2 #include <libmesh/dof_map.h> 3 #include <libmesh/elem.h> 4 #include <libmesh/equation_systems.h> 5 #include <libmesh/linear_implicit_system.h> 6 #include <libmesh/non_manifold_coupling.h> 7 #include <libmesh/partitioner.h> 8 #include <libmesh/replicated_mesh.h> 9 #include <libmesh/sides_to_elem_map.h> 39 virtual std::unique_ptr<Partitioner>
clone ()
const override 41 return std::make_unique<NonManifoldTestPartitioner>(*this);
50 const unsigned int n)
override 54 this->single_partition_range (
mesh.active_elements_begin(),
mesh.active_elements_end());
62 libmesh_assert_greater (n, 0);
66 auto success = [&]() ->
bool 68 for (
const auto & elem :
mesh.element_ptr_range())
69 for (
auto s : elem->side_index_range())
71 const auto [side_neighbors_begin, side_neighbors_end] =
74 if (
std::distance(side_neighbors_begin, side_neighbors_end) == 5)
76 for (
auto [e, it] = std::make_tuple(0u, side_neighbors_begin);
77 it != side_neighbors_end; ++e, ++it)
108 libmesh_error_msg_if(!success,
"Did not find expected non-manifold edge.");
121 std::unique_ptr<EquationSystems>
_es;
128 _mesh = std::make_unique<ReplicatedMesh>(*TestCommWorld);
129 _mesh->read(mesh_filename);
133 _mesh->partitioner() = std::make_unique<NonManifoldTestPartitioner>();
135 _mesh->prepare_for_use();
144 _es = std::make_unique<EquationSystems>(*_mesh);
158 auto ghosting_functor = std::make_shared<NonManifoldGhostingFunctor>(*_mesh);
175 #if defined(LIBMESH_HAVE_EXODUS_API) 176 CPPUNIT_TEST( verifySendListEntries0 );
177 CPPUNIT_TEST( verifySendListEntries1 );
178 CPPUNIT_TEST( verifySendListEntries2 );
179 CPPUNIT_TEST( verifySendListEntries3 );
182 CPPUNIT_TEST_SUITE_END();
203 this->read_mesh(mesh_filename);
207 System & system = _es->get_system(
"SimpleSystem");
209 const std::vector<dof_id_type> & send_list = dof_map.
get_send_list();
217 auto side_neighbors_found = [&]() ->
bool 219 for (
const auto & elem : _mesh->element_ptr_range())
220 for (
auto s : elem->side_index_range())
237 CPPUNIT_ASSERT(side_neighbors_found);
242 for (
auto it_e = beg; it_e != end; ++it_e)
243 for (
auto it_f =
std::next(it_e); it_f != end; ++it_f)
246 auto check_dofs = [&](
const Elem * elem)
248 std::vector<dof_id_type> dof_indices;
251 for (
const auto & dof : dof_indices)
254 bool is_in_send_list = (
Utility::binary_find(send_list.begin(), send_list.end(), dof) != send_list.end());
255 CPPUNIT_ASSERT(is_local || is_in_send_list);
259 const Elem * elem_e = *it_e;
260 const Elem * elem_f = *it_f;
dof_id_type end_dof(const processor_id_type proc) const
void dof_indices(const Elem *const elem, std::vector< dof_id_type > &di) const
Manages consistently variables, degrees of freedom, coefficient vectors, matrices and linear solvers ...
void verifySendListEntries2()
This is the base class from which all geometric element types are derived.
void verify_send_list_entries_helper(const std::string &mesh_filename)
The libMesh namespace provides an interface to certain functionality in the library.
std::unique_ptr< EquationSystems > _es
std::unique_ptr< MeshBase > _mesh
Real distance(const Point &p)
void add_coupling_functor(GhostingFunctor &coupling_functor, bool to_mesh=true)
Adds a functor which can specify coupling requirements for creation of sparse matrices.
This is the MeshBase class.
The Partitioner class provides a uniform interface for partitioning algorithms.
This class handles the numbering of degrees of freedom on a mesh.
virtual std::unique_ptr< Partitioner > clone() const override
void verifySendListEntries0()
Manages consistently variables, degrees of freedom, and coefficient vectors.
unsigned int add_variable(std::string_view var, const FEType &type, const std::set< subdomain_id_type > *const active_subdomains=nullptr)
Adds the variable var to the list of variables for this system.
void verifySendListEntries3()
virtual const Elem * elem_ptr(const dof_id_type i) const =0
virtual void _do_partition(MeshBase &mesh, const unsigned int n) override
Partition the MeshBase onto n processors.
ForwardIterator binary_find(ForwardIterator first, ForwardIterator last, const T &value)
The STL provides std::binary_search() which returns true or false depending on whether the searched-f...
void read_mesh(const std::string &mesh_filename)
void verifySendListEntries1()
dof_id_type first_dof(const processor_id_type proc) const
CPPUNIT_TEST_SUITE_REGISTRATION(NonManifoldGhostingFunctorTest)
const DofMap & get_dof_map() const
processor_id_type processor_id() const
const std::vector< dof_id_type > & get_send_list() const