ENH: simplify tetrahedron and triangle handling

- combine header definitions, more pass-through methods

- face/triFace: support += operator (vertex offset)
This commit is contained in:
Mark Olesen
2022-07-04 12:19:25 +02:00
parent a27c8560a8
commit b4a482751b
95 changed files with 1204 additions and 1131 deletions

View File

@ -0,0 +1,3 @@
Test-barycentric.C
EXE = $(FOAM_USER_APPBIN)/Test-barycentric

View File

@ -0,0 +1,2 @@
/* EXE_INC = */
/* EXE_LIBS = */

View File

@ -0,0 +1,93 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
Test-barycentric
Description
Some simple tests for barycentric coordinates and transforms
\*---------------------------------------------------------------------------*/
#include "barycentricTensor.H"
#include "tetrahedron.H"
#include "vectorField.H"
#include "IOstreams.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[])
{
// Tets to test
tetPoints tetA
(
point(0, 0, 0),
point(1, 0, 0),
point(1, 1, 0),
point(1, 1, 1)
);
const barycentricTensor baryT(tetA[0], tetA[1], tetA[2], tetA[3]);
Info<< nl << "Tet: " << tetA << nl;
Info<< "tens:" << baryT << nl;
for
(
const barycentric& bary :
List<barycentric>
({
{0.25, 0.25, 0.25, 0.25},
{1, 0, 0, 0},
{0, 1, 0, 0},
{0, 0, 1, 0},
{0, 0, 0, 1},
{0, 0, 0, 0} // Not really valid
})
)
{
vector v(tetA.tet().barycentricToPoint(bary));
barycentric b(tetA.tet().pointToBarycentric(v));
Info<< nl
<< "bary: " << bary << nl
<< "vec: " << v << nl
// << "Vec: " << baryT.inner(bary) << nl
<< "Vec: " << (baryT & bary) << nl
<< "bary: " << b << nl
// This won't work (needs a differently defined tensor)
// << "Bary: " << (v & baryT) << nl
;
}
Info<< "\nEnd\n" << nl;
return 0;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -38,7 +38,7 @@ Description
#include "polyMesh.H"
#include "ListOps.H"
#include "face.H"
#include "tetPointRef.H"
#include "tetrahedron.H"
#include "triFaceList.H"
#include "OFstream.H"
#include "meshTools.H"

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2017 OpenFOAM Foundation
Copyright (C) 2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -31,7 +32,7 @@ Description
\*---------------------------------------------------------------------------*/
#include "tetPointRef.H"
#include "tetrahedron.H"
#include "OFstream.H"
#include "meshTools.H"
#include "cut.H"
@ -44,12 +45,12 @@ void writeOBJ
(
Ostream& os,
label& vertI,
const FixedList<point, 4>& tet
const tetPoints& tet
)
{
forAll(tet, fp)
for (const point& p : tet)
{
meshTools::writeOBJ(os, tet[fp]);
meshTools::writeOBJ(os, p);
}
os << "l " << vertI+1 << ' ' << vertI+2 << nl
<< "l " << vertI+1 << ' ' << vertI+3 << nl
@ -61,33 +62,27 @@ void writeOBJ
}
tetPointRef makeTetPointRef(const FixedList<point, 4>& p)
{
return tetPointRef(p[0], p[1], p[2], p[3]);
}
int main(int argc, char *argv[])
{
// Tets to test
FixedList<point, 4> tetA
({
tetPoints tetA
(
point(0, 0, 0),
point(1, 0, 0),
point(1, 1, 0),
point(1, 1, 1)
});
FixedList<point, 4> tetB
({
);
tetPoints tetB
(
point(0.1, 0.1, 0.1),
point(1.1, 0.1, 0.1),
point(1.1, 1.1, 0.1),
point(1.1, 1.1, 1.1)
});
);
// Do intersection
typedef DynamicList<FixedList<point, 4>> tetList;
typedef DynamicList<tetPoints> tetList;
tetList tetsIn1, tetsIn2, tetsOut;
cut::appendOp<tetList> tetOpIn1(tetsIn1);
cut::appendOp<tetList> tetOpIn2(tetsIn2);
@ -155,25 +150,25 @@ int main(int argc, char *argv[])
// Check the volumes
Info<< "Vol A: " << makeTetPointRef(tetA).mag() << endl;
Info<< "Vol A: " << tetA.tet().mag() << endl;
scalar volIn = 0;
forAll(tetsIn, i)
for (const auto& t : tetsIn)
{
volIn += makeTetPointRef(tetsIn[i]).mag();
volIn += t.tet().mag();
}
Info<< "Vol A inside B: " << volIn << endl;
scalar volOut = 0;
forAll(tetsOut, i)
for (const auto& t : tetsOut)
{
volOut += makeTetPointRef(tetsOut[i]).mag();
volOut += t.tet().mag();
}
Info<< "Vol A outside B: " << volOut << endl;
Info<< "Sum inside and outside: " << volIn + volOut << endl;
if (mag(volIn + volOut - makeTetPointRef(tetA).mag()) > SMALL)
if (mag(volIn + volOut - tetA.tet().mag()) > SMALL)
{
FatalErrorInFunction
<< "Tet volumes do not sum up to input tet."

View File

@ -31,7 +31,7 @@ License
#include "pointIOField.H"
#include "scalarIOField.H"
#include "triadIOField.H"
#include "tetPointRef.H"
#include "tetrahedron.H"
#include "plane.H"
#include "transform.H"
#include "meshTools.H"

View File

@ -27,7 +27,6 @@ License
#include "fileControl.H"
#include "addToRunTimeSelectionTable.H"
#include "tetPointRef.H"
#include "scalarList.H"
#include "vectorTools.H"
#include "pointIOField.H"
@ -50,9 +49,6 @@ addToRunTimeSelectionTable
}
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fileControl::fileControl

View File

@ -31,7 +31,6 @@ License
#include "cellSizeFunction.H"
#include "triSurfaceMesh.H"
#include "searchableBox.H"
#include "tetPointRef.H"
#include "vectorTools.H"
#include "quaternion.H"

View File

@ -26,7 +26,7 @@ License
\*---------------------------------------------------------------------------*/
#include "plane.H"
#include "tetPointRef.H"
#include "tetrahedron.H"
#include "pointConversion.H"
#include "CGALTriangulation3DKernel.H"

View File

@ -4,7 +4,7 @@
#include "polyMeshTools.H"
#include "zeroGradientFvPatchFields.H"
#include "syncTools.H"
#include "tetPointRef.H"
#include "tetrahedron.H"
#include "regionSplit.H"
#include "wallDist.H"
#include "cellAspectRatio.H"

View File

@ -27,7 +27,7 @@ License
\*---------------------------------------------------------------------------*/
#include "dynamicIndexedOctree.H"
#include "linePointRef.H"
#include "line.H"
#include "OFstream.H"
#include "ListOps.H"

View File

@ -35,8 +35,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef dynamicIndexedOctree_H
#define dynamicIndexedOctree_H
#ifndef Foam_dynamicIndexedOctree_H
#define Foam_dynamicIndexedOctree_H
#include "treeBoundBox.H"
#include "pointIndexHit.H"
@ -54,7 +54,7 @@ namespace Foam
typedef DynamicList<autoPtr<DynamicList<label>>> contentListList;
// Forward declaration of classes
// Forward Declarations
template<class Type> class dynamicIndexedOctree;
template<class Type> Ostream& operator<<

View File

@ -39,12 +39,12 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef dynamicTreeDataPoint_H
#define dynamicTreeDataPoint_H
#ifndef Foam_dynamicTreeDataPoint_H
#define Foam_dynamicTreeDataPoint_H
#include "pointField.H"
#include "treeBoundBox.H"
#include "linePointRef.H"
#include "line.H"
#include "volumeType.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -52,7 +52,7 @@ SourceFiles
namespace Foam
{
// Forward declaration of classes
// Forward Declarations
template<class Type> class dynamicIndexedOctree;
/*---------------------------------------------------------------------------*\

View File

@ -27,7 +27,7 @@ License
\*---------------------------------------------------------------------------*/
#include "indexedOctree.H"
#include "linePointRef.H"
#include "line.H"
#include "OFstream.H"
#include "ListOps.H"
#include "memInfo.H"

View File

@ -34,8 +34,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef indexedOctree_H
#define indexedOctree_H
#ifndef Foam_indexedOctree_H
#define Foam_indexedOctree_H
#include "treeBoundBox.H"
#include "pointIndexHit.H"
@ -51,7 +51,7 @@ SourceFiles
namespace Foam
{
// Forward declaration of classes
// Forward Declarations
template<class Type> class indexedOctree;
template<class Type> Ostream& operator<<(Ostream&, const indexedOctree<Type>&);
class Istream;

View File

@ -27,7 +27,7 @@ License
\*---------------------------------------------------------------------------*/
#include "cell.H"
#include "pyramidPointFaceRef.H"
#include "pyramid.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

View File

@ -27,7 +27,7 @@ License
\*---------------------------------------------------------------------------*/
#include "cellModel.H"
#include "pyramidPointFaceRef.H"
#include "pyramid.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //

View File

@ -45,11 +45,11 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef edge_H
#define edge_H
#ifndef Foam_edge_H
#define Foam_edge_H
#include "labelPair.H"
#include "linePointRef.H"
#include "line.H"
#include "pointField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -28,7 +28,7 @@ License
#include "face.H"
#include "triFace.H"
#include "triPointRef.H"
#include "triangle.H"
#include "mathematicalConstants.H"
#include "Circulator.H"
#include <algorithm>

View File

@ -43,8 +43,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef face_H
#define face_H
#ifndef Foam_face_H
#define Foam_face_H
#include "pointField.H"
#include "labelList.H"
@ -435,6 +435,12 @@ public:
static bool sameVertices(const face& a, const face& b);
// Member Operators
//- Increment (offset) vertices by given amount
inline void operator+=(const label vertexOffset);
// Hashing
//- The symmetric hash value for face.
@ -494,19 +500,11 @@ template<> struct Hash<face> : face::hasher {};
template<>
struct offsetOp<face>
{
inline face operator()
(
const face& x,
const label offset
) const
face operator()(const face& x, const label offset) const
{
face result(x.size());
forAll(x, i)
{
result[i] = x[i] + offset;
}
return result;
face f(x);
f += offset;
return f;
}
};

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2017-2021 OpenCFD Ltd.
Copyright (C) 2017-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -190,6 +190,20 @@ inline Foam::label Foam::face::nTriangles() const
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
inline void Foam::face::operator+=(const label vertexOffset)
{
if (vertexOffset)
{
for (label& vrt : static_cast<labelList&>(*this))
{
vrt += vertexOffset;
}
}
}
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
inline bool Foam::operator==(const face& a, const face& b)

View File

@ -27,7 +27,7 @@ License
#include "face.H"
#include "pointHit.H"
#include "triPointRef.H"
#include "triangle.H"
#include "line.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -30,13 +30,10 @@ Description
Class containing opposite face for a prismatic cell with addressing
and a possibility of failure.
SourceFiles
oppositeFace.C
\*---------------------------------------------------------------------------*/
#ifndef oppositeFace_H
#define oppositeFace_H
#ifndef Foam_oppositeFace_H
#define Foam_oppositeFace_H
#include "face.H"
@ -53,7 +50,7 @@ class oppositeFace
:
public face
{
// Private data
// Private Data
//- Master face index
const label masterIndex_;
@ -84,19 +81,19 @@ public:
// Member Functions
//- Master face index
inline label masterIndex() const
label masterIndex() const noexcept
{
return masterIndex_;
}
//- Slave face index
inline label oppositeIndex() const
//- Opposite face index
label oppositeIndex() const noexcept
{
return oppositeIndex_;
}
//- Does the opposite face exist?
inline bool found() const
bool found() const noexcept
{
return oppositeIndex_ >= 0;
}

View File

@ -35,8 +35,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef labelledTri_H
#define labelledTri_H
#ifndef Foam_labelledTri_H
#define Foam_labelledTri_H
#include "triFace.H"
#include "ListListOps.H"
@ -91,9 +91,9 @@ public:
//- and optional region index (0 if unspecified)
inline labelledTri
(
const label a,
const label b,
const label c,
const label p0,
const label p1,
const label p2,
const label region = 0
);
@ -179,13 +179,9 @@ struct offsetOp<labelledTri>
{
labelledTri operator()(const labelledTri& x, const label offset) const
{
labelledTri result(x);
forAll(x, xi)
{
result[xi] = x[xi] + offset;
}
return result;
labelledTri f(x);
f += offset;
return f;
}
};

View File

@ -77,13 +77,13 @@ inline Foam::labelledTri::labelledTri
inline Foam::labelledTri::labelledTri
(
const label a,
const label b,
const label c,
const label p0,
const label p1,
const label p2,
const label region
)
:
triFace(a, b, c),
triFace(p0, p1, p2),
index_(region)
{}

View File

@ -40,15 +40,15 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef tetCell_H
#define tetCell_H
#ifndef Foam_tetCell_H
#define Foam_tetCell_H
#include "FixedList.H"
#include "triFace.H"
#include "faceList.H"
#include "edgeList.H"
#include "pointField.H"
#include "tetPointRef.H"
#include "tetrahedron.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -85,10 +85,10 @@ public:
//- Construct from four point labels
inline tetCell
(
const label a,
const label b,
const label c,
const label d
const label p0,
const label p1,
const label p2,
const label p3
);
//- Construct from an initializer list of four point labels

View File

@ -36,16 +36,16 @@ inline Foam::tetCell::tetCell()
inline Foam::tetCell::tetCell
(
const label a,
const label b,
const label c,
const label d
const label p0,
const label p1,
const label p2,
const label p3
)
{
operator[](0) = a;
operator[](1) = b;
operator[](2) = c;
operator[](3) = d;
operator[](0) = p0;
operator[](1) = p1;
operator[](2) = p2;
operator[](3) = p3;
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2021 OpenCFD Ltd.
Copyright (C) 2017-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -48,7 +48,7 @@ SourceFiles
#include "pointHit.H"
#include "intersection.H"
#include "pointField.H"
#include "triPointRef.H"
#include "triangle.H"
#include "ListListOps.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -79,12 +79,7 @@ public:
inline triFace();
//- Construct from three point labels
inline triFace
(
const label a,
const label b,
const label c
);
inline triFace(const label p0, const label p1, const label p2);
//- Construct from an initializer list of three point labels
inline explicit triFace(std::initializer_list<label> list);
@ -321,6 +316,12 @@ public:
static inline int compare(const triFace& a, const triFace& b);
// Member Operators
//- Increment (offset) vertices by given amount
inline void operator+=(const label vertexOffset);
// Hashing
//- The (commutative) hash value for triFace
@ -377,19 +378,11 @@ template<> struct Hash<triFace> : triFace::hasher {};
template<>
struct offsetOp<triFace>
{
inline triFace operator()
(
const triFace& x,
const label offset
) const
triFace operator()(const triFace& x, const label offset) const
{
triFace result;
forAll(x, i)
{
result[i] = x[i] + offset;
}
return result;
triFace f(x);
f += offset;
return f;
}
};

View File

@ -28,7 +28,6 @@ License
#include "IOstreams.H"
#include "face.H"
#include "triPointRef.H"
#include <algorithm> // For std::swap
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
@ -68,16 +67,11 @@ inline Foam::triFace::triFace()
{}
inline Foam::triFace::triFace
(
const label a,
const label b,
const label c
)
inline Foam::triFace::triFace(const label p0, const label p1, const label p2)
{
operator[](0) = a;
operator[](1) = b;
operator[](2) = c;
operator[](0) = p0;
operator[](1) = p1;
operator[](2) = p2;
}
@ -476,6 +470,19 @@ inline int Foam::triFace::edgeDirection(const Foam::edge& e) const
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
inline void Foam::triFace::operator+=(const label vertexOffset)
{
if (vertexOffset)
{
(*this)[0] += vertexOffset;
(*this)[1] += vertexOffset;
(*this)[2] += vertexOffset;
}
}
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
inline bool Foam::operator==(const triFace& a, const triFace& b)

View File

@ -28,7 +28,7 @@ License
#include "polyMeshTools.H"
#include "syncTools.H"
#include "pyramidPointFaceRef.H"
#include "pyramid.H"
#include "primitiveMeshTools.H"
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //

View File

@ -39,13 +39,12 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef polyMeshTetDecomposition_H
#define polyMeshTetDecomposition_H
#ifndef Foam_polyMeshTetDecomposition_H
#define Foam_polyMeshTetDecomposition_H
#include "polyMesh.H"
#include "coupledPolyPatch.H"
#include "syncTools.H"
#include "tetPointRef.H"
#include "tetIndices.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -59,8 +59,8 @@ SourceFiles
#define Foam_tetIndices_H
#include "label.H"
#include "tetPointRef.H"
#include "triPointRef.H"
#include "tetrahedron.H"
#include "triangle.H"
#include "polyMesh.H"
#include "triFace.H"
#include "face.H"
@ -76,7 +76,6 @@ class tetIndices;
Istream& operator>>(Istream&, tetIndices&);
Ostream& operator<<(Ostream&, const tetIndices&);
/*---------------------------------------------------------------------------*\
Class tetIndices Declaration
\*---------------------------------------------------------------------------*/
@ -149,35 +148,49 @@ public:
label& tetPt() noexcept { return tetPti_; }
// Searching
// Mesh-related
//- Return the indices corresponding to the tri on the face for
// this tet. The normal of the tri points out of the cell
//- The indices corresponding to the tri on the face for this tet.
//- The normal of the tri points out of the cell.
inline triFace faceTriIs
(
const polyMesh& mesh,
const bool warn = true
) const;
//- Return the local indices corresponding to the tri on the face
//- for this tet. The normal of the tri points out of the cell
//- Local indices corresponding to the tri on the face for this tet.
//- The normal of the tri points out of the cell.
inline triFace triIs
(
const polyMesh& mesh,
const bool warn = true
) const;
//- Return the geometry corresponding to this tet
//- The tet geometry for this tet,
//- where point0 is the cell centre.
inline tetPointRef tet(const polyMesh& mesh) const;
//- Return the geometry corresponding to the tri on the face for
//- this tet. The normal of the tri points out of the cell
//- The tet geometry for this tet (using old positions),
//- where point0 is the cell centre.
inline tetPointRef oldTet(const polyMesh& mesh) const;
//- The triangle geometry for the face for this tet.
//- The normal of the tri points out of the cell
inline triPointRef faceTri(const polyMesh& mesh) const;
//- Return the geometry corresponding to the tri on the face for
//- this tet using the old positions
//- The triangle geometry for the face for this tet
//- (using old positions)
inline triPointRef oldFaceTri(const polyMesh& mesh) const;
//- The x/y/z position for given barycentric coordinates
//- (where point0 is the cell centre).
inline point barycentricToPoint
(
const polyMesh& mesh,
const barycentric& bary
) const;
// Other

View File

@ -57,9 +57,9 @@ inline Foam::triFace Foam::tetIndices::faceTriIs
const bool warn
) const
{
const Foam::face& f = mesh.faces()[face()];
const Foam::face& f = mesh.faces()[facei_];
label faceBasePtI = mesh.tetBasePtIs()[face()];
label faceBasePtI = mesh.tetBasePtIs()[facei_];
if (faceBasePtI < 0)
{
@ -67,24 +67,25 @@ inline Foam::triFace Foam::tetIndices::faceTriIs
if (warn && nWarnings_ < maxNWarnings)
{
++nWarnings_;
WarningInFunction
<< "No base point for face " << face() << ", " << f
<< "No base point for face " << facei_ << ", " << f
<< ", produces a valid tet decomposition." << endl;
if (nWarnings_ == maxNWarnings)
if (++nWarnings_ == maxNWarnings)
{
Warning
<< "Suppressing any further warnings." << endl;
<< "Suppressing further warnings." << endl;
}
}
}
label facePtI = (tetPti_ + faceBasePtI) % f.size();
label faceOtherPtI = f.fcIndex(facePtI);
const label facePtI = (tetPti_ + faceBasePtI) % f.size();
const label faceOtherPtI = f.fcIndex(facePtI);
if (mesh.faceOwner()[face()] != cell())
if (mesh.faceOwner()[facei_] != celli_)
{
std::swap(facePtI, faceOtherPtI);
// Neighbour: return flipped face
return triFace(f[faceBasePtI], f[faceOtherPtI], f[facePtI]);
}
return triFace(f[faceBasePtI], f[facePtI], f[faceOtherPtI]);
@ -97,9 +98,9 @@ inline Foam::triFace Foam::tetIndices::triIs
const bool warn
) const
{
const Foam::face& f = mesh.faces()[face()];
const Foam::face& f = mesh.faces()[facei_];
label faceBasePtI = mesh.tetBasePtIs()[face()];
label faceBasePtI = mesh.tetBasePtIs()[facei_];
if (faceBasePtI < 0)
{
@ -107,24 +108,25 @@ inline Foam::triFace Foam::tetIndices::triIs
if (warn && nWarnings_ < maxNWarnings)
{
++nWarnings_;
WarningInFunction
<< "No base point for face " << face() << ", " << f
<< "No base point for face " << facei_ << ", " << f
<< ", produces a valid tet decomposition." << endl;
if (nWarnings_ == maxNWarnings)
if (++nWarnings_ == maxNWarnings)
{
Warning
<< "Suppressing any further warnings." << endl;
<< "Suppressing further warnings." << endl;
}
}
}
label facePtI = (tetPti_ + faceBasePtI) % f.size();
label faceOtherPtI = f.fcIndex(facePtI);
const label facePtI = (tetPti_ + faceBasePtI) % f.size();
const label faceOtherPtI = f.fcIndex(facePtI);
if (mesh.faceOwner()[face()] != cell())
if (mesh.faceOwner()[facei_] != celli_)
{
std::swap(facePtI, faceOtherPtI);
// Neighbour: return flipped face
return triFace(faceBasePtI, faceOtherPtI, facePtI);
}
return triFace(faceBasePtI, facePtI, faceOtherPtI);
@ -133,30 +135,60 @@ inline Foam::triFace Foam::tetIndices::triIs
inline Foam::tetPointRef Foam::tetIndices::tet(const polyMesh& mesh) const
{
const pointField& meshPoints = mesh.points();
const pointField& pts = mesh.points();
const triFace tri = faceTriIs(mesh);
return tetPointRef
(
mesh.cellCentres()[cell()],
meshPoints[tri[0]],
meshPoints[tri[1]],
meshPoints[tri[2]]
mesh.cellCentres()[celli_],
pts[tri[0]],
pts[tri[1]],
pts[tri[2]]
);
}
inline Foam::tetPointRef Foam::tetIndices::oldTet(const polyMesh& mesh) const
{
const pointField& pts = mesh.oldPoints();
const triFace tri = faceTriIs(mesh);
return tetPointRef
(
mesh.oldCellCentres()[celli_],
pts[tri[0]],
pts[tri[1]],
pts[tri[2]]
);
}
inline Foam::point Foam::tetIndices::barycentricToPoint
(
const polyMesh& mesh,
const barycentric& bary
) const
{
const pointField& pts = mesh.points();
const triFace tri = faceTriIs(mesh);
const point& a = mesh.cellCentres()[celli_];
const point& b = pts[tri[0]];
const point& c = pts[tri[1]];
const point& d = pts[tri[2]];
return point
(
(bary.a()*a.x() + bary.b()*b.x() + bary.c()*c.x() + bary.d()*d.x()),
(bary.a()*a.y() + bary.b()*b.y() + bary.c()*c.y() + bary.d()*d.y()),
(bary.a()*a.z() + bary.b()*b.z() + bary.c()*c.z() + bary.d()*d.z())
);
}
inline Foam::triPointRef Foam::tetIndices::faceTri(const polyMesh& mesh) const
{
const pointField& meshPoints = mesh.points();
const triFace tri = faceTriIs(mesh);
return triPointRef
(
meshPoints[tri[0]],
meshPoints[tri[1]],
meshPoints[tri[2]]
);
return faceTriIs(mesh).tri(mesh.points());
}
@ -165,15 +197,7 @@ inline Foam::triPointRef Foam::tetIndices::oldFaceTri
const polyMesh& mesh
) const
{
const pointField& meshOldPoints = mesh.oldPoints();
const triFace tri = faceTriIs(mesh);
return triPointRef
(
meshOldPoints[tri[0]],
meshOldPoints[tri[1]],
meshOldPoints[tri[2]]
);
return faceTriIs(mesh).tri(mesh.oldPoints());
}

View File

@ -27,7 +27,7 @@ License
\*---------------------------------------------------------------------------*/
#include "primitiveMesh.H"
#include "pyramidPointFaceRef.H"
#include "pyramid.H"
#include "ListOps.H"
#include "unitConversion.H"
#include "SortableList.H"

View File

@ -29,7 +29,7 @@ License
#include "primitiveMeshTools.H"
#include "primitiveMesh.H"
#include "syncTools.H"
#include "pyramidPointFaceRef.H"
#include "pyramid.H"
#include "PrecisionAdaptor.H"
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //

View File

@ -33,13 +33,13 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef cut_H
#define cut_H
#ifndef Foam_cut_H
#define Foam_cut_H
#include "plane.H"
#include "FixedList.H"
#include "tetPointRef.H"
#include "triPointRef.H"
#include "tetrahedron.H"
#include "triangle.H"
#include "zero.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -35,12 +35,13 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef line_H
#define line_H
#ifndef Foam_line_H
#define Foam_line_H
#include "point.H"
#include "point2D.H"
#include "vector.H"
#include "PointHit.H"
#include "point2D.H"
#include "FixedList.H"
#include "UList.H"
@ -60,6 +61,12 @@ template<class Point, class PointRef>
inline Ostream& operator<<(Ostream& os, const line<Point, PointRef>& l);
// Common Typedefs
//- A line using referred points
typedef line<point, const point&> linePointRef;
/*---------------------------------------------------------------------------*\
Class line Declaration
\*---------------------------------------------------------------------------*/
@ -100,19 +107,19 @@ public:
// Access
//- Return first point
inline PointRef first() const noexcept;
inline PointRef first() const noexcept { return a_; }
//- Return second (last) point
inline PointRef second() const noexcept;
inline PointRef second() const noexcept { return b_; }
//- Return last (second) point
inline PointRef last() const noexcept;
inline PointRef last() const noexcept { return b_; }
//- Return first point
inline PointRef start() const noexcept;
//- Return start (first) point
inline PointRef start() const noexcept { return a_; }
//- Return second (last) point
inline PointRef end() const noexcept;
//- Return end (second) point
inline PointRef end() const noexcept { return b_; }
// Properties

View File

@ -60,40 +60,6 @@ inline Foam::line<Point, PointRef>::line(Istream& is)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Point, class PointRef>
inline PointRef Foam::line<Point, PointRef>::first() const noexcept
{
return a_;
}
template<class Point, class PointRef>
inline PointRef Foam::line<Point, PointRef>::second() const noexcept
{
return b_;
}
template<class Point, class PointRef>
inline PointRef Foam::line<Point, PointRef>::last() const noexcept
{
return b_;
}
template<class Point, class PointRef>
inline PointRef Foam::line<Point, PointRef>::start() const noexcept
{
return first();
}
template<class Point, class PointRef>
inline PointRef Foam::line<Point, PointRef>::end() const noexcept
{
return second();
}
template<class Point, class PointRef>
inline Point Foam::line<Point, PointRef>::centre() const
{

View File

@ -1,55 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Typedef
Foam::linePoint2DRef
Description
A line using referred 2D points
\*---------------------------------------------------------------------------*/
#ifndef linePoint2DRef_H
#define linePoint2DRef_H
#include "point2D.H"
#include "line.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
typedef line<point2D, const point2D&> linePoint2DRef;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
#endif
// ************************************************************************* //

View File

@ -1,55 +1,11 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
// Compatibility include.
// linePointRef typedef included in line.H (JUL-2022)
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
#ifndef FoamCompat_linePointRef_H
#define FoamCompat_linePointRef_H
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Typedef
Foam::linePointRef
Description
A line using referred points
\*---------------------------------------------------------------------------*/
#ifndef linePointRef_H
#define linePointRef_H
#include "point.H"
#include "line.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
typedef line<point, const point&> linePointRef;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
#endif
// ************************************************************************* //

View File

@ -31,8 +31,8 @@ Description
\*---------------------------------------------------------------------------*/
#ifndef point_H
#define point_H
#ifndef Foam_point_H
#define Foam_point_H
#include "vector.H"

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
Copyright (C) 2020-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -37,8 +37,11 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef pyramid_H
#define pyramid_H
#ifndef Foam_pyramid_H
#define Foam_pyramid_H
#include "point.H"
#include "face.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -47,34 +50,39 @@ namespace Foam
// Forward Declarations
template<class Point, class PointRef, class polygonRef>
class pyramid;
template<class Point, class PointRef, class PolygonRef> class pyramid;
template<class Point, class PointRef, class polygonRef>
template<class Point, class PointRef, class PolygonRef>
inline Istream& operator>>
(
Istream& is,
pyramid<Point, PointRef, polygonRef>& p
pyramid<Point, PointRef, PolygonRef>& p
);
template<class Point, class PointRef, class polygonRef>
template<class Point, class PointRef, class PolygonRef>
inline Ostream& operator<<
(
Ostream& os,
const pyramid<Point, PointRef, polygonRef>& p
const pyramid<Point, PointRef, PolygonRef>& p
);
// Common Typedefs
//- A pyramid using referred point and face
typedef pyramid<point, const point&, const face&> pyramidPointFaceRef;
/*---------------------------------------------------------------------------*\
Class pyramid Declaration
\*---------------------------------------------------------------------------*/
template<class Point, class PointRef, class polygonRef>
template<class Point, class PointRef, class PolygonRef>
class pyramid
{
// Private Data
polygonRef base_;
PolygonRef base_;
PointRef apex_;
@ -90,7 +98,7 @@ public:
// Constructors
//- Construct from base polygon and apex point
inline pyramid(polygonRef base, const Point& apex);
inline pyramid(PolygonRef base, const Point& apex);
//- Construct from Istream
inline explicit pyramid(Istream& is);
@ -100,11 +108,11 @@ public:
// Access
//- Return apex point
inline const Point& apex() const;
//- The apex point
const Point& apex() const { return apex_; }
//- Return base polygon
inline polygonRef base() const;
//- The base polygon
PolygonRef base() const { return base_; }
// Properties
@ -121,13 +129,13 @@ public:
// IOstream Operators
friend Istream& operator>> <Point, PointRef, polygonRef>
friend Istream& operator>> <Point, PointRef, PolygonRef>
(
Istream& is,
pyramid& p
);
friend Ostream& operator<< <Point, PointRef, polygonRef>
friend Ostream& operator<< <Point, PointRef, PolygonRef>
(
Ostream& os,
const pyramid& p

View File

@ -29,10 +29,10 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Point, class PointRef, class polygonRef>
inline Foam::pyramid<Point, PointRef, polygonRef>::pyramid
template<class Point, class PointRef, class PolygonRef>
inline Foam::pyramid<Point, PointRef, PolygonRef>::pyramid
(
polygonRef base,
PolygonRef base,
const Point& apex
)
:
@ -41,31 +41,17 @@ inline Foam::pyramid<Point, PointRef, polygonRef>::pyramid
{}
template<class Point, class PointRef, class polygonRef>
inline Foam::pyramid<Point, PointRef, polygonRef>::pyramid(Istream& is)
template<class Point, class PointRef, class PolygonRef>
inline Foam::pyramid<Point, PointRef, PolygonRef>::pyramid(Istream& is)
{
is >> base_ >> apex_;
is.check(FUNCTION_NAME);
is >> *this;
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Point, class PointRef, class polygonRef>
inline const Point& Foam::pyramid<Point, PointRef, polygonRef>::apex() const
{
return apex_;
}
template<class Point, class PointRef, class polygonRef>
inline polygonRef Foam::pyramid<Point, PointRef, polygonRef>::base() const
{
return base_;
}
template<class Point, class PointRef, class polygonRef>
inline Point Foam::pyramid<Point, PointRef, polygonRef>::centre
template<class Point, class PointRef, class PolygonRef>
inline Point Foam::pyramid<Point, PointRef, PolygonRef>::centre
(
const UList<point>& points
) const
@ -74,8 +60,8 @@ inline Point Foam::pyramid<Point, PointRef, polygonRef>::centre
}
template<class Point, class PointRef, class polygonRef>
inline Foam::vector Foam::pyramid<Point, PointRef, polygonRef>::height
template<class Point, class PointRef, class PolygonRef>
inline Foam::vector Foam::pyramid<Point, PointRef, PolygonRef>::height
(
const UList<point>& points
) const
@ -85,8 +71,8 @@ inline Foam::vector Foam::pyramid<Point, PointRef, polygonRef>::height
}
template<class Point, class PointRef, class polygonRef>
inline Foam::scalar Foam::pyramid<Point, PointRef, polygonRef>::mag
template<class Point, class PointRef, class PolygonRef>
inline Foam::scalar Foam::pyramid<Point, PointRef, PolygonRef>::mag
(
const UList<point>& points
) const
@ -97,11 +83,11 @@ inline Foam::scalar Foam::pyramid<Point, PointRef, polygonRef>::mag
// * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * * //
template<class Point, class PointRef, class polygonRef>
template<class Point, class PointRef, class PolygonRef>
inline Foam::Istream& Foam::operator>>
(
Istream& is,
pyramid<Point, PointRef, polygonRef>& p
pyramid<Point, PointRef, PolygonRef>& p
)
{
is >> p.base_ >> p.apex_;
@ -110,11 +96,11 @@ inline Foam::Istream& Foam::operator>>
}
template<class Point, class PointRef, class polygonRef>
template<class Point, class PointRef, class PolygonRef>
inline Foam::Ostream& Foam::operator<<
(
Ostream& os,
const pyramid<Point, PointRef, polygonRef>& p
const pyramid<Point, PointRef, PolygonRef>& p
)
{
os << p.base_ << tab << p.apex_ << nl;

View File

@ -1,56 +1,11 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
// Compatibility include
// pyramidPointFaceRef typedef included in tetrahedron.H (SEP-2017)
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
#ifndef FoamCompat_pyramidPointFaceRef_H
#define FoamCompat_pyramidPointFaceRef_H
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Typedef
Foam::pyramidPointFaceRef
Description
A pyramid using referred points and faces
\*---------------------------------------------------------------------------*/
#ifndef pyramidPointFaceRef_H
#define pyramidPointFaceRef_H
#include "point.H"
#include "face.H"
#include "pyramid.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
typedef pyramid<point, const point&, const face&> pyramidPointFaceRef;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
#endif
// ************************************************************************* //

View File

@ -1,55 +1,11 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
// Compatibility include.
// tetPointRef typedef included in tetrahedron.H (SEP-2017)
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
#ifndef FoamCompat_tetPointRef_H
#define FoamCompat_tetPointRef_H
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Typedef
Foam::tetPointRef
Description
A tetrahedron using referred points
\*---------------------------------------------------------------------------*/
#ifndef tetPointRef_H
#define tetPointRef_H
#include "point.H"
#include "tetrahedron.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
typedef tetrahedron<point, const point&> tetPointRef;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
#endif
// ************************************************************************* //

View File

@ -1,126 +1,10 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2012 OpenFOAM Foundation
Copyright (C) 2017-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
// Compatibility include.
// tetPoints defined in tetrahedron.H (JUL-2022)
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::tetPoints
Description
Tet storage. Null constructable (unfortunately tetrahedron<point, point>
is not)
SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef tetPoints_H
#define tetPoints_H
#ifndef FoamCompat_tetPoints_H
#define FoamCompat_tetPoints_H
#include "tetrahedron.H"
#include "FixedList.H"
#include "treeBoundBox.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class tetPoints Declaration
\*---------------------------------------------------------------------------*/
class tetPoints
:
public FixedList<point, 4>
{
public:
// Constructors
//- Default construct
inline tetPoints()
{}
//- Construct from four points
inline tetPoints
(
const point& a,
const point& b,
const point& c,
const point& d
)
{
operator[](0) = a;
operator[](1) = b;
operator[](2) = c;
operator[](3) = d;
}
//- Copy construct from subset of points
inline tetPoints
(
const UList<point>& points,
const FixedList<label, 4>& indices
)
:
FixedList<point, 4>(points, indices)
{}
// Member Functions
//- Return the tetrahedron
inline tetPointRef tet() const
{
return tetPointRef
(
operator[](0),
operator[](1),
operator[](2),
operator[](3)
);
}
//- Calculate the bounding box
inline treeBoundBox bounds() const
{
treeBoundBox bb(operator[](0));
for (label i = 1; i < size(); ++i)
{
bb.add(operator[](i));
}
return bb;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif

View File

@ -26,7 +26,6 @@ License
\*---------------------------------------------------------------------------*/
#include "tetrahedron.H"
#include "triPointRef.H"
#include "scalarField.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018 OpenCFD Ltd.
Copyright (C) 2018-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -39,17 +39,17 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef tetrahedron_H
#define tetrahedron_H
#ifndef Foam_tetrahedron_H
#define Foam_tetrahedron_H
#include "point.H"
#include "primitiveFieldsFwd.H"
#include "pointHit.H"
#include "primitiveFieldsFwd.H"
#include "Random.H"
#include "FixedList.H"
#include "UList.H"
#include "triPointRef.H"
#include "boundBox.H"
#include "triangle.H"
#include "treeBoundBox.H"
#include "barycentric.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -59,28 +59,103 @@ namespace Foam
// Forward Declarations
class plane;
class tetPoints;
template<class Point, class PointRef> class tetrahedron;
template<class Point, class PointRef>
inline Istream& operator>>
(
Istream&,
tetrahedron<Point, PointRef>&
);
inline Istream& operator>>(Istream&, tetrahedron<Point, PointRef>&);
template<class Point, class PointRef>
inline Ostream& operator<<
(
Ostream&,
const tetrahedron<Point, PointRef>&
);
inline Ostream& operator<<(Ostream&, const tetrahedron<Point, PointRef>&);
// Common Typedefs
//- A tetrahedron using referred points
typedef tetrahedron<point, const point&> tetPointRef;
/*---------------------------------------------------------------------------*\
class tetrahedron Declaration
Class tetPoints Declaration
\*---------------------------------------------------------------------------*/
//- Tet point storage. Default constructable (tetrahedron is not)
class tetPoints
:
public FixedList<point, 4>
{
public:
// Generated Methods
//- Default construct
tetPoints() = default;
// Constructors
//- Construct from four points
inline tetPoints
(
const point& p0,
const point& p1,
const point& p2,
const point& p3
);
//- Construct from point references
inline explicit tetPoints(const tetPointRef& pts);
//- Construct from four points
inline tetPoints(const FixedList<point, 4>& pts);
//- Copy construct from subset of points
inline tetPoints
(
const UList<point>& points,
const FixedList<label, 4>& indices
);
// Member Functions
//- The first vertex
const point& a() const { return operator[](0); }
//- The second vertex
const point& b() const { return operator[](1); }
//- The third vertex
const point& c() const { return operator[](2); }
//- The fourth vertex
const point& d() const { return operator[](3); }
//- The first vertex
point& a() { return operator[](0); }
//- The second vertex
point& b() { return operator[](1); }
//- The third vertex
point& c() { return operator[](2); }
//- The fourth vertex
point& d() { return operator[](3); }
//- Return as tetrahedron reference
inline tetPointRef tet() const;
//- Invert tetrahedron by swapping third and fourth vertices
inline void flip();
//- The bounding box for the tetrahedron
inline treeBoundBox bounds() const;
};
/*---------------------------------------------------------------------------*\
Class tetrahedron Declaration
\*---------------------------------------------------------------------------*/
template<class Point, class PointRef>
@ -88,7 +163,10 @@ class tetrahedron
{
public:
// Public typedefs
// Public Typedefs
//- The point type
typedef Point point_type;
//- Storage type for tets originating from intersecting tets.
// (can possibly be smaller than 200)
@ -130,10 +208,13 @@ public:
private:
// Private data
// Private Data
PointRef a_, b_, c_, d_;
// Private Member Functions
inline static point planeIntersection
(
const FixedList<scalar, 4>&,
@ -161,7 +242,7 @@ private:
public:
// Member constants
// Member Constants
enum
{
@ -172,15 +253,18 @@ public:
// Constructors
//- Construct from points
//- Construct from four points
inline tetrahedron
(
const Point& a,
const Point& b,
const Point& c,
const Point& d
const Point& p0,
const Point& p1,
const Point& p2,
const Point& p3
);
//- Construct from four points
inline tetrahedron(const FixedList<Point, 4>& pts);
//- Construct from four points in the list of points
inline tetrahedron
(
@ -189,21 +273,24 @@ public:
);
//- Construct from Istream
inline tetrahedron(Istream&);
inline explicit tetrahedron(Istream&);
// Member Functions
// Access
//- Return vertices
inline const Point& a() const;
//- Return vertex a
const Point& a() const noexcept { return a_; }
inline const Point& b() const;
//- Return vertex b
const Point& b() const noexcept { return b_; }
inline const Point& c() const;
//- Return vertex c
const Point& c() const noexcept { return c_; }
inline const Point& d() const;
//- Return vertex d
const Point& d() const noexcept { return d_; }
//- Return i-th face
inline triPointRef tri(const label facei) const;
@ -236,12 +323,12 @@ public:
inline scalar circumRadius() const;
//- Return quality: Ratio of tetrahedron and circum-sphere
// volume, scaled so that a regular tetrahedron has a
// quality of 1
//- volume, scaled so that a regular tetrahedron has a
//- quality of 1
inline scalar quality() const;
//- Return a random point in the tetrahedron from a
// uniform distribution
//- uniform distribution
inline Point randomPoint(Random& rndGen) const;
//- Calculate the point from the given barycentric coordinates.

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2018 OpenCFD Ltd.
Copyright (C) 2018-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -28,24 +28,76 @@ License
#include "triangle.H"
#include "IOstreams.H"
#include "tetPoints.H"
#include "plane.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
inline Foam::tetPoints::tetPoints
(
const point& p0,
const point& p1,
const point& p2,
const point& p3
)
{
operator[](0) = p0;
operator[](1) = p1;
operator[](2) = p2;
operator[](3) = p3;
}
inline Foam::tetPoints::tetPoints(const tetPointRef& pts)
{
operator[](0) = pts.a();
operator[](1) = pts.b();
operator[](2) = pts.c();
operator[](3) = pts.d();
}
inline Foam::tetPoints::tetPoints(const FixedList<point, 4>& pts)
:
FixedList<point, 4>(pts)
{}
inline Foam::tetPoints::tetPoints
(
const UList<point>& points,
const FixedList<label, 4>& indices
)
:
FixedList<point, 4>(points, indices)
{}
template<class Point, class PointRef>
inline Foam::tetrahedron<Point, PointRef>::tetrahedron
(
const Point& a,
const Point& b,
const Point& c,
const Point& d
const Point& p0,
const Point& p1,
const Point& p2,
const Point& p3
)
:
a_(a),
b_(b),
c_(c),
d_(d)
a_(p0),
b_(p1),
c_(p2),
d_(p3)
{}
template<class Point, class PointRef>
inline Foam::tetrahedron<Point, PointRef>::tetrahedron
(
const FixedList<Point, 4>& pts
)
:
a_(pts[0]),
b_(pts[1]),
c_(pts[2]),
d_(pts[3])
{}
@ -72,33 +124,31 @@ inline Foam::tetrahedron<Point, PointRef>::tetrahedron(Istream& is)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Point, class PointRef>
inline const Point& Foam::tetrahedron<Point, PointRef>::a() const
inline Foam::tetPointRef Foam::tetPoints::tet() const
{
return a_;
return tetPointRef(a(), b(), c(), d());
}
template<class Point, class PointRef>
inline const Point& Foam::tetrahedron<Point, PointRef>::b() const
inline void Foam::tetPoints::flip()
{
return b_;
// swap pt2 <-> pt3
point t(c());
c() = d();
d() = t;
}
template<class Point, class PointRef>
inline const Point& Foam::tetrahedron<Point, PointRef>::c() const
inline Foam::treeBoundBox Foam::tetPoints::bounds() const
{
return c_;
treeBoundBox bb;
bb.add(static_cast<const FixedList<point, 4>&>(*this));
return bb;
}
template<class Point, class PointRef>
inline const Point& Foam::tetrahedron<Point, PointRef>::d() const
{
return d_;
}
// Warning. Ordering of faces needs to be the same for a tetrahedron class,
// tetrahedron cell shape model and a tetCell
template<class Point, class PointRef>
inline Foam::triPointRef Foam::tetrahedron<Point, PointRef>::tri
@ -257,7 +307,7 @@ inline Point Foam::tetrahedron<Point, PointRef>::barycentricToPoint
const barycentric& bary
) const
{
return bary[0]*a_ + bary[1]*b_ + bary[2]*c_ + bary[3]*d_;
return Point(bary.a()*a_ + bary.b()*b_ + bary.c()*c_ + bary.d()*d_);
}
@ -310,7 +360,7 @@ inline Foam::scalar Foam::tetrahedron<Point, PointRef>::pointToBarycentric
bary[0] = res.x();
bary[1] = res.y();
bary[2] = res.z();
bary[3] = 1 - cmptSum(res);
bary[3] = 1 - bary[0] - bary[1] - bary[2];
return detT;
}
@ -334,10 +384,14 @@ inline Foam::pointHit Foam::tetrahedron<Point, PointRef>::nearestPoint
bool inside = true;
if (((p - b_) & Sa()) >= 0)
// Side a
{
const triangle<Point, PointRef> tria(b_, c_, d_);
if (((p - b_) & tria.areaNormal()) >= 0)
{
// p is outside halfspace plane of tri
pointHit info = triangle<Point, PointRef>(b_, c_, d_).nearestPoint(p);
pointHit info = tria.nearestPoint(p);
inside = false;
@ -348,11 +402,16 @@ inline Foam::pointHit Foam::tetrahedron<Point, PointRef>::nearestPoint
minOutsideDistance = info.distance();
}
}
}
if (((p - a_) & Sb()) >= 0)
// Side b
{
const triangle<Point, PointRef> tria(a_, d_, c_);
if (((p - a_) & tria.areaNormal()) >= 0)
{
// p is outside halfspace plane of tri
pointHit info = triangle<Point, PointRef>(a_, d_, c_).nearestPoint(p);
pointHit info = tria.nearestPoint(p);
inside = false;
@ -363,11 +422,16 @@ inline Foam::pointHit Foam::tetrahedron<Point, PointRef>::nearestPoint
minOutsideDistance = info.distance();
}
}
}
if (((p - a_) & Sc()) >= 0)
// Side c
{
const triangle<Point, PointRef> tria(a_, b_, d_);
if (((p - a_) & tria.areaNormal()) >= 0)
{
// p is outside halfspace plane of tri
pointHit info = triangle<Point, PointRef>(a_, b_, d_).nearestPoint(p);
pointHit info = tria.nearestPoint(p);
inside = false;
@ -378,11 +442,16 @@ inline Foam::pointHit Foam::tetrahedron<Point, PointRef>::nearestPoint
minOutsideDistance = info.distance();
}
}
}
if (((p - a_) & Sd()) >= 0)
// Side c
{
const triangle<Point, PointRef> tria(a_, c_, b_);
if (((p - a_) & tria.areaNormal()) >= 0)
{
// p is outside halfspace plane of tri
pointHit info = triangle<Point, PointRef>(a_, c_, b_).nearestPoint(p);
pointHit info = tria.nearestPoint(p);
inside = false;
@ -393,6 +462,7 @@ inline Foam::pointHit Foam::tetrahedron<Point, PointRef>::nearestPoint
minOutsideDistance = info.distance();
}
}
}
// If the point is inside, then the distance to the closest point
// is zero
@ -412,7 +482,7 @@ inline Foam::pointHit Foam::tetrahedron<Point, PointRef>::nearestPoint
template<class Point, class PointRef>
bool Foam::tetrahedron<Point, PointRef>::inside(const point& pt) const
bool Foam::tetrahedron<Point, PointRef>::inside(const point& p) const
{
// For robustness, assuming that the point is in the tet unless
// "definitively" shown otherwise by obtaining a positive dot
@ -429,55 +499,41 @@ bool Foam::tetrahedron<Point, PointRef>::inside(const point& pt) const
// planeBase[2] = tetBasePt = b_
// planeBase[3] = tetBasePt = b_
vector n = Zero;
// Side a
{
// 0, a
const point& basePt = b_;
const triangle<Point, PointRef> tria(b_, c_, d_);
n = Sa();
n /= (Foam::mag(n) + VSMALL);
if (((pt - basePt) & n) > SMALL)
if (((p - b_) & tria.unitNormal()) > SMALL)
{
return false;
}
}
// Side b
{
// 1, b
const point& basePt = c_;
const triangle<Point, PointRef> tria(a_, d_, c_);
n = Sb();
n /= (Foam::mag(n) + VSMALL);
if (((pt - basePt) & n) > SMALL)
if (((p - a_) & tria.unitNormal()) > SMALL)
{
return false;
}
}
// Side c
{
// 2, c
const point& basePt = b_;
const triangle<Point, PointRef> tria(a_, b_, d_);
n = Sc();
n /= (Foam::mag(n) + VSMALL);
if (((pt - basePt) & n) > SMALL)
if (((p - a_) & tria.unitNormal()) > SMALL)
{
return false;
}
}
// Side d
{
// 3, d
const point& basePt = b_;
const triangle<Point, PointRef> tria(a_, c_, b_);
n = Sd();
n /= (Foam::mag(n) + VSMALL);
if (((pt - basePt) & n) > SMALL)
if (((p - a_) & tria.unitNormal()) > SMALL)
{
return false;
}
@ -1055,6 +1111,7 @@ inline Foam::Ostream& Foam::operator<<
const tetrahedron<Point, PointRef>& t
)
{
// Format like FixedList
os << nl
<< token::BEGIN_LIST
<< t.a_ << token::SPACE

View File

@ -1,55 +1,11 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
// Compatibility include.
// triPointRef typedef included in triangle.H (NOV-2015)
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
#ifndef FoamCompat_triPointRef_H
#define FoamCompat_triPointRef_H
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Typedef
Foam::triPointRef
Description
A triangle using referred points
\*---------------------------------------------------------------------------*/
#ifndef triPointRef_H
#define triPointRef_H
#include "point.H"
#include "triangle.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
typedef triangle<point, const point&> triPointRef;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
#endif
// ************************************************************************* //

View File

@ -1,111 +1,10 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015 OpenFOAM Foundation
Copyright (C) 2017-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
// Compatibility include.
// triPoints defined in triangle.H (JUL-2022)
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
#ifndef FoamCompat_triPoints_H
#define FoamCompat_triPoints_H
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::triPoints
Description
Triangle storage. Null constructable (unfortunately triangle<point, point>
is not)
SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef triPoints_H
#define triPoints_H
#include "FixedList.H"
#include "treeBoundBox.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class triPoints Declaration
\*---------------------------------------------------------------------------*/
class triPoints
:
public FixedList<point, 3>
{
public:
// Constructors
//- Default construct
inline triPoints()
{}
//- Construct from points
inline triPoints
(
const point& a,
const point& b,
const point& c
)
{
operator[](0) = a;
operator[](1) = b;
operator[](2) = c;
}
//- Copy construct from subset of points
inline triPoints
(
const UList<point>& points,
const FixedList<label, 3>& indices
)
:
FixedList<point, 3>(points, indices)
{}
// Member Functions
//- Calculate the bounding box
inline treeBoundBox bounds() const
{
treeBoundBox bb(operator[](0));
for (label i = 1; i < size(); ++i)
{
bb.add(operator[](i));
}
return bb;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "triangle.H"
#endif

View File

@ -26,7 +26,6 @@ License
\*---------------------------------------------------------------------------*/
#include "triangle.H"
#include "triPoints.H"
#include "plane.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2018-2020 OpenCFD Ltd.
Copyright (C) 2018-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -35,18 +35,20 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef triangle_H
#define triangle_H
#ifndef Foam_triangle_H
#define Foam_triangle_H
#include "intersection.H"
#include "point.H"
#include "vector.H"
#include "tensor.H"
#include "pointHit.H"
#include "Random.H"
#include "FixedList.H"
#include "UList.H"
#include "linePointRef.H"
#include "line.H"
#include "barycentric2D.H"
#include "treeBoundBox.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -55,7 +57,6 @@ namespace Foam
// Forward Declarations
class plane;
class triPoints;
template<class Point, class PointRef> class triangle;
@ -72,6 +73,73 @@ inline Ostream& operator<<(Ostream&, const triangle<Point, PointRef>&);
typedef triangle<point, const point&> triPointRef;
/*---------------------------------------------------------------------------*\
Class triPoints Declaration
\*---------------------------------------------------------------------------*/
//- Triangle point storage. Default constructable (triangle is not)
class triPoints
:
public FixedList<point, 3>
{
public:
// Generated Methods
//- Default construct
triPoints() = default;
// Constructors
//- Construct from three points
inline triPoints(const point& p0, const point& p1, const point& p2);
//- Construct from point references
inline explicit triPoints(const triPointRef& pts);
//- Construct from three points
inline triPoints(const FixedList<point, 3>& pts);
//- Copy construct from subset of points
inline triPoints
(
const UList<point>& points,
const FixedList<label, 3>& indices
);
// Member Functions
//- The first vertex
const point& a() const { return operator[](0); }
//- The second vertex
const point& b() const { return operator[](1); }
//- The third vertex
const point& c() const { return operator[](2); }
//- The first vertex
point& a() { return operator[](0); }
//- The second vertex
point& b() { return operator[](1); }
//- The third vertex
point& c() { return operator[](2); }
//- Return as triangle reference
inline triPointRef tri() const;
//- Flip triangle orientation by swapping second and third vertices
inline void flip();
//- The bounding box for the tetrahedron
inline treeBoundBox bounds() const;
};
/*---------------------------------------------------------------------------*\
Class triangle Declaration
\*---------------------------------------------------------------------------*/
@ -90,7 +158,7 @@ public:
//- with another triangle
typedef FixedList<triPoints, 27> triIntersectionList;
//- The proximity classifications
//- Proximity classifications
enum proxType
{
NONE = 0, //!< Unknown proximity
@ -99,10 +167,10 @@ public:
};
// Public classes
// Public Classes
// Classes for use in sliceWithPlane. What to do with decomposition
// of triangle.
// Classes for use in sliceWithPlane.
// What to do with decomposition of triangle.
//- Dummy
class dummyOp
@ -169,10 +237,10 @@ public:
// Constructors
//- Construct from three points
inline triangle(const Point& a, const Point& b, const Point& c);
inline triangle(const Point& p0, const Point& p1, const Point& p2);
//- Construct from three points
inline triangle(const FixedList<Point, 3>& tri);
inline triangle(const FixedList<Point, 3>& pts);
//- Construct from three points in the list of points
// The indices could be from triFace etc.
@ -190,14 +258,14 @@ public:
// Access
//- Return first vertex
inline const Point& a() const;
//- The first vertex
const Point& a() const noexcept { return a_; }
//- Return second vertex
inline const Point& b() const;
//- The second vertex
const Point& b() const noexcept { return b_; }
//- Return third vertex
inline const Point& c() const;
//- The third vertex
const Point& c() const noexcept { return c_; }
// Properties
@ -245,7 +313,7 @@ public:
) const;
//- Return a random point on the triangle from a uniform
// distribution
//- distribution
inline Point randomPoint(Random& rndGen) const;
//- Calculate the point from the given barycentric coordinates.

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2018 OpenCFD Ltd.
Copyright (C) 2018-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -28,34 +28,70 @@ License
#include "IOstreams.H"
#include "pointHit.H"
#include "triPoints.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Point, class PointRef>
inline Foam::triangle<Point, PointRef>::triangle
inline Foam::triPoints::triPoints
(
const Point& a,
const Point& b,
const Point& c
const point& p0,
const point& p1,
const point& p2
)
{
operator[](0) = p0;
operator[](1) = p1;
operator[](2) = p2;
}
inline Foam::triPoints::triPoints(const triPointRef& pts)
{
operator[](0) = pts.a();
operator[](1) = pts.b();
operator[](2) = pts.c();
}
inline Foam::triPoints::triPoints(const FixedList<point, 3>& pts)
:
FixedList<point, 3>(pts)
{}
inline Foam::triPoints::triPoints
(
const UList<point>& points,
const FixedList<label, 3>& indices
)
:
a_(a),
b_(b),
c_(c)
FixedList<point, 3>(points, indices)
{}
template<class Point, class PointRef>
inline Foam::triangle<Point, PointRef>::triangle
(
const FixedList<Point, 3>& tri
const Point& p0,
const Point& p1,
const Point& p2
)
:
a_(tri[0]),
b_(tri[1]),
c_(tri[2])
a_(p0),
b_(p1),
c_(p2)
{}
template<class Point, class PointRef>
inline Foam::triangle<Point, PointRef>::triangle
(
const FixedList<Point, 3>& pts
)
:
a_(pts[0]),
b_(pts[1]),
c_(pts[2])
{}
@ -72,7 +108,6 @@ inline Foam::triangle<Point, PointRef>::triangle
{}
template<class Point, class PointRef>
inline Foam::triangle<Point, PointRef>::triangle(Istream& is)
{
@ -82,22 +117,26 @@ inline Foam::triangle<Point, PointRef>::triangle(Istream& is)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Point, class PointRef>
inline const Point& Foam::triangle<Point, PointRef>::a() const
inline Foam::triPointRef Foam::triPoints::tri() const
{
return a_;
return triPointRef(a(), b(), c());
}
template<class Point, class PointRef>
inline const Point& Foam::triangle<Point, PointRef>::b() const
inline void Foam::triPoints::flip()
{
return b_;
// swap pt1 <-> pt2
point t(b());
b() = c();
c() = t;
}
template<class Point, class PointRef>
inline const Point& Foam::triangle<Point, PointRef>::c() const
inline Foam::treeBoundBox Foam::triPoints::bounds() const
{
return c_;
treeBoundBox bb;
bb.add(static_cast<const FixedList<point, 3>&>(*this));
return bb;
}
@ -916,6 +955,7 @@ inline Foam::Ostream& Foam::operator<<
const triangle<Point, PointRef>& t
)
{
// Format like FixedList
os << nl
<< token::BEGIN_LIST
<< t.a_ << token::SPACE

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 OpenFOAM Foundation
Copyright (C) 2019-2020 OpenCFD Ltd.
Copyright (C) 2019-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -28,16 +28,16 @@ Class
Foam::Barycentric
Description
Templated 3D Barycentric derived from VectorSpace. Has 4 components, one of
which is redundant.
Templated 3D Barycentric derived from VectorSpace.
Has 4 components, one of which is redundant.
SourceFiles
BarycentricI.H
\*---------------------------------------------------------------------------*/
#ifndef Barycentric_H
#define Barycentric_H
#ifndef Foam_Barycentric_H
#define Foam_Barycentric_H
#include "contiguous.H"
#include "VectorSpace.H"
@ -74,7 +74,7 @@ public:
enum components { A, B, C, D };
// Generated Methods
// Generated Methods: copy construct/assignment
//- Default construct
Barycentric() = default;
@ -94,10 +94,13 @@ public:
const Cmpt& vd
);
//- Construct from three components, calculate fourth component
inline Barycentric(const Cmpt& va, const Cmpt& vb, const Cmpt& vc);
// Member Functions
// Access
// Component access
inline const Cmpt& a() const;
inline const Cmpt& b() const;
@ -108,6 +111,12 @@ public:
inline Cmpt& b();
inline Cmpt& c();
inline Cmpt& d();
// Operations
//- Scalar-product of \c this with another Barycentric.
inline Cmpt inner(const Barycentric<Cmpt>& b2) const;
};

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 OpenFOAM Foundation
Copyright (C) 2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -50,6 +51,18 @@ inline Foam::Barycentric<Cmpt>::Barycentric
}
template<class Cmpt>
inline Foam::Barycentric<Cmpt>::Barycentric
(
const Cmpt& va,
const Cmpt& vb,
const Cmpt& vc
)
:
Barycentric<Cmpt>(va, vb, vc, (pTraits<Cmpt>::one - va - vb - vc))
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Cmpt>
@ -108,6 +121,17 @@ inline Cmpt& Foam::Barycentric<Cmpt>::d()
}
// * * * * * * * * * * * * * * * Member Operations * * * * * * * * * * * * * //
template<class Cmpt>
inline Cmpt Foam::Barycentric<Cmpt>::inner(const Barycentric<Cmpt>& b2) const
{
const Barycentric<Cmpt>& b1 = *this;
return (b1.a()*b2.a() + b1.b()*b2.b() + b1.c()*b2.c() + b1.d()*b2.d());
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
@ -118,7 +142,7 @@ namespace Foam
template<class Cmpt>
inline Cmpt operator&(const Barycentric<Cmpt>& b1, const Barycentric<Cmpt>& b2)
{
return b1.a()*b2.a() + b1.b()*b2.b() + b1.c()*b2.c() + b1.d()*b2.d();
return b1.inner(b2);
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenFOAM Foundation
Copyright (C) 2019-2020 OpenCFD Ltd.
Copyright (C) 2019-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -28,18 +28,17 @@ Class
Foam::BarycentricTensor
Description
Templated 4x3 tensor derived from VectorSpace. Has 12 components. Can
represent a barycentric transformation as a matrix-barycentric inner-
product. Can alternatively represent an inverse barycentric transformation
as a vector-matrix inner-product.
Templated 4x3 tensor derived from VectorSpace. Has 12 components.
Can represent a barycentric transformation as a matrix-barycentric
inner-product.
SourceFiles
BarycentricTensorI.H
\*---------------------------------------------------------------------------*/
#ifndef BarycentricTensor_H
#define BarycentricTensor_H
#ifndef Foam_BarycentricTensor_H
#define Foam_BarycentricTensor_H
#include "Barycentric.H"
#include "Tensor.H"
@ -64,7 +63,8 @@ public:
// Typedefs
//- Equivalent type of labels used for valid component indexing
typedef Tensor<label> labelType;
//- (unused)
typedef BarycentricTensor<label> labelType;
// Member Constants
@ -77,7 +77,7 @@ public:
enum components { XA, XB, XC, XD, YA, YB, YC, YD, ZA, ZB, ZC, ZD };
// Generated Methods
// Generated Methods: copy construct/assignment
//- Default construct
BarycentricTensor() = default;
@ -97,6 +97,7 @@ public:
);
//- Construct given four vector components (columns)
// Eg, the corners of a tetrahedron
inline BarycentricTensor
(
const Vector<Cmpt>& a,
@ -108,18 +109,44 @@ public:
// Member Functions
// Component access
inline const Cmpt& xa() const;
inline const Cmpt& xb() const;
inline const Cmpt& xc() const;
inline const Cmpt& xd() const;
inline const Cmpt& ya() const;
inline const Cmpt& yb() const;
inline const Cmpt& yc() const;
inline const Cmpt& yd() const;
inline const Cmpt& za() const;
inline const Cmpt& zb() const;
inline const Cmpt& zc() const;
inline const Cmpt& zd() const;
// Row-barycentric access
inline Barycentric<Cmpt> x() const;
inline Barycentric<Cmpt> y() const;
inline Barycentric<Cmpt> z() const;
// Column-vector access
inline Vector<Cmpt> a() const;
inline Vector<Cmpt> b() const;
inline Vector<Cmpt> c() const;
inline Vector<Cmpt> d() const;
// Operations
//- Tensor/barycentric inner product
// (transforms barycentric coordinates to vector)
inline Vector<Cmpt> inner(const Barycentric<Cmpt>& bry) const;
};

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenFOAM Foundation
Copyright (C) 2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -87,6 +88,90 @@ inline Foam::BarycentricTensor<Cmpt>::BarycentricTensor
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Cmpt>
inline const Cmpt& Foam::BarycentricTensor<Cmpt>::xa() const
{
return this->v_[XA];
}
template<class Cmpt>
inline const Cmpt& Foam::BarycentricTensor<Cmpt>::xb() const
{
return this->v_[XB];
}
template<class Cmpt>
inline const Cmpt& Foam::BarycentricTensor<Cmpt>::xc() const
{
return this->v_[XC];
}
template<class Cmpt>
inline const Cmpt& Foam::BarycentricTensor<Cmpt>::xd() const
{
return this->v_[XD];
}
template<class Cmpt>
inline const Cmpt& Foam::BarycentricTensor<Cmpt>::ya() const
{
return this->v_[YA];
}
template<class Cmpt>
inline const Cmpt& Foam::BarycentricTensor<Cmpt>::yb() const
{
return this->v_[YB];
}
template<class Cmpt>
inline const Cmpt& Foam::BarycentricTensor<Cmpt>::yc() const
{
return this->v_[YC];
}
template<class Cmpt>
inline const Cmpt& Foam::BarycentricTensor<Cmpt>::yd() const
{
return this->v_[YD];
}
template<class Cmpt>
inline const Cmpt& Foam::BarycentricTensor<Cmpt>::za() const
{
return this->v_[ZA];
}
template<class Cmpt>
inline const Cmpt& Foam::BarycentricTensor<Cmpt>::zb() const
{
return this->v_[ZB];
}
template<class Cmpt>
inline const Cmpt& Foam::BarycentricTensor<Cmpt>::zc() const
{
return this->v_[ZC];
}
template<class Cmpt>
inline const Cmpt& Foam::BarycentricTensor<Cmpt>::zd() const
{
return this->v_[ZD];
}
template<class Cmpt>
inline Foam::Barycentric<Cmpt> Foam::BarycentricTensor<Cmpt>::x() const
{
@ -157,6 +242,26 @@ inline Foam::Vector<Cmpt> Foam::BarycentricTensor<Cmpt>::d() const
}
// NB: same workaround for gcc (11+) failure on (tensor dot vector)
// - not sure it will indeed be required here as well.
template<class Cmpt>
#if defined(__GNUC__) && !defined(__clang__)
__attribute__((optimize("no-tree-vectorize")))
#endif
inline Foam::Vector<Cmpt>
Foam::BarycentricTensor<Cmpt>::inner(const Barycentric<Cmpt>& bry) const
{
const BarycentricTensor<Cmpt>& t = *this;
return Vector<Cmpt>
(
(bry.a()*t.xa() + bry.b()*t.xb() + bry.c()*t.xc() + bry.d()*t.xd()),
(bry.a()*t.ya() + bry.b()*t.yb() + bry.c()*t.yc() + bry.d()*t.yd()),
(bry.a()*t.za() + bry.b()*t.zb() + bry.c()*t.zc() + bry.d()*t.zd())
);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
@ -164,17 +269,20 @@ namespace Foam
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
// Transform Barycentric coordinates to Vector
template<class Cmpt>
inline Vector<Cmpt> operator&
(
const BarycentricTensor<Cmpt>& T,
const BarycentricTensor<Cmpt>& t,
const Barycentric<Cmpt>& b
)
{
return Vector<Cmpt>(T.x() & b, T.y() & b, T.z() & b);
return t.inner(b);
}
// Transform Vector to Barycentric coordinates.
// Caution: the tensor must be inverse one (see particle.C)
template<class Cmpt>
inline Barycentric<Cmpt> operator&
(

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenFOAM Foundation
Copyright (C) 2019-2020 OpenCFD Ltd.
Copyright (C) 2019-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -36,8 +36,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef Barycentric2D_H
#define Barycentric2D_H
#ifndef Foam_Barycentric2D_H
#define Foam_Barycentric2D_H
#include "contiguous.H"
#include "VectorSpace.H"
@ -86,33 +86,31 @@ public:
inline Barycentric2D(const Foam::zero);
//- Construct from components
inline Barycentric2D
(
const Cmpt& va,
const Cmpt& vb,
const Cmpt& vc
);
inline Barycentric2D(const Cmpt& va, const Cmpt& vb, const Cmpt& vc);
//- Construct from two components, calculating third component
inline Barycentric2D(const Cmpt& va, const Cmpt& vb);
// Member Functions
// Access
// Component access
inline const Cmpt& a() const;
inline const Cmpt& b() const;
inline const Cmpt& c() const;
// Edit
inline Cmpt& a();
inline Cmpt& b();
inline Cmpt& c();
// Tests
// Operations, Tests
//- True if any coordinates are negative
//- Scalar-product of \c this with another Barycentric2D.
inline Cmpt inner(const Barycentric2D<Cmpt>& b2) const;
//- True if any coordinate is negative
inline bool outside() const;
};

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -49,6 +49,17 @@ inline Foam::Barycentric2D<Cmpt>::Barycentric2D
}
template<class Cmpt>
inline Foam::Barycentric2D<Cmpt>::Barycentric2D
(
const Cmpt& va,
const Cmpt& vb
)
:
Barycentric2D<Cmpt>(va, vb, (pTraits<Cmpt>::one - va - vb))
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Cmpt>
@ -93,6 +104,20 @@ inline Cmpt& Foam::Barycentric2D<Cmpt>::c()
}
// * * * * * * * * * * * * * * * Member Operations * * * * * * * * * * * * * //
template<class Cmpt>
inline Cmpt Foam::Barycentric2D<Cmpt>::inner
(
const Barycentric2D<Cmpt>& b2
) const
{
const Barycentric2D<Cmpt>& b1 = *this;
return (b1.a()*b2.a() + b1.b()*b2.b() + b1.c()*b2.c());
}
template<class Cmpt>
inline bool Foam::Barycentric2D<Cmpt>::outside() const
{
@ -114,7 +139,7 @@ inline Cmpt operator&
const Barycentric2D<Cmpt>& b2
)
{
return b1.a()*b2.a() + b1.b()*b2.b() + b1.c()*b2.c();
return b1.inner(b2);
}

View File

@ -1069,7 +1069,7 @@ template<class Cmpt>
// Workaround for gcc (11+) that fails to handle tensor dot vector
__attribute__((optimize("no-tree-vectorize")))
#endif
inline typename innerProduct<Tensor<Cmpt>, Vector<Cmpt>>::type
inline Vector<Cmpt>
operator&(const Tensor<Cmpt>& t, const Vector<Cmpt>& v)
{
return Vector<Cmpt>
@ -1083,7 +1083,7 @@ operator&(const Tensor<Cmpt>& t, const Vector<Cmpt>& v)
//- Inner-product of a Vector and a Tensor
template<class Cmpt>
inline typename innerProduct<Vector<Cmpt>, Tensor<Cmpt>>::type
inline Vector<Cmpt>
operator&(const Vector<Cmpt>& v, const Tensor<Cmpt>& t)
{
return Vector<Cmpt>

View File

@ -30,7 +30,7 @@ Class
Description
Templated 3D Vector derived from VectorSpace adding construction from
3 components, element access using x(), y() and z() member functions and
the inner-product (dot-product) and cross product operators.
the inner-product (dot-product) and cross-product operators.
A centre() member function which returns the Vector for which it is called
is defined so that point which is a typedef to Vector\<scalar\> behaves as
@ -130,6 +130,15 @@ public:
//- Access to the vector z component
inline Cmpt& z();
// Vector Operations
//- Return \c this (for point which is a typedef to Vector\<scalar\>)
inline const Vector<Cmpt>& centre
(
const Foam::UList<Vector<Cmpt>>& /* (unused) */
) const noexcept;
//- Inplace normalise the vector by its magnitude
// For small magnitudes (less than ROOTVSMALL) set to zero.
// Will not be particularly useful for a vector of labels
@ -139,12 +148,11 @@ public:
//- unit vector.
inline Vector<Cmpt>& removeCollinear(const Vector<Cmpt>& unitVec);
//- Scalar-product of \c this with another Vector.
inline Cmpt inner(const Vector<Cmpt>& v2) const;
//- Return *this (used for point which is a typedef to Vector<scalar>.
inline const Vector<Cmpt>& centre
(
const Foam::UList<Vector<Cmpt>>& /* (unused) */
) const;
//- Cross-product of \c this with another Vector.
inline Vector<Cmpt> cross(const Vector<Cmpt>& v2) const;
};

View File

@ -113,7 +113,7 @@ template<class Cmpt>
inline const Foam::Vector<Cmpt>& Foam::Vector<Cmpt>::centre
(
const Foam::UList<Vector<Cmpt>>&
) const
) const noexcept
{
return *this;
}
@ -146,6 +146,32 @@ Foam::Vector<Cmpt>::removeCollinear(const Vector<Cmpt>& unitVec)
}
// * * * * * * * * * * * * * * * Member Operations * * * * * * * * * * * * * //
template<class Cmpt>
inline Cmpt Foam::Vector<Cmpt>::inner(const Vector<Cmpt>& v2) const
{
const Vector<Cmpt>& v1 = *this;
return (v1.x()*v2.x() + v1.y()*v2.y() + v1.z()*v2.z());
}
template<class Cmpt>
inline Foam::Vector<Cmpt>
Foam::Vector<Cmpt>::cross(const Vector<Cmpt>& v2) const
{
const Vector<Cmpt>& v1 = *this;
return Vector<Cmpt>
(
(v1.y()*v2.z() - v1.z()*v2.y()),
(v1.z()*v2.x() - v1.x()*v2.z()),
(v1.x()*v2.y() - v1.y()*v2.x())
);
}
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
namespace Foam
@ -153,8 +179,9 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Dummy innerProduct for scalar to allow the construction of vtables for
// virtual member functions involving the inner-products of fields
//- Dummy innerProduct for scalar
// Allows the construction of vtables for virtual member functions
// involving the inner-products of fields
// for which a "NotImplemented" specialization for scalar is provided.
template<class Cmpt>
class innerProduct<Vector<Cmpt>, scalar>
@ -166,22 +193,16 @@ public:
template<class Cmpt>
inline typename innerProduct<Vector<Cmpt>, Vector<Cmpt>>::type
operator&(const Vector<Cmpt>& v1, const Vector<Cmpt>& v2)
inline Cmpt operator&(const Vector<Cmpt>& v1, const Vector<Cmpt>& v2)
{
return Cmpt(v1.x()*v2.x() + v1.y()*v2.y() + v1.z()*v2.z());
return v1.inner(v2);
}
template<class Cmpt>
inline Vector<Cmpt> operator^(const Vector<Cmpt>& v1, const Vector<Cmpt>& v2)
{
return Vector<Cmpt>
(
(v1.y()*v2.z() - v1.z()*v2.y()),
(v1.z()*v2.x() - v1.x()*v2.z()),
(v1.x()*v2.y() - v1.y()*v2.x())
);
return v1.cross(v2);
}

View File

@ -125,8 +125,7 @@ namespace Foam
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
template<class Cmpt>
inline typename innerProduct<Vector2D<Cmpt>, Vector2D<Cmpt>>::type
operator&(const Vector2D<Cmpt>& v1, const Vector2D<Cmpt>& v2)
inline Cmpt operator&(const Vector2D<Cmpt>& v1, const Vector2D<Cmpt>& v2)
{
return Cmpt(v1.x()*v2.x() + v1.y()*v2.y());
}

View File

@ -39,8 +39,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef VectorSpace_H
#define VectorSpace_H
#ifndef Foam_VectorSpace_H
#define Foam_VectorSpace_H
#include "direction.H"
#include "scalar.H"

View File

@ -28,8 +28,8 @@ License
#include "polyMeshGeometry.H"
#include "polyMeshTetDecomposition.H"
#include "pyramidPointFaceRef.H"
#include "tetPointRef.H"
#include "pyramid.H"
#include "tetrahedron.H"
#include "syncTools.H"
#include "unitConversion.H"
#include "primitiveMeshTools.H"

View File

@ -34,7 +34,7 @@ License
#include "OFstream.H"
#include "edgeHashes.H"
#include "syncTools.H"
#include "triPointRef.H"
#include "triangle.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

View File

@ -33,7 +33,7 @@ License
#include "enrichedPatch.H"
#include "DynamicList.H"
#include "pointHit.H"
#include "triPointRef.H"
#include "triangle.H"
#include "plane.H"
#include "polyTopoChanger.H"
#include "polyAddPoint.H"

View File

@ -35,14 +35,14 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef OBJstream_H
#define OBJstream_H
#ifndef Foam_OBJstream_H
#define Foam_OBJstream_H
#include "OFstream.H"
#include "point.H"
#include "edge.H"
#include "face.H"
#include "triPointRef.H"
#include "triangle.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2017 OpenCFD Ltd.
Copyright (C) 2016-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -35,9 +35,10 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef STLtriangle_H
#define STLtriangle_H
#ifndef Foam_STLtriangle_H
#define Foam_STLtriangle_H
#include <cstdint>
#include "STLpoint.H"
#include "Istream.H"
#include "Ostream.H"
@ -60,7 +61,7 @@ class STLtriangle
// Typedefs
//- Attribute is 16-bit
typedef unsigned short STLattrib;
typedef uint16_t STLattrib;
// Private data
// NB: The order of the members (1 normal, 3 points, 1 attribute) is
@ -78,8 +79,8 @@ public:
// Constructors
//- Construct null
inline STLtriangle();
//- Default construct
STLtriangle() = default;
//- Construct from components
inline STLtriangle
@ -88,7 +89,7 @@ public:
const STLpoint& a,
const STLpoint& b,
const STLpoint& c,
unsigned short attrib
uint16_t attrib
);
//- Construct from istream (read binary)
@ -99,11 +100,11 @@ public:
// Access
inline const STLpoint& normal() const;
inline const STLpoint& a() const;
inline const STLpoint& b() const;
inline const STLpoint& c() const;
inline unsigned short attrib() const;
const STLpoint& normal() const noexcept { return normal_; }
const STLpoint& a() const noexcept { return a_; }
const STLpoint& b() const noexcept { return b_; }
const STLpoint& c() const noexcept { return c_; }
uint16_t attrib() const noexcept { return attrib_; }
// Read

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2016 OpenCFD Ltd.
Copyright (C) 2016-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -26,21 +26,17 @@ License
\*---------------------------------------------------------------------------*/
#include "triPointRef.H"
#include "triangle.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
inline Foam::STLtriangle::STLtriangle()
{}
inline Foam::STLtriangle::STLtriangle
(
const STLpoint& normal,
const STLpoint& a,
const STLpoint& b,
const STLpoint& c,
unsigned short attrib
uint16_t attrib
)
:
normal_(normal),
@ -59,36 +55,6 @@ inline Foam::STLtriangle::STLtriangle(std::istream& is)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline const Foam::STLpoint& Foam::STLtriangle::normal() const
{
return normal_;
}
inline const Foam::STLpoint& Foam::STLtriangle::a() const
{
return a_;
}
inline const Foam::STLpoint& Foam::STLtriangle::b() const
{
return b_;
}
inline const Foam::STLpoint& Foam::STLtriangle::c() const
{
return c_;
}
inline unsigned short Foam::STLtriangle::attrib() const
{
return attrib_;
}
inline void Foam::STLtriangle::read(std::istream& is)
{
is.read(reinterpret_cast<char*>(&normal_), 4*sizeof(STLpoint));

View File

@ -32,7 +32,7 @@ License
#include "stringIOList.H"
#include "cellModel.H"
#include "vectorIOField.H"
#include "triPointRef.H"
#include "triangle.H"
#include "stringOps.H"
/* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */

View File

@ -37,7 +37,7 @@ License
#include "processorFaPatchFields.H"
#include "emptyFaPatchFields.H"
#include "wedgeFaPatch.H"
#include "triPointRef.H"
#include "triangle.H"
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //

View File

@ -27,7 +27,6 @@ License
#include "FreeStream.H"
#include "constants.H"
#include "triPointRef.H"
#include "tetIndices.H"
using namespace Foam::constant::mathematical;

View File

@ -32,8 +32,8 @@ Description
\*---------------------------------------------------------------------------*/
#ifndef particle_H
#define particle_H
#ifndef Foam_particle_H
#define Foam_particle_H
#include "vector.H"
#include "barycentric.H"
@ -43,7 +43,6 @@ Description
#include "pointField.H"
#include "faceList.H"
#include "OFstream.H"
#include "tetPointRef.H"
#include "FixedList.H"
#include "polyMeshTetDecomposition.H"
#include "particleMacros.H"

View File

@ -29,7 +29,7 @@ License
#include "polyMesh.H"
#include "SubField.H"
#include "Random.H"
#include "triPointRef.H"
#include "triangle.H"
#include "volFields.H"
#include "polyMeshTetDecomposition.H"

View File

@ -41,7 +41,7 @@ License
#include "indexedOctree.H"
#include "snapParameters.H"
#include "PatchTools.H"
#include "pyramidPointFaceRef.H"
#include "pyramid.H"
#include "localPointRegion.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

View File

@ -31,7 +31,7 @@ License
#include "mapDistribute.H"
#include "flipOp.H"
#include "profiling.H"
#include "triPointRef.H"
#include "triangle.H"
#include "OFstream.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

View File

@ -44,7 +44,7 @@ SourceFiles
#include "FixedList.H"
#include "plane.H"
#include "face.H"
#include "triPoints.H"
#include "triangle.H"
#include "Enum.H"
#include "searchableSurface.H"

View File

@ -35,11 +35,11 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef treeDataEdge_H
#define treeDataEdge_H
#ifndef Foam_treeDataEdge_H
#define Foam_treeDataEdge_H
#include "treeBoundBoxList.H"
#include "linePointRef.H"
#include "line.H"
#include "volumeType.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -47,7 +47,7 @@ SourceFiles
namespace Foam
{
// Forward declaration of classes
// Forward Declarations
template<class Type> class indexedOctree;
/*---------------------------------------------------------------------------*\

View File

@ -40,12 +40,12 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef treeDataPoint_H
#define treeDataPoint_H
#ifndef Foam_treeDataPoint_H
#define Foam_treeDataPoint_H
#include "pointField.H"
#include "treeBoundBox.H"
#include "linePointRef.H"
#include "line.H"
#include "volumeType.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -53,7 +53,7 @@ SourceFiles
namespace Foam
{
// Forward declarations
// Forward Declarations
template<class Type> class indexedOctree;
/*---------------------------------------------------------------------------*\

View File

@ -42,7 +42,7 @@ License
#include "Time.H"
#include "mapDistribute.H"
#include "SubField.H"
#include "triPointRef.H"
#include "triangle.H"
#include "syncTools.H"
#include "treeDataCell.H"
#include "DynamicField.H"

View File

@ -27,9 +27,9 @@ License
\*---------------------------------------------------------------------------*/
#include "primitiveMeshGeometry.H"
#include "pyramidPointFaceRef.H"
#include "pyramid.H"
#include "unitConversion.H"
#include "triPointRef.H"
#include "triangle.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -41,15 +41,15 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef searchableSurface_H
#define searchableSurface_H
#ifndef Foam_searchableSurface_H
#define Foam_searchableSurface_H
#include "pointField.H"
#include "boundBox.H"
#include "typeInfo.H"
#include "runTimeSelectionTables.H"
#include "pointIndexHit.H"
#include "linePointRef.H"
#include "line.H"
#include "objectRegistry.H"
#include "volumeType.H"
@ -58,7 +58,7 @@ SourceFiles
namespace Foam
{
// Forward declarations
// Forward Declarations
class objectRegistry;
class mapDistribute;
class treeBoundBox;

View File

@ -28,7 +28,6 @@ License
#include "tetOverlapVolume.H"
#include "tetrahedron.H"
#include "tetPoints.H"
#include "polyMesh.H"
#include "OFstream.H"
#include "treeBoundBox.H"
@ -43,12 +42,6 @@ namespace Foam
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::tetOverlapVolume::tetOverlapVolume()
{}
// * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * * //
Foam::treeBoundBox Foam::tetOverlapVolume::pyrBb

View File

@ -35,8 +35,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef tetOverlapVolume_H
#define tetOverlapVolume_H
#ifndef Foam_tetOverlapVolume_H
#define Foam_tetOverlapVolume_H
#include "FixedList.H"
#include "labelList.H"
@ -47,6 +47,7 @@ SourceFiles
namespace Foam
{
// Forward Declarations
class primitiveMesh;
class polyMesh;
@ -56,7 +57,7 @@ class polyMesh;
class tetOverlapVolume
{
// Private classes
// Private Classes
//- tetPoints handling : sum resulting volumes
class sumMomentOp
@ -184,14 +185,14 @@ public:
// Constructors
//- Null constructor
tetOverlapVolume();
//- Default construct
tetOverlapVolume() = default;
// Public members
//- Return a list of cells in meshA which overlaps with cellBI in
// meshB
//- meshB
labelList overlappingCells
(
const polyMesh& meshA,

View File

@ -32,7 +32,6 @@ License
#include "treeDataEdge.H"
#include "treeDataPoint.H"
#include "meshTools.H"
#include "linePointRef.H"
#include "Fstream.H"
#include "unitConversion.H"
#include "edgeHashes.H"

View File

@ -49,7 +49,7 @@ SourceFiles
#define surfaceLocation_H
#include "pointIndexHit.H"
#include "triPointRef.H"
#include "triangle.H"
#include "InfoProxy.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -61,7 +61,7 @@ SourceFiles
#include "FixedList.H"
#include "Pair.H"
#include "vector2D.H"
#include "triPointRef.H"
#include "triangle.H"
#include "surfaceLocation.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -69,7 +69,7 @@ SourceFiles
namespace Foam
{
// Forward declaration of classes
// Forward Declarations
class boundBox;
class edge;
class labelledTri;

View File

@ -27,11 +27,11 @@ License
\*---------------------------------------------------------------------------*/
#include "triangleFuncs.H"
#include "triangle.H"
#include "pointField.H"
#include "treeBoundBox.H"
#include "SortableList.H"
#include "boolList.H"
#include "triPointRef.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //

View File

@ -35,8 +35,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef triangleFuncs_H
#define triangleFuncs_H
#ifndef Foam_triangleFuncs_H
#define Foam_triangleFuncs_H
#include "pointField.H"

View File

@ -36,7 +36,7 @@ License
#include "triSurface.H"
#include "triSurfaceTools.H"
#include "Time.H"
#include "triPoints.H"
#include "triangle.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -32,7 +32,7 @@ License
#include "volFields.H"
#include "triSurfaceTools.H"
#include "triSurface.H"
#include "triPoints.H"
#include "triangle.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -31,7 +31,6 @@ License
#include "volFields.H"
#include "edgeHashes.H"
#include "tetCell.H"
#include "tetPointRef.H"
#include "DynamicField.H"
#include "syncTools.H"
#include "indirectPrimitivePatch.H"

View File

@ -27,7 +27,7 @@ License
\*---------------------------------------------------------------------------*/
#include "STLsurfaceFormat.H"
#include "triPointRef.H"
#include "triangle.H"
#include "ListOps.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //