51 {
52 LOG_UNIT_TEST;
53
54#if LIBMESH_DIM < 2
55 return;
56#else
58
60 5, 5,
61 -1., 1.,
62 -1., 1.,
64
67
68
71
72 es.init();
73
74
76
77
79
80
81 const Real r2 = 0.5 * 0.5;
82
83 std::vector<const Elem *> selected_elems;
84 for (
const auto &e :
mesh.active_local_element_ptr_range())
85 {
86 const Point c = e->vertex_average();
87 if (c(0) * c(0) + c(1) * c(1) <= r2)
88 selected_elems.push_back(e);
89 }
90
91
92
94
95
96 std::vector<unsigned int> vars_to_project = {u_var};
97 sys.
project_solution(circle_projection_function,
nullptr, es.parameters, circle_range, vars_to_project);
98
99
100
101
102 const Real tol = 1e-3;
103
104 for (
const auto &e :
mesh.active_local_element_ptr_range())
105 {
106 const Point c = e->vertex_average();
107 const bool inside = (c(0) * c(0) + c(1) * c(1) <= r2);
108
109 std::vector<dof_id_type> u_indices, v_indices;
112
115
116 const Number val_baseline = baseline_linear_function(c, es.parameters,
"",
"");
117 const Number val_projected = circle_projection_function(c, es.parameters,
"",
"");
118 if (inside)
119
120 LIBMESH_ASSERT_NUMBERS_EQUAL(u_val, val_projected, tol);
121 else
122
123 LIBMESH_ASSERT_NUMBERS_EQUAL(u_val, val_baseline, tol);
124
125
126 LIBMESH_ASSERT_NUMBERS_EQUAL(v_val, val_baseline, tol);
127 }
128#endif
129 }
This class handles the numbering of degrees of freedom on a mesh.
void dof_indices(const Elem *const elem, std::vector< dof_id_type > &di) const
This is the EquationSystems class.
A Point defines a location in LIBMESH_DIM dimensional Real space.
The ReplicatedMesh class is derived from the MeshBase class, and is used to store identical copies of...
The StoredRange class defines a contiguous, divisible set of objects.
Manages consistently variables, degrees of freedom, and coefficient vectors.
void project_solution(FunctionBase< Number > *f, FunctionBase< Gradient > *g=nullptr, std::optional< ConstElemRange > active_local_range=std::nullopt, std::optional< std::vector< unsigned int > > variable_numbers=std::nullopt) const
Projects arbitrary functions onto the current solution.
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.
std::unique_ptr< NumericVector< Number > > solution
Data structure to hold solution values.
const DofMap & get_dof_map() const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real