libMesh
Public Member Functions | Private Attributes | List of all members
libMesh::PointConstraint Class Reference

Represents a fixed point constraint. More...

#include <variational_smoother_constraint.h>

Public Member Functions

 PointConstraint ()=default
 
 PointConstraint (const Point &point, const Real &tol=TOLERANCE *TOLERANCE)
 Constructor. More...
 
bool operator< (const PointConstraint &other) const
 Comparison operator for ordering PointConstraint objects. More...
 
bool operator== (const PointConstraint &other) const
 Equality operator. More...
 
bool contains_point (const PointConstraint &p) const
 Query whether a point lies on another point. More...
 
ConstraintVariant intersect (const ConstraintVariant &other) const
 Computes the intersection of this point with another constraint. More...
 
const Pointpoint () const
 Const getter for the _point attribute. More...
 
const Realtol () const
 Const getter for the _tol attribute. More...
 

Private Attributes

Point _point
 Location of constraint. More...
 
Real _tol
 Tolerance to use for numerical comparisons. More...
 

Detailed Description

Represents a fixed point constraint.

Definition at line 49 of file variational_smoother_constraint.h.

Constructor & Destructor Documentation

◆ PointConstraint() [1/2]

libMesh::PointConstraint::PointConstraint ( )
default

◆ PointConstraint() [2/2]

libMesh::PointConstraint::PointConstraint ( const Point point,
const Real tol = TOLERANCE * TOLERANCE 
)

Constructor.

Parameters
pointThe point defining the constraint.
tolThe tolerance to use for numerical comparisons.

Definition at line 48 of file variational_smoother_constraint.C.

48  : _point(point), _tol(tol)
49 {
50 }
Real _tol
Tolerance to use for numerical comparisons.
Point _point
Location of constraint.
const Point & point() const
Const getter for the _point attribute.
const Real & tol() const
Const getter for the _tol attribute.

Member Function Documentation

◆ contains_point()

bool libMesh::PointConstraint::contains_point ( const PointConstraint p) const
inline

Query whether a point lies on another point.

Parameters
pThe point in question
Returns
bool indicating whether p lies on this point.

Definition at line 84 of file variational_smoother_constraint.h.

84 { return *this == p; }

◆ intersect()

ConstraintVariant libMesh::PointConstraint::intersect ( const ConstraintVariant other) const

Computes the intersection of this point with another constraint.

Handles intersection with PointConstraint, LineConstraint, or PlaneConstraint.

Parameters
otherThe constraint to intersect with.
Returns
The most specific ConstraintVariant that satisfies both constraints. constraints. If no intersection exists, return an InvalidConstraint.

Definition at line 65 of file variational_smoother_constraint.C.

66 {
67  // using visit to resolve the variant to its actual type
68  return std::visit(
69  [&](auto && o) -> ConstraintVariant {
70  if (!o.contains_point(*this))
71  // Point is not on the constraint
72  return InvalidConstraint();
73 
74  return *this;
75  },
76  other);
77 }
std::variant< PointConstraint, LineConstraint, PlaneConstraint, InvalidConstraint > ConstraintVariant
Type used to store a constraint that may be a PlaneConstraint, LineConstraint, or PointConstraint...

◆ operator<()

bool libMesh::PointConstraint::operator< ( const PointConstraint other) const

Comparison operator for ordering PointConstraint objects.

A PointConstraint is considered less than another if its location is lexicographically less than the other's location.

Parameters
otherThe PointConstraint to compare with.
tolThe tolerance to use for numerical comparisons.
Returns
True if this PointConstraint is less than the other.

Definition at line 52 of file variational_smoother_constraint.C.

References _point, and point().

53 {
54  if (*this == other)
55  return false;
56 
57  return _point < other.point();
58 }
Point _point
Location of constraint.

◆ operator==()

bool libMesh::PointConstraint::operator== ( const PointConstraint other) const

Equality operator.

Parameters
otherThe PointConstraint to compare with.
Returns
True if both PointConstraints have the same location.

Definition at line 60 of file variational_smoother_constraint.C.

References _point, _tol, libMesh::TypeVector< T >::absolute_fuzzy_equals(), and point().

61 {
62  return _point.absolute_fuzzy_equals(other.point(), _tol);
63 }
Real _tol
Tolerance to use for numerical comparisons.
bool absolute_fuzzy_equals(const TypeVector< T > &rhs, Real tol=TOLERANCE) const
Definition: type_vector.h:972
Point _point
Location of constraint.

◆ point()

const Point& libMesh::PointConstraint::point ( ) const
inline

Const getter for the _point attribute.

Definition at line 100 of file variational_smoother_constraint.h.

References _point.

Referenced by libMesh::LineConstraint::contains_point(), libMesh::PlaneConstraint::contains_point(), libMesh::PlaneConstraint::intersect(), operator<(), and operator==().

100 { return _point; }
Point _point
Location of constraint.

◆ tol()

const Real& libMesh::PointConstraint::tol ( ) const
inline

Const getter for the _tol attribute.

Definition at line 105 of file variational_smoother_constraint.h.

References _tol.

105 { return _tol; }
Real _tol
Tolerance to use for numerical comparisons.

Member Data Documentation

◆ _point

Point libMesh::PointConstraint::_point
private

Location of constraint.

Definition at line 112 of file variational_smoother_constraint.h.

Referenced by operator<(), operator==(), and point().

◆ _tol

Real libMesh::PointConstraint::_tol
private

Tolerance to use for numerical comparisons.

Definition at line 117 of file variational_smoother_constraint.h.

Referenced by operator==(), and tol().


The documentation for this class was generated from the following files: