45 void Foam::thresholdCellFaces::calculate
48 const scalar lowerThreshold,
49 const scalar upperThreshold,
50 const bool triangulate
54 const labelList& nei = mesh_.faceNeighbour();
56 const faceList& origFaces = mesh_.faces();
59 const polyBoundaryMesh& bMesh = mesh_.boundaryMesh();
64 surfZones[0] = surfZone
74 surfZones[patchI+1] = surfZone
90 DynamicList<face> surfFaces(0.5 * mesh_.nFaces());
91 DynamicList<label> surfCells(surfFaces.size());
93 labelList oldToNewPoints(origPoints.size(), -1);
97 for (
label faceI = 0; faceI < mesh_.nInternalFaces(); ++faceI)
102 if (field[own[faceI]] > lowerThreshold)
104 if (field[nei[faceI]] < lowerThreshold)
109 else if (field[nei[faceI]] > lowerThreshold)
115 if (field[own[faceI]] < upperThreshold)
117 if (field[nei[faceI]] > upperThreshold)
122 else if (field[nei[faceI]] < upperThreshold)
130 const face& f = origFaces[faceI];
134 if (oldToNewPoints[f[fp]] == -1)
136 oldToNewPoints[f[fp]] = nPoints++;
151 surfFace = f.reverseFace();
158 label count = surfFace.triangles(origPoints, surfFaces);
161 surfCells.append(cellId);
166 surfFaces.append(surfFace);
167 surfCells.append(cellId);
172 surfZones[0].size() = surfFaces.size();
178 const polyPatch& p = bMesh[patchI];
179 surfZone& zone = surfZones[patchI+1];
181 zone.start() = nFaces;
185 isA<emptyPolyPatch>(p)
192 label faceI = p.start();
199 field[own[faceI]] > lowerThreshold
200 && field[own[faceI]] < upperThreshold
203 const face& f = origFaces[faceI];
206 if (oldToNewPoints[f[fp]] == -1)
208 oldToNewPoints[f[fp]] = nPoints++;
212 label cellId = own[faceI];
216 label count = f.triangles(origPoints, surfFaces);
219 surfCells.append(cellId);
225 surfCells.append(cellId);
232 zone.size() = surfFaces.size() - zone.start();
248 forAll(oldToNewPoints, pointI)
250 if (oldToNewPoints[pointI] >= 0)
252 surfPoints[oldToNewPoints[pointI]] = origPoints[pointI];
256 surfPoints.setSize(nPoints);
258 this->storedPoints().transfer(surfPoints);
259 this->storedFaces().transfer(surfFaces);
260 this->storedZones().transfer(surfZones);
262 meshCells_.transfer(surfCells);
272 const scalar lowerThreshold,
273 const scalar upperThreshold,
274 const bool triangulate
280 if (lowerThreshold > upperThreshold)
282 WarningIn(
"thresholdCellFaces::thresholdCellFaces(...)")
283 <<
"lower > upper limit! " 284 << lowerThreshold <<
" > " << upperThreshold <<
endl;
287 calculate(field, lowerThreshold, upperThreshold, triangulate);
static bool & parRun()
Is this a parallel run?
List< surfZone > surfZoneList
word name(const complex &)
Return a string representation of a complex.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
vectorField pointField
pointField is a vectorField.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & endl(Ostream &os)
Add newline and flush stream.
#define WarningIn(functionName)
Report a warning using Foam::Warning.
Mesh consisting of general polyhedral cells.
thresholdCellFaces(const polyMesh &, const scalarField &, const scalar lowerThreshold, const scalar upperThreshold, const bool triangulate=false)
Construct from mesh, field and threshold value.
List< label > labelList
A List of labels.
void inplaceRenumber(const labelUList &oldToNew, ListType &)
Inplace renumber the values of a list.
defineTypeNameAndDebug(combustionModel, 0)