53 void Foam::tetDecomposer::modifyFace
55 polyTopoChange& meshMod,
66 if (nei == -1 || own < nei)
97 void Foam::tetDecomposer::addFace
99 polyTopoChange& meshMod,
103 const label masterPointID,
104 const label masterEdgeID,
105 const label masterFaceID,
112 if (nei == -1 || own < nei)
151 const face&
f = mesh_.faces()[facei];
152 const label fp0 = mesh_.tetBasePtIs()[facei];
162 thisTriI =
f.
size()-3;
166 thisTriI = (fp-fp0-1) % (
f.
size()-2);
188 cellToPoint_.setSize(mesh_.nCells());
189 forAll(mesh_.cellCentres(), celli)
192 label masterPointi = mesh_.faces()[mesh_.cells()[celli][0]][0];
194 cellToPoint_[celli] = meshMod.
addPoint
196 mesh_.cellCentres()[celli],
205 if (decomposeType == FACE_CENTRE_TRIS)
207 faceToPoint_.setSize(mesh_.nFaces());
208 forAll(mesh_.faceCentres(), facei)
211 const label masterPointi = mesh_.faces()[facei][0];
213 faceToPoint_[facei] = meshMod.
addPoint
215 mesh_.faceCentres()[facei],
225 faceOwnerCells_.setSize(mesh_.nFaces());
226 faceNeighbourCells_.setSize(mesh_.nFaces());
228 if (decomposeType == FACE_CENTRE_TRIS)
230 forAll(faceOwnerCells_, facei)
232 const face&
f = mesh_.faces()[facei];
234 faceNeighbourCells_[facei].setSize(
f.
size(), -1);
240 (void)mesh_.tetBasePtIs();
242 forAll(faceOwnerCells_, facei)
244 const face&
f = mesh_.faces()[facei];
246 faceNeighbourCells_[facei].setSize(
f.
size()-2, -1);
251 forAll(mesh_.cells(), celli)
253 const cell& cFaces = mesh_.cells()[celli];
259 label facei = cFaces[cFacei];
260 const face&
f = mesh_.faces()[facei];
265 (mesh_.faceOwner()[facei] == celli)
266 ? faceOwnerCells_[facei]
267 : faceNeighbourCells_[facei]
270 if (decomposeType == FACE_CENTRE_TRIS)
274 if (cFacei == 0 && fp == 0)
287 mesh_.cellZones().whichZone(celli)
294 for (
label triI = 0; triI <
f.
size()-2; triI++)
296 if (cFacei == 0 && triI == 0)
309 mesh_.cellZones().whichZone(celli)
322 forAll(mesh_.faces(), facei)
324 label own = mesh_.faceOwner()[facei];
325 const labelList& addedOwn = faceOwnerCells_[facei];
326 const labelList& addedNei = faceNeighbourCells_[facei];
327 const face&
f = mesh_.faces()[facei];
330 if (facei >= mesh_.nInternalFaces())
332 patchi = mesh_.boundaryMesh().whichPatch(facei);
335 label zoneI = mesh_.faceZones().whichZone(facei);
336 bool zoneFlip =
false;
339 const faceZone& fz = mesh_.faceZones()[zoneI];
344 if (decomposeType == FACE_CENTRE_TRIS)
391 label newNei = addedOwn[fp];
412 if (facei < mesh_.nInternalFaces())
415 label newNei = addedNei[fp];
419 triangle[2] = cellToPoint_[mesh_.faceNeighbour()[facei]];
439 label fp0 = mesh_.tetBasePtIs()[facei];
442 for (
label triI = 0; triI <
f.
size()-2; triI++)
444 label nextTri = triI+1;
445 if (nextTri >=
f.
size()-2)
447 nextTri -=
f.
size()-2;
496 if (triI <
f.
size()-3)
498 label newOwn = addedOwn[triI];
499 label newNei = addedOwn[nextTri];
520 if (facei < mesh_.nInternalFaces())
522 label newOwn = addedNei[triI];
523 label newNei = addedNei[nextTri];
528 cellToPoint_[mesh_.faceNeighbour()[facei]];
557 forAll(mesh_.cells(), celli)
559 const cell& cFaces = mesh_.cells()[celli];
565 label facei = cFaces[cFacei];
567 label zoneI = mesh_.faceZones().whichZone(facei);
568 bool zoneFlip =
false;
571 const faceZone& fz = mesh_.faceZones()[zoneI];
575 const face&
f = mesh_.faces()[facei];
581 const edge e(p0, p1);
584 if (edgeFnd == edgeToFace.
end())
591 label otherFacei = edgeFnd();
592 const face& otherF = mesh_.faces()[otherFacei];
603 else if (otherF.
prevLabel(otherFp) == p1)
605 otherFp = otherF.
rcIndex(otherFp);
615 if (mesh_.faceOwner()[facei] == celli)
629 label thisTet, otherTet;
631 if (decomposeType == FACE_CENTRE_TRIS)
633 if (mesh_.faceOwner()[facei] == celli)
635 thisTet = faceOwnerCells_[facei][fp];
639 thisTet = faceNeighbourCells_[facei][fp];
642 if (mesh_.faceOwner()[otherFacei] == celli)
644 otherTet = faceOwnerCells_[otherFacei][otherFp];
649 faceNeighbourCells_[otherFacei][otherFp];
654 label thisTriI = triIndex(facei, fp);
655 if (mesh_.faceOwner()[facei] == celli)
657 thisTet = faceOwnerCells_[facei][thisTriI];
661 thisTet = faceNeighbourCells_[facei][thisTriI];
664 label otherTriI = triIndex(otherFacei, otherFp);
665 if (mesh_.faceOwner()[otherFacei] == celli)
667 otherTet = faceOwnerCells_[otherFacei][otherTriI];
672 faceNeighbourCells_[otherFacei][otherTriI];
702 forAll(faceOwnerCells_, facei)
706 forAll(faceNeighbourCells_, facei)
#define forAll(list, i)
Loop across all elements in list.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
void clear()
Clear all entries from table.
void size(const label)
Override size to be inconsistent with allocated storage.
void setSize(const label)
Reset size of List.
Initialise the NamedEnum HashTable from the static list of names.
label rcIndex(const label i) const
Return the reverse circular index, i.e. the previous index.
label fcIndex(const label i) const
Return the forward circular index, i.e. the next index.
A cell is defined as a list of faces with extra functionality.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
A subset of mesh faces organised as a primitive patch.
const boolList & flipMap() const
Return face flip map.
label whichFace(const label globalCellID) const
Helper function to re-direct to zone::localID(...)
A face is a list of labels corresponding to mesh vertices.
label nextLabel(const label i) const
Next vertex on face.
label prevLabel(const label i) const
Previous vertex on face.
Mesh consisting of general polyhedral cells.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
const labelList & reversePointMap() const
Reverse point map.
const labelList & reverseCellMap() const
Reverse cell map.
Direct mesh changes based on v1.3 polyTopoChange syntax.
label addCell(const label masterPointID, const label masterEdgeID, const label masterFaceID, const label masterCellID, const label zoneID)
Add cell. Return new cell label.
label addPoint(const point &, const label masterPointID, const label zoneID, const bool inCell)
Add point. Return new point label.
Decomposes polyMesh into tets.
void topoChange(const polyTopoChangeMap &)
Force recalculation of locally stored data on topological change.
static const NamedEnum< decompositionType, 2 > decompositionTypeNames
tetDecomposer(const polyMesh &)
Construct from mesh.
void setRefinement(const decompositionType decomposeType, polyTopoChange &meshMod)
Insert all changes into meshMod to convert the polyMesh into.
A triangle primitive used to calculate face areas and swept volumes.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
errorManip< error > abort(error &err)
defineTypeNameAndDebug(combustionModel, 0)
void inplaceRenumber(const labelUList &oldToNew, ListType &)
Inplace renumber the values of a list.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable