46 bool Foam::meshStructure::isStructuredCell
53 const cell& cFaces =
mesh.cells()[celli];
59 if (faceToPatchEdgeAddressing_[cFaces[i]] != -1)
65 if (nSide != cFaces.size()-2)
73 if (faceToPatchEdgeAddressing_[cFaces[i]] != -1)
75 const face&
f =
mesh.faces()[cFaces[i]];
78 label nLayerPlus1 = 0;
82 if (pointLayer_[pointi] == layerI)
86 else if (pointLayer_[pointi] == layerI+1)
92 if (
f.size() != 4 || (nLayer+nLayerPlus1 != 4))
103 void Foam::meshStructure::correct
105 const polyMesh&
mesh,
107 const globalIndex& globalFaces,
108 const globalIndex& globalEdges,
109 const globalIndex& globalPoints
113 List<topoDistanceData<label>> cellData(
mesh.
nCells());
114 List<topoDistanceData<label>> faceData(
mesh.
nFaces());
119 Info<< typeName <<
" : seeding "
120 <<
returnReduce(pp.size(), sumOp<label>()) <<
" patch faces"
127 List<topoDistanceData<label>> patchData(pp.size());
130 patchFaces[patchFacei] = pp.addressing()[patchFacei];
131 patchData[patchFacei] = topoDistanceData<label>
134 globalFaces.toGlobal(patchFacei)
140 FaceCellWave<topoDistanceData<label>> distanceCalc
154 cellToPatchFaceAddressing_.setSize(
mesh.
nCells());
156 forAll(cellToPatchFaceAddressing_, celli)
158 cellToPatchFaceAddressing_[celli] = cellData[celli].data();
159 cellLayer_[celli] = cellData[celli].distance();
167 faceToPatchFaceAddressing_.setSize(
mesh.
nFaces());
168 faceToPatchEdgeAddressing_.setSize(
mesh.
nFaces());
169 faceToPatchEdgeAddressing_ =
labelMin;
172 forAll(faceToPatchFaceAddressing_, facei)
175 label patchFacei = faceData[facei].data();
176 label patchDist = faceData[facei].distance();
185 faceToPatchFaceAddressing_[facei] = 0;
186 faceLayer_[facei] = cellData[own].distance();
191 faceToPatchFaceAddressing_[facei] = patchFacei+1;
192 faceToPatchEdgeAddressing_[facei] = -1;
193 faceLayer_[facei] = patchDist;
198 faceToPatchFaceAddressing_[facei] = -(patchFacei+1);
199 faceToPatchEdgeAddressing_[facei] = -1;
200 faceLayer_[facei] = patchDist;
203 else if (patchDist == cellData[own].
distance())
206 faceToPatchFaceAddressing_[facei] = -(patchFacei+1);
207 faceToPatchEdgeAddressing_[facei] = -1;
208 faceLayer_[facei] = patchDist;
229 Info<< typeName <<
" : seeding "
230 <<
returnReduce(pp.nPoints(), sumOp<label>()) <<
" patch points"
235 List<pointTopoDistanceData<label>> edgeData(
mesh.
nEdges());
236 List<pointTopoDistanceData<label>> pointData(
mesh.
nPoints());
240 List<pointTopoDistanceData<label>> patchData(pp.nPoints());
241 forAll(pp.meshPoints(), patchPointi)
243 patchPoints[patchPointi] = pp.meshPoints()[patchPointi];
244 patchData[patchPointi] = pointTopoDistanceData<label>
247 globalPoints.toGlobal(patchPointi)
253 PointEdgeWave<pointTopoDistanceData<label>> distanceCalc
266 pointToPatchPointAddressing_[pointi] = pointData[pointi].data();
267 pointLayer_[pointi] = pointData[pointi].distance();
272 EdgeMap<label> pointsToEdge(pp.nEdges());
275 const edge&
e = pp.edges()[edgeI];
278 globalPoints.toGlobal(
e[0]),
279 globalPoints.toGlobal(
e[1])
281 pointsToEdge.insert(globalEdge, globalEdges.toGlobal(edgeI));
285 forAll(faceToPatchEdgeAddressing_, facei)
287 if (faceToPatchEdgeAddressing_[facei] ==
labelMin)
294 label levelI = pointLayer_[
f[0]];
295 for (label fp = 1; fp <
f.size(); fp++)
297 if (pointLayer_[
f[fp]] != levelI)
315 label patchFacei = faceData[facei].data();
316 label patchDist = faceData[facei].distance();
318 faceToPatchEdgeAddressing_[facei] = -1;
319 faceToPatchFaceAddressing_[facei] = patchFacei+1;
320 faceLayer_[facei] = patchDist;
329 label pointi =
f[fp];
330 label nextPointi =
f.nextLabel(fp);
332 const auto fnd = pointsToEdge.cfind
336 pointData[pointi].data(),
337 pointData[nextPointi].data()
343 faceToPatchEdgeAddressing_[facei] = fnd.val();
344 faceToPatchFaceAddressing_[facei] = 0;
346 faceLayer_[facei] = cellData[own].distance();
362 label nLayers =
gMax(cellLayer_)+1;
366 forAll(layerToCells, layerI)
368 const labelList& lCells = layerToCells[layerI];
372 label celli = lCells[lCelli];
374 structured_ = isStructuredCell
393 reduce(structured_, andOp<bool>());