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,
597 const PtrList<dictionary>& patchDicts
600 Info<< incrIndent <<
indent <<
"Reordering processor patches" <<
endl;
603 checkProcessorPatchesMatch(patchDicts);
606 autoPtr<fvMesh> sortMeshPtr
623 const fvMesh& sortMesh = sortMeshPtr();
634 const polyPatch& pp = sortMesh.boundaryMesh()[
patchi];
636 if (isA<processorPolyPatch>(pp))
638 refCast<const processorPolyPatch>(pp).initOrder
655 pBufs.finishedSends();
657 Info<< incrIndent <<
indent <<
"Face ordering initialised..." <<
endl;
660 bool anyChanged =
false;
664 const polyPatch& pp = sortMesh.boundaryMesh()[
patchi];
666 if (isA<processorPolyPatch>(pp))
668 const label nPatchFaces =
670 const label patchStartFace =
676 bool changed = refCast<const processorPolyPatch>(pp).order
696 forAll(patchFaceRotation, patchFacei)
698 rotation[patchFacei + patchStartFace]
699 = patchFaceRotation[patchFacei];
702 forAll(patchFaceMap, patchFacei)
704 if (patchFaceMap[patchFacei] != patchFacei)
706 faceMap[patchFacei + patchStartFace]
707 = patchFaceMap[patchFacei] + patchStartFace;
718 reduce(anyChanged, orOp<bool>());
722 label nReorderedFaces = 0;
732 if (nReorderedFaces > 0)
744 if (rotation[facei] != 0)
746 faces[facei] =
rotateList(faces[facei], rotation[facei]);
751 Info<< indent << returnReduce(nReorderedFaces, sumOp<label>())
752 <<
" faces have been reordered" <<
nl 753 << indent << returnReduce(nRotated, sumOp<label>())
754 <<
" faces have been rotated" 755 << decrIndent << decrIndent
756 << decrIndent << decrIndent <<
endl;
763 const word& meshName,
764 const fileName& instance,
771 const PtrList<dictionary>& patchDicts,
773 PackedBoolList& boundaryFacesToRemove
780 time().
path()/word(meshName +
".obj"),
788 reorderPoints(points, boundaryPts, faces, nInternalFaces);
792 reorderProcessorPatches
823 Foam::move(neighbour)
828 List<polyPatch*>
patches(patchNames.size());
830 label nValidPatches = 0;
840 word(patchDicts[
p].
lookup(
"type"))
841 == processorPolyPatch::typeName
845 const_cast<dictionary&
>(patchDicts[
p]).
set 848 "coincidentFullMatch" 852 if (totalPatchSize > 0)
854 patches[nValidPatches] =
new processorPolyPatch
860 processorPolyPatch::typeName
869 reduce(totalPatchSize, sumOp<label>());
871 if (totalPatchSize > 0)
886 patches.setSize(nValidPatches);
888 mesh.addFvPatches(patches);
893 addZones(mesh, cellCentres);
899 label sz = mesh.pointZones().size();
901 DynamicList<label> bPts(boundaryPts.size());
907 const label& bPtType = boundaryPts[ptI];
909 if (bPtType == typeI)
918 <<
"Adding " << bPts.size()
920 << decrIndent <<
endl;
922 mesh.pointZones().append
945 boundaryFacesToRemove,
946 orEqOp<unsigned int>()
949 labelList addr(boundaryFacesToRemove.count());
952 forAll(boundaryFacesToRemove, facei)
954 if (boundaryFacesToRemove[facei])
956 addr[count++] = facei;
962 faceSet indirectPatchFaces
965 "indirectPatchFaces",
970 indirectPatchFaces.sync(mesh);
977 autoPtr<polyMeshFilter> meshFilter;
979 label nInitialBadFaces = 0;
983 Info<<
nl <<
"Filtering edges on polyMesh" <<
nl <<
endl;
985 meshFilter.reset(
new polyMeshFilter(mesh, boundaryPts));
989 nInitialBadFaces = meshFilter().filterEdges(0);
991 const autoPtr<fvMesh>& newMesh = meshFilter().filteredMesh();
993 polyTopoChange meshMod(newMesh());
995 autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh,
false);
997 polyMeshFilter::copySets(newMesh(), mesh);
1016 forAll(mesh.points(), ptI)
1018 boundaryPtsIO[ptI] = mesh.pointZones().whichZone(ptI);
1022 Info<<
nl <<
"Filtering faces on polyMesh" <<
nl <<
endl;
1024 meshFilter.reset(
new polyMeshFilter(mesh, boundaryPtsIO));
1026 meshFilter().filter(nInitialBadFaces);
1028 const autoPtr<fvMesh>& newMesh = meshFilter().filteredMesh();
1030 polyTopoChange meshMod(newMesh());
1032 autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh,
false);
1034 polyMeshFilter::copySets(newMesh(), mesh);
1040 mesh.setInstance(instance);
1045 <<
"Failed writing polyMesh." 1050 Info<<
nl <<
"Written filtered mesh to " 1051 << mesh.polyMesh::instance() <<
nl 1060 "boundaryPoints_collapsed",
1083 forAll(mesh.points(), ptI)
1085 boundaryPtsScalarField[ptI] = mesh.pointZones().whichZone(ptI);
1086 boundaryPtsIO[ptI] = mesh.pointZones().whichZone(ptI);
1089 boundaryPtsScalarField.write();
1090 boundaryPtsIO.write();
1111 Info<<
nl <<
"Create targetCellSize volScalarField" <<
endl;
1118 mesh.polyMesh::instance(),
1125 zeroGradientFvPatchScalarField::typeName
1128 scalarField& cellSize = targetCellSize.primitiveFieldRef();
1198 targetCellSize.correctBoundaryConditions();
1203 targetCellSize.write();
1312 Info<<
"Writing components of cellCentre positions to volScalarFields" 1313 <<
" ccx, ccy, ccz in " << runTime_.
timeName() <<
endl;
1327 mesh.C().component(i)
1337 const polyMesh& mesh
1340 timeCheck(
"Start findRemainingProtrusionSet");
1342 const polyBoundaryMesh& patches = mesh.boundaryMesh();
1348 const polyPatch& patch = patches[
patchi];
1350 forAll(patch.localPoints(), pLPI)
1352 label meshPtI = patch.meshPoints()[pLPI];
1354 const Foam::point& pt = patch.localPoints()[pLPI];
1361 sqr(targetCellSize(pt))
1365 protrudingBoundaryPoints.insert(meshPtI);
1370 cellSet protrudingCells
1373 "foamyHexMesh_remainingProtrusions",
1379 const label pointi = iter.key();
1380 const labelList& pCells = mesh.pointCells()[pointi];
1384 protrudingCells.insert(pCells[pCI]);
1388 label protrudingCellsSize = protrudingCells.size();
1390 reduce(protrudingCellsSize, sumOp<label>());
1394 Info<<
nl <<
"Found " << protrudingCellsSize
1395 <<
" cells protruding from the surface, writing cellSet " 1396 << protrudingCells.name()
1399 protrudingCells.
write();
1402 return Foam::move(protrudingCells);
1406 void Foam::conformalVoronoiMesh::writePointPairs
1408 const fileName& fName
1411 OBJstream os(fName);
1415 Delaunay::Finite_edges_iterator eit = finite_edges_begin();
1416 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.
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.
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.
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
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
PrimitivePatch< SubList< face >, 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 bool write(const bool write=true) const
Write using setting from DB.
virtual void print(Ostream &) const
Print description of IOstream to Ostream.
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.
fileName path(UMean.rootPath()/UMean.caseName()/functionObjects::writeFile::outputPrefix/"graphs"/UMean.instance())