libMesh
Public Member Functions | Private Member Functions | List of all members
CopyNodesAndElementsTest Class Reference
Inheritance diagram for CopyNodesAndElementsTest:
[legend]

Public Member Functions

 LIBMESH_CPPUNIT_TEST_SUITE (CopyNodesAndElementsTest)
 
 CPPUNIT_TEST (replicatedCopy)
 
 CPPUNIT_TEST (distributedCopy)
 
 CPPUNIT_TEST_SUITE_END ()
 
void setUp ()
 
void tearDown ()
 
void replicatedCopy ()
 
void distributedCopy ()
 

Private Member Functions

template<typename T >
void collectMeshes ()
 

Detailed Description

Definition at line 12 of file mesh_collection.C.

Member Function Documentation

◆ collectMeshes()

template<typename T >
void CopyNodesAndElementsTest::collectMeshes ( )
inlineprivate

Definition at line 24 of file mesh_collection.C.

References libMesh::MeshTools::Generation::build_cube(), libMesh::MeshBase::max_elem_id(), libMesh::MeshBase::max_node_id(), mesh, libMesh::MeshBase::parallel_max_unique_id(), libMesh::Real, TestCommWorld, and libMesh::TET10.

25  {
26  // to trigger duplicate unique ids in the old code, you needed the following circumstances:
27  // The single mesh generation routine (e.g. build_cube) *must* add a node after all the elements
28  // such that it is not an element that has the largest unique id in the single mesh. (build_cube
29  // with TET10 adds a node after all the elements are added because it calls all_second_order
30  // after all the elements are created.) If an element has the highest unique id, then the final
31  // value for _next_unique_id was (and still is) correct at the end of copy_nodes_and_elements
32  // because we set the element unique ids before adding the elements into the original mesh, such
33  // that _next_unique_id gets correctly updated. But when a node has the highest unique id, then
34  // _next_unique_id would be incorrect with the old code (but is now correct with the new code!)
35  // and after one mesh collection the value of parallel_max_unique_id() would be conceptually
36  // wrong, such that the next time we collected a mesh we would be at risk of duplicating unique
37  // ids
38  T mesh(*TestCommWorld, /*dim=*/3);
39  MeshTools::Generation::build_cube(mesh, 2, 2, 2, 0, 1, 0, 1, 0, 1, TET10);
40  Real dmin = 2, dmax = 3;
41  for (unsigned int num_other_meshes = 0; num_other_meshes < 2;
42  ++num_other_meshes, dmin += 2, dmax += 2)
43  {
44  T other_mesh(*TestCommWorld, 3);
46  other_mesh, 2, 2, 2, dmin, dmax, dmin, dmax, dmin, dmax, TET10);
47  dof_id_type node_delta = mesh.max_node_id();
48  dof_id_type elem_delta = mesh.max_elem_id();
49  unique_id_type unique_delta =
50 #ifdef LIBMESH_ENABLE_UNIQUE_ID
52 #else
53  0;
54 #endif
55  mesh.copy_nodes_and_elements(other_mesh, false, elem_delta, node_delta, unique_delta);
56  }
57  }
virtual unique_id_type parallel_max_unique_id() const =0
libMesh::Parallel::Communicator * TestCommWorld
Definition: driver.C:171
MeshBase & mesh
virtual dof_id_type max_elem_id() const =0
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual dof_id_type max_node_id() const =0
uint8_t unique_id_type
Definition: id_types.h:86
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.
uint8_t dof_id_type
Definition: id_types.h:67

◆ CPPUNIT_TEST() [1/2]

CopyNodesAndElementsTest::CPPUNIT_TEST ( replicatedCopy  )

◆ CPPUNIT_TEST() [2/2]

CopyNodesAndElementsTest::CPPUNIT_TEST ( distributedCopy  )

◆ CPPUNIT_TEST_SUITE_END()

CopyNodesAndElementsTest::CPPUNIT_TEST_SUITE_END ( )

◆ distributedCopy()

void CopyNodesAndElementsTest::distributedCopy ( )
inline

Definition at line 66 of file mesh_collection.C.

66 { LOG_UNIT_TEST; collectMeshes<DistributedMesh>(); }

◆ LIBMESH_CPPUNIT_TEST_SUITE()

CopyNodesAndElementsTest::LIBMESH_CPPUNIT_TEST_SUITE ( CopyNodesAndElementsTest  )

◆ replicatedCopy()

void CopyNodesAndElementsTest::replicatedCopy ( )
inline

Definition at line 64 of file mesh_collection.C.

64 { LOG_UNIT_TEST; collectMeshes<ReplicatedMesh>(); }

◆ setUp()

void CopyNodesAndElementsTest::setUp ( )
inline

Definition at line 60 of file mesh_collection.C.

60 {}

◆ tearDown()

void CopyNodesAndElementsTest::tearDown ( )
inline

Definition at line 62 of file mesh_collection.C.

62 {}

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