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];
174 faceToPatchFaceAddressing_[facei] = 0;
175 faceLayer_[facei] = cellData[own].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]];
274 for (
label fp = 1; fp < f.size(); fp++)
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;
307 label pointi = f[fp];
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>());
List< labelList > labelListList
A List of labelList.
#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.
meshStructure(const polyMesh &mesh, const uindirectPrimitivePatch &)
Construct null.
labelListList invertOneToMany(const label len, const labelUList &)
Invert one-to-many map. Unmapped elements will be size 0.
Ostream & endl(Ostream &os)
Add newline and flush stream.
scalar distance(const vector &p1, const vector &p2)
A list of faces which address into the list of points.
Info<< "Predicted p max-min : "<< max(p).value()<< " "<< min(p).value()<< endl;rho==max(rho0+psi *p, rhoMin);# 1 "/home/ubuntu/OpenFOAM-9/applications/solvers/multiphase/cavitatingFoam/alphavPsi.H" 1{ alphav=max(min((rho - rholSat)/(rhovSat - rholSat), scalar(1)), scalar(0));alphal=1.0 - alphav;Info<< "max-min alphav: "<< max(alphav).value()<< " "<< min(alphav).value()<< endl;psiModel-> correct()
friend class const_iterator
Declare friendship with the const_iterator.
List< label > labelList
A List of labels.
Type gMax(const FieldField< Field, Type > &f)
defineTypeNameAndDebug(combustionModel, 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.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
Mesh consisting of general polyhedral cells.
static const label labelMin