Data Structures | Public Types | Public Member Functions | Static Private Member Functions | Private Attributes | Friends
tetrahedron Class Reference

A tetrahedron primitive. More...

Data Structures

class  dummyOp
 Dummy. More...
 
class  storeOp
 Store resulting tets. More...
 
class  sumVolOp
 Sum resulting volumes. More...
 

Public Types

enum  { nVertices = 4, nEdges = 6 }
 
typedef FixedList< tetPoints, 200 > tetIntersectionList
 Storage type for tets originating from intersecting tets. More...
 

Public Member Functions

 tetrahedron (const Point &a, const Point &b, const Point &c, const Point &d)
 Construct from points. More...
 
 tetrahedron (const UList< Point > &, const FixedList< label, 4 > &indices)
 Construct from four points in the list of points. More...
 
 tetrahedron (Istream &)
 Construct from Istream. More...
 
const Pointa () const
 Return vertices. More...
 
const Pointb () const
 
const Pointc () const
 
const Pointd () const
 
triPointRef tri (const label faceI) const
 Return i-th face. More...
 
vector Sa () const
 Return face normal. More...
 
vector Sb () const
 
vector Sc () const
 
vector Sd () const
 
Point centre () const
 Return centre (centroid) More...
 
scalar mag () const
 Return volume. More...
 
Point circumCentre () const
 Return circum-centre. More...
 
scalar circumRadius () const
 Return circum-radius. More...
 
scalar quality () const
 Return quality: Ratio of tetrahedron and circum-sphere. More...
 
Point randomPoint (Random &rndGen) const
 Return a random point in the tetrahedron from a. More...
 
Point randomPoint (cachedRandom &rndGen) const
 Return a random point in the tetrahedron from a. More...
 
scalar barycentric (const point &pt, List< scalar > &bary) const
 Calculate the barycentric coordinates of the given. More...
 
pointHit nearestPoint (const point &p) const
 Return nearest point to p on tetrahedron. Is p itself. More...
 
bool inside (const point &pt) const
 Return true if point is inside tetrahedron. More...
 
template<class AboveTetOp , class BelowTetOp >
void sliceWithPlane (const plane &pl, AboveTetOp &aboveOp, BelowTetOp &belowOp) const
 Decompose tet into tets above and below plane. More...
 
void tetOverlap (const tetrahedron< Point, PointRef > &tetB, tetIntersectionList &insideTets, label &nInside, tetIntersectionList &outsideTets, label &nOutside) const
 Decompose tet into tets inside and outside other tet. More...
 
pointHit containmentSphere (const scalar tol) const
 Return (min)containment sphere, i.e. the smallest sphere with. More...
 
void gradNiSquared (scalarField &buffer) const
 Fill buffer with shape function products. More...
 
void gradNiDotGradNj (scalarField &buffer) const
 
void gradNiGradNi (tensorField &buffer) const
 
void gradNiGradNj (tensorField &buffer) const
 

Static Private Member Functions

static point planeIntersection (const FixedList< scalar, 4 > &, const tetPoints &, const label, const label)
 
template<class TetOp >
static void decomposePrism (const FixedList< point, 6 > &points, TetOp &op)
 
template<class AboveTetOp , class BelowTetOp >
static void tetSliceWithPlane (const plane &pl, const tetPoints &tet, AboveTetOp &aboveOp, BelowTetOp &belowOp)
 

Private Attributes

PointRef a_
 
PointRef b_
 
PointRef c_
 
PointRef d_
 

Friends

Istreamoperator>> (Istream &, tetrahedron &)
 
Ostreamoperator (Ostream &, const tetrahedron &)
 

Detailed Description

A tetrahedron primitive.

Ordering of edges needs to be the same for a tetrahedron class, a tetrahedron cell shape model and a tetCell.

Source files

Definition at line 62 of file tetrahedron.H.

Member Typedef Documentation

◆ tetIntersectionList

Storage type for tets originating from intersecting tets.

(can possibly be smaller than 200)

Definition at line 93 of file tetrahedron.H.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
nVertices 
nEdges 

Definition at line 164 of file tetrahedron.H.

Constructor & Destructor Documentation

◆ tetrahedron() [1/3]

tetrahedron ( const Point a,
const Point b,
const Point c,
const Point d 
)
inline

Construct from points.

Definition at line 35 of file tetrahedronI.H.

◆ tetrahedron() [2/3]

tetrahedron ( const UList< Point > &  ,
const FixedList< label, 4 > &  indices 
)
inline

Construct from four points in the list of points.

◆ tetrahedron() [3/3]

tetrahedron ( Istream )
inline

Construct from Istream.

Member Function Documentation

◆ planeIntersection()

