83 for (
auto & elem :
mesh.active_element_ptr_range())
85 Point c = elem->vertex_average();
86 elem->subdomain_id() =
105 const std::set<subdomain_id_type> sbdids1 {0,2,11,13,20,22,31,33};
106 const std::set<subdomain_id_type> sbdids2 {1,3,10,12,21,23,30,32};
107 mesh_function.
init();
109 mesh_function.set_subdomain_ids(&sbdids1);
112 const std::string dummy;
116 for (
auto & elem :
mesh.active_local_element_ptr_range())
118 const Point c = elem->vertex_average();
119 const Real expected_value =
121 const std::vector<Point> offsets
122 {{0,-1/8.}, {1/8.,0}, {0,1/8.}, {-1/8.,0}};
123 for (
Point offset : offsets)
125 const Point p = c + offset;
126 mesh_function(p, 0, vec_values, &sbdids1);
127 const Number retval1 = vec_values.
empty() ? -12345 : vec_values(0);
128 mesh_function(p, 0, vec_values, &sbdids2);
129 const Number retval2 = vec_values.
empty() ? -12345 : vec_values(0);
130 mesh_function(c, 0, vec_values,
nullptr);
131 const Number retval3 = vec_values.
empty() ? -12345 : vec_values(0);
133 LIBMESH_ASSERT_NUMBERS_EQUAL
136 if (sbdids1.count(elem->subdomain_id()))
138 CPPUNIT_ASSERT(!sbdids2.count(elem->subdomain_id()));
139 LIBMESH_ASSERT_NUMBERS_EQUAL
142 mesh_function(c, 0, vec_values, &sbdids2);
143 CPPUNIT_ASSERT(vec_values.
empty());
147 LIBMESH_ASSERT_NUMBERS_EQUAL
150 mesh_function(c, 0, vec_values, &sbdids1);
151 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.