48 Info<<
"Mesh stats" << nl
54 mesh.nInternalPoints(),
58 if (nInternalPoints != -Pstream::nProcs())
60 Info<<
" internal points: " << nInternalPoints <<
nl;
62 if (
returnReduce(mesh.nInternalPoints(), minOp<label>()) == -1)
65 <<
"Some processors have their points sorted into internal" 66 <<
" and external and some do not." << endl
67 <<
"This can cause problems later on." <<
endl;
71 if (allTopology && nInternalPoints != -Pstream::nProcs())
76 mesh.nInternalEdges(),
81 mesh.nInternal1Edges(),
86 mesh.nInternal0Edges(),
90 Info<<
" edges: " << nEdges << nl
91 <<
" internal edges: " << nInternalEdges << nl
92 <<
" internal edges using one boundary point: " 93 << nInternal1Edges-nInternal0Edges << nl
94 <<
" internal edges using two boundary points: " 95 << nInternalEdges-nInternal1Edges <<
nl;
102 Info<<
" faces: " << nFaces << nl
103 <<
" internal faces: " << nIntFaces << nl
104 <<
" cells: " << nCells << nl
105 <<
" faces per cell: " 106 << scalar(nFaces + nIntFaces)/
max(1, nCells) << nl
107 <<
" boundary patches: " << mesh.boundaryMesh().size() << nl
108 <<
" point zones: " << mesh.pointZones().size() << nl
109 <<
" face zones: " << mesh.faceZones().size() << nl
110 <<
" cell zones: " << mesh.cellZones().size() << nl
118 tetWedgeMatcher tetWedge;
130 Map<label> polyhedralFaces;
132 for (
label celli = 0; celli < mesh.nCells(); celli++)
134 if (hex.isA(mesh, celli))
138 else if (tet.isA(mesh, celli))
142 else if (pyr.isA(mesh, celli))
146 else if (prism.isA(mesh, celli))
150 else if (wedge.isA(mesh, celli))
154 else if (tetWedge.isA(mesh, celli))
161 polyhedralFaces(mesh.cells()[celli].size())++;
165 reduce(nHex,sumOp<label>());
166 reduce(nPrism,sumOp<label>());
167 reduce(nWedge,sumOp<label>());
168 reduce(nPyr,sumOp<label>());
169 reduce(nTetWedge,sumOp<label>());
170 reduce(nTet,sumOp<label>());
171 reduce(nUnknown,sumOp<label>());
173 Info<<
"Overall number of cells of each type:" << nl
174 <<
" hexahedra: " << nHex << nl
175 <<
" prisms: " << nPrism << nl
176 <<
" wedges: " << nWedge << nl
177 <<
" pyramids: " << nPyr << nl
178 <<
" tet wedges: " << nTetWedge << nl
179 <<
" tetrahedra: " << nTet << nl
180 <<
" polyhedra: " << nUnknown
185 Pstream::mapCombineGather(polyhedralFaces, plusEqOp<label>());
187 Info<<
" Breakdown of polyhedra by number of faces:" << nl
188 <<
" faces" <<
" number of cells" <<
endl;
190 const labelList sortedKeys = polyhedralFaces.sortedToc();
194 const label nFaces = sortedKeys[keyI];
197 << nFaces <<
" " << polyhedralFaces[nFaces] <<
nl;
207 const polyMesh& mesh,
208 const surfaceWriter& writer,
211 const fileName& outputDir
214 if (Pstream::parRun())
218 autoPtr<globalIndex> globalPoints;
219 autoPtr<globalIndex> globalFaces;
225 setPatch.localFaces(),
226 setPatch.meshPoints(),
227 setPatch.meshPointMap(),
230 uniqueMeshPointLabels,
239 if (Pstream::master())
241 writer.write(outputDir, name, mergedPoints, mergedFaces);
250 setPatch.localPoints(),
251 setPatch.localFaces()
259 const surfaceWriter& writer,
263 const polyMesh& mesh = refCast<const polyMesh>(
set.db());
267 IndirectList<face>(mesh.faces(),
set.sortedToc()),
274 / (Pstream::parRun() ?
".." :
"")
276 / mesh.pointsInstance()
287 const surfaceWriter& writer,
291 const polyMesh& mesh = refCast<const polyMesh>(
set.db());
292 const polyBoundaryMesh& pbm = mesh.boundaryMesh();
296 PackedBoolList isInSet(mesh.nCells());
299 isInSet[iter.key()] =
true;
303 boolList bndInSet(mesh.nFaces()-mesh.nInternalFaces());
306 const polyPatch& pp = pbm[
patchi];
310 bndInSet[pp.start()+i-mesh.nInternalFaces()] = isInSet[fc[i]];
313 syncTools::swapBoundaryFaceList(mesh, bndInSet);
316 DynamicList<label> outsideFaces(3*
set.size());
317 for (
label facei = 0; facei < mesh.nInternalFaces(); facei++)
319 bool ownVal = isInSet[mesh.faceOwner()[facei]];
320 bool neiVal = isInSet[mesh.faceNeighbour()[facei]];
322 if (ownVal != neiVal)
324 outsideFaces.append(facei);
331 const polyPatch& pp = pbm[
patchi];
337 label facei = pp.start()+i;
339 bool neiVal = bndInSet[facei-mesh.nInternalFaces()];
340 if (isInSet[fc[i]] && !neiVal)
342 outsideFaces.append(facei);
352 outsideFaces.append(pp.start()+i);
361 IndirectList<face>(mesh.faces(), outsideFaces),
368 / (Pstream::parRun() ?
".." :
"")
370 / mesh.pointsInstance()
381 const writer<scalar>& writer,
385 const polyMesh& mesh = refCast<const polyMesh>(
set.db());
390 if (Pstream::parRun())
396 globalIndex globalNumbering(mesh.nPoints());
399 mergedIDs.setSize(mergedPts.size());
404 pointField myPoints(mesh.points(), setPointIDs);
408 myIDs[i] = globalNumbering.toGlobal(setPointIDs[i]);
411 if (Pstream::master())
415 SubList<point>(mergedPts, myPoints.size(), pOffset) = myPoints;
416 SubList<label>(mergedIDs, myIDs.size(), pOffset) = myIDs;
417 pOffset += myPoints.size();
420 for (
int slave=1; slave<Pstream::nProcs(); slave++)
422 IPstream fromSlave(Pstream::commsTypes::scheduled, slave);
427 SubList<point>(mergedPts, slavePts.size(), pOffset) = slavePts;
428 SubList<label>(mergedIDs, slaveIDs.size(), pOffset) = slaveIDs;
429 pOffset += slaveIDs.size();
438 Pstream::commsTypes::scheduled,
440 myPoints.byteSize() + myIDs.byteSize()
442 toMaster << myPoints << myIDs;
447 mergedIDs =
set.sortedToc();
448 mergedPts =
pointField(mesh.points(), mergedIDs);
453 if (Pstream::master())
458 scalarPointIDs[i] = 1.0*mergedIDs[i];
461 coordSet
points(
set.
name(),
"distance", mergedPts,
mag(mergedPts));
463 List<const scalarField*> flds(1, &scalarPointIDs);
472 / (Pstream::parRun() ?
".." :
"")
474 / mesh.pointsInstance()
480 fileName outputFile(outputDir/writer.getFileName(
points,
wordList()));
483 OFstream os(outputFile);
485 writer.write(
points, fldNames, flds, os);
#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.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
IOstream & hex(IOstream &io)
Ostream & endl(Ostream &os)
Add newline and flush stream.
PrimitivePatch< IndirectList< face >, const pointField & > indirectPrimitivePatch
Foam::indirectPrimitivePatch.
List< bool > boolList
Bool container classes.
vectorField pointField
pointField is a vectorField.
Smanip< ios_base::fmtflags > setf(const ios_base::fmtflags flags)
List< label > labelList
A List of labels.
void mergeAndWrite(const polyMesh &mesh, const surfaceWriter &writer, const word &name, const indirectPrimitivePatch setPatch, const fileName &outputDir)
Generate merged surface on master and write. Needs input patch.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
volScalarField scalarField(fieldObject, mesh)
Istream and Ostream manipulators taking arguments.
bool mkDir(const fileName &, mode_t=0777)
Make a directory and return an error if it could not be created.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
word name(const complex &)
Return a string representation of a complex.
void printMeshStats(const polyMesh &mesh, const bool allTopology)
List< word > wordList
A List of words.
void setSize(const label)
Reset size of List.
#define WarningInFunction
Report a warning using Foam::Warning.
dimensioned< scalar > mag(const dimensioned< Type > &)
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
Omanip< int > setw(const int i)
fileName path(UMean.rootPath()/UMean.caseName()/functionObjects::writeFile::outputPrefix/"graphs"/UMean.instance())