41 void Foam::thresholdCellFaces::calculate
44 const scalar lowerThreshold,
45 const scalar upperThreshold,
46 const bool triangulate
50 const labelList& nei = mesh_.faceNeighbour();
52 const faceList& origFaces = mesh_.faces();
55 const polyBoundaryMesh& bMesh = mesh_.boundaryMesh();
60 surfZones[0] = surfZone
70 surfZones[
patchi+1] = surfZone
86 DynamicList<face> surfFaces(0.5 * mesh_.nFaces());
87 DynamicList<label> surfCells(surfFaces.size());
89 labelList oldToNewPoints(origPoints.size(), -1);
92 polygonTriangulate triEngine;
95 for (
label facei = 0; facei < mesh_.nInternalFaces(); ++facei)
100 if (field[own[facei]] > lowerThreshold)
102 if (field[nei[facei]] < lowerThreshold)
107 else if (field[nei[facei]] > lowerThreshold)
113 if (field[own[facei]] < upperThreshold)
115 if (field[nei[facei]] > upperThreshold)
120 else if (field[nei[facei]] < upperThreshold)
128 const face& f = origFaces[facei];
132 if (oldToNewPoints[f[fp]] == -1)
134 oldToNewPoints[f[fp]] = nPoints++;
149 surfFace = f.reverseFace();
156 triEngine.triangulate
158 UIndirectList<point>(origPoints, surfFace)
160 forAll(triEngine.triPoints(), i)
162 surfFaces.append(triEngine.triPoints(i, surfFace));
163 surfCells.append(cellId);
168 surfFaces.append(surfFace);
169 surfCells.append(cellId);
174 surfZones[0].size() = surfFaces.size();
180 const polyPatch& p = bMesh[
patchi];
181 surfZone& zone = surfZones[
patchi+1];
183 zone.start() = nFaces;
187 isA<emptyPolyPatch>(p)
194 label facei = p.start();
201 field[own[facei]] > lowerThreshold
202 && field[own[facei]] < upperThreshold
205 const face& f = origFaces[facei];
208 if (oldToNewPoints[f[fp]] == -1)
210 oldToNewPoints[f[fp]] = nPoints++;
214 label cellId = own[facei];
218 triEngine.triangulate
220 UIndirectList<point>(origPoints, f)
222 forAll(triEngine.triPoints(), i)
224 surfFaces.append(triEngine.triPoints(i, f));
225 surfCells.append(cellId);
231 surfCells.append(cellId);
238 zone.size() = surfFaces.size() - zone.start();
254 forAll(oldToNewPoints, pointi)
256 if (oldToNewPoints[pointi] >= 0)
258 surfPoints[oldToNewPoints[pointi]] = origPoints[pointi];
262 surfPoints.setSize(nPoints);
264 this->storedPoints().transfer(surfPoints);
265 this->storedFaces().transfer(surfFaces);
266 this->storedZones().transfer(surfZones);
268 meshCells_.transfer(surfCells);
278 const scalar lowerThreshold,
279 const scalar upperThreshold,
280 const bool triangulate
286 if (lowerThreshold > upperThreshold)
289 << lowerThreshold <<
" > " << upperThreshold <<
endl;
292 calculate(field, lowerThreshold, upperThreshold, triangulate);
#define forAll(list, i)
Loop across all elements in list.
FvWallInfoData< WallInfo, label > label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
void inplaceRenumber(const labelUList &oldToNew, ListType &)
Inplace renumber the values of a list.
thresholdCellFaces(const polyMesh &, const scalarField &, const scalar lowerThreshold, const scalar upperThreshold, const bool triangulate=false)
Construct from mesh, field and threshold value.
Ostream & endl(Ostream &os)
Add newline and flush stream.
label calculate(const fvMesh &mesh, const labelHashSet &patchIDs, const scalar minFaceFraction, GeometricField< scalar, PatchField, GeoMesh > &distance)
Calculate distance data from patches.
vectorField pointField
pointField is a vectorField.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
List< label > labelList
A List of labels.
defineTypeNameAndDebug(combustionModel, 0)
word name(const complex &)
Return a string representation of a complex.
List< surfZone > surfZoneList
static bool & parRun()
Is this a parallel run?
#define WarningInFunction
Report a warning using Foam::Warning.
Mesh consisting of general polyhedral cells.