From d56220c34aec927ff4d21c527d4d2efe3a324169 Mon Sep 17 00:00:00 2001 From: Mark Olesen <Mark.Olesen@Germany> Date: Sun, 16 Nov 2008 00:00:34 +0100 Subject: [PATCH] PrimitivePatchExtra - adjusted template args to match PrimitivePatch --- .../PrimitivePatchExtra/PrimitivePatchExtra.C | 42 ++++++++--------- .../PrimitivePatchExtra/PrimitivePatchExtra.H | 22 ++++----- .../PrimitivePatchExtraAddressing.C | 24 +++++----- .../PrimitivePatchExtraCleanup.C | 20 ++++---- .../PrimitivePatchExtraSearch.C | 47 ++++++++++--------- 5 files changed, 78 insertions(+), 77 deletions(-) diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatchExtra/PrimitivePatchExtra.C b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatchExtra/PrimitivePatchExtra.C index 7ab4c43084c..423be1f4853 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatchExtra/PrimitivePatchExtra.C +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatchExtra/PrimitivePatchExtra.C @@ -38,18 +38,18 @@ License template < class Face, - template<class> class ListType, + template<class> class FaceList, class PointField, class PointType > -Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>:: +Foam::PrimitivePatchExtra<Face, FaceList, PointField, PointType>:: PrimitivePatchExtra ( - const ListType<Face>& faces, - const pointField& points + const FaceList<Face>& faces, + const Field<PointType>& points ) : - PrimitivePatch<Face, ListType, PointField, PointType>(faces, points), + PrimitivePatch<Face, FaceList, PointField, PointType>(faces, points), sortedEdgeFacesPtr_(NULL), edgeOwnerPtr_(NULL) {} @@ -59,17 +59,17 @@ PrimitivePatchExtra template < class Face, - template<class> class ListType, + template<class> class FaceList, class PointField, class PointType > -Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>:: +Foam::PrimitivePatchExtra<Face, FaceList, PointField, PointType>:: PrimitivePatchExtra ( - const PrimitivePatchExtra<Face, ListType, PointField, PointType>& pp + const PrimitivePatchExtra<Face, FaceList, PointField, PointType>& pp ) : - PrimitivePatch<Face, ListType, PointField, PointType>(pp), + PrimitivePatch<Face, FaceList, PointField, PointType>(pp), sortedEdgeFacesPtr_(NULL), edgeOwnerPtr_(NULL) {} @@ -80,11 +80,11 @@ PrimitivePatchExtra template < class Face, - template<class> class ListType, + template<class> class FaceList, class PointField, class PointType > -Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>:: +Foam::PrimitivePatchExtra<Face, FaceList, PointField, PointType>:: ~PrimitivePatchExtra() { clearOut(); @@ -95,14 +95,14 @@ Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>:: template < class Face, - template<class> class ListType, + template<class> class FaceList, class PointField, class PointType > -void Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>:: +void Foam::PrimitivePatchExtra<Face, FaceList, PointField, PointType>:: clearOut() { - PrimitivePatch<Face, ListType, PointField, PointType>::clearOut(); + PrimitivePatch<Face, FaceList, PointField, PointType>::clearOut(); clearTopology(); } @@ -110,14 +110,14 @@ clearOut() template < class Face, - template<class> class ListType, + template<class> class FaceList, class PointField, class PointType > -void Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>:: +void Foam::PrimitivePatchExtra<Face, FaceList, PointField, PointType>:: clearTopology() { - PrimitivePatch<Face, ListType, PointField, PointType>::clearTopology(); + PrimitivePatch<Face, FaceList, PointField, PointType>::clearTopology(); deleteDemandDrivenData(sortedEdgeFacesPtr_); deleteDemandDrivenData(edgeOwnerPtr_); } @@ -126,12 +126,12 @@ clearTopology() template < class Face, - template<class> class ListType, + template<class> class FaceList, class PointField, class PointType > const Foam::labelListList& -Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>:: +Foam::PrimitivePatchExtra<Face, FaceList, PointField, PointType>:: sortedEdgeFaces() const { if (!sortedEdgeFacesPtr_) @@ -146,12 +146,12 @@ sortedEdgeFaces() const template < class Face, - template<class> class ListType, + template<class> class FaceList, class PointField, class PointType > const Foam::labelList& -Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>:: +Foam::PrimitivePatchExtra<Face, FaceList, PointField, PointType>:: edgeOwner() const { if (!edgeOwnerPtr_) diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatchExtra/PrimitivePatchExtra.H b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatchExtra/PrimitivePatchExtra.H index 6c3f381ff9b..90dd6ef881a 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatchExtra/PrimitivePatchExtra.H +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatchExtra/PrimitivePatchExtra.H @@ -50,13 +50,13 @@ namespace Foam template < class Face, - template<class> class ListType, + template<class> class FaceList, class PointField, class PointType=point > class PrimitivePatchExtra : - public PrimitivePatch<Face, ListType, PointField, PointType> + public PrimitivePatch<Face, FaceList, PointField, PointType> { public: @@ -64,13 +64,13 @@ public: // Public typedefs typedef Face FaceType; - typedef ListType<Face> FaceListType; + typedef FaceList<Face> FaceListType; typedef PointField PointFieldType; private: // Private typedefs - typedef PrimitivePatch<Face, ListType, PointField, PointType> TemplateType; + typedef PrimitivePatch<Face, FaceList, PointField, PointType> TemplateType; // Private data @@ -99,14 +99,14 @@ public: //- Construct from components PrimitivePatchExtra ( - const ListType<Face>& faces, - const pointField& points + const FaceList<Face>& faces, + const Field<PointType>& points ); //- Construct as copy PrimitivePatchExtra ( - const PrimitivePatchExtra<Face, ListType, PointField, PointType>& + const PrimitivePatchExtra<Face, FaceList, PointField, PointType>& ); @@ -161,7 +161,7 @@ public: // Note: faceZone has to be sized nFaces before calling. void markZone ( - const boolList& borderEdge, + const UList<bool>& borderEdge, const label faceI, const label currentZone, labelList& faceZone @@ -172,17 +172,17 @@ public: // (bool for every edge in surface). Returns number of zones. label markZones ( - const boolList& borderEdge, + const UList<bool>& borderEdge, labelList& faceZone ) const; //- Determine the mapping for a sub-mesh. - // Only include faces for which boolList entry is true + // Only include faces for which bool List entry is true // @param[out] pointMap mapping new to old localPoints // @param[out] faceMap mapping new to old faces void subsetMap ( - const boolList& include, + const UList<bool>& include, labelList& pointMap, labelList& faceMap ) const; diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatchExtra/PrimitivePatchExtraAddressing.C b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatchExtra/PrimitivePatchExtraAddressing.C index 1773014a4d5..25b1df9002e 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatchExtra/PrimitivePatchExtraAddressing.C +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatchExtra/PrimitivePatchExtraAddressing.C @@ -40,16 +40,16 @@ Description template < class Face, - template<class> class ListType, + template<class> class FaceList, class PointField, class PointType > -void Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>:: +void Foam::PrimitivePatchExtra<Face, FaceList, PointField, PointType>:: calcSortedEdgeFaces() const { if (sortedEdgeFacesPtr_) { - FatalErrorIn("PrimitivePatchExtra<Face, ListType, PointField>::calcSortedEdgeFaces()") + FatalErrorIn("PrimitivePatchExtra<Face, FaceList, PointField>::calcSortedEdgeFaces()") << "sortedEdgeFacesPtr_ already set" << abort(FatalError); } @@ -57,7 +57,7 @@ calcSortedEdgeFaces() const const labelListList& eFaces = TemplateType::edgeFaces(); const edgeList& edgeLst = TemplateType::edges(); const pointField& locPointLst = TemplateType::localPoints(); - const List<FaceType>& locFaceLst = TemplateType::localFaces(); + const List<Face>& locFaceLst = TemplateType::localFaces(); // create the lists for the various results. (resized on completion) sortedEdgeFacesPtr_ = new labelListList(eFaces.size()); @@ -101,7 +101,7 @@ calcSortedEdgeFaces() const for (label nbI = 1; nbI < myFaceNbs.size(); nbI++) { // Get opposite vertex - const FaceType& f = locFaceLst[myFaceNbs[nbI]]; + const Face& f = locFaceLst[myFaceNbs[nbI]]; label fp0 = findIndex(f, e[0]); label fp1 = f.fcIndex(fp0); label vertI = (f[fp1] != e[1] ? f[fp1] : f.fcIndex(fp1)); @@ -137,16 +137,16 @@ calcSortedEdgeFaces() const template < class Face, - template<class> class ListType, + template<class> class FaceList, class PointField, class PointType > -void Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>:: +void Foam::PrimitivePatchExtra<Face, FaceList, PointField, PointType>:: calcEdgeOwner() const { if (edgeOwnerPtr_) { - FatalErrorIn("PrimitivePatchExtra<Face, ListType, PointField>::calcEdgeOwner()") + FatalErrorIn("PrimitivePatchExtra<Face, FaceList, PointField>::calcEdgeOwner()") << "edgeOwnerPtr_ already set" << abort(FatalError); } @@ -160,7 +160,7 @@ calcEdgeOwner() const const edgeList& edgeLst = TemplateType::edges(); const labelListList& eFaces = TemplateType::edgeFaces(); - const List<FaceType>& locFaceLst = TemplateType::localFaces(); + const List<Face>& locFaceLst = TemplateType::localFaces(); forAll(edgeLst, edgeI) @@ -181,7 +181,7 @@ calcEdgeOwner() const forAll(myFaces, i) { - const FaceType& f = locFaceLst[myFaces[i]]; + const Face& f = locFaceLst[myFaces[i]]; if (f.findEdge(e) > 0) { @@ -192,11 +192,11 @@ calcEdgeOwner() const if (edgeOwner[edgeI] == -1) { - FatalErrorIn("PrimitivePatchExtra<Face, ListType, PointField>::calcEdgeOwner()") + FatalErrorIn("PrimitivePatchExtra<Face, FaceList, PointField>::calcEdgeOwner()") << "Edge " << edgeI << " vertices:" << e << " is used by faces " << myFaces << " vertices:" - << IndirectList<FaceType>(locFaceLst, myFaces)() + << IndirectList<Face>(locFaceLst, myFaces)() << " none of which use the edge vertices in the same order" << nl << "I give up" << abort(FatalError); } diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatchExtra/PrimitivePatchExtraCleanup.C b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatchExtra/PrimitivePatchExtraCleanup.C index 7a5343a7acc..7ee54ce3dc6 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatchExtra/PrimitivePatchExtraCleanup.C +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatchExtra/PrimitivePatchExtraCleanup.C @@ -34,11 +34,11 @@ License template < class Face, - template<class> class ListType, + template<class> class FaceList, class PointField, class PointType > -void Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>:: +void Foam::PrimitivePatchExtra<Face, FaceList, PointField, PointType>:: checkEdges ( const bool verbose @@ -77,18 +77,18 @@ checkEdges template < class Face, - template<class> class ListType, + template<class> class FaceList, class PointField, class PointType > Foam::boolList -Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>:: +Foam::PrimitivePatchExtra<Face, FaceList, PointField, PointType>:: checkOrientation ( const bool verbose ) const { - const ListType<FaceType>& faceLst = *this; + const FaceList<Face>& faceLst = *this; const edgeList& edgeLst = TemplateType::edges(); const labelListList& faceEs = TemplateType::faceEdges(); const label numEdges = TemplateType::nEdges(); @@ -133,7 +133,7 @@ checkOrientation // //- Compute normal from 3 points, use the first as the origin // minor warpage should not be a problem - const FaceType& f = faceLst[faceI]; + const Face& f = faceLst[faceI]; const point p0(pointLst[f[0]]); const point p1(pointLst[f[1]]); const point p2(pointLst[f[f.size()-1]]); @@ -156,8 +156,8 @@ checkOrientation const labelListList& eFaces = TemplateType::edgeFaces(); const pointField& locPointsLst = TemplateType::localPoints(); - // Storage for holding status of edge. True if normal flips across this - // edge + // Storage for holding status of edge. + // True if normal flips across this edge boolList borderEdge(numEdges, false); forAll(edgeLst, edgeI) @@ -167,8 +167,8 @@ checkOrientation if (neighbours.size() == 2) { - const FaceType& faceA = faceLst[neighbours[0]]; - const FaceType& faceB = faceLst[neighbours[1]]; + const Face& faceA = faceLst[neighbours[0]]; + const Face& faceB = faceLst[neighbours[1]]; // The edge cannot be going in the same direction if both faces // are oriented counterclockwise. diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatchExtra/PrimitivePatchExtraSearch.C b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatchExtra/PrimitivePatchExtraSearch.C index 5dc939806cc..3fbb3b54618 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatchExtra/PrimitivePatchExtraSearch.C +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatchExtra/PrimitivePatchExtraSearch.C @@ -33,13 +33,13 @@ License template < class Face, - template<class> class ListType, + template<class> class FaceList, class PointField, class PointType > -void Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>::markZone +void Foam::PrimitivePatchExtra<Face, FaceList, PointField, PointType>::markZone ( - const boolList& borderEdge, + const UList<bool>& borderEdge, const label faceI, const label currentZone, labelList& faceZone @@ -62,9 +62,9 @@ void Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>::markZone const labelList& fEdges = faceEs[faceI]; - forAll(fEdges, i) + forAll(fEdges, fEdgeI) { - label edgeI = fEdges[i]; + label edgeI = fEdges[fEdgeI]; if (!borderEdge[edgeI]) { @@ -83,7 +83,7 @@ void Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>::markZone { FatalErrorIn ( - "PrimitivePatchExtra<Face, ListType, PointField>::markZone" + "PrimitivePatchExtra<Face, FaceList, PointField>::markZone" "(const boolList&, const label, const label, labelList&) const" ) << "Zones " << faceZone[nbrFaceI] @@ -113,28 +113,25 @@ void Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>::markZone template < class Face, - template<class> class ListType, + template<class> class FaceList, class PointField, class PointType > -Foam::label Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>:: +Foam::label Foam::PrimitivePatchExtra<Face, FaceList, PointField, PointType>:: markZones ( - const boolList& borderEdge, + const UList<bool>& borderEdge, labelList& faceZone ) const { const label numEdges = TemplateType::nEdges(); const label numFaces = TemplateType::size(); - faceZone.setSize(numFaces); - faceZone = -1; - if (borderEdge.size() != numEdges) { FatalErrorIn ( - "PrimitivePatchExtra<Face, ListType, PointField>::markZones" + "PrimitivePatchExtra<Face, FaceList, PointField>::markZones" "(const boolList&, labelList&)" ) << "borderEdge boolList not same size as number of edges" << endl @@ -143,28 +140,32 @@ markZones << exit(FatalError); } + faceZone.setSize(numFaces); + faceZone = -1; + label zoneI = 0; label startFaceI = 0; - for (;;zoneI++) + while (true) { - // Find first non-coloured face + // Find first non-visited face for (; startFaceI < numFaces; startFaceI++) { if (faceZone[startFaceI] == -1) { + faceZone[startFaceI] = zoneI; + markZone(borderEdge, startFaceI, zoneI, faceZone); break; } } if (startFaceI >= numFaces) { + // Finished break; } - faceZone[startFaceI] = zoneI; - - markZone(borderEdge, startFaceI, zoneI, faceZone); + zoneI++; } return zoneI; @@ -177,19 +178,19 @@ markZones template < class Face, - template<class> class ListType, + template<class> class FaceList, class PointField, class PointType > -void Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>:: +void Foam::PrimitivePatchExtra<Face, FaceList, PointField, PointType>:: subsetMap ( - const boolList& include, + const UList<bool>& include, labelList& pointMap, labelList& faceMap ) const { - const List<FaceType>& locFaces = TemplateType::localFaces(); + const List<Face>& locFaces = TemplateType::localFaces(); const label numPoints = TemplateType::nPoints(); label faceI = 0; @@ -208,7 +209,7 @@ subsetMap faceMap[faceI++] = oldFaceI; // Renumber labels for face - const FaceType& f = locFaces[oldFaceI]; + const Face& f = locFaces[oldFaceI]; forAll(f, fp) { -- GitLab