19 #include "libmesh/variational_smoother_constraint.h" 20 #include "libmesh/mesh_tools.h" 29 _preserve_subdomain_boundaries(preserve_subdomain_boundaries)
39 std::unordered_map<dof_id_type, std::vector<const Elem *>> nodes_to_elem_map;
43 for (
const auto & bid : boundary_node_ids)
45 const auto & node =
mesh.node_ref(bid);
48 std::vector<const Node *> neighbors;
53 std::remove_if(neighbors.begin(), neighbors.end(),
54 [&boundary_node_ids](
const Node * neigh) {
55 return boundary_node_ids.find(neigh->id()) == boundary_node_ids.end();
80 auto already_constrained_node_ids = boundary_node_ids;
81 for (
const auto * elem :
mesh.active_element_ptr_range())
83 const auto & subdomain_id = elem->subdomain_id();
84 for (
const auto side : elem->side_index_range())
86 const auto * neighbor = elem->neighbor_ptr(side);
87 if (neighbor ==
nullptr)
90 const auto & neighbor_subdomain_id = neighbor->subdomain_id();
91 if (subdomain_id != neighbor_subdomain_id)
93 for (
const auto local_node_id : elem->nodes_on_side(side))
95 const auto & node =
mesh.node_ref(elem->node_id(local_node_id));
98 std::find(already_constrained_node_ids.begin(),
99 already_constrained_node_ids.end(),
100 node.id()) == already_constrained_node_ids.end()
104 already_constrained_node_ids.insert(node.id());
121 const auto constrained_value = node(d);
dof_id_type dof_number(const unsigned int s, const unsigned int var, const unsigned int comp) const
A Node is like a Point, but with more information.
The libMesh namespace provides an interface to certain functionality in the library.
const MeshBase & get_mesh() const
unsigned int number() const
void add_constraint_row(const dof_id_type dof_number, const DofConstraintRow &constraint_row, const Number constraint_rhs, const bool forbid_constraint_overwrite)
Adds a copy of the user-defined row to the constraint matrix, using an inhomogeneous right-hand-side ...
Manages consistently variables, degrees of freedom, and coefficient vectors.
virtual ~VariationalSmootherConstraint() override
const bool _preserve_subdomain_boundaries
Whether nodes on subdomain boundaries are subject to change via smoothing.
virtual void constrain() override
Constraint function.
std::map< dof_id_type, Real, std::less< dof_id_type >, Threads::scalable_allocator< std::pair< const dof_id_type, Real > > > DofConstraintRow
A row of the Dof constraint matrix.
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
unsigned int mesh_dimension() const
const DofMap & get_dof_map() const
void fix_node(const Node &node)
VariationalSmootherConstraint(System &sys, const bool &preserve_subdomain_boundaries)