1 #include <libmesh/mesh.h> 2 #include <libmesh/mesh_generation.h> 3 #include <libmesh/elem.h> 4 #include <libmesh/node.h> 5 #include <libmesh/parallel.h> 19 CPPUNIT_TEST( testLocatorOnEdge3 );
21 CPPUNIT_TEST( testLocatorOnQuad9 );
22 CPPUNIT_TEST( testLocatorOnTri6 );
25 CPPUNIT_TEST( testLocatorOnHex27 );
26 CPPUNIT_TEST( testPlanar );
29 CPPUNIT_TEST_SUITE_END();
44 const unsigned int n_elem_per_side = 5;
46 const unsigned int ymax =
dim > 1;
47 const unsigned int zmax =
dim > 2;
48 const unsigned int ny = ymax * n_elem_per_side;
49 const unsigned int nz = zmax * n_elem_per_side;
63 locator->enable_out_of_mesh_mode();
65 for (
unsigned int i=0; i != n_elem_per_side+1; ++i)
67 for (
unsigned int j=0; j != ny+1; ++j)
69 for (
unsigned int k=0; k != nz+1; ++k)
72 Point p(i*h, j*h, k*h);
74 const Elem *elem = locator->operator()(p);
76 bool found_elem = elem;
80 CPPUNIT_ASSERT(found_elem);
86 const Node *node = locator->locate_node(p);
88 bool found_node = node;
92 CPPUNIT_ASSERT(found_node);
96 LIBMESH_ASSERT_FP_EQUAL(i*h, (*node)(0),
99 LIBMESH_ASSERT_FP_EQUAL(j*h, (*node)(1),
102 LIBMESH_ASSERT_FP_EQUAL(k*h, (*node)(2),
124 for (
auto & node :
mesh.node_ptr_range())
125 (*node)(2) += 3.1e-15;
132 locator->enable_out_of_mesh_mode();
137 Point p(0.53, 0.7, 0.0);
138 const Elem *elem = (*locator)(p);
140 bool found_elem = elem;
144 CPPUNIT_ASSERT(found_elem);
void testLocator(const ElemType elem_type)
ElemType
Defines an enum for geometric element types.
CPPUNIT_TEST_SUITE_REGISTRATION(PointLocatorTest)
A Node is like a Point, but with more information.
std::unique_ptr< PointLocatorBase > sub_point_locator() const
libMesh::Parallel::Communicator * TestCommWorld
static constexpr Real TOLERANCE
static const unsigned int type_to_dim_map[INVALID_ELEM]
This array maps the integer representation of the ElemType enum to the geometric dimension of the ele...
This is the base class from which all geometric element types are derived.
const Parallel::Communicator & comm() const
void testLocatorOnHex27()
The libMesh namespace provides an interface to certain functionality in the library.
virtual bool is_serial() const
void testLocatorOnQuad9()
virtual bool contains_point(const Point &p, Real tol=TOLERANCE) const
void testLocatorOnEdge3()
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void max(const T &r, T &o, Request &req) const
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
A Point defines a location in LIBMESH_DIM dimensional Real space.