Go to the documentation of this file.
46 const string& description
56 const string& description,
62 Info<<
nl <<
"--- [ cpuTime "
63 << runTime.elapsedCpuTime() <<
" s, "
64 <<
"delta " << runTime.cpuTimeIncrement()<<
" s";
68 Info<<
", " << description <<
" ";
81 PrintTable<word, label> memoryTable
87 memoryTable.add(
"mSize", m.size());
88 memoryTable.add(
"mPeak", m.peak());
89 memoryTable.add(
"mRss", m.rss());
119 PackedBoolList boundaryFacesToRemove;
131 cellToDelaunayVertex,
132 patchToDelaunayVertex,
133 boundaryFacesToRemove
136 Info<<
nl <<
"Writing polyMesh to " << instance <<
endl;
150 boundaryFacesToRemove
155 forAll(dualPatchStarts, patchI)
157 dualPatchStarts[patchI] =
162 if (foamyHexMeshControls().writeCellShapeControlMesh())
164 cellShapeControls().shapeControlMesh().write();
167 if (foamyHexMeshControls().writeBackgroundMeshDecomposition())
169 Info<<
nl <<
"Writing " <<
"backgroundMeshDecomposition" <<
endl;
172 const_cast<fvMesh&
>(decomposition_().mesh()).setInstance
177 decomposition_().mesh().
write();
180 if (foamyHexMeshControls().writeTetDualMesh())
185 Finite_cells_iterator cit = finite_cells_begin();
186 cit != finite_cells_end();
196 cit->cellIndex() = cellI++;
200 Info<<
nl <<
"Writing " <<
"tetDualMesh" <<
endl;
204 autoPtr<polyMesh> tetMesh =
205 createMesh(
"tetDualMesh", vertexMap, cellMap);
429 == processorPolyPatch::typeName
433 patches[patchI] =
new processorPolyPatch
484 == processorPolyPatch::typeName
488 const label procNeighb =
500 bool allMatch =
true;
502 forAll(procPatchSizes, procI)
504 const labelList& patchSizes = procPatchSizes[procI];
506 forAll(patchSizes, patchI)
508 if (patchSizes[patchI] != procPatchSizes[patchI][procI])
512 Info<<
indent <<
"Patches " << procI <<
" and " << patchI
513 <<
" have different sizes: " << patchSizes[patchI]
514 <<
" and " << procPatchSizes[patchI][procI] <<
endl;
521 Info<<
indent <<
"All processor patches have matching numbers of "
533 const label nInternalFaces
542 for (
label fI = nInternalFaces; fI < faces.size(); ++fI)
544 const face&
f = faces[fI];
548 oldToNew[
f[fpI]] = 1;
554 label countInternal = 0;
555 label countExternal = nInternalPoints;
559 if (oldToNew[pI] == 0)
561 oldToNew[pI] = countInternal++;
565 oldToNew[pI] = countExternal++;
570 <<
"Number of internal points: " << countInternal <<
nl
571 <<
indent <<
"Number of external points: " << countExternal
583 f[fpI] = oldToNew[
f[fpI]];
592 const fileName& instance,
605 autoPtr<fvMesh> sortMeshPtr
622 const fvMesh& sortMesh = sortMeshPtr();
648 forAll(sortMesh.boundaryMesh(), patchI)
650 const polyPatch& pp = sortMesh.boundaryMesh()[patchI];
652 if (isA<processorPolyPatch>(pp))
654 refCast<const processorPolyPatch>(pp).initOrder
671 pBufs.finishedSends();
676 bool anyChanged =
false;
678 forAll(sortMesh.boundaryMesh(), patchI)
680 const polyPatch& pp = sortMesh.boundaryMesh()[patchI];
682 if (isA<processorPolyPatch>(pp))
684 const label nPatchFaces =
686 const label patchStartFace =
692 bool changed = refCast<const processorPolyPatch>(pp).order
712 forAll(patchFaceRotation, patchFaceI)
714 rotation[patchFaceI + patchStartFace]
715 = patchFaceRotation[patchFaceI];
718 forAll(patchFaceMap, patchFaceI)
720 if (patchFaceMap[patchFaceI] != patchFaceI)
722 faceMap[patchFaceI + patchStartFace]
723 = patchFaceMap[patchFaceI] + patchStartFace;
734 reduce(anyChanged, orOp<bool>());
738 label nReorderedFaces = 0;
748 if (nReorderedFaces > 0)
758 if (rotation[faceI] != 0)
760 faces[faceI] =
rotateList(faces[faceI], rotation[faceI]);
765 Info<< indent << returnReduce(nReorderedFaces, sumOp<label>())
766 <<
" faces have been reordered" <<
nl
768 <<
" faces have been rotated"
778 const fileName& instance,
787 PackedBoolList& boundaryFacesToRemove
790 if (foamyHexMeshControls().objOutput())
802 reorderPoints(
points, boundaryPts, faces, nInternalFaces);
806 reorderProcessorPatches
820 timeCheck(
"Before fvMesh construction");
842 label nValidPatches = 0;
853 == processorPolyPatch::typeName
865 if (totalPatchSize > 0)
867 patches[nValidPatches] =
new processorPolyPatch
873 processorPolyPatch::typeName
882 reduce(totalPatchSize, sumOp<label>());
884 if (totalPatchSize > 0)
899 patches.setSize(nValidPatches);
906 addZones(
mesh, cellCentres);
914 DynamicList<label> bPts(boundaryPts.size());
916 forAll(dualMeshPointTypeNames_, typeI)
920 const label& bPtType = boundaryPts[ptI];
922 if (bPtType == typeI)
931 <<
"Adding " << bPts.size()
932 <<
" points of type " << dualMeshPointTypeNames_.words()[typeI]
939 dualMeshPointTypeNames_.words()[typeI],
958 boundaryFacesToRemove,
959 orEqOp<unsigned int>()
962 labelList addr(boundaryFacesToRemove.count());
965 forAll(boundaryFacesToRemove, faceI)
967 if (boundaryFacesToRemove[faceI])
969 addr[count++] = faceI;
975 faceSet indirectPatchFaces
978 "indirectPatchFaces",
983 indirectPatchFaces.sync(
mesh);
988 timeCheck(
"Before fvMesh filtering");
990 autoPtr<polyMeshFilter> meshFilter;
992 label nInitialBadFaces = 0;
994 if (foamyHexMeshControls().filterEdges())
996 Info<<
nl <<
"Filtering edges on polyMesh" <<
nl <<
endl;
998 meshFilter.reset(
new polyMeshFilter(
mesh, boundaryPts));
1002 nInitialBadFaces = meshFilter().filterEdges(0);
1004 const autoPtr<fvMesh>& newMesh = meshFilter().filteredMesh();
1006 polyTopoChange meshMod(newMesh());
1008 autoPtr<mapPolyMesh> map = meshMod.changeMesh(
mesh,
false);
1014 if (foamyHexMeshControls().filterFaces())
1035 Info<<
nl <<
"Filtering faces on polyMesh" <<
nl <<
endl;
1037 meshFilter.reset(
new polyMeshFilter(
mesh, boundaryPtsIO));
1039 meshFilter().filter(nInitialBadFaces);
1041 const autoPtr<fvMesh>& newMesh = meshFilter().filteredMesh();
1043 polyTopoChange meshMod(newMesh());
1045 autoPtr<mapPolyMesh> map = meshMod.changeMesh(
mesh,
false);
1051 timeCheck(
"After fvMesh filtering");
1058 <<
"Failed writing polyMesh."
1063 Info<<
nl <<
"Written filtered mesh to "
1064 <<
mesh.polyMesh::instance() <<
nl
1073 "boundaryPoints_collapsed",
1102 boundaryPtsScalarField.write();
1103 boundaryPtsIO.write();
1112 findRemainingProtrusionSet(
mesh);
1122 timeCheck(
"Start writeCellSizes");
1124 Info<<
nl <<
"Create targetCellSize volScalarField" <<
endl;
1131 mesh.polyMesh::instance(),
1138 zeroGradientFvPatchScalarField::typeName
1141 scalarField& cellSize = targetCellSize.internalField();
1147 cellSize[i] = cellShapeControls().cellSize(
C[i]);
1211 targetCellSize.correctBoundaryConditions();
1216 targetCellSize.write();
1325 Info<<
"Writing components of cellCentre positions to volScalarFields"
1326 <<
" ccx, ccy, ccz in " << runTime_.timeName() <<
endl;
1335 runTime_.timeName(),
1350 const polyMesh&
mesh
1353 timeCheck(
"Start findRemainingProtrusionSet");
1361 const polyPatch& patch =
patches[patchI];
1363 forAll(patch.localPoints(), pLPI)
1365 label meshPtI = patch.meshPoints()[pLPI];
1367 const Foam::point& pt = patch.localPoints()[pLPI];
1371 geometryToConformTo_.wellOutside
1374 sqr(targetCellSize(pt))
1378 protrudingBoundaryPoints.insert(meshPtI);
1383 cellSet protrudingCells
1386 "foamyHexMesh_remainingProtrusions",
1392 const label pointI = iter.key();
1397 protrudingCells.insert(pCells[pCI]);
1401 label protrudingCellsSize = protrudingCells.size();
1403 reduce(protrudingCellsSize, sumOp<label>());
1405 if (foamyHexMeshControls().objOutput() && protrudingCellsSize > 0)
1407 Info<<
nl <<
"Found " << protrudingCellsSize
1408 <<
" cells protruding from the surface, writing cellSet "
1409 << protrudingCells.name()
1412 protrudingCells.
write();
1415 return protrudingCells;
1421 const fileName& fName
1424 OBJstream os(fName);
1428 Delaunay::Finite_edges_iterator eit = finite_edges_begin();
1429 eit != finite_edges_end();
1433 Cell_handle
c = eit->first;
1434 Vertex_handle vA =
c->vertex(eit->second);
1435 Vertex_handle vB =
c->vertex(eit->third);
1437 if (ptPairs_.isPointPair(vA, vB))
vectorField pointField
pointField is a vectorField.
void clear()
Clear the zones.
virtual const pointField & points() const
Return raw points.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
tmp< GeometricField< cmptType, PatchField, GeoMesh > > component(const direction) const
Return a component of the field.
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
List< label > labelList
A List of labels.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
static word defaultRegion
Return the default region name.
#define forAll(list, i)
Loop across all elements in list.
void addFvPatches(const List< polyPatch * > &, const bool validBoundary=true)
Add boundary patches. Constructor helper.
static label nProcs(const label communicator=0)
Number of processes in parallel run.
static bool & parRun()
Is this a parallel run?
@ nComponents
Number of components in this vector space.
PrimitivePatch< face, SubList, const pointField & > primitivePatch
Foam::primitivePatch.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static const char * componentNames[]
IOList< label > labelIOList
Label container classes.
Ostream & incrIndent(Ostream &os)
Increment the indent level.
virtual void print(Ostream &) const
Print description of IOstream to Ostream.
pointFromPoint topoint(const Point &P)
static const pointMesh & New(const polyMesh &mesh)
PtrList< dictionary > patchDicts
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
Field< vector > vectorField
Specialisation of Field<T> for vector.
List< word > wordList
A List of words.
virtual bool write() const
Write mesh using IO settings from time.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
static const label labelMin
void inplaceReorder(const labelUList &oldToNew, ListType &)
Inplace reorder the elements of a list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
virtual Ostream & write(const token &)=0
Write next token to stream.
const pointZoneMesh & pointZones() const
Return point zone mesh.
List< cell > cellList
list of cells
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
wordList patchNames(nPatches)
label whichZone(const label objectIndex) const
Given a global object index, return the zone it is in.
static autoPtr< polyPatch > New(const word &patchType, const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm)
Return a pointer to a new patch created on freestore from.
ListType rotateList(const ListType &list, const label n)
Rotate a list by n places. If n is positive rotate clockwise/right/down.
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
Ostream & indent(Ostream &os)
Indent stream.
GeometricField< scalar, pointPatchField, pointMesh > pointScalarField
errorManipArg< error, int > exit(error &err, const int errNo=1)
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
static bool master(const label communicator=0)
Am I the master process.
void setInstance(const fileName &)
Set the instance for mesh files.
List< labelList > labelListList
A List of labelList.
const vectorField & cellCentres() const
line< point, const point & > linePointRef
Line using referred points.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
static void gatherList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Gather data but keep individual values separate.
HashTable< label, labelPair, FixedList< label, 2 >::Hash<> > labelTolabelPairHashTable
dimensionedSymmTensor sqr(const dimensionedVector &dv)
const volVectorField & C() const
Return cell centres as volVectorField.
Xfer< T > xferMove(T &)
Construct by transferring the contents of the arg.
Xfer< T > xferCopy(const T &)
Construct by copying the contents of the arg.
const labelListList & pointCells() const
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
static void copySets(const polyMesh &oldMesh, const polyMesh &newMesh)
static const word null
An empty word.
label readLabel(Istream &is)
const dimensionedScalar c
Speed of light in a vacuum.
Various functions to operate on Lists.
void size(const label)
Override size to be inconsistent with allocated storage.
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys.
void writeMesh(const string &msg, const meshRefinement &meshRefiner, const meshRefinement::debugType debugLevel, const meshRefinement::writeType writeLevel)
stressControl lookup("compactNormalStress") >> compactNormalStress