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

Public Member Functions

 LIBMESH_CPPUNIT_TEST_SUITE (MeshBaseTest)
 This test verifies various operations on the MeshBase and derived classes. More...
 
 CPPUNIT_TEST (testDistributedMeshVerifyIsPrepared)
 
 CPPUNIT_TEST (testMeshVerifyIsPrepared)
 
 CPPUNIT_TEST (testReplicatedMeshVerifyIsPrepared)
 
 CPPUNIT_TEST_SUITE_END ()
 
void setUp ()
 
void tearDown ()
 
void testMeshBaseVerifyIsPrepared (UnstructuredMesh &mesh)
 
void testDistributedMeshVerifyIsPrepared ()
 
void testMeshVerifyIsPrepared ()
 
void testReplicatedMeshVerifyIsPrepared ()
 

Detailed Description

Definition at line 15 of file mesh_base_test.C.

Member Function Documentation

◆ CPPUNIT_TEST() [1/3]

MeshBaseTest::CPPUNIT_TEST ( testDistributedMeshVerifyIsPrepared  )

◆ CPPUNIT_TEST() [2/3]

MeshBaseTest::CPPUNIT_TEST ( testMeshVerifyIsPrepared  )

◆ CPPUNIT_TEST() [3/3]

MeshBaseTest::CPPUNIT_TEST ( testReplicatedMeshVerifyIsPrepared  )

◆ CPPUNIT_TEST_SUITE_END()

MeshBaseTest::CPPUNIT_TEST_SUITE_END ( )

◆ LIBMESH_CPPUNIT_TEST_SUITE()

MeshBaseTest::LIBMESH_CPPUNIT_TEST_SUITE ( MeshBaseTest  )

This test verifies various operations on the MeshBase and derived classes.

◆ setUp()

void MeshBaseTest::setUp ( )
inline

Definition at line 34 of file mesh_base_test.C.

34 {}

◆ tearDown()

void MeshBaseTest::tearDown ( )
inline

Definition at line 36 of file mesh_base_test.C.

36 {}

◆ testDistributedMeshVerifyIsPrepared()

void MeshBaseTest::testDistributedMeshVerifyIsPrepared ( )
inline

Definition at line 75 of file mesh_base_test.C.

References mesh, and TestCommWorld.

76  {
79  }
void testMeshBaseVerifyIsPrepared(UnstructuredMesh &mesh)
libMesh::Parallel::Communicator * TestCommWorld
Definition: driver.C:171
MeshBase & mesh
The DistributedMesh class is derived from the MeshBase class, and is intended to provide identical fu...

◆ testMeshBaseVerifyIsPrepared()

void MeshBaseTest::testMeshBaseVerifyIsPrepared ( UnstructuredMesh mesh)
inline

Build a 2d 2x2 square mesh (mesh_one) covering [0.0, 1.0] x [0.0, 1.0] with linear Quad elements.

Definition at line 38 of file mesh_base_test.C.

References libMesh::MeshTools::Generation::build_square(), libMesh::invalid_uint, mesh, libMesh::Elem::neighbor_ptr(), libMesh::QUAD9, libMesh::MeshBase::query_elem_ptr(), libMesh::Elem::set_neighbor(), libMesh::Elem::side_index_range(), libMesh::MeshTools::valid_is_prepared(), and libMesh::Elem::which_neighbor_am_i().

39  {
45  2, 2,
46  0., 1.,
47  0., 1.,
48  QUAD9);
49 
50  // build_square does its own prepare_for_use(), so we should be
51  // prepared.
52  CPPUNIT_ASSERT(MeshTools::valid_is_prepared(mesh));
53 
54  // Break some neighbor links. Of course nobody would do this in
55  // real life, right?
56  Elem * elem0 = mesh.query_elem_ptr(0);
57  if (elem0)
58  for (auto n : elem0->side_index_range())
59  {
60  Elem * neigh = elem0->neighbor_ptr(n);
61  if (!neigh)
62  continue;
63  auto n_neigh = neigh->which_neighbor_am_i(elem0);
64  CPPUNIT_ASSERT(n_neigh != libMesh::invalid_uint);
65 
66  elem0->set_neighbor(n, nullptr);
67  neigh->set_neighbor(n_neigh, nullptr);
68  }
69 
70  // We're unprepared (prepare_for_use() will restitch those
71  // neighbor pointers) but we're not marked that way.
72  CPPUNIT_ASSERT(!MeshTools::valid_is_prepared(mesh));
73  }
const unsigned int invalid_uint
A number which is used quite often to represent an invalid or uninitialized value for an unsigned int...
Definition: libmesh.h:310
IntRange< unsigned short > side_index_range() const
Definition: elem.h:2710
bool valid_is_prepared(const MeshBase &mesh)
A function for testing whether a mesh&#39;s cached is_prepared() setting is not a false positive...
Definition: mesh_tools.C:1182
This is the base class from which all geometric element types are derived.
Definition: elem.h:94
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.
unsigned int which_neighbor_am_i(const Elem *e) const
This function tells you which neighbor e is.
Definition: elem.h:2919
void set_neighbor(const unsigned int i, Elem *n)
Assigns n as the neighbor.
Definition: elem.h:2618
const Elem * neighbor_ptr(unsigned int i) const
Definition: elem.h:2598
virtual const Elem * query_elem_ptr(const dof_id_type i) const =0

◆ testMeshVerifyIsPrepared()

void MeshBaseTest::testMeshVerifyIsPrepared ( )
inline

Definition at line 81 of file mesh_base_test.C.

References mesh, and TestCommWorld.

82  {
85  }
void testMeshBaseVerifyIsPrepared(UnstructuredMesh &mesh)
libMesh::Parallel::Communicator * TestCommWorld
Definition: driver.C:171
MeshBase & mesh
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
Definition: mesh.h:50

◆ testReplicatedMeshVerifyIsPrepared()

void MeshBaseTest::testReplicatedMeshVerifyIsPrepared ( )
inline

Definition at line 87 of file mesh_base_test.C.

References mesh, and TestCommWorld.

88  {
91  }
The ReplicatedMesh class is derived from the MeshBase class, and is used to store identical copies of...
void testMeshBaseVerifyIsPrepared(UnstructuredMesh &mesh)
libMesh::Parallel::Communicator * TestCommWorld
Definition: driver.C:171
MeshBase & mesh

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