libMesh
Public Types | Public Member Functions | Protected Member Functions | List of all members
MeshGenerationTest Class Reference
Inheritance diagram for MeshGenerationTest:
[legend]

Public Types

typedef void(MeshGenerationTest::* Builder) (UnstructuredMesh &, unsigned int, ElemType)
 

Public Member Functions

 LIBMESH_CPPUNIT_TEST_SUITE (MeshGenerationTest)
 The goal of this test is to verify proper operation of MeshGeneration functions, as well as to indirectly verify the MeshBase functions they rely on. More...
 
 CPPUNIT_TEST (buildLineEdge2)
 
 CPPUNIT_TEST (buildLineEdge3)
 
 CPPUNIT_TEST (buildLineEdge4)
 
 CPPUNIT_TEST (buildSphereEdge2)
 
 CPPUNIT_TEST (buildSphereEdge3)
 
 CPPUNIT_TEST (buildSquareTri3)
 
 CPPUNIT_TEST (buildSquareTri6)
 
 CPPUNIT_TEST (buildSquareTri7)
 
 CPPUNIT_TEST (buildSquareQuad4)
 
 CPPUNIT_TEST (buildSquareQuad8)
 
 CPPUNIT_TEST (buildSquareQuad9)
 
 CPPUNIT_TEST (buildSphereTri3)
 
 CPPUNIT_TEST (buildSphereQuad4)
 
 CPPUNIT_TEST (buildCubeTet4)
 
 CPPUNIT_TEST (buildCubeTet10)
 
 CPPUNIT_TEST (buildCubeTet14)
 
 CPPUNIT_TEST (buildCubeHex8)
 
 CPPUNIT_TEST (buildCubeHex20)
 
 CPPUNIT_TEST (buildCubeHex27)
 
 CPPUNIT_TEST (buildCubePrism6)
 
 CPPUNIT_TEST (buildCubePrism15)
 
 CPPUNIT_TEST (buildCubePrism18)
 
 CPPUNIT_TEST (buildCubePrism20)
 
 CPPUNIT_TEST (buildCubePrism21)
 
 CPPUNIT_TEST (buildCubePyramid5)
 
 CPPUNIT_TEST (buildCubePyramid13)
 
 CPPUNIT_TEST (buildCubePyramid14)
 
 CPPUNIT_TEST (buildSphereHex27)
 
 CPPUNIT_TEST (buildSphereHex8)
 
 CPPUNIT_TEST_SUITE_END ()
 
void setUp ()
 
void tearDown ()
 
void testBuildLine (UnstructuredMesh &mesh, unsigned int n, ElemType type)
 
void testBuildSquare (UnstructuredMesh &mesh, unsigned int n, ElemType type)
 
void testBuildCube (UnstructuredMesh &mesh, unsigned int n, ElemType type)
 
void testBuildSphere (unsigned int n_ref, ElemType type)
 
void tester (Builder f, unsigned int n, ElemType type)
 
void buildLineEdge2 ()
 
void buildLineEdge3 ()
 
void buildLineEdge4 ()
 
void buildSphereEdge2 ()
 
void buildSphereEdge3 ()
 
void buildSphereEdge4 ()
 
void buildSquareTri3 ()
 
void buildSquareTri6 ()
 
void buildSquareTri7 ()
 
void buildSquareQuad4 ()
 
void buildSquareQuad8 ()
 
void buildSquareQuad9 ()
 
void buildSphereTri3 ()
 
void buildSphereQuad4 ()
 
void buildCubeTet4 ()
 
void buildCubeTet10 ()
 
void buildCubeTet14 ()
 
void buildCubeHex8 ()
 
void buildCubeHex20 ()
 
void buildCubeHex27 ()
 
void buildCubePrism6 ()
 
void buildCubePrism15 ()
 
void buildCubePrism18 ()
 
void buildCubePrism20 ()
 
void buildCubePrism21 ()
 
void buildCubePyramid5 ()
 
void buildCubePyramid13 ()
 
void buildCubePyramid14 ()
 
void buildSphereHex8 ()
 
void buildSphereHex27 ()
 

Protected Member Functions

std::unique_ptr< UnstructuredMeshnew_mesh (bool is_replicated)
 

Detailed Description

Definition at line 14 of file mesh_generation_test.C.

Member Typedef Documentation

◆ Builder

typedef void(MeshGenerationTest::* MeshGenerationTest::Builder) (UnstructuredMesh &, unsigned int, ElemType)

Definition at line 266 of file mesh_generation_test.C.

Member Function Documentation

◆ buildCubeHex20()

void MeshGenerationTest::buildCubeHex20 ( )
inline

Definition at line 304 of file mesh_generation_test.C.

References libMesh::HEX20, testBuildCube(), and tester().

