libMesh
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_SUITE_END ()
 
void setUp ()
 
void tearDown ()
 
void testRemoteElemError ()
 

Detailed Description

Definition at line 17 of file distributed_mesh_test.C.

Member Function Documentation

◆ CPPUNIT_TEST()

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 28 of file distributed_mesh_test.C.

29  {}

◆ tearDown()

void DistributedMeshTest::tearDown ( )
inline

Definition at line 31 of file distributed_mesh_test.C.

32  {}

◆ testRemoteElemError()

void DistributedMeshTest::testRemoteElemError ( )
inline

Definition at line 34 of file distributed_mesh_test.C.

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

35  {
36  LOG_UNIT_TEST;
37 
39 
40  // Build enough elements to be sure some will be remote on 2
41  // processors
43 
44 #ifdef LIBMESH_ENABLE_EXCEPTIONS
45  if (mesh.n_processors() > 1)
46  {
47  // We only expect a throw if we can get to a remote_elem to
48  // throw from, which can't happen if we're on 11+ procs
49  bool threw_expected_error = true;
50  try
51  {
52  for (const auto & elem : mesh.element_ptr_range())
53  {
54  threw_expected_error = false;
55  for (const Elem * neigh : elem->neighbor_ptr_range())
56  if (neigh && neigh->n_sides() != 2) // this should throw if not 2
57  CPPUNIT_ASSERT(false);
58  }
59  }
60  catch (libMesh::LogicError & e)
61  {
62  std::regex msg_regex("merely a shim");
63  CPPUNIT_ASSERT(std::regex_search(e.what(), msg_regex));
64  threw_expected_error = true;
65  }
66 
67  CPPUNIT_ASSERT(threw_expected_error);
68  }
69 #endif // LIBMESH_ENABLE_EXCEPTIONS
70  }
libMesh::Parallel::Communicator * TestCommWorld
Definition: driver.C:171
This is the base class from which all geometric element types are derived.
Definition: elem.h:94
MeshBase & mesh
processor_id_type n_processors() const
The DistributedMesh class is derived from the MeshBase class, and is intended to provide identical fu...
A class to represent the internal "this should never happen" errors, to be thrown by "libmesh_error()...
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.
SimpleRange< NeighborPtrIter > neighbor_ptr_range()
Returns a range with all neighbors of an element, usable in range-based for loops.
Definition: elem.h:3503

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