Foam::point planeIntersection ( const FixedList< scalar, 4 > &  d,
const tetPoints t,
const label  negI,
const label  posI 
)
inlinestaticprivate

Definition at line 580 of file tetrahedronI.H.

References tetrahedron::d().

Referenced by tetrahedron::tetSliceWithPlane().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ decomposePrism()

void decomposePrism ( const FixedList< point, 6 > &  points,
TetOp &  op 
)
inlinestaticprivate

Definition at line 596 of file tetrahedronI.H.

References points.

Referenced by tetrahedron::tetSliceWithPlane().

Here is the caller graph for this function:

◆ tetSliceWithPlane()

void tetSliceWithPlane ( const plane pl,
const tetPoints tet,
AboveTetOp &  aboveOp,
BelowTetOp &  belowOp 
)
inlinestaticprivate

Definition at line 611 of file tetrahedronI.H.

References Foam::abort(), tetrahedron::d(), tetrahedron::decomposePrism(), Foam::FatalError, FatalErrorInFunction, forAll, plane::normal(), p, tetrahedron::planeIntersection(), and plane::refPoint().

Referenced by tetrahedron::sliceWithPlane().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ a()

const Point & a ( ) const
inline

◆ b()

const Point & b ( ) const
inline

◆ c()

const Point & c ( ) const
inline

◆ d()

const Point & d ( ) const
inline

◆ tri()

Foam::triPointRef tri ( const label  faceI) const
inline

Return i-th face.

Definition at line 102 of file tetrahedronI.H.

References Foam::abort(), Foam::FatalError, and FatalErrorInFunction.

Here is the call graph for this function:

◆ Sa()

Foam::vector Sa ( ) const
inline

Return face normal.

Definition at line 136 of file tetrahedronI.H.

References triangle::normal().

Referenced by particle< Type >::trackToFace().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Sb()

Foam::vector Sb ( ) const
inline

Definition at line 143 of file tetrahedronI.H.

References triangle::normal().

Referenced by particle< Type >::trackToFace().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Sc()

Foam::vector Sc ( ) const
inline

Definition at line 150 of file tetrahedronI.H.

References triangle::normal().

Referenced by particle< Type >::trackToFace().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Sd()

Foam::vector Sd ( ) const
inline

Definition at line 157 of file tetrahedronI.H.

References triangle::normal().

Referenced by particle< Type >::trackToFace().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ centre()

Point centre ( ) const
inline

Return centre (centroid)

Definition at line 164 of file tetrahedronI.H.

Referenced by particle< Type >::findTris(), particle< Type >::hitWallFaces(), primitiveMesh::makeCellCentresAndVols(), tetOverlapVolume::sumMomentOp::operator()(), and particle< Type >::trackToFace().

Here is the caller graph for this function:

◆ mag()

Foam::scalar mag ( ) const
inline

◆ circumCentre()

Point circumCentre ( ) const
inline

Return circum-centre.

Definition at line 178 of file tetrahedronI.H.

References Foam::constant::physicoChemical::b, Foam::constant::universal::c, lambda(), Foam::mag(), Foam::magSqr(), and Foam::constant::physicoChemical::mu.

Referenced by partTet::crcmCentre(), and main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ circumRadius()

Foam::scalar circumRadius ( ) const
inline

Return circum-radius.

Definition at line 205 of file tetrahedronI.H.

References Foam::constant::physicoChemical::b, Foam::constant::universal::c, lambda(), Foam::mag(), Foam::magSqr(), and Foam::constant::physicoChemical::mu.

Referenced by partTet::crcmRadius(), and main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ quality()

Foam::scalar quality ( ) const
inline

Return quality: Ratio of tetrahedron and circum-sphere.

volume, scaled so that a regular tetrahedron has a quality of 1

Definition at line 231 of file tetrahedronI.H.

References Foam::mag(), Foam::min(), Foam::pow3(), and Foam::sqrt().

Referenced by polyMeshTetDecomposition::findBasePoint(), and polyMeshTetDecomposition::findSharedBasePoint().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ randomPoint() [1/2]

Point randomPoint ( Random rndGen) const
inline

Return a random point in the tetrahedron from a.

uniform distribution

Definition at line 245 of file tetrahedronI.H.

References rndGen(), s(), and cachedRandom::scalar01().

Referenced by DSMCCloud< DSMCParcel< ParcelType > >::initialise().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ randomPoint() [2/2]

Point randomPoint ( cachedRandom rndGen) const
inline

Return a random point in the tetrahedron from a.

uniform distribution

Definition at line 281 of file tetrahedronI.H.

References rndGen(), s(), and cachedRandom::sample01().

Here is the call graph for this function:

◆ barycentric()

Foam::scalar barycentric ( const point pt,
List< scalar > &  bary 
) const
inline

