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
153 dualPatchStarts.setSize(patchDicts.size());
169 Info<<
nl <<
"Writing " <<
"backgroundMeshDecomposition" <<
endl;
172 const_cast<fvMesh&
>(decomposition_().mesh()).setInstance
177 decomposition_().mesh().write();
186 cit != finite_cells_end();
196 cit->cellIndex() = celli++;
200 Info<<
nl <<
"Writing " <<
"tetDualMesh" <<
endl;
204 autoPtr<polyMesh> tetMesh =
205 createMesh(
"tetDualMesh", vertexMap, cellMap);
405 const PtrList<dictionary>& patchDicts
420 List<polyPatch*>
patches(patchDicts.size());
429 == processorPolyPatch::typeName
433 patches[
patchi] =
new processorPolyPatch
458 mesh.addFvPatches(patches);
464 void Foam::conformalVoronoiMesh::checkProcessorPatchesMatch
466 const PtrList<dictionary>& patchDicts
483 == processorPolyPatch::typeName
487 const label procNeighb =
499 bool allMatch =
true;
501 forAll(procPatchSizes, proci)
503 const labelList& patchSizes = procPatchSizes[proci];
507 if (patchSizes[
patchi] != procPatchSizes[
patchi][proci])
512 <<
" have different sizes: " << patchSizes[
patchi]
513 <<
" and " << procPatchSizes[
patchi][proci] <<
endl;
520 Info<<
indent <<
"All processor patches have matching numbers of " 527 void Foam::conformalVoronoiMesh::reorderPoints
532 const label nInternalFaces
535 Info<< incrIndent <<
indent <<
"Reordering points into internal/external" 541 for (
label fI = nInternalFaces; fI < faces.size(); ++fI)
543 const face&
f = faces[fI];
547 oldToNew[f[fpI]] = 1;
551 const label nInternalPoints = points.size() -
sum(oldToNew);
553 label countInternal = 0;
554 label countExternal = nInternalPoints;
558 if (oldToNew[pI] == 0)
560 oldToNew[pI] = countInternal++;
564 oldToNew[pI] = countExternal++;
569 <<
"Number of internal points: " << countInternal <<
nl 570 <<
indent <<
"Number of external points: " << countExternal
571 << decrIndent <<
endl;
582 f[fpI] = oldToNew[f[fpI]];
588 void Foam::conformalVoronoiMesh::reorderProcessorPatches
590 const word& meshName,
591 const fileName& instance,
595 const PtrList<dictionary>& patchDicts
598 Info<< incrIndent <<
indent <<
"Reordering processor patches" <<
endl;
601 checkProcessorPatchesMatch(patchDicts);
604 autoPtr<fvMesh> sortMeshPtr
621 const fvMesh& sortMesh = sortMeshPtr();
649 const polyPatch& pp = sortMesh.boundaryMesh()[
patchi];
651 if (isA<processorPolyPatch>(pp))
653 refCast<const processorPolyPatch>(pp).initOrder
670 pBufs.finishedSends();
672 Info<< incrIndent <<
indent <<
"Face ordering initialised..." <<
endl;
675 bool anyChanged =
false;
679 const polyPatch& pp = sortMesh.boundaryMesh()[
patchi];
681 if (isA<processorPolyPatch>(pp))
683 const label nPatchFaces =
685 const label patchStartFace =
691 bool changed = refCast<const processorPolyPatch>(pp).order
711 forAll(patchFaceRotation, patchFacei)
713 rotation[patchFacei + patchStartFace]
714 = patchFaceRotation[patchFacei];
717 forAll(patchFaceMap, patchFacei)
719 if (patchFaceMap[patchFacei] != patchFacei)
721 faceMap[patchFacei + patchStartFace]
722 = patchFaceMap[patchFacei] + patchStartFace;
733 reduce(anyChanged, orOp<bool>());
737 label nReorderedFaces = 0;
747 if (nReorderedFaces > 0)
757 if (rotation[facei] != 0)
759 faces[facei] =
rotateList(faces[facei], rotation[facei]);
764 Info<< indent << returnReduce(nReorderedFaces, sumOp<label>())
765 <<
" faces have been reordered" <<
nl 766 << indent << returnReduce(nRotated, sumOp<label>())
767 <<
" faces have been rotated" 768 << decrIndent << decrIndent
769 << decrIndent << decrIndent <<
endl;
776 const word& meshName,
777 const fileName& instance,
784 const PtrList<dictionary>& patchDicts,
786 PackedBoolList& boundaryFacesToRemove
793 time().
path()/word(meshName +
".obj"),
801 reorderPoints(points, boundaryPts, faces, nInternalFaces);
805 reorderProcessorPatches
839 List<polyPatch*>
patches(patchNames.size());
841 label nValidPatches = 0;
851 word(patchDicts[
p].
lookup(
"type"))
852 == processorPolyPatch::typeName
856 const_cast<dictionary&
>(patchDicts[
p]).
set 864 if (totalPatchSize > 0)
866 patches[nValidPatches] =
new processorPolyPatch
872 processorPolyPatch::typeName
881 reduce(totalPatchSize, sumOp<label>());
883 if (totalPatchSize > 0)
898 patches.setSize(nValidPatches);
900 mesh.addFvPatches(patches);
905 addZones(mesh, cellCentres);
911 label sz = mesh.pointZones().size();
913 DynamicList<label> bPts(boundaryPts.size());
919 const label& bPtType = boundaryPts[ptI];
921 if (bPtType == typeI)
930 <<
"Adding " << bPts.size()
932 << decrIndent <<
endl;
934 mesh.pointZones().append
957 boundaryFacesToRemove,
958 orEqOp<unsigned int>()
961 labelList addr(boundaryFacesToRemove.count());
964 forAll(boundaryFacesToRemove, facei)
966 if (boundaryFacesToRemove[facei])
968 addr[count++] = facei;
974 faceSet indirectPatchFaces
977 "indirectPatchFaces",
982 indirectPatchFaces.sync(mesh);
989 autoPtr<polyMeshFilter> meshFilter;
991 label nInitialBadFaces = 0;
995 Info<<
nl <<
"Filtering edges on polyMesh" <<
nl <<
endl;
997 meshFilter.reset(
new polyMeshFilter(mesh, boundaryPts));
1001 nInitialBadFaces = meshFilter().filterEdges(0);
1003 const autoPtr<fvMesh>& newMesh = meshFilter().filteredMesh();
1005 polyTopoChange meshMod(newMesh());
1007 autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh,
false);
1009 polyMeshFilter::copySets(newMesh(), mesh);
1028 forAll(mesh.points(), ptI)
1030 boundaryPtsIO[ptI] = mesh.pointZones().whichZone(ptI);
1034 Info<<
nl <<
"Filtering faces on polyMesh" <<
nl <<
endl;
1036 meshFilter.reset(
new polyMeshFilter(mesh, boundaryPtsIO));
1038 meshFilter().filter(nInitialBadFaces);
1040 const autoPtr<fvMesh>& newMesh = meshFilter().filteredMesh();
1042 polyTopoChange meshMod(newMesh());
1044 autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh,
false);
1046 polyMeshFilter::copySets(newMesh(), mesh);
1052 mesh.setInstance(instance);
1057 <<
"Failed writing polyMesh." 1062 Info<<
nl <<
"Written filtered mesh to " 1063 << mesh.polyMesh::instance() <<
nl 1072 "boundaryPoints_collapsed",
1095 forAll(mesh.points(), ptI)
1097 boundaryPtsScalarField[ptI] = mesh.pointZones().whichZone(ptI);
1098 boundaryPtsIO[ptI] = mesh.pointZones().whichZone(ptI);
1101 boundaryPtsScalarField.write();
1102 boundaryPtsIO.write();
1123 Info<<
nl <<
"Create targetCellSize volScalarField" <<
endl;
1130 mesh.polyMesh::instance(),
1137 zeroGradientFvPatchScalarField::typeName
1140 scalarField& cellSize = targetCellSize.primitiveFieldRef();
1210 targetCellSize.correctBoundaryConditions();
1215 targetCellSize.write();
1324 Info<<
"Writing components of cellCentre positions to volScalarFields" 1325 <<
" ccx, ccy, ccz in " << runTime_.
timeName() <<
endl;
1339 mesh.C().component(i)
1349 const polyMesh& mesh
1352 timeCheck(
"Start findRemainingProtrusionSet");
1354 const polyBoundaryMesh& patches = mesh.boundaryMesh();
1360 const polyPatch& patch = patches[
patchi];
1362 forAll(patch.localPoints(), pLPI)
1364 label meshPtI = patch.meshPoints()[pLPI];
1366 const Foam::point& pt = patch.localPoints()[pLPI];
1373 sqr(targetCellSize(pt))
1377 protrudingBoundaryPoints.insert(meshPtI);
1382 cellSet protrudingCells
1385 "foamyHexMesh_remainingProtrusions",
1391 const label pointi = iter.key();
1392 const labelList& pCells = mesh.pointCells()[pointi];
1396 protrudingCells.insert(pCells[pCI]);
1400 label protrudingCellsSize = protrudingCells.size();
1402 reduce(protrudingCellsSize, sumOp<label>());
1406 Info<<
nl <<
"Found " << protrudingCellsSize
1407 <<
" cells protruding from the surface, writing cellSet " 1408 << protrudingCells.name()
1411 protrudingCells.
write();
1414 return protrudingCells;
1418 void Foam::conformalVoronoiMesh::writePointPairs
1420 const fileName& fName
1423 OBJstream os(fName);
1427 Delaunay::Finite_edges_iterator eit = finite_edges_begin();
1428 eit != finite_edges_end();
GeometricField< scalar, pointPatchField, pointMesh > pointScalarField
bool isPointPair(const Vertex_handle &vA, const Vertex_handle &vB) const
static wordList words()
The set of names as a list of words.
List< labelList > labelListList
A List of labelList.
void inplaceReorder(const labelUList &oldToNew, ListType &)
Inplace reorder the elements of a list.
#define forAll(list, i)
Loop across all elements in 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.
Ostream & indent(Ostream &os)
Indent stream.
pointFromPoint topoint(const Point &P)
errorManipArg< error, int > exit(error &err, const int errNo=1)
virtual void print(Ostream &) const
Print description of IOstream to Ostream.
autoPtr< polyMesh > createMesh(const fileName &name, labelTolabelPairHashTable &vertexMap, labelList &cellMap, const bool writeDelaunayData=true) const
Create an fvMesh from the triangulation.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
ListType rotateList(const ListType &list, const label n)
Rotate a list by n places. If n is positive rotate clockwise/right/down.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
static const char *const componentNames[]
scalar cellSize(const point &pt) const
Return the cell size at the given location.
HashTable< label, labelPair, FixedList< label, 2 >::Hash<> > labelTolabelPairHashTable
static word defaultRegion
Return the default region name.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static bool master(const label communicator=0)
Am I the master process.
Xfer< T > xferCopy(const T &)
Construct by copying the contents of the arg.
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
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.
static const pointMesh & New(const polyMesh &mesh)
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 with label keys.
static const direction nComponents
Number of components in this vector space.
vectorField pointField
pointField is a vectorField.
stressControl lookup("compactNormalStress") >> compactNormalStress
line< point, const point & > linePointRef
Line using referred points.
Xfer< T > xferMove(T &)
Construct by transferring the contents of the arg.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
wordList patchNames(nPatches)
static const word null
An empty word.
List< label > labelList
A List of labels.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
label readLabel(Istream &is)
Delaunay::Finite_cells_iterator Finite_cells_iterator
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
PrimitivePatch< face, SubList, const pointField & > primitivePatch
Addressing for a faceList slice.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
List< word > wordList
A List of words.
static bool & parRun()
Is this a parallel run?
static label nProcs(const label communicator=0)
Number of processes in parallel run.
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
virtual bool write() const
Write using setting from DB.
cellShapeControlMesh & shapeControlMesh()
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 a pointer to a new patch created on freestore from.
virtual Ostream & write(const token &)=0
Write next token to stream.
PtrList< dictionary > patchDicts
Ostream & incrIndent(Ostream &os)
Increment the indent level.
static void gatherList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Gather data but keep individual values separate.
List< cell > cellList
list of cells
static const label labelMin
IOList< label > labelIOList
Label container classes.