1 #include <libmesh/equation_systems.h> 2 #include <libmesh/mesh.h> 3 #include <libmesh/mesh_generation.h> 4 #include <libmesh/numeric_vector.h> 5 #include <libmesh/dof_map.h> 6 #include <libmesh/elem.h> 7 #include <libmesh/default_coupling.h> 22 const Real & x = p(0);
23 const Real & y = LIBMESH_DIM > 1 ? p(1) : 0;
24 const Real & z = LIBMESH_DIM > 2 ? p(2) : 0;
26 return x*(1-x)*(1-x) + x*x*(1-y) + x*(1-y)*(1-z) + y*(1-y)*z + z*(1-z)*(1-z);
36 CPPUNIT_TEST( testCouplingOnEdge3 );
39 CPPUNIT_TEST( testCouplingOnQuad9 );
40 CPPUNIT_TEST( testCouplingOnTri6 );
41 CPPUNIT_TEST( testCouplingOnHex27 );
44 CPPUNIT_TEST_SUITE_END();
66 const unsigned int n_elem_per_side = 5;
67 const std::unique_ptr<Elem> test_elem =
Elem::build(elem_type);
68 const unsigned int ymax = test_elem->dim() > 1;
69 const unsigned int zmax = test_elem->dim() > 2;
70 const unsigned int ny = ymax * n_elem_per_side;
71 const unsigned int nz = zmax * n_elem_per_side;
85 std::set<dof_id_type> evaluable_elements;
87 for (
const auto & elem :
mesh.active_local_element_ptr_range())
90 evaluable_elements.insert(elem->id());
92 for (
unsigned int s1=0; s1 != elem->n_neighbors(); ++s1)
101 if (!evaluable_elements.count(n1->
id()))
104 evaluable_elements.insert(n1->
id());
107 for (
unsigned int s2=0; s2 != elem->n_neighbors(); ++s2)
114 if (!evaluable_elements.count(n2->
id()))
117 evaluable_elements.insert(n2->
id());
120 for (
unsigned int s3=0; s3 != elem->n_neighbors(); ++s3)
125 evaluable_elements.count(n3->
id()))
129 evaluable_elements.insert(n3->
id());
141 const std::size_t n_evaluable =
145 CPPUNIT_ASSERT_EQUAL(evaluable_elements.size(), n_evaluable);
ElemType
Defines an enum for geometric element types.
This is the EquationSystems class.
This class provides the ability to map between arbitrary, user-defined strings and several data types...
libMesh::Parallel::Communicator * TestCommWorld
static constexpr Real TOLERANCE
void testCouplingOnQuad9()
This is the base class from which all geometric element types are derived.
DefaultCoupling & default_algebraic_ghosting()
Default algebraic ghosting functor.
Number point_value(unsigned int var, const Point &p, const bool insist_on_success=true, const NumericVector< Number > *sol=nullptr) const
CPPUNIT_TEST_SUITE_REGISTRATION(DefaultCouplingTest)
void testCouplingOnTri6()
void testCouplingOnHex27()
The libMesh namespace provides an interface to certain functionality in the library.
Real distance(const Point &p)
void project_solution(FunctionBase< Number > *f, FunctionBase< Gradient > *g=nullptr) const
Projects arbitrary functions onto the current solution.
Number cubic_default_coupling_test(const Point &p, const Parameters &, const std::string &, const std::string &)
void testCouplingOnEdge3()
Manages consistently variables, degrees of freedom, and coefficient vectors.
static std::unique_ptr< Elem > build(const ElemType type, Elem *p=nullptr)
void testCoupling(const ElemType elem_type)
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.
const Elem * neighbor_ptr(unsigned int i) const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void set_n_levels(unsigned int n_levels)
Parameters parameters
Data structure holding arbitrary parameters.
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.
processor_id_type processor_id() const
const DofMap & get_dof_map() const
processor_id_type processor_id() const
A Point defines a location in LIBMESH_DIM dimensional Real space.
Point vertex_average() const
bool is_evaluable(const DofObjectSubclass &obj, unsigned int var_num=libMesh::invalid_uint) const