From f9b8994a927a069a2decf63e6197c8b0bab51377 Mon Sep 17 00:00:00 2001 From: mattijs <mattijs@hunt.opencfd.co.uk> Date: Wed, 18 Mar 2009 11:46:24 +0000 Subject: [PATCH] local point ordering --- .../PrimitivePatch/PrimitivePatch.H | 4 +- .../PrimitivePatch/PrimitivePatchMeshData.C | 56 ++++++++++++++----- 2 files changed, 44 insertions(+), 16 deletions(-) diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.H b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.H index f0bd005b476..c741b0839ec 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.H +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.H @@ -330,7 +330,9 @@ public: // Addressing into mesh - //- Return labelList of mesh points in patch + //- Return labelList of mesh points in patch. They are constructed + // walking through the faces in incremental order and not sorted + // anymore. const labelList& meshPoints() const; //- Mesh point map. Given the global point index find its diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchMeshData.C b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchMeshData.C index 9941b024598..30cffb6310a 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchMeshData.C +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchMeshData.C @@ -67,30 +67,56 @@ calcMeshData() const // number of faces in the patch Map<label> markedPoints(4*this->size()); - // if the point is used, set the mark to 1 + + // Important: + // ~~~~~~~~~~ + // In <= 1.5 the meshPoints would be in increasing order but this gives + // problems in processor point synchronisation where we have to find out + // how the opposite side would have allocated points. + + ////- 1.5 code: + //// if the point is used, set the mark to 1 + //forAll (*this, faceI) + //{ + // const Face& curPoints = this->operator[](faceI); + // + // forAll (curPoints, pointI) + // { + // markedPoints.insert(curPoints[pointI], -1); + // } + //} + // + //// Create the storage and store the meshPoints. Mesh points are + //// the ones marked by the usage loop above + //meshPointsPtr_ = new labelList(markedPoints.toc()); + //labelList& pointPatch = *meshPointsPtr_; + // + //// Sort the list to preserve compatibility with the old ordering + //sort(pointPatch); + // + //// For every point in map give it its label in mesh points + //forAll (pointPatch, pointI) + //{ + // markedPoints.find(pointPatch[pointI])() = pointI; + //} + + //- Unsorted version: + DynamicList<label> meshPoints(2*this->size()); forAll (*this, faceI) { const Face& curPoints = this->operator[](faceI); forAll (curPoints, pointI) { - markedPoints.insert(curPoints[pointI], -1); + if (markedPoints.insert(curPoints[pointI], meshPoints.size())) + { + meshPoints.append(curPoints[pointI]); + } } } + // Transfer to straight list (reuses storage) + meshPointsPtr_ = new labelList(meshPoints, true); - // Create the storage and store the meshPoints. Mesh points are - // the ones marked by the usage loop above - meshPointsPtr_ = new labelList(markedPoints.toc()); - labelList& pointPatch = *meshPointsPtr_; - - // Sort the list to preserve compatibility with the old ordering - sort(pointPatch); - - // For every point in map give it its label in mesh points - forAll (pointPatch, pointI) - { - markedPoints.find(pointPatch[pointI])() = pointI; - } // Create local faces. Note that we start off from copy of original face // list (even though vertices are overwritten below). This is done so -- GitLab