49 const string& description
59 const string& description,
65 Info<<
nl <<
"--- [ cpuTime " 69 if (!description.empty())
71 Info<<
", " << description <<
" ";
84 PrintTable<word, label> memoryTable
90 memoryTable.add(
"mSize", m.size());
91 memoryTable.add(
"mPeak", m.peak());
92 memoryTable.add(
"mRss", m.rss());
122 bitSet boundaryFacesToRemove;
134 cellToDelaunayVertex,
135 patchToDelaunayVertex,
136 boundaryFacesToRemove
139 Info<<
nl <<
"Writing polyMesh to " << instance <<
endl;
153 boundaryFacesToRemove
158 forAll(dualPatchStarts, patchi)
160 dualPatchStarts[patchi] =
165 if (foamyHexMeshControls().writeCellShapeControlMesh())
167 cellShapeControls().shapeControlMesh().write();
170 if (foamyHexMeshControls().writeBackgroundMeshDecomposition())
172 Info<<
nl <<
"Writing " <<
"backgroundMeshDecomposition" <<
endl;
175 const_cast<fvMesh&
>(decomposition_().mesh()).setInstance
180 decomposition_().mesh().
write();
183 if (foamyHexMeshControls().writeTetDualMesh())
188 Finite_cells_iterator cit = finite_cells_begin();
189 cit != finite_cells_end();
199 cit->cellIndex() = celli++;
203 Info<<
nl <<
"Writing " <<
"tetDualMesh" <<
endl;
207 autoPtr<polyMesh> tetMesh =
208 createMesh(
"tetDualMesh", vertexMap, cellMap);
423 == processorPolyPatch::typeName
427 patches[patchi] =
new processorPolyPatch
434 patchDicts[patchi].get<label>(
"neighbProcNo"),
458 void Foam::conformalVoronoiMesh::checkProcessorPatchesMatch
477 == processorPolyPatch::typeName
481 const label procNeighb =
482 patchDicts[patchi].get<label>(
"neighbProcNo");
493 bool allMatch =
true;
495 forAll(procPatchSizes, proci)
497 const labelList& patchSizes = procPatchSizes[proci];
499 forAll(patchSizes, patchi)
501 if (patchSizes[patchi] != procPatchSizes[patchi][proci])
505 Info<<
indent <<
"Patches " << proci <<
" and " << patchi
506 <<
" have different sizes: " << patchSizes[patchi]
507 <<
" and " << procPatchSizes[patchi][proci] <<
endl;
514 Info<<
indent <<
"All processor patches have matching numbers of " 521 void Foam::conformalVoronoiMesh::reorderPoints
526 const label nInternalFaces
535 for (label fI = nInternalFaces; fI < faces.size(); ++fI)
537 const face&
f = faces[fI];
541 oldToNew[
f[fpI]] = 1;
547 label countInternal = 0;
548 label countExternal = nInternalPoints;
552 if (oldToNew[pI] == 0)
554 oldToNew[pI] = countInternal++;
558 oldToNew[pI] = countExternal++;
563 <<
"Number of internal points: " << countInternal <<
nl 564 <<
indent <<
"Number of external points: " << countExternal
576 f[fpI] = oldToNew[
f[fpI]];
582 void Foam::conformalVoronoiMesh::reorderProcessorPatches
584 const word& meshName,
585 const fileName& instance,
598 autoPtr<fvMesh> sortMeshPtr
615 const fvMesh& sortMesh = sortMeshPtr();
624 forAll(sortMesh.boundaryMesh(), patchi)
626 const polyPatch&
pp = sortMesh.boundaryMesh()[patchi];
628 if (isA<processorPolyPatch>(
pp))
630 refCast<const processorPolyPatch>(
pp).initOrder
647 pBufs.finishedSends();
652 bool anyChanged =
false;
654 forAll(sortMesh.boundaryMesh(), patchi)
656 const polyPatch&
pp = sortMesh.boundaryMesh()[patchi];
658 if (isA<processorPolyPatch>(
pp))
660 const label nPatchFaces =
663 const label patchStartFace =
666 labelList patchFaceMap(nPatchFaces, label(-1));
669 bool changed = refCast<const processorPolyPatch>(
pp).order
689 forAll(patchFaceRotation, patchFacei)
691 rotation[patchFacei + patchStartFace]
692 = patchFaceRotation[patchFacei];
695 forAll(patchFaceMap, patchFacei)
697 if (patchFaceMap[patchFacei] != patchFacei)
699 faceMap[patchFacei + patchStartFace]
700 = patchFaceMap[patchFacei] + patchStartFace;
713 label nReorderedFaces = 0;
723 if (nReorderedFaces > 0)
733 if (rotation[facei] != 0)
735 faces[facei] =
rotateList(faces[facei], rotation[facei]);
740 Info<< indent << returnReduce(nReorderedFaces, sumOp<label>())
741 <<
" faces have been reordered" <<
nl 742 << indent << returnReduce(nRotated, sumOp<label>())
743 <<
" faces have been rotated" 752 const word& meshName,
753 const fileName& instance,
762 bitSet& boundaryFacesToRemove
765 if (foamyHexMeshControls().objOutput())
769 time().
path()/word(meshName +
".obj"),
775 const label nInternalFaces =
patchDicts[0].get<label>(
"startFace");
777 reorderPoints(
points, boundaryPts, faces, nInternalFaces);
781 reorderProcessorPatches
795 timeCheck(
"Before fvMesh construction");
817 label nValidPatches = 0;
821 label totalPatchSize =
patchDicts[
p].get<label>(
"nFaces");
828 == processorPolyPatch::typeName
835 "coincidentFullMatch" 839 if (totalPatchSize > 0)
841 patches[nValidPatches] =
new processorPolyPatch
847 processorPolyPatch::typeName
856 reduce(totalPatchSize, sumOp<label>());
858 if (totalPatchSize > 0)
879 addZones(
mesh, cellCentres);
886 DynamicList<label> bPts(boundaryPts.size());
888 forAll(dualMeshPointTypeNames_, typeI)
891 dualMeshPointTypeNames_[dualMeshPointType(typeI)];
895 const label& bPtType = boundaryPts[ptI];
897 if (bPtType == typeI)
906 <<
"Adding " << bPts.size()
907 <<
" points of type " << znName
933 boundaryFacesToRemove,
934 orEqOp<unsigned int>()
937 labelList addr(boundaryFacesToRemove.toc());
939 faceSet indirectPatchFaces
942 "indirectPatchFaces",
947 indirectPatchFaces.sync(
mesh);
952 timeCheck(
"Before fvMesh filtering");
954 autoPtr<polyMeshFilter> meshFilter;
956 label nInitialBadFaces = 0;
958 if (foamyHexMeshControls().filterEdges())
960 Info<<
nl <<
"Filtering edges on polyMesh" <<
nl <<
endl;
962 meshFilter.reset(
new polyMeshFilter(
mesh, boundaryPts));
966 nInitialBadFaces = meshFilter().filterEdges(0);
968 const autoPtr<fvMesh>& newMesh = meshFilter().filteredMesh();
970 polyTopoChange meshMod(newMesh());
972 autoPtr<mapPolyMesh> map = meshMod.changeMesh(
mesh,
false);
974 polyMeshFilter::copySets(newMesh(),
mesh);
978 if (foamyHexMeshControls().filterFaces())
999 Info<<
nl <<
"Filtering faces on polyMesh" <<
nl <<
endl;
1001 meshFilter.reset(
new polyMeshFilter(
mesh, boundaryPtsIO));
1003 meshFilter().filter(nInitialBadFaces);
1005 const autoPtr<fvMesh>& newMesh = meshFilter().filteredMesh();
1007 polyTopoChange meshMod(newMesh());
1009 autoPtr<mapPolyMesh> map = meshMod.changeMesh(
mesh,
false);
1011 polyMeshFilter::copySets(newMesh(),
mesh);
1015 timeCheck(
"After fvMesh filtering");
1022 <<
"Failed writing polyMesh." 1027 Info<<
nl <<
"Written filtered mesh to " 1028 <<
mesh.polyMesh::instance() <<
nl 1037 "boundaryPoints_collapsed",
1066 boundaryPtsScalarField.write();
1067 boundaryPtsIO.write();
1076 findRemainingProtrusionSet(
mesh);
1086 timeCheck(
"Start writeCellSizes");
1088 Info<<
nl <<
"Create targetCellSize volScalarField" <<
endl;
1095 mesh.polyMesh::instance(),
1105 scalarField& cellSize = targetCellSize.primitiveFieldRef();
1111 cellSize[i] = cellShapeControls().cellSize(
C[i]);
1175 targetCellSize.correctBoundaryConditions();
1180 targetCellSize.write();
1290 Info<<
"Writing components of cellCentre positions to volScalarFields" 1291 <<
" ccx, ccy, ccz in " << runTime_.timeName() <<
endl;
1299 "cc" + word(vector::componentNames[i]),
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);
1378 void 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))
static const word & zeroGradientType() noexcept
The type name for zeroGradient patch fields.
void size(const label n)
Older name for setAddressableSize.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &f1)
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.
static const pointMesh & New(const polyMesh &mesh, Args &&... args)
Get existing or create a new MeshObject. Registered with typeName.
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.
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.
::Foam::direction nComponents(const expressions::valueTypeCode) noexcept
The number of components associated with given valueTypeCode.
Ignore writing from objectRegistry::writeObject()
const dimensionSet dimless
Dimensionless.
static int myProcNo(const label communicator=worldComm)
Rank of this process in the communicator (starting from masterNo()). Can be negative if the process i...
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.
List< labelList > labelListList
List of labelList.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
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.
List< face > faceList
List of faces.
static label nProcs(const label communicator=worldComm)
Number of ranks in parallel run (for given communicator). It 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...
IOList< label > labelIOList
IO for a List of label.
Foam::autoPtr< Foam::dynamicFvMesh > meshPtr
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
static word defaultRegion
Return the default region name.
label size() const noexcept
The number of entries in the list.
wordList patchNames(nPatches)
virtual bool write(const bool writeOnProc=true) const
Write using setting from DB.
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
virtual bool write(const bool writeOnProc=true) const
Write mesh using IO settings from time.
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
List of word.
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)
True if process corresponds to the master rank in the communicator.
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.
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
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.
Do not request registration (bool: false)
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
static constexpr const zero Zero
Global zero (0)