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

Public Member Functions

 LIBMESH_CPPUNIT_TEST_SUITE (MeshDeletionsTest)
 This test ensures operations like delete_elem don't cause problems with later mesh preparation.
 
 CPPUNIT_TEST (testDeleteElemReplicated)
 
 CPPUNIT_TEST (testDeleteElemDistributed)
 
 CPPUNIT_TEST_SUITE_END ()
 
void setUp ()
 
void tearDown ()
 
void testDeleteElem (UnstructuredMesh &mesh)
 
void testDeleteElemReplicated ()
 
void testDeleteElemDistributed ()
 

Detailed Description

Definition at line 14 of file mesh_deletions.C.

Member Function Documentation

◆ CPPUNIT_TEST() [1/2]

MeshDeletionsTest::CPPUNIT_TEST ( testDeleteElemDistributed  )

◆ CPPUNIT_TEST() [2/2]

MeshDeletionsTest::CPPUNIT_TEST ( testDeleteElemReplicated  )

◆ CPPUNIT_TEST_SUITE_END()

MeshDeletionsTest::CPPUNIT_TEST_SUITE_END ( )

◆ LIBMESH_CPPUNIT_TEST_SUITE()

MeshDeletionsTest::LIBMESH_CPPUNIT_TEST_SUITE ( MeshDeletionsTest  )

This test ensures operations like delete_elem don't cause problems with later mesh preparation.

◆ setUp()

void MeshDeletionsTest::setUp ( )
inline

Definition at line 32 of file mesh_deletions.C.

33 {
34 }

◆ tearDown()

void MeshDeletionsTest::tearDown ( )
inline

Definition at line 36 of file mesh_deletions.C.

37 {
38 }

◆ testDeleteElem()

void MeshDeletionsTest::testDeleteElem ( UnstructuredMesh mesh)
inline

Definition at line 40 of file mesh_deletions.C.

41 {
42 LOG_UNIT_TEST;
43
44 // Let's not trust Metis or Parmetis to give us a replicable test
45 // case.
47
49 3, 3,
50 0., 1.,
51 0., 1.,
52 QUAD4);
53
54 std::vector<std::vector<int>> deletions =
55 {{1, 2, 4}, {0, 3}, {0, 2}, {1}};
57 for (auto deletionset : deletions)
58 {
59 for (int e : deletionset)
60 {
61 --n_elem;
62 Elem * elem = mesh.query_elem_ptr(e);
63 if (elem)
64 {
65 elem->remove_links_to_me();
66 mesh.delete_elem(elem);
67 }
68 }
69
71
72 CPPUNIT_ASSERT_EQUAL(mesh.n_elem(), n_elem);
73 }
74 }
This is the base class from which all geometric element types are derived.
Definition elem.h:96
void remove_links_to_me()
Resets this element's neighbors' appropriate neighbor pointers and its parent's and children's approp...
Definition elem.C:1648
virtual std::unique_ptr< Partitioner > & partitioner()
A partitioner to use at each partitioning.
Definition mesh_base.h:165
virtual dof_id_type n_elem() const =0
void prepare_for_use(const bool skip_renumber_nodes_and_elements, const bool skip_find_neighbors)
Prepare a newly created (or read) mesh for use.
Definition mesh_base.C:824
virtual void delete_elem(Elem *e)=0
Removes element e from the mesh.
virtual const Elem * query_elem_ptr(const dof_id_type i) const =0
static std::unique_ptr< Partitioner > build(const PartitionerType solver_package)
Builds a Partitioner of the type specified by partitioner_type.
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.
dof_id_type n_elem(const MeshBase::const_element_iterator &begin, const MeshBase::const_element_iterator &end)
Count up the number of elements of a specific type (as defined by an iterator range).
uint8_t dof_id_type
Definition id_types.h:67

References libMesh::Partitioner::build(), libMesh::MeshTools::Generation::build_square(), libMesh::MeshBase::delete_elem(), libMesh::LINEAR_PARTITIONER, mesh, libMesh::MeshBase::n_elem(), libMesh::MeshBase::partitioner(), libMesh::MeshBase::prepare_for_use(), libMesh::QUAD4, libMesh::MeshBase::query_elem_ptr(), and libMesh::Elem::remove_links_to_me().

Referenced by testDeleteElemDistributed(), and testDeleteElemReplicated().

◆ testDeleteElemDistributed()

void MeshDeletionsTest::testDeleteElemDistributed ( )
inline

Definition at line 83 of file mesh_deletions.C.

84 {
85 LOG_UNIT_TEST;
86 DistributedMesh mesh(*TestCommWorld);
88 }
void testDeleteElem(UnstructuredMesh &mesh)
The DistributedMesh class is derived from the MeshBase class, and is intended to provide identical fu...

References mesh, TestCommWorld, and testDeleteElem().

◆ testDeleteElemReplicated()

void MeshDeletionsTest::testDeleteElemReplicated ( )
inline

Definition at line 76 of file mesh_deletions.C.

77 {
78 LOG_UNIT_TEST;
79 ReplicatedMesh mesh(*TestCommWorld);
81 }
The ReplicatedMesh class is derived from the MeshBase class, and is used to store identical copies of...

References mesh, TestCommWorld, and testDeleteElem().


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