304 { LOG_UNIT_TEST; tester(&MeshGenerationTest::testBuildCube, 2, HEX20); }
void testBuildCube(UnstructuredMesh &mesh, unsigned int n, ElemType type)
void tester(Builder f, unsigned int n, ElemType type)

◆ buildCubeHex27()

void MeshGenerationTest::buildCubeHex27 ( )
inline

Definition at line 305 of file mesh_generation_test.C.

References libMesh::HEX27, testBuildCube(), and tester().

305 { LOG_UNIT_TEST; tester(&MeshGenerationTest::testBuildCube, 2, HEX27); }
void testBuildCube(UnstructuredMesh &mesh, unsigned int n, ElemType type)
void tester(Builder f, unsigned int n, ElemType type)

◆ buildCubeHex8()

void MeshGenerationTest::buildCubeHex8 ( )
inline

Definition at line 303 of file mesh_generation_test.C.

References libMesh::HEX8, testBuildCube(), and tester().

303 { LOG_UNIT_TEST; tester(&MeshGenerationTest::testBuildCube, 2, HEX8); }
void testBuildCube(UnstructuredMesh &mesh, unsigned int n, ElemType type)
void tester(Builder f, unsigned int n, ElemType type)

◆ buildCubePrism15()

void MeshGenerationTest::buildCubePrism15 ( )
inline

Definition at line 307 of file mesh_generation_test.C.

References libMesh::PRISM15, testBuildCube(), and tester().

307 { LOG_UNIT_TEST; tester(&MeshGenerationTest::testBuildCube, 2, PRISM15); }
void testBuildCube(UnstructuredMesh &mesh, unsigned int n, ElemType type)
void tester(Builder f, unsigned int n, ElemType type)

◆ buildCubePrism18()

void MeshGenerationTest::buildCubePrism18 ( )
inline

Definition at line 308 of file mesh_generation_test.C.

References libMesh::PRISM18, testBuildCube(), and tester().

308 { LOG_UNIT_TEST; tester(&MeshGenerationTest::testBuildCube, 2, PRISM18); }
void testBuildCube(UnstructuredMesh &mesh, unsigned int n, ElemType type)
void tester(Builder f, unsigned int n, ElemType type)

◆ buildCubePrism20()

void MeshGenerationTest::buildCubePrism20 ( )
inline

Definition at line 309 of file mesh_generation_test.C.

References libMesh::PRISM20, testBuildCube(), and tester().

309 { LOG_UNIT_TEST; tester(&MeshGenerationTest::testBuildCube, 2, PRISM20); }
void testBuildCube(UnstructuredMesh &mesh, unsigned int n, ElemType type)
void tester(Builder f, unsigned int n, ElemType type)

◆ buildCubePrism21()

void MeshGenerationTest::buildCubePrism21 ( )
inline

Definition at line 310 of file mesh_generation_test.C.

References libMesh::PRISM21, testBuildCube(), and tester().

310 { LOG_UNIT_TEST; tester(&MeshGenerationTest::testBuildCube, 2, PRISM21); }
void testBuildCube(UnstructuredMesh &mesh, unsigned int n, ElemType type)
void tester(Builder f, unsigned int n, ElemType type)

◆ buildCubePrism6()

void MeshGenerationTest::buildCubePrism6 ( )
inline

Definition at line 306 of file mesh_generation_test.C.

References libMesh::PRISM6, testBuildCube(), and tester().

306 { LOG_UNIT_TEST; tester(&MeshGenerationTest::testBuildCube, 2, PRISM6); }
void testBuildCube(UnstructuredMesh &mesh, unsigned int n, ElemType type)
void tester(Builder f, unsigned int n, ElemType type)

◆ buildCubePyramid13()

void MeshGenerationTest::buildCubePyramid13 ( )
inline

Definition at line 316 of file mesh_generation_test.C.

References libMesh::PYRAMID13, testBuildCube(), and tester().

316 { LOG_UNIT_TEST; tester(&MeshGenerationTest::testBuildCube, 2, PYRAMID13); }
void testBuildCube(UnstructuredMesh &mesh, unsigned int n, ElemType type)
void tester(Builder f, unsigned int n, ElemType type)

◆ buildCubePyramid14()

void MeshGenerationTest::buildCubePyramid14 ( )
inline

Definition at line 317 of file mesh_generation_test.C.

References libMesh::PYRAMID14, testBuildCube(), and tester().

317 { LOG_UNIT_TEST; tester(&MeshGenerationTest::testBuildCube, 2, PYRAMID14); }
void testBuildCube(UnstructuredMesh &mesh, unsigned int n, ElemType type)
void tester(Builder f, unsigned int n, ElemType type)

◆ buildCubePyramid5()

void MeshGenerationTest::buildCubePyramid5 ( )
inline

Definition at line 315 of file mesh_generation_test.C.

References libMesh::PYRAMID5, testBuildCube(), and tester().

