76 for (
auto & elem :
mesh.active_element_ptr_range())
78 Point c = elem->vertex_average();
79 elem->subdomain_id() =
98 const std::set<subdomain_id_type> sbdids1 {0,2,11,13,20,22,31,33};
99 const std::set<subdomain_id_type> sbdids2 {1,3,10,12,21,23,30,32};
100 mesh_function.
init();
102 mesh_function.set_subdomain_ids(&sbdids1);
105 const std::string dummy;
109 for (
auto & elem :
mesh.active_local_element_ptr_range())
111 const Point c = elem->vertex_average();
112 const Real expected_value =
114 const std::vector<Point> offsets
115 {{0,-1/8.}, {1/8.,0}, {0,1/8.}, {-1/8.,0}};
116 for (
Point offset : offsets)
118 const Point p = c + offset;
119 mesh_function(p, 0, vec_values, &sbdids1);
120 const Number retval1 = vec_values.
empty() ? -12345 : vec_values(0);
121 mesh_function(p, 0, vec_values, &sbdids2);
122 const Number retval2 = vec_values.
empty() ? -12345 : vec_values(0);
123 mesh_function(c, 0, vec_values,
nullptr);
124 const Number retval3 = vec_values.
empty() ? -12345 : vec_values(0);
126 LIBMESH_ASSERT_FP_EQUAL(
libmesh_real(retval3), expected_value,
129 if (sbdids1.count(elem->subdomain_id()))
131 CPPUNIT_ASSERT(!sbdids2.count(elem->subdomain_id()));
132 LIBMESH_ASSERT_FP_EQUAL(
libmesh_real(retval1), expected_value,
135 mesh_function(c, 0, vec_values, &sbdids2);
136 CPPUNIT_ASSERT(vec_values.
empty());
140 LIBMESH_ASSERT_FP_EQUAL(
libmesh_real(retval2), expected_value,
143 mesh_function(c, 0, vec_values, &sbdids1);
144 CPPUNIT_ASSERT(vec_values.
empty());
This is the EquationSystems class.
The ReplicatedMesh class is derived from the MeshBase class, and is used to store identical copies of...
Number trilinear_function(const Point &p, const Parameters &, const std::string &, const std::string &)
libMesh::Parallel::Communicator * TestCommWorld
static constexpr Real TOLERANCE
TestClass subdomain_id_type
Based on the 4-byte comment warning above, this probably doesn't work with exodusII at all...
const EquationSystems & get_equation_systems() const
void project_solution(FunctionBase< Number > *f, FunctionBase< Gradient > *g=nullptr) const
Projects arbitrary functions onto the current solution.
Manages consistently variables, degrees of freedom, and coefficient vectors.
virtual bool empty() const override final
virtual void init() override
Override the FunctionBase::init() member function.
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.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
std::unique_ptr< NumericVector< Number > > current_local_solution
All the values I need to compute my contribution to the simulation at hand.
This class provides function-like objects for data distributed over a mesh.
const DofMap & get_dof_map() const
A Point defines a location in LIBMESH_DIM dimensional Real space.