18 #ifndef LIBMESH_VARIATIONAL_SMOOTHER_CONSTRAINT_H 19 #define LIBMESH_VARIATIONAL_SMOOTHER_CONSTRAINT_H 22 #include "libmesh/system.h" 23 #include "libmesh/dof_map.h" 32 class PointConstraint;
34 class PlaneConstraint;
35 class InvalidConstraint;
335 :
_err_msg(
"We should never get here! The InvalidConstraint object should be " 336 "detected and replaced with a valid ConstraintVariant prior to calling " 337 "any class methods.")
345 libmesh_assert_msg(
false,
_err_msg);
353 libmesh_assert_msg(
false,
_err_msg);
377 return lhs.intersect(rhs);
434 const std::unordered_map<
dof_id_type, std::vector<const Elem *>> & nodes_to_elem_map,
435 std::vector<const Node *> & neighbors);
446 const Node & boundary_node,
447 const Node & neighbor_node,
448 const Elem & containing_elem,
463 static std::set<std::set<const Node *>>
466 const std::unordered_map<
dof_id_type, std::vector<const Elem *>>
483 const std::unordered_set<dof_id_type> &boundary_node_ids,
485 const std::unordered_map<
dof_id_type, std::vector<const Elem *>>
496 const Node &node,
const unsigned int dim,
497 const std::set<std::set<const Node *>> &side_grouped_boundary_neighbors);
525 #endif // LIBMESH_VARIATIONAL_SMOOTHER_CONSTRAINT_H bool operator<(const LineConstraint &other) const
Comparison operator for ordering LineConstraint objects.
const Point & normal() const
Const getter for the _normal attribute.
bool contains_point(const PointConstraint &p) const
Query whether a point lies on another point.
void constrain_node_to_plane(const Node &node, const Point &ref_normal_vec)
Constrain a node to remain in the given plane during mesh smoothing.
A Node is like a Point, but with more information.
bool contains_point(const PointConstraint &) const
Dummy contains_point method that should never be called.
Constraint class for the VariationalMeshSmoother.
bool contains_point(const PointConstraint &p) const
Query whether a point lies on the plane.
static constexpr Real TOLERANCE
This is the base class from which all geometric element types are derived.
Real _tol
Tolerance to use for numerical comparisons.
bool operator==(const PointConstraint &other) const
Equality operator.
PointConstraint()=default
ConstraintVariant intersect(const ConstraintVariant &other) const
Computes the intersection of this line with another constraint.
The libMesh namespace provides an interface to certain functionality in the library.
Point _point
A point on the constraining plane.
bool contains_line(const LineConstraint &l) const
Query whether a line lies on the plane.
This is the MeshBase class.
Point _normal
The direction normal to the constraining plane.
ConstraintVariant intersect_constraints(const ConstraintVariant &a, const ConstraintVariant &b)
Dispatch intersection between two constraint variants.
bool is_parallel(const LineConstraint &l) const
Query whether a line is parallel to this line.
bool operator<(const PlaneConstraint &other) const
Comparison operator for ordering PlaneConstraint objects.
Represents an invalid constraint (i.e., when the two constraints don't intersect) ...
ConstraintVariant intersect(const ConstraintVariant &) const
Dummy intersect method that should never be called.
PlaneConstraint()=default
static std::set< std::set< const Node * > > get_neighbors_for_boundary_constraint(const MeshBase &mesh, const Node &node, const std::unordered_set< dof_id_type > &boundary_node_ids, const BoundaryInfo &boundary_info, const std::unordered_map< dof_id_type, std::vector< const Elem *>> &nodes_to_elem_map)
Get the relevant nodal neighbors for an external boundary constraint.
Point _point
A point on the constraining line.
Point _direction
Direction of the constraining line.
static std::set< std::set< const Node * > > get_neighbors_for_subdomain_constraint(const MeshBase &mesh, const Node &node, const subdomain_id_type sub_id, const std::unordered_map< dof_id_type, std::vector< const Elem *>> &nodes_to_elem_map)
Get the relevant nodal neighbors for a subdomain constraint.
const Point & direction() const
Const getter for the _direction attribute.
void constrain_node_to_line(const Node &node, const Point &line_vec)
Constrain a node to remain on the given line during mesh smoothing.
Manages consistently variables, degrees of freedom, and coefficient vectors.
const Point & point() const
Const getter for the _point attribute.
Represents a plane constraint defined by a point and normal vector.
virtual ~VariationalSmootherConstraint() override
bool operator<(const PointConstraint &other) const
Comparison operator for ordering PointConstraint objects.
Real _tol
Tolerance to use for numerical comparisons.
The BoundaryInfo class contains information relevant to boundary conditions including storing faces...
bool operator==(const LineConstraint &other) const
Equality operator.
const bool _preserve_subdomain_boundaries
Whether nodes on subdomain boundaries are subject to change via smoothing.
static bool nodes_share_boundary_id(const Node &boundary_node, const Node &neighbor_node, const Elem &containing_elem, const BoundaryInfo &boundary_info)
Determines whether two neighboring nodes share a common boundary id.
Point _point
Location of constraint.
virtual void constrain() override
Constraint function.
ConstraintVariant intersect(const ConstraintVariant &other) const
Computes the intersection of this point with another constraint.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const Point & point() const
Const getter for the _point attribute.
const Real & tol() const
Const getter for the _tol attribute.
Represents a fixed point constraint.
Real _tol
Tolerance to use for numerical comparisons.
static ConstraintVariant determine_constraint(const Node &node, const unsigned int dim, const std::set< std::set< const Node *>> &side_grouped_boundary_neighbors)
Determines the appropriate constraint (PointConstraint, LineConstraint, or PlaneConstraint) for a nod...
Abstract base class to be used for system constraints.
void impose_constraint(const Node &node, const ConstraintVariant &constraint)
Applies a given constraint to a node (e.g., fixing it, restricting it to a line or plane)...
Represents a line constraint defined by a base point and direction vector.
const Point & point() const
Const getter for the _point attribute.
std::variant< PointConstraint, LineConstraint, PlaneConstraint, InvalidConstraint > ConstraintVariant
Type used to store a constraint that may be a PlaneConstraint, LineConstraint, or PointConstraint...
bool is_parallel(const PlaneConstraint &p) const
Query whether a plane is parallel to this plane.
A Point defines a location in LIBMESH_DIM dimensional Real space.
bool operator==(const PlaneConstraint &other) const
Equality operator.
const Real & tol() const
Const getter for the _tol attribute.
static void find_nodal_or_face_neighbors(const MeshBase &mesh, const Node &node, const std::unordered_map< dof_id_type, std::vector< const Elem *>> &nodes_to_elem_map, std::vector< const Node *> &neighbors)
Given a mesh and a node in the mesh, the vector will be filled with every node directly attached to t...
void fix_node(const Node &node)
Constrain (i.e., fix) a node to not move during mesh smoothing.
VariationalSmootherConstraint(System &sys, const bool &preserve_subdomain_boundaries)
Constructor.
bool contains_point(const PointConstraint &p) const
Query whether a point lies on the line.
const Real & tol() const
Const getter for the _tol attribute.
ConstraintVariant intersect(const ConstraintVariant &other) const
Computes the intersection of this plane with another constraint.