315 { LOG_UNIT_TEST; tester(&MeshGenerationTest::testBuildCube, 2, PYRAMID5); }
void testBuildCube(UnstructuredMesh &mesh, unsigned int n, ElemType type)
void tester(Builder f, unsigned int n, ElemType type)

◆ buildCubeTet10()

void MeshGenerationTest::buildCubeTet10 ( )
inline

Definition at line 301 of file mesh_generation_test.C.

References testBuildCube(), tester(), and libMesh::TET10.

301 { LOG_UNIT_TEST; tester(&MeshGenerationTest::testBuildCube, 2, TET10); }
void testBuildCube(UnstructuredMesh &mesh, unsigned int n, ElemType type)
void tester(Builder f, unsigned int n, ElemType type)

◆ buildCubeTet14()

void MeshGenerationTest::buildCubeTet14 ( )
inline

Definition at line 302 of file mesh_generation_test.C.

References testBuildCube(), tester(), and libMesh::TET14.

302 { LOG_UNIT_TEST; tester(&MeshGenerationTest::testBuildCube, 2, TET14); }
void testBuildCube(UnstructuredMesh &mesh, unsigned int n, ElemType type)
void tester(Builder f, unsigned int n, ElemType type)

◆ buildCubeTet4()

void MeshGenerationTest::buildCubeTet4 ( )
inline

Definition at line 300 of file mesh_generation_test.C.

References testBuildCube(), tester(), and libMesh::TET4.

300 { LOG_UNIT_TEST; tester(&MeshGenerationTest::testBuildCube, 2, TET4); }
void testBuildCube(UnstructuredMesh &mesh, unsigned int n, ElemType type)
void tester(Builder f, unsigned int n, ElemType type)

◆ buildLineEdge2()

void MeshGenerationTest::buildLineEdge2 ( )
inline

Definition at line 282 of file mesh_generation_test.C.

References libMesh::EDGE2, testBuildLine(), and tester().

282 { LOG_UNIT_TEST; tester(&MeshGenerationTest::testBuildLine, 5, EDGE2); }
void testBuildLine(UnstructuredMesh &mesh, unsigned int n, ElemType type)
void tester(Builder f, unsigned int n, ElemType type)

◆ buildLineEdge3()

void MeshGenerationTest::buildLineEdge3 ( )
inline

Definition at line 283 of file mesh_generation_test.C.

References libMesh::EDGE3, testBuildLine(), and tester().

283 { LOG_UNIT_TEST; tester(&MeshGenerationTest::testBuildLine, 5, EDGE3); }
void testBuildLine(UnstructuredMesh &mesh, unsigned int n, ElemType type)
void tester(Builder f, unsigned int n, ElemType type)

◆ buildLineEdge4()

void MeshGenerationTest::buildLineEdge4 ( )
inline

Definition at line 284 of file mesh_generation_test.C.

References libMesh::EDGE4, testBuildLine(), and tester().

284 { LOG_UNIT_TEST; tester(&MeshGenerationTest::testBuildLine, 5, EDGE4); }
void testBuildLine(UnstructuredMesh &mesh, unsigned int n, ElemType type)
void tester(Builder f, unsigned int n, ElemType type)

◆ buildSphereEdge2()

void MeshGenerationTest::buildSphereEdge2 ( )
inline

Definition at line 286 of file mesh_generation_test.C.

References libMesh::EDGE2.

286 { LOG_UNIT_TEST; testBuildSphere(2, EDGE2); }
void testBuildSphere(unsigned int n_ref, ElemType type)

◆ buildSphereEdge3()

void MeshGenerationTest::buildSphereEdge3 ( )
inline

Definition at line 287 of file mesh_generation_test.C.

References libMesh::EDGE3.

287 { LOG_UNIT_TEST; testBuildSphere(2, EDGE3); }
void testBuildSphere(unsigned int n_ref, ElemType type)

◆ buildSphereEdge4()

void MeshGenerationTest::buildSphereEdge4 ( )
inline

Definition at line 288 of file mesh_generation_test.C.

References libMesh::EDGE4.

288 { LOG_UNIT_TEST; testBuildSphere(2, EDGE4); }
void testBuildSphere(unsigned int n_ref, ElemType type)

◆ buildSphereHex27()

void MeshGenerationTest::buildSphereHex27 ( )
inline

Definition at line 321 of file mesh_generation_test.C.

References libMesh::HEX27.

321 { LOG_UNIT_TEST; testBuildSphere(2, HEX27); }
void testBuildSphere(unsigned int n_ref, ElemType type)

◆ buildSphereHex8()

void MeshGenerationTest::buildSphereHex8 ( )
inline

Definition at line 320 of file mesh_generation_test.C.

References libMesh::HEX8.

320 { LOG_UNIT_TEST; testBuildSphere(2, HEX8); }
void testBuildSphere(unsigned int n_ref, ElemType type)

◆ buildSphereQuad4()

