https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
SBMBndTri3 Class Reference

Derived class for 3-node triangular elements (Tri3) Triangle is listed first so it is initialized before SBMBndElementBase; the base class constructor then receives the unit normal from Triangle::normal() (see the .C file). More...

#include <SBMBndTri3.h>

Inheritance diagram for SBMBndTri3:
[legend]

Public Member Functions

 SBMBndTri3 (const Elem *elem)
 Constructor.
 
const Point & normal () const
 Getter for the normal vector.
 
Ball computeBoundingBall () const override
 
bool intersect (const LineSegment &l, libMesh::Point &intersect_p) const
 
bool intersect (const LineSegment &line_segment) const override
 
const Elem & elem () const
 Getter for the underlying element.
 
unsigned int expectedEmbeddingMeshDim () const
 Getter of expected embedding solving mesh dimension Because the boundary element is a face of the embedding mesh, its dimension is one less than the dimension of the embedding mesh.
 
virtual Point distanceFrom (const Point &pt) const
 Compute the distance vector from an arbitrary point to this boundary element.
 
Real getProjectedBoundingBoxDiagonal (const Point &normal_dir) const
 Compute the length of the element bounding-box diagonal projected onto a plane orthogonal to a given direction.
 

Private Attributes

libMesh::Point _p0
 
libMesh::Point _p1
 
libMesh::Point _p2
 
const Elem * _elem
 < Pointer to the libMesh element representing this boundary face.
 
const Point _normal
 

Detailed Description

Derived class for 3-node triangular elements (Tri3) Triangle is listed first so it is initialized before SBMBndElementBase; the base class constructor then receives the unit normal from Triangle::normal() (see the .C file).

Definition at line 19 of file SBMBndTri3.h.

Constructor & Destructor Documentation

◆ SBMBndTri3()

SBMBndTri3::SBMBndTri3 ( const Elem *  elem)
explicit

Constructor.

Definition at line 13 of file SBMBndTri3.C.

14 : Triangle(elem->point(0), elem->point(1), elem->point(2)),
16{
17 mooseAssert(elem->type() == TRI3, "Element must be of type TRI3");
18}
Base class for SBM boundary elements.
const Elem & elem() const
Getter for the underlying element.
libMesh::Point normal() const
Triangle()=default

Member Function Documentation

◆ computeBoundingBall()

Ball Triangle::computeBoundingBall ( ) const
virtual

Implements GeometryBase.

◆ distanceFrom()

Point SBMBndElementBase::distanceFrom ( const Point &  pt) const
virtualinherited

Compute the distance vector from an arbitrary point to this boundary element.

Default: normal-based distance vector. Override in derived class if needed. (a) First calculation of the normal-based distance and the projection point (b) If the projection point is outside the element, return the distance to the closest vertex.

Definition at line 39 of file SBMBndElementBase.C.

40{
41 // Side-type precondition is validated once in the base ctor; no per-call
42 // check needed here.
43
44 // (a) Project pt onto the normal direction
45 const auto vec_to_first = _elem->point(0) - pt;
46 const auto scale = vec_to_first * _normal;
47 const auto projection = _normal * scale;
48
49 // Check if projection point lands inside the geometry
50 if (_elem->contains_point(pt + projection))
51 return projection;
52
53 // (d) Point to closest edge or node
54 Real min_dist = std::numeric_limits<Real>::max();
55 Point closest_vec;
56
57 const unsigned int n_edges = _elem->n_sides();
58 for (unsigned int j = 0; j < n_edges; ++j)
59 {
60 std::unique_ptr<const Elem> curr_edge = _elem->build_side_ptr(j);
61
62 switch (curr_edge->type())
63 {
64 case EDGE2:
65 {
66 const Point & p1 = *curr_edge->node_ptr(0);
67 const Point & p2 = *curr_edge->node_ptr(1);
68
69 const Point edge = p2 - p1;
70 Real t = ((pt - p1) * edge) / (edge * edge);
71 t = std::clamp(t, 0.0, 1.0);
72 const Point proj = p1 + t * edge;
73 const Real dist = (pt - proj).norm();
74
75 if (dist < min_dist)
76 {
77 min_dist = dist;
78 closest_vec = proj - pt;
79 }
80 break;
81 }
82
83 case NODEELEM:
84 {
85 const Point & p = *curr_edge->node_ptr(0);
86 const Real dist = (pt - p).norm();
87 if (dist < min_dist)
88 {
89 min_dist = dist;
90 closest_vec = p - pt;
91 }
92 break;
93 }
94
95 default:
96 mooseAssert(false, "unreachable: side type validated in SBMBndElementBase ctor");
97 }
98 }
99
100 return closest_vec;
101}
const Real p
Real scale
const Elem * _elem
< Pointer to the libMesh element representing this boundary face.
auto norm(const T &a)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

