diff --git a/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H b/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H index f309a2700d..836f6e4cca 100644 --- a/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H +++ b/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H @@ -684,6 +684,8 @@ private: labelList& patchStarts, labelList& procNeighbours, pointField& cellCentres, + labelList& cellToDelaunayVertex, + labelListList& patchToDelaunayVertex, bool filterFaces ); @@ -691,6 +693,7 @@ private: void calcTetMesh ( pointField& points, + labelList& pointToDelaunayVertex, faceList& faces, labelList& owner, labelList& neighbour, @@ -812,14 +815,15 @@ private: labelList& patchSizes, labelList& patchStarts, labelList& procNeighbours, + labelListList& patchPointPairSlaves, bool includeEmptyPatches = false ) const; //- Create the cell centres to use for the mesh - void createCellCentres - ( - pointField& cellCentres - ) const; + void createCellCentres(pointField& cellCentres) const; + + //- Extract all points in vertex-index order + tmp allPoints() const; //- Sort the faces, owner and neighbour lists into // upper-triangular order. For internal faces only, use @@ -837,6 +841,7 @@ private: ( List >& patchFaces, List >& patchOwners, + List >& patchPointPairSlaves, List > >& patchSortingIndices ) const; @@ -859,12 +864,12 @@ private: pointField& pts ) const; - //- Remove dual cells that are not used by any faces - void removeUnusedCells + //- Remove dual cells that are not used by any faces. Return compaction + // map. + labelList removeUnusedCells ( labelList& owner, - labelList& neighbour, - pointField& cellCentres + labelList& neighbour ) const; //- Disallow default bitwise copy construct @@ -1008,11 +1013,11 @@ public: faceList& faces, labelList& owner, labelList& neighbour, - wordList& patchTypes, - wordList& patchNames, - labelList& patchSizes, - labelList& patchStarts, - labelList& procNeighbours, + const wordList& patchTypes, + const wordList& patchNames, + const labelList& patchSizes, + const labelList& patchStarts, + const labelList& procNeighbours, const pointField& cellCentres ) const; diff --git a/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C b/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C index d74df4f061..5a5cbfe44d 100644 --- a/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C +++ b/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C @@ -41,6 +41,8 @@ void Foam::conformalVoronoiMesh::calcDualMesh labelList& patchStarts, labelList& procNeighbours, pointField& cellCentres, + labelList& cellToDelaunayVertex, + labelListList& patchToDelaunayVertex, bool filterFaces ) { @@ -274,14 +276,17 @@ void Foam::conformalVoronoiMesh::calcDualMesh patchSizes, patchStarts, procNeighbours, + patchToDelaunayVertex, // from patch face to Delaunay vertex (slavePp) false ); // deferredCollapseFaceSet(owner, neighbour, deferredCollapseFaces); - createCellCentres(cellCentres); + cellCentres = allPoints(); - removeUnusedCells(owner, neighbour, cellCentres); + cellToDelaunayVertex = removeUnusedCells(owner, neighbour); + + cellCentres = pointField(cellCentres, cellToDelaunayVertex); removeUnusedPoints(faces, points); @@ -292,6 +297,7 @@ void Foam::conformalVoronoiMesh::calcDualMesh void Foam::conformalVoronoiMesh::calcTetMesh ( pointField& points, + labelList& pointToDelaunayVertex, faceList& faces, labelList& owner, labelList& neighbour, @@ -306,6 +312,7 @@ void Foam::conformalVoronoiMesh::calcTetMesh label vertI = 0; points.setSize(number_of_vertices()); + pointToDelaunayVertex.setSize(number_of_vertices()); for ( @@ -318,11 +325,13 @@ void Foam::conformalVoronoiMesh::calcTetMesh { vertexMap[vit->index()] = vertI; points[vertI] = topoint(vit->point()); + pointToDelaunayVertex[vertI] = vit->index(); vertI++; } } points.setSize(vertI); + pointToDelaunayVertex.setSize(vertI); label cellI = 0; @@ -1508,6 +1517,7 @@ Foam::labelHashSet Foam::conformalVoronoiMesh::checkPolyMeshQuality labelList patchStarts; labelList procNeighbours; pointField cellCentres; + labelListList patchToDelaunayVertex; timeCheck("Start of checkPolyMeshQuality"); @@ -1523,12 +1533,15 @@ Foam::labelHashSet Foam::conformalVoronoiMesh::checkPolyMeshQuality patchSizes, patchStarts, procNeighbours, + patchToDelaunayVertex, false ); - createCellCentres(cellCentres); + //createCellCentres(cellCentres); + cellCentres = allPoints(); - removeUnusedCells(owner, neighbour, cellCentres); + labelList cellToDelaunayVertex(removeUnusedCells(owner, neighbour)); + cellCentres = pointField(cellCentres, cellToDelaunayVertex); polyMesh pMesh ( @@ -1887,6 +1900,7 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches labelList& patchSizes, labelList& patchStarts, labelList& procNeighbours, + labelListList& patchPointPairSlaves, bool includeEmptyPatches ) const { @@ -1966,6 +1980,10 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches List > patchOwners(nPatches, DynamicList