49 Info<<
"Mesh stats" << nl
55 mesh.nInternalPoints(),
59 if (nInternalPoints != -Pstream::nProcs())
61 Info<<
" internal points: " << nInternalPoints <<
nl;
63 if (
returnReduce(mesh.nInternalPoints(), minOp<label>()) == -1)
66 <<
"Some processors have their points sorted into internal" 67 <<
" and external and some do not." << endl
68 <<
"This can cause problems later on." <<
endl;
72 if (allTopology && nInternalPoints != -Pstream::nProcs())
77 mesh.nInternalEdges(),
82 mesh.nInternal1Edges(),
87 mesh.nInternal0Edges(),
91 Info<<
" edges: " << nEdges << nl
92 <<
" internal edges: " << nInternalEdges << nl
93 <<
" internal edges using one boundary point: " 94 << nInternal1Edges-nInternal0Edges << nl
95 <<
" internal edges using two boundary points: " 96 << nInternalEdges-nInternal1Edges <<
nl;
103 Info<<
" faces: " << nFaces << nl
104 <<
" internal faces: " << nIntFaces << nl
105 <<
" cells: " << nCells << nl
106 <<
" faces per cell: " 107 << scalar(nFaces + nIntFaces)/
max(1, nCells) << nl
108 <<
" boundary patches: " << mesh.boundaryMesh().size() << nl
109 <<
" point zones: " << mesh.pointZones().size() << nl
110 <<
" face zones: " << mesh.faceZones().size() << nl
111 <<
" cell zones: " << mesh.cellZones().size() << nl
119 tetWedgeMatcher tetWedge;
131 Map<label> polyhedralFaces;
133 for (
label celli = 0; celli < mesh.nCells(); celli++)
135 if (hex.isA(mesh, celli))
139 else if (tet.isA(mesh, celli))
143 else if (pyr.isA(mesh, celli))
147 else if (prism.isA(mesh, celli))
151 else if (wedge.isA(mesh, celli))
155 else if (tetWedge.isA(mesh, celli))
162 polyhedralFaces(mesh.cells()[celli].size())++;
166 reduce(nHex,sumOp<label>());
167 reduce(nPrism,sumOp<label>());
168 reduce(nWedge,sumOp<label>());
169 reduce(nPyr,sumOp<label>());
170 reduce(nTetWedge,sumOp<label>());
171 reduce(nTet,sumOp<label>());
172 reduce(nUnknown,sumOp<label>());
174 Info<<
"Overall number of cells of each type:" << nl
175 <<
" hexahedra: " << nHex << nl
176 <<
" prisms: " << nPrism << nl
177 <<
" wedges: " << nWedge << nl
178 <<
" pyramids: " << nPyr << nl
179 <<
" tet wedges: " << nTetWedge << nl
180 <<
" tetrahedra: " << nTet << nl
181 <<
" polyhedra: " << nUnknown
186 Pstream::mapCombineGather(polyhedralFaces, plusEqOp<label>());
188 Info<<
" Breakdown of polyhedra by number of faces:" << nl
189 <<
" faces" <<
" number of cells" <<
endl;
191 const labelList sortedKeys = polyhedralFaces.sortedToc();
195 const label nFaces = sortedKeys[keyI];
198 << nFaces <<
" " << polyhedralFaces[nFaces] <<
nl;
208 const polyMesh& mesh,
209 const surfaceWriter& writer,
212 const fileName& outputDir
215 if (Pstream::parRun())
219 autoPtr<globalIndex> globalPoints;
220 autoPtr<globalIndex> globalFaces;
226 setPatch.localFaces(),
227 setPatch.meshPoints(),
228 setPatch.meshPointMap(),
231 uniqueMeshPointLabels,
240 if (Pstream::master())
242 writer.write(outputDir, name, mergedPoints, mergedFaces);
251 setPatch.localPoints(),
252 setPatch.localFaces()
260 const surfaceWriter& writer,
264 const polyMesh& mesh = refCast<const polyMesh>(
set.db());
268 IndirectList<face>(mesh.faces(),
set.sortedToc()),
274 set.time().globalPath()
275 /functionObjects::writeFile::outputPrefix
276 /mesh.pointsInstance()
286 const surfaceWriter& writer,
290 const polyMesh& mesh = refCast<const polyMesh>(
set.db());
291 const polyBoundaryMesh& pbm = mesh.boundaryMesh();
295 PackedBoolList isInSet(mesh.nCells());
298 isInSet[iter.key()] =
true;
302 boolList bndInSet(mesh.nFaces()-mesh.nInternalFaces());
305 const polyPatch& pp = pbm[
patchi];
309 bndInSet[pp.start()+i-mesh.nInternalFaces()] = isInSet[fc[i]];
312 syncTools::swapBoundaryFaceList(mesh, bndInSet);
315 DynamicList<label> outsideFaces(3*
set.size());
316 for (
label facei = 0; facei < mesh.nInternalFaces(); facei++)
318 bool ownVal = isInSet[mesh.faceOwner()[facei]];
319 bool neiVal = isInSet[mesh.faceNeighbour()[facei]];
321 if (ownVal != neiVal)
323 outsideFaces.append(facei);
330 const polyPatch& pp = pbm[
patchi];
336 label facei = pp.start()+i;
338 bool neiVal = bndInSet[facei-mesh.nInternalFaces()];
339 if (isInSet[fc[i]] && !neiVal)
341 outsideFaces.append(facei);
351 outsideFaces.append(pp.start()+i);
360 IndirectList<face>(mesh.faces(), outsideFaces),
367 / (Pstream::parRun() ?
".." :
"")
369 / mesh.pointsInstance()
380 const setWriter<scalar>& writer,
384 const polyMesh& mesh = refCast<const polyMesh>(
set.db());
389 if (Pstream::parRun())
395 globalIndex globalNumbering(mesh.nPoints());
398 mergedIDs.setSize(mergedPts.size());
403 pointField myPoints(mesh.points(), setPointIDs);
407 myIDs[i] = globalNumbering.toGlobal(setPointIDs[i]);
410 if (Pstream::master())
414 SubList<point>(mergedPts, myPoints.size(), pOffset) = myPoints;
415 SubList<label>(mergedIDs, myIDs.size(), pOffset) = myIDs;
416 pOffset += myPoints.size();
419 for (
int slave=1; slave<Pstream::nProcs(); slave++)
421 IPstream fromSlave(Pstream::commsTypes::scheduled, slave);
426 SubList<point>(mergedPts, slavePts.size(), pOffset) = slavePts;
427 SubList<label>(mergedIDs, slaveIDs.size(), pOffset) = slaveIDs;
428 pOffset += slaveIDs.size();
437 Pstream::commsTypes::scheduled,
439 myPoints.byteSize() + myIDs.byteSize()
441 toMaster << myPoints << myIDs;
446 mergedIDs =
set.sortedToc();
447 mergedPts =
pointField(mesh.points(), mergedIDs);
452 if (Pstream::master())
457 scalarPointIDs[i] = 1.0*mergedIDs[i];
460 coordSet
points(
set.
name(),
"distance", mergedPts,
mag(mergedPts));
462 List<const scalarField*> flds(1, &scalarPointIDs);
471 / (Pstream::parRun() ?
".." :
"")
473 / mesh.pointsInstance()
479 fileName outputFile(outputDir/writer.getFileName(
points,
wordList()));
482 OFstream os(outputFile);
484 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)
void mergeAndWrite(const polyMesh &mesh, const surfaceWriter &setWriter, const word &name, const indirectPrimitivePatch setPatch, const fileName &outputDir)
Generate merged surface on master and write. Needs input patch.
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.
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())