57Foam::scalar Foam::isoSurfaceCell::isoFraction
63 const scalar d = s1-s0;
76 const labelledTri& tri0,
77 const labelledTri& tri1
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];
110Foam::point Foam::isoSurfaceCell::calcCentre(
const triSurface&
s)
116 sum +=
s[i].centre(
s.points());
126 DynamicList<labelledTri, 64>& localTris
131 if (localTris.size() == 1)
133 const labelledTri& tri = localTris[0];
134 info.setPoint(tri.centre(localPoints));
137 else if (localTris.size() == 2)
140 const labelledTri& tri0 = localTris[0];
141 const labelledTri& tri1 = localTris[1];
143 labelPair shared = findCommonPoints(tri0, tri1);
147 const vector n0 = tri0.areaNormal(localPoints);
148 const vector n1 = tri1.areaNormal(localPoints);
155 mag(n0) <= ROOTVSMALL
156 ||
mag(n1) <= ROOTVSMALL
164 tri0.centre(localPoints)
165 + tri1.centre(localPoints)
172 else if (localTris.size())
182 localTris.clearStorage();
185 label
nZones = surf.markZones
194 scalar minCos = GREAT;
195 const vector& n0 = surf.faceNormals()[0];
196 for (label i = 1; i < surf.size(); ++i)
198 scalar cosAngle = (n0 & surf.faceNormals()[i]);
199 if (cosAngle < minCos)
207 info.setPoint(calcCentre(surf));
217void Foam::isoSurfaceCell::calcSnappedCc
223 DynamicList<point>& snappedPoints,
230 snappedCc.
setSize(mesh_.nCells());
234 DynamicList<point, 64> localPoints(64);
235 DynamicList<labelledTri, 64> localTris(64);
236 Map<label> pointToLocal(64);
238 forAll(mesh_.cells(), celli)
240 if (cellCutType_[celli] == cutType::CUT)
242 const scalar cVal = cVals[celli];
244 const cell& cFaces = mesh_.cells()[celli];
248 pointToLocal.clear();
253 for (
const label facei : cFaces)
255 const face&
f = mesh_.faces()[facei];
257 for (
const label pointi :
f)
259 scalar
s = isoFraction(cVal, pVals[pointi]);
261 if (
s >= 0.0 &&
s <= 0.5)
263 if (pointToLocal.insert(pointi, localPoints.size()))
265 localPoints.append((1.0-
s)*cc[celli]+
s*pts[pointi]);
271 if (localPoints.size() == 1)
274 snappedCc[celli] = snappedPoints.size();
275 snappedPoints.append(localPoints[0]);
283 else if (localPoints.size() == 2)
286 snappedCc[celli] = snappedPoints.size();
287 snappedPoints.append(0.5*(localPoints[0]+localPoints[1]));
295 else if (localPoints.size())
298 for (
const label facei : cFaces)
300 const face&
f = mesh_.faces()[facei];
306 const label fp0 = mesh_.tetBasePtIs()[facei];
308 for (label i = 2; i <
f.
size(); ++i)
314 FixedList<scalar, 3>
s(3);
315 s[0] = isoFraction(cVal, pVals[tri[0]]);
316 s[1] = isoFraction(cVal, pVals[tri[1]]);
317 s[2] = isoFraction(cVal, pVals[tri[2]]);
321 (
s[0] >= 0.0 &&
s[0] <= 0.5)
322 && (
s[1] >= 0.0 &&
s[1] <= 0.5)
323 && (
s[2] >= 0.0 &&
s[2] <= 0.5)
328 (mesh_.faceOwner()[facei] == celli)
329 == (cVal >= pVals[tri[0]])
336 pointToLocal[tri[1]],
337 pointToLocal[tri[0]],
338 pointToLocal[tri[2]],
349 pointToLocal[tri[0]],
350 pointToLocal[tri[1]],
351 pointToLocal[tri[2]],
373 snappedCc[celli] = snappedPoints.size();
374 snappedPoints.append(info.hitPoint());
388void Foam::isoSurfaceCell::genPointTris
395 DynamicList<point, 64>& localTriPoints
400 const face&
f = mesh_.faces()[facei];
402 const label fp0 = mesh_.tetBasePtIs()[facei];
404 for (label i = 2; i <
f.
size(); ++i)
409 label index = tri.find(pointi);
417 label
b = tri[tri.fcIndex(index)];
418 label
c = tri[tri.rcIndex(index)];
421 FixedList<scalar, 3>
s(3);
422 s[0] = isoFraction(pointValues[pointi], pointValues[
b]);
423 s[1] = isoFraction(pointValues[pointi], pointValues[c]);
424 s[2] = isoFraction(pointValues[pointi], cellValues[celli]);
428 (
s[0] >= 0.0 &&
s[0] <= 0.5)
429 && (
s[1] >= 0.0 &&
s[1] <= 0.5)
430 && (
s[2] >= 0.0 &&
s[2] <= 0.5)
433 point p0 = (1.0-
s[0])*pts[pointi] +
s[0]*pts[
b];
434 point p1 = (1.0-
s[1])*pts[pointi] +
s[1]*pts[c];
435 point p2 = (1.0-
s[2])*pts[pointi] +
s[2]*cc[celli];
439 (mesh_.faceOwner()[facei] == celli)
440 == (pointValues[pointi] > cellValues[celli])
443 localTriPoints.append(
p0);
444 localTriPoints.append(p1);
445 localTriPoints.append(p2);
449 localTriPoints.append(p1);
450 localTriPoints.append(
p0);
451 localTriPoints.append(p2);
460void Foam::isoSurfaceCell::genPointTris
466 DynamicList<point, 64>& localTriPoints
470 const cell& cFaces = mesh_.cells()[celli];
474 const face&
f = mesh_.faces()[facei];
478 for (
const label cfacei : cFaces)
480 const face& f1 = mesh_.faces()[cfacei];
481 for (
const label p1 : f1)
497 label index =
f.
find(pointi);
505 FixedList<scalar, 3>
s(3);
506 s[0] = isoFraction(pointValues[pointi], pointValues[
b]);
507 s[1] = isoFraction(pointValues[pointi], pointValues[c]);
508 s[2] = isoFraction(pointValues[pointi], pointValues[ccPointi]);
512 (
s[0] >= 0.0 &&
s[0] <= 0.5)
513 && (
s[1] >= 0.0 &&
s[1] <= 0.5)
514 && (
s[2] >= 0.0 &&
s[2] <= 0.5)
517 point p0 = (1.0-
s[0])*pts[pointi] +
s[0]*pts[
b];
518 point p1 = (1.0-
s[1])*pts[pointi] +
s[1]*pts[c];
519 point p2 = (1.0-
s[2])*pts[pointi] +
s[2]*pts[ccPointi];
521 if (mesh_.faceOwner()[facei] != celli)
523 localTriPoints.append(
p0);
524 localTriPoints.append(p1);
525 localTriPoints.append(p2);
529 localTriPoints.append(p1);
530 localTriPoints.append(
p0);
531 localTriPoints.append(p2);
537void Foam::isoSurfaceCell::calcSnappedPoint
543 DynamicList<point>& snappedPoints,
547 const labelList& faceOwn = mesh_.faceOwner();
548 const labelList& faceNei = mesh_.faceNeighbour();
552 bitSet isBoundaryPoint(mesh_.nPoints());
553 const polyBoundaryMesh&
patches = mesh_.boundaryMesh();
555 for (
const polyPatch& pp :
patches)
559 for (
const label facei : pp.range())
561 const face&
f = mesh_.faces()[facei];
563 isBoundaryPoint.
set(
f);
569 const point greatPoint(GREAT, GREAT, GREAT);
571 pointField collapsedPoint(mesh_.nPoints(), greatPoint);
575 DynamicList<point, 64> localTriPoints(100);
578 forAll(mesh_.pointFaces(), pointi)
580 constexpr uint8_t realCut(cutType::CUT | cutType::TETCUT);
582 if (isBoundaryPoint.test(pointi))
591 for (
const label facei :
pFaces)
595 (cellCutType_[faceOwn[facei]] & realCut) != 0
597 mesh_.isInternalFace(facei)
598 && (cellCutType_[faceNei[facei]] & realCut) != 0
615 localPointCells.clear();
616 localTriPoints.clear();
618 for (
const label facei :
pFaces)
620 const label own = faceOwn[facei];
626 if (localPointCells.insert(own))
628 genPointTris(pVals, pointi, facei, own, localTriPoints);
644 if (mesh_.isInternalFace(facei))
646 const label nei = faceNei[facei];
650 if (localPointCells.insert(nei))
652 genPointTris(pVals, pointi, facei, nei, localTriPoints);
670 if (localTriPoints.size() == 3)
681 else if (localTriPoints.size())
700 label
nZones = surf.markZones
709 scalar minCos = GREAT;
710 const vector& n0 = surf.faceNormals()[0];
711 for (label i = 1; i < surf.size(); ++i)
713 const vector&
n = surf.faceNormals()[i];
714 scalar cosAngle = (n0 &
n);
715 if (cosAngle < minCos)
722 collapsedPoint[pointi] = calcCentre(surf);
732 minMagSqrEqOp<point>(),
736 snappedPoint.setSize(mesh_.nPoints());
739 forAll(collapsedPoint, pointi)
743 if (
magSqr(collapsedPoint[pointi]) < 0.5*
magSqr(greatPoint))
745 snappedPoint[pointi] = snappedPoints.size();
746 snappedPoints.append(collapsedPoint[pointi]);
754 const bool checkDuplicates,
755 const List<point>& triPoints,
760 label nTris = triPoints.
size()/3;
762 if ((triPoints.size() % 3) != 0)
765 <<
"Problem: number of points " << triPoints.size()
782 Pout<<
"isoSurfaceCell : merged from " << triPointReverseMap.size()
783 <<
" points down to " << newPoints.size() <<
endl;
794 if (nUnique != newPoints.size())
797 <<
"Merged points contain duplicates"
798 <<
" when merging with distance " << mergeDistance_ <<
endl
799 <<
"merged:" << newPoints.size() <<
" re-merged:"
806 List<labelledTri> tris;
808 DynamicList<labelledTri> dynTris(nTris);
810 DynamicList<label> newToOldTri(nTris);
812 for (label oldTriI = 0; oldTriI < nTris; ++oldTriI)
816 triPointReverseMap[rawPointi],
817 triPointReverseMap[rawPointi+1],
818 triPointReverseMap[rawPointi+2],
823 newToOldTri.append(oldTriI);
830 triMap.transfer(newToOldTri);
831 tris.transfer(dynTris);
843 Pout<<
"isoSurfaceCell : merged from " << nTris
844 <<
" down to " << tris.size() <<
" triangles." <<
endl;
850 centres[triI] = tris[triI].centre(newPoints);
864 Pout<<
"isoSurfaceCell : detected "
865 << (oldToMerged.size() - nUnique)
866 <<
" duplicate triangles." <<
endl;
869 if (oldToMerged.size() != nUnique)
873 DynamicList<label> newToOldTri(tris.size());
877 label mergedI = oldToMerged[triI];
879 if (newToMaster[mergedI] == -1)
881 newToMaster[mergedI] = triI;
882 newToOldTri.append(triMap[triI]);
883 tris[newTriI++] = tris[triI];
887 triMap.transfer(newToOldTri);
888 tris.setSize(newTriI);
896void Foam::isoSurfaceCell::calcAddressing
898 const triSurface& surf,
899 List<FixedList<label, 3>>& faceEdges,
902 Map<labelList>& edgeFacesRest
911 const labelledTri& tri = surf[triI];
912 edgeCentres[edgeI++] = 0.5*(
points[tri[0]]+
points[tri[1]]);
913 edgeCentres[edgeI++] = 0.5*(
points[tri[1]]+
points[tri[2]]);
914 edgeCentres[edgeI++] = 0.5*(
points[tri[2]]+
points[tri[0]]);
928 Pout<<
"isoSurfaceCell : detected "
930 <<
" edges on " << surf.size() <<
" triangles." <<
endl;
933 if (nUnique == edgeCentres.size())
941 faceEdges.setSize(surf.size());
945 faceEdges[triI][0] = oldToMerged[edgeI++];
946 faceEdges[triI][1] = oldToMerged[edgeI++];
947 faceEdges[triI][2] = oldToMerged[edgeI++];
952 edgeFace0.resize(nUnique);
954 edgeFace1.resize(nUnique);
956 edgeFacesRest.clear();
958 forAll(oldToMerged, oldEdgeI)
960 label triI = oldEdgeI / 3;
961 label edgeI = oldToMerged[oldEdgeI];
963 if (edgeFace0[edgeI] == -1)
965 edgeFace0[edgeI] = triI;
967 else if (edgeFace1[edgeI] == -1)
969 edgeFace1[edgeI] = triI;
980 if (iter != edgeFacesRest.end())
983 label sz = eFaces.size();
984 eFaces.setSize(sz+1);
989 edgeFacesRest.insert(edgeI,
labelList(1, triI));
996bool Foam::isoSurfaceCell::danglingTriangle
998 const FixedList<label, 3>& fEdges,
1003 for (
const label edgei : fEdges)
1005 if (edgeFace1[edgei] == -1)
1011 return (nOpen == 1 || nOpen == 2 || nOpen == 3);
1015Foam::label Foam::isoSurfaceCell::markDanglingTriangles
1017 const List<FixedList<label, 3>>& faceEdges,
1020 const Map<labelList>& edgeFacesRest,
1024 keepTriangles.setSize(faceEdges.size());
1025 keepTriangles =
true;
1027 label nDangling = 0;
1035 const label edgeI = iter.key();
1036 const labelList& otherEdgeFaces = iter.val();
1039 if (danglingTriangle(faceEdges[edgeFace0[edgeI]], edgeFace1))
1041 keepTriangles[edgeFace0[edgeI]] =
false;
1044 if (danglingTriangle(faceEdges[edgeFace1[edgeI]], edgeFace1))
1046 keepTriangles[edgeFace1[edgeI]] =
false;
1049 for (
const label triI : otherEdgeFaces)
1051 if (danglingTriangle(faceEdges[triI], edgeFace1))
1053 keepTriangles[triI] =
false;
1064 const triSurface&
s,
1072 ListOps::createWithValue<bool>(
s.size(), newToOldFaces,
true,
false)
1075 newToOldPoints.setSize(
s.points().size());
1076 oldToNewPoints.setSize(
s.points().size());
1077 oldToNewPoints = -1;
1081 forAll(include, oldFacei)
1083 if (include[oldFacei])
1086 for (
const label oldPointi :
s[oldFacei])
1088 if (oldToNewPoints[oldPointi] == -1)
1090 oldToNewPoints[oldPointi] = pointi;
1091 newToOldPoints[pointi++] = oldPointi;
1096 newToOldPoints.setSize(pointi);
1101 forAll(newToOldPoints, i)
1103 newPoints[i] =
s.points()[newToOldPoints[i]];
1106 List<labelledTri> newTriangles(newToOldFaces.size());
1111 const labelledTri& tri =
s[newToOldFaces[i]];
1113 newTriangles[i][0] = oldToNewPoints[tri[0]];
1114 newTriangles[i][1] = oldToNewPoints[tri[1]];
1115 newTriangles[i][2] = oldToNewPoints[tri[2]];
1116 newTriangles[i].region() = tri.region();
1120 return triSurface(newTriangles,
s.patches(), newPoints,
true);
1133 const bitSet& ignoreCells
1137 mergeDistance_(params.mergeTol()*
mesh.bounds().
mag()),
1140 const bool regularise = (params.
filter() != filterType::NONE);
1144 Pout<<
"isoSurfaceCell:" <<
nl
1147 <<
" isoValue : " << iso <<
nl
1148 <<
" filter : " <<
Switch(regularise) <<
nl
1151 <<
" mergeDistance : " << mergeDistance_ <<
nl
1152 <<
" ignoreCells : " << ignoreCells.
count()
1158 label nBlockedCells = 0;
1161 nBlockedCells +=
blockCells(cellCutType_, ignoreCells);
1172 for (label celli = 0; celli <
mesh_.
nCells(); ++celli)
1186 Pout<<
"isoSurfaceCell : candidate cells cut "
1188 <<
" blocked " << nBlockedCells
1192 if (debug && isA<fvMesh>(
mesh))
1194 const auto& fvmesh = dynamicCast<const fvMesh>(
mesh);
1200 "isoSurfaceCell.cutType",
1201 fvmesh.time().timeName(),
1213 forAll(cellCutType_, celli)
1215 debugFld[celli] = cellCutType_[celli];
1218 Pout<<
"Writing cut types:"
1248 Pout<<
"isoSurfaceCell : shifted " << snappedPoints.
size()
1249 <<
" cell centres to intersection." <<
endl;
1253 label nCellSnaps = snappedPoints.
size();
1276 Pout<<
"isoSurfaceCell : shifted " << snappedPoints.
size()-nCellSnaps
1277 <<
" vertices to intersection." <<
endl;
1306 Pout<<
"isoSurfaceCell : generated " << triMeshCells.
size()
1307 <<
" unmerged triangles." <<
endl;
1319 isoSurfacePoint::trimToBox
1325 interpolatedPoints_,
1326 interpolatedOldPoints_,
1327 interpolationWeights_
1329 triMeshCells =
labelField(triMeshCells, trimTriMap);
1335 tmpsurf = stitchTriPoints
1345 Pout<<
"isoSurfaceCell : generated " << triMap.
size()
1346 <<
" merged triangles." <<
endl;
1355 labelList newTriPointMergeMap(nOldPoints, -1);
1356 forAll(trimTriPointMap, trimPointI)
1358 label oldPointI = trimTriPointMap[trimPointI];
1361 label pointI = triPointMergeMap_[trimPointI];
1364 newTriPointMergeMap[oldPointI] = pointI;
1368 triPointMergeMap_.
transfer(newTriPointMergeMap);
1381 Pout<<
"isoSurfaceCell : checking " << tmpsurf.
size()
1382 <<
" triangles for validity." <<
endl;
1412 label nDangling = markDanglingTriangles
1423 Pout<<
"isoSurfaceCell : detected " << nDangling
1424 <<
" dangling triangles." <<
endl;
1437 tmpsurf = subsetMesh
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
DynamicList< T, SizeMin > & shrink()
Shrink the allocated space to the number of elements used.
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.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
fileName objectPath() const
The complete path + object name.
std::enable_if< std::is_same< bool, TypeT >::value, bool >::type set(const label i, bool val=true)
A bitSet::set() method for a list of bool.
void transfer(List< T > &list)
void setSize(const label n)
Alias for resize()
A HashTable to objects of type <T> with a label key.
typename parent_type::iterator iterator
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
const labelListList & faceEdges() const
Return face-edge addressing.
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
True if the value if found in the list.
label find(const T &val, label pos=0) const
Find index of the first occurrence of the value.
label rcIndex(const label i) const noexcept
void size(const label n)
Older name for setAddressableSize.
label fcIndex(const label i) const noexcept
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.
scalar mag() const
The magnitude of the bounding box span.
Low-level components common to various iso-surface algorithms.
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",...
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.
Mesh consisting of general polyhedral cells.
const boundBox & bounds() const
Return mesh bounding box.
const labelIOList & tetBasePtIs() const
Return the tetBasePtIs.
virtual const pointField & points() const
Return raw points.
const vectorField & cellCentres() const
label nPoints() const noexcept
Number of mesh points.
label nCells() const noexcept
Number of mesh cells.
virtual bool write(const bool valid=true) const
Write using setting from DB.
transferModelList & transfer()
Transfer.
static bool test(const UList< face > &faces)
Standard boundBox with extra functionality for use in octree.
Triangle storage. Null constructable (unfortunately triangle<point, point> 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.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
#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.
const dimensionedScalar c
Speed of light in a vacuum.
Pair< label > labelPair
A pair of labels.
const dimensionSet dimless
Dimensionless.
void inplaceRenumber(const labelUList &oldToNew, IntListType &input)
Inplace renumber the values (not the indices) of a list.
List< label > labelList
A List of labels.
PointIndexHit< point > pointIndexHit
A PointIndexHit for 3D points.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
List< geometricSurfacePatch > geometricSurfacePatchList
A List of geometricSurfacePatch.
vectorField pointField
pointField is a vectorField.
vector point
Point is a vector.
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)
MinMax< label > minMax(const labelHashSet &set)
Find the min/max values of labelHashSet.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
errorManip< error > abort(error &err)
Field< label > labelField
Specialisation of Field<T> for label.
List< bool > boolList
A List of bools.
static constexpr const zero Zero
Global zero (0)
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
List< surfZone > surfZoneList
labelList findIndices(const ListType &input, typename ListType::const_reference val, label start=0)
Linear search to find all occurrences of given element.
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];} label minLabel=min(start, end);pointMap[start]=pointMap[end]=minLabel;} } 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};const 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< SLList< 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.