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);
422 == processorPolyPatch::typeName
426 patches[patchi] =
new processorPolyPatch
433 patchDicts[patchi].get<label>(
"neighbProcNo"),
457 void Foam::conformalVoronoiMesh::checkProcessorPatchesMatch
476 == processorPolyPatch::typeName
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 " 520 void 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]];
581 void 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;
712 label nReorderedFaces = 0;
722 if (nReorderedFaces > 0)
732 if (rotation[facei] != 0)
734 faces[facei] =
rotateList(faces[facei], rotation[facei]);
739 Info<< indent << returnReduce(nReorderedFaces, sumOp<label>())
740 <<
" faces have been reordered" <<
nl 741 << indent << returnReduce(nRotated, sumOp<label>())
742 <<
" faces have been rotated" 751 const word& meshName,
752 const fileName& instance,
761 bitSet& boundaryFacesToRemove
764 if (foamyHexMeshControls().objOutput())
768 time().
path()/word(meshName +
".obj"),
774 const label nInternalFaces =
patchDicts[0].get<label>(
"startFace");
776 reorderPoints(
points, boundaryPts, faces, nInternalFaces);
780 reorderProcessorPatches
794 timeCheck(
"Before fvMesh construction");
816 label nValidPatches = 0;
820 label totalPatchSize =
patchDicts[
p].get<label>(
"nFaces");
827 == processorPolyPatch::typeName
834 "coincidentFullMatch" 838 if (totalPatchSize > 0)
840 patches[nValidPatches] =
new processorPolyPatch
846 processorPolyPatch::typeName
855 reduce(totalPatchSize, sumOp<label>());
857 if (totalPatchSize > 0)
878 addZones(
mesh, cellCentres);
885 DynamicList<label> bPts(boundaryPts.size());
887 forAll(dualMeshPointTypeNames_, typeI)
890 dualMeshPointTypeNames_[dualMeshPointType(typeI)];
894 const label& bPtType = boundaryPts[ptI];
896 if (bPtType == typeI)
905 <<
"Adding " << bPts.size()
906 <<
" points of type " << znName
932 boundaryFacesToRemove,
933 orEqOp<unsigned int>()
936 labelList addr(boundaryFacesToRemove.toc());
938 faceSet indirectPatchFaces
941 "indirectPatchFaces",
946 indirectPatchFaces.sync(
mesh);
951 timeCheck(
"Before fvMesh filtering");
953 autoPtr<polyMeshFilter> meshFilter;
955 label nInitialBadFaces = 0;
957 if (foamyHexMeshControls().filterEdges())
959 Info<<
nl <<
"Filtering edges on polyMesh" <<
nl <<
endl;
961 meshFilter.reset(
new polyMeshFilter(
mesh, boundaryPts));
965 nInitialBadFaces = meshFilter().filterEdges(0);
967 const autoPtr<fvMesh>& newMesh = meshFilter().filteredMesh();
969 polyTopoChange meshMod(newMesh());
971 autoPtr<mapPolyMesh> map = meshMod.changeMesh(
mesh,
false);
973 polyMeshFilter::copySets(newMesh(),
mesh);
977 if (foamyHexMeshControls().filterFaces())
998 Info<<
nl <<
"Filtering faces on polyMesh" <<
nl <<
endl;
1000 meshFilter.reset(
new polyMeshFilter(
mesh, boundaryPtsIO));
1002 meshFilter().filter(nInitialBadFaces);
1004 const autoPtr<fvMesh>& newMesh = meshFilter().filteredMesh();
1006 polyTopoChange meshMod(newMesh());
1008 autoPtr<mapPolyMesh> map = meshMod.changeMesh(
mesh,
false);
1010 polyMeshFilter::copySets(newMesh(),
mesh);
1014 timeCheck(
"After fvMesh filtering");
1021 <<
"Failed writing polyMesh." 1026 Info<<
nl <<
"Written filtered mesh to " 1027 <<
mesh.polyMesh::instance() <<
nl 1036 "boundaryPoints_collapsed",
1065 boundaryPtsScalarField.write();
1066 boundaryPtsIO.write();
1075 findRemainingProtrusionSet(
mesh);
1085 timeCheck(
"Start writeCellSizes");
1087 Info<<
nl <<
"Create targetCellSize volScalarField" <<
endl;
1094 mesh.polyMesh::instance(),
1101 zeroGradientFvPatchScalarField::typeName
1104 scalarField& cellSize = targetCellSize.primitiveFieldRef();
1110 cellSize[i] = cellShapeControls().cellSize(
C[i]);
1174 targetCellSize.correctBoundaryConditions();
1179 targetCellSize.write();
1288 Info<<
"Writing components of cellCentre positions to volScalarFields" 1289 <<
" ccx, ccy, ccz in " << runTime_.timeName() <<
endl;
1291 for (
direction i=0; i<vector::nComponents; i++)
1297 "cc" + word(vector::componentNames[i]),
1298 runTime_.timeName(),
1313 const polyMesh&
mesh 1316 timeCheck(
"Start findRemainingProtrusionSet");
1328 label meshPtI =
patch.meshPoints()[pLPI];
1334 geometryToConformTo_.wellOutside
1337 sqr(targetCellSize(pt))
1341 protrudingBoundaryPoints.insert(meshPtI);
1346 cellSet protrudingCells
1349 "foamyHexMesh_remainingProtrusions",
1353 for (
const label pointi : protrudingBoundaryPoints)
1356 protrudingCells.insert(pCells);
1359 const label protrudingCellsSize =
1362 if (foamyHexMeshControls().objOutput() && protrudingCellsSize)
1364 Info<<
nl <<
"Found " << protrudingCellsSize
1365 <<
" cells protruding from the surface, writing cellSet " 1366 << protrudingCells.name()
1369 protrudingCells.
write();
1372 return std::move(protrudingCells);
1376 void Foam::conformalVoronoiMesh::writePointPairs
1378 const fileName& fName
1381 OBJstream
os(fName);
1385 Delaunay::Finite_edges_iterator eit = finite_edges_begin();
1386 eit != finite_edges_end();
1390 Cell_handle
c = eit->first;
1391 Vertex_handle vA =
c->vertex(eit->second);
1392 Vertex_handle vB =
c->vertex(eit->third);
1394 if (ptPairs_.isPointPair(vA, vB))
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
List< labelList > labelListList
A List of labelList.
void size(const label n)
Older name for setAddressableSize.
Ostream & indent(Ostream &os)
Indent stream.
pointFromPoint topoint(const Point &P)
errorManipArg< error, int > exit(error &err, const int errNo=1)
label nPoints() const noexcept
Number of mesh points.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
ListType rotateList(const ListType &list, const label n)
Rotate a list by n places.
virtual bool write(const bool valid=true) const
Write mesh using IO settings from time.
static const pointMesh & New(const polyMesh &mesh, Args &&... args)
Get existing or create a new MeshObject.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
constexpr char nl
The newline '\n' character (0x0a)
void inplaceReorder(const labelUList &oldToNew, ListType &input, const bool prune=false)
Inplace reorder the elements of a list.
List< face > faceList
A List of faces.
Ostream & endl(Ostream &os)
Add newline and flush stream.
tmp< GeometricField< cmptType, PatchField, GeoMesh > > component(const direction) const
Return a component of the field.
static bool & parRun() noexcept
Test if this a parallel run.
Ignore writing from objectRegistry::writeObject()
const dimensionSet dimless
Dimensionless.
static int myProcNo(const label communicator=worldComm)
Number of this process (starting from masterNo() = 0)
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.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
Various functions to operate on Lists.
virtual const pointField & points() const
Return raw points.
#define forAll(list, i)
Loop across all elements in list.
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
GeometricField< scalar, fvPatchField, volMesh > volScalarField
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
static label nProcs(const label communicator=worldComm)
Number of ranks in parallel run (for given communicator) is 1 for serial run.
vectorField pointField
pointField is a vectorField.
static void gatherList(const List< commsStruct > &comms, List< T > &values, const int tag, const label comm)
Gather data, but keep individual values separate. Uses the specified communication schedule...
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
Foam::autoPtr< Foam::dynamicFvMesh > meshPtr
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
static word defaultRegion
Return the default region name.
label size() const noexcept
The number of elements in the list.
wordList patchNames(nPatches)
static const word null
An empty word.
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
GeometricField< scalar, pointPatchField, pointMesh > pointScalarField
const vectorField & cellCentres() const
const labelListList & pointCells() const
Ostream & writeLine(const point &p0, const point &p1)
Write line joining two points.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
OBJstream os(runTime.globalPath()/outputName)
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
virtual void print(Ostream &os) const
Print stream description to Ostream.
void addFvPatches(polyPatchList &plist, const bool validBoundary=true)
Add boundary patches. Constructor helper.
static void check(const int retVal, const char *what)
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
void setSize(const label newLen)
Same as resize()
PrimitivePatch< SubList< face >, const pointField & > primitivePatch
A PrimitivePatch with a SubList addressing for the faces, const reference for the point field...
double cpuTimeIncrement() const
Return CPU time (in seconds) since last call to cpuTimeIncrement()
label whichZone(const label objectIndex) const
Given a global object index, return the zone it is in.
const pointZoneMesh & pointZones() const noexcept
Return point zone mesh.
List< word > wordList
A List of words.
void append(autoPtr< T > &ptr)
Move append an element to the end of the list.
void setInstance(const fileName &instance, const IOobjectOption::writeOption wOpt=IOobject::AUTO_WRITE)
Set the instance for mesh files.
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
label nCells() const noexcept
Number of mesh cells.
const dimensionedScalar c
Speed of light in a vacuum.
static bool master(const label communicator=worldComm)
Am I the master rank.
const polyBoundaryMesh & patches
Automatically write from objectRegistry::writeObject()
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...
const std::string patch
OpenFOAM patch number as a std::string.
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.
"nonBlocking" : (MPI_Isend, MPI_Irecv)
messageStream Info
Information stream (stdout output on master, null elsewhere)
Field< vector > vectorField
Specialisation of Field<T> for vector.
static autoPtr< polyPatch > New(const word &patchType, const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm)
Return pointer to a new patch created on freestore from components.
const volVectorField & C() const
Return cell centres as volVectorField.
double elapsedCpuTime() const
Return CPU time (in seconds) from the start.
PtrList< dictionary > patchDicts
List< label > labelList
A List of labels.
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
virtual bool write(const bool valid=true) const
Write using setting from DB.
bool returnReduceOr(const bool value, const label comm=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
Ostream & incrIndent(Ostream &os)
Increment the indent level.
IOList< label > labelIOList
Label container classes.
static constexpr const zero Zero
Global zero (0)