48 const string& description
58 const string& description,
64 Info<<
nl <<
"--- [ cpuTime "
70 Info<<
", " << description <<
" ";
83 PrintTable<word, label> memoryTable
89 memoryTable.add(
"mSize", m.size());
90 memoryTable.add(
"mPeak", m.peak());
91 memoryTable.add(
"mRss", m.rss());
121 bitSet boundaryFacesToRemove;
133 cellToDelaunayVertex,
134 patchToDelaunayVertex,
135 boundaryFacesToRemove
138 Info<<
nl <<
"Writing polyMesh to " << instance <<
endl;
152 boundaryFacesToRemove
157 forAll(dualPatchStarts, patchi)
159 dualPatchStarts[patchi] =
164 if (foamyHexMeshControls().writeCellShapeControlMesh())
166 cellShapeControls().shapeControlMesh().write();
169 if (foamyHexMeshControls().writeBackgroundMeshDecomposition())
171 Info<<
nl <<
"Writing " <<
"backgroundMeshDecomposition" <<
endl;
174 const_cast<fvMesh&
>(decomposition_().mesh()).setInstance
179 decomposition_().mesh().
write();
182 if (foamyHexMeshControls().writeTetDualMesh())
187 Finite_cells_iterator cit = finite_cells_begin();
188 cit != finite_cells_end();
198 cit->cellIndex() = celli++;
202 Info<<
nl <<
"Writing " <<
"tetDualMesh" <<
endl;
206 autoPtr<polyMesh> tetMesh =
207 createMesh(
"tetDualMesh", vertexMap, cellMap);
422 == processorPolyPatch::typeName
426 patches[patchi] =
new processorPolyPatch
433 patchDicts[patchi].get<label>(
"neighbProcNo"),
457 void Foam::conformalVoronoiMesh::checkProcessorPatchesMatch
476 == processorPolyPatch::typeName
480 const label procNeighb =
481 patchDicts[patchi].get<label>(
"neighbProcNo");
492 bool allMatch =
true;
494 forAll(procPatchSizes, proci)
496 const labelList& patchSizes = procPatchSizes[proci];
498 forAll(patchSizes, patchi)
500 if (patchSizes[patchi] != procPatchSizes[patchi][proci])
504 Info<<
indent <<
"Patches " << proci <<
" and " << patchi
505 <<
" have different sizes: " << patchSizes[patchi]
506 <<
" and " << procPatchSizes[patchi][proci] <<
endl;
513 Info<<
indent <<
"All processor patches have matching numbers of "
520 void Foam::conformalVoronoiMesh::reorderPoints
525 const label nInternalFaces
534 for (label fI = nInternalFaces; fI < faces.size(); ++fI)
536 const face&
f = faces[fI];
540 oldToNew[
f[fpI]] = 1;
544 const label nInternalPoints =
points.size() -
sum(oldToNew);
546 label countInternal = 0;
547 label countExternal = nInternalPoints;
551 if (oldToNew[pI] == 0)
553 oldToNew[pI] = countInternal++;
557 oldToNew[pI] = countExternal++;
562 <<
"Number of internal points: " << countInternal <<
nl
563 <<
indent <<
"Number of external points: " << countExternal
575 f[fpI] = oldToNew[
f[fpI]];
581 void Foam::conformalVoronoiMesh::reorderProcessorPatches
583 const word& meshName,
584 const fileName& instance,
597 autoPtr<fvMesh> sortMeshPtr
614 const fvMesh& sortMesh = sortMeshPtr();
623 forAll(sortMesh.boundaryMesh(), patchi)
625 const polyPatch& pp = sortMesh.boundaryMesh()[patchi];
627 if (isA<processorPolyPatch>(pp))
629 refCast<const processorPolyPatch>(pp).initOrder
646 pBufs.finishedSends();
651 bool anyChanged =
false;
653 forAll(sortMesh.boundaryMesh(), patchi)
655 const polyPatch& pp = sortMesh.boundaryMesh()[patchi];
657 if (isA<processorPolyPatch>(pp))
659 const label nPatchFaces =
662 const label patchStartFace =
665 labelList patchFaceMap(nPatchFaces, label(-1));
668 bool changed = refCast<const processorPolyPatch>(pp).order
688 forAll(patchFaceRotation, patchFacei)
690 rotation[patchFacei + patchStartFace]
691 = patchFaceRotation[patchFacei];
694 forAll(patchFaceMap, patchFacei)
696 if (patchFaceMap[patchFacei] != patchFacei)
698 faceMap[patchFacei + patchStartFace]
699 = patchFaceMap[patchFacei] + patchStartFace;
710 reduce(anyChanged, orOp<bool>());
714 label nReorderedFaces = 0;
724 if (nReorderedFaces > 0)
734 if (rotation[facei] != 0)
736 faces[facei] =
rotateList(faces[facei], rotation[facei]);
741 Info<< indent << returnReduce(nReorderedFaces, sumOp<label>())
742 <<
" faces have been reordered" <<
nl
744 <<
" faces have been rotated"
753 const word& meshName,
754 const fileName& instance,
763 bitSet& boundaryFacesToRemove
766 if (foamyHexMeshControls().objOutput())
770 time().
path()/word(meshName +
".obj"),
776 const label nInternalFaces =
patchDicts[0].get<label>(
"startFace");
778 reorderPoints(
points, boundaryPts, faces, nInternalFaces);
782 reorderProcessorPatches
796 timeCheck(
"Before fvMesh construction");
818 label nValidPatches = 0;
822 label totalPatchSize =
patchDicts[
p].get<label>(
"nFaces");
829 == processorPolyPatch::typeName
836 "coincidentFullMatch"
840 if (totalPatchSize > 0)
842 patches[nValidPatches] =
new processorPolyPatch
848 processorPolyPatch::typeName
857 reduce(totalPatchSize, sumOp<label>());
859 if (totalPatchSize > 0)
880 addZones(
mesh, cellCentres);
887 DynamicList<label> bPts(boundaryPts.size());
889 forAll(dualMeshPointTypeNames_, typeI)
892 dualMeshPointTypeNames_[dualMeshPointType(typeI)];
896 const label& bPtType = boundaryPts[ptI];
898 if (bPtType == typeI)
907 <<
"Adding " << bPts.size()
908 <<
" points of type " << znName
934 boundaryFacesToRemove,
935 orEqOp<unsigned int>()
938 labelList addr(boundaryFacesToRemove.toc());
940 faceSet indirectPatchFaces
943 "indirectPatchFaces",
948 indirectPatchFaces.sync(
mesh);
953 timeCheck(
"Before fvMesh filtering");
955 autoPtr<polyMeshFilter> meshFilter;
957 label nInitialBadFaces = 0;
959 if (foamyHexMeshControls().filterEdges())
961 Info<<
nl <<
"Filtering edges on polyMesh" <<
nl <<
endl;
963 meshFilter.reset(
new polyMeshFilter(
mesh, boundaryPts));
967 nInitialBadFaces = meshFilter().filterEdges(0);
969 const autoPtr<fvMesh>& newMesh = meshFilter().filteredMesh();
971 polyTopoChange meshMod(newMesh());
973 autoPtr<mapPolyMesh> map = meshMod.changeMesh(
mesh,
false);
975 polyMeshFilter::copySets(newMesh(),
mesh);
979 if (foamyHexMeshControls().filterFaces())
1000 Info<<
nl <<
"Filtering faces on polyMesh" <<
nl <<
endl;
1002 meshFilter.reset(
new polyMeshFilter(
mesh, boundaryPtsIO));
1004 meshFilter().filter(nInitialBadFaces);
1006 const autoPtr<fvMesh>& newMesh = meshFilter().filteredMesh();
1008 polyTopoChange meshMod(newMesh());
1010 autoPtr<mapPolyMesh> map = meshMod.changeMesh(
mesh,
false);
1012 polyMeshFilter::copySets(newMesh(),
mesh);
1016 timeCheck(
"After fvMesh filtering");
1023 <<
"Failed writing polyMesh."
1028 Info<<
nl <<
"Written filtered mesh to "
1029 <<
mesh.polyMesh::instance() <<
nl
1038 "boundaryPoints_collapsed",
1067 boundaryPtsScalarField.write();
1068 boundaryPtsIO.write();
1077 findRemainingProtrusionSet(
mesh);
1087 timeCheck(
"Start writeCellSizes");
1089 Info<<
nl <<
"Create targetCellSize volScalarField" <<
endl;
1096 mesh.polyMesh::instance(),
1103 zeroGradientFvPatchScalarField::typeName
1106 scalarField& cellSize = targetCellSize.primitiveFieldRef();
1112 cellSize[i] = cellShapeControls().cellSize(
C[i]);
1176 targetCellSize.correctBoundaryConditions();
1181 targetCellSize.write();
1290 Info<<
"Writing components of cellCentre positions to volScalarFields"
1291 <<
" ccx, ccy, ccz in " << runTime_.timeName() <<
endl;
1300 runTime_.timeName(),
1315 const polyMesh&
mesh
1318 timeCheck(
"Start findRemainingProtrusionSet");
1330 label meshPtI =
patch.meshPoints()[pLPI];
1336 geometryToConformTo_.wellOutside
1339 sqr(targetCellSize(pt))
1343 protrudingBoundaryPoints.insert(meshPtI);
1348 cellSet protrudingCells
1351 "foamyHexMesh_remainingProtrusions",
1355 for (
const label pointi : protrudingBoundaryPoints)
1358 protrudingCells.insert(pCells);
1361 const label protrudingCellsSize =
1364 if (foamyHexMeshControls().objOutput() && protrudingCellsSize)
1366 Info<<
nl <<
"Found " << protrudingCellsSize
1367 <<
" cells protruding from the surface, writing cellSet "
1368 << protrudingCells.name()
1371 protrudingCells.
write();
1374 return std::move(protrudingCells);
1378 void Foam::conformalVoronoiMesh::writePointPairs
1380 const fileName& fName
1383 OBJstream
os(fName);
1387 Delaunay::Finite_edges_iterator eit = finite_edges_begin();
1388 eit != finite_edges_end();
1392 Cell_handle
c = eit->first;
1393 Vertex_handle vA =
c->vertex(eit->second);
1394 Vertex_handle vB =
c->vertex(eit->third);
1396 if (ptPairs_.isPointPair(vA, vB))