diff --git a/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H b/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H index a93ddd7cf0..85d168e9f2 100644 --- a/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H +++ b/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H @@ -957,7 +957,8 @@ public: void drawDelaunayCell ( Ostream& os, - const Delaunay::Finite_cells_iterator& cit + const Delaunay::Finite_cells_iterator& cit, + label offset = 0 ) const; //- Write Delaunay points to .obj file diff --git a/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshIO.C b/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshIO.C index 77ee7101e9..b93d0f8f9f 100644 --- a/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshIO.C +++ b/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshIO.C @@ -115,9 +115,19 @@ void Foam::conformalVoronoiMesh::timeCheck void Foam::conformalVoronoiMesh::drawDelaunayCell ( Ostream& os, - const Delaunay::Finite_cells_iterator& cit + const Delaunay::Finite_cells_iterator& cit, + label offset ) const { + // Supply offset as tet number + offset *= 5; + + os << "# cell index: " << label(cit->cellIndex()) << endl; + + os << "# circumradius " + << mag(topoint(dual(cit)) - topoint(cit->vertex(0)->point())) + << endl; + for (int i = 0; i < 4; i++) { os << "# index type: " @@ -127,14 +137,16 @@ void Foam::conformalVoronoiMesh::drawDelaunayCell meshTools::writeOBJ(os, topoint(cit->vertex(i)->point())); } - os << "f 1 3 2" << nl - << "f 2 3 4" << nl - << "f 1 4 3" << nl - << "f 1 2 4" << endl; + os << "f " << 1 + offset << " " << 3 + offset << " " << 2 + offset << nl + << "f " << 2 + offset << " " << 3 + offset << " " << 4 + offset << nl + << "f " << 1 + offset << " " << 4 + offset << " " << 3 + offset << nl + << "f " << 1 + offset << " " << 2 + offset << " " << 4 + offset << endl; + + os << "# cicumcentre " << endl; meshTools::writeOBJ(os, topoint(dual(cit))); - os << "l 1 5" << endl; + os << "l " << 1 + offset << " " << 5 + offset << endl; } diff --git a/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell.H b/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell.H index c2da18ae71..c15197a237 100644 --- a/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell.H +++ b/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell.H @@ -36,6 +36,7 @@ Description #include #include #include "indexedVertex.H" +#include "Pstream.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -157,8 +158,8 @@ public: } - // Is the Delaunay cell real, i.e. any real vertex - inline int real() const + //- Is the Delaunay cell real, i.e. any real vertex + inline bool real() const { return ( @@ -170,9 +171,50 @@ public: } + //- Does the Dual vertex form part of a processor patch + inline int parallelDualVertex() const + { + return + ( + this->vertex(0)->referred() + || this->vertex(1)->referred() + || this->vertex(2)->referred() + || this->vertex(3)->referred() + ); + } + + + //- Does the Dual vertex form part of a processor patch + inline Foam::label dualVertexMasterProc() const + { + if (!parallelDualVertex) + { + return -1; + } + + // The master processor is the lowest numbered of the four on this tet. + + int masterProc = Foam::Pstream::nProcs() + 1; + + for (int i = 0; i < 4; i++) + { + if (this->vertex(i)->referred()) + { + masterProc = min(masterProc, this->vertex(i)->procIndex()); + } + else + { + masterProc = min(masterProc, Foam::Pstream::myProcNo()); + } + } + + return masterProc; + } + + // Is the Delaunay cell part of the final dual mesj, i.e. any vertex form // part of the internal or boundary definition - inline int internalOrBoundaryDualVertex() const + inline bool internalOrBoundaryDualVertex() const { return ( @@ -186,7 +228,7 @@ public: // Is the Delaunay cell real or referred (or mixed), i.e. all vertices form // part of the real or referred internal or boundary definition - inline int anyInternalOrBoundaryDualVertex() const + inline bool anyInternalOrBoundaryDualVertex() const { return (