Calculate the barycentric coordinates of the given.

point, in the same order as a, b, c, d. Returns the determinant of the solution.

Definition at line 317 of file tetrahedronI.H.

References Foam::det(), Foam::inv(), Foam::mag(), List::setSize(), Vector< Cmpt >::x(), Vector< Cmpt >::y(), and Vector< Cmpt >::z().

Referenced by cellPointWeight::findTetrahedron(), interpolationCellPoint< Foam::Vector >::interpolate(), Dual< Type >::tetGeometry(), and Implicit< CloudType >::velocityCorrection().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nearestPoint()

Foam::pointHit nearestPoint ( const point p) const
inline

Return nearest point to p on tetrahedron. Is p itself.

if inside.

Definition at line 362 of file tetrahedronI.H.

References PointHit::distance(), triangle::nearestPoint(), p, and PointHit::rawPoint().

Referenced by cellPointWeight::findTetrahedron().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ inside()

bool inside ( const point pt) const
inline

Return true if point is inside tetrahedron.

Definition at line 456 of file tetrahedronI.H.

References Foam::mag(), n, and Vector< scalar >::zero.

Referenced by polyMeshTetDecomposition::findTet().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sliceWithPlane()

void sliceWithPlane ( const plane pl,
AboveTetOp &  aboveOp,
BelowTetOp &  belowOp 
) const
inline

Decompose tet into tets above and below plane.

Definition at line 985 of file tetrahedronI.H.

References tetrahedron::a_, tetrahedron::b_, tetrahedron::c_, tetrahedron::d_, and tetrahedron::tetSliceWithPlane().

Referenced by tetOverlapVolume::tetTetOverlap().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tetOverlap()

void tetOverlap ( const tetrahedron< Point, PointRef > &  tetB,
tetIntersectionList insideTets,
label nInside,
tetIntersectionList outsideTets,
label nOutside 
) const
inline

Decompose tet into tets inside and outside other tet.

Definition at line 34 of file tetrahedron.C.

References tetrahedron::a_, tetrahedron::b_, tetrahedron::c_, and tetrahedron::d_.

Referenced by main().

Here is the caller graph for this function:

◆ containmentSphere()

Foam::pointHit containmentSphere ( const scalar  tol) const

Return (min)containment sphere, i.e. the smallest sphere with.

all points inside. Returns pointHit with:

  • hit : if sphere is equal to circumsphere (biggest sphere)
  • point : centre of sphere
  • distance : radius of sphere
  • eligiblemiss: false Tol (small compared to 1, e.g. 1e-9) is used to determine whether point is inside: mag(pt - ctr) < (1+tol)*radius.

Definition at line 130 of file tetrahedron.C.

References Foam::magSqr(), PointHit::rawPoint(), PointHit::setDistance(), PointHit::setHit(), PointHit::setMiss(), PointHit::setPoint(), and Foam::sqrt().

Here is the call graph for this function:

◆ gradNiSquared()

void gradNiSquared ( scalarField buffer) const

Fill buffer with shape function products.

Definition at line 335 of file tetrahedron.C.

References Foam::mag(), and Foam::magSqr().

Here is the call graph for this function:

◆ gradNiDotGradNj()

void gradNiDotGradNj ( scalarField buffer) const

Definition at line 356 of file tetrahedron.C.

References Foam::mag().

Here is the call graph for this function:

◆ gradNiGradNi()

void gradNiGradNi ( tensorField buffer) const

Definition at line 386 of file tetrahedron.C.

References Foam::mag(), and Foam::sqr().

Here is the call graph for this function:

◆ gradNiGradNj()

void gradNiGradNj ( tensorField buffer) const

Definition at line 404 of file tetrahedron.C.

References Foam::mag().

Here is the call graph for this function:

Friends And Related Function Documentation

◆ operator>>

Istream& operator>> ( Istream ,
tetrahedron  
)
friend

◆ operator

Ostream& operator ( Ostream ,
const tetrahedron  
)
friend

Field Documentation

◆ a_

PointRef a_
private

Definition at line 133 of file tetrahedron.H.

Referenced by tetrahedron::sliceWithPlane(), and tetrahedron::tetOverlap().

◆ b_

PointRef b_
private

Definition at line 133 of file tetrahedron.H.

Referenced by tetrahedron::sliceWithPlane(), and tetrahedron::tetOverlap().

◆ c_

PointRef c_
private

Definition at line 133 of file tetrahedron.H.

Referenced by tetrahedron::sliceWithPlane(), and tetrahedron::tetOverlap().

◆ d_

PointRef d_
private

Definition at line 133 of file tetrahedron.H.

Referenced by tetrahedron::sliceWithPlane(), and tetrahedron::tetOverlap().


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