|
libMesh
|
Constraint class for the VariationalMeshSmoother. More...
#include <variational_smoother_constraint.h>
Public Member Functions | |
| VariationalSmootherConstraint (System &sys, const bool &preserve_subdomain_boundaries, const unsigned int verbosity) | |
| Constructor. More... | |
| virtual | ~VariationalSmootherConstraint () override |
| virtual void | constrain () override |
| Constraint function. More... | |
Private Member Functions | |
| void | fix_node (const Node &node) |
| Constrain (i.e., fix) a node to not move during mesh smoothing. More... | |
| 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. More... | |
| void | constrain_node_to_line (const Node &node, const Point &line_vec) |
| Constrain a node to remain on the given line during mesh smoothing. More... | |
| 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). More... | |
Static Private Member Functions | |
| 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. More... | |
| 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. More... | |
| 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. More... | |
| 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 node based on its neighbors. More... | |
Private Attributes | |
| const unsigned int | _verbosity |
| Verbosity setting. More... | |
| System & | _sys |
| const bool | _preserve_subdomain_boundaries |
| Whether nodes on subdomain boundaries are subject to change via smoothing. More... | |
Constraint class for the VariationalMeshSmoother.
Currently, all mesh boundary nodes are constrained to not move during smoothing. If requested (preserve_subdomain_boundaries = true), nodes on subdomain boundaries are also constrained to not move.
Definition at line 389 of file variational_smoother_constraint.h.
| libMesh::VariationalSmootherConstraint::VariationalSmootherConstraint | ( | System & | sys, |
| const bool & | preserve_subdomain_boundaries, | ||
| const unsigned int | verbosity | ||
| ) |
Constructor.
| sys | System to constrain. |
| preserve_subdomain_boundaries | Whether to constrain nodes on subdomain boundaries to not move. |
Definition at line 334 of file variational_smoother_constraint.C.
|
overridevirtualdefault |
|
overridevirtual |
Constraint function.
This function will be called to constrain the system prior to a solve and must be provided by the user in a derived class.
Implements libMesh::System::Constraint.
Definition at line 341 of file variational_smoother_constraint.C.
References _preserve_subdomain_boundaries, _sys, _verbosity, libMesh::MeshTools::build_nodes_to_elem_map(), determine_constraint(), dim, libMesh::MeshTools::find_boundary_nodes(), libMesh::System::get_mesh(), get_neighbors_for_boundary_constraint(), get_neighbors_for_subdomain_constraint(), impose_constraint(), libMesh::intersect_constraints(), mesh, and libMesh::out.
|
private |
Constrain a node to remain on the given line during mesh smoothing.
| node | Node to constrain |
| line_vec | vector parallel to the constraining line. This, along with the coordinates of node, are used to define the constraining line. |
Definition at line 533 of file variational_smoother_constraint.C.
References _sys, libMesh::DofMap::add_constraint_row(), b, dim, distance(), libMesh::DofObject::dof_number(), libMesh::System::get_dof_map(), libMesh::System::get_mesh(), libMesh::libmesh_assert(), libMesh::make_range(), libMesh::MeshBase::mesh_dimension(), libMesh::System::number(), and libMesh::relative_fuzzy_equals().
Referenced by impose_constraint().
|
private |
Constrain a node to remain in the given plane during mesh smoothing.
| node | Node to constrain |
| ref_normal_vec | Reference normal vector to the constraining plane. This, along with the coordinates of node, are used to define the constraining plane. |
Definition at line 483 of file variational_smoother_constraint.C.
References _sys, libMesh::DofMap::add_constraint_row(), dim, libMesh::DofObject::dof_number(), libMesh::System::get_dof_map(), libMesh::System::get_mesh(), libMesh::libmesh_assert(), libMesh::make_range(), libMesh::MeshBase::mesh_dimension(), libMesh::TypeVector< T >::norm(), libMesh::System::number(), libMesh::Real, and libMesh::TOLERANCE.
Referenced by impose_constraint().
|
staticprivate |
Determines the appropriate constraint (PointConstraint, LineConstraint, or PlaneConstraint) for a node based on its neighbors.
| node | The node to constrain. |
| dim | The mesh dimension. |
Definition at line 798 of file variational_smoother_constraint.C.
References libMesh::TypeVector< T >::cross(), dim, libMesh::index_range(), libMesh::intersect_constraints(), libMesh::libmesh_assert(), libMesh::make_range(), libMesh::TypeVector< T >::norm(), libMesh::TOLERANCE, and libMesh::TypeVector< T >::unit().
Referenced by constrain().
|
private |
Constrain (i.e., fix) a node to not move during mesh smoothing.
| node | Node to fix. |
Definition at line 469 of file variational_smoother_constraint.C.
References _sys, libMesh::DofMap::add_constraint_row(), libMesh::DofObject::dof_number(), libMesh::System::get_dof_map(), libMesh::System::get_mesh(), libMesh::make_range(), libMesh::MeshBase::mesh_dimension(), and libMesh::System::number().
Referenced by impose_constraint().
|
staticprivate |
Get the relevant nodal neighbors for an external boundary constraint.
| mesh | The mesh being smoothed. |
| node | The node (on the external boundary) being constrained. |
| boundary_node_ids | The set of mesh's external boundary node ids. |
| boundary_info | The mesh's BoundaryInfo. |
| nodes_to_elem_map | A mapping from node id to containing element ids. |
Definition at line 717 of file variational_smoother_constraint.C.
References libMesh::MeshTools::find_nodal_or_face_neighbors(), libMesh::DofObject::id(), mesh, and nodes_share_boundary_id().
Referenced by constrain().
|
staticprivate |
Get the relevant nodal neighbors for a subdomain constraint.
| mesh | The mesh being smoothed. |
| node | The node (on the subdomain boundary) being constrained. |
| sub_id | The subdomain id of the block on one side of the subdomain boundary. |
| nodes_to_elem_map | A mapping from node id to containing element ids. |
Definition at line 632 of file variational_smoother_constraint.C.
References libMesh::MeshTools::find_nodal_or_face_neighbors(), libMesh::DofObject::id(), mesh, libMesh::Elem::neighbor_ptr(), and libMesh::Elem::subdomain_id().
Referenced by constrain().
|
private |
Applies a given constraint to a node (e.g., fixing it, restricting it to a line or plane).
| node | The node to constrain. |
| constraint | The geometric constraint variant to apply. |
| libMesh::logicError | If the constraint cannot be imposed. |
Definition at line 888 of file variational_smoother_constraint.C.
References constrain_node_to_line(), constrain_node_to_plane(), and fix_node().
Referenced by constrain().
|
staticprivate |
Determines whether two neighboring nodes share a common boundary id.
| boundary_node | The first of the two prospective nodes. |
| neighbor_node | The second of the two prospective nodes. |
| containing_elem | The element containing node1 and node2. |
| boundary_info | The mesh's BoundaryInfo. |
Definition at line 600 of file variational_smoother_constraint.C.
References libMesh::BoundaryInfo::boundary_ids(), libMesh::Elem::get_node_index(), libMesh::Elem::is_node_on_side(), side_id, and libMesh::Elem::side_index_range().
Referenced by get_neighbors_for_boundary_constraint().
|
private |
Whether nodes on subdomain boundaries are subject to change via smoothing.
Definition at line 410 of file variational_smoother_constraint.h.
Referenced by constrain().
|
private |
Definition at line 405 of file variational_smoother_constraint.h.
Referenced by constrain(), constrain_node_to_line(), constrain_node_to_plane(), and fix_node().
|
private |
Verbosity setting.
The verbosity levels and the corresponding information output are as follows:
verbosity = 0: No information.
20 < verbosity: Prints:
Definition at line 403 of file variational_smoother_constraint.h.
Referenced by constrain().
1.8.14