53 allPatchNames_.
clear();
57 faceZoneNames_.
clear();
59 boundaryFaceToBeIncluded_.
clear();
78 if (patchPatterns_.
empty())
80 forAll(allPatchNames_, nameI)
82 patchNames_.
insert(allPatchNames_[nameI]);
88 forAll(allPatchNames_, nameI)
90 const word& patchName = allPatchNames_[nameI];
93 patchNames_.
insert(patchName);
100 if (patchNames_.
size())
103 patchPartOffset_ = 1;
134 const cellShape& cellShape = cellShapes[celli];
135 const cellModel& cellModel = cellShape.model();
137 if (cellModel == tet)
139 tets[nTets++] = celli;
141 else if (cellModel == pyr)
143 pyrs[nPyrs++] = celli;
145 else if (cellModel == prism)
147 prisms[nPrisms++] = celli;
149 else if (cellModel == wedge)
151 wedges[nWedges++] = celli;
153 else if (cellModel == hex)
155 hexes[nHexes++] = celli;
159 polys[nPolys++] = celli;
165 prisms.setSize(nPrisms);
166 wedges.setSize(nWedges);
167 hexes.setSize(nHexes);
168 polys.setSize(nPolys);
170 meshCellSets_.
nTets = nTets;
173 meshCellSets_.
nPyrs = nPyrs;
176 meshCellSets_.
nPrisms = nPrisms;
182 meshCellSets_.
nPolys = nPolys;
206 tris.setSize(p.size());
207 quads.setSize(p.size());
208 polys.setSize(p.size());
216 const face& f = p[facei];
220 tris[nTris++] = facei;
222 else if (f.size() == 4)
224 quads[nQuads++] = facei;
228 polys[nPolys++] = facei;
233 quads.setSize(nQuads);
234 polys.setSize(nPolys);
241 const word& patchName = allPatchNames_[
patchi];
244 if (patchNames_.
empty() || patchNames_.
found(patchName))
248 nfp.nTris = boundaryFaceSets_[
patchi].tris.size();
249 nfp.nQuads = boundaryFaceSets_[
patchi].quads.size();
250 nfp.nPolys = boundaryFaceSets_[
patchi].polys.size();
254 reduce(nfp.nTris, sumOp<label>());
255 reduce(nfp.nQuads, sumOp<label>());
256 reduce(nfp.nPolys, sumOp<label>());
258 nPatchPrims_.insert(patchName, nfp);
267 sort(faceZoneNamesAll);
270 forAll(faceZoneNamesAll, nameI)
272 const word& zoneName = faceZoneNamesAll[nameI];
275 faceZoneNames_.
insert(zoneName);
280 boundaryFaceToBeIncluded_.
setSize 292 isA<processorPolyPatch>(pp)
293 && !refCast<const processorPolyPatch>(pp).owner()
299 boundaryFaceToBeIncluded_[bFacei++] = 0;
305 forAll(faceZoneNamesAll, zoneI)
307 const word& zoneName = faceZoneNamesAll[zoneI];
310 const faceZone& fz = mesh_.
faceZones()[faceZoneId];
314 labelList& tris = faceZoneFaceSets_[faceZoneId].tris;
315 labelList& quads = faceZoneFaceSets_[faceZoneId].quads;
316 labelList& polys = faceZoneFaceSets_[faceZoneId].polys;
318 tris.setSize(fz.size());
319 quads.setSize(fz.size());
320 polys.setSize(fz.size());
326 label faceCounter = 0;
335 const face& f = mesh_.
faces()[facei];
339 tris[nTris++] = faceCounter;
341 else if (f.size() == 4)
343 quads[nQuads++] = faceCounter;
347 polys[nPolys++] = faceCounter;
355 quads.setSize(nQuads);
356 polys.setSize(nPolys);
360 forAll(faceZoneNamesAll, zoneI)
362 const word& zoneName = faceZoneNamesAll[zoneI];
366 if (faceZoneNames_.
found(zoneName))
370 faceZoneFaceSets_[faceZoneId].tris.size()
371 || faceZoneFaceSets_[faceZoneId].quads.size()
372 || faceZoneFaceSets_[faceZoneId].polys.size()
375 nfp.nTris = faceZoneFaceSets_[faceZoneId].tris.size();
376 nfp.nQuads = faceZoneFaceSets_[faceZoneId].quads.size();
377 nfp.nPolys = faceZoneFaceSets_[faceZoneId].polys.size();
381 reduce(nfp.nTris, sumOp<label>());
382 reduce(nfp.nQuads, sumOp<label>());
383 reduce(nfp.nPolys, sumOp<label>());
385 nFaceZonePrims_.insert(zoneName, nfp);
396 const bool noPatches,
401 const bool faceZones,
408 noPatches_(noPatches),
410 patchPatterns_(patchPatterns),
411 faceZones_(faceZones),
412 faceZonePatterns_(faceZonePatterns),
414 meshCellSets_(mesh.nCells())
448 reduce(appI,maxOp<label>());
463 mcsl[i] = cellShapes[prims[i]];
483 mcsl[i] = cellShapes[hexes[i]];
487 label offset = hexes.size();
494 const cellShape& cellPoints = cellShapes[wedges[i]];
496 hexLabels[0] = cellPoints[0];
497 hexLabels[1] = cellPoints[1];
498 hexLabels[2] = cellPoints[0];
499 hexLabels[3] = cellPoints[2];
500 hexLabels[4] = cellPoints[3];
501 hexLabels[5] = cellPoints[4];
502 hexLabels[6] = cellPoints[6];
503 hexLabels[7] = cellPoints[5];
505 mcsl[i + offset] = cellShape(hex, hexLabels);
513 void Foam::ensightMesh::writePrims
516 ensightStream& ensightGeometryFile
520 if (cellShapes.size())
522 if (ensightGeometryFile.ascii())
528 const cellShape& cellPoints = cellShapes[i];
530 List<int> temp(cellPoints.size());
532 forAll(cellPoints, pointi)
534 temp[pointi] = cellPoints[pointi] + 1;
536 ensightGeometryFile.write(temp);
542 int numIntElem = cellShapes.size()*cellShapes[0].size();
543 List<int> temp(numIntElem);
549 const cellShape& cellPoints = cellShapes[i];
551 forAll(cellPoints, pointi)
553 temp[
n] = cellPoints[pointi] + 1;
557 ensightGeometryFile.write(temp);
563 void Foam::ensightMesh::writePolysNFaces
567 ensightStream& ensightGeometryFile
572 ensightGeometryFile.write(cellFaces[polys[i]].size());
577 void Foam::ensightMesh::writePolysNPointsPerFace
582 ensightStream& ensightGeometryFile
587 const labelList& cf = cellFaces[polys[i]];
591 ensightGeometryFile.write(faces[cf[facei]].size());
597 void Foam::ensightMesh::writePolysPoints
603 ensightStream& ensightGeometryFile
608 const labelList& cf = cellFaces[polys[i]];
612 const label faceId = cf[facei];
613 const face& f = faces[
faceId];
614 const label np = f.size();
615 bool reverseOrder =
false;
616 if (faceId >= faceOwner.size())
629 if (faceOwner[faceId] != polys[i])
646 temp[np-1-pointi] = f[pointi] + 1;
650 temp[pointi] = f[pointi] + 1;
653 ensightGeometryFile.write(temp);
659 void Foam::ensightMesh::writeAllPolys
662 ensightStream& ensightGeometryFile
679 ensightGeometryFile.write(
"nfaced");
680 ensightGeometryFile.write(meshCellSets_.
nPolys);
716 toMaster<< meshCellSets_.
polys << cellFaces;
724 writePolysNPointsPerFace
739 writePolysNPointsPerFace
755 toMaster<< meshCellSets_.
polys << cellFaces << faces;
797 toMaster<< meshCellSets_.
polys << cellFaces << faces << faceOwner;
803 void Foam::ensightMesh::writeAllPrims
808 ensightStream& ensightGeometryFile
815 ensightGeometryFile.write(key);
816 ensightGeometryFile.write(nPrims);
818 writePrims(cellShapes, ensightGeometryFile);
825 writePrims(cellShapes, ensightGeometryFile);
841 void Foam::ensightMesh::writeFacePrims
844 ensightStream& ensightGeometryFile
849 const face& patchFace = patchFaces[i];
851 List<int> temp(patchFace.size());
854 temp[pointi] = patchFace[pointi] + 1;
857 ensightGeometryFile.write(temp);
862 void Foam::ensightMesh::writeAllFacePrims
868 ensightStream& ensightGeometryFile
875 ensightGeometryFile.write(key);
876 ensightGeometryFile.write(nPrims);
880 UIndirectList<face>(patchFaces, prims)(),
889 writeFacePrims(patchFaces, ensightGeometryFile);
899 toMaster<< UIndirectList<face>(patchFaces, prims);
905 void Foam::ensightMesh::writeNSidedNPointsPerFace
908 ensightStream& ensightGeometryFile
913 ensightGeometryFile.write(patchFaces[i].size());
918 void Foam::ensightMesh::writeNSidedPoints
921 ensightStream& ensightGeometryFile
924 writeFacePrims(patchFaces, ensightGeometryFile);
928 void Foam::ensightMesh::writeAllNSided
933 ensightStream& ensightGeometryFile
940 ensightGeometryFile.write(
"nsided");
941 ensightGeometryFile.write(nPrims);
947 writeNSidedNPointsPerFace
949 UIndirectList<face>(patchFaces, prims)(),
958 writeNSidedNPointsPerFace
972 toMaster<< UIndirectList<face>(patchFaces, prims);
980 UIndirectList<face>(patchFaces, prims)(),
989 writeNSidedPoints(patchFaces, ensightGeometryFile);
999 toMaster<< UIndirectList<face>(patchFaces, prims);
1005 void Foam::ensightMesh::writeAllPoints
1007 const label ensightPartI,
1008 const word& ensightPartName,
1010 const label nPoints,
1011 ensightStream& ensightGeometryFile
1018 ensightGeometryFile.writePartHeader(ensightPartI);
1019 ensightGeometryFile.write(ensightPartName.c_str());
1020 ensightGeometryFile.write(
"coordinates");
1021 ensightGeometryFile.write(nPoints);
1025 ensightGeometryFile.write(uniquePoints.component(d));
1030 ensightGeometryFile.write(patchPointsComponent);
1043 toMaster<< uniquePoints.component(d);
1051 const fileName& postProcPath,
1052 const word& prepend,
1053 const label timeIndex,
1054 const bool meshMoving,
1055 Ostream& ensightCaseFile
1058 const Time& runTime = mesh_.
time();
1062 word timeFile = prepend;
1066 timeFile +=
"0000.";
1068 else if (meshMoving)
1070 timeFile +=
itoa(timeIndex) +
'.';
1074 fileName ensightGeometryFileName = timeFile +
"mesh";
1076 ensightStream* ensightGeometryFilePtr =
nullptr;
1081 ensightGeometryFilePtr =
new ensightBinaryStream
1083 postProcPath/ensightGeometryFileName,
1086 ensightGeometryFilePtr->write(
"C binary");
1090 ensightGeometryFilePtr =
new ensightAsciiStream
1092 postProcPath/ensightGeometryFileName,
1098 ensightStream& ensightGeometryFile = *ensightGeometryFilePtr;
1104 ensightGeometryFile.write(
"EnSight Geometry File");
1105 ensightGeometryFile.write(desc.c_str());
1106 ensightGeometryFile.write(
"node id assign");
1107 ensightGeometryFile.write(
"element id assign");
1110 if (patchNames_.
empty())
1132 meshCellSets_.
hexes,
1143 map(cellShapes, meshCellSets_.
prisms, pointToGlobal_),
1150 meshCellSets_.
nPyrs,
1151 map(cellShapes, meshCellSets_.
pyrs, pointToGlobal_),
1158 meshCellSets_.
nTets,
1159 map(cellShapes, meshCellSets_.
tets, pointToGlobal_),
1171 label ensightPatchi = patchPartOffset_;
1175 const word& patchName = allPatchNames_[
patchi];
1177 if (patchNames_.
empty() || patchNames_.
found(patchName))
1179 const nFacePrimitives& nfp = nPatchPrims_[patchName];
1181 if (nfp.nTris || nfp.nQuads || nfp.nPolys)
1192 autoPtr<globalIndex> globalPointsPtr =
1198 uniqueMeshPointLabels
1203 faceList patchFaces(p.localFaces());
1214 globalPointsPtr().size(),
1250 const word& faceZoneName = iter.key();
1254 const faceZone& fz = mesh_.
faceZones()[faceID];
1256 const nFacePrimitives& nfp = nFaceZonePrims_[faceZoneName];
1258 if (nfp.nTris || nfp.nQuads || nfp.nPolys)
1260 const labelList& tris = faceZoneFaceSets_[faceID].tris;
1261 const labelList& quads = faceZoneFaceSets_[faceID].quads;
1262 const labelList& polys = faceZoneFaceSets_[faceID].polys;
1267 autoPtr<globalIndex> globalPointsPtr =
1271 fz().meshPointMap(),
1273 uniqueMeshPointLabels
1280 faceList faceZoneFaces(fz().localFaces());
1284 label nMasterFaces = 0;
1295 faceList faceZoneMasterFaces(nMasterFaces);
1297 label currentFace = 0;
1303 faceZoneMasterFaces[currentFace] = faceZoneFaces[facei];
1309 forAll(faceZoneMasterFaces, i)
1319 globalPointsPtr().size(),
1328 faceZoneMasterFaces,
1337 faceZoneMasterFaces,
1345 faceZoneMasterFaces,
1353 delete ensightGeometryFilePtr;
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
label findZoneID(const word &zoneName) const
Find zone index given a name.
#define forAll(list, i)
Loop across all elements in list.
const labelList & processorPatches() const
Return list of processor patch labels.
bool empty() const
Return true if the UList is empty (ie, size() is zero)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
static int masterNo()
Process index of the master.
static const cellModel * lookup(const word &)
Look up a model by name and return a pointer to the model or nullptr.
void inplaceRenumber(const labelUList &oldToNew, ListType &)
Inplace renumber the values of a list.
label nInternalFaces() const
void size(const label)
Override size to be inconsistent with allocated storage.
const cellShapeList & cellShapes() const
Return cell shapes.
bool empty() const
Return true if the hash table is empty.
static bool master(const label communicator=0)
Am I the master process.
const cellList & cells() const
~ensightMesh()
Destructor.
autoPtr< globalIndex > mergePoints(labelList &pointToGlobal, labelList &uniquePoints) const
Helper for merging (collocated!) mesh point data.
Operations on lists of strings.
const Time & time() const
Return the top-level database.
const char *const FOAMversion
bool insert(const Key &key)
Insert a new entry.
Combination-Reduction operation for a parallel run. The information from all nodes is collected on th...
label size() const
Return number of elements in table.
ensightMesh(const fvMesh &mesh, const bool noPatches, const bool patches, const wordReList &patchPatterns, const bool faceZones, const wordReList &faceZonePatterns, const bool binary)
Construct from fvMesh.
bool findStrings(const wordReListMatcher &matcher, const std::string &str)
Return true if string matches one of the regular expressions.
virtual const pointField & points() const
Return raw points.
wordList names() const
Return a list of zone names.
void correct()
Update for new mesh.
void setSize(const label nCells)
static const direction nComponents
Number of components in this vector space.
vectorField pointField
pointField is a vectorField.
List< cellShape > cellShapeList
List of cellShapes and PtrList of List of cellShape.
bool found(const Key &) const
Return true if hashedEntry is found in table.
void clear()
Clear the list, i.e. set size to zero.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
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()
const cellShapeList & cellShapes
void clear()
Clear all entries from table.
wordList names() const
Return a list of patch names.
label size() const
Global sum of localSizes.
virtual const labelList & faceOwner() const
Return face owner.
const fvMesh & mesh() const
const globalMeshData & globalData() const
Return parallel info.
List< label > labelList
A List of labels.
HashSet wordHashSet
A HashSet with word keys.
virtual const faceList & faces() const
Return raw faces.
void setSize(const label, const unsigned int &val=0u)
Alias for resize()
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
void clear()
Clear the list, i.e. set addressable size to zero.
bool isInternalFace(const label faceIndex) const
Return true if given face label is internal to the mesh.
Istream and Ostream manipulators taking arguments.
bool checkParallelSync(const bool report=false) const
Check whether all procs have all patches and in same order. Return.
static void barrier()
Helper to cause barrier. Necessary on Quadrics.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
label size() const
Return the number of elements in the UPtrList.
List< word > wordList
A List of words.
void setSize(const label)
Reset size of List.
static bool & parRun()
Is this a parallel run?
static label nProcs(const label communicator=0)
Number of processes in parallel run.
const meshFaceZones & faceZones() const
Return face zones.
List< wordRe > wordReList
A List of wordRe (word or regular expression)
const labelList & pointToGlobal() const
From mesh point to global merged point.
const globalIndex & globalPoints() const
Global numbering for merged points.
bool faceToBeIncluded(const label facei) const
When exporting faceZones, check if a given face has to be included.
List< cell > cellList
list of cells
void write(const fileName &postProcPath, const word &prepend, const label timeIndex, const bool meshMoving, Ostream &ensightCaseFile) const
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.