void MeshGenerationTest::buildSphereQuad4 ( )
inline

Definition at line 298 of file mesh_generation_test.C.

References libMesh::QUAD4.

298 { LOG_UNIT_TEST; testBuildSphere(2, QUAD4); }
void testBuildSphere(unsigned int n_ref, ElemType type)

◆ buildSphereTri3()

void MeshGenerationTest::buildSphereTri3 ( )
inline

Definition at line 297 of file mesh_generation_test.C.

References libMesh::TRI3.

297 { LOG_UNIT_TEST; testBuildSphere(2, TRI3); }
void testBuildSphere(unsigned int n_ref, ElemType type)

◆ buildSquareQuad4()

void MeshGenerationTest::buildSquareQuad4 ( )
inline

Definition at line 293 of file mesh_generation_test.C.

References libMesh::QUAD4, testBuildSquare(), and tester().

293 { LOG_UNIT_TEST; tester(&MeshGenerationTest::testBuildSquare, 4, QUAD4); }
void testBuildSquare(UnstructuredMesh &mesh, unsigned int n, ElemType type)
void tester(Builder f, unsigned int n, ElemType type)

◆ buildSquareQuad8()

void MeshGenerationTest::buildSquareQuad8 ( )
inline

Definition at line 294 of file mesh_generation_test.C.

References libMesh::QUAD8, testBuildSquare(), and tester().

294 { LOG_UNIT_TEST; tester(&MeshGenerationTest::testBuildSquare, 4, QUAD8); }
void testBuildSquare(UnstructuredMesh &mesh, unsigned int n, ElemType type)
void tester(Builder f, unsigned int n, ElemType type)

◆ buildSquareQuad9()

void MeshGenerationTest::buildSquareQuad9 ( )
inline

Definition at line 295 of file mesh_generation_test.C.

References libMesh::QUAD9, testBuildSquare(), and tester().

295 { LOG_UNIT_TEST; tester(&MeshGenerationTest::testBuildSquare, 4, QUAD9); }
void testBuildSquare(UnstructuredMesh &mesh, unsigned int n, ElemType type)
void tester(Builder f, unsigned int n, ElemType type)

◆ buildSquareTri3()

void MeshGenerationTest::buildSquareTri3 ( )
inline

Definition at line 290 of file mesh_generation_test.C.

References testBuildSquare(), tester(), and libMesh::TRI3.

290 { LOG_UNIT_TEST; tester(&MeshGenerationTest::testBuildSquare, 3, TRI3); }
void testBuildSquare(UnstructuredMesh &mesh, unsigned int n, ElemType type)
void tester(Builder f, unsigned int n, ElemType type)

◆ buildSquareTri6()

void MeshGenerationTest::buildSquareTri6 ( )
inline

Definition at line 291 of file mesh_generation_test.C.

References testBuildSquare(), tester(), and libMesh::TRI6.

291 { LOG_UNIT_TEST; tester(&MeshGenerationTest::testBuildSquare, 4, TRI6); }
void testBuildSquare(UnstructuredMesh &mesh, unsigned int n, ElemType type)
void tester(Builder f, unsigned int n, ElemType type)

◆ buildSquareTri7()

void MeshGenerationTest::buildSquareTri7 ( )
inline

Definition at line 292 of file mesh_generation_test.C.

References testBuildSquare(), tester(), and libMesh::TRI7.

292 { LOG_UNIT_TEST; tester(&MeshGenerationTest::testBuildSquare, 4, TRI7); }
void testBuildSquare(UnstructuredMesh &mesh, unsigned int n, ElemType type)
void tester(Builder f, unsigned int n, ElemType type)

◆ CPPUNIT_TEST() [1/29]

MeshGenerationTest::CPPUNIT_TEST ( buildLineEdge2  )

◆ CPPUNIT_TEST() [2/29]

MeshGenerationTest::CPPUNIT_TEST ( buildLineEdge3  )

◆ CPPUNIT_TEST() [3/29]

MeshGenerationTest::CPPUNIT_TEST ( buildLineEdge4  )

◆ CPPUNIT_TEST() [4/29]

MeshGenerationTest::CPPUNIT_TEST ( buildSphereEdge2  )

◆ CPPUNIT_TEST() [5/29]

MeshGenerationTest::CPPUNIT_TEST ( buildSphereEdge3  )

◆ CPPUNIT_TEST() [6/29]

MeshGenerationTest::CPPUNIT_TEST ( buildSquareTri3  )

◆ CPPUNIT_TEST() [7/29]

MeshGenerationTest::CPPUNIT_TEST ( buildSquareTri6  )

◆ CPPUNIT_TEST() [8/29]

MeshGenerationTest::CPPUNIT_TEST ( buildSquareTri7  )

◆ CPPUNIT_TEST() [9/29]

MeshGenerationTest::CPPUNIT_TEST ( buildSquareQuad4  )

