diff --git a/applications/test/primitivePatch/Test-PrimitivePatch.C b/applications/test/primitivePatch/Test-PrimitivePatch.C index 45b002592bd4e0bff98b7d209a08e4c26e70f388..1f947f394ca04add5701e6a9905aff7100a7963f 100644 --- a/applications/test/primitivePatch/Test-PrimitivePatch.C +++ b/applications/test/primitivePatch/Test-PrimitivePatch.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -28,10 +29,10 @@ Description \*---------------------------------------------------------------------------*/ -#include "PrimitivePatch.H" #include "argList.H" #include "Time.H" #include "polyMesh.H" +#include "primitiveFacePatch.H" #include "primitivePatch.H" #include "Fstream.H" @@ -39,15 +40,10 @@ using namespace Foam; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -typedef PrimitivePatch<face, List, const pointField&> myPrimitivePatch; - - -void writeObj(Ostream& os,const pointField& points) +void writeObj(Ostream& os, const pointField& points) { - forAll(points, pointi) + for (const point& pt : points) { - const point& pt = points[pointi]; - os << "v " << pt.x() << ' ' << pt.y() << ' ' << pt.z() << endl; } } @@ -227,7 +223,7 @@ int main(int argc, char *argv[]) // Test addressing { - myPrimitivePatch pp(patch, patch.points()); + primitiveFacePatch pp(patch, patch.points()); const pointField& localPoints = pp.localPoints(); const faceList& localFaces = pp.localFaces(); @@ -250,8 +246,8 @@ int main(int argc, char *argv[]) // Move construct { - faceList patchFaces = patch; - pointField allPoints = patch.points(); + faceList patchFaces(patch); + pointField allPoints(patch.points()); PrimitivePatch<face, List, pointField, point> storedPatch ( diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.H b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.H index c41b009b5978a41b8c6a68f4ed6fd79fe21622a6..e5322519b2d0876a6606c0bde00a8d0b7e051692 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.H +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2016-2018 OpenCFD Ltd. + Copyright (C) 2016-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -96,14 +96,26 @@ class PrimitivePatch public: - // Public typedefs + // Public Typedefs - typedef Face FaceType; + //- The face type + typedef Face face_type; + + //- The point type + typedef PointType point_type; + + //- The face list type typedef FaceList<Face> FaceListType; + + //- The point field type typedef PointField PointFieldType; + //- Deprecated(2020-03) prefer face_type typedef + // \deprecated(2020-03) prefer face_type typedef + typedef Face FaceType; + - // Public data types + // Public Data Types //- Enumeration defining the surface type. Used in check routines. enum surfaceTopo @@ -115,7 +127,7 @@ public: private: - // Private data + // Private Data //- Reference to global list of points PointField points_; diff --git a/src/surfMesh/MeshedSurface/MeshedSurface.C b/src/surfMesh/MeshedSurface/MeshedSurface.C index 48330fb0a1b198d8bc90c8e6faf479fd285d69e1..14bfd978a80f0f58fedf191b0599e6dcf71b25a6 100644 --- a/src/surfMesh/MeshedSurface/MeshedSurface.C +++ b/src/surfMesh/MeshedSurface/MeshedSurface.C @@ -166,7 +166,7 @@ void Foam::MeshedSurface<Face>::write template<class Face> Foam::MeshedSurface<Face>::MeshedSurface() : - ParentType(List<Face>(), pointField()), + MeshReference(List<Face>(), pointField()), zones_() {} @@ -177,7 +177,7 @@ Foam::MeshedSurface<Face>::MeshedSurface const MeshedSurface<Face>& surf ) : - ParentType(surf.surfFaces(), surf.points()), + MeshReference(surf.surfFaces(), surf.points()), zones_(surf.zones_) {} @@ -188,7 +188,7 @@ Foam::MeshedSurface<Face>::MeshedSurface const UnsortedMeshedSurface<Face>& surf ) : - ParentType(List<Face>(), surf.points()) // Copy points only + MeshReference(List<Face>(), surf.points()) // Copy points only { labelList faceMap; this->storedZones() = surf.sortedZones(faceMap); @@ -237,7 +237,7 @@ Foam::MeshedSurface<Face>::MeshedSurface const UList<surfZone>& zoneLst ) : - ParentType(faceLst, pointLst), // Copy construct + MeshReference(faceLst, pointLst), // Copy construct zones_(zoneLst) {} @@ -250,7 +250,7 @@ Foam::MeshedSurface<Face>::MeshedSurface const UList<surfZone>& zoneLst ) : - ParentType(faceLst, pointLst, true), // Move construct + MeshReference(faceLst, pointLst, true), // Move construct zones_(zoneLst) {} @@ -264,7 +264,7 @@ Foam::MeshedSurface<Face>::MeshedSurface const UList<word>& zoneNames ) : - ParentType(faceLst, pointLst), // Copy construct + MeshReference(faceLst, pointLst), // Copy construct zones_() { if (zoneSizes.size()) @@ -290,7 +290,7 @@ Foam::MeshedSurface<Face>::MeshedSurface const UList<word>& zoneNames ) : - ParentType(faceLst, pointLst, true), // Move construct + MeshReference(faceLst, pointLst, true), // Move construct zones_() { if (zoneSizes.size()) @@ -555,7 +555,7 @@ void Foam::MeshedSurface<Face>::remapFaces template<class Face> void Foam::MeshedSurface<Face>::clear() { - ParentType::clearOut(); // Topology changes + MeshReference::clearOut(); // Topology changes storedPoints().clear(); storedFaces().clear(); @@ -566,10 +566,10 @@ void Foam::MeshedSurface<Face>::clear() template<class Face> void Foam::MeshedSurface<Face>::movePoints(const pointField& newPoints) { - ParentType::clearGeom(); // Changes areas, normals etc. + MeshReference::clearGeom(); // Changes areas, normals etc. // Adapt for new point position - ParentType::movePoints(newPoints); + MeshReference::movePoints(newPoints); // Copy new points storedPoints() = newPoints; @@ -582,12 +582,12 @@ void Foam::MeshedSurface<Face>::scalePoints(const scalar scaleFactor) // Avoid bad scaling if (scaleFactor > 0 && scaleFactor != 1.0) { - ParentType::clearGeom(); // Changes areas, normals etc. + MeshReference::clearGeom(); // Changes areas, normals etc. pointField newPoints(scaleFactor*this->points()); // Adapt for new point position - ParentType::movePoints(newPoints); + MeshReference::movePoints(newPoints); storedPoints() = std::move(newPoints); } @@ -683,7 +683,7 @@ bool Foam::MeshedSurface<Face>::stitchFaces faceMap.clear(); // Topology can change when points are merged, etc - ParentType::clearOut(); + MeshReference::clearOut(); return true; } @@ -842,7 +842,7 @@ bool Foam::MeshedSurface<Face>::checkFaces faceMap.clear(); // Topology can change because of renumbering - ParentType::clearOut(); + MeshReference::clearOut(); return changed; } @@ -852,7 +852,7 @@ Foam::label Foam::MeshedSurface<Face>::nTriangles() const { if (faceTraits<Face>::isTri()) { - return ParentType::size(); + return MeshReference::size(); } return nTriangles @@ -1035,7 +1035,7 @@ Foam::label Foam::MeshedSurface<Face>::triangulate faceMap.clear(); // Topology can change because of renumbering - ParentType::clearOut(); + MeshReference::clearOut(); return nTri; } @@ -1206,7 +1206,7 @@ void Foam::MeshedSurface<Face>::swap return; // Self-swap is a no-op } - ParentType::clearOut(); // Topology changes + MeshReference::clearOut(); // Topology changes surf.clearOut(); // Topology changes this->storedPoints().swap(surf.storedPoints()); @@ -1222,7 +1222,7 @@ void Foam::MeshedSurface<Face>::transfer List<Face>& faceLst ) { - ParentType::clearOut(); // Topology changes + MeshReference::clearOut(); // Topology changes this->storedPoints().transfer(pointLst); this->storedFaces().transfer(faceLst); @@ -1241,7 +1241,7 @@ void Foam::MeshedSurface<Face>::transfer return; // Self-assigment is a no-op } - ParentType::clearOut(); // Topology changes + MeshReference::clearOut(); // Topology changes this->storedPoints().transfer(surf.storedPoints()); this->storedFaces().transfer(surf.storedFaces()); @@ -1302,7 +1302,7 @@ Foam::MeshedSurface<Face>::releaseGeom() template<class Face> void Foam::MeshedSurface<Face>::swapFaces(List<Face>& faces) { - ParentType::clearOut(); // Topology changes + MeshReference::clearOut(); // Topology changes this->storedFaces().swap(faces); } @@ -1311,7 +1311,7 @@ void Foam::MeshedSurface<Face>::swapFaces(List<Face>& faces) template<class Face> void Foam::MeshedSurface<Face>::swapPoints(pointField& points) { - ParentType::clearOut(); // Topology changes + MeshReference::clearOut(); // Topology changes this->storedPoints().swap(points); } diff --git a/src/surfMesh/MeshedSurface/MeshedSurface.H b/src/surfMesh/MeshedSurface/MeshedSurface.H index f6b606738318ad0c84fbe486a7e2ad8c0a591f65..e89015b56d05c6cca2754fdd70ca0fd646bd2fda 100644 --- a/src/surfMesh/MeshedSurface/MeshedSurface.H +++ b/src/surfMesh/MeshedSurface/MeshedSurface.H @@ -105,14 +105,9 @@ private: // Private Typedefs (convenience) - typedef PrimitivePatch - < - Face, - ::Foam::List, - pointField, - point - > - ParentType; + //- Internal mesh storage type + typedef PrimitivePatch<Face, ::Foam::List, pointField, point> + MeshReference; typedef UnsortedMeshedSurface<Face> FriendType; typedef MeshedSurfaceProxy<Face> ProxyType; @@ -160,7 +155,7 @@ protected: //- Non-const access to global points pointField& storedPoints() { - return const_cast<pointField&>(ParentType::points()); + return const_cast<pointField&>(MeshReference::points()); } //- Non-const access to the faces @@ -191,8 +186,11 @@ public: // Public Typedefs - //- Face type used - typedef Face FaceType; + //- The face type (same as the underlying PrimitivePatch) + typedef Face face_type; + + //- The point type (same as the underlying PrimitivePatch) + typedef point point_type; //- Declare type-name (with debug switch) @@ -382,7 +380,7 @@ public: //- The surface size is the number of faces label size() const { - return ParentType::size(); + return MeshReference::size(); } //- Return const access to the faces @@ -402,19 +400,19 @@ public: //- Face area vectors (normals) const vectorField& Sf() const { - return ParentType::faceAreas(); + return MeshReference::faceAreas(); } //- Face area magnitudes const scalarField& magSf() const { - return ParentType::magFaceAreas(); + return MeshReference::magFaceAreas(); } //- Face centres const vectorField& Cf() const { - return ParentType::faceCentres(); + return MeshReference::faceCentres(); } diff --git a/src/surfMesh/MeshedSurfaceProxy/MeshedSurfaceProxy.H b/src/surfMesh/MeshedSurfaceProxy/MeshedSurfaceProxy.H index 12e4891b180d2214ce6dc5e4f994904c0d0d78e3..66afff1cde18202e0b921b947b4399d7189a0cd2 100644 --- a/src/surfMesh/MeshedSurfaceProxy/MeshedSurfaceProxy.H +++ b/src/surfMesh/MeshedSurfaceProxy/MeshedSurfaceProxy.H @@ -77,8 +77,11 @@ public: // Public Typedefs - //- Face type used - typedef Face FaceType; + //- The face type + typedef Face face_type; + + //- The point type + typedef point point_type; //- Declare type-name (with debug switch) diff --git a/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.C b/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.C index c992875041b4ed82944465bb92edc730bdb888a8..0d43dfe8359e8f495b37d8b5c97dfa8e171cf8f3 100644 --- a/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.C +++ b/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.C @@ -60,7 +60,7 @@ bool Foam::UnsortedMeshedSurface<Face>::canReadType { return fileFormats::surfaceFormatsCore::checkSupport ( - readTypes() | ParentType::readTypes(), + readTypes() | MeshReference::readTypes(), ext, verbose, "reading" @@ -161,7 +161,7 @@ void Foam::UnsortedMeshedSurface<Face>::write template<class Face> Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface() : - ParentType() + MeshReference() {} @@ -171,7 +171,7 @@ Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface const UnsortedMeshedSurface<Face>& surf ) : - ParentType(surf.points(), surf.surfFaces()), // Copy construct (no zones) + MeshReference(surf.points(), surf.surfFaces()), // Copy construct (no zones) zoneIds_(surf.zoneIds()), zoneToc_(surf.zoneToc()) {} @@ -183,7 +183,7 @@ Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface const MeshedSurface<Face>& surf ) : - ParentType(surf.points(), surf.surfFaces()), // Copy construct (no zones) + MeshReference(surf.points(), surf.surfFaces()), // Copy construct (no zones) zoneIds_(), zoneToc_() { @@ -224,7 +224,7 @@ Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface UList<surfZoneIdentifier>& tocInfo ) : - ParentType(std::move(pointLst), std::move(faceLst)), + MeshReference(std::move(pointLst), std::move(faceLst)), zoneIds_(std::move(zoneIds)), zoneToc_(tocInfo) {} @@ -487,7 +487,7 @@ void Foam::UnsortedMeshedSurface<Face>::setSize(const label s) template<class Face> void Foam::UnsortedMeshedSurface<Face>::clear() { - ParentType::clear(); + MeshReference::clear(); zoneIds_.clear(); zoneToc_.clear(); } @@ -720,7 +720,7 @@ void Foam::UnsortedMeshedSurface<Face>::transfer ) { surfZoneList zoneInfo(surf.surfZones()); - ParentType::transfer(surf); + MeshReference::transfer(surf); setZones(zoneInfo); } diff --git a/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.H b/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.H index 5987db1472679f2bd40eebaa885b66a0e7788dd2..ba535a9effd7ab1875258a64b74f9a122bf138e0 100644 --- a/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.H +++ b/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.H @@ -96,7 +96,7 @@ private: // Private Typedefs (convenience) - typedef MeshedSurface<Face> ParentType; + typedef MeshedSurface<Face> MeshReference; typedef MeshedSurface<Face> FriendType; typedef MeshedSurfaceProxy<Face> ProxyType; @@ -161,8 +161,11 @@ public: // Public Typedefs - //- Face type used - typedef Face FaceType; + //- The face type (same as the underlying PrimitivePatch) + typedef Face face_type; + + //- The point type (same as the underlying PrimitivePatch) + typedef point point_type; //- Declare type-name, virtual type (with debug switch) @@ -315,7 +318,7 @@ public: //- The surface size is the number of faces label size() const { - return ParentType::size(); + return MeshReference::size(); } //- Reset size of face and zone list diff --git a/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurfaceNew.C b/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurfaceNew.C index baa516fe8654302c67ae1df493a5c99a601b5513..269e681b7912245fb42f87fe9b3a8a17e3514591 100644 --- a/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurfaceNew.C +++ b/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurfaceNew.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2017 OpenCFD Ltd. + Copyright (C) 2017-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -49,13 +49,13 @@ Foam::UnsortedMeshedSurface<Face>::New if (!cstrIter.found()) { // No direct reader, delegate to parent if possible - const wordHashSet& delegate = ParentType::readTypes(); + const wordHashSet& delegate = MeshReference::readTypes(); if (delegate.found(ext)) { // Create indirectly auto surf = autoPtr<UnsortedMeshedSurface<Face>>::New(); - surf().transfer(*(ParentType::New(name, ext))); + surf().transfer(*(MeshReference::New(name, ext))); return surf; } diff --git a/src/surfMesh/polySurface/polySurface.H b/src/surfMesh/polySurface/polySurface.H index 13541f6457fc2357004050fb0992e7f2b9038093..c0ffc66e1e699b89271e4cc0f22ab9fa265f4e5d 100644 --- a/src/surfMesh/polySurface/polySurface.H +++ b/src/surfMesh/polySurface/polySurface.H @@ -52,7 +52,7 @@ SourceFiles namespace Foam { -// Forward declarations +// Forward Declarations class dimensionSet; class surfZone; class polySurfaceGeoMesh; @@ -87,14 +87,9 @@ private: // Private Typedefs - typedef PrimitivePatch - < - face, - ::Foam::List, - pointField, - point - > - MeshReference; + //- Internal mesh storage type + typedef PrimitivePatch<face, ::Foam::List, pointField, point> + MeshReference; // Private Data diff --git a/src/surfMesh/surfaceFormats/stl/triSurfaceSTLformat.C b/src/surfMesh/surfaceFormats/stl/triSurfaceSTLformat.C index e9ae731a0857f9ae61157f2a79070e8653736a39..d69a7e4013884ba2b930b36240e670f282ece1dc 100644 --- a/src/surfMesh/surfaceFormats/stl/triSurfaceSTLformat.C +++ b/src/surfMesh/surfaceFormats/stl/triSurfaceSTLformat.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2017 OpenCFD Ltd. + Copyright (C) 2017-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -66,7 +66,7 @@ bool Foam::triSurface::readSTL(const fileName& filename, bool forceBinary) const labelList& zoneIds = reader.zoneIds(); pointField& pointLst = storedPoints(); - List<Face>& faceLst = storedFaces(); + List<face_type>& faceLst = storedFaces(); // Sizing pointLst.setSize(nUniquePoints); @@ -80,14 +80,14 @@ bool Foam::triSurface::readSTL(const fileName& filename, bool forceBinary) // Assign triangles label pointi = 0; - forAll(faceLst, i) + forAll(faceLst, facei) { - Face& f = faceLst[i]; + auto& f = faceLst[facei]; f[0] = pointMap[pointi++]; f[1] = pointMap[pointi++]; f[2] = pointMap[pointi++]; - f.region() = zoneIds[i]; + f.region() = zoneIds[facei]; } // Set patch name/index. diff --git a/src/surfMesh/triSurface/triSurface.C b/src/surfMesh/triSurface/triSurface.C index 850d444d0b12f81a677d444732b7e151522aa9e7..2f08b8155e3ec8891042da2d9f178239351b19c1 100644 --- a/src/surfMesh/triSurface/triSurface.C +++ b/src/surfMesh/triSurface/triSurface.C @@ -156,7 +156,7 @@ void Foam::triSurface::checkTriangles(const bool verbose) // Simple check on indices ok. const label maxPointi = points().size() - 1; - for (const triSurface::FaceType& f : *this) + for (const auto& f : *this) { for (const label verti : f) { @@ -403,7 +403,7 @@ void Foam::triSurface::setDefaultPatches() Foam::triSurface::triSurface() : - ParentType(List<Face>(), pointField()), + MeshReference(List<labelledTri>(), pointField()), patches_(), sortedEdgeFacesPtr_(nullptr), edgeOwnerPtr_(nullptr) @@ -412,7 +412,7 @@ Foam::triSurface::triSurface() Foam::triSurface::triSurface(const triSurface& surf) : - ParentType(surf, surf.points()), + MeshReference(surf, surf.points()), patches_(surf.patches()), sortedEdgeFacesPtr_(nullptr), edgeOwnerPtr_(nullptr) @@ -434,7 +434,7 @@ Foam::triSurface::triSurface const pointField& pts ) : - ParentType(triangles, pts), + MeshReference(triangles, pts), patches_(patches), sortedEdgeFacesPtr_(nullptr), edgeOwnerPtr_(nullptr) @@ -449,7 +449,7 @@ Foam::triSurface::triSurface const bool reuse ) : - ParentType(triangles, pts, reuse), + MeshReference(triangles, pts, reuse), patches_(patches), sortedEdgeFacesPtr_(nullptr), edgeOwnerPtr_(nullptr) @@ -462,7 +462,7 @@ Foam::triSurface::triSurface const pointField& pts ) : - ParentType(triangles, pts), + MeshReference(triangles, pts), patches_(), sortedEdgeFacesPtr_(nullptr), edgeOwnerPtr_(nullptr) @@ -477,7 +477,7 @@ Foam::triSurface::triSurface const pointField& pts ) : - ParentType(convertToTri(triangles, 0), pts), + MeshReference(convertToTri(triangles, 0), pts), patches_(), sortedEdgeFacesPtr_(nullptr), edgeOwnerPtr_(nullptr) @@ -523,7 +523,7 @@ Foam::triSurface::~triSurface() void Foam::triSurface::clearTopology() { - ParentType::clearTopology(); + MeshReference::clearTopology(); sortedEdgeFacesPtr_.reset(nullptr); edgeOwnerPtr_.reset(nullptr); } @@ -531,13 +531,13 @@ void Foam::triSurface::clearTopology() void Foam::triSurface::clearPatchMeshAddr() { - ParentType::clearPatchMeshAddr(); + MeshReference::clearPatchMeshAddr(); } void Foam::triSurface::clearOut() { - ParentType::clearOut(); + MeshReference::clearOut(); clearTopology(); clearPatchMeshAddr(); } @@ -553,7 +553,7 @@ void Foam::triSurface::swap(triSurface& surf) clearOut(); surf.clearOut(); - FaceListType::swap(static_cast<FaceListType&>(surf)); + storedFaces().swap(surf.storedFaces()); storedPoints().swap(surf.storedPoints()); patches_.swap(surf.patches()); } @@ -587,7 +587,7 @@ void Foam::triSurface::movePoints(const pointField& pts) sortedEdgeFacesPtr_.reset(nullptr); // Adapt for new point positions - ParentType::movePoints(pts); + MeshReference::movePoints(pts); // Copy new points storedPoints() = pts; @@ -600,7 +600,7 @@ void Foam::triSurface::swapPoints(pointField& pts) sortedEdgeFacesPtr_.reset(nullptr); // Adapt for new point positions - ParentType::movePoints(pts); + MeshReference::movePoints(pts); // Move/swap new points storedPoints().swap(pts); @@ -616,7 +616,7 @@ void Foam::triSurface::scalePoints(const scalar scaleFactor) clearTopology(); // Adapt for new point positions - ParentType::movePoints(pointField()); + MeshReference::movePoints(pointField()); storedPoints() *= scaleFactor; } @@ -895,7 +895,7 @@ void Foam::triSurface::transfer(triSurface& surf) { clearOut(); - FaceListType::transfer(surf.storedFaces()); + storedFaces().transfer(surf.storedFaces()); storedPoints().transfer(surf.storedPoints()); patches_.transfer(surf.patches()); @@ -933,7 +933,7 @@ void Foam::triSurface::operator=(const triSurface& surf) { clearOut(); - FaceListType::operator=(static_cast<const FaceListType&>(surf)); + storedFaces() = surf; storedPoints() = surf.points(); patches_ = surf.patches(); } diff --git a/src/surfMesh/triSurface/triSurface.H b/src/surfMesh/triSurface/triSurface.H index 263d8e733f4c87a99247f8771dc3db416bd68d81..4986f3415c913b23fe88cde11d7125b735b6a4d9 100644 --- a/src/surfMesh/triSurface/triSurface.H +++ b/src/surfMesh/triSurface/triSurface.H @@ -78,21 +78,14 @@ class triSurface : public PrimitivePatch<labelledTri, ::Foam::List, pointField, point> { - // Private typedefs + // Private Typedefs - //- Typedefs for convenience - typedef labelledTri Face; - typedef PrimitivePatch - < - labelledTri, - ::Foam::List, - pointField, - point - > - ParentType; + //- Internal mesh storage type + typedef PrimitivePatch<labelledTri, ::Foam::List, pointField, point> + MeshReference; - // Private data + // Private Data //- Patch information // (face ordering nFaces/startFace only used during reading, writing) @@ -103,7 +96,7 @@ class triSurface static wordHashSet writeTypes_; - // Demand driven private data. + // Demand driven //- Edge-face addressing (sorted) mutable unique_ptr<labelListList> sortedEdgeFacesPtr_; @@ -214,13 +207,13 @@ protected: //- Non-const access to global points pointField& storedPoints() { - return const_cast<pointField&>(ParentType::points()); + return const_cast<pointField&>(MeshReference::points()); } //- Non-const access to the faces - List<Face>& storedFaces() + List<labelledTri>& storedFaces() { - return static_cast<List<Face>&>(*this); + return static_cast<List<labelledTri>&>(*this); } @@ -231,8 +224,15 @@ public: //- Placeholder only, but do not remove - it is needed for GeoMesh typedef bool BoundaryMesh; - //- Runtime type information - ClassName("triSurface"); + //- The face type (same as the underlying PrimitivePatch) + typedef labelledTri face_type; + + //- The point type (same as the underlying PrimitivePatch) + typedef point point_type; + + + //- Runtime type information + ClassName("triSurface"); // Static @@ -430,19 +430,19 @@ public: //- Face area vectors (normals) inline const vectorField& Sf() const { - return ParentType::faceAreas(); + return MeshReference::faceAreas(); } //- Face area magnitudes inline const scalarField& magSf() const { - return ParentType::magFaceAreas(); + return MeshReference::magFaceAreas(); } //- Face centres inline const vectorField& Cf() const { - return ParentType::faceCentres(); + return MeshReference::faceCentres(); } diff --git a/src/surfMesh/triSurface/triSurfaceAddressing.C b/src/surfMesh/triSurface/triSurfaceAddressing.C index d8767b49c5ce61eff3f420ee28886e4bc9614aed..427478b0e40651201e3ccc1ae2e8026087b7fd56 100644 --- a/src/surfMesh/triSurface/triSurfaceAddressing.C +++ b/src/surfMesh/triSurface/triSurfaceAddressing.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2015 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -30,8 +31,6 @@ Description \*---------------------------------------------------------------------------*/ #include "triSurface.H" -#include "HashTable.H" -#include "transform.H" #include "PatchTools.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/surfMesh/triSurface/triSurfaceIO.C b/src/surfMesh/triSurface/triSurfaceIO.C index 6fe241b1a113af91fd785cee8944266b57ec791d..cf9fb4c57917ebf7368532030a134e537fd358ff 100644 --- a/src/surfMesh/triSurface/triSurfaceIO.C +++ b/src/surfMesh/triSurface/triSurfaceIO.C @@ -408,7 +408,7 @@ void Foam::triSurface::writeStats(Ostream& os) const boundBox bb(boundBox::invertedBox); labelHashSet regionsUsed; - for (const triSurface::FaceType& f : *this) + for (const auto& f : *this) { regionsUsed.insert(f.region());