1 #include <libmesh/partitioner.h> 2 #include <libmesh/mesh.h> 3 #include <libmesh/mesh_generation.h> 4 #include <libmesh/equation_systems.h> 5 #include <libmesh/elem.h> 6 #include <libmesh/system.h> 7 #include <libmesh/dof_map.h> 27 std::unique_ptr<Partitioner>
clone()
const override 29 return std::make_unique<ContrivedPartitioner>(*this);
37 unsigned int n_interior_elems = 0;
40 bool internal_elem =
true;
44 internal_elem =
false;
52 n_interior_elems += internal_elem;
53 elem->processor_id() = internal_elem;
57 CPPUNIT_ASSERT_EQUAL(n_interior_elems, 1u);
68 CPPUNIT_TEST_SUITE_END();
86 auto & nodal_dof_map = nodal_system.get_dof_map();
87 nodal_dof_map.remove_default_ghosting();
90 auto & elem_dof_map = elem_system.get_dof_map();
91 elem_dof_map.remove_default_ghosting();
97 mesh.evaluable_elements_end(nodal_dof_map));
98 typedef decltype(n_evaluable) comp_type;
102 CPPUNIT_ASSERT_EQUAL(n_evaluable, comp_type(9));
106 CPPUNIT_ASSERT_EQUAL(n_evaluable, comp_type(1));
110 CPPUNIT_ASSERT_EQUAL(n_evaluable, comp_type(0));
117 mesh.evaluable_elements_end(elem_dof_map));
118 typedef decltype(n_evaluable) comp_type;
122 CPPUNIT_ASSERT_EQUAL(n_evaluable, comp_type(
TestCommWorld->
size() == 1 ? 9 : 8));
126 CPPUNIT_ASSERT_EQUAL(n_evaluable, comp_type(1));
130 CPPUNIT_ASSERT_EQUAL(n_evaluable, comp_type(0));
136 std::vector<const DofMap *> dof_maps = {&nodal_dof_map, &elem_dof_map};
138 mesh.multi_evaluable_elements_end(dof_maps));
139 typedef decltype(n_evaluable) comp_type;
143 CPPUNIT_ASSERT_EQUAL(n_evaluable, comp_type(
TestCommWorld->
size() == 1 ? 9 : 8));
147 CPPUNIT_ASSERT_EQUAL(n_evaluable, comp_type(1));
151 CPPUNIT_ASSERT_EQUAL(n_evaluable, comp_type(0));
This is the EquationSystems class.
libMesh::Parallel::Communicator * TestCommWorld
This is the base class from which all geometric element types are derived.
virtual std::unique_ptr< Partitioner > & partitioner()
A partitioner to use at each prepare_for_use()
processor_id_type rank() const
The libMesh namespace provides an interface to certain functionality in the library.
Real distance(const Point &p)
This is the MeshBase class.
The Partitioner class provides a uniform interface for partitioning algorithms.
processor_id_type size() const
Manages consistently variables, degrees of freedom, and coefficient vectors.
SimpleRange< IndexType > as_range(const std::pair< IndexType, IndexType > &p)
Helper function that allows us to treat a homogenous pair as a range.
CPPUNIT_TEST_SUITE_REGISTRATION(MultiEvaluablePredTest)
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.
SimpleRange< NeighborPtrIter > neighbor_ptr_range()
Returns a range with all neighbors of an element, usable in range-based for loops.
virtual void init()
Initialize all the systems.
virtual System & add_system(std::string_view system_type, std::string_view name)
Add the system of type system_type named name to the systems array.
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
void _do_partition(MeshBase &mesh, const unsigned int n) override
This is the actual partitioning method which must be overridden in derived classes.
std::unique_ptr< Partitioner > clone() const override