◆ CPPUNIT_TEST() [10/29]

MeshGenerationTest::CPPUNIT_TEST ( buildSquareQuad8  )

◆ CPPUNIT_TEST() [11/29]

MeshGenerationTest::CPPUNIT_TEST ( buildSquareQuad9  )

◆ CPPUNIT_TEST() [12/29]

MeshGenerationTest::CPPUNIT_TEST ( buildSphereTri3  )

◆ CPPUNIT_TEST() [13/29]

MeshGenerationTest::CPPUNIT_TEST ( buildSphereQuad4  )

◆ CPPUNIT_TEST() [14/29]

MeshGenerationTest::CPPUNIT_TEST ( buildCubeTet4  )

◆ CPPUNIT_TEST() [15/29]

MeshGenerationTest::CPPUNIT_TEST ( buildCubeTet10  )

◆ CPPUNIT_TEST() [16/29]

MeshGenerationTest::CPPUNIT_TEST ( buildCubeTet14  )

◆ CPPUNIT_TEST() [17/29]

MeshGenerationTest::CPPUNIT_TEST ( buildCubeHex8  )

◆ CPPUNIT_TEST() [18/29]

MeshGenerationTest::CPPUNIT_TEST ( buildCubeHex20  )

◆ CPPUNIT_TEST() [19/29]

MeshGenerationTest::CPPUNIT_TEST ( buildCubeHex27  )

◆ CPPUNIT_TEST() [20/29]

MeshGenerationTest::CPPUNIT_TEST ( buildCubePrism6  )

◆ CPPUNIT_TEST() [21/29]

MeshGenerationTest::CPPUNIT_TEST ( buildCubePrism15  )

◆ CPPUNIT_TEST() [22/29]

MeshGenerationTest::CPPUNIT_TEST ( buildCubePrism18  )

◆ CPPUNIT_TEST() [23/29]

MeshGenerationTest::CPPUNIT_TEST ( buildCubePrism20  )

◆ CPPUNIT_TEST() [24/29]

MeshGenerationTest::CPPUNIT_TEST ( buildCubePrism21  )

◆ CPPUNIT_TEST() [25/29]

MeshGenerationTest::CPPUNIT_TEST ( buildCubePyramid5  )

◆ CPPUNIT_TEST() [26/29]

MeshGenerationTest::CPPUNIT_TEST ( buildCubePyramid13  )

◆ CPPUNIT_TEST() [27/29]

MeshGenerationTest::CPPUNIT_TEST ( buildCubePyramid14  )

◆ CPPUNIT_TEST() [28/29]

MeshGenerationTest::CPPUNIT_TEST ( buildSphereHex27  )

◆ CPPUNIT_TEST() [29/29]

MeshGenerationTest::CPPUNIT_TEST ( buildSphereHex8  )

◆ CPPUNIT_TEST_SUITE_END()

MeshGenerationTest::CPPUNIT_TEST_SUITE_END ( )

◆ LIBMESH_CPPUNIT_TEST_SUITE()

MeshGenerationTest::LIBMESH_CPPUNIT_TEST_SUITE ( MeshGenerationTest  )

The goal of this test is to verify proper operation of MeshGeneration functions, as well as to indirectly verify the MeshBase functions they rely on.

◆ new_mesh()

std::unique_ptr<UnstructuredMesh> MeshGenerationTest::new_mesh ( bool  is_replicated)
inlineprotected

Definition at line 78 of file mesh_generation_test.C.

79  {
80  if (is_replicated)
81  return std::make_unique<ReplicatedMesh>(*TestCommWorld);
82  return std::make_unique<DistributedMesh>(*TestCommWorld);
83  }

◆ setUp()

void MeshGenerationTest::setUp ( )
inline

Definition at line 86 of file mesh_generation_test.C.

86 {}

◆ tearDown()

void MeshGenerationTest::tearDown ( )
inline

Definition at line 88 of file mesh_generation_test.C.

88 {}

◆ testBuildCube()

void MeshGenerationTest::testBuildCube ( UnstructuredMesh mesh,
unsigned int  n,
ElemType  type 
)
inline

Definition at line 153 of file mesh_generation_test.C.

References libMesh::MeshTools::Generation::build_cube(), libMesh::MeshTools::create_bounding_box(), libMesh::HEX20, libMesh::BoundingBox::max(), mesh, libMesh::BoundingBox::min(), libMesh::MeshBase::n_elem(), libMesh::MeshBase::n_nodes(), libMesh::PRISM15, libMesh::PRISM18, libMesh::PRISM20, libMesh::PRISM21, libMesh::PRISM6, libMesh::PYRAMID13, libMesh::PYRAMID14, libMesh::PYRAMID5, libMesh::Real, libMesh::Elem::type_to_n_nodes_map, and libMesh::Elem::type_to_n_sides_map.

