42 bool Foam::meshStructure::isStructuredCell
49 const cell& cFaces = mesh.cells()[celli];
55 if (faceToPatchEdgeAddressing_[cFaces[i]] != -1)
61 if (nSide != cFaces.size()-2)
69 if (faceToPatchEdgeAddressing_[cFaces[i]] != -1)
71 const face&
f = mesh.faces()[cFaces[i]];
74 label nLayerPlus1 = 0;
78 if (pointLayer_[pointi] == layerI)
82 else if (pointLayer_[pointi] == layerI+1)
88 if (
f.size() != 4 || (nLayer+nLayerPlus1 != 4))
99 void Foam::meshStructure::correct
101 const polyMesh& mesh,
106 List<topoDistanceData> cellData(mesh.nCells());
107 List<topoDistanceData> faceData(mesh.nFaces());
112 Info<< typeName <<
" : seeding "
113 <<
returnReduce(pp.size(), sumOp<label>()) <<
" patch faces"
120 List<topoDistanceData> patchData(pp.size());
123 patchFaces[patchFacei] = pp.addressing()[patchFacei];
124 patchData[patchFacei] = topoDistanceData(patchFacei, 0);
129 FaceCellWave<topoDistanceData> distanceCalc
136 mesh.globalData().nTotalCells()+1
143 cellToPatchFaceAddressing_.setSize(mesh.nCells());
144 cellLayer_.setSize(mesh.nCells());
145 forAll(cellToPatchFaceAddressing_, celli)
147 cellToPatchFaceAddressing_[celli] = cellData[celli].data();
148 cellLayer_[celli] = cellData[celli].distance();
156 faceToPatchFaceAddressing_.setSize(mesh.nFaces());
157 faceToPatchEdgeAddressing_.setSize(mesh.nFaces());
158 faceToPatchEdgeAddressing_ =
labelMin;
159 faceLayer_.setSize(mesh.nFaces());
161 forAll(faceToPatchFaceAddressing_, facei)
163 label own = mesh.faceOwner()[facei];
164 label patchFacei = faceData[facei].data();
165 label patchDist = faceData[facei].distance();
167 if (mesh.isInternalFace(facei))
169 label nei = mesh.faceNeighbour()[facei];
171 if (cellData[own].distance() == cellData[nei].distance())
174 faceToPatchFaceAddressing_[facei] = 0;
175 faceLayer_[facei] = cellData[own].distance();
177 else if (cellData[own].distance() < cellData[nei].distance())
180 faceToPatchFaceAddressing_[facei] = patchFacei+1;
181 faceToPatchEdgeAddressing_[facei] = -1;
182 faceLayer_[facei] = patchDist;
187 faceToPatchFaceAddressing_[facei] = -(patchFacei+1);
188 faceToPatchEdgeAddressing_[facei] = -1;
189 faceLayer_[facei] = patchDist;
192 else if (patchDist == cellData[own].distance())
195 faceToPatchFaceAddressing_[facei] = -(patchFacei+1);
196 faceToPatchEdgeAddressing_[facei] = -1;
197 faceLayer_[facei] = patchDist;
213 pointToPatchPointAddressing_.setSize(mesh.nPoints());
214 pointLayer_.setSize(mesh.nPoints());
218 Info<< typeName <<
" : seeding "
219 <<
returnReduce(pp.nPoints(), sumOp<label>()) <<
" patch points"
224 List<pointTopoDistanceData> edgeData(mesh.nEdges());
225 List<pointTopoDistanceData> pointData(mesh.nPoints());
229 List<pointTopoDistanceData> patchData(pp.nPoints());
230 forAll(pp.meshPoints(), patchPointi)
232 patchPoints[patchPointi] = pp.meshPoints()[patchPointi];
233 patchData[patchPointi] = pointTopoDistanceData(patchPointi, 0);
238 PointEdgeWave<pointTopoDistanceData> distanceCalc
246 mesh.globalData().nTotalPoints()
251 pointToPatchPointAddressing_[pointi] = pointData[pointi].data();
252 pointLayer_[pointi] = pointData[pointi].distance();
257 EdgeMap<label> pointsToEdge(pp.nEdges());
260 pointsToEdge.insert(pp.edges()[edgeI], edgeI);
264 forAll(faceToPatchEdgeAddressing_, facei)
266 if (faceToPatchEdgeAddressing_[facei] ==
labelMin)
271 const face&
f = mesh.faces()[facei];
273 label levelI = pointLayer_[
f[0]];
276 if (pointLayer_[
f[fp]] != levelI)
293 label patchFacei = faceData[facei].data();
294 label patchDist = faceData[facei].distance();
296 faceToPatchEdgeAddressing_[facei] = -1;
297 faceToPatchFaceAddressing_[facei] = patchFacei+1;
298 faceLayer_[facei] = patchDist;
308 label nextPointi =
f.nextLabel(fp);
314 pointData[pointi].data(),
315 pointData[nextPointi].data()
318 if (fnd != pointsToEdge.end())
320 faceToPatchEdgeAddressing_[facei] = fnd();
321 faceToPatchFaceAddressing_[facei] = 0;
322 label own = mesh.faceOwner()[facei];
323 faceLayer_[facei] = cellData[own].distance();
343 forAll(layerToCells, layerI)
345 const labelList& lCells = layerToCells[layerI];
349 label celli = lCells[lCelli];
351 structured_ = isStructuredCell
370 reduce(structured_, andOp<bool>());
#define forAll(list, i)
Loop across all elements in list.
friend class const_iterator
Declare friendship with the const_iterator.
void size(const label)
Override size to be inconsistent with allocated storage.
A list of faces which address into the list of points.
Detect extruded mesh structure given a set of patch faces.
meshStructure(const polyMesh &mesh, const uindirectPrimitivePatch &)
Construct null.
Mesh consisting of general polyhedral cells.
void correct(const RdeltaTType &rDeltaT, const RhoType &rho, volScalarField &psi, const surfaceScalarField &phiCorr, const SpType &Sp, const SuType &Su)
List< label > labelList
A List of labels.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
labelListList invertOneToMany(const label len, const labelUList &)
Invert one-to-many map. Unmapped elements will be size 0.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
PrimitivePatch< UIndirectList< face >, const pointField & > uindirectPrimitivePatch
Foam::uindirectPrimitivePatch.
List< labelList > labelListList
A List of labelList.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
defineTypeNameAndDebug(combustionModel, 0)
Type gMax(const FieldField< Field, Type > &f)
static const label labelMin