40 void Foam::thresholdCellFaces::calculate
43 const scalar lowerThreshold,
44 const scalar upperThreshold,
45 const bool triangulate
49 const labelList& nei = mesh_.faceNeighbour();
51 const faceList& origFaces = mesh_.faces();
54 const polyBoundaryMesh& bMesh = mesh_.boundaryMesh();
59 surfZones[0] = surfZone
69 surfZones[
patchi+1] = surfZone
85 DynamicList<face> surfFaces(0.5 * mesh_.nFaces());
86 DynamicList<label> surfCells(surfFaces.size());
88 labelList oldToNewPoints(origPoints.size(), -1);
91 polygonTriangulate triEngine;
94 for (
label facei = 0; facei < mesh_.nInternalFaces(); ++facei)
99 if (field[own[facei]] > lowerThreshold)
101 if (field[nei[facei]] < lowerThreshold)
106 else if (field[nei[facei]] > lowerThreshold)
112 if (field[own[facei]] < upperThreshold)
114 if (field[nei[facei]] > upperThreshold)
119 else if (field[nei[facei]] < upperThreshold)
127 const face& f = origFaces[facei];
131 if (oldToNewPoints[f[fp]] == -1)
133 oldToNewPoints[f[fp]] = nPoints++;
148 surfFace = f.reverseFace();
155 triEngine.triangulate
157 UIndirectList<point>(origPoints, surfFace)
159 forAll(triEngine.triPoints(), i)
161 surfFaces.append(triEngine.triPoints(i, surfFace));
162 surfCells.append(cellId);
167 surfFaces.append(surfFace);
168 surfCells.append(cellId);
173 surfZones[0].size() = surfFaces.size();
179 const polyPatch& p = bMesh[
patchi];
180 surfZone& zone = surfZones[
patchi+1];
182 zone.start() = nFaces;
186 isA<emptyPolyPatch>(p)
193 label facei = p.start();
200 field[own[facei]] > lowerThreshold
201 && field[own[facei]] < upperThreshold
204 const face& f = origFaces[facei];
207 if (oldToNewPoints[f[fp]] == -1)
209 oldToNewPoints[f[fp]] = nPoints++;
213 label cellId = own[facei];
217 triEngine.triangulate
219 UIndirectList<point>(origPoints, f)
221 forAll(triEngine.triPoints(), i)
223 surfFaces.append(triEngine.triPoints(i, f));
224 surfCells.append(cellId);
230 surfCells.append(cellId);
237 zone.size() = surfFaces.size() - zone.start();
253 forAll(oldToNewPoints, pointi)
255 if (oldToNewPoints[pointi] >= 0)
257 surfPoints[oldToNewPoints[pointi]] = origPoints[pointi];
261 surfPoints.setSize(nPoints);
263 this->storedPoints().transfer(surfPoints);
264 this->storedFaces().transfer(surfFaces);
265 this->storedZones().transfer(surfZones);
267 meshCells_.transfer(surfCells);
277 const scalar lowerThreshold,
278 const scalar upperThreshold,
279 const bool triangulate
285 if (lowerThreshold > upperThreshold)
288 << lowerThreshold <<
" > " << upperThreshold <<
endl;
291 calculate(field, lowerThreshold, upperThreshold, triangulate);
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t 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.
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.