Referenced by buildCubeHex20(), buildCubeHex27(), buildCubeHex8(), buildCubePrism15(), buildCubePrism18(), buildCubePrism20(), buildCubePrism21(), buildCubePrism6(), buildCubePyramid13(), buildCubePyramid14(), buildCubePyramid5(), buildCubeTet10(), buildCubeTet14(), and buildCubeTet4().

154  {
155  MeshTools::Generation::build_cube (mesh, n, n, n, -2.0, 3.0, -4.0, 5.0, -6.0, 7.0, type);
156  switch (Elem::type_to_n_sides_map[type])
157  {
158  case 4: // tets
159  CPPUNIT_ASSERT_EQUAL(mesh.n_elem(), cast_int<dof_id_type>(n*n*n*24));
160  break;
161  case 5: // prisms, pyramids
162  if (type == PRISM6 || type == PRISM15 || type == PRISM18 ||
163  type == PRISM20 || type == PRISM21)
164  CPPUNIT_ASSERT_EQUAL(mesh.n_elem(), cast_int<dof_id_type>(n*n*n*2));
165  else
166  CPPUNIT_ASSERT_EQUAL(mesh.n_elem(), cast_int<dof_id_type>(n*n*n*6));
167  break;
168  case 6: // hexes
169  CPPUNIT_ASSERT_EQUAL(mesh.n_elem(), cast_int<dof_id_type>(n*n*n));
170  break;
171  default:
172  libmesh_error();
173  }
174 
175 
176  switch (Elem::type_to_n_nodes_map[type])
177  {
178  case 4: // First-order tets
179  CPPUNIT_ASSERT_EQUAL(mesh.n_nodes(),
180  cast_int<dof_id_type>((n+1)*(n+1)*(n+1) + n*n*n + 3*(n+1)*n*n));
181  break;
182  case 6: // First-order prisms and hexes use the same nodes
183  case 8:
184  CPPUNIT_ASSERT_EQUAL(mesh.n_nodes(),
185  cast_int<dof_id_type>((n+1)*(n+1)*(n+1)));
186  break;
187  case 10: // Second-order tets
188  CPPUNIT_ASSERT_EQUAL(mesh.n_nodes(),
189  cast_int<dof_id_type>((2*n+1)*(2*n+1)*(2*n+1) + 14*n*n*n + 4*3*(n+1)*n*n));
190  break;
191  case 18:
192  case 27: // Second-order prisms and hexes use the same nodes
193  CPPUNIT_ASSERT_EQUAL(mesh.n_nodes(),
194  cast_int<dof_id_type>((2*n+1)*(2*n+1)*(2*n+1)));
195  break;
196  case 20:
197  if (type == HEX20)
198  CPPUNIT_ASSERT_EQUAL(mesh.n_nodes(),
199  cast_int<dof_id_type>((2*n+1)*(2*n+1)*(2*n+1) - n*n*n - 3*(n+1)*n*n));
200  if (type == PRISM20)
201  CPPUNIT_ASSERT_EQUAL(mesh.n_nodes(),
202  cast_int<dof_id_type>((2*n+1)*(2*n+1)*(2*n+1) + 2*(n+1)*n*n));
203  break;
204  case 21: // Prisms based on full Tri7 cross sections
205  CPPUNIT_ASSERT_EQUAL(mesh.n_nodes(),
206  cast_int<dof_id_type>((2*n+1)*(2*n+1)*(2*n+1) + 2*(2*n+1)*n*n));
207  break;
208  case 15: // weird partial order prism
209  CPPUNIT_ASSERT_EQUAL(mesh.n_nodes(),
210  cast_int<dof_id_type>((2*n+1)*(2*n+1)*(2*n+1) - n*n*n - 2*(n+1)*n*n));
211  break;
212  case 5: // pyramids
213  CPPUNIT_ASSERT_EQUAL(mesh.n_nodes(),
214  cast_int<dof_id_type>((n+1)*(n+1)*(n+1) + n*n*n));
215  break;
216  case 13:
217  CPPUNIT_ASSERT_EQUAL(mesh.n_nodes(),
218  cast_int<dof_id_type>((2*n+1)*(2*n+1)*(2*n+1) + 8*n*n*n - 3*(n+1)*n*n));
219  break;
220  case 14: // pyramids, tets
221  if (type == PYRAMID14)
222  CPPUNIT_ASSERT_EQUAL(mesh.n_nodes(),
223  cast_int<dof_id_type>((2*n+1)*(2*n+1)*(2*n+1) + 8*n*n*n));
224  else // TET14
225  CPPUNIT_ASSERT_EQUAL(mesh.n_nodes(),
226  cast_int<dof_id_type>((2*n+1)*(2*n+1)*(2*n+1) + 14*n*n*n + 4*3*(n+1)*n*n +
227  36*n*n*n + 4*3*(n+1)*n*n));
228  break;
229  default:
230  libmesh_error();
231  }
232 
233  // Our bounding boxes can be loose on higher order elements, but
234  // we can at least assert that they're not too tight
236  CPPUNIT_ASSERT(bbox.min()(0) <= Real(-2.0));
237  CPPUNIT_ASSERT(bbox.max()(0) >= Real(3.0));
238  CPPUNIT_ASSERT(bbox.min()(1) <= Real(-4.0));
239  CPPUNIT_ASSERT(bbox.max()(1) >= Real(5.0));
240  CPPUNIT_ASSERT(bbox.min()(2) <= Real(-6.0));
241  CPPUNIT_ASSERT(bbox.max()(2) >= Real(7.0));
242 
243  // We don't yet try to do affine map optimizations on pyramids
244  if (type == PYRAMID5 ||
245  type == PYRAMID13 ||
246  type == PYRAMID14)
247  return;
248 
249  // Do serial assertions *after* all parallel assertions, so we
250  // stay in sync after failure on only some processor(s)
251  for (auto & elem : mesh.element_ptr_range())
252  CPPUNIT_ASSERT(elem->has_affine_map());
253  }
libMesh::BoundingBox create_bounding_box(const MeshBase &mesh)
Definition: mesh_tools.C:558
MeshBase & mesh
const Point & min() const
Definition: bounding_box.h:76
Defines a Cartesian bounding box by the two corner extremum.
Definition: bounding_box.h:40
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const Point & max() const
Definition: bounding_box.h:85
virtual dof_id_type n_elem() const =0
void build_cube(UnstructuredMesh &mesh, const unsigned int nx=0, const unsigned int ny=0, const unsigned int nz=0, const Real xmin=0., const Real xmax=1., const Real ymin=0., const Real ymax=1., const Real zmin=0., const Real zmax=1., const ElemType type=INVALID_ELEM, const bool gauss_lobatto_grid=false)
Builds a (elements) cube.
virtual dof_id_type n_nodes() const =0

