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

Public Member Functions

 LIBMESH_CPPUNIT_TEST_SUITE (DistributedMeshTest)
 
 CPPUNIT_TEST (testRemoteElemError)
 
 CPPUNIT_TEST (testCopyConstructorUnsynchedIdCounts)
 
 CPPUNIT_TEST_SUITE_END ()
 
void setUp ()
 
void tearDown ()
 
void testRemoteElemError ()
 
void testCopyConstructorUnsynchedIdCounts ()
 

Detailed Description

Definition at line 17 of file distributed_mesh_test.C.

Member Function Documentation

◆ CPPUNIT_TEST() [1/2]

DistributedMeshTest::CPPUNIT_TEST ( testCopyConstructorUnsynchedIdCounts  )

◆ CPPUNIT_TEST() [2/2]

DistributedMeshTest::CPPUNIT_TEST ( testRemoteElemError  )

◆ CPPUNIT_TEST_SUITE_END()

DistributedMeshTest::CPPUNIT_TEST_SUITE_END ( )

◆ LIBMESH_CPPUNIT_TEST_SUITE()

DistributedMeshTest::LIBMESH_CPPUNIT_TEST_SUITE ( DistributedMeshTest  )

◆ setUp()

void DistributedMeshTest::setUp ( )
inline

Definition at line 29 of file distributed_mesh_test.C.

30 {}

◆ tearDown()

void DistributedMeshTest::tearDown ( )
inline

Definition at line 32 of file distributed_mesh_test.C.

33 {}

◆ testCopyConstructorUnsynchedIdCounts()

void DistributedMeshTest::testCopyConstructorUnsynchedIdCounts ( )
inline

Definition at line 73 of file distributed_mesh_test.C.

74 {
75 LOG_UNIT_TEST;
76
77 DistributedMesh mesh(*TestCommWorld);
79
80 CPPUNIT_ASSERT(mesh.preparation().has_synched_id_counts);
81
83 CPPUNIT_ASSERT(!mesh.preparation().has_synched_id_counts);
84
85 DistributedMesh mesh_copy(mesh);
86 CPPUNIT_ASSERT(!mesh_copy.preparation().has_synched_id_counts);
87 }
The DistributedMesh class is derived from the MeshBase class, and is intended to provide identical fu...
Preparation preparation() const
Definition mesh_base.h:213
void unset_has_synched_id_counts()
Tells this we have done some operation (e.g.
Definition mesh_base.h:257
MeshBase & mesh
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.

References libMesh::MeshTools::Generation::build_line(), libMesh::EDGE2, libMesh::MeshBase::Preparation::has_synched_id_counts, mesh, libMesh::MeshBase::preparation(), TestCommWorld, and libMesh::MeshBase::unset_has_synched_id_counts().

◆ testRemoteElemError()

void DistributedMeshTest::testRemoteElemError ( )
inline

Definition at line 35 of file distributed_mesh_test.C.

36 {
37 LOG_UNIT_TEST;
38
39 DistributedMesh mesh(*TestCommWorld);
40
41 // Build enough elements to be sure some will be remote on 2
42 // processors
44
45#ifdef LIBMESH_ENABLE_EXCEPTIONS
46 if (mesh.n_processors() > 1)
47 {
48 // We only expect a throw if we can get to a remote_elem to
49 // throw from, which can't happen if we're on 11+ procs
50 bool threw_expected_error = true;
51 try
52 {
53 for (const auto & elem : mesh.element_ptr_range())
54 {
55 threw_expected_error = false;
56 for (const Elem * neigh : elem->neighbor_ptr_range())
57 if (neigh && neigh->n_sides() != 2) // this should throw if not 2
58 CPPUNIT_ASSERT(false);
59 }
60 }
61 catch (libMesh::LogicError & e)
62 {
63 std::regex msg_regex("merely a shim");
64 CPPUNIT_ASSERT(std::regex_search(e.what(), msg_regex));
65 threw_expected_error = true;
66 }
67
68 CPPUNIT_ASSERT(threw_expected_error);
69 }
70#endif // LIBMESH_ENABLE_EXCEPTIONS
71 }
This is the base class from which all geometric element types are derived.
Definition elem.h:96
A class to represent the internal "this should never happen" errors, to be thrown by "libmesh_error()...
processor_id_type n_processors() const

References libMesh::MeshTools::Generation::build_line(), libMesh::EDGE2, mesh, libMesh::ParallelObject::n_processors(), and TestCommWorld.


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