55 Info<<
"Mesh stats " <<
mesh.regionName() <<
nl 65 if (minInt == -1 && maxInt > 0)
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;
72 else if (minInt != -1)
77 mesh.nInternalPoints(),
80 Info<<
" internal points: " << nInternalPoints <<
nl;
83 if (allTopology && (minInt != -1))
88 mesh.nInternalEdges(),
93 mesh.nInternal1Edges(),
98 mesh.nInternal0Edges(),
102 Info<<
" edges: " << nEdges <<
nl 103 <<
" internal edges: " << nInternalEdges <<
nl 104 <<
" internal edges using one boundary point: " 105 << nInternal1Edges-nInternal0Edges <<
nl 106 <<
" internal edges using two boundary points: " 107 << nInternalEdges-nInternal1Edges <<
nl;
111 label nIntFaces =
returnReduce(
mesh.faceNeighbour().size(), sumOp<label>());
115 Info<<
" faces: " << nFaces <<
nl 116 <<
" internal faces: " << nIntFaces <<
nl 117 <<
" cells: " << nCells <<
nl 118 <<
" faces per cell: " 119 << (scalar(nFaces) + scalar(nIntFaces))/
max(1, nCells) <<
nl 120 <<
" boundary patches: ";
122 if (Pstream::parRun())
125 Info<<
mesh.boundaryMesh().nNonProcessor() <<
' ' 133 Info<<
" point zones: " <<
mesh.pointZones().size() <<
nl 134 <<
" face zones: " <<
mesh.faceZones().size() <<
nl 135 <<
" cell zones: " <<
mesh.cellZones().size() <<
nl 141 tetWedgeMatcher tetWedge;
152 Map<label> polyhedralFaces;
154 for (label celli = 0; celli <
mesh.nCells(); celli++)
156 if (hexMatcher::test(
mesh, celli))
160 else if (tetMatcher::test(
mesh, celli))
164 else if (pyrMatcher::test(
mesh, celli))
168 else if (prism.isA(
mesh, celli))
172 else if (wedge.isA(
mesh, celli))
176 else if (tetWedge.isA(
mesh, celli))
183 polyhedralFaces(
mesh.cells()[celli].size())++;
187 reduce(nHex,sumOp<label>());
188 reduce(nPrism,sumOp<label>());
189 reduce(nWedge,sumOp<label>());
190 reduce(nPyr,sumOp<label>());
191 reduce(nTetWedge,sumOp<label>());
192 reduce(nTet,sumOp<label>());
193 reduce(nUnknown,sumOp<label>());
195 Info<<
"Overall number of cells of each type:" <<
nl 196 <<
" hexahedra: " << nHex <<
nl 197 <<
" prisms: " << nPrism <<
nl 198 <<
" wedges: " << nWedge <<
nl 199 <<
" pyramids: " << nPyr <<
nl 200 <<
" tet wedges: " << nTetWedge <<
nl 201 <<
" tetrahedra: " << nTet <<
nl 202 <<
" polyhedra: " << nUnknown
207 Pstream::mapCombineGather(polyhedralFaces, plusEqOp<label>());
209 Info<<
" Breakdown of polyhedra by number of faces:" <<
nl 210 <<
" faces" <<
" number of cells" <<
endl;
212 const labelList sortedKeys = polyhedralFaces.sortedToc();
216 const label nFaces = sortedKeys[keyi];
219 << nFaces <<
" " << polyhedralFaces[nFaces] <<
nl;
229 const polyMesh&
mesh,
233 const fileName& outputDir
238 setPatch.localPoints(),
239 setPatch.localFaces(),
254 const polyMesh&
mesh = refCast<const polyMesh>(
set.db());
258 IndirectList<face>(
mesh.faces(),
set.sortedToc()),
264 set.time().globalPath()
265 / functionObject::outputPrefix
266 /
mesh.pointsInstance()
281 const polyMesh&
mesh = refCast<const polyMesh>(
set.db());
282 const polyBoundaryMesh&
pbm =
mesh.boundaryMesh();
286 bitSet isInSet(
mesh.nCells());
287 for (
const label celli :
set)
296 const polyPatch&
pp =
pbm[patchi];
300 bndInSet[
pp.start()+i-
mesh.nInternalFaces()] = isInSet[fc[i]];
303 syncTools::swapBoundaryFaceList(
mesh, bndInSet);
306 DynamicList<label> outsideFaces(3*
set.size());
307 for (label facei = 0; facei <
mesh.nInternalFaces(); facei++)
309 const bool ownVal = isInSet[
mesh.faceOwner()[facei]];
310 const bool neiVal = isInSet[
mesh.faceNeighbour()[facei]];
312 if (ownVal != neiVal)
314 outsideFaces.append(facei);
321 const polyPatch&
pp =
pbm[patchi];
327 label facei =
pp.start()+i;
329 const bool neiVal = bndInSet[facei-
mesh.nInternalFaces()];
330 if (isInSet[fc[i]] && !neiVal)
332 outsideFaces.append(facei);
342 outsideFaces.append(
pp.start()+i);
351 IndirectList<face>(
mesh.faces(), outsideFaces),
357 set.time().globalPath()
358 / functionObject::outputPrefix
359 /
mesh.pointsInstance()
374 const polyMesh&
mesh = refCast<const polyMesh>(
set.db());
379 if (Pstream::parRun())
386 globalIndex(
mesh.nPoints()).inplaceToGlobal(mergedIDs);
388 globalIndex gatherer(globalIndex::gatherOnly{}, mergedIDs.size());
389 gatherer.gatherInplace(mergedIDs);
390 gatherer.gatherInplace(mergedPts);
395 if (Pstream::master())
397 coordSet coords(
set.
name(),
"distance", mergedPts,
mag(mergedPts));
403 set.time().globalPath()
404 / functionObject::outputPrefix
405 /
mesh.pointsInstance()
410 writer.open(coords, outputPath);
412 writer.write(
"pointID", mergedIDs);
const polyBoundaryMesh & pbm
Field< label > labelField
Specialisation of Field<T> for label.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
vtk::lineWriter writer(edgeCentres, edgeList::null(), fileName(aMesh.time().globalPath()/"finiteArea-edgesCentres"))
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
void mergeAndWrite(const polyMesh &mesh, surfaceWriter &writer, const word &name, const indirectPrimitivePatch &setPatch, const fileName &outputDir)
Generate merged surface on master and write. Needs input patch.
PrimitivePatch< IndirectList< face >, const pointField & > indirectPrimitivePatch
A PrimitivePatch with an IndirectList for the faces, const reference for the point field...
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
#define forAll(list, i)
Loop across all elements in list.
vectorField pointField
pointField is a vectorField.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Smanip< ios_base::fmtflags > setf(const ios_base::fmtflags flags)
MinMax< label > labelMinMax
A label min/max range.
Istream and Ostream manipulators taking arguments.
#define WarningInFunction
Report a warning using Foam::Warning.
void printMeshStats(const polyMesh &mesh, const bool allTopology)
void reduce(const List< UPstream::commsStruct > &comms, T &value, const BinaryOp &bop, const int tag, const label comm)
Reduce inplace (cf. MPI Allreduce) using specified communication schedule.
List< label > sortedToc(const UList< bool > &bools)
Return the (sorted) values corresponding to 'true' entries.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Omanip< int > setw(const int i)
List< label > labelList
A List of labels.
List< bool > boolList
A List of bools.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())