◆ testBuildLine()

void MeshGenerationTest::testBuildLine ( UnstructuredMesh mesh,
unsigned int  n,
ElemType  type 
)
inline

Definition at line 90 of file mesh_generation_test.C.

References libMesh::MeshTools::Generation::build_line(), libMesh::MeshTools::create_bounding_box(), mesh, libMesh::MeshBase::n_elem(), libMesh::MeshBase::n_nodes(), libMesh::Real, and libMesh::Elem::type_to_n_nodes_map.

Referenced by buildLineEdge2(), buildLineEdge3(), and buildLineEdge4().

91  {
92  MeshTools::Generation::build_line (mesh, n, -1.0, 2.0, type);
93  CPPUNIT_ASSERT_EQUAL(mesh.n_elem(), cast_int<dof_id_type>(n));
94  CPPUNIT_ASSERT_EQUAL(mesh.n_nodes(),
95  cast_int<dof_id_type>((Elem::type_to_n_nodes_map[type]-1)*n + 1));
96 
98  CPPUNIT_ASSERT_EQUAL(bbox.min()(0), Real(-1.0));
99  CPPUNIT_ASSERT_EQUAL(bbox.max()(0), Real(2.0));
100 
101  // Do serial assertions *after* all parallel assertions, so we
102  // stay in sync after failure on only some processor(s)
103  for (auto & elem : mesh.element_ptr_range())
104  CPPUNIT_ASSERT(elem->has_affine_map());
105  }
libMesh::BoundingBox create_bounding_box(const MeshBase &mesh)
Definition: mesh_tools.C:558
MeshBase & mesh
Defines a Cartesian bounding box by the two corner extremum.
Definition: bounding_box.h:40
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void build_line(UnstructuredMesh &mesh, const unsigned int nx, const Real xmin=0., const Real xmax=1., const ElemType type=INVALID_ELEM, const bool gauss_lobatto_grid=false)
A specialized build_cube() for 1D meshes.
virtual dof_id_type n_elem() const =0
virtual dof_id_type n_nodes() const =0

◆ testBuildSphere()

void MeshGenerationTest::testBuildSphere ( unsigned int  n_ref,
ElemType  type 
)
inline

Definition at line 255 of file mesh_generation_test.C.

References libMesh::MeshBase::allow_renumbering(), libMesh::MeshTools::Generation::build_sphere(), and TestCommWorld.

256  {
258  MeshTools::Generation::build_sphere (rmesh, 2.0, n_ref, type);
259 
261  dmesh.allow_renumbering(false);
262  MeshTools::Generation::build_sphere (dmesh, 2.0, n_ref, type);
263  }
The ReplicatedMesh class is derived from the MeshBase class, and is used to store identical copies of...
void build_sphere(UnstructuredMesh &mesh, const Real rad=1, const unsigned int nr=2, const ElemType type=INVALID_ELEM, const unsigned int n_smooth=2, const bool flat=true)
Meshes a spherical or mapped-spherical domain.
libMesh::Parallel::Communicator * TestCommWorld
Definition: driver.C:159
The DistributedMesh class is derived from the MeshBase class, and is intended to provide identical fu...

