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();
632 const polyPatch& pp = sortMesh.boundaryMesh()[
patchi];
634 if (isA<processorPolyPatch>(pp))
636 refCast<const processorPolyPatch>(pp).initOrder
653 pBufs.finishedSends();
655 Info<< incrIndent <<
indent <<
"Face ordering initialised..." <<
endl;
658 bool anyChanged =
false;
662 const polyPatch& pp = sortMesh.boundaryMesh()[
patchi];
664 if (isA<processorPolyPatch>(pp))
666 const label nPatchFaces =
668 const label patchStartFace =
674 bool changed = refCast<const processorPolyPatch>(pp).order
694 forAll(patchFaceRotation, patchFacei)
696 rotation[patchFacei + patchStartFace]
697 = patchFaceRotation[patchFacei];
700 forAll(patchFaceMap, patchFacei)
702 if (patchFaceMap[patchFacei] != patchFacei)
704 faceMap[patchFacei + patchStartFace]
705 = patchFaceMap[patchFacei] + patchStartFace;
716 reduce(anyChanged, orOp<bool>());
720 label nReorderedFaces = 0;
730 if (nReorderedFaces > 0)
740 if (rotation[facei] != 0)
742 faces[facei] =
rotateList(faces[facei], rotation[facei]);
747 Info<< indent << returnReduce(nReorderedFaces, sumOp<label>())
748 <<
" faces have been reordered" <<
nl 749 << indent << returnReduce(nRotated, sumOp<label>())
750 <<
" faces have been rotated" 751 << decrIndent << decrIndent
752 << decrIndent << decrIndent <<
endl;
759 const word& meshName,
760 const fileName& instance,
767 const PtrList<dictionary>& patchDicts,
769 PackedBoolList& boundaryFacesToRemove
776 time().
path()/word(meshName +
".obj"),
784 reorderPoints(points, boundaryPts, faces, nInternalFaces);
788 reorderProcessorPatches
822 List<polyPatch*>
patches(patchNames.size());
824 label nValidPatches = 0;
834 word(patchDicts[
p].
lookup(
"type"))
835 == processorPolyPatch::typeName
839 const_cast<dictionary&
>(patchDicts[
p]).
set 842 "coincidentFullMatch" 846 if (totalPatchSize > 0)
848 patches[nValidPatches] =
new processorPolyPatch
854 processorPolyPatch::typeName
863 reduce(totalPatchSize, sumOp<label>());
865 if (totalPatchSize > 0)
880 patches.setSize(nValidPatches);
882 mesh.addFvPatches(patches);
887 addZones(mesh, cellCentres);
893 label sz = mesh.pointZones().size();
895 DynamicList<label> bPts(boundaryPts.size());
901 const label& bPtType = boundaryPts[ptI];
903 if (bPtType == typeI)
912 <<
"Adding " << bPts.size()
914 << decrIndent <<
endl;
916 mesh.pointZones().append
939 boundaryFacesToRemove,
940 orEqOp<unsigned int>()
943 labelList addr(boundaryFacesToRemove.count());
946 forAll(boundaryFacesToRemove, facei)
948 if (boundaryFacesToRemove[facei])
950 addr[count++] = facei;
956 faceSet indirectPatchFaces
959 "indirectPatchFaces",
964 indirectPatchFaces.sync(mesh);
971 autoPtr<polyMeshFilter> meshFilter;
973 label nInitialBadFaces = 0;
977 Info<<
nl <<
"Filtering edges on polyMesh" <<
nl <<
endl;
979 meshFilter.reset(
new polyMeshFilter(mesh, boundaryPts));
983 nInitialBadFaces = meshFilter().filterEdges(0);
985 const autoPtr<fvMesh>& newMesh = meshFilter().filteredMesh();
987 polyTopoChange meshMod(newMesh());
989 autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh,
false);
991 polyMeshFilter::copySets(newMesh(), mesh);
1010 forAll(mesh.points(), ptI)
1012 boundaryPtsIO[ptI] = mesh.pointZones().whichZone(ptI);
1016 Info<<
nl <<
"Filtering faces on polyMesh" <<
nl <<
endl;
1018 meshFilter.reset(
new polyMeshFilter(mesh, boundaryPtsIO));
1020 meshFilter().filter(nInitialBadFaces);
1022 const autoPtr<fvMesh>& newMesh = meshFilter().filteredMesh();
1024 polyTopoChange meshMod(newMesh());
1026 autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh,
false);
1028 polyMeshFilter::copySets(newMesh(), mesh);
1034 mesh.setInstance(instance);
1039 <<
"Failed writing polyMesh." 1044 Info<<
nl <<
"Written filtered mesh to " 1045 << mesh.polyMesh::instance() <<
nl 1054 "boundaryPoints_collapsed",
1077 forAll(mesh.points(), ptI)
1079 boundaryPtsScalarField[ptI] = mesh.pointZones().whichZone(ptI);
1080 boundaryPtsIO[ptI] = mesh.pointZones().whichZone(ptI);
1083 boundaryPtsScalarField.write();
1084 boundaryPtsIO.write();
1105 Info<<
nl <<
"Create targetCellSize volScalarField" <<
endl;
1112 mesh.polyMesh::instance(),
1119 zeroGradientFvPatchScalarField::typeName
1122 scalarField& cellSize = targetCellSize.primitiveFieldRef();
1192 targetCellSize.correctBoundaryConditions();
1197 targetCellSize.write();
1306 Info<<
"Writing components of cellCentre positions to volScalarFields" 1307 <<
" ccx, ccy, ccz in " << runTime_.
timeName() <<
endl;
1321 mesh.C().component(i)
1331 const polyMesh& mesh
1334 timeCheck(
"Start findRemainingProtrusionSet");
1336 const polyBoundaryMesh& patches = mesh.boundaryMesh();
1342 const polyPatch& patch = patches[
patchi];
1344 forAll(patch.localPoints(), pLPI)
1346 label meshPtI = patch.meshPoints()[pLPI];
1348 const Foam::point& pt = patch.localPoints()[pLPI];
1355 sqr(targetCellSize(pt))
1359 protrudingBoundaryPoints.insert(meshPtI);
1364 cellSet protrudingCells
1367 "foamyHexMesh_remainingProtrusions",
1373 const label pointi = iter.key();
1374 const labelList& pCells = mesh.pointCells()[pointi];
1378 protrudingCells.insert(pCells[pCI]);
1382 label protrudingCellsSize = protrudingCells.size();
1384 reduce(protrudingCellsSize, sumOp<label>());
1388 Info<<
nl <<
"Found " << protrudingCellsSize
1389 <<
" cells protruding from the surface, writing cellSet " 1390 << protrudingCells.name()
1393 protrudingCells.
write();
1396 return protrudingCells;
1400 void Foam::conformalVoronoiMesh::writePointPairs
1402 const fileName& fName
1405 OBJstream os(fName);
1409 Delaunay::Finite_edges_iterator eit = finite_edges_begin();
1410 eit != finite_edges_end();
GeometricField< scalar, pointPatchField, pointMesh > pointScalarField
static wordList words()
The set of names as a list of words.
List< labelList > labelListList
A List of labelList.
A HashTable with keys but without contents.
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)
#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[]
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)
bool isPointPair(const Vertex_handle &vA, const Vertex_handle &vB) const
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.
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
virtual void print(Ostream &) const
Print description of IOstream to Ostream.
virtual bool write(const bool valid=true) const
Write using setting from DB.
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.
autoPtr< polyMesh > createMesh(const fileName &name, labelTolabelPairHashTable &vertexMap, labelList &cellMap, const bool writeDelaunayData=true) const
Create an fvMesh from the triangulation.
scalar cellSize(const point &pt) const
Return the cell size at the given location.