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"
35class 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);
445 const Node & boundary_node,
446 const Node & neighbor_node,
447 const Elem & containing_elem,
462 static std::set<std::set<const Node *>>
465 const std::unordered_map<
dof_id_type, std::vector<const Elem *>>
482 const std::unordered_set<dof_id_type> &boundary_node_ids,
484 const std::unordered_map<
dof_id_type, std::vector<const Elem *>>
495 const Node &node,
const unsigned int dim,
496 const std::set<std::set<const Node *>> &side_grouped_boundary_neighbors);
515 const bool & preserve_subdomain_boundaries,
516 const unsigned int verbosity);
The BoundaryInfo class contains information relevant to boundary conditions including storing faces,...
This is the base class from which all geometric element types are derived.
Represents an invalid constraint (i.e., when the two constraints don't intersect)
bool contains_point(const PointConstraint &) const
Dummy contains_point method that should never be called.
ConstraintVariant intersect(const ConstraintVariant &) const
Dummy intersect method that should never be called.
Represents a line constraint defined by a base point and direction vector.
bool contains_point(const PointConstraint &p) const
Query whether a point lies on the line.
const Point & direction() const
Const getter for the _direction attribute.
bool operator<(const LineConstraint &other) const
Comparison operator for ordering LineConstraint objects.
bool operator==(const LineConstraint &other) const
Equality operator.
const Real & tol() const
Const getter for the _tol attribute.
bool is_parallel(const LineConstraint &l) const
Query whether a line is parallel to this line.
const Point & point() const
Const getter for the _point attribute.
Point _direction
Direction of the constraining line.
Real _tol
Tolerance to use for numerical comparisons.
ConstraintVariant intersect(const ConstraintVariant &other) const
Computes the intersection of this line with another constraint.
Point _point
A point on the constraining line.
This is the MeshBase class.
A Node is like a Point, but with more information.
Represents a plane constraint defined by a point and normal vector.
PlaneConstraint()=default
const Point & point() const
Const getter for the _point attribute.
const Point & normal() const
Const getter for the _normal attribute.
bool operator==(const PlaneConstraint &other) const
Equality operator.
Point _point
A point on the constraining plane.
Point _normal
The direction normal to the constraining plane.
ConstraintVariant intersect(const ConstraintVariant &other) const
Computes the intersection of this plane with another constraint.
bool is_parallel(const PlaneConstraint &p) const
Query whether a plane is parallel to this plane.
bool contains_line(const LineConstraint &l) const
Query whether a line lies on the plane.
bool contains_point(const PointConstraint &p) const
Query whether a point lies on the plane.
Real _tol
Tolerance to use for numerical comparisons.
bool operator<(const PlaneConstraint &other) const
Comparison operator for ordering PlaneConstraint objects.
const Real & tol() const
Const getter for the _tol attribute.
Represents a fixed point constraint.
bool operator==(const PointConstraint &other) const
Equality operator.
const Point & point() const
Const getter for the _point attribute.
bool contains_point(const PointConstraint &p) const
Query whether a point lies on another point.
bool operator<(const PointConstraint &other) const
Comparison operator for ordering PointConstraint objects.
Point _point
Location of constraint.
PointConstraint()=default
const Real & tol() const
Const getter for the _tol attribute.
ConstraintVariant intersect(const ConstraintVariant &other) const
Computes the intersection of this point with another constraint.
Real _tol
Tolerance to use for numerical comparisons.
A Point defines a location in LIBMESH_DIM dimensional Real space.
Abstract base class to be used for system constraints.
Manages consistently variables, degrees of freedom, and coefficient vectors.
Constraint class for the VariationalMeshSmoother.
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 unsigned int _verbosity
Verbosity setting.
void fix_node(const Node &node)
Constrain (i.e., fix) a node to not move during mesh smoothing.
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).
virtual void constrain() override
Constraint function.
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.
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.
virtual ~VariationalSmootherConstraint() override
const bool _preserve_subdomain_boundaries
Whether nodes on subdomain boundaries are subject to change via smoothing.
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...
void constrain_node_to_line(const Node &node, const Point &line_vec)
Constrain a node to remain on the given line during mesh smoothing.
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.
The libMesh namespace provides an interface to certain functionality in the library.
std::variant< PointConstraint, LineConstraint, PlaneConstraint, InvalidConstraint > ConstraintVariant
Type used to store a constraint that may be a PlaneConstraint, LineConstraint, or PointConstraint.
static constexpr Real TOLERANCE
ConstraintVariant intersect_constraints(const ConstraintVariant &a, const ConstraintVariant &b)
Dispatch intersection between two constraint variants.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real