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
440 patchDicts[
patchi].lookup<label>(
"neighbProcNo")
457 mesh.addFvPatches(patches);
463 void Foam::conformalVoronoiMesh::checkProcessorPatchesMatch
465 const PtrList<dictionary>& patchDicts
482 == processorPolyPatch::typeName
486 const label procNeighb =
498 bool allMatch =
true;
500 forAll(procPatchSizes, proci)
502 const labelList& patchSizes = procPatchSizes[proci];
506 if (patchSizes[
patchi] != procPatchSizes[
patchi][proci])
511 <<
" have different sizes: " << patchSizes[
patchi]
512 <<
" and " << procPatchSizes[
patchi][proci] <<
endl;
519 Info<<
indent <<
"All processor patches have matching numbers of " 526 void Foam::conformalVoronoiMesh::reorderPoints
531 const label nInternalFaces
534 Info<< incrIndent <<
indent <<
"Reordering points into internal/external" 540 for (
label fI = nInternalFaces; fI < faces.size(); ++fI)
542 const face&
f = faces[fI];
546 oldToNew[f[fpI]] = 1;
550 const label nInternalPoints = points.size() -
sum(oldToNew);
552 label countInternal = 0;
553 label countExternal = nInternalPoints;
557 if (oldToNew[pI] == 0)
559 oldToNew[pI] = countInternal++;
563 oldToNew[pI] = countExternal++;
568 <<
"Number of internal points: " << countInternal <<
nl 569 <<
indent <<
"Number of external points: " << countExternal
570 << decrIndent <<
endl;
581 f[fpI] = oldToNew[f[fpI]];
587 void Foam::conformalVoronoiMesh::reorderProcessorPatches
589 const word& meshName,
590 const fileName& instance,
596 const PtrList<dictionary>& patchDicts
599 Info<< incrIndent <<
indent <<
"Reordering processor patches" <<
endl;
602 checkProcessorPatchesMatch(patchDicts);
605 autoPtr<fvMesh> sortMeshPtr
622 const fvMesh& sortMesh = sortMeshPtr();
633 const polyPatch& pp = sortMesh.boundaryMesh()[
patchi];
635 if (isA<processorPolyPatch>(pp))
637 refCast<const processorPolyPatch>(pp).initOrder
645 patchDicts[
patchi].lookup<label>(
"nFaces"),
646 patchDicts[
patchi].lookup<label>(
"startFace")
654 pBufs.finishedSends();
656 Info<< incrIndent <<
indent <<
"Face ordering initialised..." <<
endl;
659 bool anyChanged =
false;
663 const polyPatch& pp = sortMesh.boundaryMesh()[
patchi];
665 if (isA<processorPolyPatch>(pp))
667 const label nPatchFaces =
669 const label patchStartFace =
675 bool changed = refCast<const processorPolyPatch>(pp).order
695 forAll(patchFaceRotation, patchFacei)
697 rotation[patchFacei + patchStartFace]
698 = patchFaceRotation[patchFacei];
701 forAll(patchFaceMap, patchFacei)
703 if (patchFaceMap[patchFacei] != patchFacei)
705 faceMap[patchFacei + patchStartFace]
706 = patchFaceMap[patchFacei] + patchStartFace;
717 reduce(anyChanged, orOp<bool>());
721 label nReorderedFaces = 0;
731 if (nReorderedFaces > 0)
743 if (rotation[facei] != 0)
745 faces[facei] =
rotateList(faces[facei], rotation[facei]);
750 Info<< indent << returnReduce(nReorderedFaces, sumOp<label>())
751 <<
" faces have been reordered" <<
nl 752 << indent << returnReduce(nRotated, sumOp<label>())
753 <<
" faces have been rotated" 754 << decrIndent << decrIndent
755 << decrIndent << decrIndent <<
endl;
762 const word& meshName,
763 const fileName& instance,
770 const PtrList<dictionary>& patchDicts,
772 PackedBoolList& boundaryFacesToRemove
779 time().
path()/word(meshName +
".obj"),
785 const label nInternalFaces = patchDicts[0].lookup<
label>(
"startFace");
787 reorderPoints(points, boundaryPts, faces, nInternalFaces);
791 reorderProcessorPatches
822 Foam::move(neighbour)
827 List<polyPatch*>
patches(patchNames.size());
829 label nValidPatches = 0;
833 label totalPatchSize = patchDicts[
p].lookup<
label>(
"nFaces");
839 word(patchDicts[
p].
lookup(
"type"))
840 == processorPolyPatch::typeName
844 const_cast<dictionary&
>(patchDicts[
p]).
set 847 "coincidentFullMatch" 851 if (totalPatchSize > 0)
853 patches[nValidPatches] =
new processorPolyPatch
859 processorPolyPatch::typeName
868 reduce(totalPatchSize, sumOp<label>());
870 if (totalPatchSize > 0)
885 patches.setSize(nValidPatches);
887 mesh.addFvPatches(patches);
892 addZones(mesh, cellCentres);
898 label sz = mesh.pointZones().size();
900 DynamicList<label> bPts(boundaryPts.size());
906 const label& bPtType = boundaryPts[ptI];
908 if (bPtType == typeI)
917 <<
"Adding " << bPts.size()
919 << decrIndent <<
endl;
921 mesh.pointZones().append
944 boundaryFacesToRemove,
945 orEqOp<unsigned int>()
948 labelList addr(boundaryFacesToRemove.count());
951 forAll(boundaryFacesToRemove, facei)
953 if (boundaryFacesToRemove[facei])
955 addr[count++] = facei;
961 faceSet indirectPatchFaces
964 "indirectPatchFaces",
969 indirectPatchFaces.sync(mesh);
976 autoPtr<polyMeshFilter> meshFilter;
978 label nInitialBadFaces = 0;
982 Info<<
nl <<
"Filtering edges on polyMesh" <<
nl <<
endl;
984 meshFilter.reset(
new polyMeshFilter(mesh, boundaryPts));
988 nInitialBadFaces = meshFilter().filterEdges(0);
990 const autoPtr<fvMesh>& newMesh = meshFilter().filteredMesh();
992 polyTopoChange meshMod(newMesh());
994 autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh,
false);
996 polyMeshFilter::copySets(newMesh(), mesh);
1015 forAll(mesh.points(), ptI)
1017 boundaryPtsIO[ptI] = mesh.pointZones().whichZone(ptI);
1021 Info<<
nl <<
"Filtering faces on polyMesh" <<
nl <<
endl;
1023 meshFilter.reset(
new polyMeshFilter(mesh, boundaryPtsIO));
1025 meshFilter().filter(nInitialBadFaces);
1027 const autoPtr<fvMesh>& newMesh = meshFilter().filteredMesh();
1029 polyTopoChange meshMod(newMesh());
1031 autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh,
false);
1033 polyMeshFilter::copySets(newMesh(), mesh);
1039 mesh.setInstance(instance);
1044 <<
"Failed writing polyMesh." 1049 Info<<
nl <<
"Written filtered mesh to " 1050 << mesh.polyMesh::instance() <<
nl 1059 "boundaryPoints_collapsed",
1082 forAll(mesh.points(), ptI)
1084 boundaryPtsScalarField[ptI] = mesh.pointZones().whichZone(ptI);
1085 boundaryPtsIO[ptI] = mesh.pointZones().whichZone(ptI);
1088 boundaryPtsScalarField.write();
1089 boundaryPtsIO.write();
1110 Info<<
nl <<
"Create targetCellSize volScalarField" <<
endl;
1117 mesh.polyMesh::instance(),
1124 zeroGradientFvPatchScalarField::typeName
1127 scalarField& cellSize = targetCellSize.primitiveFieldRef();
1197 targetCellSize.correctBoundaryConditions();
1202 targetCellSize.write();
1311 Info<<
"Writing components of cellCentre positions to volScalarFields" 1312 <<
" ccx, ccy, ccz in " << runTime_.
timeName() <<
endl;
1326 mesh.C().component(i)
1336 const polyMesh& mesh
1339 timeCheck(
"Start findRemainingProtrusionSet");
1341 const polyBoundaryMesh& patches = mesh.boundaryMesh();
1347 const polyPatch& patch = patches[
patchi];
1349 forAll(patch.localPoints(), pLPI)
1351 label meshPtI = patch.meshPoints()[pLPI];
1353 const Foam::point& pt = patch.localPoints()[pLPI];
1360 sqr(targetCellSize(pt))
1364 protrudingBoundaryPoints.insert(meshPtI);
1369 cellSet protrudingCells
1372 "foamyHexMesh_remainingProtrusions",
1378 const label pointi = iter.key();
1379 const labelList& pCells = mesh.pointCells()[pointi];
1383 protrudingCells.insert(pCells[pCI]);
1387 label protrudingCellsSize = protrudingCells.size();
1389 reduce(protrudingCellsSize, sumOp<label>());
1393 Info<<
nl <<
"Found " << protrudingCellsSize
1394 <<
" cells protruding from the surface, writing cellSet " 1395 << protrudingCells.name()
1398 protrudingCells.
write();
1401 return Foam::move(protrudingCells);
1405 void Foam::conformalVoronoiMesh::writePointPairs
1407 const fileName& fName
1410 OBJstream os(fName);
1414 Delaunay::Finite_edges_iterator eit = finite_edges_begin();
1415 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.
virtual Ostream & write(const char)=0
Write character.
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)
const dimensionSet dimLength
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
Various functions to operate on Lists.
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)
Delaunay ::Finite_cells_iterator Finite_cells_iterator
Switch writeCellShapeControlMesh() const
Write cellShapeControlMesh at output time.
static pointMesh & New(polyMesh &mesh)
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.
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.
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())