57 mesh.nInternalPoints(),
61 if (nInternalPoints != -Pstream::nProcs())
63 Info<<
" internal points: " << nInternalPoints <<
nl;
65 if (
returnReduce(mesh.nInternalPoints(), minOp<label>()) == -1)
68 <<
"Some processors have their points sorted into internal"
69 <<
" and external and some do not." <<
endl
70 <<
"This can cause problems later on." <<
endl;
74 if (allTopology && nInternalPoints != -Pstream::nProcs())
79 mesh.nInternalEdges(),
84 mesh.nInternal1Edges(),
89 mesh.nInternal0Edges(),
93 Info<<
" edges: " << nEdges <<
nl
94 <<
" internal edges: " << nInternalEdges <<
nl
95 <<
" internal edges using one boundary point: "
96 << nInternal1Edges-nInternal0Edges <<
nl
97 <<
" internal edges using two boundary points: "
98 << nInternalEdges-nInternal1Edges <<
nl;
105 Info<<
" faces: " << nFaces <<
nl
106 <<
" internal faces: " << nIntFaces <<
nl
107 <<
" cells: " << nCells <<
nl
108 <<
" faces per cell: "
109 << scalar(nFaces + nIntFaces)/
max(1, nCells) <<
nl
110 <<
" boundary patches: " << mesh.boundaryMesh().size() <<
nl
111 <<
" point zones: " << mesh.pointZones().size() <<
nl
112 <<
" face zones: " << mesh.faceZones().size() <<
nl
113 <<
" cell zones: " << mesh.cellZones().size() <<
nl
121 tetWedgeMatcher tetWedge;
133 Map<label> polyhedralFaces;
135 for (
label celli = 0; celli < mesh.nCells(); celli++)
137 if (
hex.isA(mesh, celli))
141 else if (tet.isA(mesh, celli))
145 else if (pyr.isA(mesh, celli))
149 else if (prism.isA(mesh, celli))
153 else if (wedge.isA(mesh, celli))
157 else if (tetWedge.isA(mesh, celli))
164 polyhedralFaces(mesh.cells()[celli].size())++;
168 reduce(nHex,sumOp<label>());
169 reduce(nPrism,sumOp<label>());
170 reduce(nWedge,sumOp<label>());
171 reduce(nPyr,sumOp<label>());
172 reduce(nTetWedge,sumOp<label>());
173 reduce(nTet,sumOp<label>());
174 reduce(nUnknown,sumOp<label>());
176 Info<<
"Overall number of cells of each type:" <<
nl
177 <<
" hexahedra: " << nHex <<
nl
178 <<
" prisms: " << nPrism <<
nl
179 <<
" wedges: " << nWedge <<
nl
180 <<
" pyramids: " << nPyr <<
nl
181 <<
" tet wedges: " << nTetWedge <<
nl
182 <<
" tetrahedra: " << nTet <<
nl
183 <<
" polyhedra: " << nUnknown
188 Pstream::mapCombineGather(polyhedralFaces, plusEqOp<label>());
190 Info<<
" Breakdown of polyhedra by number of faces:" <<
nl
191 <<
" faces" <<
" number of cells" <<
endl;
193 const labelList sortedKeys = polyhedralFaces.sortedToc();
197 const label nFaces = sortedKeys[keyI];
200 << nFaces <<
" " << polyhedralFaces[nFaces] <<
nl;
210 const polyMesh& mesh,
211 const surfaceWriter& writer,
214 const fileName& outputDir
217 if (Pstream::parRun())
221 autoPtr<globalIndex> globalPoints;
222 autoPtr<globalIndex> globalFaces;
228 setPatch.localFaces(),
229 setPatch.meshPoints(),
230 setPatch.meshPointMap(),
233 uniqueMeshPointLabels,
242 if (Pstream::master())
244 writer.write(outputDir,
name, mergedPoints, mergedFaces);
253 setPatch.localPoints(),
254 setPatch.localFaces()
263 mesh.time().globalPath()
264 /functionObjects::writeFile::outputPrefix
266 (mesh.name() != polyMesh::defaultRegion)
271 /mesh.pointsInstance();
277 const surfaceWriter& writer,
281 const polyMesh& mesh = refCast<const polyMesh>(set.db());
285 IndirectList<face>(mesh.faces(), set.sortedToc()),
295 const surfaceWriter& writer,
299 const polyMesh& mesh = refCast<const polyMesh>(set.db());
300 const polyBoundaryMesh& pbm = mesh.boundaryMesh();
304 PackedBoolList isInSet(mesh.nCells());
307 isInSet[iter.key()] =
true;
311 boolList bndInSet(mesh.nFaces()-mesh.nInternalFaces());
314 const polyPatch& pp = pbm[
patchi];
318 bndInSet[pp.start()+i-mesh.nInternalFaces()] = isInSet[fc[i]];
321 syncTools::swapBoundaryFaceList(mesh, bndInSet);
324 DynamicList<label> outsideFaces(3*set.size());
325 for (
label facei = 0; facei < mesh.nInternalFaces(); facei++)
327 bool ownVal = isInSet[mesh.faceOwner()[facei]];
328 bool neiVal = isInSet[mesh.faceNeighbour()[facei]];
330 if (ownVal != neiVal)
332 outsideFaces.append(facei);
339 const polyPatch& pp = pbm[
patchi];
345 label facei = pp.start()+i;
347 bool neiVal = bndInSet[facei-mesh.nInternalFaces()];
348 if (isInSet[fc[i]] && !neiVal)
350 outsideFaces.append(facei);
360 outsideFaces.append(pp.start()+i);
369 IndirectList<face>(mesh.faces(), outsideFaces),
376 mergeAndWrite(mesh, writer, set.name(), setPatch, outputDir);
382 const setWriter& writer,
386 const polyMesh& mesh = refCast<const polyMesh>(set.db());
391 if (Pstream::parRun())
397 globalIndex globalNumbering(mesh.nPoints());
399 mergedPts.setSize(
returnReduce(set.size(), sumOp<label>()));
400 mergedIDs.setSize(mergedPts.size());
405 pointField myPoints(mesh.points(), setPointIDs);
409 myIDs[i] = globalNumbering.toGlobal(setPointIDs[i]);
412 if (Pstream::master())
416 SubList<point>(mergedPts, myPoints.size(), pOffset) = myPoints;
417 SubList<label>(mergedIDs, myIDs.size(), pOffset) = myIDs;
418 pOffset += myPoints.size();
421 for (
int slave=1; slave<Pstream::nProcs(); slave++)
423 IPstream fromSlave(Pstream::commsTypes::scheduled, slave);
428 SubList<point>(mergedPts, slavePts.size(), pOffset) = slavePts;
429 SubList<label>(mergedIDs, slaveIDs.size(), pOffset) = slaveIDs;
430 pOffset += slaveIDs.size();
439 Pstream::commsTypes::scheduled,
441 myPoints.byteSize() + myIDs.byteSize()
443 toMaster << myPoints << myIDs;
448 mergedIDs = set.sortedToc();
449 mergedPts =
pointField(mesh.points(), mergedIDs);
453 if (Pstream::master())
459 coordSet(
false, word::null, mergedPts),
Istream and Ostream manipulators taking arguments.
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
A class for handling file names.
word name() const
Return file name (part beyond last /)
volScalarField scalarField(fieldObject, mesh)
#define WarningInFunction
Report a warning using Foam::Warning.
Smanip< ios_base::fmtflags > setf(const ios_base::fmtflags flags)
List< label > labelList
A List of labels.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
word name(const bool)
Return a word representation of a bool.
Omanip< int > setw(const int i)
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.
IOstream & hex(IOstream &io)
vectorField pointField
pointField is a vectorField.
List< bool > boolList
Bool container classes.
List< scalar > scalarList
A List of scalars.
void printMeshStats(const polyMesh &mesh, const bool allTopology)
Print mesh statistics.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
fileName checkMeshOutputDir(const polyMesh &mesh)
Output directory for sets and surfaces.
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
PrimitivePatch< IndirectList< face >, const pointField & > indirectPrimitivePatch
Foam::indirectPrimitivePatch.