libMesh
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
MixedOrderTest Class Reference
Inheritance diagram for MixedOrderTest:
[legend]

Public Member Functions

 LIBMESH_CPPUNIT_TEST_SUITE (MixedOrderTest)
 The goal of this test set is to test libMesh manipulation of meshes with mixed Elem orders.
 
 CPPUNIT_TEST (testFindNeighbors)
 
 CPPUNIT_TEST (testStitch)
 
 CPPUNIT_TEST_SUITE_END ()
 
void setUp ()
 
void tearDown ()
 
void testFindNeighbors ()
 
void testStitch ()
 

Static Public Member Functions

static int n_neighbor_links (const MeshBase &mesh)
 

Detailed Description

Definition at line 15 of file mixed_order_test.C.

Member Function Documentation

◆ CPPUNIT_TEST() [1/2]

MixedOrderTest::CPPUNIT_TEST ( testFindNeighbors  )

◆ CPPUNIT_TEST() [2/2]

MixedOrderTest::CPPUNIT_TEST ( testStitch  )

◆ CPPUNIT_TEST_SUITE_END()

MixedOrderTest::CPPUNIT_TEST_SUITE_END ( )

◆ LIBMESH_CPPUNIT_TEST_SUITE()

MixedOrderTest::LIBMESH_CPPUNIT_TEST_SUITE ( MixedOrderTest  )

The goal of this test set is to test libMesh manipulation of meshes with mixed Elem orders.

◆ n_neighbor_links()

static int MixedOrderTest::n_neighbor_links ( const MeshBase mesh)
inlinestatic

Definition at line 34 of file mixed_order_test.C.

35 {
36 int n_neighbors = 0;
37 for (const auto & elem : mesh.local_element_ptr_range())
38 for (const auto & neigh : elem->neighbor_ptr_range())
39 if (neigh)
40 ++n_neighbors;
41 mesh.comm().sum(n_neighbors);
42 return n_neighbors;
43 }
const Parallel::Communicator & comm() const
MeshBase & mesh

References libMesh::ParallelObject::comm(), mesh, and libMesh::Parallel::Communicator::sum().

Referenced by testFindNeighbors(), and testStitch().

◆ setUp()

void MixedOrderTest::setUp ( )
inline

Definition at line 30 of file mixed_order_test.C.

30{}

◆ tearDown()

void MixedOrderTest::tearDown ( )
inline

Definition at line 32 of file mixed_order_test.C.

32{}

◆ testFindNeighbors()

void MixedOrderTest::testFindNeighbors ( )
inline

Definition at line 46 of file mixed_order_test.C.

47 {
48 LOG_UNIT_TEST;
49
50 Mesh mesh(*TestCommWorld);
51
52 // Construct a multi-element Tri3 mesh
54 /*nx=*/3, /*ny=*/3,
55 /*xmin=*/0., /*xmax=*/1.,
56 /*ymin=*/0., /*ymax=*/1.,
57 /*elem_type=*/TRI3);
58
59 // Make some of them into Tri6
60 auto range_start = mesh.elements_begin();
61 const auto range_end = mesh.elements_end();
62 while (range_start != range_end && (*range_start)->id() < 5)
63 ++range_start;
64
65 const int old_n_neighbors = n_neighbor_links(mesh);
66
67 mesh.all_second_order_range({range_start,range_end},
68 /*full_ordered=*/true);
69 const int new_n_neighbors = n_neighbor_links(mesh);
70 CPPUNIT_ASSERT_EQUAL(old_n_neighbors, new_n_neighbors);
71
73 const int newer_n_neighbors = n_neighbor_links(mesh);
74 CPPUNIT_ASSERT_EQUAL(old_n_neighbors, newer_n_neighbors);
75 }
static int n_neighbor_links(const MeshBase &mesh)
virtual void all_second_order_range(const SimpleRange< element_iterator > &range, const bool full_ordered=true)=0
Converts a set of this Mesh's elements defined by range from FIRST order to SECOND order.
virtual void find_neighbors(const bool reset_remote_elements=false, const bool reset_current_list=true, const bool assert_valid=true)=0
Locate element face (edge in 2D) neighbors.
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
Definition mesh.h:51
void build_square(UnstructuredMesh &mesh, const unsigned int nx, const unsigned int ny, const Real xmin=0., const Real xmax=1., const Real ymin=0., const Real ymax=1., const ElemType type=INVALID_ELEM, const bool gauss_lobatto_grid=false)
A specialized build_cube() for 2D meshes.

References libMesh::MeshBase::all_second_order_range(), libMesh::MeshTools::Generation::build_square(), libMesh::MeshBase::find_neighbors(), mesh, n_neighbor_links(), TestCommWorld, and libMesh::TRI3.

◆ testStitch()

void MixedOrderTest::testStitch ( )
inline

Definition at line 77 of file mixed_order_test.C.

78 {
79 LOG_UNIT_TEST;
80
81 Mesh mesh0(*TestCommWorld),
82 mesh1(*TestCommWorld);
83
84 // Quad4 mesh and Quad9 mesh
86 /*nx=*/3, /*ny=*/3,
87 /*xmin=*/0., /*xmax=*/1.,
88 /*ymin=*/0., /*ymax=*/1.,
89 /*elem_type=*/QUAD4);
90 CPPUNIT_ASSERT_EQUAL(mesh0.n_nodes(), dof_id_type(16));
91
93 /*nx=*/3, /*ny=*/3,
94 /*xmin=*/-1., /*xmax=*/0.,
95 /*ymin=*/0., /*ymax=*/1.,
96 /*elem_type=*/QUAD9);
97 CPPUNIT_ASSERT_EQUAL(mesh1.n_nodes(), dof_id_type(49));
98
99 // Stitch them together
100 mesh0.stitch_meshes(mesh1, 3, 1, TOLERANCE, /*clear_bcids*/ true,
101 /*verbose*/ false, /*binary_search*/ false,
102 /*enforce_all_nodes_match*/ false,
103 /*merge_all_or_nothing*/ false);
104 CPPUNIT_ASSERT_EQUAL(mesh0.n_nodes(), dof_id_type(61));
105
106 const int stitched_n_neighbors = n_neighbor_links(mesh0);
107 CPPUNIT_ASSERT_EQUAL(stitched_n_neighbors, 54);
108
109 mesh0.all_second_order_range(mesh0.element_ptr_range(),
110 /*full_ordered=*/true);
111 const int new_n_neighbors = n_neighbor_links(mesh0);
112 CPPUNIT_ASSERT_EQUAL(new_n_neighbors, 54);
113 }
static constexpr Real TOLERANCE
uint8_t dof_id_type
Definition id_types.h:67

References libMesh::MeshTools::Generation::build_square(), n_neighbor_links(), libMesh::DistributedMesh::n_nodes(), libMesh::QUAD4, libMesh::QUAD9, TestCommWorld, and libMesh::TOLERANCE.


The documentation for this class was generated from the following file: