From 8a5d108fd20300dadcd088644260828896d95ed7 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Thu, 30 Apr 2020 12:46:00 +0200 Subject: [PATCH] STYLE: update PrimitivePatch (#1648) - simplified templating, which cleans up code and does not appear to break any normal user coding. ENH: unique_ptr instead of homegrown demand-driven handling. --- .../test/primitivePatch/Test-PrimitivePatch.C | 2 +- .../extrudeMesh/extrudedMesh/extrudedMesh.H | 19 +- .../extrudedMesh/extrudedMeshTemplates.C | 27 +- .../backgroundMeshDecomposition.H | 2 +- .../automatic/automatic.C | 4 +- .../nonUniformField/nonUniformField.H | 6 +- .../primitiveMesh/PatchTools/PatchTools.H | 154 ++------ .../PatchTools/PatchToolsCheck.C | 20 +- .../PatchTools/PatchToolsEdgeOwner.C | 24 +- .../PatchTools/PatchToolsGatherAndMerge.C | 49 +-- .../PatchTools/PatchToolsMatch.C | 30 +- .../PatchTools/PatchToolsNormals.C | 29 +- .../PatchTools/PatchToolsSearch.C | 47 +-- .../PatchTools/PatchToolsSortEdges.C | 20 +- .../PatchTools/PatchToolsSortPoints.C | 12 +- .../PrimitivePatch/PrimitivePatch.C | 362 ++++++------------ .../PrimitivePatch/PrimitivePatch.H | 115 +++--- .../PrimitivePatch/PrimitivePatchAddressing.C | 51 +-- .../PrimitivePatch/PrimitivePatchBdryPoints.C | 24 +- .../PrimitivePatch/PrimitivePatchCheck.C | 68 +--- .../PrimitivePatch/PrimitivePatchClear.C | 105 ++--- .../PrimitivePatch/PrimitivePatchEdgeLoops.C | 40 +- .../PrimitivePatchLocalPointOrder.C | 24 +- .../PrimitivePatch/PrimitivePatchMeshData.C | 199 ++++------ .../PrimitivePatch/PrimitivePatchMeshEdges.C | 52 +-- .../PrimitivePatchPointAddressing.C | 53 +-- .../PrimitivePatchProjectPoints.C | 58 ++- .../primitivePatch/indirectPrimitivePatch.H | 2 +- .../primitivePatch/primitiveFacePatch.H | 2 +- .../primitivePatch/primitivePatch.H | 2 +- .../primitivePatch/uindirectPrimitivePatch.H | 2 +- src/dynamicMesh/boundaryMesh/bMesh.H | 3 +- .../pairPatchAgglomeration.H | 4 +- .../extendedEdgeMesh/extendedEdgeMesh.C | 2 +- .../extendedEdgeMesh/extendedEdgeMesh.H | 2 +- .../extendedFeatureEdgeMesh.C | 3 +- .../extendedFeatureEdgeMesh.H | 2 +- .../triSurfaceMesh/triSurfaceMesh.C | 2 +- .../triSurfaceSearch/triSurfaceRegionSearch.H | 11 +- src/surfMesh/MeshedSurface/MeshedSurface.H | 4 +- src/surfMesh/polySurface/polySurface.H | 4 +- src/surfMesh/surfMesh/surfMesh.H | 4 +- .../surfaceFormats/ac3d/AC3DsurfaceFormat.C | 22 +- src/surfMesh/triSurface/triSurface.H | 4 +- 44 files changed, 553 insertions(+), 1118 deletions(-) diff --git a/applications/test/primitivePatch/Test-PrimitivePatch.C b/applications/test/primitivePatch/Test-PrimitivePatch.C index 1f947f394c..a74deb4bdf 100644 --- a/applications/test/primitivePatch/Test-PrimitivePatch.C +++ b/applications/test/primitivePatch/Test-PrimitivePatch.C @@ -249,7 +249,7 @@ int main(int argc, char *argv[]) faceList patchFaces(patch); pointField allPoints(patch.points()); - PrimitivePatch storedPatch + PrimitivePatch, pointField> storedPatch ( patchFaces, allPoints, diff --git a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudedMesh/extrudedMesh.H b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudedMesh/extrudedMesh.H index 9899c700f2..ae9d8e0590 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudedMesh/extrudedMesh.H +++ b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudedMesh/extrudedMesh.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2015 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -53,7 +54,7 @@ class extrudedMesh : public polyMesh { - // Private data + // Private Data const extrudeModel& model_; @@ -64,26 +65,26 @@ class extrudedMesh static bool sameOrder(const face&, const edge&); //- Construct and return the extruded mesh points - template class FaceList, class PointField> + template pointField extrudedPoints ( - const PrimitivePatch& extrudePatch, + const PrimitivePatch& extrudePatch, const extrudeModel& ); //- Construct and return the extruded mesh faces - template class FaceList, class PointField> + template faceList extrudedFaces ( - const PrimitivePatch& extrudePatch, + const PrimitivePatch& extrudePatch, const extrudeModel& ); //- Construct and return the extruded mesh cells - template class FaceList, class PointField> + template cellList extrudedCells ( - const PrimitivePatch& extrudePatch, + const PrimitivePatch& extrudePatch, const extrudeModel& ); @@ -100,11 +101,11 @@ public: // Constructors //- Construct from the primitivePatch to extrude - template class FaceList, class PointField> + template extrudedMesh ( const IOobject&, - const PrimitivePatch& extrudePatch, + const PrimitivePatch& extrudePatch, const extrudeModel& ); }; diff --git a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudedMesh/extrudedMeshTemplates.C b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudedMesh/extrudedMeshTemplates.C index a2b2058061..0671cd12fc 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudedMesh/extrudedMeshTemplates.C +++ b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudedMesh/extrudedMeshTemplates.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2012 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -30,15 +31,10 @@ License // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -template -< - class Face, - template class FaceList, - class PointField -> +template Foam::pointField Foam::extrudedMesh::extrudedPoints ( - const PrimitivePatch& extrudePatch, + const PrimitivePatch& extrudePatch, const extrudeModel& model ) { @@ -68,10 +64,10 @@ Foam::pointField Foam::extrudedMesh::extrudedPoints } -template class FaceList, class PointField> +template Foam::faceList Foam::extrudedMesh::extrudedFaces ( - const PrimitivePatch& extrudePatch, + const PrimitivePatch& extrudePatch, const extrudeModel& model ) { @@ -194,10 +190,10 @@ Foam::faceList Foam::extrudedMesh::extrudedFaces } -template class FaceList, class PointField> +template Foam::cellList Foam::extrudedMesh::extrudedCells ( - const PrimitivePatch& extrudePatch, + const PrimitivePatch& extrudePatch, const extrudeModel& model ) { @@ -302,16 +298,11 @@ Foam::cellList Foam::extrudedMesh::extrudedCells // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -template -< - class Face, - template class FaceList, - class PointField -> +template Foam::extrudedMesh::extrudedMesh ( const IOobject& io, - const PrimitivePatch& extrudePatch, + const PrimitivePatch& extrudePatch, const extrudeModel& model ) : diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.H b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.H index e8603d1d45..c0dbded989 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.H +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.H @@ -81,7 +81,7 @@ SourceFiles namespace Foam { -typedef PrimitivePatch bPatch; +typedef PrimitivePatch<::Foam::List, const pointField> bPatch; typedef treeDataPrimitivePatch treeDataBPatch; class Time; diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/automatic/automatic.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/automatic/automatic.C index 778882f08c..3b50972776 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/automatic/automatic.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/automatic/automatic.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2012-2017 OpenFOAM Foundation - Copyright (C) 2016 OpenCFD Ltd. + Copyright (C) 2016-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -199,7 +199,7 @@ Foam::tmp Foam::automatic::load() PrimitivePatchInterpolation < - PrimitivePatch + PrimitivePatch<::Foam::List, pointField> > patchInterpolate(surface_); const Map