Referenced by UnsignedDistanceToSurfaceMesh::distanceVectorToSurface(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ elem()

const Elem & SBMBndElementBase::elem ( ) const
inlineinherited

Getter for the underlying element.

Definition at line 32 of file SBMBndElementBase.h.

32{ return *_elem; }

Referenced by SBMBndEdge2::SBMBndEdge2(), SBMBndElementBase::SBMBndElementBase(), SBMBndUnsupportedForTest::SBMBndElementBase(), and SBMBndTri3().

◆ expectedEmbeddingMeshDim()

unsigned int SBMBndElementBase::expectedEmbeddingMeshDim ( ) const
inlineinherited

Getter of expected embedding solving mesh dimension Because the boundary element is a face of the embedding mesh, its dimension is one less than the dimension of the embedding mesh.

Definition at line 46 of file SBMBndElementBase.h.

46{ return _elem->dim() + 1; }

◆ getProjectedBoundingBoxDiagonal()

Real SBMBndElementBase::getProjectedBoundingBoxDiagonal ( const Point &  normal_dir) const
inherited

Compute the length of the element bounding-box diagonal projected onto a plane orthogonal to a given direction.

The projection plane is defined only by its normal direction; the specific location (offset) of the plane is irrelevant for this operation. Equivalently, this function removes the component of the bounding-box diagonal along the given normal direction and returns the norm of the remaining tangential component.

Parameters
normal_dirA direction vector defining the plane normal.
Returns
The length of the longest diagonal of the projected rectangle.

Definition at line 104 of file SBMBndElementBase.C.

105{
106 BoundingBox bbox = _elem->loose_bounding_box();
107
108 const Point & min_pt = bbox.first;
109 const Point & max_pt = bbox.second;
110
111 // Step (a): Calculate box_vec
112 Point box_vec = max_pt - min_pt;
113
114 // Step (b): Project box_vec onto normal_dir
115 Real normal_scale = box_vec * normal_dir;
116 Point normal_box_vec = normal_dir * normal_scale;
117
118 // Step (c): Calculate tangent_vec and its norm
119 Point tangent_vec = box_vec - normal_box_vec;
120
121 return tangent_vec.norm();
122}

Referenced by TEST().

◆ intersect() [1/2]

bool Triangle::intersect ( const LineSegment l,
libMesh::Point intersect_p 
) const

Referenced by TEST(), and TEST().

◆ intersect() [2/2]

bool Triangle::intersect ( const LineSegment line_segment) const
virtual

Implements GeometryBase.

◆ normal()

const Point & SBMBndElementBase::normal ( ) const
inline

Getter for the normal vector.

Definition at line 35 of file SBMBndElementBase.h.

35{ return _normal; }

Referenced by TEST(), and TEST().

Member Data Documentation

◆ _elem

const Elem* SBMBndElementBase::_elem
privateinherited

< Pointer to the libMesh element representing this boundary face.

Derived classes access it through elem() rather than this field directly. Unit normal vector of the boundary element, computed eagerly in the derived constructor and passed through the base constructor.

Definition at line 80 of file SBMBndElementBase.h.

Referenced by SBMBndElementBase::distanceFrom(), SBMBndElementBase::elem(), SBMBndElementBase::expectedEmbeddingMeshDim(), and SBMBndElementBase::getProjectedBoundingBoxDiagonal().

◆ _normal

const Point SBMBndElementBase::_normal
privateinherited

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