39 void Foam::thresholdCellFaces::calculate
42 const scalar lowerThreshold,
43 const scalar upperThreshold,
44 const bool triangulate
48 const labelList& nei = mesh_.faceNeighbour();
50 const faceList& origFaces = mesh_.faces();
53 const polyBoundaryMesh& bMesh = mesh_.boundaryMesh();
58 surfZones[0] = surfZone
68 surfZones[
patchi+1] = surfZone
84 DynamicList<face> surfFaces(0.5 * mesh_.nFaces());
85 DynamicList<label> surfCells(surfFaces.size());
87 labelList oldToNewPoints(origPoints.size(), -1);
91 for (
label facei = 0; facei < mesh_.nInternalFaces(); ++facei)
96 if (field[own[facei]] > lowerThreshold)
98 if (field[nei[facei]] < lowerThreshold)
103 else if (field[nei[facei]] > lowerThreshold)
109 if (field[own[facei]] < upperThreshold)
111 if (field[nei[facei]] > upperThreshold)
116 else if (field[nei[facei]] < upperThreshold)
124 const face& f = origFaces[facei];
128 if (oldToNewPoints[f[fp]] == -1)
130 oldToNewPoints[f[fp]] = nPoints++;
145 surfFace = f.reverseFace();
152 label count = surfFace.triangles(origPoints, surfFaces);
155 surfCells.append(cellId);
160 surfFaces.append(surfFace);
161 surfCells.append(cellId);
166 surfZones[0].size() = surfFaces.size();
172 const polyPatch& p = bMesh[
patchi];
173 surfZone& zone = surfZones[
patchi+1];
175 zone.start() = nFaces;
179 isA<emptyPolyPatch>(p)
186 label facei = p.start();
193 field[own[facei]] > lowerThreshold
194 && field[own[facei]] < upperThreshold
197 const face& f = origFaces[facei];
200 if (oldToNewPoints[f[fp]] == -1)
202 oldToNewPoints[f[fp]] = nPoints++;
206 label cellId = own[facei];
210 label count = f.triangles(origPoints, surfFaces);
213 surfCells.append(cellId);
219 surfCells.append(cellId);
226 zone.size() = surfFaces.size() - zone.start();
242 forAll(oldToNewPoints, pointi)
244 if (oldToNewPoints[pointi] >= 0)
246 surfPoints[oldToNewPoints[pointi]] = origPoints[pointi];
250 surfPoints.setSize(nPoints);
252 this->storedPoints().transfer(surfPoints);
253 this->storedFaces().transfer(surfFaces);
254 this->storedZones().transfer(surfZones);
256 meshCells_.transfer(surfCells);
266 const scalar lowerThreshold,
267 const scalar upperThreshold,
268 const bool triangulate
274 if (lowerThreshold > upperThreshold)
277 << lowerThreshold <<
" > " << upperThreshold <<
endl;
280 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.