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);
393 Foam::ensightMesh::ensightMesh
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);
712 toMaster<< meshCellSets_.
polys << cellFaces;
720 writePolysNPointsPerFace
735 writePolysNPointsPerFace
747 toMaster<< meshCellSets_.
polys << cellFaces << faces;
785 toMaster<< meshCellSets_.
polys << cellFaces << faces << faceOwner;
791 void Foam::ensightMesh::writeAllPrims
796 ensightStream& ensightGeometryFile
803 ensightGeometryFile.write(key);
804 ensightGeometryFile.write(nPrims);
806 writePrims(cellShapes, ensightGeometryFile);
813 writePrims(cellShapes, ensightGeometryFile);
825 void Foam::ensightMesh::writeFacePrims
828 ensightStream& ensightGeometryFile
833 const face& patchFace = patchFaces[i];
835 List<int> temp(patchFace.size());
838 temp[pointi] = patchFace[pointi] + 1;
841 ensightGeometryFile.write(temp);
846 void Foam::ensightMesh::writeAllFacePrims
852 ensightStream& ensightGeometryFile
859 ensightGeometryFile.write(key);
860 ensightGeometryFile.write(nPrims);
864 UIndirectList<face>(patchFaces, prims)(),
873 writeFacePrims(patchFaces, ensightGeometryFile);
879 toMaster<< UIndirectList<face>(patchFaces, prims);
885 void Foam::ensightMesh::writeNSidedNPointsPerFace
888 ensightStream& ensightGeometryFile
893 ensightGeometryFile.write(patchFaces[i].size());
898 void Foam::ensightMesh::writeNSidedPoints
901 ensightStream& ensightGeometryFile
904 writeFacePrims(patchFaces, ensightGeometryFile);
908 void Foam::ensightMesh::writeAllNSided
913 ensightStream& ensightGeometryFile
920 ensightGeometryFile.write(
"nsided");
921 ensightGeometryFile.write(nPrims);
927 writeNSidedNPointsPerFace
929 UIndirectList<face>(patchFaces, prims)(),
938 writeNSidedNPointsPerFace
948 toMaster<< UIndirectList<face>(patchFaces, prims);
956 UIndirectList<face>(patchFaces, prims)(),
965 writeNSidedPoints(patchFaces, ensightGeometryFile);
971 toMaster<< UIndirectList<face>(patchFaces, prims);
977 void Foam::ensightMesh::writeAllPoints
979 const label ensightPartI,
980 const word& ensightPartName,
983 ensightStream& ensightGeometryFile
990 ensightGeometryFile.writePartHeader(ensightPartI);
991 ensightGeometryFile.write(ensightPartName.c_str());
992 ensightGeometryFile.write(
"coordinates");
993 ensightGeometryFile.write(nPoints);
997 ensightGeometryFile.write(uniquePoints.component(d));
1002 ensightGeometryFile.write(patchPointsComponent);
1011 toMaster<< uniquePoints.component(d);
1019 const fileName& postProcPath,
1020 const word& prepend,
1021 const label timeIndex,
1022 const bool meshMoving,
1023 Ostream& ensightCaseFile
1026 const Time& runTime = mesh_.
time();
1030 word timeFile = prepend;
1034 timeFile +=
"0000.";
1036 else if (meshMoving)
1038 timeFile +=
itoa(timeIndex) +
'.';
1042 fileName ensightGeometryFileName = timeFile +
"mesh";
1044 ensightStream* ensightGeometryFilePtr = NULL;
1049 ensightGeometryFilePtr =
new ensightBinaryStream
1051 postProcPath/ensightGeometryFileName,
1054 ensightGeometryFilePtr->write(
"C binary");
1058 ensightGeometryFilePtr =
new ensightAsciiStream
1060 postProcPath/ensightGeometryFileName,
1066 ensightStream& ensightGeometryFile = *ensightGeometryFilePtr;
1072 ensightGeometryFile.write(
"EnSight Geometry File");
1073 ensightGeometryFile.write(desc.c_str());
1074 ensightGeometryFile.write(
"node id assign");
1075 ensightGeometryFile.write(
"element id assign");
1078 if (patchNames_.
empty())
1100 meshCellSets_.
hexes,
1111 map(cellShapes, meshCellSets_.
prisms, pointToGlobal_),
1118 meshCellSets_.
nPyrs,
1119 map(cellShapes, meshCellSets_.
pyrs, pointToGlobal_),
1126 meshCellSets_.
nTets,
1127 map(cellShapes, meshCellSets_.
tets, pointToGlobal_),
1139 label ensightPatchi = patchPartOffset_;
1143 const word& patchName = allPatchNames_[
patchi];
1145 if (patchNames_.
empty() || patchNames_.
found(patchName))
1147 const nFacePrimitives& nfp = nPatchPrims_[patchName];
1149 if (nfp.nTris || nfp.nQuads || nfp.nPolys)
1160 autoPtr<globalIndex> globalPointsPtr =
1166 uniqueMeshPointLabels
1171 faceList patchFaces(p.localFaces());
1182 globalPointsPtr().size(),
1218 const word& faceZoneName = iter.key();
1222 const faceZone& fz = mesh_.
faceZones()[faceID];
1224 const nFacePrimitives& nfp = nFaceZonePrims_[faceZoneName];
1226 if (nfp.nTris || nfp.nQuads || nfp.nPolys)
1228 const labelList& tris = faceZoneFaceSets_[faceID].tris;
1229 const labelList& quads = faceZoneFaceSets_[faceID].quads;
1230 const labelList& polys = faceZoneFaceSets_[faceID].polys;
1235 autoPtr<globalIndex> globalPointsPtr =
1239 fz().meshPointMap(),
1241 uniqueMeshPointLabels
1248 faceList faceZoneFaces(fz().localFaces());
1252 label nMasterFaces = 0;
1263 faceList faceZoneMasterFaces(nMasterFaces);
1265 label currentFace = 0;
1271 faceZoneMasterFaces[currentFace] = faceZoneFaces[facei];
1277 forAll(faceZoneMasterFaces, i)
1287 globalPointsPtr().size(),
1296 faceZoneMasterFaces,
1305 faceZoneMasterFaces,
1313 faceZoneMasterFaces,
1321 delete ensightGeometryFilePtr;
void write(const fileName &postProcPath, const word &prepend, const label timeIndex, const bool meshMoving, Ostream &ensightCaseFile) const
#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.
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 NULL.
autoPtr< globalIndex > mergePoints(labelList &pointToGlobal, labelList &uniquePoints) const
Helper for merging (collocated!) mesh point data.
void inplaceRenumber(const labelUList &oldToNew, ListType &)
Inplace renumber the values of a list.
bool checkParallelSync(const bool report=false) const
Check whether all procs have all patches and in same order. Return.
wordList names() const
Return a list of patch names.
bool empty() const
Return true if the UList is empty (ie, size() is zero)
void size(const label)
Override size to be inconsistent with allocated storage.
bool faceToBeIncluded(const label facei) const
When exporting faceZones, check if a given face has to be included.
static bool master(const label communicator=0)
Am I the master process.
const labelList & processorPatches() const
Return list of processor patch labels.
label size() const
Return number of elements in table.
~ensightMesh()
Destructor.
Operations on lists of strings.
const char *const FOAMversion
bool isInternalFace(const label faceIndex) const
Return true if given face label is internal to the mesh.
bool insert(const Key &key)
Insert a new entry.
const cellList & cells() const
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Combination-Reduction operation for a parallel run. The information from all nodes is collected on th...
virtual const pointField & points() const
Return raw points.
label size() const
Global sum of localSizes.
bool findStrings(const wordReListMatcher &matcher, const std::string &str)
Return true if string matches one of the regular expressions.
void correct()
Update for new mesh.
void setSize(const label nCells)
const cellShapeList & cellShapes() const
Return cell shapes.
label findZoneID(const word &zoneName) const
Find zone index given a name.
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.
void clear()
Clear the list, i.e. set size to zero.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
const cellShapeList & cellShapes
wordList names() const
Return a list of zone names.
void clear()
Clear all entries from table.
List< label > labelList
A List of labels.
HashSet wordHashSet
A HashSet with word keys.
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 empty() const
Return true if the hash table is empty.
bool found(const Key &) const
Return true if hashedEntry is found in table.
const globalMeshData & globalData() const
Return parallel info.
Istream and Ostream manipulators taking arguments.
const fvMesh & mesh() const
Info<< "Predicted p max-min : "<< max(p).value()<< " "<< min(p).value()<< endl;rho==max(psi *p+alphal *rhol0+((alphav *psiv+alphal *psil)-psi)*pSat, rhoMin);#1"/home/ubuntu/OpenFOAM-4.1/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()
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)
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 faceZoneMesh & faceZones() const
Return face zone mesh.
List< wordRe > wordReList
A List of wordRe (word or regular expression)
virtual const labelList & faceOwner() const
Return face owner.
virtual const faceList & faces() const
Return raw faces.
const labelList & pointToGlobal() const
From mesh point to global merged point.
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
label nInternalFaces() const
const globalIndex & globalPoints() const
Global numbering for merged points.
List< cell > cellList
list of cells
const Time & time() const
Return the top-level database.
label size() const
Return the number of elements in the UPtrList.