Definition at line 14 of file extra_integers.C.
◆ build_mesh()
std::array<unsigned int, 6> ExtraIntegersTest::build_mesh |
( |
Mesh & |
mesh, |
|
|
ElemType |
elem_type, |
|
|
unsigned int |
n_elem_per_side |
|
) |
| |
|
inlineprotected |
Definition at line 37 of file extra_integers.C.
47 const std::unique_ptr<Elem> test_elem = Elem::build(elem_type);
48 const unsigned int ymax = test_elem->dim() > 1;
49 const unsigned int zmax = test_elem->dim() > 2;
50 const unsigned int ny = ymax * n_elem_per_side;
51 const unsigned int nz = zmax * n_elem_per_side;
61 return {i1, r1, ni1, ni2, nr1, nr2};
References libMesh::MeshBase::add_elem_datum(), libMesh::MeshBase::add_elem_integer(), libMesh::MeshBase::add_node_datum(), libMesh::MeshBase::add_node_integer(), libMesh::Elem::build(), libMesh::MeshTools::Generation::build_cube(), mesh, and libMesh::Real.
◆ checkpoint_helper()
void ExtraIntegersTest::checkpoint_helper |
( |
ElemType |
elem_type, |
|
|
unsigned int |
n_elem_per_side, |
|
|
bool |
binary |
|
) |
| |
|
inlineprotected |
Definition at line 157 of file extra_integers.C.
161 std::array<unsigned int, 6> ini =
build_mesh(
mesh, elem_type, n_elem_per_side);
162 const unsigned int i1 = ini[0], ni1 = ini[2], ni2 = ini[3];
166 const std::string filename =
167 std::string(
"extra_integers.cp") + (binary ?
"r" :
"a");
175 mesh2.read(filename);
178 CPPUNIT_ASSERT_EQUAL(i1, mesh2.add_elem_integer(
"i1"));
179 CPPUNIT_ASSERT_EQUAL(ni1, mesh2.add_node_integer(
"ni1"));
180 CPPUNIT_ASSERT_EQUAL(ni2, mesh2.add_node_integer(
"ni2"));
References libMesh::MeshBase::add_elem_integer(), libMesh::MeshBase::add_node_integer(), mesh, libMesh::UnstructuredMesh::read(), TestCommWorld, and libMesh::MeshBase::write().
◆ CPPUNIT_TEST() [1/4]
◆ CPPUNIT_TEST() [2/4]
◆ CPPUNIT_TEST() [3/4]
◆ CPPUNIT_TEST() [4/4]
◆ CPPUNIT_TEST_SUITE()
The goal of this test is to verify the ability to add extra integer storage to a Mesh object, then set and query those extra integers in the objects within the mesh.
◆ CPPUNIT_TEST_SUITE_END()
ExtraIntegersTest::CPPUNIT_TEST_SUITE_END |
( |
| ) |
|
◆ setUp()
void ExtraIntegersTest::setUp |
( |
| ) |
|
|
inline |
◆ tearDown()
void ExtraIntegersTest::tearDown |
( |
| ) |
|
|
inline |
◆ test_and_set_initial_data()
void ExtraIntegersTest::test_and_set_initial_data |
( |
Mesh & |
mesh, |
|
|
std::array< unsigned int, 6 > |
ini |
|
) |
| |
|
inlineprotected |
Definition at line 66 of file extra_integers.C.
68 const unsigned int i1 = ini[0],
75 const unsigned int expected_extra_ints =
77 CPPUNIT_ASSERT_EQUAL(elem->n_extra_integers(), expected_extra_ints);
78 CPPUNIT_ASSERT_EQUAL(elem->get_extra_integer(i1), DofObject::invalid_id);
79 elem->set_extra_integer(i1,
dof_id_type(elem->point(0)(0)*100));
80 CPPUNIT_ASSERT_EQUAL(elem->get_extra_integer(i1),
dof_id_type(elem->point(0)(0)*100));
81 elem->set_extra_datum<
Real>(r1, elem->point(0)(0)*1000);
82 CPPUNIT_ASSERT_EQUAL(elem->get_extra_datum<
Real>(r1), elem->point(0)(0)*1000);
87 const unsigned int expected_extra_ints =
89 CPPUNIT_ASSERT_EQUAL(node->n_extra_integers(), expected_extra_ints);
90 CPPUNIT_ASSERT_EQUAL(node->get_extra_integer(ni1), DofObject::invalid_id);
91 CPPUNIT_ASSERT_EQUAL(node->get_extra_integer(ni2), DofObject::invalid_id);
92 node->set_extra_datum<
Real>(nr1, (*node)(0)*1000);
93 CPPUNIT_ASSERT_EQUAL(node->get_extra_datum<
Real>(nr1), (*node)(0)*1000);
References libMesh::MeshBase::element_ptr_range(), libMesh::DofObject::invalid_id, mesh, libMesh::MeshBase::node_ptr_range(), and libMesh::Real.
◆ test_final_integers()
void ExtraIntegersTest::test_final_integers |
( |
Mesh & |
mesh, |
|
|
unsigned int |
i1 |
|
) |
| |
|
inlineprotected |
◆ test_helper()
void ExtraIntegersTest::test_helper |
( |
ElemType |
elem_type, |
|
|
unsigned int |
n_elem_per_side |
|
) |
| |
|
inlineprotected |
◆ testExtraIntegersCheckpointEdge3()
void ExtraIntegersTest::testExtraIntegersCheckpointEdge3 |
( |
| ) |
|
|
inline |
◆ testExtraIntegersCheckpointHex8()
void ExtraIntegersTest::testExtraIntegersCheckpointHex8 |
( |
| ) |
|
|
inline |
◆ testExtraIntegersEdge2()
void ExtraIntegersTest::testExtraIntegersEdge2 |
( |
| ) |
|
|
inline |
◆ testExtraIntegersTri6()
void ExtraIntegersTest::testExtraIntegersTri6 |
( |
| ) |
|
|
inline |
The documentation for this class was generated from the following file:
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
virtual void write(const std::string &name)=0
unsigned int add_elem_datum(const std::string &name, bool allocate_data=true)
Register a datum (of type T) to be added to each element in the mesh.
const Point & point(const unsigned int i) const
virtual SimpleRange< element_iterator > element_ptr_range()=0
Implements (adaptive) mesh refinement algorithms for a MeshBase.
virtual SimpleRange< node_iterator > node_ptr_range()=0
libMesh::Parallel::Communicator * TestCommWorld
unsigned int add_elem_integer(const std::string &name, bool allocate_data=true)
Register an integer datum (of type dof_id_type) to be added to each element in the mesh.
unsigned int add_node_integer(const std::string &name, bool allocate_data=true)
Register an integer datum (of type dof_id_type) to be added to each node in the mesh.
unsigned int add_node_datum(const std::string &name, bool allocate_data=true)
Register a datum (of type T) to be added to each node in the mesh.
This is the base class from which all geometric element types are derived.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual void partition(const unsigned int n_parts)
Call the default partitioner (currently metis_partition()).
const Elem * top_parent() const