50 Foam::scalar Foam::tetOverlapVolume::tetTetOverlapVol
61 typedef cutTetList<27> tetListType;
62 static tetListType cutTetList1, cutTetList2;
65 const plane pl0(tetB.
b(), tetB.
d(), tetB.
c());
70 const FixedList<point, 4> t({tetA.
a(), tetA.
b(), tetA.
c(), tetA.
d()});
72 tetCut(t, pl0, cutTriTet::appendOp<tetListType>(cutTetList1), noOp());
73 if (cutTetList1.size() == 0)
79 const plane pl1(tetB.
a(), tetB.
c(), tetB.
d());
85 for (
label i = 0; i < cutTetList1.size(); i++)
87 const FixedList<point, 4>& t = cutTetList1[i];
88 tetCut(t, pl1, cutTriTet::appendOp<tetListType>(cutTetList2), noOp());
90 if (cutTetList2.size() == 0)
96 const plane pl2(tetB.
a(), tetB.
d(), tetB.
b());
102 for (
label i = 0; i < cutTetList2.size(); i++)
104 const FixedList<point, 4>& t = cutTetList2[i];
105 tetCut(t, pl2, cutTriTet::appendOp<tetListType>(cutTetList1), noOp());
107 if (cutTetList1.size() == 0)
113 const plane pl3(tetB.
a(), tetB.
b(), tetB.
c());
119 for (
label i = 0; i < cutTetList1.size(); i++)
121 const FixedList<point, 4>& t = cutTetList1[i];
122 v +=
tetCut(t, pl3, cutTriTet::volumeOp(), noOp());
136 treeBoundBox bb(fc, fc);
140 bb.min() =
min(bb.min(), pt);
141 bb.max() =
max(bb.max(), pt);
160 return treeA.findBox(bbB);
170 const cell& cFaces = mesh.
cells()[cellI];
177 label faceI = cFaces[cF];
181 bool own = (mesh.
faceOwner()[faceI] == cellI);
183 label tetBasePtI = 0;
187 for (
label tetPtI = 1; tetPtI <
f.
size() - 1; tetPtI++)
189 label facePtI = (tetPtI + tetBasePtI) %
f.
size();
198 pt1I =
f[otherFacePtI];
202 pt0I =
f[otherFacePtI];
229 const scalar threshold
232 const cell& cFacesA = meshA.
cells()[cellAI];
235 const cell& cFacesB = meshB.
cells()[cellBI];
242 label faceAI = cFacesA[cFA];
251 bool ownA = (meshA.
faceOwner()[faceAI] == cellAI);
253 label tetBasePtAI = 0;
255 const point& tetBasePtA = meshA.
points()[fA[tetBasePtAI]];
257 for (
label tetPtI = 1; tetPtI < fA.
size() - 1; tetPtI++)
259 label facePtAI = (tetPtI + tetBasePtAI) % fA.
size();
268 pt1I = fA[otherFacePtAI];
272 pt0I = fA[otherFacePtAI];
289 label faceBI = cFacesB[cFB];
298 bool ownB = (meshB.
faceOwner()[faceBI] == cellBI);
300 label tetBasePtBI = 0;
302 const point& tetBasePtB = meshB.
points()[fB[tetBasePtBI]];
304 for (
label tetPtI = 1; tetPtI < fB.
size() - 1; tetPtI++)
306 label facePtBI = (tetPtI + tetBasePtBI) % fB.
size();
315 pt1I = fB[otherFacePtBI];
319 pt0I = fB[otherFacePtBI];
336 vol += tetTetOverlapVol(tetA, tetB);
360 const cell& cFacesA = meshA.
cells()[cellAI];
363 const cell& cFacesB = meshB.
cells()[cellBI];
370 label faceAI = cFacesA[cFA];
379 bool ownA = (meshA.
faceOwner()[faceAI] == cellAI);
381 label tetBasePtAI = 0;
383 const point& tetBasePtA = meshA.
points()[fA[tetBasePtAI]];
385 for (
label tetPtI = 1; tetPtI < fA.
size() - 1; tetPtI++)
387 label facePtAI = (tetPtI + tetBasePtAI) % fA.
size();
396 pt1I = fA[otherFacePtAI];
400 pt0I = fA[otherFacePtAI];
417 label faceBI = cFacesB[cFB];
426 bool ownB = (meshB.
faceOwner()[faceBI] == cellBI);
428 label tetBasePtBI = 0;
430 const point& tetBasePtB = meshB.
points()[fB[tetBasePtBI]];
432 for (
label tetPtI = 1; tetPtI < fB.
size() - 1; tetPtI++)
434 label facePtBI = (tetPtI + tetBasePtBI) % fB.
size();
443 pt1I = fB[otherFacePtBI];
447 pt0I = fB[otherFacePtBI];
463 vol += tetTetOverlapVol(tetA, tetB);
#define forAll(list, i)
Loop across all elements in list.
void size(const label)
Override size to be inconsistent with allocated storage.
label fcIndex(const label i) const
Return the forward circular index, i.e. the next index.
bool overlaps(const boundBox &) const
Overlaps/touches boundingBox?
A cell is defined as a list of faces with extra functionality.
A face is a list of labels corresponding to mesh vertices.
Non-pointer based hierarchical recursive searching.
Geometric class that creates a 2D plane and can return the intersection point between a line and the ...
Mesh consisting of general polyhedral cells.
virtual const pointField & points() const
Return raw points.
const indexedOctree< treeDataCell > & cellTree() const
Return the cell search tree.
Cell-face mesh analysis engine.
virtual const faceList & faces() const =0
Return faces.
const vectorField & cellCentres() const
virtual const labelList & faceOwner() const =0
Face face-owner addressing.
const labelListList & cellPoints() const
virtual const pointField & points() const =0
Return mesh points.
const cellList & cells() const
Calculates the overlap volume of two cells using tetrahedral decomposition.
scalar cellCellOverlapVolumeMinDecomp(const primitiveMesh &meshA, const label cellAI, const primitiveMesh &meshB, const label cellBI, const treeBoundBox &cellBbB) const
Calculates the overlap volume.
scalar cellVolumeMinDecomp(const primitiveMesh &mesh, const label celli) const
Calculates the cell volume.
labelList overlappingCells(const polyMesh &meshA, const polyMesh &meshB, const label cellBI) const
Return a list of cells in meshA which overlaps with cellBI in.
bool cellCellOverlapMinDecomp(const primitiveMesh &meshA, const label cellAI, const primitiveMesh &meshB, const label cellBI, const treeBoundBox &cellBbB, const scalar threshold=0.0) const
Return true if olverlap volume is greater than threshold.
tetOverlapVolume()
Null constructor.
boundBox bounds() const
Calculate the bounding box.
const Point & a() const
Return vertices.
scalar mag() const
Return volume.
Standard boundBox + extra functionality for use in octree.
bool overlaps(const boundBox &) const
Overlaps other bounding box?
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
vectorField pointField
pointField is a vectorField.
vector point
Point is a vector.
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
defineTypeNameAndDebug(combustionModel, 0)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
cutTriTet::opAddResult< AboveOp, BelowOp >::type tetCut(const FixedList< Point, 4 > &tet, const FixedList< scalar, 4 > &level, const AboveOp &aboveOp, const BelowOp &belowOp)
As triCut, but for a tetrahedron.