◆ testBuildSquare()

void MeshGenerationTest::testBuildSquare ( UnstructuredMesh mesh,
unsigned int  n,
ElemType  type 
)
inline

Definition at line 107 of file mesh_generation_test.C.

References libMesh::MeshTools::Generation::build_square(), libMesh::MeshTools::create_bounding_box(), libMesh::BoundingBox::max(), mesh, libMesh::BoundingBox::min(), libMesh::MeshBase::n_elem(), libMesh::MeshBase::n_nodes(), libMesh::QUAD4, libMesh::QUAD8, libMesh::QUAD9, libMesh::Real, libMesh::TRI3, libMesh::TRI6, libMesh::TRI7, and libMesh::Elem::type_to_n_sides_map.

Referenced by buildSquareQuad4(), buildSquareQuad8(), buildSquareQuad9(), buildSquareTri3(), buildSquareTri6(), and buildSquareTri7().

108  {
109  MeshTools::Generation::build_square (mesh, n, n, -2.0, 3.0, -4.0, 5.0, type);
110  if (Elem::type_to_n_sides_map[type] == 4)
111  CPPUNIT_ASSERT_EQUAL(mesh.n_elem(), cast_int<dof_id_type>(n*n));
112  else
113  CPPUNIT_ASSERT_EQUAL(mesh.n_elem(), cast_int<dof_id_type>(n*n*2));
114 
115  switch (type)
116  {
117  case TRI3: // First-order elements
118  case QUAD4:
119  CPPUNIT_ASSERT_EQUAL(mesh.n_nodes(),
120  cast_int<dof_id_type>((n+1)*(n+1)));
121  break;
122  case TRI6: // Second-order elements
123  case QUAD9:
124  CPPUNIT_ASSERT_EQUAL(mesh.n_nodes(),
125  cast_int<dof_id_type>((2*n+1)*(2*n+1)));
126  break;
127  case QUAD8: // Not-really-second-order element missing center nodes
128  CPPUNIT_ASSERT_EQUAL(mesh.n_nodes(),
129  cast_int<dof_id_type>((2*n+1)*(2*n+1) - n*n));
130  break;
131  case TRI7: // Not-really-second-order element with extra center nodes
132  CPPUNIT_ASSERT_EQUAL(mesh.n_nodes(),
133  cast_int<dof_id_type>((2*n+1)*(2*n+1) + 2*n*n));
134  break;
135  default: // Wait, what did we try to build?
136  CPPUNIT_ASSERT(false);
137  }
138 
139  // Our bounding boxes can be loose on higher order elements, but
140  // we can at least assert that they're not too tight
142  CPPUNIT_ASSERT(bbox.min()(0) <= Real(-2.0));
143  CPPUNIT_ASSERT(bbox.max()(0) >= Real(3.0));
144  CPPUNIT_ASSERT(bbox.min()(1) <= Real(-4.0));
145  CPPUNIT_ASSERT(bbox.max()(1) >= Real(5.0));
146 
147  // Do serial assertions *after* all parallel assertions, so we
148  // stay in sync after failure on only some processor(s)
149  for (auto & elem : mesh.element_ptr_range())
150  CPPUNIT_ASSERT(elem->has_affine_map());
151  }
libMesh::BoundingBox create_bounding_box(const MeshBase &mesh)
Definition: mesh_tools.C:558
MeshBase & mesh
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.
const Point & min() const
Definition: bounding_box.h:76
Defines a Cartesian bounding box by the two corner extremum.
Definition: bounding_box.h:40
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const Point & max() const
Definition: bounding_box.h:85
virtual dof_id_type n_elem() const =0
virtual dof_id_type n_nodes() const =0

◆ tester()

void MeshGenerationTest::tester ( Builder  f,
unsigned int  n,
ElemType  type 
)
inline

Definition at line 268 of file mesh_generation_test.C.

References libMesh::MeshBase::allow_renumbering(), and mesh.

269  {
270  for (int is_replicated = 0; is_replicated != 2; ++is_replicated)
271  {
272  for (int skip_renumber = 0 ; skip_renumber != 2; ++skip_renumber)
273  {
274  std::unique_ptr<UnstructuredMesh> mesh =
275  new_mesh(is_replicated);
276  mesh->allow_renumbering(!skip_renumber);
277  (this->*f)(*mesh, n, type);
278  }
279  }
280  }
void allow_renumbering(bool allow)
If false is passed in then this mesh will no longer be renumbered when being prepared for use...
Definition: mesh_base.h:1173
MeshBase & mesh
std::unique_ptr< UnstructuredMesh > new_mesh(bool is_replicated)

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