57Foam::scalar Foam::isoSurfaceCell::isoFraction
63 const scalar d = s1-s0;
83 label fp1 = tri1.find(tri0[fp0]);
88 fp1 = tri1.find(tri0[fp0]);
96 label fp0p1 = tri0.fcIndex(fp0);
97 label fp1p1 = tri1.fcIndex(fp1);
98 label fp1m1 = tri1.rcIndex(fp1);
100 if (tri0[fp0p1] == tri1[fp1p1] || tri0[fp0p1] == tri1[fp1m1])
102 common[0] = tri0[fp0];
103 common[1] = tri0[fp0p1];
116 sum +=
s[i].centre(
s.points());
131 if (localTris.size() == 1)
134 info.hitPoint(tri.centre(localPoints));
136 else if (localTris.size() == 2)
142 labelPair shared = findCommonPoints(tri0, tri1);
146 const vector n0 = tri0.areaNormal(localPoints);
147 const vector n1 = tri1.areaNormal(localPoints);
154 mag(n0) <= ROOTVSMALL
155 ||
mag(n1) <= ROOTVSMALL
163 tri0.centre(localPoints)
164 + tri1.centre(localPoints)
170 else if (localTris.size())
180 localTris.clearStorage();
183 label nZones = surf.markZones
192 scalar minCos = GREAT;
193 const vector& n0 = surf.faceNormals()[0];
194 for (label i = 1; i < surf.size(); ++i)
196 scalar cosAngle = (n0 & surf.faceNormals()[i]);
197 if (cosAngle < minCos)
205 info.hitPoint(calcCentre(surf));
214void Foam::isoSurfaceCell::calcSnappedCc
227 snappedCc.
setSize(mesh_.nCells());
235 forAll(mesh_.cells(), celli)
237 if (cellCutType_[celli] == cutType::CUT)
239 const scalar cVal = cVals[celli];
241 const cell& cFaces = mesh_.cells()[celli];
245 pointToLocal.clear();
250 for (
const label facei : cFaces)
252 const face&
f = mesh_.faces()[facei];
254 for (
const label pointi :
f)
256 scalar
s = isoFraction(cVal, pVals[pointi]);
258 if (
s >= 0.0 &&
s <= 0.5)
260 if (pointToLocal.insert(pointi, localPoints.size()))
262 localPoints.append((1.0-
s)*cc[celli]+
s*
pts[pointi]);
268 if (localPoints.size() == 1)
271 snappedCc[celli] = snappedPoints.size();
272 snappedPoints.append(localPoints[0]);
280 else if (localPoints.size() == 2)
283 snappedCc[celli] = snappedPoints.size();
284 snappedPoints.append(0.5*(localPoints[0]+localPoints[1]));
292 else if (localPoints.size())
295 for (
const label facei : cFaces)
297 const face&
f = mesh_.faces()[facei];
303 const label fp0 = mesh_.tetBasePtIs()[facei];
305 for (label i = 2; i <
f.
size(); ++i)
312 s[0] = isoFraction(cVal, pVals[tri[0]]);
313 s[1] = isoFraction(cVal, pVals[tri[1]]);
314 s[2] = isoFraction(cVal, pVals[tri[2]]);
318 (
s[0] >= 0.0 &&
s[0] <= 0.5)
319 && (
s[1] >= 0.0 &&
s[1] <= 0.5)
320 && (
s[2] >= 0.0 &&
s[2] <= 0.5)
325 (mesh_.faceOwner()[facei] == celli)
326 == (cVal >= pVals[tri[0]])
333 pointToLocal[tri[1]],
334 pointToLocal[tri[0]],
335 pointToLocal[tri[2]],
346 pointToLocal[tri[0]],
347 pointToLocal[tri[1]],
348 pointToLocal[tri[2]],
360 surfPoints.transfer(localPoints);
370 snappedCc[celli] = snappedPoints.size();
371 snappedPoints.append(info.point());
385void Foam::isoSurfaceCell::genPointTris
397 const face&
f = mesh_.faces()[facei];
399 const label fp0 = mesh_.tetBasePtIs()[facei];
401 for (label i = 2; i <
f.
size(); ++i)
406 label index = tri.find(pointi);
414 label
b = tri[tri.fcIndex(index)];
415 label
c = tri[tri.rcIndex(index)];
419 s[0] = isoFraction(pointValues[pointi], pointValues[
b]);
420 s[1] = isoFraction(pointValues[pointi], pointValues[c]);
421 s[2] = isoFraction(pointValues[pointi], cellValues[celli]);
425 (
s[0] >= 0.0 &&
s[0] <= 0.5)
426 && (
s[1] >= 0.0 &&
s[1] <= 0.5)
427 && (
s[2] >= 0.0 &&
s[2] <= 0.5)
432 point p2 = (1.0-
s[2])*
pts[pointi] +
s[2]*cc[celli];
436 (mesh_.faceOwner()[facei] == celli)
437 == (pointValues[pointi] > cellValues[celli])
440 localTriPoints.append(
p0);
441 localTriPoints.append(p1);
442 localTriPoints.append(p2);
446 localTriPoints.append(p1);
447 localTriPoints.append(
p0);
448 localTriPoints.append(p2);
457void Foam::isoSurfaceCell::genPointTris
467 const cell& cFaces = mesh_.cells()[celli];
471 const face&
f = mesh_.faces()[facei];
475 for (
const label cfacei : cFaces)
477 const face& f1 = mesh_.faces()[cfacei];
478 for (
const label p1 : f1)
494 label index =
f.
find(pointi);
503 s[0] = isoFraction(pointValues[pointi], pointValues[
b]);
504 s[1] = isoFraction(pointValues[pointi], pointValues[c]);
505 s[2] = isoFraction(pointValues[pointi], pointValues[ccPointi]);
509 (
s[0] >= 0.0 &&
s[0] <= 0.5)
510 && (
s[1] >= 0.0 &&
s[1] <= 0.5)
511 && (
s[2] >= 0.0 &&
s[2] <= 0.5)
518 if (mesh_.faceOwner()[facei] != celli)
520 localTriPoints.append(
p0);
521 localTriPoints.append(p1);
522 localTriPoints.append(p2);
526 localTriPoints.append(p1);
527 localTriPoints.append(
p0);
528 localTriPoints.append(p2);
534void Foam::isoSurfaceCell::calcSnappedPoint
544 const labelList& faceOwn = mesh_.faceOwner();
545 const labelList& faceNei = mesh_.faceNeighbour();
549 bitSet isBoundaryPoint(mesh_.nPoints());
556 for (
const label facei :
pp.range())
558 const face&
f = mesh_.faces()[facei];
560 isBoundaryPoint.
set(
f);
566 const point greatPoint(GREAT, GREAT, GREAT);
568 pointField collapsedPoint(mesh_.nPoints(), greatPoint);
575 forAll(mesh_.pointFaces(), pointi)
577 constexpr uint8_t realCut(cutType::CUT | cutType::TETCUT);
579 if (isBoundaryPoint.test(pointi))
588 for (
const label facei :
pFaces)
592 (cellCutType_[faceOwn[facei]] & realCut) != 0
594 mesh_.isInternalFace(facei)
595 && (cellCutType_[faceNei[facei]] & realCut) != 0
612 localPointCells.clear();
613 localTriPoints.clear();
615 for (
const label facei :
pFaces)
617 const label own = faceOwn[facei];
623 if (localPointCells.insert(own))
625 genPointTris(pVals, pointi, facei, own, localTriPoints);
641 if (mesh_.isInternalFace(facei))
643 const label nei = faceNei[facei];
647 if (localPointCells.insert(nei))
649 genPointTris(pVals, pointi, facei, nei, localTriPoints);
667 if (localTriPoints.size() == 3)
678 else if (localTriPoints.size())
697 label nZones = surf.markZones
706 scalar minCos = GREAT;
707 const vector& n0 = surf.faceNormals()[0];
708 for (label i = 1; i < surf.size(); ++i)
710 const vector&
n = surf.faceNormals()[i];
711 scalar cosAngle = (n0 &
n);
712 if (cosAngle < minCos)
719 collapsedPoint[pointi] = calcCentre(surf);
733 snappedPoint.setSize(mesh_.nPoints());
736 forAll(collapsedPoint, pointi)
740 if (
magSqr(collapsedPoint[pointi]) < 0.5*
magSqr(greatPoint))
742 snappedPoint[pointi] = snappedPoints.size();
743 snappedPoints.append(collapsedPoint[pointi]);
749Foam::triSurface Foam::isoSurfaceCell::stitchTriPoints
751 const bool checkDuplicates,
779 Pout<<
"isoSurfaceCell : merged from " << triPointReverseMap.size()
780 <<
" points down to " << newPoints.size() <<
endl;
791 if (nUnique != newPoints.size())
794 <<
"Merged points contain duplicates"
795 <<
" when merging with distance " << mergeDistance_ <<
endl
796 <<
"merged:" << newPoints.size() <<
" re-merged:"
809 for (label oldTriI = 0; oldTriI < nTris; ++oldTriI)
813 triPointReverseMap[rawPointi],
814 triPointReverseMap[rawPointi+1],
815 triPointReverseMap[rawPointi+2],
820 newToOldTri.append(oldTriI);
827 triMap.transfer(newToOldTri);
828 tris.transfer(dynTris);
840 Pout<<
"isoSurfaceCell : merged from " << nTris
841 <<
" down to " << tris.size() <<
" triangles." <<
endl;
847 centres[triI] = tris[triI].centre(newPoints);
861 Pout<<
"isoSurfaceCell : detected "
862 << (oldToMerged.size() - nUnique)
863 <<
" duplicate triangles." <<
endl;
866 if (oldToMerged.size() != nUnique)
874 label mergedI = oldToMerged[triI];
876 if (newToMaster[mergedI] == -1)
878 newToMaster[mergedI] = triI;
879 newToOldTri.append(triMap[triI]);
880 tris[newTriI++] = tris[triI];
884 triMap.transfer(newToOldTri);
885 tris.setSize(newTriI);
893void Foam::isoSurfaceCell::calcAddressing
925 Pout<<
"isoSurfaceCell : detected "
927 <<
" edges on " << surf.size() <<
" triangles." <<
endl;
938 faceEdges.setSize(surf.size());
942 faceEdges[triI][0] = oldToMerged[edgeI++];
943 faceEdges[triI][1] = oldToMerged[edgeI++];
944 faceEdges[triI][2] = oldToMerged[edgeI++];
949 edgeFace0.resize_nocopy(nUnique);
951 edgeFace1.resize_nocopy(nUnique);
953 edgeFacesRest.clear();
955 forAll(oldToMerged, oldEdgeI)
957 label triI = oldEdgeI / 3;
958 label edgeI = oldToMerged[oldEdgeI];
960 if (edgeFace0[edgeI] == -1)
962 edgeFace0[edgeI] = triI;
964 else if (edgeFace1[edgeI] == -1)
966 edgeFace1[edgeI] = triI;
976 edgeFacesRest(edgeI).push_back(triI);
982bool Foam::isoSurfaceCell::danglingTriangle
989 for (
const label edgei : fEdges)
991 if (edgeFace1[edgei] == -1)
997 return (nOpen == 1 || nOpen == 2 || nOpen == 3);
1001Foam::label Foam::isoSurfaceCell::markDanglingTriangles
1010 keepTriangles.setSize(faceEdges.size());
1011 keepTriangles =
true;
1013 label nDangling = 0;
1021 const label edgeI = iter.key();
1022 const labelList& otherEdgeFaces = iter.val();
1025 if (danglingTriangle(faceEdges[edgeFace0[edgeI]], edgeFace1))
1027 keepTriangles[edgeFace0[edgeI]] =
false;
1030 if (danglingTriangle(faceEdges[edgeFace1[edgeI]], edgeFace1))
1032 keepTriangles[edgeFace1[edgeI]] =
false;
1035 for (
const label triI : otherEdgeFaces)
1037 if (danglingTriangle(faceEdges[triI], edgeFace1))
1039 keepTriangles[triI] =
false;
1048Foam::triSurface Foam::isoSurfaceCell::subsetMesh
1061 newToOldPoints.setSize(
s.points().size());
1062 oldToNewPoints.setSize(
s.points().size());
1063 oldToNewPoints = -1;
1067 forAll(include, oldFacei)
1069 if (include[oldFacei])
1072 for (
const label oldPointi :
s[oldFacei])
1074 if (oldToNewPoints[oldPointi] == -1)
1076 oldToNewPoints[oldPointi] = pointi;
1077 newToOldPoints[pointi++] = oldPointi;
1082 newToOldPoints.setSize(pointi);
1087 forAll(newToOldPoints, i)
1089 newPoints[i] =
s.points()[newToOldPoints[i]];
1099 newTriangles[i][0] = oldToNewPoints[tri[0]];
1100 newTriangles[i][1] = oldToNewPoints[tri[1]];
1101 newTriangles[i][2] = oldToNewPoints[tri[2]];
1102 newTriangles[i].
region() = tri.region();
1106 return triSurface(newTriangles,
s.patches(), newPoints,
true);
1119 const bitSet& ignoreCells
1124 cellCutType_(
mesh.nCells(), cutType::UNVISITED)
1126 const bool regularise = (params.
filter() != filterType::NONE);
1130 Pout<<
"isoSurfaceCell:" <<
nl
1133 <<
" isoValue : " << iso <<
nl
1134 <<
" filter : " <<
Switch(regularise) <<
nl
1136 <<
" mesh span : " <<
mesh.bounds().mag() <<
nl
1137 <<
" mergeDistance : " << mergeDistance_ <<
nl
1138 <<
" ignoreCells : " << ignoreCells.
count()
1144 label nBlockedCells = 0;
1147 nBlockedCells +=
blockCells(cellCutType_, ignoreCells);
1158 for (label celli = 0; celli <
mesh_.
nCells(); ++celli)
1172 Pout<<
"isoSurfaceCell : candidate cells cut "
1174 <<
" blocked " << nBlockedCells
1186 "isoSurfaceCell.cutType",
1187 fvmesh.time().timeName(),
1197 auto& debugFld = debugField.primitiveFieldRef();
1199 forAll(cellCutType_, celli)
1201 debugFld[celli] = cellCutType_[celli];
1204 Pout<<
"Writing cut types:"
1205 << debugField.objectPath() <<
endl;
1211 DynamicList<point> snappedPoints(nCutCells_);
1228 snappedCc.setSize(
mesh_.nCells());
1234 Pout<<
"isoSurfaceCell : shifted " << snappedPoints.size()
1235 <<
" cell centres to intersection." <<
endl;
1238 snappedPoints.shrink();
1239 label nCellSnaps = snappedPoints.
size();
1256 snappedPoint.setSize(
mesh_.nPoints());
1262 Pout<<
"isoSurfaceCell : shifted " << snappedPoints.size()-nCellSnaps
1263 <<
" vertices to intersection." <<
endl;
1271 DynamicList<point> triPoints(nCutCells_);
1272 DynamicList<label> triMeshCells(nCutCells_);
1279 mesh_.cellCentres(),
1292 Pout<<
"isoSurfaceCell : generated " << triMeshCells.size()
1293 <<
" unmerged triangles." <<
endl;
1297 label nOldPoints = triPoints.size();
1300 DynamicList<label> trimTriMap;
1305 isoSurfacePoint::trimToBox
1311 interpolatedPoints_,
1312 interpolatedOldPoints_,
1313 interpolationWeights_
1315 triMeshCells =
labelField(triMeshCells, trimTriMap);
1321 tmpsurf = stitchTriPoints
1331 Pout<<
"isoSurfaceCell : generated " << triMap.size()
1332 <<
" merged triangles." <<
endl;
1341 labelList newTriPointMergeMap(nOldPoints, -1);
1342 forAll(trimTriPointMap, trimPointI)
1344 label oldPointI = trimTriPointMap[trimPointI];
1347 label pointI = triPointMergeMap_[trimPointI];
1350 newTriPointMergeMap[oldPointI] = pointI;
1354 triPointMergeMap_.transfer(newTriPointMergeMap);
1367 Pout<<
"isoSurfaceCell : checking " << tmpsurf.size()
1368 <<
" triangles for validity." <<
endl;
1381 Map<labelList> edgeFacesRest;
1398 label nDangling = markDanglingTriangles
1409 Pout<<
"isoSurfaceCell : detected " << nDangling
1410 <<
" dangling triangles." <<
endl;
1423 tmpsurf = subsetMesh
1440 tmpsurf.swapPoints(
pts);
1444 tmpsurf.triFaceFaces(faces);
Info<< " "<< writer.output().name()<< nl;}{ const Field< vector > edgeCentres(faMeshTools::flattenEdgeField(aMesh.edgeCentres(), true))
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
DynamicList< T, SizeMin > & shrink()
Calls shrink_to_fit() and returns a reference to the DynamicList.
A 1D vector of objects of type <T> with a fixed length <N>.
static constexpr label size() noexcept
Return the number of elements in the FixedList.
Internal::FieldType & primitiveFieldRef(const bool updateAccessTime=true)
Return a reference to the internal field values.
@ NO_REGISTER
Do not request registration (bool: false).
@ NO_READ
Nothing to be read.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
fileName objectPath() const
The complete path + object name.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void transfer(List< T > &list)
Transfer the contents of the argument List into this list and annul the argument list.
bool set(const label i, bool val=true)
A bitSet::set() method for a list of bool.
void setSize(label n)
Alias for resize().
void clear()
Clear the list, i.e. set size to zero.
A HashTable to objects of type <T> with a label key.
void transfer(pointField &pointLst, List< face > &faceLst)
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
const labelListList & faceEdges() const
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
bool found(const T &val, label pos=0) const
Same as contains().
label rcIndex(const label i) const noexcept
The reverse circular index. The previous index in the list which returns to the last at the beginning...
void size(const label n)
Older name for setAddressableSize.
label find(const T &val) const
Find index of the first occurrence of the value.
label fcIndex(const label i) const noexcept
The forward circular index. The next index in the list which returns to the first at the end of the l...
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
unsigned int count(const bool on=true) const
Count number of bits set.
void set(const bitSet &bitset)
Set specified bits from another bitset.
A cell is defined as a list of faces with extra functionality.
A subset of mesh faces organised as a primitive patch.
A face is a list of labels corresponding to mesh vertices.
Low-level components common to various iso-surface algorithms.
isoSurfaceBase(const isoSurfaceBase &)=delete
No copy construct.
cutType
The type of cell/face cuts.
const scalarField & cellValues() const noexcept
The mesh cell values used for creating the iso-surface.
const scalarField & pVals_
Point values.
label calcCellCuts(List< cutType > &cuts) const
Populate a list of candidate cell cuts using getCellCutType().
labelList meshCells_
For every face, the original cell in mesh.
const scalar iso_
Iso value.
const polyMesh & mesh() const noexcept
The mesh for which the iso-surface is associated.
const scalarField & pointValues() const noexcept
The mesh point values used for creating the iso-surface.
const polyMesh & mesh_
Reference to mesh.
label blockCells(UList< cutType > &cuts, const bitSet &ignoreCells) const
Mark ignoreCells as BLOCKED.
const scalarField & cVals_
Cell values.
A surface formed by the iso value. After "Polygonising A Scalar Field Using Tetrahedrons",...
isoSurfaceCell(const polyMesh &mesh, const scalarField &cellValues, const scalarField &pointValues, const scalar iso, const isoSurfaceParams ¶ms=isoSurfaceParams(), const bitSet &ignoreCells=bitSet())
Construct from cell and point values.
Preferences for controlling iso-surface algorithms.
filterType filter() const noexcept
Get current filter type.
const boundBox & getClipBounds() const noexcept
Get optional clipping bounding box.
scalar mergeTol() const noexcept
Get current merge tolerance.
A triFace with additional (region) index.
label region() const noexcept
Return the region index.
A polyBoundaryMesh is a polyPatch list with registered IO, a reference to the associated polyMesh,...
Mesh consisting of general polyhedral cells.
const labelIOList & tetBasePtIs() const
Return the tetBasePtIs.
A patch is a list of labels that address the faces in the global face list.
label nCells() const noexcept
Number of mesh cells.
virtual bool write(const bool writeOnProc=true) const
Write using setting from DB.
static bool test(const UList< face > &faces)
Test if given list of faces satisfies criteria for TET. (4 tri).
Standard boundBox with extra functionality for use in octree.
A triangular face using a FixedList of labels corresponding to mesh vertices.
Triangle point storage. Default constructable (triangle is not).
Triangulated surface description with patch information.
void triFaceFaces(List< face > &plainFaceList) const
Create a list of faces from the triFaces.
virtual void swapPoints(pointField &pts)
Swap points. Similar to movePoints, but returns the old points.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
const volScalarField & p0
const polyBoundaryMesh & patches
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Convenience macros for instantiating iso-surface interpolate methods.
#define defineIsoSurfaceInterpolateMethods(ThisClass)
Geometric merging of points. See below.
List< T > createWithValue(const label len, const labelUList &locations, const T &val, const T &deflt=T())
Create a List filled with default values and various locations with another specified value.
Namespace for bounding specifications. At the moment, mostly for tables.
const dimensionedScalar c
Speed of light in a vacuum.
Namespace for handling debugging switches.
Type & refCast(U &obj)
A dynamic_cast (for references) to Type reference.
Pair< label > labelPair
A pair of labels.
const dimensionSet dimless
Dimensionless.
void inplaceRenumber(const labelUList &oldToNew, IntListType &input)
Inplace renumber the values within a list.
List< label > labelList
A List of labels.
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
List< surfZone > surfZoneList
List of surfZone.
List< face > faceList
List of faces.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
label mergePoints(const PointList &points, labelList &pointToUnique, labelList &uniquePoints, const scalar mergeTol=SMALL, const bool verbose=false)
Calculate merge mapping, preserving the original point order. All points closer/equal mergeTol are to...
MinMax< label > minMax(const labelHashSet &set)
Find the min/max values of labelHashSet.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const Type * isA(const U &obj)
Attempt dynamic_cast to Type.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
errorManip< error > abort(error &err)
Field< label > labelField
Specialisation of Field<T> for label.
vector point
Point is a vector.
List< geometricSurfacePatch > geometricSurfacePatchList
List of geometricSurfacePatch.
List< bool > boolList
A List of bools.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &f1, const label comm)
static constexpr const zero Zero
Global zero (0).
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
vectorField pointField
pointField is a vectorField.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
labelList findIndices(const ListType &input, typename ListType::const_reference val, label start=0)
Linear search to find all occurrences of given element.
PointIndexHit< point > pointIndexHit
A PointIndexHit with a 3D point.
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
constexpr char nl
The newline '\n' character (0x0a).
Info<< "Finished reading KIVA file"<< endl;cellShapeList cellShapes(nPoints);labelList cellZoning(nPoints, -1);const cellModel &hex=cellModel::ref(cellModel::HEX);labelList hexLabels(8);label activeCells=0;labelList pointMap(nPoints);forAll(pointMap, i){ pointMap[i]=i;}for(label i=0;i< nPoints;i++){ if(f[i] > 0.0) { hexLabels[0]=i;hexLabels[1]=i1tab[i];hexLabels[2]=i3tab[i1tab[i]];hexLabels[3]=i3tab[i];hexLabels[4]=i8tab[i];hexLabels[5]=i1tab[i8tab[i]];hexLabels[6]=i3tab[i1tab[i8tab[i]]];hexLabels[7]=i3tab[i8tab[i]];cellShapes[activeCells].reset(hex, hexLabels);edgeList edges=cellShapes[activeCells].edges();forAll(edges, ei) { if(edges[ei].mag(points)< SMALL) { label start=pointMap[edges[ei].start()];while(start !=pointMap[start]) { start=pointMap[start];} label end=pointMap[edges[ei].end()];while(end !=pointMap[end]) { end=pointMap[end];} pointMap[start]=pointMap[end]=Foam::min(start, end);} } cellZoning[activeCells]=idreg[i];activeCells++;}}cellShapes.setSize(activeCells);cellZoning.setSize(activeCells);forAll(cellShapes, celli){ cellShape &cs=cellShapes[celli];forAll(cs, i) { cs[i]=pointMap[cs[i]];} cs.collapse();}label bcIDs[11]={-1, 0, 2, 4, -1, 5, -1, 6, 7, 8, 9};constexpr label nBCs=12;const word *kivaPatchTypes[nBCs]={ &wallPolyPatch::typeName, &wallPolyPatch::typeName, &wallPolyPatch::typeName, &wallPolyPatch::typeName, &symmetryPolyPatch::typeName, &wedgePolyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &symmetryPolyPatch::typeName, &oldCyclicPolyPatch::typeName};enum patchTypeNames{ PISTON, VALVE, LINER, CYLINDERHEAD, AXIS, WEDGE, INFLOW, OUTFLOW, PRESIN, PRESOUT, SYMMETRYPLANE, CYCLIC};const char *kivaPatchNames[nBCs]={ "piston", "valve", "liner", "cylinderHead", "axis", "wedge", "inflow", "outflow", "presin", "presout", "symmetryPlane", "cyclic"};List< DynamicList< face > > pFaces[nBCs]
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIters(container, iter)
Iterate across all elements of the container object with const access.