1 #include <libmesh/equation_systems.h> 2 #include <libmesh/replicated_mesh.h> 3 #include <libmesh/mesh_generation.h> 4 #include <libmesh/edge_edge2.h> 5 #include <libmesh/face_quad4.h> 6 #include <libmesh/face_tri3.h> 7 #include <libmesh/cell_hex8.h> 8 #include <libmesh/dof_map.h> 9 #include <libmesh/linear_implicit_system.h> 10 #include <libmesh/mesh_refinement.h> 28 CPPUNIT_TEST( testMesh );
29 #ifdef LIBMESH_HAVE_SOLVER 30 CPPUNIT_TEST( testDofOrdering );
32 CPPUNIT_TEST( testPointLocatorTree );
35 CPPUNIT_TEST_SUITE_END();
39 std::unique_ptr<ReplicatedMesh>
_mesh;
43 _mesh = std::make_unique<ReplicatedMesh>(*TestCommWorld);
61 _mesh->set_mesh_dimension(2);
63 _mesh->add_point(
Point(0.0,-1.0), 4 );
64 _mesh->add_point(
Point(1.0,-1.0), 5 );
65 _mesh->add_point(
Point(1.0, 0.0), 1 );
66 _mesh->add_point(
Point(1.0, 1.0), 2 );
67 _mesh->add_point(
Point(0.0, 1.0), 3 );
68 _mesh->add_point(
Point(0.0, 0.0), 0 );
72 elem_top->
set_node(0, _mesh->node_ptr(0));
73 elem_top->
set_node(1, _mesh->node_ptr(1));
74 elem_top->
set_node(2, _mesh->node_ptr(2));
75 elem_top->
set_node(3, _mesh->node_ptr(3));
78 elem_bottom->
set_node(0, _mesh->node_ptr(4));
79 elem_bottom->
set_node(1, _mesh->node_ptr(5));
80 elem_bottom->
set_node(2, _mesh->node_ptr(1));
81 elem_bottom->
set_node(3, _mesh->node_ptr(0));
84 edge->
set_node(0, _mesh->node_ptr(0));
85 edge->
set_node(1, _mesh->node_ptr(1));
91 _mesh->allow_renumbering(
true);
92 _mesh->prepare_for_use();
110 CPPUNIT_ASSERT_EQUAL(static_cast<dof_id_type>(3), _mesh->n_elem());
113 CPPUNIT_ASSERT_EQUAL(static_cast<dof_id_type>(6), _mesh->n_nodes());
117 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(2).node_id(0), _mesh->elem_ref(0).node_id(0) );
118 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(2).node_id(1), _mesh->elem_ref(0).node_id(1) );
122 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(2).node_id(0), _mesh->elem_ref(1).node_id(3) );
123 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(2).node_id(1), _mesh->elem_ref(1).node_id(2) );
127 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(0).node_id(0), _mesh->elem_ref(1).node_id(3) );
128 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(0).node_id(1), _mesh->elem_ref(1).node_id(2) );
132 CPPUNIT_ASSERT( _mesh->elem_ref(2).interior_parent() );
146 std::vector<dof_id_type> top_quad_dof_indices, bottom_quad_dof_indices, edge_dof_indices;
148 dof_map.
dof_indices( _mesh->elem_ptr(0), top_quad_dof_indices );
149 dof_map.
dof_indices( _mesh->elem_ptr(1), bottom_quad_dof_indices );
150 dof_map.
dof_indices( _mesh->elem_ptr(2), edge_dof_indices );
154 CPPUNIT_ASSERT_EQUAL( edge_dof_indices[0], top_quad_dof_indices[0] );
155 CPPUNIT_ASSERT_EQUAL( edge_dof_indices[1], top_quad_dof_indices[1] );
159 CPPUNIT_ASSERT_EQUAL( edge_dof_indices[0], bottom_quad_dof_indices[3] );
160 CPPUNIT_ASSERT_EQUAL( edge_dof_indices[1], bottom_quad_dof_indices[2] );
164 CPPUNIT_ASSERT_EQUAL( top_quad_dof_indices[0], bottom_quad_dof_indices[3] );
165 CPPUNIT_ASSERT_EQUAL( top_quad_dof_indices[1], bottom_quad_dof_indices[2] );
172 std::unique_ptr<PointLocatorBase> locator = _mesh->sub_point_locator();
174 Point top_point(0.5, 0.5);
175 const Elem* top_elem = (*locator)(top_point);
176 CPPUNIT_ASSERT(top_elem);
179 CPPUNIT_ASSERT_EQUAL(static_cast<dof_id_type>(0), top_elem->
id());
181 Point bottom_point(0.5, -0.5);
182 const Elem* bottom_elem = (*locator)(bottom_point);
183 CPPUNIT_ASSERT(bottom_elem);
186 CPPUNIT_ASSERT_EQUAL(static_cast<dof_id_type>(1), bottom_elem->
id());
190 std::set<subdomain_id_type> subdomain_id; subdomain_id.insert(1);
191 Point interface_point( 0.5, 0.0 );
192 const Elem* interface_elem = (*locator)(interface_point, &subdomain_id);
193 CPPUNIT_ASSERT(interface_elem);
196 CPPUNIT_ASSERT_EQUAL(static_cast<dof_id_type>(2), interface_elem->
id());
213 CPPUNIT_TEST( testMesh );
214 #ifdef LIBMESH_HAVE_SOLVER 215 CPPUNIT_TEST( testDofOrdering );
219 CPPUNIT_TEST_SUITE_END();
242 #ifdef LIBMESH_ENABLE_AMR 250 #ifdef LIBMESH_ENABLE_AMR 254 CPPUNIT_ASSERT_EQUAL(static_cast<dof_id_type>(13), _mesh->n_elem());
255 CPPUNIT_ASSERT_EQUAL(static_cast<dof_id_type>(10), _mesh->n_active_elem());
258 CPPUNIT_ASSERT_EQUAL(static_cast<dof_id_type>(15), _mesh->n_nodes());
261 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(11).node_id(0),
262 _mesh->elem_ref(3).node_id(0) );
263 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(11).node_id(1),
264 _mesh->elem_ref(3).node_id(1) );
267 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(12).node_id(0),
268 _mesh->elem_ref(4).node_id(0) );
269 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(12).node_id(1),
270 _mesh->elem_ref(4).node_id(1) );
273 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(11).node_id(0),
274 _mesh->elem_ref(9).node_id(3) );
275 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(11).node_id(1),
276 _mesh->elem_ref(9).node_id(2) );
279 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(12).node_id(0),
280 _mesh->elem_ref(10).node_id(3) );
281 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(12).node_id(1),
282 _mesh->elem_ref(10).node_id(2) );
285 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(11).node_id(1),
286 _mesh->elem_ref(12).node_id(0) );
289 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(11).parent(),
290 _mesh->elem_ptr(2) );
291 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(12).parent(),
292 _mesh->elem_ptr(2) );
295 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(11).interior_parent(),
296 _mesh->elem_ptr(3) );
297 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(12).interior_parent(),
298 _mesh->elem_ptr(4) );
304 #ifdef LIBMESH_ENABLE_AMR 314 std::vector<dof_id_type> top_quad3_dof_indices, top_quad4_dof_indices;
315 std::vector<dof_id_type> bottom_quad9_dof_indices, bottom_quad10_dof_indices;
316 std::vector<dof_id_type> edge11_dof_indices, edge12_dof_indices;
318 dof_map.
dof_indices( _mesh->elem_ptr(3), top_quad3_dof_indices );
319 dof_map.
dof_indices( _mesh->elem_ptr(4), top_quad4_dof_indices );
320 dof_map.
dof_indices( _mesh->elem_ptr(9), bottom_quad9_dof_indices );
321 dof_map.
dof_indices( _mesh->elem_ptr(10), bottom_quad10_dof_indices );
322 dof_map.
dof_indices( _mesh->elem_ptr(11), edge11_dof_indices );
323 dof_map.
dof_indices( _mesh->elem_ptr(12), edge12_dof_indices );
326 CPPUNIT_ASSERT_EQUAL( edge11_dof_indices[0], top_quad3_dof_indices[0] );
327 CPPUNIT_ASSERT_EQUAL( edge11_dof_indices[1], top_quad3_dof_indices[1] );
330 CPPUNIT_ASSERT_EQUAL( edge12_dof_indices[0], top_quad4_dof_indices[0] );
331 CPPUNIT_ASSERT_EQUAL( edge12_dof_indices[1], top_quad4_dof_indices[1] );
334 CPPUNIT_ASSERT_EQUAL( edge11_dof_indices[0], bottom_quad9_dof_indices[3] );
335 CPPUNIT_ASSERT_EQUAL( edge11_dof_indices[1], bottom_quad9_dof_indices[2] );
338 CPPUNIT_ASSERT_EQUAL( edge12_dof_indices[0], bottom_quad10_dof_indices[3] );
339 CPPUNIT_ASSERT_EQUAL( edge12_dof_indices[1], bottom_quad10_dof_indices[2] );
342 CPPUNIT_ASSERT_EQUAL( edge11_dof_indices[1], edge12_dof_indices[0] );
360 CPPUNIT_TEST( testMesh );
361 #ifdef LIBMESH_HAVE_SOLVER 362 CPPUNIT_TEST( testDofOrdering );
366 CPPUNIT_TEST_SUITE_END();
371 std::unique_ptr<ReplicatedMesh>
_mesh;
375 _mesh = std::make_unique<ReplicatedMesh>(*TestCommWorld);
437 _mesh->set_mesh_dimension(2);
439 _mesh->add_point(
Point(0.0,0.0), 0 );
440 _mesh->add_point(
Point(1.0,0.0), 1 );
441 _mesh->add_point(
Point(1.0,1.0), 2 );
442 _mesh->add_point(
Point(0.0,1.0), 3 );
443 _mesh->add_point(
Point(0.0,2.0), 4 );
444 _mesh->add_point(
Point(1.0,2.0), 5 );
445 _mesh->add_point(
Point(0.0,-1.0), 6 );
446 _mesh->add_point(
Point(1.0,-1.0), 7 );
447 _mesh->add_point(
Point(1.0,-2.0), 8 );
448 _mesh->add_point(
Point(0.0,-2.0), 9 );
453 quad0->
set_node(0, _mesh->node_ptr(0));
454 quad0->
set_node(1, _mesh->node_ptr(1));
455 quad0->
set_node(2, _mesh->node_ptr(2));
456 quad0->
set_node(3, _mesh->node_ptr(3));
459 quad1->
set_node(0, _mesh->node_ptr(3));
460 quad1->
set_node(1, _mesh->node_ptr(2));
461 quad1->
set_node(2, _mesh->node_ptr(5));
462 quad1->
set_node(3, _mesh->node_ptr(4));
465 quad2->
set_node(0, _mesh->node_ptr(6));
466 quad2->
set_node(1, _mesh->node_ptr(7));
467 quad2->
set_node(2, _mesh->node_ptr(1));
468 quad2->
set_node(3, _mesh->node_ptr(0));
471 quad3->
set_node(0, _mesh->node_ptr(9));
472 quad3->
set_node(1, _mesh->node_ptr(8));
473 quad3->
set_node(2, _mesh->node_ptr(7));
474 quad3->
set_node(3, _mesh->node_ptr(6));
477 edge->
set_node(0, _mesh->node_ptr(0));
478 edge->
set_node(1, _mesh->node_ptr(1));
484 _mesh->allow_renumbering(
true);
485 _mesh->prepare_for_use();
488 #ifdef LIBMESH_ENABLE_AMR 508 #ifdef LIBMESH_ENABLE_AMR 512 CPPUNIT_ASSERT_EQUAL(static_cast<dof_id_type>(15), _mesh->n_elem());
513 CPPUNIT_ASSERT_EQUAL(static_cast<dof_id_type>(12), _mesh->n_active_elem());
516 CPPUNIT_ASSERT_EQUAL(static_cast<dof_id_type>(19), _mesh->n_nodes());
519 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(13).node_id(0),
520 _mesh->elem_ref(5).node_id(0) );
521 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(13).node_id(1),
522 _mesh->elem_ref(5).node_id(1) );
525 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(14).node_id(0),
526 _mesh->elem_ref(6).node_id(0) );
527 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(14).node_id(1),
528 _mesh->elem_ref(6).node_id(1) );
531 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(13).node_id(0),
532 _mesh->elem_ref(11).node_id(3) );
533 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(13).node_id(1),
534 _mesh->elem_ref(11).node_id(2) );
537 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(14).node_id(0),
538 _mesh->elem_ref(12).node_id(3) );
539 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(14).node_id(1),
540 _mesh->elem_ref(12).node_id(2) );
543 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(13).node_id(1),
544 _mesh->elem_ref(14).node_id(0) );
547 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(13).parent(),
548 _mesh->elem_ptr(4) );
549 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(14).parent(),
550 _mesh->elem_ptr(4) );
553 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(13).interior_parent(),
554 _mesh->elem_ptr(5) );
555 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(14).interior_parent(),
556 _mesh->elem_ptr(6) );
562 #ifdef LIBMESH_ENABLE_AMR 572 std::vector<dof_id_type> top_quad5_dof_indices, top_quad6_dof_indices;
573 std::vector<dof_id_type> bottom_quad11_dof_indices, bottom_quad12_dof_indices;
574 std::vector<dof_id_type> edge13_dof_indices, edge14_dof_indices;
576 dof_map.
dof_indices( _mesh->elem_ptr(5), top_quad5_dof_indices );
577 dof_map.
dof_indices( _mesh->elem_ptr(6), top_quad6_dof_indices );
578 dof_map.
dof_indices( _mesh->elem_ptr(11), bottom_quad11_dof_indices );
579 dof_map.
dof_indices( _mesh->elem_ptr(12), bottom_quad12_dof_indices );
580 dof_map.
dof_indices( _mesh->elem_ptr(13), edge13_dof_indices );
581 dof_map.
dof_indices( _mesh->elem_ptr(14), edge14_dof_indices );
584 CPPUNIT_ASSERT_EQUAL( edge13_dof_indices[0], top_quad5_dof_indices[0] );
585 CPPUNIT_ASSERT_EQUAL( edge13_dof_indices[1], top_quad5_dof_indices[1] );
588 CPPUNIT_ASSERT_EQUAL( edge14_dof_indices[0], top_quad6_dof_indices[0] );
589 CPPUNIT_ASSERT_EQUAL( edge14_dof_indices[1], top_quad6_dof_indices[1] );
592 CPPUNIT_ASSERT_EQUAL( edge13_dof_indices[0], bottom_quad11_dof_indices[3] );
593 CPPUNIT_ASSERT_EQUAL( edge13_dof_indices[1], bottom_quad11_dof_indices[2] );
596 CPPUNIT_ASSERT_EQUAL( edge14_dof_indices[0], bottom_quad12_dof_indices[3] );
597 CPPUNIT_ASSERT_EQUAL( edge14_dof_indices[1], bottom_quad12_dof_indices[2] );
600 CPPUNIT_ASSERT_EQUAL( edge13_dof_indices[1], edge14_dof_indices[0] );
617 CPPUNIT_TEST( testMesh );
618 #ifdef LIBMESH_HAVE_SOLVER 619 CPPUNIT_TEST( testDofOrdering );
623 CPPUNIT_TEST_SUITE_END();
627 std::unique_ptr<ReplicatedMesh>
_mesh;
631 _mesh = std::make_unique<ReplicatedMesh>(*TestCommWorld);
673 _mesh->set_mesh_dimension(2);
675 _mesh->add_point(
Point(0.0,-1.0), 4 );
676 _mesh->add_point(
Point(1.0,-1.0), 5 );
677 _mesh->add_point(
Point(1.0, 0.0), 1 );
678 _mesh->add_point(
Point(1.0, 1.0), 2 );
679 _mesh->add_point(
Point(0.0, 1.0), 3 );
680 _mesh->add_point(
Point(0.0, 0.0), 0 );
684 elem0->
set_node(0, _mesh->node_ptr(0));
685 elem0->
set_node(1, _mesh->node_ptr(1));
686 elem0->
set_node(2, _mesh->node_ptr(2));
689 elem1->
set_node(0, _mesh->node_ptr(2));
690 elem1->
set_node(1, _mesh->node_ptr(3));
691 elem1->
set_node(2, _mesh->node_ptr(0));
694 elem2->
set_node(0, _mesh->node_ptr(1));
695 elem2->
set_node(1, _mesh->node_ptr(0));
696 elem2->
set_node(2, _mesh->node_ptr(4));
699 elem3->
set_node(0, _mesh->node_ptr(4));
700 elem3->
set_node(1, _mesh->node_ptr(5));
701 elem3->
set_node(2, _mesh->node_ptr(1));
704 edge->
set_node(0, _mesh->node_ptr(0));
705 edge->
set_node(1, _mesh->node_ptr(1));
712 _mesh->allow_renumbering(
true);
713 _mesh->prepare_for_use();
715 #ifdef LIBMESH_ENABLE_AMR 734 #ifdef LIBMESH_ENABLE_AMR 738 CPPUNIT_ASSERT_EQUAL(static_cast<dof_id_type>(15), _mesh->n_elem());
739 CPPUNIT_ASSERT_EQUAL(static_cast<dof_id_type>(12), _mesh->n_active_elem());
742 CPPUNIT_ASSERT_EQUAL(static_cast<dof_id_type>(11), _mesh->n_nodes());
745 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(13).node_id(0),
746 _mesh->elem_ref(5).node_id(0) );
747 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(13).node_id(1),
748 _mesh->elem_ref(5).node_id(1) );
751 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(13).node_id(0),
752 _mesh->elem_ref(10).node_id(1) );
753 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(13).node_id(1),
754 _mesh->elem_ref(10).node_id(0) );
757 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(13).node_id(1),
758 _mesh->elem_ref(8).node_id(0) );
759 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(13).node_id(1),
760 _mesh->elem_ref(12).node_id(0) );
763 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(14).node_id(0),
764 _mesh->elem_ref(6).node_id(0) );
765 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(14).node_id(1),
766 _mesh->elem_ref(6).node_id(1) );
769 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(14).node_id(0),
770 _mesh->elem_ref(9).node_id(1) );
771 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(14).node_id(1),
772 _mesh->elem_ref(9).node_id(0) );
775 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(14).node_id(0),
776 _mesh->elem_ref(8).node_id(0) );
777 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(14).node_id(0),
778 _mesh->elem_ref(12).node_id(0) );
781 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(13).node_id(1),
782 _mesh->elem_ref(14).node_id(0) );
785 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(13).parent(),
786 _mesh->elem_ptr(4) );
787 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(14).parent(),
788 _mesh->elem_ptr(4) );
791 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(13).interior_parent(),
792 _mesh->elem_ptr(5) );
793 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(14).interior_parent(),
794 _mesh->elem_ptr(6) );
796 #endif // LIBMESH_ENABLE_AMR 801 #ifdef LIBMESH_ENABLE_AMR 812 std::vector<dof_id_type> elem5_dof_indices, elem6_dof_indices, elem8_dof_indices;
815 std::vector<dof_id_type> elem9_dof_indices, elem10_dof_indices, elem12_dof_indices;
818 std::vector<dof_id_type> elem13_dof_indices, elem14_dof_indices;
820 dof_map.
dof_indices( _mesh->elem_ptr(5), elem5_dof_indices );
821 dof_map.
dof_indices( _mesh->elem_ptr(6), elem6_dof_indices );
822 dof_map.
dof_indices( _mesh->elem_ptr(8), elem8_dof_indices );
823 dof_map.
dof_indices( _mesh->elem_ptr(9), elem9_dof_indices );
824 dof_map.
dof_indices( _mesh->elem_ptr(10), elem10_dof_indices );
825 dof_map.
dof_indices( _mesh->elem_ptr(12), elem12_dof_indices );
826 dof_map.
dof_indices( _mesh->elem_ptr(13), elem13_dof_indices );
827 dof_map.
dof_indices( _mesh->elem_ptr(14), elem14_dof_indices );
832 CPPUNIT_ASSERT_EQUAL( elem13_dof_indices[0], elem5_dof_indices[0] );
833 CPPUNIT_ASSERT_EQUAL( elem13_dof_indices[1], elem5_dof_indices[1] );
834 CPPUNIT_ASSERT_EQUAL( elem13_dof_indices[1], elem6_dof_indices[0] );
835 CPPUNIT_ASSERT_EQUAL( elem13_dof_indices[1], elem8_dof_indices[0] );
836 CPPUNIT_ASSERT_EQUAL( elem14_dof_indices[0], elem6_dof_indices[0] );
837 CPPUNIT_ASSERT_EQUAL( elem14_dof_indices[1], elem6_dof_indices[1] );
838 CPPUNIT_ASSERT_EQUAL( elem14_dof_indices[0], elem5_dof_indices[1] );
839 CPPUNIT_ASSERT_EQUAL( elem14_dof_indices[0], elem8_dof_indices[0] );
844 CPPUNIT_ASSERT_EQUAL( elem13_dof_indices[0], elem10_dof_indices[1] );
845 CPPUNIT_ASSERT_EQUAL( elem13_dof_indices[1], elem10_dof_indices[0] );
846 CPPUNIT_ASSERT_EQUAL( elem13_dof_indices[1], elem9_dof_indices[1] );
847 CPPUNIT_ASSERT_EQUAL( elem13_dof_indices[1], elem12_dof_indices[0] );
848 CPPUNIT_ASSERT_EQUAL( elem14_dof_indices[0], elem9_dof_indices[1] );
849 CPPUNIT_ASSERT_EQUAL( elem14_dof_indices[1], elem9_dof_indices[0] );
850 CPPUNIT_ASSERT_EQUAL( elem14_dof_indices[0], elem10_dof_indices[0] );
851 CPPUNIT_ASSERT_EQUAL( elem14_dof_indices[0], elem12_dof_indices[0] );
855 CPPUNIT_ASSERT_EQUAL( elem5_dof_indices[0], elem10_dof_indices[1] );
856 CPPUNIT_ASSERT_EQUAL( elem5_dof_indices[1], elem10_dof_indices[0] );
857 CPPUNIT_ASSERT_EQUAL( elem6_dof_indices[0], elem9_dof_indices[1] );
858 CPPUNIT_ASSERT_EQUAL( elem6_dof_indices[1], elem9_dof_indices[0] );
859 CPPUNIT_ASSERT_EQUAL( elem8_dof_indices[0], elem12_dof_indices[0] );
860 #endif // LIBMESH_ENABLE_AMR 877 CPPUNIT_TEST( testMesh );
878 #ifdef LIBMESH_HAVE_SOLVER 879 CPPUNIT_TEST( testDofOrdering );
883 CPPUNIT_TEST_SUITE_END();
888 std::unique_ptr<ReplicatedMesh>
_mesh;
892 _mesh = std::make_unique<ReplicatedMesh>(*TestCommWorld);
894 _mesh->set_mesh_dimension(3);
897 for (
unsigned int z = 0; z < 5; z++)
899 for (
unsigned int y = 0; y < 4; y++)
901 for (
unsigned int x = 0; x < 4; x++)
910 for (
unsigned int z = 0; z < 4; z++)
912 for (
unsigned int y = 0; y < 3; y++)
914 for (
unsigned int x = 0; x < 3; x++)
917 hex->
set_node(0, _mesh->node_ptr(x+4*y +16*z ));
918 hex->
set_node(1, _mesh->node_ptr(x+4*y +16*z + 1));
919 hex->
set_node(2, _mesh->node_ptr(x+4*(y+1)+16*z + 1));
920 hex->
set_node(3, _mesh->node_ptr(x+4*(y+1)+16*z ));
921 hex->
set_node(4, _mesh->node_ptr(x+4*y +16*(z+1) ));
922 hex->
set_node(5, _mesh->node_ptr(x+4*y +16*(z+1) + 1));
923 hex->
set_node(6, _mesh->node_ptr(x+4*(y+1)+16*(z+1) + 1));
924 hex->
set_node(7, _mesh->node_ptr(x+4*(y+1)+16*(z+1) ));
929 unsigned int x=1,y=1,z=2;
930 quad->
set_node(0, _mesh->node_ptr(x+4*y +16*z ));
931 quad->
set_node(1, _mesh->node_ptr(x+4*y +16*z + 1));
932 quad->
set_node(2, _mesh->node_ptr(x+4*(y+1)+16*z + 1));
933 quad->
set_node(3, _mesh->node_ptr(x+4*(y+1)+16*z ));
939 _mesh->allow_renumbering(
true);
940 _mesh->prepare_for_use();
942 #ifdef LIBMESH_ENABLE_AMR 961 #ifdef LIBMESH_ENABLE_AMR 965 CPPUNIT_ASSERT_EQUAL(static_cast<dof_id_type>(57), _mesh->n_elem() );
966 CPPUNIT_ASSERT_EQUAL(static_cast<dof_id_type>(54), _mesh->n_active_elem() );
969 CPPUNIT_ASSERT_EQUAL(static_cast<dof_id_type>(113), _mesh->n_nodes() );
972 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(53).node_id(0),
973 _mesh->elem_ref(41).node_id(4) );
974 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(53).node_id(1),
975 _mesh->elem_ref(41).node_id(5) );
976 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(53).node_id(2),
977 _mesh->elem_ref(41).node_id(6) );
978 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(53).node_id(3),
979 _mesh->elem_ref(41).node_id(7) );
982 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(53).node_id(0),
983 _mesh->elem_ref(45).node_id(0) );
984 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(53).node_id(1),
985 _mesh->elem_ref(45).node_id(1) );
986 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(53).node_id(2),
987 _mesh->elem_ref(45).node_id(2) );
988 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(53).node_id(3),
989 _mesh->elem_ref(45).node_id(3) );
992 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(54).node_id(0),
993 _mesh->elem_ref(42).node_id(4) );
994 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(54).node_id(1),
995 _mesh->elem_ref(42).node_id(5) );
996 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(54).node_id(2),
997 _mesh->elem_ref(42).node_id(6) );
998 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(54).node_id(3),
999 _mesh->elem_ref(42).node_id(7) );
1002 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(54).node_id(0),
1003 _mesh->elem_ref(46).node_id(0) );
1004 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(54).node_id(1),
1005 _mesh->elem_ref(46).node_id(1) );
1006 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(54).node_id(2),
1007 _mesh->elem_ref(46).node_id(2) );
1008 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(54).node_id(3),
1009 _mesh->elem_ref(46).node_id(3) );
1012 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(55).node_id(0),
1013 _mesh->elem_ref(43).node_id(4) );
1014 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(55).node_id(1),
1015 _mesh->elem_ref(43).node_id(5) );
1016 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(55).node_id(2),
1017 _mesh->elem_ref(43).node_id(6) );
1018 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(55).node_id(3),
1019 _mesh->elem_ref(43).node_id(7) );
1022 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(55).node_id(0),
1023 _mesh->elem_ref(47).node_id(0) );
1024 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(55).node_id(1),
1025 _mesh->elem_ref(47).node_id(1) );
1026 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(55).node_id(2),
1027 _mesh->elem_ref(47).node_id(2) );
1028 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(55).node_id(3),
1029 _mesh->elem_ref(47).node_id(3) );
1032 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(56).node_id(0),
1033 _mesh->elem_ref(44).node_id(4) );
1034 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(56).node_id(1),
1035 _mesh->elem_ref(44).node_id(5) );
1036 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(56).node_id(2),
1037 _mesh->elem_ref(44).node_id(6) );
1038 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(56).node_id(3),
1039 _mesh->elem_ref(44).node_id(7) );
1042 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(56).node_id(0),
1043 _mesh->elem_ref(48).node_id(0) );
1044 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(56).node_id(1),
1045 _mesh->elem_ref(48).node_id(1) );
1046 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(56).node_id(2),
1047 _mesh->elem_ref(48).node_id(2) );
1048 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(56).node_id(3),
1049 _mesh->elem_ref(48).node_id(3) );
1052 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(53).node_id(1),
1053 _mesh->elem_ref(54).node_id(0) );
1054 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(53).node_id(2),
1055 _mesh->elem_ref(54).node_id(3) );
1056 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(53).node_id(3),
1057 _mesh->elem_ref(55).node_id(0) );
1058 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(53).node_id(2),
1059 _mesh->elem_ref(55).node_id(1) );
1060 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(54).node_id(3),
1061 _mesh->elem_ref(56).node_id(0) );
1062 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(54).node_id(2),
1063 _mesh->elem_ref(56).node_id(1) );
1064 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(55).node_id(1),
1065 _mesh->elem_ref(56).node_id(0) );
1066 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(55).node_id(2),
1067 _mesh->elem_ref(56).node_id(3) );
1070 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(53).parent(),
1071 _mesh->elem_ptr(36) );
1072 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(54).parent(),
1073 _mesh->elem_ptr(36) );
1074 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(55).parent(),
1075 _mesh->elem_ptr(36) );
1076 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(56).parent(),
1077 _mesh->elem_ptr(36) );
1080 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(53).interior_parent(),
1081 _mesh->elem_ptr(41) );
1082 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(54).interior_parent(),
1083 _mesh->elem_ptr(42) );
1084 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(55).interior_parent(),
1085 _mesh->elem_ptr(43) );
1086 CPPUNIT_ASSERT_EQUAL( _mesh->elem_ref(56).interior_parent(),
1087 _mesh->elem_ptr(44) );
1094 #ifdef LIBMESH_ENABLE_AMR 1105 std::vector<dof_id_type> elem41_dof_indices, elem42_dof_indices, elem43_dof_indices, elem44_dof_indices;
1107 std::vector<dof_id_type> elem45_dof_indices, elem46_dof_indices, elem47_dof_indices, elem48_dof_indices;
1109 std::vector<dof_id_type> elem53_dof_indices, elem54_dof_indices, elem55_dof_indices, elem56_dof_indices;
1111 dof_map.
dof_indices( _mesh->elem_ptr(41), elem41_dof_indices );
1112 dof_map.
dof_indices( _mesh->elem_ptr(42), elem42_dof_indices );
1113 dof_map.
dof_indices( _mesh->elem_ptr(43), elem43_dof_indices );
1114 dof_map.
dof_indices( _mesh->elem_ptr(44), elem44_dof_indices );
1115 dof_map.
dof_indices( _mesh->elem_ptr(45), elem45_dof_indices );
1116 dof_map.
dof_indices( _mesh->elem_ptr(46), elem46_dof_indices );
1117 dof_map.
dof_indices( _mesh->elem_ptr(47), elem47_dof_indices );
1118 dof_map.
dof_indices( _mesh->elem_ptr(48), elem48_dof_indices );
1119 dof_map.
dof_indices( _mesh->elem_ptr(53), elem53_dof_indices );
1120 dof_map.
dof_indices( _mesh->elem_ptr(54), elem54_dof_indices );
1121 dof_map.
dof_indices( _mesh->elem_ptr(55), elem55_dof_indices );
1122 dof_map.
dof_indices( _mesh->elem_ptr(56), elem56_dof_indices );
1127 CPPUNIT_ASSERT_EQUAL( elem53_dof_indices[0], elem41_dof_indices[4] );
1128 CPPUNIT_ASSERT_EQUAL( elem53_dof_indices[1], elem41_dof_indices[5] );
1129 CPPUNIT_ASSERT_EQUAL( elem53_dof_indices[2], elem41_dof_indices[6] );
1130 CPPUNIT_ASSERT_EQUAL( elem53_dof_indices[3], elem41_dof_indices[7] );
1132 CPPUNIT_ASSERT_EQUAL( elem54_dof_indices[0], elem42_dof_indices[4] );
1133 CPPUNIT_ASSERT_EQUAL( elem54_dof_indices[1], elem42_dof_indices[5] );
1134 CPPUNIT_ASSERT_EQUAL( elem54_dof_indices[2], elem42_dof_indices[6] );
1135 CPPUNIT_ASSERT_EQUAL( elem54_dof_indices[3], elem42_dof_indices[7] );
1137 CPPUNIT_ASSERT_EQUAL( elem55_dof_indices[0], elem43_dof_indices[4] );
1138 CPPUNIT_ASSERT_EQUAL( elem55_dof_indices[1], elem43_dof_indices[5] );
1139 CPPUNIT_ASSERT_EQUAL( elem55_dof_indices[2], elem43_dof_indices[6] );
1140 CPPUNIT_ASSERT_EQUAL( elem55_dof_indices[3], elem43_dof_indices[7] );
1142 CPPUNIT_ASSERT_EQUAL( elem56_dof_indices[0], elem44_dof_indices[4] );
1143 CPPUNIT_ASSERT_EQUAL( elem56_dof_indices[1], elem44_dof_indices[5] );
1144 CPPUNIT_ASSERT_EQUAL( elem56_dof_indices[2], elem44_dof_indices[6] );
1145 CPPUNIT_ASSERT_EQUAL( elem56_dof_indices[3], elem44_dof_indices[7] );
1150 CPPUNIT_ASSERT_EQUAL( elem53_dof_indices[0], elem45_dof_indices[0] );
1151 CPPUNIT_ASSERT_EQUAL( elem53_dof_indices[1], elem45_dof_indices[1] );
1152 CPPUNIT_ASSERT_EQUAL( elem53_dof_indices[2], elem45_dof_indices[2] );
1153 CPPUNIT_ASSERT_EQUAL( elem53_dof_indices[3], elem45_dof_indices[3] );
1155 CPPUNIT_ASSERT_EQUAL( elem54_dof_indices[0], elem46_dof_indices[0] );
1156 CPPUNIT_ASSERT_EQUAL( elem54_dof_indices[1], elem46_dof_indices[1] );
1157 CPPUNIT_ASSERT_EQUAL( elem54_dof_indices[2], elem46_dof_indices[2] );
1158 CPPUNIT_ASSERT_EQUAL( elem54_dof_indices[3], elem46_dof_indices[3] );
1160 CPPUNIT_ASSERT_EQUAL( elem55_dof_indices[0], elem47_dof_indices[0] );
1161 CPPUNIT_ASSERT_EQUAL( elem55_dof_indices[1], elem47_dof_indices[1] );
1162 CPPUNIT_ASSERT_EQUAL( elem55_dof_indices[2], elem47_dof_indices[2] );
1163 CPPUNIT_ASSERT_EQUAL( elem55_dof_indices[3], elem47_dof_indices[3] );
1165 CPPUNIT_ASSERT_EQUAL( elem56_dof_indices[0], elem48_dof_indices[0] );
1166 CPPUNIT_ASSERT_EQUAL( elem56_dof_indices[1], elem48_dof_indices[1] );
1167 CPPUNIT_ASSERT_EQUAL( elem56_dof_indices[2], elem48_dof_indices[2] );
1168 CPPUNIT_ASSERT_EQUAL( elem56_dof_indices[3], elem48_dof_indices[3] );
1173 CPPUNIT_ASSERT_EQUAL( elem41_dof_indices[4], elem45_dof_indices[0] );
1174 CPPUNIT_ASSERT_EQUAL( elem41_dof_indices[5], elem45_dof_indices[1] );
1175 CPPUNIT_ASSERT_EQUAL( elem41_dof_indices[6], elem45_dof_indices[2] );
1176 CPPUNIT_ASSERT_EQUAL( elem41_dof_indices[7], elem45_dof_indices[3] );
1178 CPPUNIT_ASSERT_EQUAL( elem42_dof_indices[4], elem46_dof_indices[0] );
1179 CPPUNIT_ASSERT_EQUAL( elem42_dof_indices[5], elem46_dof_indices[1] );
1180 CPPUNIT_ASSERT_EQUAL( elem42_dof_indices[6], elem46_dof_indices[2] );
1181 CPPUNIT_ASSERT_EQUAL( elem42_dof_indices[7], elem46_dof_indices[3] );
1183 CPPUNIT_ASSERT_EQUAL( elem43_dof_indices[4], elem47_dof_indices[0] );
1184 CPPUNIT_ASSERT_EQUAL( elem43_dof_indices[5], elem47_dof_indices[1] );
1185 CPPUNIT_ASSERT_EQUAL( elem43_dof_indices[6], elem47_dof_indices[2] );
1186 CPPUNIT_ASSERT_EQUAL( elem43_dof_indices[7], elem47_dof_indices[3] );
1188 CPPUNIT_ASSERT_EQUAL( elem44_dof_indices[4], elem48_dof_indices[0] );
1189 CPPUNIT_ASSERT_EQUAL( elem44_dof_indices[5], elem48_dof_indices[1] );
1190 CPPUNIT_ASSERT_EQUAL( elem44_dof_indices[6], elem48_dof_indices[2] );
1191 CPPUNIT_ASSERT_EQUAL( elem44_dof_indices[7], elem48_dof_indices[3] );
1195 CPPUNIT_ASSERT_EQUAL( elem53_dof_indices[1], elem54_dof_indices[0] );
1196 CPPUNIT_ASSERT_EQUAL( elem53_dof_indices[2], elem54_dof_indices[3] );
1197 CPPUNIT_ASSERT_EQUAL( elem53_dof_indices[3], elem55_dof_indices[0] );
1198 CPPUNIT_ASSERT_EQUAL( elem53_dof_indices[2], elem55_dof_indices[1] );
1199 CPPUNIT_ASSERT_EQUAL( elem53_dof_indices[2], elem56_dof_indices[0] );
1200 CPPUNIT_ASSERT_EQUAL( elem54_dof_indices[3], elem55_dof_indices[1] );
1201 CPPUNIT_ASSERT_EQUAL( elem54_dof_indices[3], elem56_dof_indices[0] );
1202 CPPUNIT_ASSERT_EQUAL( elem54_dof_indices[2], elem56_dof_indices[1] );
1203 CPPUNIT_ASSERT_EQUAL( elem55_dof_indices[1], elem56_dof_indices[0] );
1204 CPPUNIT_ASSERT_EQUAL( elem55_dof_indices[2], elem56_dof_indices[3] );
CPPUNIT_TEST_SUITE_REGISTRATION(MixedDimensionMeshTest)
This is the EquationSystems class.
virtual Node *& set_node(const unsigned int i)
void dof_indices(const Elem *const elem, std::vector< dof_id_type > &di) const
Manages consistently variables, degrees of freedom, coefficient vectors, matrices and linear solvers ...
This is the base class from which all geometric element types are derived.
The libMesh namespace provides an interface to certain functionality in the library.
const T_sys & get_system(std::string_view name) const
This class handles the numbering of degrees of freedom on a mesh.
Implements (adaptive) mesh refinement algorithms for a MeshBase.
static std::unique_ptr< Elem > build(const ElemType type, Elem *p=nullptr)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
subdomain_id_type subdomain_id() const
bool refine_and_coarsen_elements()
Refines and coarsens user-requested elements.
std::unique_ptr< ReplicatedMesh > _mesh
void testPointLocatorTree()
virtual void init()
Initialize all the systems.
virtual System & add_system(std::string_view system_type, std::string_view name)
Add the system of type system_type named name to the systems array.
A Point defines a location in LIBMESH_DIM dimensional Real space.
void uniformly_refine(unsigned int n=1)
Uniformly refines the mesh n times.