From 605c27ae0e16af262ebdf7d7bffb46b6bc84c0fb Mon Sep 17 00:00:00 2001 From: graham Date: Mon, 20 Jun 2011 09:55:54 +0100 Subject: [PATCH] ENH: Motion of points in parallel. Insertion or removal can only happen between real, internal points, not between real internal and referred internal points. Function (referredInternalOrBoundary) name change, more accurate. --- .../conformalVoronoiMesh.C | 30 ++++++++---- .../conformalVoronoiMeshCalcDualMesh.C | 10 ++-- .../conformalVoronoiMeshConformToSurface.C | 2 +- .../conformalVoronoiMesh/indexedVertex.H | 46 +++---------------- 4 files changed, 37 insertions(+), 51 deletions(-) diff --git a/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C b/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C index c0f3459be8..8a7bdefa9e 100644 --- a/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C +++ b/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C @@ -1550,7 +1550,11 @@ void Foam::conformalVoronoiMesh::setVertexSizeAndAlignment() vit++ ) { - if (vit->internalOrBoundaryPoint()) + if + ( + vit->internalOrBoundaryPoint() + || vit->referredInternalOrBoundaryPoint() + ) { Foam::point pt(topoint(vit->point())); @@ -1962,10 +1966,10 @@ void Foam::conformalVoronoiMesh::move() if ( - cit->vertex(0)->internalOrBoundaryPoint() - || cit->vertex(1)->internalOrBoundaryPoint() - || cit->vertex(2)->internalOrBoundaryPoint() - || cit->vertex(3)->internalOrBoundaryPoint() + cit->vertex(0)->anyInternalOrBoundaryPoint() + || cit->vertex(1)->anyInternalOrBoundaryPoint() + || cit->vertex(2)->anyInternalOrBoundaryPoint() + || cit->vertex(3)->anyInternalOrBoundaryPoint() ) { cit->cellIndex() = dualVertI; @@ -1996,7 +2000,11 @@ void Foam::conformalVoronoiMesh::move() vector::zero ); - PackedBoolList pointToBeRetained(number_of_vertices(), true); + PackedBoolList pointToBeRetained + ( + number_of_vertices(), + true + ); std::list pointsToInsert; @@ -2011,10 +2019,16 @@ void Foam::conformalVoronoiMesh::move() Vertex_handle vA = c->vertex(eit->second); Vertex_handle vB = c->vertex(eit->third); + if (!vA->internalOrBoundaryPoint() && !vB->internalOrBoundaryPoint()) + { + // At least one vertex has to be a real internalOrBoundaryPoint + continue; + } + if ( - vA->internalOrBoundaryPoint() - && vB->internalOrBoundaryPoint() + vA->anyInternalOrBoundaryPoint() + && vB->anyInternalOrBoundaryPoint() ) { face dualFace = buildDualFace(eit); diff --git a/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C b/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C index 092aa0657b..b2e6a96581 100644 --- a/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C +++ b/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C @@ -1929,7 +1929,11 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches label patchIndex = -1; - if (vA->referredInternal() || vB->referredInternal()) + if + ( + vA->referredInternalOrBoundaryPoint() + || vB->referredInternalOrBoundaryPoint() + ) { // One (and only one) of the points is an internal // point from another processor @@ -1949,7 +1953,7 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches Pair >& sortingIndex = procPatchSortingIndex[patchIndex]; - if (vB->referredInternal()) + if (vB->referredInternalOrBoundaryPoint()) { sortingIndex.first().append(vA->index()); sortingIndex.second().append(vB->index()); @@ -1968,7 +1972,7 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches Pair >& sortingIndex = procPatchSortingIndex[patchIndex]; - if (vA->referredInternal()) + if (vA->referredInternalOrBoundaryPoint()) { sortingIndex.first().append(vA->index()); sortingIndex.second().append(vB->index()); diff --git a/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshConformToSurface.C b/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshConformToSurface.C index b0da1386a6..ff94ed68f5 100644 --- a/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshConformToSurface.C +++ b/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshConformToSurface.C @@ -305,7 +305,7 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation ( vit->nearBoundary() || vit->ppMaster() - || vit->referredInternal() + || vit->referredInternalOrBoundaryPoint() ) { Foam::point vert(topoint(vit->point())); diff --git a/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex.H b/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex.H index 492cf10889..87283a8dcd 100644 --- a/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex.H +++ b/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex.H @@ -227,9 +227,9 @@ public: // is this a referred internal or boundary vertex - inline bool referredInternal() const + inline bool referredInternalOrBoundaryPoint() const { - return referred() && index_ >= 0 ; + return referred() && index_ >= 0; } @@ -350,43 +350,11 @@ public: } - // //- Do the two given vertices consitute a boundary point-pair - // inline friend bool pointPair - // ( - // const indexedVertex& v0, - // const indexedVertex& v1 - // ) - // { - // return v0.index_ == v1.type_ || v1.index_ == v0.type_; - // } - - - // //- Do the three given vertices consitute a boundary triangle - // inline friend bool boundaryTriangle - // ( - // const indexedVertex& v0, - // const indexedVertex& v1, - // const indexedVertex& v2 - // ) - // { - // return (v0.pairPoint() && pointPair(v1, v2)) - // || (v1.pairPoint() && pointPair(v2, v0)) - // || (v2.pairPoint() && pointPair(v0, v1)); - // } - - - // //- Do the three given vertices consitute an outside triangle - // inline friend bool outsideTriangle - // ( - // const indexedVertex& v0, - // const indexedVertex& v1, - // const indexedVertex& v2 - // ) - // { - // return (v0.farPoint() || v0.ppSlave()) - // || (v1.farPoint() || v1.ppSlave()) - // || (v2.farPoint() || v2.ppSlave()); - // } + //- Either a real or referred internal or boundary point + inline bool anyInternalOrBoundaryPoint() const + { + return internalOrBoundaryPoint() || referredInternalOrBoundaryPoint(); + } // inline void operator=(const Delaunay::Finite_vertices_iterator vit)