48 const string& description
58 const string& description,
64 Info<<
nl <<
"--- [ cpuTime "
70 Info<<
", " << description <<
" ";
83 PrintTable<word, label> memoryTable
89 memoryTable.add(
"mSize", m.size());
90 memoryTable.add(
"mPeak", m.peak());
91 memoryTable.add(
"mRss", m.rss());
121 bitSet boundaryFacesToRemove;
133 cellToDelaunayVertex,
134 patchToDelaunayVertex,
135 boundaryFacesToRemove
138 Info<<
nl <<
"Writing polyMesh to " << instance <<
endl;
152 boundaryFacesToRemove
157 forAll(dualPatchStarts, patchi)
159 dualPatchStarts[patchi] =
164 if (foamyHexMeshControls().writeCellShapeControlMesh())
166 cellShapeControls().shapeControlMesh().write();
169 if (foamyHexMeshControls().writeBackgroundMeshDecomposition())
171 Info<<
nl <<
"Writing " <<
"backgroundMeshDecomposition" <<
endl;
174 const_cast<fvMesh&
>(decomposition_().mesh()).setInstance
179 decomposition_().mesh().
write();
182 if (foamyHexMeshControls().writeTetDualMesh())
187 Finite_cells_iterator cit = finite_cells_begin();
188 cit != finite_cells_end();
198 cit->cellIndex() = celli++;
202 Info<<
nl <<
"Writing " <<
"tetDualMesh" <<
endl;
206 autoPtr<polyMesh> tetMesh =
207 createMesh(
"tetDualMesh", vertexMap, cellMap);
426 patches[patchi] =
new processorPolyPatch
433 patchDicts[patchi].get<label>(
"neighbProcNo"),
457void Foam::conformalVoronoiMesh::checkProcessorPatchesMatch
480 const label procNeighb =
481 patchDicts[patchi].get<label>(
"neighbProcNo");
492 bool allMatch =
true;
494 forAll(procPatchSizes, proci)
496 const labelList& patchSizes = procPatchSizes[proci];
498 forAll(patchSizes, patchi)
500 if (patchSizes[patchi] != procPatchSizes[patchi][proci])
504 Info<<
indent <<
"Patches " << proci <<
" and " << patchi
505 <<
" have different sizes: " << patchSizes[patchi]
506 <<
" and " << procPatchSizes[patchi][proci] <<
endl;
513 Info<<
indent <<
"All processor patches have matching numbers of "
520void Foam::conformalVoronoiMesh::reorderPoints
525 const label nInternalFaces
534 for (label fI = nInternalFaces; fI < faces.size(); ++fI)
536 const face&
f = faces[fI];
540 oldToNew[
f[fpI]] = 1;
546 label countInternal = 0;
547 label countExternal = nInternalPoints;
551 if (oldToNew[pI] == 0)
553 oldToNew[pI] = countInternal++;
557 oldToNew[pI] = countExternal++;
562 <<
"Number of internal points: " << countInternal <<
nl
563 <<
indent <<
"Number of external points: " << countExternal
575 f[fpI] = oldToNew[
f[fpI]];
581void Foam::conformalVoronoiMesh::reorderProcessorPatches
583 const word& meshName,
584 const fileName& instance,
597 autoPtr<fvMesh> sortMeshPtr
614 const fvMesh& sortMesh = sortMeshPtr();
623 forAll(sortMesh.boundaryMesh(), patchi)
625 const polyPatch& pp = sortMesh.boundaryMesh()[patchi];
627 if (isA<processorPolyPatch>(pp))
629 refCast<const processorPolyPatch>(pp).initOrder
646 pBufs.finishedSends();
651 bool anyChanged =
false;
653 forAll(sortMesh.boundaryMesh(), patchi)
655 const polyPatch& pp = sortMesh.boundaryMesh()[patchi];
657 if (isA<processorPolyPatch>(pp))
659 const label nPatchFaces =
662 const label patchStartFace =
665 labelList patchFaceMap(nPatchFaces, label(-1));
668 bool changed = refCast<const processorPolyPatch>(pp).order
688 forAll(patchFaceRotation, patchFacei)
690 rotation[patchFacei + patchStartFace]
691 = patchFaceRotation[patchFacei];
694 forAll(patchFaceMap, patchFacei)
696 if (patchFaceMap[patchFacei] != patchFacei)
698 faceMap[patchFacei + patchStartFace]
699 = patchFaceMap[patchFacei] + patchStartFace;
710 reduce(anyChanged, orOp<bool>());
714 label nReorderedFaces = 0;
724 if (nReorderedFaces > 0)
734 if (rotation[facei] != 0)
736 faces[facei] =
rotateList(faces[facei], rotation[facei]);
741 Info<< indent << returnReduce(nReorderedFaces, sumOp<label>())
742 <<
" faces have been reordered" <<
nl
744 <<
" faces have been rotated"
753 const word& meshName,
754 const fileName& instance,
763 bitSet& boundaryFacesToRemove
766 if (foamyHexMeshControls().objOutput())
770 time().
path()/word(meshName +
".obj"),
776 const label nInternalFaces =
patchDicts[0].get<label>(
"startFace");
778 reorderPoints(
points, boundaryPts, faces, nInternalFaces);
782 reorderProcessorPatches
796 timeCheck(
"Before fvMesh construction");
818 label nValidPatches = 0;
822 label totalPatchSize =
patchDicts[
p].get<label>(
"nFaces");
836 "coincidentFullMatch"
840 if (totalPatchSize > 0)
842 patches[nValidPatches] =
new processorPolyPatch
857 reduce(totalPatchSize, sumOp<label>());
859 if (totalPatchSize > 0)
880 addZones(
mesh, cellCentres);
887 DynamicList<label> bPts(boundaryPts.size());
889 forAll(dualMeshPointTypeNames_, typeI)
892 dualMeshPointTypeNames_[dualMeshPointType(typeI)];
896 const label& bPtType = boundaryPts[ptI];
898 if (bPtType == typeI)
907 <<
"Adding " << bPts.size()
908 <<
" points of type " << znName
934 boundaryFacesToRemove,
935 orEqOp<unsigned int>()
938 labelList addr(boundaryFacesToRemove.toc());
940 faceSet indirectPatchFaces
943 "indirectPatchFaces",
948 indirectPatchFaces.sync(
mesh);
953 timeCheck(
"Before fvMesh filtering");
955 autoPtr<polyMeshFilter> meshFilter;
957 label nInitialBadFaces = 0;
959 if (foamyHexMeshControls().filterEdges())
961 Info<<
nl <<
"Filtering edges on polyMesh" <<
nl <<
endl;
963 meshFilter.reset(
new polyMeshFilter(
mesh, boundaryPts));
967 nInitialBadFaces = meshFilter().filterEdges(0);
969 const autoPtr<fvMesh>& newMesh = meshFilter().filteredMesh();
971 polyTopoChange meshMod(newMesh());
973 autoPtr<mapPolyMesh> map = meshMod.changeMesh(
mesh,
false);
975 polyMeshFilter::copySets(newMesh(),
mesh);
979 if (foamyHexMeshControls().filterFaces())
1000 Info<<
nl <<
"Filtering faces on polyMesh" <<
nl <<
endl;
1002 meshFilter.reset(
new polyMeshFilter(
mesh, boundaryPtsIO));
1004 meshFilter().filter(nInitialBadFaces);
1006 const autoPtr<fvMesh>& newMesh = meshFilter().filteredMesh();
1008 polyTopoChange meshMod(newMesh());
1010 autoPtr<mapPolyMesh> map = meshMod.changeMesh(
mesh,
false);
1012 polyMeshFilter::copySets(newMesh(),
mesh);
1016 timeCheck(
"After fvMesh filtering");
1023 <<
"Failed writing polyMesh."
1028 Info<<
nl <<
"Written filtered mesh to "
1029 <<
mesh.polyMesh::instance() <<
nl
1038 "boundaryPoints_collapsed",
1067 boundaryPtsScalarField.write();
1068 boundaryPtsIO.write();
1077 findRemainingProtrusionSet(
mesh);
1087 timeCheck(
"Start writeCellSizes");
1089 Info<<
nl <<
"Create targetCellSize volScalarField" <<
endl;
1096 mesh.polyMesh::instance(),
1103 zeroGradientFvPatchScalarField::typeName
1106 scalarField& cellSize = targetCellSize.primitiveFieldRef();
1112 cellSize[i] = cellShapeControls().cellSize(C[i]);
1176 targetCellSize.correctBoundaryConditions();
1181 targetCellSize.write();
1290 Info<<
"Writing components of cellCentre positions to volScalarFields"
1291 <<
" ccx, ccy, ccz in " << runTime_.timeName() <<
endl;
1300 runTime_.timeName(),
1315 const polyMesh&
mesh
1318 timeCheck(
"Start findRemainingProtrusionSet");
1330 label meshPtI =
patch.meshPoints()[pLPI];
1336 geometryToConformTo_.wellOutside
1339 sqr(targetCellSize(pt))
1343 protrudingBoundaryPoints.insert(meshPtI);
1348 cellSet protrudingCells
1351 "foamyHexMesh_remainingProtrusions",
1355 for (
const label pointi : protrudingBoundaryPoints)
1358 protrudingCells.insert(pCells);
1361 const label protrudingCellsSize =
1364 if (foamyHexMeshControls().objOutput() && protrudingCellsSize)
1366 Info<<
nl <<
"Found " << protrudingCellsSize
1367 <<
" cells protruding from the surface, writing cellSet "
1368 << protrudingCells.name()
1371 protrudingCells.
write();
1374 return std::move(protrudingCells);
1378void Foam::conformalVoronoiMesh::writePointPairs
1380 const fileName& fName
1383 OBJstream
os(fName);
1387 Delaunay::Finite_edges_iterator eit = finite_edges_begin();
1388 eit != finite_edges_end();
1392 Cell_handle
c = eit->first;
1393 Vertex_handle vA =
c->vertex(eit->second);
1394 Vertex_handle vB =
c->vertex(eit->third);
1396 if (ptPairs_.isPointPair(vA, vB))
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
Various functions to operate on Lists.
tmp< GeometricField< cmptType, PatchField, GeoMesh > > component(const direction) const
Return a component of the field.
virtual void print(Ostream &os) const
Print stream description to Ostream.
virtual Ostream & write(const char c)
Write character.
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
label nProcs() const noexcept
Number of ranks associated with PstreamBuffers.
static void gatherList(const List< commsStruct > &comms, List< T > &values, const int tag, const label comm)
void append(T *ptr)
Append an element to the end of the list.
void setSize(const label newLen)
Same as resize()
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
void size(const label n)
Older name for setAddressableSize.
@ nonBlocking
"nonBlocking"
static bool & parRun() noexcept
Test if this a parallel run.
label size() const noexcept
The number of elements in the list.
label whichZone(const label objectIndex) const
Given a global object index, return the zone it is in.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
double cpuTimeIncrement() const
Return CPU time (in seconds) since last call to cpuTimeIncrement()
double elapsedCpuTime() const
Return CPU time (in seconds) from the start.
void writeMesh() const
Write equivalent mesh information at the polyMesh faceInstances time.
Writes the cell-centres volVectorField and the three component fields as volScalarFields.
const volVectorField & C() const
Return cell centres as volVectorField.
virtual bool write(const bool valid=true) const
Write mesh using IO settings from time.
void addFvPatches(polyPatchList &plist, const bool validBoundary=true)
Add boundary patches. Constructor helper.
static const char *const componentNames[]
static constexpr direction nComponents
Number of components in bool is 1.
void setInstance(const fileName &instance, const IOobject::writeOption wOpt=IOobject::AUTO_WRITE)
Set the instance for mesh files.
static word defaultRegion
Return the default region name.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
const pointZoneMesh & pointZones() const noexcept
Return point zone mesh.
virtual const pointField & points() const
Return raw points.
const labelListList & pointCells() const
const vectorField & cellCentres() const
label nPoints() const noexcept
Number of mesh points.
label nCells() const noexcept
Number of mesh cells.
int myProcNo() const noexcept
Return processor number.
splitCell * master() const
static const word null
An empty word.
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
const polyBoundaryMesh & patches
Foam::autoPtr< Foam::dynamicFvMesh > meshPtr
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
const dimensionedScalar c
Speed of light in a vacuum.
const std::string patch
OpenFOAM patch number as a std::string.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
List< word > wordList
A List of words.
const dimensionSet dimless
Dimensionless.
GeometricField< scalar, pointPatchField, pointMesh > pointScalarField
List< label > labelList
A List of labels.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
line< point, const point & > linePointRef
A line using referred points.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
pointFromPoint topoint(const Point &P)
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
messageStream Info
Information stream (stdout output on master, null elsewhere)
ListType rotateList(const ListType &list, const label n)
Rotate a list by n places.
static void check(const int retVal, const char *what)
vectorField pointField
pointField is a vectorField.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & incrIndent(Ostream &os)
Increment the indent level.
PrimitivePatch< SubList< face >, const pointField & > primitivePatch
A PrimitivePatch with a SubList addressing for the faces, const reference for the point field.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Ostream & indent(Ostream &os)
Indent stream.
HashTable< label, labelPair, Foam::Hash< labelPair > > labelPairLookup
This is a Map of a labelPair to a label. Used for e.g. for face1, face2 to shared edge....
void inplaceReorder(const labelUList &oldToNew, ListType &input, const bool prune=false)
Inplace reorder the elements of a list.
List< labelList > labelListList
A List of labelList.
void reduce(const List< UPstream::commsStruct > &comms, T &value, const BinaryOp &bop, const int tag, const label comm)
IOList< label > labelIOList
Label container classes.
Field< vector > vectorField
Specialisation of Field<T> for vector.
static constexpr const zero Zero
Global zero (0)
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Reduce (copy) and return value.
List< face > faceList
A List of faces.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
constexpr char nl
The newline '\n' character (0x0a)
wordList patchNames(nPatches)
PtrList< dictionary > patchDicts
#define forAll(list, i)
Loop across all elements in list.
static const char *const typeName
The type name used in ensight case files.