234 Point top(0.5, 0.5, 0.0);
237 Point bottom(0.5, -0.5, 0.0);
240 Point face(0.5, 0.0, 0.0);
250 std::vector<unsigned int> variables;
252 std::unique_ptr<NumericVector<Number>> mesh_function_vector =
255 sys.
solution->localize(*mesh_function_vector);
259 mesh_function.
init();
262 std::map<const Elem *, Gradient> top_val = mesh_function.discontinuous_gradient(top);
265 CPPUNIT_ASSERT (top_val.size() == 1);
268 for (std::map<const Elem *, Gradient>::const_iterator it = top_val.begin(); it != top_val.end(); ++it)
269 CPPUNIT_ASSERT (it->first->id() == 0 && std::abs(it->second(1) - 2.0) < 1.0e-10);
272 std::map<const Elem *, Gradient> bottom_val = mesh_function.discontinuous_gradient(bottom);
275 CPPUNIT_ASSERT (bottom_val.size() == 1);
278 for (std::map<const Elem *, Gradient>::const_iterator it = bottom_val.begin(); it != bottom_val.end(); ++it)
279 CPPUNIT_ASSERT (it->first->id() == 1 && std::abs(it->second(1) - 1.0) < 1.0e-10);
282 std::map<const Elem *, Gradient> face_val = mesh_function.discontinuous_gradient(face);
285 CPPUNIT_ASSERT (face_val.size() == 2);
288 for (std::map<const Elem *, Gradient>::const_iterator it = face_val.begin(); it != face_val.end(); ++it)
289 if (it->first->id() == 0)
290 CPPUNIT_ASSERT (std::abs(it->second(1) - 2.0) < 1.0e-10);
291 else if (it->first->id() == 1)
292 CPPUNIT_ASSERT (std::abs(it->second(1) - 1.0) < 1.0e-10);
294 CPPUNIT_ASSERT (
false);
Number position_function2(const Point &p, const Parameters &, const std::string &, const std::string &)
This is the EquationSystems class.
Provides a uniform interface to vector storage schemes for different linear algebra libraries...
void get_all_variable_numbers(std::vector< unsigned int > &all_variable_numbers) const
Fills all_variable_numbers with all the variable numbers for the variables that have been added to th...
virtual void init(const numeric_index_type n, const numeric_index_type n_local, const bool fast=false, const ParallelType ptype=AUTOMATIC)=0
Change the dimension of the vector to n.
dof_id_type n_dofs() 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.
std::unique_ptr< NumericVector< Number > > solution
Data structure to hold solution values.
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.
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.
std::unique_ptr< ReplicatedMesh > _mesh