mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: simplify tetrahedron and triangle handling
- combine header definitions, more pass-through methods - face/triFace: support += operator (vertex offset)
This commit is contained in:
3
applications/test/barycentric/Make/files
Normal file
3
applications/test/barycentric/Make/files
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
Test-barycentric.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_USER_APPBIN)/Test-barycentric
|
||||||
2
applications/test/barycentric/Make/options
Normal file
2
applications/test/barycentric/Make/options
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
/* EXE_INC = */
|
||||||
|
/* EXE_LIBS = */
|
||||||
93
applications/test/barycentric/Test-barycentric.C
Normal file
93
applications/test/barycentric/Test-barycentric.C
Normal 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -38,7 +38,7 @@ Description
|
|||||||
#include "polyMesh.H"
|
#include "polyMesh.H"
|
||||||
#include "ListOps.H"
|
#include "ListOps.H"
|
||||||
#include "face.H"
|
#include "face.H"
|
||||||
#include "tetPointRef.H"
|
#include "tetrahedron.H"
|
||||||
#include "triFaceList.H"
|
#include "triFaceList.H"
|
||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
#include "meshTools.H"
|
#include "meshTools.H"
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2012-2017 OpenFOAM Foundation
|
Copyright (C) 2012-2017 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -31,7 +32,7 @@ Description
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "tetPointRef.H"
|
#include "tetrahedron.H"
|
||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
#include "meshTools.H"
|
#include "meshTools.H"
|
||||||
#include "cut.H"
|
#include "cut.H"
|
||||||
@ -44,12 +45,12 @@ void writeOBJ
|
|||||||
(
|
(
|
||||||
Ostream& os,
|
Ostream& os,
|
||||||
label& vertI,
|
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
|
os << "l " << vertI+1 << ' ' << vertI+2 << nl
|
||||||
<< "l " << vertI+1 << ' ' << vertI+3 << 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[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
// Tets to test
|
// Tets to test
|
||||||
FixedList<point, 4> tetA
|
tetPoints tetA
|
||||||
({
|
(
|
||||||
point(0, 0, 0),
|
point(0, 0, 0),
|
||||||
point(1, 0, 0),
|
point(1, 0, 0),
|
||||||
point(1, 1, 0),
|
point(1, 1, 0),
|
||||||
point(1, 1, 1)
|
point(1, 1, 1)
|
||||||
});
|
);
|
||||||
FixedList<point, 4> tetB
|
tetPoints tetB
|
||||||
({
|
(
|
||||||
point(0.1, 0.1, 0.1),
|
point(0.1, 0.1, 0.1),
|
||||||
point(1.1, 0.1, 0.1),
|
point(1.1, 0.1, 0.1),
|
||||||
point(1.1, 1.1, 0.1),
|
point(1.1, 1.1, 0.1),
|
||||||
point(1.1, 1.1, 1.1)
|
point(1.1, 1.1, 1.1)
|
||||||
});
|
);
|
||||||
|
|
||||||
|
|
||||||
// Do intersection
|
// Do intersection
|
||||||
typedef DynamicList<FixedList<point, 4>> tetList;
|
typedef DynamicList<tetPoints> tetList;
|
||||||
tetList tetsIn1, tetsIn2, tetsOut;
|
tetList tetsIn1, tetsIn2, tetsOut;
|
||||||
cut::appendOp<tetList> tetOpIn1(tetsIn1);
|
cut::appendOp<tetList> tetOpIn1(tetsIn1);
|
||||||
cut::appendOp<tetList> tetOpIn2(tetsIn2);
|
cut::appendOp<tetList> tetOpIn2(tetsIn2);
|
||||||
@ -155,25 +150,25 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
|
|
||||||
// Check the volumes
|
// Check the volumes
|
||||||
Info<< "Vol A: " << makeTetPointRef(tetA).mag() << endl;
|
Info<< "Vol A: " << tetA.tet().mag() << endl;
|
||||||
|
|
||||||
scalar volIn = 0;
|
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;
|
Info<< "Vol A inside B: " << volIn << endl;
|
||||||
|
|
||||||
scalar volOut = 0;
|
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<< "Vol A outside B: " << volOut << endl;
|
||||||
|
|
||||||
Info<< "Sum inside and outside: " << volIn + 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
|
FatalErrorInFunction
|
||||||
<< "Tet volumes do not sum up to input tet."
|
<< "Tet volumes do not sum up to input tet."
|
||||||
|
|||||||
@ -31,7 +31,7 @@ License
|
|||||||
#include "pointIOField.H"
|
#include "pointIOField.H"
|
||||||
#include "scalarIOField.H"
|
#include "scalarIOField.H"
|
||||||
#include "triadIOField.H"
|
#include "triadIOField.H"
|
||||||
#include "tetPointRef.H"
|
#include "tetrahedron.H"
|
||||||
#include "plane.H"
|
#include "plane.H"
|
||||||
#include "transform.H"
|
#include "transform.H"
|
||||||
#include "meshTools.H"
|
#include "meshTools.H"
|
||||||
|
|||||||
@ -27,7 +27,6 @@ License
|
|||||||
|
|
||||||
#include "fileControl.H"
|
#include "fileControl.H"
|
||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
#include "tetPointRef.H"
|
|
||||||
#include "scalarList.H"
|
#include "scalarList.H"
|
||||||
#include "vectorTools.H"
|
#include "vectorTools.H"
|
||||||
#include "pointIOField.H"
|
#include "pointIOField.H"
|
||||||
@ -50,9 +49,6 @@ addToRunTimeSelectionTable
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::fileControl::fileControl
|
Foam::fileControl::fileControl
|
||||||
|
|||||||
@ -31,7 +31,6 @@ License
|
|||||||
#include "cellSizeFunction.H"
|
#include "cellSizeFunction.H"
|
||||||
#include "triSurfaceMesh.H"
|
#include "triSurfaceMesh.H"
|
||||||
#include "searchableBox.H"
|
#include "searchableBox.H"
|
||||||
#include "tetPointRef.H"
|
|
||||||
#include "vectorTools.H"
|
#include "vectorTools.H"
|
||||||
#include "quaternion.H"
|
#include "quaternion.H"
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,7 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "plane.H"
|
#include "plane.H"
|
||||||
#include "tetPointRef.H"
|
#include "tetrahedron.H"
|
||||||
#include "pointConversion.H"
|
#include "pointConversion.H"
|
||||||
#include "CGALTriangulation3DKernel.H"
|
#include "CGALTriangulation3DKernel.H"
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
#include "polyMeshTools.H"
|
#include "polyMeshTools.H"
|
||||||
#include "zeroGradientFvPatchFields.H"
|
#include "zeroGradientFvPatchFields.H"
|
||||||
#include "syncTools.H"
|
#include "syncTools.H"
|
||||||
#include "tetPointRef.H"
|
#include "tetrahedron.H"
|
||||||
#include "regionSplit.H"
|
#include "regionSplit.H"
|
||||||
#include "wallDist.H"
|
#include "wallDist.H"
|
||||||
#include "cellAspectRatio.H"
|
#include "cellAspectRatio.H"
|
||||||
|
|||||||
@ -27,7 +27,7 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "dynamicIndexedOctree.H"
|
#include "dynamicIndexedOctree.H"
|
||||||
#include "linePointRef.H"
|
#include "line.H"
|
||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
#include "ListOps.H"
|
#include "ListOps.H"
|
||||||
|
|
||||||
|
|||||||
@ -35,8 +35,8 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef dynamicIndexedOctree_H
|
#ifndef Foam_dynamicIndexedOctree_H
|
||||||
#define dynamicIndexedOctree_H
|
#define Foam_dynamicIndexedOctree_H
|
||||||
|
|
||||||
#include "treeBoundBox.H"
|
#include "treeBoundBox.H"
|
||||||
#include "pointIndexHit.H"
|
#include "pointIndexHit.H"
|
||||||
@ -54,7 +54,7 @@ namespace Foam
|
|||||||
|
|
||||||
typedef DynamicList<autoPtr<DynamicList<label>>> contentListList;
|
typedef DynamicList<autoPtr<DynamicList<label>>> contentListList;
|
||||||
|
|
||||||
// Forward declaration of classes
|
// Forward Declarations
|
||||||
template<class Type> class dynamicIndexedOctree;
|
template<class Type> class dynamicIndexedOctree;
|
||||||
|
|
||||||
template<class Type> Ostream& operator<<
|
template<class Type> Ostream& operator<<
|
||||||
|
|||||||
@ -39,12 +39,12 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef dynamicTreeDataPoint_H
|
#ifndef Foam_dynamicTreeDataPoint_H
|
||||||
#define dynamicTreeDataPoint_H
|
#define Foam_dynamicTreeDataPoint_H
|
||||||
|
|
||||||
#include "pointField.H"
|
#include "pointField.H"
|
||||||
#include "treeBoundBox.H"
|
#include "treeBoundBox.H"
|
||||||
#include "linePointRef.H"
|
#include "line.H"
|
||||||
#include "volumeType.H"
|
#include "volumeType.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -52,7 +52,7 @@ SourceFiles
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Forward declaration of classes
|
// Forward Declarations
|
||||||
template<class Type> class dynamicIndexedOctree;
|
template<class Type> class dynamicIndexedOctree;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
|
|||||||
@ -27,7 +27,7 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "indexedOctree.H"
|
#include "indexedOctree.H"
|
||||||
#include "linePointRef.H"
|
#include "line.H"
|
||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
#include "ListOps.H"
|
#include "ListOps.H"
|
||||||
#include "memInfo.H"
|
#include "memInfo.H"
|
||||||
|
|||||||
@ -34,8 +34,8 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef indexedOctree_H
|
#ifndef Foam_indexedOctree_H
|
||||||
#define indexedOctree_H
|
#define Foam_indexedOctree_H
|
||||||
|
|
||||||
#include "treeBoundBox.H"
|
#include "treeBoundBox.H"
|
||||||
#include "pointIndexHit.H"
|
#include "pointIndexHit.H"
|
||||||
@ -51,7 +51,7 @@ SourceFiles
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Forward declaration of classes
|
// Forward Declarations
|
||||||
template<class Type> class indexedOctree;
|
template<class Type> class indexedOctree;
|
||||||
template<class Type> Ostream& operator<<(Ostream&, const indexedOctree<Type>&);
|
template<class Type> Ostream& operator<<(Ostream&, const indexedOctree<Type>&);
|
||||||
class Istream;
|
class Istream;
|
||||||
|
|||||||
@ -27,7 +27,7 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "cell.H"
|
#include "cell.H"
|
||||||
#include "pyramidPointFaceRef.H"
|
#include "pyramid.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,7 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "cellModel.H"
|
#include "cellModel.H"
|
||||||
#include "pyramidPointFaceRef.H"
|
#include "pyramid.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|||||||
@ -45,11 +45,11 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef edge_H
|
#ifndef Foam_edge_H
|
||||||
#define edge_H
|
#define Foam_edge_H
|
||||||
|
|
||||||
#include "labelPair.H"
|
#include "labelPair.H"
|
||||||
#include "linePointRef.H"
|
#include "line.H"
|
||||||
#include "pointField.H"
|
#include "pointField.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -28,7 +28,7 @@ License
|
|||||||
|
|
||||||
#include "face.H"
|
#include "face.H"
|
||||||
#include "triFace.H"
|
#include "triFace.H"
|
||||||
#include "triPointRef.H"
|
#include "triangle.H"
|
||||||
#include "mathematicalConstants.H"
|
#include "mathematicalConstants.H"
|
||||||
#include "Circulator.H"
|
#include "Circulator.H"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|||||||
@ -43,8 +43,8 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef face_H
|
#ifndef Foam_face_H
|
||||||
#define face_H
|
#define Foam_face_H
|
||||||
|
|
||||||
#include "pointField.H"
|
#include "pointField.H"
|
||||||
#include "labelList.H"
|
#include "labelList.H"
|
||||||
@ -435,6 +435,12 @@ public:
|
|||||||
static bool sameVertices(const face& a, const face& b);
|
static bool sameVertices(const face& a, const face& b);
|
||||||
|
|
||||||
|
|
||||||
|
// Member Operators
|
||||||
|
|
||||||
|
//- Increment (offset) vertices by given amount
|
||||||
|
inline void operator+=(const label vertexOffset);
|
||||||
|
|
||||||
|
|
||||||
// Hashing
|
// Hashing
|
||||||
|
|
||||||
//- The symmetric hash value for face.
|
//- The symmetric hash value for face.
|
||||||
@ -494,19 +500,11 @@ template<> struct Hash<face> : face::hasher {};
|
|||||||
template<>
|
template<>
|
||||||
struct offsetOp<face>
|
struct offsetOp<face>
|
||||||
{
|
{
|
||||||
inline face operator()
|
face operator()(const face& x, const label offset) const
|
||||||
(
|
|
||||||
const face& x,
|
|
||||||
const label offset
|
|
||||||
) const
|
|
||||||
{
|
{
|
||||||
face result(x.size());
|
face f(x);
|
||||||
|
f += offset;
|
||||||
forAll(x, i)
|
return f;
|
||||||
{
|
|
||||||
result[i] = x[i] + offset;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011 OpenFOAM Foundation
|
Copyright (C) 2011 OpenFOAM Foundation
|
||||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
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 * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline bool Foam::operator==(const face& a, const face& b)
|
inline bool Foam::operator==(const face& a, const face& b)
|
||||||
|
|||||||
@ -27,7 +27,7 @@ License
|
|||||||
|
|
||||||
#include "face.H"
|
#include "face.H"
|
||||||
#include "pointHit.H"
|
#include "pointHit.H"
|
||||||
#include "triPointRef.H"
|
#include "triangle.H"
|
||||||
#include "line.H"
|
#include "line.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -30,13 +30,10 @@ Description
|
|||||||
Class containing opposite face for a prismatic cell with addressing
|
Class containing opposite face for a prismatic cell with addressing
|
||||||
and a possibility of failure.
|
and a possibility of failure.
|
||||||
|
|
||||||
SourceFiles
|
|
||||||
oppositeFace.C
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef oppositeFace_H
|
#ifndef Foam_oppositeFace_H
|
||||||
#define oppositeFace_H
|
#define Foam_oppositeFace_H
|
||||||
|
|
||||||
#include "face.H"
|
#include "face.H"
|
||||||
|
|
||||||
@ -53,7 +50,7 @@ class oppositeFace
|
|||||||
:
|
:
|
||||||
public face
|
public face
|
||||||
{
|
{
|
||||||
// Private data
|
// Private Data
|
||||||
|
|
||||||
//- Master face index
|
//- Master face index
|
||||||
const label masterIndex_;
|
const label masterIndex_;
|
||||||
@ -84,19 +81,19 @@ public:
|
|||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Master face index
|
//- Master face index
|
||||||
inline label masterIndex() const
|
label masterIndex() const noexcept
|
||||||
{
|
{
|
||||||
return masterIndex_;
|
return masterIndex_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Slave face index
|
//- Opposite face index
|
||||||
inline label oppositeIndex() const
|
label oppositeIndex() const noexcept
|
||||||
{
|
{
|
||||||
return oppositeIndex_;
|
return oppositeIndex_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Does the opposite face exist?
|
//- Does the opposite face exist?
|
||||||
inline bool found() const
|
bool found() const noexcept
|
||||||
{
|
{
|
||||||
return oppositeIndex_ >= 0;
|
return oppositeIndex_ >= 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,8 +35,8 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef labelledTri_H
|
#ifndef Foam_labelledTri_H
|
||||||
#define labelledTri_H
|
#define Foam_labelledTri_H
|
||||||
|
|
||||||
#include "triFace.H"
|
#include "triFace.H"
|
||||||
#include "ListListOps.H"
|
#include "ListListOps.H"
|
||||||
@ -91,9 +91,9 @@ public:
|
|||||||
//- and optional region index (0 if unspecified)
|
//- and optional region index (0 if unspecified)
|
||||||
inline labelledTri
|
inline labelledTri
|
||||||
(
|
(
|
||||||
const label a,
|
const label p0,
|
||||||
const label b,
|
const label p1,
|
||||||
const label c,
|
const label p2,
|
||||||
const label region = 0
|
const label region = 0
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -179,13 +179,9 @@ struct offsetOp<labelledTri>
|
|||||||
{
|
{
|
||||||
labelledTri operator()(const labelledTri& x, const label offset) const
|
labelledTri operator()(const labelledTri& x, const label offset) const
|
||||||
{
|
{
|
||||||
labelledTri result(x);
|
labelledTri f(x);
|
||||||
|
f += offset;
|
||||||
forAll(x, xi)
|
return f;
|
||||||
{
|
|
||||||
result[xi] = x[xi] + offset;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -77,13 +77,13 @@ inline Foam::labelledTri::labelledTri
|
|||||||
|
|
||||||
inline Foam::labelledTri::labelledTri
|
inline Foam::labelledTri::labelledTri
|
||||||
(
|
(
|
||||||
const label a,
|
const label p0,
|
||||||
const label b,
|
const label p1,
|
||||||
const label c,
|
const label p2,
|
||||||
const label region
|
const label region
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
triFace(a, b, c),
|
triFace(p0, p1, p2),
|
||||||
index_(region)
|
index_(region)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|||||||
@ -40,15 +40,15 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef tetCell_H
|
#ifndef Foam_tetCell_H
|
||||||
#define tetCell_H
|
#define Foam_tetCell_H
|
||||||
|
|
||||||
#include "FixedList.H"
|
#include "FixedList.H"
|
||||||
#include "triFace.H"
|
#include "triFace.H"
|
||||||
#include "faceList.H"
|
#include "faceList.H"
|
||||||
#include "edgeList.H"
|
#include "edgeList.H"
|
||||||
#include "pointField.H"
|
#include "pointField.H"
|
||||||
#include "tetPointRef.H"
|
#include "tetrahedron.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -85,10 +85,10 @@ public:
|
|||||||
//- Construct from four point labels
|
//- Construct from four point labels
|
||||||
inline tetCell
|
inline tetCell
|
||||||
(
|
(
|
||||||
const label a,
|
const label p0,
|
||||||
const label b,
|
const label p1,
|
||||||
const label c,
|
const label p2,
|
||||||
const label d
|
const label p3
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from an initializer list of four point labels
|
//- Construct from an initializer list of four point labels
|
||||||
|
|||||||
@ -36,16 +36,16 @@ inline Foam::tetCell::tetCell()
|
|||||||
|
|
||||||
inline Foam::tetCell::tetCell
|
inline Foam::tetCell::tetCell
|
||||||
(
|
(
|
||||||
const label a,
|
const label p0,
|
||||||
const label b,
|
const label p1,
|
||||||
const label c,
|
const label p2,
|
||||||
const label d
|
const label p3
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
operator[](0) = a;
|
operator[](0) = p0;
|
||||||
operator[](1) = b;
|
operator[](1) = p1;
|
||||||
operator[](2) = c;
|
operator[](2) = p2;
|
||||||
operator[](3) = d;
|
operator[](3) = p3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -48,7 +48,7 @@ SourceFiles
|
|||||||
#include "pointHit.H"
|
#include "pointHit.H"
|
||||||
#include "intersection.H"
|
#include "intersection.H"
|
||||||
#include "pointField.H"
|
#include "pointField.H"
|
||||||
#include "triPointRef.H"
|
#include "triangle.H"
|
||||||
#include "ListListOps.H"
|
#include "ListListOps.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -79,12 +79,7 @@ public:
|
|||||||
inline triFace();
|
inline triFace();
|
||||||
|
|
||||||
//- Construct from three point labels
|
//- Construct from three point labels
|
||||||
inline triFace
|
inline triFace(const label p0, const label p1, const label p2);
|
||||||
(
|
|
||||||
const label a,
|
|
||||||
const label b,
|
|
||||||
const label c
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Construct from an initializer list of three point labels
|
//- Construct from an initializer list of three point labels
|
||||||
inline explicit triFace(std::initializer_list<label> list);
|
inline explicit triFace(std::initializer_list<label> list);
|
||||||
@ -321,6 +316,12 @@ public:
|
|||||||
static inline int compare(const triFace& a, const triFace& b);
|
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
|
// Hashing
|
||||||
|
|
||||||
//- The (commutative) hash value for triFace
|
//- The (commutative) hash value for triFace
|
||||||
@ -377,19 +378,11 @@ template<> struct Hash<triFace> : triFace::hasher {};
|
|||||||
template<>
|
template<>
|
||||||
struct offsetOp<triFace>
|
struct offsetOp<triFace>
|
||||||
{
|
{
|
||||||
inline triFace operator()
|
triFace operator()(const triFace& x, const label offset) const
|
||||||
(
|
|
||||||
const triFace& x,
|
|
||||||
const label offset
|
|
||||||
) const
|
|
||||||
{
|
{
|
||||||
triFace result;
|
triFace f(x);
|
||||||
|
f += offset;
|
||||||
forAll(x, i)
|
return f;
|
||||||
{
|
|
||||||
result[i] = x[i] + offset;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -28,7 +28,6 @@ License
|
|||||||
|
|
||||||
#include "IOstreams.H"
|
#include "IOstreams.H"
|
||||||
#include "face.H"
|
#include "face.H"
|
||||||
#include "triPointRef.H"
|
|
||||||
#include <algorithm> // For std::swap
|
#include <algorithm> // For std::swap
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
@ -68,16 +67,11 @@ inline Foam::triFace::triFace()
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::triFace::triFace
|
inline Foam::triFace::triFace(const label p0, const label p1, const label p2)
|
||||||
(
|
|
||||||
const label a,
|
|
||||||
const label b,
|
|
||||||
const label c
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
operator[](0) = a;
|
operator[](0) = p0;
|
||||||
operator[](1) = b;
|
operator[](1) = p1;
|
||||||
operator[](2) = c;
|
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 * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline bool Foam::operator==(const triFace& a, const triFace& b)
|
inline bool Foam::operator==(const triFace& a, const triFace& b)
|
||||||
|
|||||||
@ -28,7 +28,7 @@ License
|
|||||||
|
|
||||||
#include "polyMeshTools.H"
|
#include "polyMeshTools.H"
|
||||||
#include "syncTools.H"
|
#include "syncTools.H"
|
||||||
#include "pyramidPointFaceRef.H"
|
#include "pyramid.H"
|
||||||
#include "primitiveMeshTools.H"
|
#include "primitiveMeshTools.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -39,13 +39,12 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef polyMeshTetDecomposition_H
|
#ifndef Foam_polyMeshTetDecomposition_H
|
||||||
#define polyMeshTetDecomposition_H
|
#define Foam_polyMeshTetDecomposition_H
|
||||||
|
|
||||||
#include "polyMesh.H"
|
#include "polyMesh.H"
|
||||||
#include "coupledPolyPatch.H"
|
#include "coupledPolyPatch.H"
|
||||||
#include "syncTools.H"
|
#include "syncTools.H"
|
||||||
#include "tetPointRef.H"
|
|
||||||
#include "tetIndices.H"
|
#include "tetIndices.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -54,7 +53,7 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class polyMeshTetDecomposition Declaration
|
Class polyMeshTetDecomposition Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class polyMeshTetDecomposition
|
class polyMeshTetDecomposition
|
||||||
|
|||||||
@ -59,8 +59,8 @@ SourceFiles
|
|||||||
#define Foam_tetIndices_H
|
#define Foam_tetIndices_H
|
||||||
|
|
||||||
#include "label.H"
|
#include "label.H"
|
||||||
#include "tetPointRef.H"
|
#include "tetrahedron.H"
|
||||||
#include "triPointRef.H"
|
#include "triangle.H"
|
||||||
#include "polyMesh.H"
|
#include "polyMesh.H"
|
||||||
#include "triFace.H"
|
#include "triFace.H"
|
||||||
#include "face.H"
|
#include "face.H"
|
||||||
@ -76,7 +76,6 @@ class tetIndices;
|
|||||||
Istream& operator>>(Istream&, tetIndices&);
|
Istream& operator>>(Istream&, tetIndices&);
|
||||||
Ostream& operator<<(Ostream&, const tetIndices&);
|
Ostream& operator<<(Ostream&, const tetIndices&);
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class tetIndices Declaration
|
Class tetIndices Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
@ -149,35 +148,49 @@ public:
|
|||||||
label& tetPt() noexcept { return tetPti_; }
|
label& tetPt() noexcept { return tetPti_; }
|
||||||
|
|
||||||
|
|
||||||
// Searching
|
// Mesh-related
|
||||||
|
|
||||||
//- Return the indices corresponding to the tri on the face for
|
//- The indices corresponding to the tri on the face for this tet.
|
||||||
// this tet. The normal of the tri points out of the cell
|
//- The normal of the tri points out of the cell.
|
||||||
inline triFace faceTriIs
|
inline triFace faceTriIs
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const bool warn = true
|
const bool warn = true
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Return the local indices corresponding to the tri on the face
|
//- Local indices corresponding to the tri on the face for this tet.
|
||||||
//- for this tet. The normal of the tri points out of the cell
|
//- The normal of the tri points out of the cell.
|
||||||
inline triFace triIs
|
inline triFace triIs
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const bool warn = true
|
const bool warn = true
|
||||||
) const;
|
) 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;
|
inline tetPointRef tet(const polyMesh& mesh) const;
|
||||||
|
|
||||||
//- Return the geometry corresponding to the tri on the face for
|
//- The tet geometry for this tet (using old positions),
|
||||||
//- this tet. The normal of the tri points out of the cell
|
//- 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;
|
inline triPointRef faceTri(const polyMesh& mesh) const;
|
||||||
|
|
||||||
//- Return the geometry corresponding to the tri on the face for
|
//- The triangle geometry for the face for this tet
|
||||||
//- this tet using the old positions
|
//- (using old positions)
|
||||||
inline triPointRef oldFaceTri(const polyMesh& mesh) const;
|
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
|
// Other
|
||||||
|
|
||||||
|
|||||||
@ -57,9 +57,9 @@ inline Foam::triFace Foam::tetIndices::faceTriIs
|
|||||||
const bool warn
|
const bool warn
|
||||||
) const
|
) 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)
|
if (faceBasePtI < 0)
|
||||||
{
|
{
|
||||||
@ -67,24 +67,25 @@ inline Foam::triFace Foam::tetIndices::faceTriIs
|
|||||||
|
|
||||||
if (warn && nWarnings_ < maxNWarnings)
|
if (warn && nWarnings_ < maxNWarnings)
|
||||||
{
|
{
|
||||||
++nWarnings_;
|
|
||||||
WarningInFunction
|
WarningInFunction
|
||||||
<< "No base point for face " << face() << ", " << f
|
<< "No base point for face " << facei_ << ", " << f
|
||||||
<< ", produces a valid tet decomposition." << endl;
|
<< ", produces a valid tet decomposition." << endl;
|
||||||
if (nWarnings_ == maxNWarnings)
|
|
||||||
|
if (++nWarnings_ == maxNWarnings)
|
||||||
{
|
{
|
||||||
Warning
|
Warning
|
||||||
<< "Suppressing any further warnings." << endl;
|
<< "Suppressing further warnings." << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
label facePtI = (tetPti_ + faceBasePtI) % f.size();
|
const label facePtI = (tetPti_ + faceBasePtI) % f.size();
|
||||||
label faceOtherPtI = f.fcIndex(facePtI);
|
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]);
|
return triFace(f[faceBasePtI], f[facePtI], f[faceOtherPtI]);
|
||||||
@ -97,9 +98,9 @@ inline Foam::triFace Foam::tetIndices::triIs
|
|||||||
const bool warn
|
const bool warn
|
||||||
) const
|
) 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)
|
if (faceBasePtI < 0)
|
||||||
{
|
{
|
||||||
@ -107,24 +108,25 @@ inline Foam::triFace Foam::tetIndices::triIs
|
|||||||
|
|
||||||
if (warn && nWarnings_ < maxNWarnings)
|
if (warn && nWarnings_ < maxNWarnings)
|
||||||
{
|
{
|
||||||
++nWarnings_;
|
|
||||||
WarningInFunction
|
WarningInFunction
|
||||||
<< "No base point for face " << face() << ", " << f
|
<< "No base point for face " << facei_ << ", " << f
|
||||||
<< ", produces a valid tet decomposition." << endl;
|
<< ", produces a valid tet decomposition." << endl;
|
||||||
if (nWarnings_ == maxNWarnings)
|
|
||||||
|
if (++nWarnings_ == maxNWarnings)
|
||||||
{
|
{
|
||||||
Warning
|
Warning
|
||||||
<< "Suppressing any further warnings." << endl;
|
<< "Suppressing further warnings." << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
label facePtI = (tetPti_ + faceBasePtI) % f.size();
|
const label facePtI = (tetPti_ + faceBasePtI) % f.size();
|
||||||
label faceOtherPtI = f.fcIndex(facePtI);
|
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);
|
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
|
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);
|
const triFace tri = faceTriIs(mesh);
|
||||||
|
|
||||||
return tetPointRef
|
return tetPointRef
|
||||||
(
|
(
|
||||||
mesh.cellCentres()[cell()],
|
mesh.cellCentres()[celli_],
|
||||||
meshPoints[tri[0]],
|
pts[tri[0]],
|
||||||
meshPoints[tri[1]],
|
pts[tri[1]],
|
||||||
meshPoints[tri[2]]
|
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
|
inline Foam::triPointRef Foam::tetIndices::faceTri(const polyMesh& mesh) const
|
||||||
{
|
{
|
||||||
const pointField& meshPoints = mesh.points();
|
return faceTriIs(mesh).tri(mesh.points());
|
||||||
const triFace tri = faceTriIs(mesh);
|
|
||||||
|
|
||||||
return triPointRef
|
|
||||||
(
|
|
||||||
meshPoints[tri[0]],
|
|
||||||
meshPoints[tri[1]],
|
|
||||||
meshPoints[tri[2]]
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -165,15 +197,7 @@ inline Foam::triPointRef Foam::tetIndices::oldFaceTri
|
|||||||
const polyMesh& mesh
|
const polyMesh& mesh
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const pointField& meshOldPoints = mesh.oldPoints();
|
return faceTriIs(mesh).tri(mesh.oldPoints());
|
||||||
const triFace tri = faceTriIs(mesh);
|
|
||||||
|
|
||||||
return triPointRef
|
|
||||||
(
|
|
||||||
meshOldPoints[tri[0]],
|
|
||||||
meshOldPoints[tri[1]],
|
|
||||||
meshOldPoints[tri[2]]
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,7 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "primitiveMesh.H"
|
#include "primitiveMesh.H"
|
||||||
#include "pyramidPointFaceRef.H"
|
#include "pyramid.H"
|
||||||
#include "ListOps.H"
|
#include "ListOps.H"
|
||||||
#include "unitConversion.H"
|
#include "unitConversion.H"
|
||||||
#include "SortableList.H"
|
#include "SortableList.H"
|
||||||
|
|||||||
@ -29,7 +29,7 @@ License
|
|||||||
#include "primitiveMeshTools.H"
|
#include "primitiveMeshTools.H"
|
||||||
#include "primitiveMesh.H"
|
#include "primitiveMesh.H"
|
||||||
#include "syncTools.H"
|
#include "syncTools.H"
|
||||||
#include "pyramidPointFaceRef.H"
|
#include "pyramid.H"
|
||||||
#include "PrecisionAdaptor.H"
|
#include "PrecisionAdaptor.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -33,13 +33,13 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef cut_H
|
#ifndef Foam_cut_H
|
||||||
#define cut_H
|
#define Foam_cut_H
|
||||||
|
|
||||||
#include "plane.H"
|
#include "plane.H"
|
||||||
#include "FixedList.H"
|
#include "FixedList.H"
|
||||||
#include "tetPointRef.H"
|
#include "tetrahedron.H"
|
||||||
#include "triPointRef.H"
|
#include "triangle.H"
|
||||||
#include "zero.H"
|
#include "zero.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -35,12 +35,13 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef line_H
|
#ifndef Foam_line_H
|
||||||
#define line_H
|
#define Foam_line_H
|
||||||
|
|
||||||
|
#include "point.H"
|
||||||
|
#include "point2D.H"
|
||||||
#include "vector.H"
|
#include "vector.H"
|
||||||
#include "PointHit.H"
|
#include "PointHit.H"
|
||||||
#include "point2D.H"
|
|
||||||
#include "FixedList.H"
|
#include "FixedList.H"
|
||||||
#include "UList.H"
|
#include "UList.H"
|
||||||
|
|
||||||
@ -60,6 +61,12 @@ template<class Point, class PointRef>
|
|||||||
inline Ostream& operator<<(Ostream& os, const line<Point, PointRef>& l);
|
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
|
Class line Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
@ -100,19 +107,19 @@ public:
|
|||||||
// Access
|
// Access
|
||||||
|
|
||||||
//- Return first point
|
//- Return first point
|
||||||
inline PointRef first() const noexcept;
|
inline PointRef first() const noexcept { return a_; }
|
||||||
|
|
||||||
//- Return second (last) point
|
//- Return second (last) point
|
||||||
inline PointRef second() const noexcept;
|
inline PointRef second() const noexcept { return b_; }
|
||||||
|
|
||||||
//- Return last (second) point
|
//- Return last (second) point
|
||||||
inline PointRef last() const noexcept;
|
inline PointRef last() const noexcept { return b_; }
|
||||||
|
|
||||||
//- Return first point
|
//- Return start (first) point
|
||||||
inline PointRef start() const noexcept;
|
inline PointRef start() const noexcept { return a_; }
|
||||||
|
|
||||||
//- Return second (last) point
|
//- Return end (second) point
|
||||||
inline PointRef end() const noexcept;
|
inline PointRef end() const noexcept { return b_; }
|
||||||
|
|
||||||
|
|
||||||
// Properties
|
// Properties
|
||||||
|
|||||||
@ -60,40 +60,6 @@ inline Foam::line<Point, PointRef>::line(Istream& is)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * 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>
|
template<class Point, class PointRef>
|
||||||
inline Point Foam::line<Point, PointRef>::centre() const
|
inline Point Foam::line<Point, PointRef>::centre() const
|
||||||
{
|
{
|
||||||
|
|||||||
@ -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
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,55 +1,11 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
// Compatibility include.
|
||||||
========= |
|
// linePointRef typedef included in line.H (JUL-2022)
|
||||||
\\ / 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
|
#ifndef FoamCompat_linePointRef_H
|
||||||
under the terms of the GNU General Public License as published by
|
#define FoamCompat_linePointRef_H
|
||||||
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::linePointRef
|
|
||||||
|
|
||||||
Description
|
|
||||||
A line using referred points
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef linePointRef_H
|
|
||||||
#define linePointRef_H
|
|
||||||
|
|
||||||
#include "point.H"
|
|
||||||
#include "line.H"
|
#include "line.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
typedef line<point, const point&> linePointRef;
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -31,8 +31,8 @@ Description
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef point_H
|
#ifndef Foam_point_H
|
||||||
#define point_H
|
#define Foam_point_H
|
||||||
|
|
||||||
#include "vector.H"
|
#include "vector.H"
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011 OpenFOAM Foundation
|
Copyright (C) 2011 OpenFOAM Foundation
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -37,8 +37,11 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef pyramid_H
|
#ifndef Foam_pyramid_H
|
||||||
#define pyramid_H
|
#define Foam_pyramid_H
|
||||||
|
|
||||||
|
#include "point.H"
|
||||||
|
#include "face.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -47,34 +50,39 @@ namespace Foam
|
|||||||
|
|
||||||
// Forward Declarations
|
// Forward Declarations
|
||||||
|
|
||||||
template<class Point, class PointRef, class polygonRef>
|
template<class Point, class PointRef, class PolygonRef> class pyramid;
|
||||||
class pyramid;
|
|
||||||
|
|
||||||
template<class Point, class PointRef, class polygonRef>
|
template<class Point, class PointRef, class PolygonRef>
|
||||||
inline Istream& operator>>
|
inline Istream& operator>>
|
||||||
(
|
(
|
||||||
Istream& is,
|
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<<
|
inline Ostream& operator<<
|
||||||
(
|
(
|
||||||
Ostream& os,
|
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
|
Class pyramid Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
template<class Point, class PointRef, class polygonRef>
|
template<class Point, class PointRef, class PolygonRef>
|
||||||
class pyramid
|
class pyramid
|
||||||
{
|
{
|
||||||
// Private Data
|
// Private Data
|
||||||
|
|
||||||
polygonRef base_;
|
PolygonRef base_;
|
||||||
|
|
||||||
PointRef apex_;
|
PointRef apex_;
|
||||||
|
|
||||||
@ -90,7 +98,7 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from base polygon and apex point
|
//- Construct from base polygon and apex point
|
||||||
inline pyramid(polygonRef base, const Point& apex);
|
inline pyramid(PolygonRef base, const Point& apex);
|
||||||
|
|
||||||
//- Construct from Istream
|
//- Construct from Istream
|
||||||
inline explicit pyramid(Istream& is);
|
inline explicit pyramid(Istream& is);
|
||||||
@ -98,36 +106,36 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
//- Return apex point
|
//- The apex point
|
||||||
inline const Point& apex() const;
|
const Point& apex() const { return apex_; }
|
||||||
|
|
||||||
//- Return base polygon
|
//- The base polygon
|
||||||
inline polygonRef base() const;
|
PolygonRef base() const { return base_; }
|
||||||
|
|
||||||
|
|
||||||
// Properties
|
// Properties
|
||||||
|
|
||||||
//- Return centre (centroid)
|
//- Return centre (centroid)
|
||||||
inline Point centre(const UList<point>& points) const;
|
inline Point centre(const UList<point>& points) const;
|
||||||
|
|
||||||
//- Return height vector
|
//- Return height vector
|
||||||
inline vector height(const UList<point>& points) const;
|
inline vector height(const UList<point>& points) const;
|
||||||
|
|
||||||
//- Return scalar magnitude - returns volume of pyramid
|
//- Return scalar magnitude - returns volume of pyramid
|
||||||
inline scalar mag(const UList<point>& points) const;
|
inline scalar mag(const UList<point>& points) const;
|
||||||
|
|
||||||
|
|
||||||
// IOstream Operators
|
// IOstream Operators
|
||||||
|
|
||||||
friend Istream& operator>> <Point, PointRef, polygonRef>
|
friend Istream& operator>> <Point, PointRef, PolygonRef>
|
||||||
(
|
(
|
||||||
Istream& is,
|
Istream& is,
|
||||||
pyramid& p
|
pyramid& p
|
||||||
);
|
);
|
||||||
|
|
||||||
friend Ostream& operator<< <Point, PointRef, polygonRef>
|
friend Ostream& operator<< <Point, PointRef, PolygonRef>
|
||||||
(
|
(
|
||||||
Ostream& os,
|
Ostream& os,
|
||||||
const pyramid& p
|
const pyramid& p
|
||||||
|
|||||||
@ -29,10 +29,10 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Point, class PointRef, class polygonRef>
|
template<class Point, class PointRef, class PolygonRef>
|
||||||
inline Foam::pyramid<Point, PointRef, polygonRef>::pyramid
|
inline Foam::pyramid<Point, PointRef, PolygonRef>::pyramid
|
||||||
(
|
(
|
||||||
polygonRef base,
|
PolygonRef base,
|
||||||
const Point& apex
|
const Point& apex
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
@ -41,31 +41,17 @@ inline Foam::pyramid<Point, PointRef, polygonRef>::pyramid
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
template<class Point, class PointRef, class polygonRef>
|
template<class Point, class PointRef, class PolygonRef>
|
||||||
inline Foam::pyramid<Point, PointRef, polygonRef>::pyramid(Istream& is)
|
inline Foam::pyramid<Point, PointRef, PolygonRef>::pyramid(Istream& is)
|
||||||
{
|
{
|
||||||
is >> base_ >> apex_;
|
is >> *this;
|
||||||
is.check(FUNCTION_NAME);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Point, class PointRef, class polygonRef>
|
template<class Point, class PointRef, class PolygonRef>
|
||||||
inline const Point& Foam::pyramid<Point, PointRef, polygonRef>::apex() const
|
inline Point Foam::pyramid<Point, PointRef, PolygonRef>::centre
|
||||||
{
|
|
||||||
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
|
|
||||||
(
|
(
|
||||||
const UList<point>& points
|
const UList<point>& points
|
||||||
) const
|
) const
|
||||||
@ -74,8 +60,8 @@ inline Point Foam::pyramid<Point, PointRef, polygonRef>::centre
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Point, class PointRef, class polygonRef>
|
template<class Point, class PointRef, class PolygonRef>
|
||||||
inline Foam::vector Foam::pyramid<Point, PointRef, polygonRef>::height
|
inline Foam::vector Foam::pyramid<Point, PointRef, PolygonRef>::height
|
||||||
(
|
(
|
||||||
const UList<point>& points
|
const UList<point>& points
|
||||||
) const
|
) const
|
||||||
@ -85,8 +71,8 @@ inline Foam::vector Foam::pyramid<Point, PointRef, polygonRef>::height
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Point, class PointRef, class polygonRef>
|
template<class Point, class PointRef, class PolygonRef>
|
||||||
inline Foam::scalar Foam::pyramid<Point, PointRef, polygonRef>::mag
|
inline Foam::scalar Foam::pyramid<Point, PointRef, PolygonRef>::mag
|
||||||
(
|
(
|
||||||
const UList<point>& points
|
const UList<point>& points
|
||||||
) const
|
) const
|
||||||
@ -97,11 +83,11 @@ inline Foam::scalar Foam::pyramid<Point, PointRef, polygonRef>::mag
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Point, class PointRef, class polygonRef>
|
template<class Point, class PointRef, class PolygonRef>
|
||||||
inline Foam::Istream& Foam::operator>>
|
inline Foam::Istream& Foam::operator>>
|
||||||
(
|
(
|
||||||
Istream& is,
|
Istream& is,
|
||||||
pyramid<Point, PointRef, polygonRef>& p
|
pyramid<Point, PointRef, PolygonRef>& p
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
is >> p.base_ >> p.apex_;
|
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<<
|
inline Foam::Ostream& Foam::operator<<
|
||||||
(
|
(
|
||||||
Ostream& os,
|
Ostream& os,
|
||||||
const pyramid<Point, PointRef, polygonRef>& p
|
const pyramid<Point, PointRef, PolygonRef>& p
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
os << p.base_ << tab << p.apex_ << nl;
|
os << p.base_ << tab << p.apex_ << nl;
|
||||||
|
|||||||
@ -1,56 +1,11 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
// Compatibility include
|
||||||
========= |
|
// pyramidPointFaceRef typedef included in tetrahedron.H (SEP-2017)
|
||||||
\\ / 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
|
#ifndef FoamCompat_pyramidPointFaceRef_H
|
||||||
under the terms of the GNU General Public License as published by
|
#define FoamCompat_pyramidPointFaceRef_H
|
||||||
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::pyramidPointFaceRef
|
|
||||||
|
|
||||||
Description
|
|
||||||
A pyramid using referred points and faces
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef pyramidPointFaceRef_H
|
|
||||||
#define pyramidPointFaceRef_H
|
|
||||||
|
|
||||||
#include "point.H"
|
|
||||||
#include "face.H"
|
|
||||||
#include "pyramid.H"
|
#include "pyramid.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
typedef pyramid<point, const point&, const face&> pyramidPointFaceRef;
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -1,55 +1,11 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
// Compatibility include.
|
||||||
========= |
|
// tetPointRef typedef included in tetrahedron.H (SEP-2017)
|
||||||
\\ / 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.
|
|
||||||
|
|
||||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
#ifndef FoamCompat_tetPointRef_H
|
||||||
under the terms of the GNU General Public License as published by
|
#define FoamCompat_tetPointRef_H
|
||||||
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::tetPointRef
|
|
||||||
|
|
||||||
Description
|
|
||||||
A tetrahedron using referred points
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef tetPointRef_H
|
|
||||||
#define tetPointRef_H
|
|
||||||
|
|
||||||
#include "point.H"
|
|
||||||
#include "tetrahedron.H"
|
#include "tetrahedron.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
typedef tetrahedron<point, const point&> tetPointRef;
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -1,126 +1,10 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
// Compatibility include.
|
||||||
========= |
|
// tetPoints defined in tetrahedron.H (JUL-2022)
|
||||||
\\ / 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.
|
|
||||||
|
|
||||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
#ifndef FoamCompat_tetPoints_H
|
||||||
under the terms of the GNU General Public License as published by
|
#define FoamCompat_tetPoints_H
|
||||||
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
|
|
||||||
|
|
||||||
#include "tetrahedron.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
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,6 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "tetrahedron.H"
|
#include "tetrahedron.H"
|
||||||
#include "triPointRef.H"
|
|
||||||
#include "scalarField.H"
|
#include "scalarField.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2018 OpenCFD Ltd.
|
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -39,17 +39,17 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef tetrahedron_H
|
#ifndef Foam_tetrahedron_H
|
||||||
#define tetrahedron_H
|
#define Foam_tetrahedron_H
|
||||||
|
|
||||||
#include "point.H"
|
#include "point.H"
|
||||||
#include "primitiveFieldsFwd.H"
|
|
||||||
#include "pointHit.H"
|
#include "pointHit.H"
|
||||||
|
#include "primitiveFieldsFwd.H"
|
||||||
#include "Random.H"
|
#include "Random.H"
|
||||||
#include "FixedList.H"
|
#include "FixedList.H"
|
||||||
#include "UList.H"
|
#include "UList.H"
|
||||||
#include "triPointRef.H"
|
#include "triangle.H"
|
||||||
#include "boundBox.H"
|
#include "treeBoundBox.H"
|
||||||
#include "barycentric.H"
|
#include "barycentric.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -59,28 +59,103 @@ namespace Foam
|
|||||||
|
|
||||||
// Forward Declarations
|
// Forward Declarations
|
||||||
class plane;
|
class plane;
|
||||||
class tetPoints;
|
|
||||||
|
|
||||||
template<class Point, class PointRef> class tetrahedron;
|
template<class Point, class PointRef> class tetrahedron;
|
||||||
|
|
||||||
template<class Point, class PointRef>
|
template<class Point, class PointRef>
|
||||||
inline Istream& operator>>
|
inline Istream& operator>>(Istream&, tetrahedron<Point, PointRef>&);
|
||||||
(
|
|
||||||
Istream&,
|
|
||||||
tetrahedron<Point, PointRef>&
|
|
||||||
);
|
|
||||||
|
|
||||||
template<class Point, class PointRef>
|
template<class Point, class PointRef>
|
||||||
inline Ostream& operator<<
|
inline Ostream& operator<<(Ostream&, const tetrahedron<Point, PointRef>&);
|
||||||
(
|
|
||||||
Ostream&,
|
|
||||||
const tetrahedron<Point, PointRef>&
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
|
// Common Typedefs
|
||||||
|
|
||||||
|
//- A tetrahedron using referred points
|
||||||
typedef tetrahedron<point, const point&> tetPointRef;
|
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>
|
template<class Point, class PointRef>
|
||||||
@ -88,7 +163,10 @@ class tetrahedron
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Public typedefs
|
// Public Typedefs
|
||||||
|
|
||||||
|
//- The point type
|
||||||
|
typedef Point point_type;
|
||||||
|
|
||||||
//- Storage type for tets originating from intersecting tets.
|
//- Storage type for tets originating from intersecting tets.
|
||||||
// (can possibly be smaller than 200)
|
// (can possibly be smaller than 200)
|
||||||
@ -130,10 +208,13 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// Private data
|
// Private Data
|
||||||
|
|
||||||
PointRef a_, b_, c_, d_;
|
PointRef a_, b_, c_, d_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
inline static point planeIntersection
|
inline static point planeIntersection
|
||||||
(
|
(
|
||||||
const FixedList<scalar, 4>&,
|
const FixedList<scalar, 4>&,
|
||||||
@ -161,7 +242,7 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Member constants
|
// Member Constants
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
@ -172,15 +253,18 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from points
|
//- Construct from four points
|
||||||
inline tetrahedron
|
inline tetrahedron
|
||||||
(
|
(
|
||||||
const Point& a,
|
const Point& p0,
|
||||||
const Point& b,
|
const Point& p1,
|
||||||
const Point& c,
|
const Point& p2,
|
||||||
const Point& d
|
const Point& p3
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Construct from four points
|
||||||
|
inline tetrahedron(const FixedList<Point, 4>& pts);
|
||||||
|
|
||||||
//- Construct from four points in the list of points
|
//- Construct from four points in the list of points
|
||||||
inline tetrahedron
|
inline tetrahedron
|
||||||
(
|
(
|
||||||
@ -189,24 +273,27 @@ public:
|
|||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from Istream
|
//- Construct from Istream
|
||||||
inline tetrahedron(Istream&);
|
inline explicit tetrahedron(Istream&);
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
//- Return vertices
|
//- Return vertex a
|
||||||
inline const Point& a() const;
|
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
|
//- Return i-th face
|
||||||
inline triPointRef tri(const label facei) const;
|
inline triPointRef tri(const label facei) const;
|
||||||
|
|
||||||
|
|
||||||
// Properties
|
// Properties
|
||||||
@ -236,12 +323,12 @@ public:
|
|||||||
inline scalar circumRadius() const;
|
inline scalar circumRadius() const;
|
||||||
|
|
||||||
//- Return quality: Ratio of tetrahedron and circum-sphere
|
//- Return quality: Ratio of tetrahedron and circum-sphere
|
||||||
// volume, scaled so that a regular tetrahedron has a
|
//- volume, scaled so that a regular tetrahedron has a
|
||||||
// quality of 1
|
//- quality of 1
|
||||||
inline scalar quality() const;
|
inline scalar quality() const;
|
||||||
|
|
||||||
//- Return a random point in the tetrahedron from a
|
//- Return a random point in the tetrahedron from a
|
||||||
// uniform distribution
|
//- uniform distribution
|
||||||
inline Point randomPoint(Random& rndGen) const;
|
inline Point randomPoint(Random& rndGen) const;
|
||||||
|
|
||||||
//- Calculate the point from the given barycentric coordinates.
|
//- Calculate the point from the given barycentric coordinates.
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2018 OpenCFD Ltd.
|
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -28,24 +28,76 @@ License
|
|||||||
|
|
||||||
#include "triangle.H"
|
#include "triangle.H"
|
||||||
#include "IOstreams.H"
|
#include "IOstreams.H"
|
||||||
#include "tetPoints.H"
|
|
||||||
#include "plane.H"
|
#include "plane.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * 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>
|
template<class Point, class PointRef>
|
||||||
inline Foam::tetrahedron<Point, PointRef>::tetrahedron
|
inline Foam::tetrahedron<Point, PointRef>::tetrahedron
|
||||||
(
|
(
|
||||||
const Point& a,
|
const Point& p0,
|
||||||
const Point& b,
|
const Point& p1,
|
||||||
const Point& c,
|
const Point& p2,
|
||||||
const Point& d
|
const Point& p3
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
a_(a),
|
a_(p0),
|
||||||
b_(b),
|
b_(p1),
|
||||||
c_(c),
|
c_(p2),
|
||||||
d_(d)
|
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 * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Point, class PointRef>
|
inline Foam::tetPointRef Foam::tetPoints::tet() const
|
||||||
inline const Point& Foam::tetrahedron<Point, PointRef>::a() const
|
|
||||||
{
|
{
|
||||||
return a_;
|
return tetPointRef(a(), b(), c(), d());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Point, class PointRef>
|
inline void Foam::tetPoints::flip()
|
||||||
inline const Point& Foam::tetrahedron<Point, PointRef>::b() const
|
|
||||||
{
|
{
|
||||||
return b_;
|
// swap pt2 <-> pt3
|
||||||
|
point t(c());
|
||||||
|
c() = d();
|
||||||
|
d() = t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Point, class PointRef>
|
inline Foam::treeBoundBox Foam::tetPoints::bounds() const
|
||||||
inline const Point& Foam::tetrahedron<Point, PointRef>::c() const
|
|
||||||
{
|
{
|
||||||
return c_;
|
treeBoundBox bb;
|
||||||
|
bb.add(static_cast<const FixedList<point, 4>&>(*this));
|
||||||
|
return bb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Point, class PointRef>
|
// Warning. Ordering of faces needs to be the same for a tetrahedron class,
|
||||||
inline const Point& Foam::tetrahedron<Point, PointRef>::d() const
|
// tetrahedron cell shape model and a tetCell
|
||||||
{
|
|
||||||
return d_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Point, class PointRef>
|
template<class Point, class PointRef>
|
||||||
inline Foam::triPointRef Foam::tetrahedron<Point, PointRef>::tri
|
inline Foam::triPointRef Foam::tetrahedron<Point, PointRef>::tri
|
||||||
@ -257,7 +307,7 @@ inline Point Foam::tetrahedron<Point, PointRef>::barycentricToPoint
|
|||||||
const barycentric& bary
|
const barycentric& bary
|
||||||
) const
|
) 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[0] = res.x();
|
||||||
bary[1] = res.y();
|
bary[1] = res.y();
|
||||||
bary[2] = res.z();
|
bary[2] = res.z();
|
||||||
bary[3] = 1 - cmptSum(res);
|
bary[3] = 1 - bary[0] - bary[1] - bary[2];
|
||||||
|
|
||||||
return detT;
|
return detT;
|
||||||
}
|
}
|
||||||
@ -334,63 +384,83 @@ inline Foam::pointHit Foam::tetrahedron<Point, PointRef>::nearestPoint
|
|||||||
|
|
||||||
bool inside = true;
|
bool inside = true;
|
||||||
|
|
||||||
if (((p - b_) & Sa()) >= 0)
|
// Side a
|
||||||
{
|
{
|
||||||
// p is outside halfspace plane of tri
|
const triangle<Point, PointRef> tria(b_, c_, d_);
|
||||||
pointHit info = triangle<Point, PointRef>(b_, c_, d_).nearestPoint(p);
|
|
||||||
|
|
||||||
inside = false;
|
if (((p - b_) & tria.areaNormal()) >= 0)
|
||||||
|
|
||||||
if (info.distance() < minOutsideDistance)
|
|
||||||
{
|
{
|
||||||
closestPt = info.rawPoint();
|
// p is outside halfspace plane of tri
|
||||||
|
pointHit info = tria.nearestPoint(p);
|
||||||
|
|
||||||
minOutsideDistance = info.distance();
|
inside = false;
|
||||||
|
|
||||||
|
if (info.distance() < minOutsideDistance)
|
||||||
|
{
|
||||||
|
closestPt = info.rawPoint();
|
||||||
|
|
||||||
|
minOutsideDistance = info.distance();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((p - a_) & Sb()) >= 0)
|
// Side b
|
||||||
{
|
{
|
||||||
// p is outside halfspace plane of tri
|
const triangle<Point, PointRef> tria(a_, d_, c_);
|
||||||
pointHit info = triangle<Point, PointRef>(a_, d_, c_).nearestPoint(p);
|
|
||||||
|
|
||||||
inside = false;
|
if (((p - a_) & tria.areaNormal()) >= 0)
|
||||||
|
|
||||||
if (info.distance() < minOutsideDistance)
|
|
||||||
{
|
{
|
||||||
closestPt = info.rawPoint();
|
// p is outside halfspace plane of tri
|
||||||
|
pointHit info = tria.nearestPoint(p);
|
||||||
|
|
||||||
minOutsideDistance = info.distance();
|
inside = false;
|
||||||
|
|
||||||
|
if (info.distance() < minOutsideDistance)
|
||||||
|
{
|
||||||
|
closestPt = info.rawPoint();
|
||||||
|
|
||||||
|
minOutsideDistance = info.distance();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((p - a_) & Sc()) >= 0)
|
// Side c
|
||||||
{
|
{
|
||||||
// p is outside halfspace plane of tri
|
const triangle<Point, PointRef> tria(a_, b_, d_);
|
||||||
pointHit info = triangle<Point, PointRef>(a_, b_, d_).nearestPoint(p);
|
|
||||||
|
|
||||||
inside = false;
|
if (((p - a_) & tria.areaNormal()) >= 0)
|
||||||
|
|
||||||
if (info.distance() < minOutsideDistance)
|
|
||||||
{
|
{
|
||||||
closestPt = info.rawPoint();
|
// p is outside halfspace plane of tri
|
||||||
|
pointHit info = tria.nearestPoint(p);
|
||||||
|
|
||||||
minOutsideDistance = info.distance();
|
inside = false;
|
||||||
|
|
||||||
|
if (info.distance() < minOutsideDistance)
|
||||||
|
{
|
||||||
|
closestPt = info.rawPoint();
|
||||||
|
|
||||||
|
minOutsideDistance = info.distance();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((p - a_) & Sd()) >= 0)
|
// Side c
|
||||||
{
|
{
|
||||||
// p is outside halfspace plane of tri
|
const triangle<Point, PointRef> tria(a_, c_, b_);
|
||||||
pointHit info = triangle<Point, PointRef>(a_, c_, b_).nearestPoint(p);
|
|
||||||
|
|
||||||
inside = false;
|
if (((p - a_) & tria.areaNormal()) >= 0)
|
||||||
|
|
||||||
if (info.distance() < minOutsideDistance)
|
|
||||||
{
|
{
|
||||||
closestPt = info.rawPoint();
|
// p is outside halfspace plane of tri
|
||||||
|
pointHit info = tria.nearestPoint(p);
|
||||||
|
|
||||||
minOutsideDistance = info.distance();
|
inside = false;
|
||||||
|
|
||||||
|
if (info.distance() < minOutsideDistance)
|
||||||
|
{
|
||||||
|
closestPt = info.rawPoint();
|
||||||
|
|
||||||
|
minOutsideDistance = info.distance();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -412,7 +482,7 @@ inline Foam::pointHit Foam::tetrahedron<Point, PointRef>::nearestPoint
|
|||||||
|
|
||||||
|
|
||||||
template<class Point, class PointRef>
|
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
|
// For robustness, assuming that the point is in the tet unless
|
||||||
// "definitively" shown otherwise by obtaining a positive dot
|
// "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[2] = tetBasePt = b_
|
||||||
// planeBase[3] = tetBasePt = b_
|
// planeBase[3] = tetBasePt = b_
|
||||||
|
|
||||||
vector n = Zero;
|
// Side a
|
||||||
|
|
||||||
{
|
{
|
||||||
// 0, a
|
const triangle<Point, PointRef> tria(b_, c_, d_);
|
||||||
const point& basePt = b_;
|
|
||||||
|
|
||||||
n = Sa();
|
if (((p - b_) & tria.unitNormal()) > SMALL)
|
||||||
n /= (Foam::mag(n) + VSMALL);
|
|
||||||
|
|
||||||
if (((pt - basePt) & n) > SMALL)
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Side b
|
||||||
{
|
{
|
||||||
// 1, b
|
const triangle<Point, PointRef> tria(a_, d_, c_);
|
||||||
const point& basePt = c_;
|
|
||||||
|
|
||||||
n = Sb();
|
if (((p - a_) & tria.unitNormal()) > SMALL)
|
||||||
n /= (Foam::mag(n) + VSMALL);
|
|
||||||
|
|
||||||
if (((pt - basePt) & n) > SMALL)
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Side c
|
||||||
{
|
{
|
||||||
// 2, c
|
const triangle<Point, PointRef> tria(a_, b_, d_);
|
||||||
const point& basePt = b_;
|
|
||||||
|
|
||||||
n = Sc();
|
if (((p - a_) & tria.unitNormal()) > SMALL)
|
||||||
n /= (Foam::mag(n) + VSMALL);
|
|
||||||
|
|
||||||
if (((pt - basePt) & n) > SMALL)
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Side d
|
||||||
{
|
{
|
||||||
// 3, d
|
const triangle<Point, PointRef> tria(a_, c_, b_);
|
||||||
const point& basePt = b_;
|
|
||||||
|
|
||||||
n = Sd();
|
if (((p - a_) & tria.unitNormal()) > SMALL)
|
||||||
n /= (Foam::mag(n) + VSMALL);
|
|
||||||
|
|
||||||
if (((pt - basePt) & n) > SMALL)
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1055,6 +1111,7 @@ inline Foam::Ostream& Foam::operator<<
|
|||||||
const tetrahedron<Point, PointRef>& t
|
const tetrahedron<Point, PointRef>& t
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
// Format like FixedList
|
||||||
os << nl
|
os << nl
|
||||||
<< token::BEGIN_LIST
|
<< token::BEGIN_LIST
|
||||||
<< t.a_ << token::SPACE
|
<< t.a_ << token::SPACE
|
||||||
|
|||||||
@ -1,55 +1,11 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
// Compatibility include.
|
||||||
========= |
|
// triPointRef typedef included in triangle.H (NOV-2015)
|
||||||
\\ / 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
|
#ifndef FoamCompat_triPointRef_H
|
||||||
under the terms of the GNU General Public License as published by
|
#define FoamCompat_triPointRef_H
|
||||||
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::triPointRef
|
|
||||||
|
|
||||||
Description
|
|
||||||
A triangle using referred points
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef triPointRef_H
|
|
||||||
#define triPointRef_H
|
|
||||||
|
|
||||||
#include "point.H"
|
|
||||||
#include "triangle.H"
|
#include "triangle.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
typedef triangle<point, const point&> triPointRef;
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -1,111 +1,10 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
// Compatibility include.
|
||||||
========= |
|
// triPoints defined in triangle.H (JUL-2022)
|
||||||
\\ / 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.
|
|
||||||
|
|
||||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
#ifndef FoamCompat_triPoints_H
|
||||||
under the terms of the GNU General Public License as published by
|
#define FoamCompat_triPoints_H
|
||||||
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
|
#include "triangle.H"
|
||||||
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
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,6 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "triangle.H"
|
#include "triangle.H"
|
||||||
#include "triPoints.H"
|
|
||||||
#include "plane.H"
|
#include "plane.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -35,18 +35,20 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef triangle_H
|
#ifndef Foam_triangle_H
|
||||||
#define triangle_H
|
#define Foam_triangle_H
|
||||||
|
|
||||||
#include "intersection.H"
|
#include "intersection.H"
|
||||||
|
#include "point.H"
|
||||||
#include "vector.H"
|
#include "vector.H"
|
||||||
#include "tensor.H"
|
#include "tensor.H"
|
||||||
#include "pointHit.H"
|
#include "pointHit.H"
|
||||||
#include "Random.H"
|
#include "Random.H"
|
||||||
#include "FixedList.H"
|
#include "FixedList.H"
|
||||||
#include "UList.H"
|
#include "UList.H"
|
||||||
#include "linePointRef.H"
|
#include "line.H"
|
||||||
#include "barycentric2D.H"
|
#include "barycentric2D.H"
|
||||||
|
#include "treeBoundBox.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -55,7 +57,6 @@ namespace Foam
|
|||||||
|
|
||||||
// Forward Declarations
|
// Forward Declarations
|
||||||
class plane;
|
class plane;
|
||||||
class triPoints;
|
|
||||||
|
|
||||||
template<class Point, class PointRef> class triangle;
|
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;
|
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
|
Class triangle Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
@ -90,7 +158,7 @@ public:
|
|||||||
//- with another triangle
|
//- with another triangle
|
||||||
typedef FixedList<triPoints, 27> triIntersectionList;
|
typedef FixedList<triPoints, 27> triIntersectionList;
|
||||||
|
|
||||||
//- The proximity classifications
|
//- Proximity classifications
|
||||||
enum proxType
|
enum proxType
|
||||||
{
|
{
|
||||||
NONE = 0, //!< Unknown proximity
|
NONE = 0, //!< Unknown proximity
|
||||||
@ -99,10 +167,10 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// Public classes
|
// Public Classes
|
||||||
|
|
||||||
// Classes for use in sliceWithPlane. What to do with decomposition
|
// Classes for use in sliceWithPlane.
|
||||||
// of triangle.
|
// What to do with decomposition of triangle.
|
||||||
|
|
||||||
//- Dummy
|
//- Dummy
|
||||||
class dummyOp
|
class dummyOp
|
||||||
@ -169,10 +237,10 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from three points
|
//- 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
|
//- 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
|
//- Construct from three points in the list of points
|
||||||
// The indices could be from triFace etc.
|
// The indices could be from triFace etc.
|
||||||
@ -188,16 +256,16 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
//- Return first vertex
|
//- The first vertex
|
||||||
inline const Point& a() const;
|
const Point& a() const noexcept { return a_; }
|
||||||
|
|
||||||
//- Return second vertex
|
//- The second vertex
|
||||||
inline const Point& b() const;
|
const Point& b() const noexcept { return b_; }
|
||||||
|
|
||||||
//- Return third vertex
|
//- The third vertex
|
||||||
inline const Point& c() const;
|
const Point& c() const noexcept { return c_; }
|
||||||
|
|
||||||
|
|
||||||
// Properties
|
// Properties
|
||||||
@ -245,7 +313,7 @@ public:
|
|||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Return a random point on the triangle from a uniform
|
//- Return a random point on the triangle from a uniform
|
||||||
// distribution
|
//- distribution
|
||||||
inline Point randomPoint(Random& rndGen) const;
|
inline Point randomPoint(Random& rndGen) const;
|
||||||
|
|
||||||
//- Calculate the point from the given barycentric coordinates.
|
//- Calculate the point from the given barycentric coordinates.
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2018 OpenCFD Ltd.
|
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -28,34 +28,70 @@ License
|
|||||||
|
|
||||||
#include "IOstreams.H"
|
#include "IOstreams.H"
|
||||||
#include "pointHit.H"
|
#include "pointHit.H"
|
||||||
#include "triPoints.H"
|
|
||||||
#include "mathematicalConstants.H"
|
#include "mathematicalConstants.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Point, class PointRef>
|
inline Foam::triPoints::triPoints
|
||||||
inline Foam::triangle<Point, PointRef>::triangle
|
|
||||||
(
|
(
|
||||||
const Point& a,
|
const point& p0,
|
||||||
const Point& b,
|
const point& p1,
|
||||||
const Point& c
|
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),
|
FixedList<point, 3>(points, indices)
|
||||||
b_(b),
|
|
||||||
c_(c)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
template<class Point, class PointRef>
|
template<class Point, class PointRef>
|
||||||
inline Foam::triangle<Point, PointRef>::triangle
|
inline Foam::triangle<Point, PointRef>::triangle
|
||||||
(
|
(
|
||||||
const FixedList<Point, 3>& tri
|
const Point& p0,
|
||||||
|
const Point& p1,
|
||||||
|
const Point& p2
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
a_(tri[0]),
|
a_(p0),
|
||||||
b_(tri[1]),
|
b_(p1),
|
||||||
c_(tri[2])
|
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>
|
template<class Point, class PointRef>
|
||||||
inline Foam::triangle<Point, PointRef>::triangle(Istream& is)
|
inline Foam::triangle<Point, PointRef>::triangle(Istream& is)
|
||||||
{
|
{
|
||||||
@ -82,22 +117,26 @@ inline Foam::triangle<Point, PointRef>::triangle(Istream& is)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Point, class PointRef>
|
inline Foam::triPointRef Foam::triPoints::tri() const
|
||||||
inline const Point& Foam::triangle<Point, PointRef>::a() 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
|
const triangle<Point, PointRef>& t
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
// Format like FixedList
|
||||||
os << nl
|
os << nl
|
||||||
<< token::BEGIN_LIST
|
<< token::BEGIN_LIST
|
||||||
<< t.a_ << token::SPACE
|
<< t.a_ << token::SPACE
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2016-2017 OpenFOAM Foundation
|
Copyright (C) 2016-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -28,16 +28,16 @@ Class
|
|||||||
Foam::Barycentric
|
Foam::Barycentric
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Templated 3D Barycentric derived from VectorSpace. Has 4 components, one of
|
Templated 3D Barycentric derived from VectorSpace.
|
||||||
which is redundant.
|
Has 4 components, one of which is redundant.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
BarycentricI.H
|
BarycentricI.H
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef Barycentric_H
|
#ifndef Foam_Barycentric_H
|
||||||
#define Barycentric_H
|
#define Foam_Barycentric_H
|
||||||
|
|
||||||
#include "contiguous.H"
|
#include "contiguous.H"
|
||||||
#include "VectorSpace.H"
|
#include "VectorSpace.H"
|
||||||
@ -74,7 +74,7 @@ public:
|
|||||||
enum components { A, B, C, D };
|
enum components { A, B, C, D };
|
||||||
|
|
||||||
|
|
||||||
// Generated Methods
|
// Generated Methods: copy construct/assignment
|
||||||
|
|
||||||
//- Default construct
|
//- Default construct
|
||||||
Barycentric() = default;
|
Barycentric() = default;
|
||||||
@ -94,20 +94,29 @@ public:
|
|||||||
const Cmpt& vd
|
const Cmpt& vd
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Construct from three components, calculate fourth component
|
||||||
|
inline Barycentric(const Cmpt& va, const Cmpt& vb, const Cmpt& vc);
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
// Access
|
// Component access
|
||||||
|
|
||||||
inline const Cmpt& a() const;
|
inline const Cmpt& a() const;
|
||||||
inline const Cmpt& b() const;
|
inline const Cmpt& b() const;
|
||||||
inline const Cmpt& c() const;
|
inline const Cmpt& c() const;
|
||||||
inline const Cmpt& d() const;
|
inline const Cmpt& d() const;
|
||||||
|
|
||||||
inline Cmpt& a();
|
inline Cmpt& a();
|
||||||
inline Cmpt& b();
|
inline Cmpt& b();
|
||||||
inline Cmpt& c();
|
inline Cmpt& c();
|
||||||
inline Cmpt& d();
|
inline Cmpt& d();
|
||||||
|
|
||||||
|
|
||||||
|
// Operations
|
||||||
|
|
||||||
|
//- Scalar-product of \c this with another Barycentric.
|
||||||
|
inline Cmpt inner(const Barycentric<Cmpt>& b2) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2016-2017 OpenFOAM Foundation
|
Copyright (C) 2016-2017 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
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 * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Cmpt>
|
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
|
namespace Foam
|
||||||
@ -118,7 +142,7 @@ namespace Foam
|
|||||||
template<class Cmpt>
|
template<class Cmpt>
|
||||||
inline Cmpt operator&(const Barycentric<Cmpt>& b1, const Barycentric<Cmpt>& b2)
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017 OpenFOAM Foundation
|
Copyright (C) 2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -28,18 +28,17 @@ Class
|
|||||||
Foam::BarycentricTensor
|
Foam::BarycentricTensor
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Templated 4x3 tensor derived from VectorSpace. Has 12 components. Can
|
Templated 4x3 tensor derived from VectorSpace. Has 12 components.
|
||||||
represent a barycentric transformation as a matrix-barycentric inner-
|
Can represent a barycentric transformation as a matrix-barycentric
|
||||||
product. Can alternatively represent an inverse barycentric transformation
|
inner-product.
|
||||||
as a vector-matrix inner-product.
|
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
BarycentricTensorI.H
|
BarycentricTensorI.H
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef BarycentricTensor_H
|
#ifndef Foam_BarycentricTensor_H
|
||||||
#define BarycentricTensor_H
|
#define Foam_BarycentricTensor_H
|
||||||
|
|
||||||
#include "Barycentric.H"
|
#include "Barycentric.H"
|
||||||
#include "Tensor.H"
|
#include "Tensor.H"
|
||||||
@ -64,7 +63,8 @@ public:
|
|||||||
// Typedefs
|
// Typedefs
|
||||||
|
|
||||||
//- Equivalent type of labels used for valid component indexing
|
//- Equivalent type of labels used for valid component indexing
|
||||||
typedef Tensor<label> labelType;
|
//- (unused)
|
||||||
|
typedef BarycentricTensor<label> labelType;
|
||||||
|
|
||||||
|
|
||||||
// Member Constants
|
// Member Constants
|
||||||
@ -77,7 +77,7 @@ public:
|
|||||||
enum components { XA, XB, XC, XD, YA, YB, YC, YD, ZA, ZB, ZC, ZD };
|
enum components { XA, XB, XC, XD, YA, YB, YC, YD, ZA, ZB, ZC, ZD };
|
||||||
|
|
||||||
|
|
||||||
// Generated Methods
|
// Generated Methods: copy construct/assignment
|
||||||
|
|
||||||
//- Default construct
|
//- Default construct
|
||||||
BarycentricTensor() = default;
|
BarycentricTensor() = default;
|
||||||
@ -97,6 +97,7 @@ public:
|
|||||||
);
|
);
|
||||||
|
|
||||||
//- Construct given four vector components (columns)
|
//- Construct given four vector components (columns)
|
||||||
|
// Eg, the corners of a tetrahedron
|
||||||
inline BarycentricTensor
|
inline BarycentricTensor
|
||||||
(
|
(
|
||||||
const Vector<Cmpt>& a,
|
const Vector<Cmpt>& a,
|
||||||
@ -108,18 +109,44 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
// Row-barycentric access
|
// Component access
|
||||||
|
|
||||||
inline Barycentric<Cmpt> x() const;
|
inline const Cmpt& xa() const;
|
||||||
inline Barycentric<Cmpt> y() const;
|
inline const Cmpt& xb() const;
|
||||||
inline Barycentric<Cmpt> z() const;
|
inline const Cmpt& xc() const;
|
||||||
|
inline const Cmpt& xd() const;
|
||||||
|
|
||||||
// Column-vector access
|
inline const Cmpt& ya() const;
|
||||||
|
inline const Cmpt& yb() const;
|
||||||
|
inline const Cmpt& yc() const;
|
||||||
|
inline const Cmpt& yd() const;
|
||||||
|
|
||||||
inline Vector<Cmpt> a() const;
|
inline const Cmpt& za() const;
|
||||||
inline Vector<Cmpt> b() const;
|
inline const Cmpt& zb() const;
|
||||||
inline Vector<Cmpt> c() const;
|
inline const Cmpt& zc() const;
|
||||||
inline Vector<Cmpt> d() 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;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017 OpenFOAM Foundation
|
Copyright (C) 2017 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -87,6 +88,90 @@ inline Foam::BarycentricTensor<Cmpt>::BarycentricTensor
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * 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>
|
template<class Cmpt>
|
||||||
inline Foam::Barycentric<Cmpt> Foam::BarycentricTensor<Cmpt>::x() const
|
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
|
namespace Foam
|
||||||
@ -164,17 +269,20 @@ namespace Foam
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Transform Barycentric coordinates to Vector
|
||||||
template<class Cmpt>
|
template<class Cmpt>
|
||||||
inline Vector<Cmpt> operator&
|
inline Vector<Cmpt> operator&
|
||||||
(
|
(
|
||||||
const BarycentricTensor<Cmpt>& T,
|
const BarycentricTensor<Cmpt>& t,
|
||||||
const Barycentric<Cmpt>& b
|
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>
|
template<class Cmpt>
|
||||||
inline Barycentric<Cmpt> operator&
|
inline Barycentric<Cmpt> operator&
|
||||||
(
|
(
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017 OpenFOAM Foundation
|
Copyright (C) 2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -36,8 +36,8 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef Barycentric2D_H
|
#ifndef Foam_Barycentric2D_H
|
||||||
#define Barycentric2D_H
|
#define Foam_Barycentric2D_H
|
||||||
|
|
||||||
#include "contiguous.H"
|
#include "contiguous.H"
|
||||||
#include "VectorSpace.H"
|
#include "VectorSpace.H"
|
||||||
@ -86,33 +86,31 @@ public:
|
|||||||
inline Barycentric2D(const Foam::zero);
|
inline Barycentric2D(const Foam::zero);
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
inline Barycentric2D
|
inline Barycentric2D(const Cmpt& va, const Cmpt& vb, const Cmpt& vc);
|
||||||
(
|
|
||||||
const Cmpt& va,
|
//- Construct from two components, calculating third component
|
||||||
const Cmpt& vb,
|
inline Barycentric2D(const Cmpt& va, const Cmpt& vb);
|
||||||
const Cmpt& vc
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
// Access
|
// Component access
|
||||||
|
|
||||||
inline const Cmpt& a() const;
|
inline const Cmpt& a() const;
|
||||||
inline const Cmpt& b() const;
|
inline const Cmpt& b() const;
|
||||||
inline const Cmpt& c() const;
|
inline const Cmpt& c() const;
|
||||||
|
|
||||||
|
|
||||||
// Edit
|
|
||||||
|
|
||||||
inline Cmpt& a();
|
inline Cmpt& a();
|
||||||
inline Cmpt& b();
|
inline Cmpt& b();
|
||||||
inline Cmpt& c();
|
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;
|
inline bool outside() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017 OpenFOAM Foundation
|
Copyright (C) 2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2019 OpenCFD Ltd.
|
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
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 * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Cmpt>
|
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>
|
template<class Cmpt>
|
||||||
inline bool Foam::Barycentric2D<Cmpt>::outside() const
|
inline bool Foam::Barycentric2D<Cmpt>::outside() const
|
||||||
{
|
{
|
||||||
@ -114,7 +139,7 @@ inline Cmpt operator&
|
|||||||
const Barycentric2D<Cmpt>& b2
|
const Barycentric2D<Cmpt>& b2
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return b1.a()*b2.a() + b1.b()*b2.b() + b1.c()*b2.c();
|
return b1.inner(b2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1069,7 +1069,7 @@ template<class Cmpt>
|
|||||||
// Workaround for gcc (11+) that fails to handle tensor dot vector
|
// Workaround for gcc (11+) that fails to handle tensor dot vector
|
||||||
__attribute__((optimize("no-tree-vectorize")))
|
__attribute__((optimize("no-tree-vectorize")))
|
||||||
#endif
|
#endif
|
||||||
inline typename innerProduct<Tensor<Cmpt>, Vector<Cmpt>>::type
|
inline Vector<Cmpt>
|
||||||
operator&(const Tensor<Cmpt>& t, const Vector<Cmpt>& v)
|
operator&(const Tensor<Cmpt>& t, const Vector<Cmpt>& v)
|
||||||
{
|
{
|
||||||
return Vector<Cmpt>
|
return Vector<Cmpt>
|
||||||
@ -1083,7 +1083,7 @@ operator&(const Tensor<Cmpt>& t, const Vector<Cmpt>& v)
|
|||||||
|
|
||||||
//- Inner-product of a Vector and a Tensor
|
//- Inner-product of a Vector and a Tensor
|
||||||
template<class Cmpt>
|
template<class Cmpt>
|
||||||
inline typename innerProduct<Vector<Cmpt>, Tensor<Cmpt>>::type
|
inline Vector<Cmpt>
|
||||||
operator&(const Vector<Cmpt>& v, const Tensor<Cmpt>& t)
|
operator&(const Vector<Cmpt>& v, const Tensor<Cmpt>& t)
|
||||||
{
|
{
|
||||||
return Vector<Cmpt>
|
return Vector<Cmpt>
|
||||||
|
|||||||
@ -30,7 +30,7 @@ Class
|
|||||||
Description
|
Description
|
||||||
Templated 3D Vector derived from VectorSpace adding construction from
|
Templated 3D Vector derived from VectorSpace adding construction from
|
||||||
3 components, element access using x(), y() and z() member functions and
|
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
|
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
|
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
|
//- Access to the vector z component
|
||||||
inline Cmpt& z();
|
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
|
//- Inplace normalise the vector by its magnitude
|
||||||
// For small magnitudes (less than ROOTVSMALL) set to zero.
|
// For small magnitudes (less than ROOTVSMALL) set to zero.
|
||||||
// Will not be particularly useful for a vector of labels
|
// Will not be particularly useful for a vector of labels
|
||||||
@ -139,12 +148,11 @@ public:
|
|||||||
//- unit vector.
|
//- unit vector.
|
||||||
inline Vector<Cmpt>& removeCollinear(const Vector<Cmpt>& unitVec);
|
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>.
|
//- Cross-product of \c this with another Vector.
|
||||||
inline const Vector<Cmpt>& centre
|
inline Vector<Cmpt> cross(const Vector<Cmpt>& v2) const;
|
||||||
(
|
|
||||||
const Foam::UList<Vector<Cmpt>>& /* (unused) */
|
|
||||||
) const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -113,7 +113,7 @@ template<class Cmpt>
|
|||||||
inline const Foam::Vector<Cmpt>& Foam::Vector<Cmpt>::centre
|
inline const Foam::Vector<Cmpt>& Foam::Vector<Cmpt>::centre
|
||||||
(
|
(
|
||||||
const Foam::UList<Vector<Cmpt>>&
|
const Foam::UList<Vector<Cmpt>>&
|
||||||
) const
|
) const noexcept
|
||||||
{
|
{
|
||||||
return *this;
|
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 * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
@ -153,8 +179,9 @@ namespace Foam
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
//- Dummy innerProduct for scalar to allow the construction of vtables for
|
//- Dummy innerProduct for scalar
|
||||||
// virtual member functions involving the inner-products of fields
|
// Allows the construction of vtables for virtual member functions
|
||||||
|
// involving the inner-products of fields
|
||||||
// for which a "NotImplemented" specialization for scalar is provided.
|
// for which a "NotImplemented" specialization for scalar is provided.
|
||||||
template<class Cmpt>
|
template<class Cmpt>
|
||||||
class innerProduct<Vector<Cmpt>, scalar>
|
class innerProduct<Vector<Cmpt>, scalar>
|
||||||
@ -166,22 +193,16 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
template<class Cmpt>
|
template<class Cmpt>
|
||||||
inline typename innerProduct<Vector<Cmpt>, Vector<Cmpt>>::type
|
inline Cmpt operator&(const Vector<Cmpt>& v1, const Vector<Cmpt>& v2)
|
||||||
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>
|
template<class Cmpt>
|
||||||
inline Vector<Cmpt> operator^(const Vector<Cmpt>& v1, const Vector<Cmpt>& v2)
|
inline Vector<Cmpt> operator^(const Vector<Cmpt>& v1, const Vector<Cmpt>& v2)
|
||||||
{
|
{
|
||||||
return Vector<Cmpt>
|
return v1.cross(v2);
|
||||||
(
|
|
||||||
(v1.y()*v2.z() - v1.z()*v2.y()),
|
|
||||||
(v1.z()*v2.x() - v1.x()*v2.z()),
|
|
||||||
(v1.x()*v2.y() - v1.y()*v2.x())
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -125,8 +125,7 @@ namespace Foam
|
|||||||
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Cmpt>
|
template<class Cmpt>
|
||||||
inline typename innerProduct<Vector2D<Cmpt>, Vector2D<Cmpt>>::type
|
inline Cmpt operator&(const Vector2D<Cmpt>& v1, const Vector2D<Cmpt>& v2)
|
||||||
operator&(const Vector2D<Cmpt>& v1, const Vector2D<Cmpt>& v2)
|
|
||||||
{
|
{
|
||||||
return Cmpt(v1.x()*v2.x() + v1.y()*v2.y());
|
return Cmpt(v1.x()*v2.x() + v1.y()*v2.y());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,8 +39,8 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef VectorSpace_H
|
#ifndef Foam_VectorSpace_H
|
||||||
#define VectorSpace_H
|
#define Foam_VectorSpace_H
|
||||||
|
|
||||||
#include "direction.H"
|
#include "direction.H"
|
||||||
#include "scalar.H"
|
#include "scalar.H"
|
||||||
|
|||||||
@ -28,8 +28,8 @@ License
|
|||||||
|
|
||||||
#include "polyMeshGeometry.H"
|
#include "polyMeshGeometry.H"
|
||||||
#include "polyMeshTetDecomposition.H"
|
#include "polyMeshTetDecomposition.H"
|
||||||
#include "pyramidPointFaceRef.H"
|
#include "pyramid.H"
|
||||||
#include "tetPointRef.H"
|
#include "tetrahedron.H"
|
||||||
#include "syncTools.H"
|
#include "syncTools.H"
|
||||||
#include "unitConversion.H"
|
#include "unitConversion.H"
|
||||||
#include "primitiveMeshTools.H"
|
#include "primitiveMeshTools.H"
|
||||||
|
|||||||
@ -34,7 +34,7 @@ License
|
|||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
#include "edgeHashes.H"
|
#include "edgeHashes.H"
|
||||||
#include "syncTools.H"
|
#include "syncTools.H"
|
||||||
#include "triPointRef.H"
|
#include "triangle.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|||||||
@ -33,7 +33,7 @@ License
|
|||||||
#include "enrichedPatch.H"
|
#include "enrichedPatch.H"
|
||||||
#include "DynamicList.H"
|
#include "DynamicList.H"
|
||||||
#include "pointHit.H"
|
#include "pointHit.H"
|
||||||
#include "triPointRef.H"
|
#include "triangle.H"
|
||||||
#include "plane.H"
|
#include "plane.H"
|
||||||
#include "polyTopoChanger.H"
|
#include "polyTopoChanger.H"
|
||||||
#include "polyAddPoint.H"
|
#include "polyAddPoint.H"
|
||||||
|
|||||||
@ -35,14 +35,14 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef OBJstream_H
|
#ifndef Foam_OBJstream_H
|
||||||
#define OBJstream_H
|
#define Foam_OBJstream_H
|
||||||
|
|
||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
#include "point.H"
|
#include "point.H"
|
||||||
#include "edge.H"
|
#include "edge.H"
|
||||||
#include "face.H"
|
#include "face.H"
|
||||||
#include "triPointRef.H"
|
#include "triangle.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2016-2017 OpenCFD Ltd.
|
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -35,9 +35,10 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef STLtriangle_H
|
#ifndef Foam_STLtriangle_H
|
||||||
#define STLtriangle_H
|
#define Foam_STLtriangle_H
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
#include "STLpoint.H"
|
#include "STLpoint.H"
|
||||||
#include "Istream.H"
|
#include "Istream.H"
|
||||||
#include "Ostream.H"
|
#include "Ostream.H"
|
||||||
@ -60,7 +61,7 @@ class STLtriangle
|
|||||||
// Typedefs
|
// Typedefs
|
||||||
|
|
||||||
//- Attribute is 16-bit
|
//- Attribute is 16-bit
|
||||||
typedef unsigned short STLattrib;
|
typedef uint16_t STLattrib;
|
||||||
|
|
||||||
// Private data
|
// Private data
|
||||||
// NB: The order of the members (1 normal, 3 points, 1 attribute) is
|
// NB: The order of the members (1 normal, 3 points, 1 attribute) is
|
||||||
@ -78,8 +79,8 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Default construct
|
||||||
inline STLtriangle();
|
STLtriangle() = default;
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
inline STLtriangle
|
inline STLtriangle
|
||||||
@ -88,7 +89,7 @@ public:
|
|||||||
const STLpoint& a,
|
const STLpoint& a,
|
||||||
const STLpoint& b,
|
const STLpoint& b,
|
||||||
const STLpoint& c,
|
const STLpoint& c,
|
||||||
unsigned short attrib
|
uint16_t attrib
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from istream (read binary)
|
//- Construct from istream (read binary)
|
||||||
@ -99,11 +100,11 @@ public:
|
|||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
inline const STLpoint& normal() const;
|
const STLpoint& normal() const noexcept { return normal_; }
|
||||||
inline const STLpoint& a() const;
|
const STLpoint& a() const noexcept { return a_; }
|
||||||
inline const STLpoint& b() const;
|
const STLpoint& b() const noexcept { return b_; }
|
||||||
inline const STLpoint& c() const;
|
const STLpoint& c() const noexcept { return c_; }
|
||||||
inline unsigned short attrib() const;
|
uint16_t attrib() const noexcept { return attrib_; }
|
||||||
|
|
||||||
|
|
||||||
// Read
|
// Read
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011 OpenFOAM Foundation
|
Copyright (C) 2011 OpenFOAM Foundation
|
||||||
Copyright (C) 2016 OpenCFD Ltd.
|
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -26,21 +26,17 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "triPointRef.H"
|
#include "triangle.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline Foam::STLtriangle::STLtriangle()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
inline Foam::STLtriangle::STLtriangle
|
inline Foam::STLtriangle::STLtriangle
|
||||||
(
|
(
|
||||||
const STLpoint& normal,
|
const STLpoint& normal,
|
||||||
const STLpoint& a,
|
const STLpoint& a,
|
||||||
const STLpoint& b,
|
const STLpoint& b,
|
||||||
const STLpoint& c,
|
const STLpoint& c,
|
||||||
unsigned short attrib
|
uint16_t attrib
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
normal_(normal),
|
normal_(normal),
|
||||||
@ -59,36 +55,6 @@ inline Foam::STLtriangle::STLtriangle(std::istream& is)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * 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)
|
inline void Foam::STLtriangle::read(std::istream& is)
|
||||||
{
|
{
|
||||||
is.read(reinterpret_cast<char*>(&normal_), 4*sizeof(STLpoint));
|
is.read(reinterpret_cast<char*>(&normal_), 4*sizeof(STLpoint));
|
||||||
|
|||||||
@ -32,7 +32,7 @@ License
|
|||||||
#include "stringIOList.H"
|
#include "stringIOList.H"
|
||||||
#include "cellModel.H"
|
#include "cellModel.H"
|
||||||
#include "vectorIOField.H"
|
#include "vectorIOField.H"
|
||||||
#include "triPointRef.H"
|
#include "triangle.H"
|
||||||
#include "stringOps.H"
|
#include "stringOps.H"
|
||||||
|
|
||||||
/* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */
|
/* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */
|
||||||
|
|||||||
@ -37,7 +37,7 @@ License
|
|||||||
#include "processorFaPatchFields.H"
|
#include "processorFaPatchFields.H"
|
||||||
#include "emptyFaPatchFields.H"
|
#include "emptyFaPatchFields.H"
|
||||||
#include "wedgeFaPatch.H"
|
#include "wedgeFaPatch.H"
|
||||||
#include "triPointRef.H"
|
#include "triangle.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,6 @@ License
|
|||||||
|
|
||||||
#include "FreeStream.H"
|
#include "FreeStream.H"
|
||||||
#include "constants.H"
|
#include "constants.H"
|
||||||
#include "triPointRef.H"
|
|
||||||
#include "tetIndices.H"
|
#include "tetIndices.H"
|
||||||
|
|
||||||
using namespace Foam::constant::mathematical;
|
using namespace Foam::constant::mathematical;
|
||||||
|
|||||||
@ -32,8 +32,8 @@ Description
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef particle_H
|
#ifndef Foam_particle_H
|
||||||
#define particle_H
|
#define Foam_particle_H
|
||||||
|
|
||||||
#include "vector.H"
|
#include "vector.H"
|
||||||
#include "barycentric.H"
|
#include "barycentric.H"
|
||||||
@ -43,7 +43,6 @@ Description
|
|||||||
#include "pointField.H"
|
#include "pointField.H"
|
||||||
#include "faceList.H"
|
#include "faceList.H"
|
||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
#include "tetPointRef.H"
|
|
||||||
#include "FixedList.H"
|
#include "FixedList.H"
|
||||||
#include "polyMeshTetDecomposition.H"
|
#include "polyMeshTetDecomposition.H"
|
||||||
#include "particleMacros.H"
|
#include "particleMacros.H"
|
||||||
|
|||||||
@ -29,7 +29,7 @@ License
|
|||||||
#include "polyMesh.H"
|
#include "polyMesh.H"
|
||||||
#include "SubField.H"
|
#include "SubField.H"
|
||||||
#include "Random.H"
|
#include "Random.H"
|
||||||
#include "triPointRef.H"
|
#include "triangle.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
#include "polyMeshTetDecomposition.H"
|
#include "polyMeshTetDecomposition.H"
|
||||||
|
|
||||||
|
|||||||
@ -41,7 +41,7 @@ License
|
|||||||
#include "indexedOctree.H"
|
#include "indexedOctree.H"
|
||||||
#include "snapParameters.H"
|
#include "snapParameters.H"
|
||||||
#include "PatchTools.H"
|
#include "PatchTools.H"
|
||||||
#include "pyramidPointFaceRef.H"
|
#include "pyramid.H"
|
||||||
#include "localPointRegion.H"
|
#include "localPointRegion.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -31,7 +31,7 @@ License
|
|||||||
#include "mapDistribute.H"
|
#include "mapDistribute.H"
|
||||||
#include "flipOp.H"
|
#include "flipOp.H"
|
||||||
#include "profiling.H"
|
#include "profiling.H"
|
||||||
#include "triPointRef.H"
|
#include "triangle.H"
|
||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -44,7 +44,7 @@ SourceFiles
|
|||||||
#include "FixedList.H"
|
#include "FixedList.H"
|
||||||
#include "plane.H"
|
#include "plane.H"
|
||||||
#include "face.H"
|
#include "face.H"
|
||||||
#include "triPoints.H"
|
#include "triangle.H"
|
||||||
#include "Enum.H"
|
#include "Enum.H"
|
||||||
#include "searchableSurface.H"
|
#include "searchableSurface.H"
|
||||||
|
|
||||||
|
|||||||
@ -35,11 +35,11 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef treeDataEdge_H
|
#ifndef Foam_treeDataEdge_H
|
||||||
#define treeDataEdge_H
|
#define Foam_treeDataEdge_H
|
||||||
|
|
||||||
#include "treeBoundBoxList.H"
|
#include "treeBoundBoxList.H"
|
||||||
#include "linePointRef.H"
|
#include "line.H"
|
||||||
#include "volumeType.H"
|
#include "volumeType.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -47,7 +47,7 @@ SourceFiles
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Forward declaration of classes
|
// Forward Declarations
|
||||||
template<class Type> class indexedOctree;
|
template<class Type> class indexedOctree;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
|
|||||||
@ -40,12 +40,12 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef treeDataPoint_H
|
#ifndef Foam_treeDataPoint_H
|
||||||
#define treeDataPoint_H
|
#define Foam_treeDataPoint_H
|
||||||
|
|
||||||
#include "pointField.H"
|
#include "pointField.H"
|
||||||
#include "treeBoundBox.H"
|
#include "treeBoundBox.H"
|
||||||
#include "linePointRef.H"
|
#include "line.H"
|
||||||
#include "volumeType.H"
|
#include "volumeType.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -53,7 +53,7 @@ SourceFiles
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Forward declarations
|
// Forward Declarations
|
||||||
template<class Type> class indexedOctree;
|
template<class Type> class indexedOctree;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
|
|||||||
@ -42,7 +42,7 @@ License
|
|||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "mapDistribute.H"
|
#include "mapDistribute.H"
|
||||||
#include "SubField.H"
|
#include "SubField.H"
|
||||||
#include "triPointRef.H"
|
#include "triangle.H"
|
||||||
#include "syncTools.H"
|
#include "syncTools.H"
|
||||||
#include "treeDataCell.H"
|
#include "treeDataCell.H"
|
||||||
#include "DynamicField.H"
|
#include "DynamicField.H"
|
||||||
|
|||||||
@ -27,9 +27,9 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "primitiveMeshGeometry.H"
|
#include "primitiveMeshGeometry.H"
|
||||||
#include "pyramidPointFaceRef.H"
|
#include "pyramid.H"
|
||||||
#include "unitConversion.H"
|
#include "unitConversion.H"
|
||||||
#include "triPointRef.H"
|
#include "triangle.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|||||||
@ -41,15 +41,15 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef searchableSurface_H
|
#ifndef Foam_searchableSurface_H
|
||||||
#define searchableSurface_H
|
#define Foam_searchableSurface_H
|
||||||
|
|
||||||
#include "pointField.H"
|
#include "pointField.H"
|
||||||
#include "boundBox.H"
|
#include "boundBox.H"
|
||||||
#include "typeInfo.H"
|
#include "typeInfo.H"
|
||||||
#include "runTimeSelectionTables.H"
|
#include "runTimeSelectionTables.H"
|
||||||
#include "pointIndexHit.H"
|
#include "pointIndexHit.H"
|
||||||
#include "linePointRef.H"
|
#include "line.H"
|
||||||
#include "objectRegistry.H"
|
#include "objectRegistry.H"
|
||||||
#include "volumeType.H"
|
#include "volumeType.H"
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ SourceFiles
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Forward declarations
|
// Forward Declarations
|
||||||
class objectRegistry;
|
class objectRegistry;
|
||||||
class mapDistribute;
|
class mapDistribute;
|
||||||
class treeBoundBox;
|
class treeBoundBox;
|
||||||
|
|||||||
@ -28,7 +28,6 @@ License
|
|||||||
|
|
||||||
#include "tetOverlapVolume.H"
|
#include "tetOverlapVolume.H"
|
||||||
#include "tetrahedron.H"
|
#include "tetrahedron.H"
|
||||||
#include "tetPoints.H"
|
|
||||||
#include "polyMesh.H"
|
#include "polyMesh.H"
|
||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
#include "treeBoundBox.H"
|
#include "treeBoundBox.H"
|
||||||
@ -43,12 +42,6 @@ namespace Foam
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::tetOverlapVolume::tetOverlapVolume()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::treeBoundBox Foam::tetOverlapVolume::pyrBb
|
Foam::treeBoundBox Foam::tetOverlapVolume::pyrBb
|
||||||
|
|||||||
@ -35,8 +35,8 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef tetOverlapVolume_H
|
#ifndef Foam_tetOverlapVolume_H
|
||||||
#define tetOverlapVolume_H
|
#define Foam_tetOverlapVolume_H
|
||||||
|
|
||||||
#include "FixedList.H"
|
#include "FixedList.H"
|
||||||
#include "labelList.H"
|
#include "labelList.H"
|
||||||
@ -47,6 +47,7 @@ SourceFiles
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// Forward Declarations
|
||||||
class primitiveMesh;
|
class primitiveMesh;
|
||||||
class polyMesh;
|
class polyMesh;
|
||||||
|
|
||||||
@ -56,7 +57,7 @@ class polyMesh;
|
|||||||
|
|
||||||
class tetOverlapVolume
|
class tetOverlapVolume
|
||||||
{
|
{
|
||||||
// Private classes
|
// Private Classes
|
||||||
|
|
||||||
//- tetPoints handling : sum resulting volumes
|
//- tetPoints handling : sum resulting volumes
|
||||||
class sumMomentOp
|
class sumMomentOp
|
||||||
@ -184,14 +185,14 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Null constructor
|
//- Default construct
|
||||||
tetOverlapVolume();
|
tetOverlapVolume() = default;
|
||||||
|
|
||||||
|
|
||||||
// Public members
|
// Public members
|
||||||
|
|
||||||
//- Return a list of cells in meshA which overlaps with cellBI in
|
//- Return a list of cells in meshA which overlaps with cellBI in
|
||||||
// meshB
|
//- meshB
|
||||||
labelList overlappingCells
|
labelList overlappingCells
|
||||||
(
|
(
|
||||||
const polyMesh& meshA,
|
const polyMesh& meshA,
|
||||||
|
|||||||
@ -32,7 +32,6 @@ License
|
|||||||
#include "treeDataEdge.H"
|
#include "treeDataEdge.H"
|
||||||
#include "treeDataPoint.H"
|
#include "treeDataPoint.H"
|
||||||
#include "meshTools.H"
|
#include "meshTools.H"
|
||||||
#include "linePointRef.H"
|
|
||||||
#include "Fstream.H"
|
#include "Fstream.H"
|
||||||
#include "unitConversion.H"
|
#include "unitConversion.H"
|
||||||
#include "edgeHashes.H"
|
#include "edgeHashes.H"
|
||||||
|
|||||||
@ -49,7 +49,7 @@ SourceFiles
|
|||||||
#define surfaceLocation_H
|
#define surfaceLocation_H
|
||||||
|
|
||||||
#include "pointIndexHit.H"
|
#include "pointIndexHit.H"
|
||||||
#include "triPointRef.H"
|
#include "triangle.H"
|
||||||
#include "InfoProxy.H"
|
#include "InfoProxy.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -61,7 +61,7 @@ SourceFiles
|
|||||||
#include "FixedList.H"
|
#include "FixedList.H"
|
||||||
#include "Pair.H"
|
#include "Pair.H"
|
||||||
#include "vector2D.H"
|
#include "vector2D.H"
|
||||||
#include "triPointRef.H"
|
#include "triangle.H"
|
||||||
#include "surfaceLocation.H"
|
#include "surfaceLocation.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -69,7 +69,7 @@ SourceFiles
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Forward declaration of classes
|
// Forward Declarations
|
||||||
class boundBox;
|
class boundBox;
|
||||||
class edge;
|
class edge;
|
||||||
class labelledTri;
|
class labelledTri;
|
||||||
|
|||||||
@ -27,11 +27,11 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "triangleFuncs.H"
|
#include "triangleFuncs.H"
|
||||||
|
#include "triangle.H"
|
||||||
#include "pointField.H"
|
#include "pointField.H"
|
||||||
#include "treeBoundBox.H"
|
#include "treeBoundBox.H"
|
||||||
#include "SortableList.H"
|
#include "SortableList.H"
|
||||||
#include "boolList.H"
|
#include "boolList.H"
|
||||||
#include "triPointRef.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|||||||
@ -35,8 +35,8 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef triangleFuncs_H
|
#ifndef Foam_triangleFuncs_H
|
||||||
#define triangleFuncs_H
|
#define Foam_triangleFuncs_H
|
||||||
|
|
||||||
#include "pointField.H"
|
#include "pointField.H"
|
||||||
|
|
||||||
|
|||||||
@ -36,7 +36,7 @@ License
|
|||||||
#include "triSurface.H"
|
#include "triSurface.H"
|
||||||
#include "triSurfaceTools.H"
|
#include "triSurfaceTools.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "triPoints.H"
|
#include "triangle.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|||||||
@ -32,7 +32,7 @@ License
|
|||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
#include "triSurfaceTools.H"
|
#include "triSurfaceTools.H"
|
||||||
#include "triSurface.H"
|
#include "triSurface.H"
|
||||||
#include "triPoints.H"
|
#include "triangle.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|||||||
@ -31,7 +31,6 @@ License
|
|||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
#include "edgeHashes.H"
|
#include "edgeHashes.H"
|
||||||
#include "tetCell.H"
|
#include "tetCell.H"
|
||||||
#include "tetPointRef.H"
|
|
||||||
#include "DynamicField.H"
|
#include "DynamicField.H"
|
||||||
#include "syncTools.H"
|
#include "syncTools.H"
|
||||||
#include "indirectPrimitivePatch.H"
|
#include "indirectPrimitivePatch.H"
|
||||||
|
|||||||
@ -27,7 +27,7 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "STLsurfaceFormat.H"
|
#include "STLsurfaceFormat.H"
|
||||||
#include "triPointRef.H"
|
#include "triangle.H"
|
||||||
#include "ListOps.H"
|
#include "ListOps.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|||||||
Reference in New Issue
Block a user