From 68263fe30ab4585d369c78cf26591d18b1bc9df4 Mon Sep 17 00:00:00 2001 From: henry Date: Mon, 23 Nov 2009 23:14:35 +0000 Subject: [PATCH] Added faceCentres member function. Removed spurious blank lines between template declarations and function definitions. --- .../primitiveMesh/PrimitivePatch/PrimitivePatch.C | 51 +++++----- .../primitiveMesh/PrimitivePatch/PrimitivePatch.H | 9 ++ .../PrimitivePatch/PrimitivePatchAddressing.C | 1 - .../PrimitivePatch/PrimitivePatchBdryPoints.C | 3 - .../PrimitivePatch/PrimitivePatchCheck.C | 4 - .../PrimitivePatch/PrimitivePatchClear.C | 7 +- .../PrimitivePatch/PrimitivePatchEdgeLoops.C | 3 - .../PrimitivePatch/PrimitivePatchLocalPointOrder.C | 4 +- .../PrimitivePatch/PrimitivePatchMeshData.C | 109 ++++++++++++++------- .../PrimitivePatch/PrimitivePatchMeshEdges.C | 5 - .../PrimitivePatch/PrimitivePatchPointAddressing.C | 2 - .../PrimitivePatch/PrimitivePatchProjectPoints.C | 2 - 12 files changed, 113 insertions(+), 87 deletions(-) diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.C b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.C index 6be9ef34..a86dd360 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.C +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.C @@ -28,7 +28,6 @@ License // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct from components template < class Face, @@ -36,7 +35,6 @@ template class PointField, class PointType > - Foam::PrimitivePatch:: PrimitivePatch ( @@ -60,12 +58,12 @@ PrimitivePatch edgeLoopsPtr_(NULL), localPointsPtr_(NULL), localPointOrderPtr_(NULL), + faceCentresPtr_(NULL), faceNormalsPtr_(NULL), pointNormalsPtr_(NULL) {} -// Construct from components template < class Face, @@ -73,7 +71,6 @@ template class PointField, class PointType > - Foam::PrimitivePatch:: PrimitivePatch ( @@ -98,12 +95,12 @@ PrimitivePatch edgeLoopsPtr_(NULL), localPointsPtr_(NULL), localPointOrderPtr_(NULL), + faceCentresPtr_(NULL), faceNormalsPtr_(NULL), pointNormalsPtr_(NULL) {} -// Construct as copy template < class Face, @@ -111,7 +108,6 @@ template class PointField, class PointType > - Foam::PrimitivePatch:: PrimitivePatch ( @@ -135,6 +131,7 @@ PrimitivePatch edgeLoopsPtr_(NULL), localPointsPtr_(NULL), localPointOrderPtr_(NULL), + faceCentresPtr_(NULL), faceNormalsPtr_(NULL), pointNormalsPtr_(NULL) {} @@ -149,8 +146,8 @@ template class PointField, class PointType > - -Foam::PrimitivePatch::~PrimitivePatch() +Foam::PrimitivePatch:: +~PrimitivePatch() { clearOut(); } @@ -158,7 +155,6 @@ Foam::PrimitivePatch::~PrimitivePatch() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -// Correct patch after moving points template < class Face, @@ -166,7 +162,6 @@ template class PointField, class PointType > - void Foam::PrimitivePatch:: movePoints @@ -193,7 +188,6 @@ template class PointField, class PointType > - const Foam::edgeList& Foam::PrimitivePatch:: edges() const @@ -214,7 +208,6 @@ template class PointField, class PointType > - Foam::label Foam::PrimitivePatch:: nInternalEdges() const @@ -235,7 +228,6 @@ template class PointField, class PointType > - const Foam::labelList& Foam::PrimitivePatch:: boundaryPoints() const @@ -256,7 +248,6 @@ template class PointField, class PointType > - const Foam::labelListList& Foam::PrimitivePatch:: faceFaces() const @@ -277,7 +268,6 @@ template class PointField, class PointType > - const Foam::labelListList& Foam::PrimitivePatch:: edgeFaces() const @@ -298,7 +288,6 @@ template class PointField, class PointType > - const Foam::labelListList& Foam::PrimitivePatch:: faceEdges() const @@ -319,7 +308,6 @@ template class PointField, class PointType > - const Foam::labelListList& Foam::PrimitivePatch:: pointEdges() const @@ -340,7 +328,6 @@ template class PointField, class PointType > - const Foam::labelListList& Foam::PrimitivePatch:: pointFaces() const @@ -361,7 +348,6 @@ template class PointField, class PointType > - const Foam::List& Foam::PrimitivePatch:: localFaces() const @@ -382,7 +368,6 @@ template class PointField, class PointType > - const Foam::labelList& Foam::PrimitivePatch:: meshPoints() const @@ -403,7 +388,6 @@ template class PointField, class PointType > - const Foam::Map& Foam::PrimitivePatch:: meshPointMap() const @@ -424,7 +408,6 @@ template class PointField, class PointType > - const Foam::Field& Foam::PrimitivePatch:: localPoints() const @@ -445,7 +428,6 @@ template class PointField, class PointType > - const Foam::labelList& Foam::PrimitivePatch:: localPointOrder() const @@ -466,7 +448,6 @@ template class PointField, class PointType > - Foam::label Foam::PrimitivePatch:: whichPoint @@ -495,7 +476,26 @@ template class PointField, class PointType > +const Foam::Field& +Foam::PrimitivePatch:: +faceCentres() const +{ + if (!faceCentresPtr_) + { + calcFaceCentres(); + } + + return *faceCentresPtr_; +} + +template +< + class Face, + template class FaceList, + class PointField, + class PointType +> const Foam::Field& Foam::PrimitivePatch:: faceNormals() const @@ -516,7 +516,6 @@ template class PointField, class PointType > - const Foam::Field& Foam::PrimitivePatch:: pointNormals() const @@ -539,7 +538,6 @@ template class PointField, class PointType > - void Foam::PrimitivePatch:: operator= @@ -552,6 +550,7 @@ operator= FaceList::operator=(pp); } + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #include "PrimitivePatchAddressing.C" diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.H b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.H index c741b083..dbd8a9ff 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.H +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.H @@ -166,6 +166,9 @@ private: //- Local point order for most efficient search mutable labelList* localPointOrderPtr_; + //- Face centres + mutable Field* faceCentresPtr_; + //- Face unit normals mutable Field* faceNormalsPtr_; @@ -205,6 +208,9 @@ private: //- Calculate local point order void calcLocalPointOrder() const; + //- Calculate face centres + void calcFaceCentres() const; + //- Calculate unit face normals void calcFaceNormals() const; @@ -370,6 +376,9 @@ public: const labelListList& pointEdges ) const; + //- Return face centres for patch + const Field& faceCentres() const; + //- Return face normals for patch const Field& faceNormals() const; diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchAddressing.C b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchAddressing.C index 14d91344..5deecba2 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchAddressing.C +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchAddressing.C @@ -48,7 +48,6 @@ template class PointField, class PointType > - void Foam::PrimitivePatch:: calcAddressing() const diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchBdryPoints.C b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchBdryPoints.C index fbd309d2..379445b1 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchBdryPoints.C +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchBdryPoints.C @@ -22,8 +22,6 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -Description - \*---------------------------------------------------------------------------*/ #include "PrimitivePatch.H" @@ -39,7 +37,6 @@ template class PointField, class PointType > - void Foam::PrimitivePatch:: calcBdryPoints() const diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchCheck.C b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchCheck.C index 172bc9db..11fe2235 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchCheck.C +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchCheck.C @@ -41,7 +41,6 @@ template class PointField, class PointType > - void Foam::PrimitivePatch:: visitPointRegion @@ -120,7 +119,6 @@ template class PointField, class PointType > - typename Foam::PrimitivePatch::surfaceTopo Foam::PrimitivePatch:: surfaceType() const @@ -174,7 +172,6 @@ template class PointField, class PointType > - bool Foam::PrimitivePatch:: checkTopology @@ -245,7 +242,6 @@ template class PointField, class PointType > - bool Foam::PrimitivePatch:: checkPointManifold diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchClear.C b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchClear.C index 160bf554..c85cf147 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchClear.C +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchClear.C @@ -22,8 +22,6 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -Description - \*---------------------------------------------------------------------------*/ #include "PrimitivePatch.H" @@ -39,7 +37,6 @@ template class PointField, class PointType > - void Foam::PrimitivePatch:: clearGeom() @@ -52,6 +49,7 @@ clearGeom() } deleteDemandDrivenData(localPointsPtr_); + deleteDemandDrivenData(faceCentresPtr_); deleteDemandDrivenData(faceNormalsPtr_); deleteDemandDrivenData(pointNormalsPtr_); } @@ -64,7 +62,6 @@ template class PointField, class PointType > - void Foam::PrimitivePatch:: clearTopology() @@ -106,7 +103,6 @@ template class PointField, class PointType > - void Foam::PrimitivePatch:: clearPatchMeshAddr() @@ -132,7 +128,6 @@ template class PointField, class PointType > - void Foam::PrimitivePatch:: clearOut() diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchEdgeLoops.C b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchEdgeLoops.C index 3b7d87df..80e36f16 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchEdgeLoops.C +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchEdgeLoops.C @@ -31,7 +31,6 @@ Description #include "PrimitivePatch.H" - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template @@ -41,7 +40,6 @@ template class PointField, class PointType > - void Foam::PrimitivePatch:: calcEdgeLoops() const @@ -174,7 +172,6 @@ template class PointField, class PointType > - const Foam::labelListList& Foam::PrimitivePatch:: edgeLoops() const diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchLocalPointOrder.C b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchLocalPointOrder.C index b4359d83..7a20d8a8 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchLocalPointOrder.C +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchLocalPointOrder.C @@ -39,14 +39,13 @@ template class PointField, class PointType > - void Foam::PrimitivePatch:: calcLocalPointOrder() const { // Note: Cannot use bandCompressing as point-point addressing does // not exist and is not considered generally useful. - // + // if (debug) { @@ -137,4 +136,5 @@ calcLocalPointOrder() const } } + // ************************************************************************* // diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchMeshData.C b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchMeshData.C index 30cffb63..cd05f3f0 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchMeshData.C +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchMeshData.C @@ -27,8 +27,6 @@ License #include "PrimitivePatch.H" #include "Map.H" - - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // template @@ -38,7 +36,6 @@ template class PointField, class PointType > - void Foam::PrimitivePatch:: calcMeshData() const @@ -76,13 +73,13 @@ calcMeshData() const ////- 1.5 code: //// if the point is used, set the mark to 1 - //forAll (*this, faceI) + //forAll(*this, facei) //{ - // const Face& curPoints = this->operator[](faceI); + // const Face& curPoints = this->operator[](facei); // - // forAll (curPoints, pointI) + // forAll(curPoints, pointi) // { - // markedPoints.insert(curPoints[pointI], -1); + // markedPoints.insert(curPoints[pointi], -1); // } //} // @@ -95,22 +92,22 @@ calcMeshData() const //sort(pointPatch); // //// For every point in map give it its label in mesh points - //forAll (pointPatch, pointI) + //forAll(pointPatch, pointi) //{ - // markedPoints.find(pointPatch[pointI])() = pointI; + // markedPoints.find(pointPatch[pointi])() = pointi; //} //- Unsorted version: DynamicList