diff --git a/applications/test/primitivePatch/Test-PrimitivePatch.C b/applications/test/primitivePatch/Test-PrimitivePatch.C index 1f947f394ca04add5701e6a9905aff7100a7963f..a74deb4bdf43944d86ee523839ef3424e430b14a 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<face, List, pointField, point> storedPatch + PrimitivePatch<List<face>, 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 9899c700f2cee64102030544facbe697a4e71cc4..ae9d8e0590c67170ff05e54e9d02d3971191b18d 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 Face, template<class> class FaceList, class PointField> + template<class FaceList, class PointField> pointField extrudedPoints ( - const PrimitivePatch<Face, FaceList, PointField>& extrudePatch, + const PrimitivePatch<FaceList, PointField>& extrudePatch, const extrudeModel& ); //- Construct and return the extruded mesh faces - template<class Face, template<class> class FaceList, class PointField> + template<class FaceList, class PointField> faceList extrudedFaces ( - const PrimitivePatch<Face, FaceList, PointField>& extrudePatch, + const PrimitivePatch<FaceList, PointField>& extrudePatch, const extrudeModel& ); //- Construct and return the extruded mesh cells - template<class Face, template<class> class FaceList, class PointField> + template<class FaceList, class PointField> cellList extrudedCells ( - const PrimitivePatch<Face, FaceList, PointField>& extrudePatch, + const PrimitivePatch<FaceList, PointField>& extrudePatch, const extrudeModel& ); @@ -100,11 +101,11 @@ public: // Constructors //- Construct from the primitivePatch to extrude - template<class Face, template<class> class FaceList, class PointField> + template<class FaceList, class PointField> extrudedMesh ( const IOobject&, - const PrimitivePatch<Face, FaceList, PointField>& extrudePatch, + const PrimitivePatch<FaceList, PointField>& 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 a2b2058061e812c6549427a74570c2f1571daf19..0671cd12fc5a33fb44ba3fff35ecbc7b3b79f1fd 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> class FaceList, - class PointField -> +template<class FaceList, class PointField> Foam::pointField Foam::extrudedMesh::extrudedPoints ( - const PrimitivePatch<Face, FaceList, PointField>& extrudePatch, + const PrimitivePatch<FaceList, PointField>& extrudePatch, const extrudeModel& model ) { @@ -68,10 +64,10 @@ Foam::pointField Foam::extrudedMesh::extrudedPoints } -template<class Face, template<class> class FaceList, class PointField> +template<class FaceList, class PointField> Foam::faceList Foam::extrudedMesh::extrudedFaces ( - const PrimitivePatch<Face, FaceList, PointField>& extrudePatch, + const PrimitivePatch<FaceList, PointField>& extrudePatch, const extrudeModel& model ) { @@ -194,10 +190,10 @@ Foam::faceList Foam::extrudedMesh::extrudedFaces } -template<class Face, template<class> class FaceList, class PointField> +template<class FaceList, class PointField> Foam::cellList Foam::extrudedMesh::extrudedCells ( - const PrimitivePatch<Face, FaceList, PointField>& extrudePatch, + const PrimitivePatch<FaceList, PointField>& extrudePatch, const extrudeModel& model ) { @@ -302,16 +298,11 @@ Foam::cellList Foam::extrudedMesh::extrudedCells // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -template -< - class Face, - template<class> class FaceList, - class PointField -> +template<class FaceList, class PointField> Foam::extrudedMesh::extrudedMesh ( const IOobject& io, - const PrimitivePatch<Face, FaceList, PointField>& extrudePatch, + const PrimitivePatch<FaceList, PointField>& 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 e8603d1d453ffca9c95d3675699bcc941837a58a..c0dbded9895792de7a77124398f6dd48888d170d 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<face, List, const pointField, point> bPatch; +typedef PrimitivePatch<::Foam::List<face>, const pointField> bPatch; typedef treeDataPrimitivePatch<bPatch> 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 778882f08cced477eb45856232ea63f52f947c52..3b509727761761e2c3b5141d266f85f5fd22ffbc 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::triSurfacePointScalarField> Foam::automatic::load() PrimitivePatchInterpolation < - PrimitivePatch<labelledTri, ::Foam::List, pointField, point> + PrimitivePatch<::Foam::List<labelledTri>, pointField> > patchInterpolate(surface_); const Map<label>& meshPointMap = surface_.meshPointMap(); diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/nonUniformField/nonUniformField.H b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/nonUniformField/nonUniformField.H index e7508172ee01cf64ad0d43cd7eb5d9a992ac9e7e..13436971f64415e72cc94906c92de86910ec7fee 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/nonUniformField/nonUniformField.H +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/nonUniformField/nonUniformField.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2012-2015 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -61,11 +61,11 @@ class nonUniformField protected: - // Private typedef + // Typedefs typedef PrimitivePatchInterpolation < - PrimitivePatch<labelledTri, List, pointField, point> + PrimitivePatch<::Foam::List<labelledTri>, pointField> > primitivePatchInterpolation; diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.C index e9a424b0a2618a2c38943346088faaaa5ed40ef6..3e915b3e7e6938eb96cbbd47ae49c16b44365b25 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2018 OpenCFD Ltd. + Copyright (C) 2018-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -35,6 +35,7 @@ License #include "entry.H" #include "dictionary.H" #include "pointPatchField.H" +#include "demandDrivenData.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchTools.H b/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchTools.H index eb2670c12eb4c53d8db0981c0829c6acd5624253..3579c952ae3a3831a23e88469d5fc89e3abb7c10 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchTools.H +++ b/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchTools.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -57,7 +58,7 @@ SourceFiles namespace Foam { -// Forward declarations +// Forward Declarations class polyMesh; class bitSet; class boundBox; @@ -73,16 +74,10 @@ public: //- Check for orientation issues. // Returns true if problems were found. // If a normal flips across an edge, places it in the HashSet - template - < - class Face, - template<class> class FaceList, - class PointField, - class PointType - > + template<class FaceList, class PointField> static bool checkOrientation ( - const PrimitivePatch<Face, FaceList, PointField, PointType>&, + const PrimitivePatch<FaceList, PointField>&, const bool report = false, labelHashSet* marked = 0 ); @@ -91,17 +86,10 @@ public: //- Fill faceZone with currentZone for every face reachable // from facei without crossing edge marked in borderEdge. // Note: faceZone has to be sized nFaces before calling. - template - < - class BoolListType, - class Face, - template<class> class FaceList, - class PointField, - class PointType - > + template<class BoolListType, class FaceList, class PointField> static void markZone ( - const PrimitivePatch<Face, FaceList, PointField, PointType>&, + const PrimitivePatch<FaceList, PointField>&, const BoolListType& borderEdge, const label facei, const label currentZone, @@ -111,17 +99,10 @@ public: //- Size and fills faceZone with zone of face. // Zone is area reachable by edge crossing without crossing borderEdge. // Returns number of zones. - template - < - class BoolListType, - class Face, - template<class> class FaceList, - class PointField, - class PointType - > + template<class BoolListType, class FaceList, class PointField> static label markZones ( - const PrimitivePatch<Face, FaceList, PointField, PointType>&, + const PrimitivePatch<FaceList, PointField>&, const BoolListType& borderEdge, labelList& faceZone ); @@ -132,78 +113,47 @@ public: // \param[in] includeFaces faces to include // \param[out] pointMap mapping new to old localPoints // \param[out] faceMap mapping new to old faces - template - < - class BoolListType, - class Face, - template<class> class FaceList, - class PointField, - class PointType - > + template<class BoolListType, class FaceList, class PointField> static void subsetMap ( - const PrimitivePatch<Face, FaceList, PointField, PointType>& p, + const PrimitivePatch<FaceList, PointField>& p, const BoolListType& includeFaces, labelList& pointMap, labelList& faceMap ); //- - template - < - class Face, - template<class> class FaceList, - class PointField, - class PointType - > + template<class FaceList, class PointField> static void calcBounds ( - const PrimitivePatch<Face, FaceList, PointField, PointType>& p, + const PrimitivePatch<FaceList, PointField>& p, boundBox& bb, label& nPoints ); //- Return edge-face addressing sorted by angle around the edge. // Orientation is anticlockwise looking from edge.vec(localPoints()) - template - < - class Face, - template<class> class FaceList, - class PointField, - class PointType - > + template<class FaceList, class PointField> static labelListList sortedEdgeFaces ( - const PrimitivePatch<Face, FaceList, PointField, PointType>& + const PrimitivePatch<FaceList, PointField>& ); //- Return point-edge addressing sorted by order around the point. - template - < - class Face, - template<class> class FaceList, - class PointField, - class PointType - > + template<class FaceList, class PointField> static labelListList sortedPointEdges ( - const PrimitivePatch<Face, FaceList, PointField, PointType>& + const PrimitivePatch<FaceList, PointField>& ); //- If 2 face neighbours: label of face where ordering of edge // is consistent with righthand walk. // If 1 neighbour: label of only face. // If >2 neighbours: undetermined. - template - < - class Face, - template<class> class FaceList, - class PointField, - class PointType - > + template<class FaceList, class PointField> static labelList edgeOwner ( - const PrimitivePatch<Face, FaceList, PointField, PointType>& + const PrimitivePatch<FaceList, PointField>& ); @@ -212,19 +162,13 @@ public: // p2PointLabels : corresponding points on p2 template < - class Face1, - template<class> class FaceList1, - class PointField1, - class PointType1, - class Face2, - template<class> class FaceList2, - class PointField2, - class PointType2 + class FaceList1, class PointField1, + class FaceList2, class PointField2 > static void matchPoints ( - const PrimitivePatch<Face1, FaceList1, PointField1, PointType1>& p1, - const PrimitivePatch<Face2, FaceList2, PointField2, PointType2>& p2, + const PrimitivePatch<FaceList1, PointField1>& p1, + const PrimitivePatch<FaceList2, PointField2>& p2, labelList& p1PointLabels, labelList& p2PointLabels @@ -236,19 +180,13 @@ public: // sameOrientation : same orientation? template < - class Face1, - template<class> class FaceList1, - class PointField1, - class PointType1, - class Face2, - template<class> class FaceList2, - class PointField2, - class PointType2 + class FaceList1, class PointField1, + class FaceList2, class PointField2 > static void matchEdges ( - const PrimitivePatch<Face1, FaceList1, PointField1, PointType1>& p1, - const PrimitivePatch<Face2, FaceList2, PointField2, PointType2>& p2, + const PrimitivePatch<FaceList1, PointField1>& p1, + const PrimitivePatch<FaceList2, PointField2>& p2, labelList& p1EdgeLabels, labelList& p2EdgeLabels, @@ -257,33 +195,21 @@ public: //- Return parallel consistent point normals for patches using mesh points. - template - < - class Face, - template<class> class FaceList, - class PointField, - class PointType - > + template<class FaceList, class PointField> static tmp<pointField> pointNormals ( const polyMesh&, - const PrimitivePatch<Face, FaceList, PointField, PointType>& + const PrimitivePatch<FaceList, PointField>& ); //- Return parallel consistent edge normals for patches using mesh points. // Supply with patch matching info from matchEdges. - template - < - class Face, - template<class> class FaceList, - class PointField, - class PointType - > + template<class FaceList, class PointField> static tmp<pointField> edgeNormals ( const polyMesh&, - const PrimitivePatch<Face, FaceList, PointField, PointType>&, + const PrimitivePatch<FaceList, PointField>&, const labelList& patchEdges, const labelList& coupledEdges ); @@ -291,19 +217,19 @@ public: //- Gather points and faces onto master and merge into single patch. // Note: uses faces/points, not localFaces/localPoints. - template - < - class Face, - template<class> class FaceList, - class PointField, - class PointType - > + template<class FaceList, class PointField> static void gatherAndMerge ( const scalar mergeDist, - const PrimitivePatch<Face, FaceList, PointField, PointType>& p, - Field<PointType>& mergedPoints, - List<Face>& mergedFaces, + const PrimitivePatch<FaceList, PointField>& p, + Field + < + typename PrimitivePatch<FaceList, PointField>::point_type + >& mergedPoints, + List + < + typename PrimitivePatch<FaceList, PointField>::face_type + >& mergedFaces, labelList& pointMergeMap ); diff --git a/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsCheck.C b/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsCheck.C index 7afb7857e6d7f56e1a4f9fe8f7fdf9c5548ca7dc..327a8b02c0c5fd168b3c59c6d3d40d15ba3cefab 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsCheck.C +++ b/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsCheck.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. @@ -29,22 +30,17 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> - +template<class FaceList, class PointField> bool Foam::PatchTools::checkOrientation ( - const PrimitivePatch<Face, FaceList, PointField, PointType>& p, + const PrimitivePatch<FaceList, PointField>& p, const bool report, labelHashSet* setPtr ) { + typedef typename PrimitivePatch<FaceList, PointField>::face_type FaceType; + bool foundError = false; // Check edge normals, face normals, point normals. @@ -93,7 +89,7 @@ Foam::PatchTools::checkOrientation // //- Compute normal from 3 points, use the first as the origin // minor warpage should not be a problem - const Face& f = p[facei]; + const FaceType& f = p[facei]; const point& p0 = p.points()[f[0]]; const point& p1 = p.points()[f[1]]; const point& p2 = p.points()[f.last()]; @@ -126,8 +122,8 @@ Foam::PatchTools::checkOrientation { // we use localFaces() since edges() are LOCAL // these are both already available - const Face& faceA = p.localFaces()[neighbouringFaces[0]]; - const Face& faceB = p.localFaces()[neighbouringFaces[1]]; + const FaceType& faceA = p.localFaces()[neighbouringFaces[0]]; + const FaceType& faceB = p.localFaces()[neighbouringFaces[1]]; // If the faces are correctly oriented, the edges must go in // different directions on connected faces. diff --git a/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsEdgeOwner.C b/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsEdgeOwner.C index d490eda67ca1a59bc5d603262c33d695967fe966..96262ed76cf3b93c40caf4f146000c44550004f5 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsEdgeOwner.C +++ b/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsEdgeOwner.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. @@ -29,23 +30,18 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> - +template<class FaceList, class PointField> Foam::labelList Foam::PatchTools::edgeOwner ( - const PrimitivePatch<Face, FaceList, PointField, PointType>& p + const PrimitivePatch<FaceList, PointField>& p ) { + typedef typename PrimitivePatch<FaceList, PointField>::face_type FaceType; + const edgeList& edges = p.edges(); const labelListList& edgeFaces = p.edgeFaces(); - const List<Face>& localFaces = p.localFaces(); + const List<FaceType>& localFaces = p.localFaces(); // create the owner list labelList edgeOwner(edges.size(), -1); @@ -62,13 +58,13 @@ Foam::PatchTools::edgeOwner { // Find the first face whose vertices are aligned with the edge. // with multiply connected edges, this is the best we can do - forAll(nbrFaces, i) + for (const label nbrFacei : nbrFaces) { - const Face& f = localFaces[nbrFaces[i]]; + const FaceType& f = localFaces[nbrFacei]; if (f.edgeDirection(edges[edgeI]) > 0) { - edgeOwner[edgeI] = nbrFaces[i]; + edgeOwner[edgeI] = nbrFacei; break; } } @@ -79,7 +75,7 @@ Foam::PatchTools::edgeOwner << "Edge " << edgeI << " vertices:" << edges[edgeI] << " is used by faces " << nbrFaces << " vertices:" - << UIndirectList<Face>(localFaces, nbrFaces) + << UIndirectList<FaceType>(localFaces, nbrFaces) << " none of which use the edge vertices in the same order" << nl << "I give up" << abort(FatalError); } diff --git a/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsGatherAndMerge.C b/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsGatherAndMerge.C index 031459670a4fcef789302395ade612fff8294f52..8eb0020c81c8cae7a4123842b03ba775cfef6181 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsGatherAndMerge.C +++ b/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsGatherAndMerge.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2012-2017 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -33,22 +33,25 @@ License // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> +template<class FaceList, class PointField> void Foam::PatchTools::gatherAndMerge ( const scalar mergeDist, - const PrimitivePatch<Face, FaceList, PointField, PointType>& p, - Field<PointType>& mergedPoints, - List<Face>& mergedFaces, + const PrimitivePatch<FaceList, PointField>& p, + Field + < + typename PrimitivePatch<FaceList, PointField>::point_type + >& mergedPoints, + List + < + typename PrimitivePatch<FaceList, PointField>::face_type + >& mergedFaces, labelList& pointMergeMap ) { + typedef typename PrimitivePatch<FaceList,PointField>::face_type FaceType; + typedef typename PrimitivePatch<FaceList,PointField>::point_type PointType; + // Collect points from all processors labelList pointSizes; { @@ -62,20 +65,20 @@ void Foam::PatchTools::gatherAndMerge // Collect faces from all processors and renumber using sizes of // gathered points { - List<List<Face>> gatheredFaces(Pstream::nProcs()); + List<List<FaceType>> gatheredFaces(Pstream::nProcs()); gatheredFaces[Pstream::myProcNo()] = p; Pstream::gatherList(gatheredFaces); if (Pstream::master()) { - mergedFaces = static_cast<const List<Face>&> + mergedFaces = static_cast<const List<FaceType>&> ( - ListListOps::combineOffset<List<Face>> + ListListOps::combineOffset<List<FaceType>> ( gatheredFaces, pointSizes, - accessOp<List<Face>>(), - offsetOp<Face>() + accessOp<List<FaceType>>(), + offsetOp<FaceType>() ) ); } @@ -104,11 +107,9 @@ void Foam::PatchTools::gatherAndMerge mergedPoints.transfer(newPoints); // Relabel faces - List<Face>& faces = mergedFaces; - - forAll(faces, facei) + for (auto& f : mergedFaces) { - inplaceRenumber(pointMergeMap, faces[facei]); + inplaceRenumber(pointMergeMap, f); } } } @@ -151,9 +152,9 @@ void Foam::PatchTools::gatherAndMerge // Get renumbered local data pointField myPoints(mesh.points(), uniqueMeshPointLabels); List<FaceType> myFaces(localFaces); - forAll(myFaces, i) + for (auto& f : myFaces) { - inplaceRenumber(pointToGlobal, myFaces[i]); + inplaceRenumber(pointToGlobal, f); } @@ -190,9 +191,9 @@ void Foam::PatchTools::gatherAndMerge // Get renumbered local data pointField myPoints(mesh.points(), uniqueMeshPointLabels); List<FaceType> myFaces(localFaces); - forAll(myFaces, i) + for (auto& f : myFaces) { - inplaceRenumber(pointToGlobal, myFaces[i]); + inplaceRenumber(pointToGlobal, f); } // Construct processor stream with estimate of size. Could diff --git a/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsMatch.C b/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsMatch.C index b3d4e8aaa45e05eb889cf36440fe9fa1d57f6cbc..fc32a55b05d1bca8ee8f31ad0312cbd2fd9e3594 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsMatch.C +++ b/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsMatch.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -32,19 +32,13 @@ License template < - class Face1, - template<class> class FaceList1, - class PointField1, - class PointType1, - class Face2, - template<class> class FaceList2, - class PointField2, - class PointType2 + class FaceList1, class PointField1, + class FaceList2, class PointField2 > void Foam::PatchTools::matchPoints ( - const PrimitivePatch<Face1, FaceList1, PointField1, PointType1>& p1, - const PrimitivePatch<Face2, FaceList2, PointField2, PointType2>& p2, + const PrimitivePatch<FaceList1, PointField1>& p1, + const PrimitivePatch<FaceList2, PointField2>& p2, labelList& p1PointLabels, labelList& p2PointLabels @@ -75,19 +69,13 @@ void Foam::PatchTools::matchPoints template < - class Face1, - template<class> class FaceList1, - class PointField1, - class PointType1, - class Face2, - template<class> class FaceList2, - class PointField2, - class PointType2 + class FaceList1, class PointField1, + class FaceList2, class PointField2 > void Foam::PatchTools::matchEdges ( - const PrimitivePatch<Face1, FaceList1, PointField1, PointType1>& p1, - const PrimitivePatch<Face2, FaceList2, PointField2, PointType2>& p2, + const PrimitivePatch<FaceList1, PointField1>& p1, + const PrimitivePatch<FaceList2, PointField2>& p2, labelList& p1EdgeLabels, labelList& p2EdgeLabels, diff --git a/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsNormals.C b/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsNormals.C index 87c45e5264165e0b5058e3407214ce406a9958a3..7d14c99d7bf374945f11ea79e0b833f5b904cd55 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsNormals.C +++ b/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsNormals.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -33,19 +33,12 @@ License // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> - +template<class FaceList, class PointField> Foam::tmp<Foam::pointField> Foam::PatchTools::pointNormals ( const polyMesh& mesh, - const PrimitivePatch<Face, FaceList, PointField, PointType>& p + const PrimitivePatch<FaceList, PointField>& p ) { const globalMeshData& globalData = mesh.globalData(); @@ -196,27 +189,21 @@ Foam::PatchTools::pointNormals } -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> - +template<class FaceList, class PointField> Foam::tmp<Foam::pointField> Foam::PatchTools::edgeNormals ( const polyMesh& mesh, - const PrimitivePatch<Face, FaceList, PointField, PointType>& p, + const PrimitivePatch<FaceList, PointField>& p, const labelList& patchEdges, const labelList& coupledEdges ) { // 1. Start off with local normals - tmp<pointField> tedgeNormals(new pointField(p.nEdges(), Zero)); - pointField& edgeNormals = tedgeNormals.ref(); + auto tedgeNormals = tmp<pointField>::New(p.nEdges(), Zero); + auto& edgeNormals = tedgeNormals.ref(); + { const labelListList& edgeFaces = p.edgeFaces(); const vectorField& faceNormals = p.faceNormals(); diff --git a/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsSearch.C b/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsSearch.C index dc057c3cb04c30e42ac4083e47422a99fe91a9db..fe01c0e8db7a2dd6eaf8ed2caf58604c15d006fa 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsSearch.C +++ b/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsSearch.C @@ -35,17 +35,10 @@ Description // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -template -< - class BoolListType, - class Face, - template<class> class FaceList, - class PointField, - class PointType -> +template<class BoolListType, class FaceList, class PointField> void Foam::PatchTools::markZone ( - const PrimitivePatch<Face, FaceList, PointField, PointType>& p, + const PrimitivePatch<FaceList, PointField>& p, const BoolListType& borderEdge, const label facei, const label currentZone, @@ -111,19 +104,11 @@ void Foam::PatchTools::markZone } -template -< - class BoolListType, - class Face, - template<class> class FaceList, - class PointField, - class PointType -> - +template<class BoolListType, class FaceList, class PointField> Foam::label Foam::PatchTools::markZones ( - const PrimitivePatch<Face, FaceList, PointField, PointType>& p, + const PrimitivePatch<FaceList, PointField>& p, const BoolListType& borderEdge, labelList& faceZone ) @@ -151,25 +136,17 @@ Foam::PatchTools::markZones } -template -< - class BoolListType, - class Face, - template<class> class FaceList, - class PointField, - class PointType -> - +template<class BoolListType, class FaceList, class PointField> void Foam::PatchTools::subsetMap ( - const PrimitivePatch<Face, FaceList, PointField, PointType>& p, + const PrimitivePatch<FaceList, PointField>& p, const BoolListType& includeFaces, labelList& pointMap, labelList& faceMap ) { - const List<Face>& localFaces = p.localFaces(); + const auto& localFaces = p.localFaces(); faceMap.resize(localFaces.size()); pointMap.clear(); @@ -196,16 +173,10 @@ Foam::PatchTools::subsetMap } -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> +template<class FaceList, class PointField> void Foam::PatchTools::calcBounds ( - const PrimitivePatch<Face, FaceList, PointField, PointType>& p, + const PrimitivePatch<FaceList, PointField>& p, boundBox& bb, label& nPoints ) diff --git a/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsSortEdges.C b/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsSortEdges.C index 4b14e04c4cbaa91df0b8c05c58436dba0da2aaf6..bf6299567a474503505a6f24017378e4f69000df 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsSortEdges.C +++ b/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsSortEdges.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2013 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -31,24 +32,17 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> - +template<class FaceList, class PointField> Foam::labelListList Foam::PatchTools::sortedEdgeFaces ( - const PrimitivePatch<Face, FaceList, PointField, PointType>& p + const PrimitivePatch<FaceList, PointField>& p ) { const edgeList& edges = p.edges(); const labelListList& edgeFaces = p.edgeFaces(); - const List<Face>& localFaces = p.localFaces(); - const Field<PointType>& localPoints = p.localPoints(); + const auto& localFaces = p.localFaces(); + const auto& localPoints = p.localPoints(); // create the lists for the various results. (resized on completion) labelListList sortedEdgeFaces(edgeFaces.size()); @@ -69,7 +63,7 @@ Foam::PatchTools::sortedEdgeFaces // Get the vertex on 0th face that forms a vector with the first // edge point that has the largest angle with the edge - const Face& f0 = localFaces[faceNbs[0]]; + const auto& f0 = localFaces[faceNbs[0]]; scalar maxAngle = GREAT; vector maxAngleEdgeDir(vector::max); @@ -110,7 +104,7 @@ Foam::PatchTools::sortedEdgeFaces { // Get the vertex on face that forms a vector with the first // edge point that has the largest angle with the edge - const Face& f = localFaces[faceNbs[nbI]]; + const auto& f = localFaces[faceNbs[nbI]]; maxAngle = GREAT; maxAngleEdgeDir = vector::max; diff --git a/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsSortPoints.C b/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsSortPoints.C index fd5cbd1322d01d05bd5fd5a8c04163bec2cc838f..ec54e595fafecce925a02b9f84888e78f632c6ff 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsSortPoints.C +++ b/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsSortPoints.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. @@ -29,18 +30,11 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> - +template<class FaceList, class PointField> Foam::labelListList Foam::PatchTools::sortedPointEdges ( - const PrimitivePatch<Face, FaceList, PointField, PointType>& p + const PrimitivePatch<FaceList, PointField>& p ) { // Now order the edges of each point according to whether they share a diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.C b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.C index c00dd3413937ee416de132efab8a71c8cc26f296..d45ce84119e08d7d09886aa176cc5b18215707da 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.C +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/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. @@ -29,21 +30,14 @@ License // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -PrimitivePatch +template<class FaceList, class PointField> +Foam::PrimitivePatch<FaceList, PointField>::PrimitivePatch ( - const FaceList<Face>& faces, - const Field<PointType>& points + const FaceList& faces, + const PointField& points ) : - FaceList<Face>(faces), + FaceList(faces), points_(points), edgesPtr_(nullptr), nInternalEdges_(-1), @@ -67,21 +61,14 @@ PrimitivePatch {} -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -PrimitivePatch +template<class FaceList, class PointField> +Foam::PrimitivePatch<FaceList, PointField>::PrimitivePatch ( - FaceList<Face>&& faces, - const Field<PointType>& points + FaceList&& faces, + const PointField& points ) : - FaceList<Face>(std::move(faces)), + FaceList(std::move(faces)), points_(points), edgesPtr_(nullptr), nInternalEdges_(-1), @@ -105,22 +92,15 @@ PrimitivePatch {} -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -PrimitivePatch +template<class FaceList, class PointField> +Foam::PrimitivePatch<FaceList, PointField>::PrimitivePatch ( - FaceList<Face>& faces, - Field<PointType>& points, + FaceList& faces, + PointField& points, const bool reuse ) : - FaceList<Face>(faces, reuse), + FaceList(faces, reuse), points_(points, reuse), edgesPtr_(nullptr), nInternalEdges_(-1), @@ -144,21 +124,14 @@ PrimitivePatch {} -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -PrimitivePatch +template<class FaceList, class PointField> +Foam::PrimitivePatch<FaceList, PointField>::PrimitivePatch ( - const PrimitivePatch<Face, FaceList, PointField, PointType>& pp + const PrimitivePatch<FaceList, PointField>& pp ) : PrimitivePatchName(), - FaceList<Face>(pp), + FaceList(pp), points_(pp.points_), edgesPtr_(nullptr), nInternalEdges_(-1), @@ -184,15 +157,8 @@ PrimitivePatch // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -~PrimitivePatch() +template<class FaceList, class PointField> +Foam::PrimitivePatch<FaceList, PointField>::PrimitivePatch::~PrimitivePatch() { clearOut(); } @@ -200,23 +166,16 @@ Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> +template<class FaceList, class PointField> void -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -movePoints +Foam::PrimitivePatch<FaceList, PointField>::movePoints ( - const Field<PointType>& + const Field<point_type>& ) { if (debug) { - Pout<< "PrimitivePatch<Face, FaceList, PointField, PointType>::" + Pout<< "PrimitivePatch<FaceList, PointField>::" << "movePoints() : " << "recalculating PrimitivePatch geometry following mesh motion" << endl; @@ -226,16 +185,9 @@ movePoints } -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> +template<class FaceList, class PointField> const Foam::edgeList& -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -edges() const +Foam::PrimitivePatch<FaceList, PointField>::edges() const { if (!edgesPtr_) { @@ -246,16 +198,9 @@ edges() const } -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> +template<class FaceList, class PointField> Foam::label -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -nInternalEdges() const +Foam::PrimitivePatch<FaceList, PointField>::nInternalEdges() const { if (!edgesPtr_) { @@ -266,16 +211,9 @@ nInternalEdges() const } -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> +template<class FaceList, class PointField> const Foam::labelList& -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -boundaryPoints() const +Foam::PrimitivePatch<FaceList, PointField>::boundaryPoints() const { if (!boundaryPointsPtr_) { @@ -286,16 +224,9 @@ boundaryPoints() const } -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> +template<class FaceList, class PointField> const Foam::labelListList& -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -faceFaces() const +Foam::PrimitivePatch<FaceList, PointField>::faceFaces() const { if (!faceFacesPtr_) { @@ -306,16 +237,9 @@ faceFaces() const } -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> +template<class FaceList, class PointField> const Foam::labelListList& -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -edgeFaces() const +Foam::PrimitivePatch<FaceList, PointField>::edgeFaces() const { if (!edgeFacesPtr_) { @@ -326,16 +250,9 @@ edgeFaces() const } -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> +template<class FaceList, class PointField> const Foam::labelListList& -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -faceEdges() const +Foam::PrimitivePatch<FaceList, PointField>::faceEdges() const { if (!faceEdgesPtr_) { @@ -346,16 +263,9 @@ faceEdges() const } -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> +template<class FaceList, class PointField> const Foam::labelListList& -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -pointEdges() const +Foam::PrimitivePatch<FaceList, PointField>::pointEdges() const { if (!pointEdgesPtr_) { @@ -366,16 +276,9 @@ pointEdges() const } -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> +template<class FaceList, class PointField> const Foam::labelListList& -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -pointFaces() const +Foam::PrimitivePatch<FaceList, PointField>::pointFaces() const { if (!pointFacesPtr_) { @@ -386,16 +289,12 @@ pointFaces() const } -template +template<class FaceList, class PointField> +const Foam::List < - class Face, - template<class> class FaceList, - class PointField, - class PointType -> -const Foam::List<Face>& -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -localFaces() const + typename Foam::PrimitivePatch<FaceList, PointField>::face_type +>& +Foam::PrimitivePatch<FaceList, PointField>::localFaces() const { if (!localFacesPtr_) { @@ -406,16 +305,9 @@ localFaces() const } -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> +template<class FaceList, class PointField> const Foam::labelList& -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -meshPoints() const +Foam::PrimitivePatch<FaceList, PointField>::meshPoints() const { if (!meshPointsPtr_) { @@ -426,16 +318,9 @@ meshPoints() const } -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> +template<class FaceList, class PointField> const Foam::Map<Foam::label>& -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -meshPointMap() const +Foam::PrimitivePatch<FaceList, PointField>::meshPointMap() const { if (!meshPointMapPtr_) { @@ -446,16 +331,12 @@ meshPointMap() const } -template +template<class FaceList, class PointField> +const Foam::Field < - class Face, - template<class> class FaceList, - class PointField, - class PointType -> -const Foam::Field<PointType>& -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -localPoints() const + typename Foam::PrimitivePatch<FaceList, PointField>::point_type +>& +Foam::PrimitivePatch<FaceList, PointField>::localPoints() const { if (!localPointsPtr_) { @@ -466,16 +347,9 @@ localPoints() const } -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> +template<class FaceList, class PointField> const Foam::labelList& -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -localPointOrder() const +Foam::PrimitivePatch<FaceList, PointField>::localPointOrder() const { if (!localPointOrderPtr_) { @@ -486,16 +360,9 @@ localPointOrder() const } -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> +template<class FaceList, class PointField> Foam::label -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -whichPoint +Foam::PrimitivePatch<FaceList, PointField>::whichPoint ( const label gp ) const @@ -505,16 +372,12 @@ whichPoint } -template +template<class FaceList, class PointField> +const Foam::Field < - class Face, - template<class> class FaceList, - class PointField, - class PointType -> -const Foam::Field<PointType>& -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -faceCentres() const + typename Foam::PrimitivePatch<FaceList, PointField>::point_type +>& +Foam::PrimitivePatch<FaceList, PointField>::faceCentres() const { if (!faceCentresPtr_) { @@ -525,16 +388,12 @@ faceCentres() const } -template +template<class FaceList, class PointField> +const Foam::Field < - class Face, - template<class> class FaceList, - class PointField, - class PointType -> -const Foam::Field<PointType>& -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -faceAreas() const + typename Foam::PrimitivePatch<FaceList, PointField>::point_type +>& +Foam::PrimitivePatch<FaceList, PointField>::faceAreas() const { if (!faceAreasPtr_) { @@ -545,16 +404,9 @@ faceAreas() const } -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> +template<class FaceList, class PointField> const Foam::Field<Foam::scalar>& -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -magFaceAreas() const +Foam::PrimitivePatch<FaceList, PointField>::magFaceAreas() const { if (!magFaceAreasPtr_) { @@ -565,16 +417,12 @@ magFaceAreas() const } -template +template<class FaceList, class PointField> +const Foam::Field < - class Face, - template<class> class FaceList, - class PointField, - class PointType -> -const Foam::Field<PointType>& -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -faceNormals() const + typename Foam::PrimitivePatch<FaceList, PointField>::point_type +>& +Foam::PrimitivePatch<FaceList, PointField>::faceNormals() const { if (!faceNormalsPtr_) { @@ -585,16 +433,12 @@ faceNormals() const } -template +template<class FaceList, class PointField> +const Foam::Field < - class Face, - template<class> class FaceList, - class PointField, - class PointType -> -const Foam::Field<PointType>& -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -pointNormals() const + typename Foam::PrimitivePatch<FaceList, PointField>::point_type +>& +Foam::PrimitivePatch<FaceList, PointField>::pointNormals() const { if (!pointNormalsPtr_) { @@ -607,23 +451,43 @@ pointNormals() const // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> +template<class FaceList, class PointField> +void +Foam::PrimitivePatch<FaceList, PointField>::operator= +( + const PrimitivePatch<FaceList, PointField>& rhs +) +{ + if (&rhs == this) + { + return; + } + + clearOut(); + + FaceList::shallowCopy(rhs); + + // Cannot copy assign points (could be const reference) +} + + +template<class FaceList, class PointField> void -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -operator= +Foam::PrimitivePatch<FaceList, PointField>::operator= ( - const PrimitivePatch<Face, FaceList, PointField, PointType>& pp + PrimitivePatch<FaceList, PointField>&& rhs ) { + if (&rhs == this) + { + return; + } + clearOut(); - FaceList<Face>::shallowCopy(pp); + FaceList::operator=(std::move(rhs)); + + // Cannot move assign points (could be const reference) } diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.H b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.H index e5322519b2d0876a6606c0bde00a8d0b7e051692..f2cdc95af53d8c7956d5baa42374d4cf46102f76 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.H +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.H @@ -67,6 +67,7 @@ SourceFiles namespace Foam { +// Forward Declarations class face; template<class T> class Map; @@ -81,38 +82,33 @@ TemplateName(PrimitivePatch); Class PrimitivePatch Declaration \*---------------------------------------------------------------------------*/ -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType=point -> +template<class FaceList, class PointField> class PrimitivePatch : public PrimitivePatchName, - public FaceList<Face> + public FaceList { - public: // Public Typedefs //- The face type - typedef Face face_type; + typedef typename + std::remove_reference<FaceList>::type::value_type face_type; //- The point type - typedef PointType point_type; + typedef typename + std::remove_reference<PointField>::type::value_type point_type; //- The face list type - typedef FaceList<Face> FaceListType; + typedef FaceList 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; + typedef face_type FaceType; // Public Data Types @@ -138,62 +134,62 @@ private: //- Edges of the patch; address into local point list; // sorted with internal edges first in upper-triangular order // and external edges last. - mutable edgeList* edgesPtr_; + mutable unique_ptr<edgeList> edgesPtr_; //- Which part of edgesPtr_ is internal edges. mutable label nInternalEdges_; //- Boundary point labels, addressing into local point list - mutable labelList* boundaryPointsPtr_; + mutable unique_ptr<labelList> boundaryPointsPtr_; //- Face-face addressing - mutable labelListList* faceFacesPtr_; + mutable unique_ptr<labelListList> faceFacesPtr_; //- Edge-face addressing - mutable labelListList* edgeFacesPtr_; + mutable unique_ptr<labelListList> edgeFacesPtr_; //- Face-edge addressing - mutable labelListList* faceEdgesPtr_; + mutable unique_ptr<labelListList> faceEdgesPtr_; //- Point-edge addressing - mutable labelListList* pointEdgesPtr_; + mutable unique_ptr<labelListList> pointEdgesPtr_; //- Point-face addressing - mutable labelListList* pointFacesPtr_; + mutable unique_ptr<labelListList> pointFacesPtr_; //- Faces addressing into local point list - mutable List<Face>* localFacesPtr_; + mutable unique_ptr<List<face_type>> localFacesPtr_; //- Labels of mesh points - mutable labelList* meshPointsPtr_; + mutable unique_ptr<labelList> meshPointsPtr_; //- Mesh point map. Given the global point index find its //- location in the patch - mutable Map<label>* meshPointMapPtr_; + mutable unique_ptr<Map<label>> meshPointMapPtr_; //- Outside edge loops - mutable labelListList* edgeLoopsPtr_; + mutable unique_ptr<labelListList> edgeLoopsPtr_; //- Points local to patch - mutable Field<PointType>* localPointsPtr_; + mutable unique_ptr<Field<point_type>> localPointsPtr_; //- Local point order for most efficient search - mutable labelList* localPointOrderPtr_; + mutable unique_ptr<labelList> localPointOrderPtr_; //- Face centres - mutable Field<PointType>* faceCentresPtr_; + mutable unique_ptr<Field<point_type>> faceCentresPtr_; //- Face area vectors - mutable Field<PointType>* faceAreasPtr_; + mutable unique_ptr<Field<point_type>> faceAreasPtr_; //- Mag face area - mutable Field<scalar>* magFaceAreasPtr_; + mutable unique_ptr<Field<scalar>> magFaceAreasPtr_; //- Face unit normals - mutable Field<PointType>* faceNormalsPtr_; + mutable unique_ptr<Field<point_type>> faceNormalsPtr_; //- Point unit normals - mutable Field<PointType>* pointNormalsPtr_; + mutable unique_ptr<Field<point_type>> pointNormalsPtr_; // Private Member Functions @@ -263,30 +259,27 @@ public: //- Construct from components PrimitivePatch ( - const FaceList<Face>& faces, - const Field<PointType>& points + const FaceList& faces, + const PointField& points ); //- Construct from components, transferring faces PrimitivePatch ( - FaceList<Face>&& faces, - const Field<PointType>& points + FaceList&& faces, + const PointField& points ); //- Construct from components, reuse storage PrimitivePatch ( - FaceList<Face>& faces, - Field<PointType>& points, + FaceList& faces, + PointField& points, const bool reuse ); - //- Construct as copy - PrimitivePatch - ( - const PrimitivePatch<Face, FaceList, PointField, PointType>& - ); + //- Copy construct + PrimitivePatch(const PrimitivePatch<FaceList, PointField>& pp); //- Destructor @@ -310,7 +303,7 @@ public: // Access //- Return reference to global points - const Field<PointType>& points() const + const Field<point_type>& points() const { return points_; } @@ -363,7 +356,7 @@ public: const labelListList& pointFaces() const; //- Return patch faces addressing into local point list - const List<Face>& localFaces() const; + const List<face_type>& localFaces() const; // Addressing into mesh @@ -378,7 +371,7 @@ public: const Map<label>& meshPointMap() const; //- Return pointField of points in patch - const Field<PointType>& localPoints() const; + const Field<point_type>& localPoints() const; //- Return orders the local points for most efficient search const labelList& localPointOrder() const; @@ -409,27 +402,27 @@ public: ) const; //- Return face centres for patch - const Field<PointType>& faceCentres() const; + const Field<point_type>& faceCentres() const; //- Return face area vectors for patch - const Field<PointType>& faceAreas() const; + const Field<point_type>& faceAreas() const; //- Return face area magnitudes for patch const Field<scalar>& magFaceAreas() const; //- Return face unit normals for patch - const Field<PointType>& faceNormals() const; + const Field<point_type>& faceNormals() const; //- Return point normals for patch - const Field<PointType>& pointNormals() const; + const Field<point_type>& pointNormals() const; // Storage Management - inline bool hasFaceAreas() const { return faceAreasPtr_; } - inline bool hasFaceCentres() const { return faceCentresPtr_; } - inline bool hasFaceNormals() const { return faceNormalsPtr_; } - inline bool hasPointNormals() const { return pointNormalsPtr_; } + bool hasFaceAreas() const { return bool(faceAreasPtr_); } + bool hasFaceCentres() const { return bool(faceCentresPtr_); } + bool hasFaceNormals() const { return bool(faceNormalsPtr_); } + bool hasPointNormals() const { return bool(pointNormalsPtr_); } // Other patch operations @@ -439,7 +432,7 @@ public: List<objectHit> projectPoints ( const ToPatch& targetPatch, - const Field<PointType>& projectionDirection, + const Field<point_type>& projectionDirection, const intersection::algorithm = intersection::FULL_RAY, const intersection::direction = intersection::VECTOR ) const; @@ -449,7 +442,7 @@ public: List<objectHit> projectFaceCentres ( const ToPatch& targetPatch, - const Field<PointType>& projectionDirection, + const Field<point_type>& projectionDirection, const intersection::algorithm = intersection::FULL_RAY, const intersection::direction = intersection::VECTOR ) const; @@ -494,16 +487,16 @@ public: // Edit //- Correct patch after moving points - virtual void movePoints(const Field<PointType>&); + virtual void movePoints(const Field<point_type>&); // Member Operators - //- Assignment - void operator= - ( - const PrimitivePatch<Face, FaceList, PointField, PointType>& - ); + //- Copy assign faces. Leave points alone (could be a reference). + void operator=(const PrimitivePatch<FaceList, PointField>& rhs); + + //- Move assign faces. Leave points alone (could be a reference). + void operator=(PrimitivePatch<FaceList, PointField>&& rhs); }; diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchAddressing.C b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchAddressing.C index 9fa1f9a4cdbfe8be40bf10feb9112d579aa963c5..7913307c60afa23224591b61c9d35dfa4e81d887 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchAddressing.C +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchAddressing.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. @@ -39,26 +40,13 @@ Description #include "PrimitivePatch.H" #include "DynamicList.H" - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> +template<class FaceList, class PointField> void -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -calcAddressing() const +Foam::PrimitivePatch<FaceList, PointField>::calcAddressing() const { - if (debug) - { - Info<< "PrimitivePatch<Face, FaceList, PointField, PointType>::" - << "calcAddressing() : calculating patch addressing" - << endl; - } + DebugInFunction << "Calculating patch addressing" << nl; if (edgesPtr_ || faceFacesPtr_ || edgeFacesPtr_ || faceEdgesPtr_) { @@ -69,31 +57,31 @@ calcAddressing() const } // get reference to localFaces - const List<Face>& locFcs = localFaces(); + const List<face_type>& locFcs = localFaces(); // get reference to pointFaces const labelListList& pf = pointFaces(); // Guess the max number of edges and neighbours for a face label maxEdges = 0; - forAll(locFcs, facei) + for (const auto& f : locFcs) { - maxEdges += locFcs[facei].size(); + maxEdges += f.size(); } // create the lists for the various results. (resized on completion) - edgesPtr_ = new edgeList(maxEdges); - edgeList& edges = *edgesPtr_; + edgesPtr_.reset(new edgeList(maxEdges)); + auto& edges = *edgesPtr_; - edgeFacesPtr_ = new labelListList(maxEdges); - labelListList& edgeFaces = *edgeFacesPtr_; + edgeFacesPtr_.reset(new labelListList(maxEdges)); + auto& edgeFaces = *edgeFacesPtr_; // faceFaces created using a dynamic list. Cannot guess size because // of multiple connections List<DynamicList<label>> ff(locFcs.size()); - faceEdgesPtr_ = new labelListList(locFcs.size()); - labelListList& faceEdges = *faceEdgesPtr_; + faceEdgesPtr_.reset(new labelListList(locFcs.size())); + auto& faceEdges = *faceEdgesPtr_; // count the number of face neighbours labelList noFaceFaces(locFcs.size()); @@ -129,7 +117,7 @@ calcAddressing() const forAll(locFcs, facei) { // Get reference to vertices of current face and corresponding edges. - const Face& curF = locFcs[facei]; + const face_type& curF = locFcs[facei]; const edgeList& curEdges = faceIntoEdges[facei]; // Record the neighbour face. Multiple connectivity allowed @@ -283,8 +271,8 @@ calcAddressing() const edgeFaces.setSize(nEdges); // faceFaces list - faceFacesPtr_ = new labelListList(locFcs.size()); - labelListList& faceFaces = *faceFacesPtr_; + faceFacesPtr_.reset(new labelListList(locFcs.size())); + auto& faceFaces = *faceFacesPtr_; forAll(faceFaces, facei) { @@ -292,12 +280,7 @@ calcAddressing() const } - if (debug) - { - Info<< "PrimitivePatch<Face, FaceList, PointField, PointType>::" - << "calcAddressing() : finished calculating patch addressing" - << endl; - } + DebugInFunction << "Calculated patch addressing" << nl; } diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchBdryPoints.C b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchBdryPoints.C index b75af3370eb5156ff2d159819be3de20cf74031e..3ced498e62d554c82f4b298b9c06c1330d37896d 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchBdryPoints.C +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchBdryPoints.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. @@ -30,21 +31,11 @@ License // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> +template<class FaceList, class PointField> void -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -calcBdryPoints() const +Foam::PrimitivePatch<FaceList, PointField>::calcBdryPoints() const { - if (debug) - { - InfoInFunction << "Calculating boundary points" << endl; - } + DebugInFunction << "Calculating boundary points" << nl; if (boundaryPointsPtr_) { @@ -66,12 +57,9 @@ calcBdryPoints() const bp.insert(curEdge.end()); } - boundaryPointsPtr_ = new labelList(bp.sortedToc()); + boundaryPointsPtr_.reset(new labelList(bp.sortedToc())); - if (debug) - { - Info<< " Finished." << endl; - } + DebugInfo << " Finished." << nl; } diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchCheck.C b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchCheck.C index c5b820345e8519556e35d1ef809119eb07606079..ff1fef3f3c3b8ad0d34375cda182f2ae918999da 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchCheck.C +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchCheck.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. @@ -34,16 +35,9 @@ Description // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> +template<class FaceList, class PointField> void -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -visitPointRegion +Foam::PrimitivePatch<FaceList, PointField>::visitPointRegion ( const label pointi, const labelList& pFaces, @@ -109,22 +103,11 @@ visitPointRegion // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> -typename -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::surfaceTopo -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -surfaceType() const +template<class FaceList, class PointField> +typename Foam::PrimitivePatch<FaceList, PointField>::surfaceTopo +Foam::PrimitivePatch<FaceList, PointField>::surfaceType() const { - if (debug) - { - InfoInFunction << "Calculating patch topology" << endl; - } + DebugInFunction << "Calculating patch topology" << nl; const labelListList& edgeFcs = edgeFaces(); @@ -148,34 +131,21 @@ surfaceType() const } } - if (debug) - { - Info<< " Finished." << endl; - } + DebugInFunction << "Calculated patch topology" << nl; return pType; } -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> +template<class FaceList, class PointField> bool -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -checkTopology +Foam::PrimitivePatch<FaceList, PointField>::checkTopology ( const bool report, labelHashSet* setPtr ) const { - if (debug) - { - InfoInFunction << "Checking patch topology" << endl; - } + DebugInFunction << "Checking patch topology" << nl; // Check edgeFaces @@ -208,25 +178,15 @@ checkTopology } } - if (debug) - { - Info<< " Finished." << endl; - } + DebugInFunction << "Checked patch topology" << nl; return illegalTopo; } -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> +template<class FaceList, class PointField> bool -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -checkPointManifold +Foam::PrimitivePatch<FaceList, PointField>::checkPointManifold ( const bool report, labelHashSet* setPtr diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchClear.C b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchClear.C index c64c1a380a184755b4f185b7c8f0560c217f00c7..3151db5d653a5ef97ca15a9b8569256c84eb0282 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchClear.C +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchClear.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. @@ -26,108 +27,62 @@ License \*---------------------------------------------------------------------------*/ #include "PrimitivePatch.H" -#include "demandDrivenData.H" - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> +template<class FaceList, class PointField> void -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -clearGeom() +Foam::PrimitivePatch<FaceList, PointField>::clearGeom() { - if (debug) - { - InfoInFunction << "Clearing geometric data" << endl; - } - - deleteDemandDrivenData(localPointsPtr_); - deleteDemandDrivenData(faceCentresPtr_); - deleteDemandDrivenData(faceAreasPtr_); - deleteDemandDrivenData(magFaceAreasPtr_); - deleteDemandDrivenData(faceNormalsPtr_); - deleteDemandDrivenData(pointNormalsPtr_); + DebugInFunction << "Clearing geometric data" << nl; + + localPointsPtr_.reset(nullptr); + faceCentresPtr_.reset(nullptr); + faceAreasPtr_.reset(nullptr); + magFaceAreasPtr_.reset(nullptr); + faceNormalsPtr_.reset(nullptr); + pointNormalsPtr_.reset(nullptr); } -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> +template<class FaceList, class PointField> void -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -clearTopology() +Foam::PrimitivePatch<FaceList, PointField>::clearTopology() { - if (debug) - { - InfoInFunction << "Clearing patch addressing" << endl; - } + DebugInFunction << "Clearing patch addressing" << nl; // group created and destroyed together if (edgesPtr_ && faceFacesPtr_ && edgeFacesPtr_ && faceEdgesPtr_) { - delete edgesPtr_; - edgesPtr_ = nullptr; - - delete faceFacesPtr_; - faceFacesPtr_ = nullptr; - - delete edgeFacesPtr_; - edgeFacesPtr_ = nullptr; - - delete faceEdgesPtr_; - faceEdgesPtr_ = nullptr; + edgesPtr_.reset(nullptr); + faceFacesPtr_.reset(nullptr); + edgeFacesPtr_.reset(nullptr); + faceEdgesPtr_.reset(nullptr); } - deleteDemandDrivenData(boundaryPointsPtr_); - deleteDemandDrivenData(pointEdgesPtr_); - deleteDemandDrivenData(pointFacesPtr_); - deleteDemandDrivenData(edgeLoopsPtr_); - deleteDemandDrivenData(localPointOrderPtr_); + boundaryPointsPtr_.reset(nullptr); + pointEdgesPtr_.reset(nullptr); + pointFacesPtr_.reset(nullptr); + edgeLoopsPtr_.reset(nullptr); + localPointOrderPtr_.reset(nullptr); } -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> +template<class FaceList, class PointField> void -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -clearPatchMeshAddr() +Foam::PrimitivePatch<FaceList, PointField>::clearPatchMeshAddr() { - if (debug) - { - InfoInFunction << "Clearing patch-mesh addressing" << endl; - } + DebugInFunction << "Clearing patch-mesh addressing" << nl; - deleteDemandDrivenData(meshPointsPtr_); - deleteDemandDrivenData(meshPointMapPtr_); - deleteDemandDrivenData(localFacesPtr_); + meshPointsPtr_.reset(nullptr); + meshPointMapPtr_.reset(nullptr); + localFacesPtr_.reset(nullptr); } -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> +template<class FaceList, class PointField> void -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -clearOut() +Foam::PrimitivePatch<FaceList, PointField>::clearOut() { clearGeom(); clearTopology(); diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchEdgeLoops.C b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchEdgeLoops.C index fc66bc592d9682a8c404a71b5b837bed0f2ff0b6..90d9f75af5ea8d9ff28d0090a3a2860ed2a86513 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchEdgeLoops.C +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchEdgeLoops.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. @@ -31,24 +32,13 @@ Description #include "PrimitivePatch.H" - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> +template<class FaceList, class PointField> void -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -calcEdgeLoops() const +Foam::PrimitivePatch<FaceList, PointField>::calcEdgeLoops() const { - if (debug) - { - InfoInFunction << "Calculating boundary edge loops" << endl; - } + DebugInFunction << "Calculating boundary edge loops" << endl; if (edgeLoopsPtr_) { @@ -64,7 +54,7 @@ calcEdgeLoops() const if (nBdryEdges == 0) { - edgeLoopsPtr_ = new labelListList(0); + edgeLoopsPtr_.reset(new labelListList(0)); return; } @@ -79,8 +69,8 @@ calcEdgeLoops() const labelList loopNumber(nBdryEdges, -1); // Size return list plenty big - edgeLoopsPtr_ = new labelListList(nBdryEdges); - labelListList& edgeLoops = *edgeLoopsPtr_; + edgeLoopsPtr_.reset(new labelListList(nBdryEdges)); + auto& edgeLoops = *edgeLoopsPtr_; // Current loop number. @@ -149,23 +139,13 @@ calcEdgeLoops() const edgeLoops.setSize(loopI); - if (debug) - { - Info<< " Finished." << endl; - } + DebugInFunction << "Calculated boundary edge loops" << nl; } -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> +template<class FaceList, class PointField> const Foam::labelListList& -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -edgeLoops() const +Foam::PrimitivePatch<FaceList, PointField>::edgeLoops() const { if (!edgeLoopsPtr_) { diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchLocalPointOrder.C b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchLocalPointOrder.C index 4b2c572df45efbdcceb5200d27e95069441ced17..abe417f13e6f8b82758956e40afcb21b003f716d 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchLocalPointOrder.C +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchLocalPointOrder.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. @@ -33,24 +34,16 @@ Description // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> +template<class FaceList, class PointField> void -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -calcLocalPointOrder() const +Foam::PrimitivePatch<FaceList, PointField>::calcLocalPointOrder() const { // Note: Cannot use bandCompressing as point-point addressing does // not exist and is not considered generally useful. - // if (debug) { - Pout<< "PrimitivePatch<Face, FaceList, PointField, PointType>::" + Pout<< "PrimitivePatch<FaceList, PointField>::" << "calcLocalPointOrder() : " << "calculating local point order" << endl; @@ -64,15 +57,14 @@ calcLocalPointOrder() const << abort(FatalError); } - const List<Face>& lf = localFaces(); + const List<face_type>& lf = localFaces(); const labelListList& ff = faceFaces(); boolList visitedFace(lf.size(), false); - localPointOrderPtr_ = new labelList(meshPoints().size(), -1); - - labelList& pointOrder = *localPointOrderPtr_; + localPointOrderPtr_.reset(new labelList(meshPoints().size(), -1)); + auto& pointOrder = *localPointOrderPtr_; boolList visitedPoint(pointOrder.size(), false); @@ -126,7 +118,7 @@ calcLocalPointOrder() const if (debug) { - Pout<< "PrimitivePatch<Face, FaceList, PointField, PointType>::" + Pout<< "PrimitivePatch<FaceList, PointField>::" << "calcLocalPointOrder() " << "finished calculating local point order" << endl; diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchMeshData.C b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchMeshData.C index cf61c4501742f192507312d6e12d1680c77d2641..df1e23e51136613268a3d4d5ee17324ad13a95d8 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchMeshData.C +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchMeshData.C @@ -31,20 +31,13 @@ License // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> +template<class FaceList, class PointField> void -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -calcMeshData() const +Foam::PrimitivePatch<FaceList, PointField>::calcMeshData() const { if (debug) { - Pout<< "PrimitivePatch<Face, FaceList, PointField, PointType>::" + Pout<< "PrimitivePatch<FaceList, PointField>::" "calcMeshData() : " "calculating mesh data in PrimitivePatch" << endl; @@ -73,7 +66,7 @@ calcMeshData() const //// if the point is used, set the mark to 1 //forAll(*this, facei) //{ - // const Face& curPoints = this->operator[](facei); + // const face_type& curPoints = this->operator[](facei); // // forAll(curPoints, pointi) // { @@ -83,8 +76,8 @@ calcMeshData() const // //// 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_; + //meshPointsPtr_.reset(new labelList(markedPoints.toc())); + //auto& pointPatch = *meshPointsPtr_; // //// Sort the list to preserve compatibility with the old ordering //sort(pointPatch); @@ -97,42 +90,36 @@ calcMeshData() const //- Unsorted version: DynamicList<label> meshPoints(2*this->size()); - forAll(*this, facei) + for (const face_type& f : *this) { - const Face& curPoints = this->operator[](facei); - - forAll(curPoints, pointi) + for (const label pointi : f) { - if (markedPoints.insert(curPoints[pointi], meshPoints.size())) + if (markedPoints.insert(pointi, meshPoints.size())) { - meshPoints.append(curPoints[pointi]); + meshPoints.append(pointi); } } } // Transfer to straight list (reuses storage) - meshPointsPtr_ = new labelList(meshPoints, true); - + meshPointsPtr_.reset(new labelList(meshPoints, true)); - // Create local faces. Note that we start off from copy of original face - // list (even though vertices are overwritten below). This is done so - // additional data gets copied (e.g. region number of labelledTri) - localFacesPtr_ = new List<Face>(*this); - List<Face>& lf = *localFacesPtr_; + // Create local faces. Deep-copy original faces to retain additional + // data (e.g. region number of labelledTri) + // The vertices will be overwritten later + localFacesPtr_.reset(new List<face_type>(*this)); + auto& locFaces = *localFacesPtr_; - forAll(*this, facei) + for (face_type& f : locFaces) { - const Face& curFace = this->operator[](facei); - lf[facei].setSize(curFace.size()); - - forAll(curFace, labelI) + for (label& pointi : f) { - lf[facei][labelI] = markedPoints.find(curFace[labelI])(); + pointi = *(markedPoints.cfind(pointi)); } } if (debug) { - Pout<< "PrimitivePatch<Face, FaceList, PointField, PointType>::" + Pout<< "PrimitivePatch<FaceList, PointField>::" "calcMeshData() : " "finished calculating mesh data in PrimitivePatch" << endl; @@ -140,20 +127,13 @@ calcMeshData() const } -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> +template<class FaceList, class PointField> void -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -calcMeshPointMap() const +Foam::PrimitivePatch<FaceList, PointField>::calcMeshPointMap() const { if (debug) { - Pout<< "PrimitivePatch<Face, FaceList, PointField, PointType>::" + Pout<< "PrimitivePatch<FaceList, PointField>::" "calcMeshPointMap() : " "calculating mesh point map in PrimitivePatch" << endl; @@ -169,8 +149,8 @@ calcMeshPointMap() const const labelList& mp = meshPoints(); - meshPointMapPtr_ = new Map<label>(2*mp.size()); - Map<label>& mpMap = *meshPointMapPtr_; + meshPointMapPtr_.reset(new Map<label>(2*mp.size())); + auto& mpMap = *meshPointMapPtr_; forAll(mp, i) { @@ -179,7 +159,7 @@ calcMeshPointMap() const if (debug) { - Pout<< "PrimitivePatch<Face, FaceList, PointField, PointType>::" + Pout<< "PrimitivePatch<FaceList, PointField>::" "calcMeshPointMap() : " "finished calculating mesh point map in PrimitivePatch" << endl; @@ -187,20 +167,13 @@ calcMeshPointMap() const } -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> +template<class FaceList, class PointField> void -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -calcLocalPoints() const +Foam::PrimitivePatch<FaceList, PointField>::calcLocalPoints() const { if (debug) { - Pout<< "PrimitivePatch<Face, FaceList, PointField, PointType>::" + Pout<< "PrimitivePatch<FaceList, PointField>::" "calcLocalPoints() : " "calculating localPoints in PrimitivePatch" << endl; @@ -216,9 +189,8 @@ calcLocalPoints() const const labelList& meshPts = meshPoints(); - localPointsPtr_ = new Field<PointType>(meshPts.size()); - - Field<PointType>& locPts = *localPointsPtr_; + localPointsPtr_.reset(new Field<point_type>(meshPts.size())); + auto& locPts = *localPointsPtr_; forAll(meshPts, pointi) { @@ -227,7 +199,7 @@ calcLocalPoints() const if (debug) { - Pout<< "PrimitivePatch<Face, FaceList, PointField, PointType>::" + Pout<< "PrimitivePatch<FaceList, PointField>::" << "calcLocalPoints() : " << "finished calculating localPoints in PrimitivePatch" << endl; @@ -235,20 +207,13 @@ calcLocalPoints() const } -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> +template<class FaceList, class PointField> void -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -calcPointNormals() const +Foam::PrimitivePatch<FaceList, PointField>::calcPointNormals() const { if (debug) { - Pout<< "PrimitivePatch<Face, FaceList, PointField, PointType>::" + Pout<< "PrimitivePatch<FaceList, PointField>::" "calcPointNormals() : " "calculating pointNormals in PrimitivePatch" << endl; @@ -262,21 +227,16 @@ calcPointNormals() const << abort(FatalError); } - const Field<PointType>& faceUnitNormals = faceNormals(); + const auto& faceUnitNormals = faceNormals(); const labelListList& pf = pointFaces(); - pointNormalsPtr_ = new Field<PointType> - ( - meshPoints().size(), - PointType::zero - ); - - Field<PointType>& n = *pointNormalsPtr_; + pointNormalsPtr_.reset(new Field<point_type>(meshPoints().size(), Zero)); + auto& n = *pointNormalsPtr_; forAll(pf, pointi) { - PointType& curNormal = n[pointi]; + point_type& curNormal = n[pointi]; const labelList& curFaces = pf[pointi]; @@ -290,7 +250,7 @@ calcPointNormals() const if (debug) { - Pout<< "PrimitivePatch<Face, FaceList, PointField, PointType>::" + Pout<< "PrimitivePatch<FaceList, PointField>::" "calcPointNormals() : " "finished calculating pointNormals in PrimitivePatch" << endl; @@ -298,20 +258,13 @@ calcPointNormals() const } -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> +template<class FaceList, class PointField> void -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -calcFaceCentres() const +Foam::PrimitivePatch<FaceList, PointField>::calcFaceCentres() const { if (debug) { - Pout<< "PrimitivePatch<Face, FaceList, PointField, PointType>::" + Pout<< "PrimitivePatch<FaceList, PointField>::" "calcFaceCentres() : " "calculating faceCentres in PrimitivePatch" << endl; @@ -325,9 +278,8 @@ calcFaceCentres() const << abort(FatalError); } - faceCentresPtr_ = new Field<PointType>(this->size()); - - Field<PointType>& c = *faceCentresPtr_; + faceCentresPtr_.reset(new Field<point_type>(this->size())); + auto& c = *faceCentresPtr_; forAll(c, facei) { @@ -336,7 +288,7 @@ calcFaceCentres() const if (debug) { - Pout<< "PrimitivePatch<Face, FaceList, PointField, PointType>::" + Pout<< "PrimitivePatch<FaceList, PointField>::" "calcFaceCentres() : " "finished calculating faceCentres in PrimitivePatch" << endl; @@ -344,20 +296,13 @@ calcFaceCentres() const } -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> +template<class FaceList, class PointField> void -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -calcMagFaceAreas() const +Foam::PrimitivePatch<FaceList, PointField>::calcMagFaceAreas() const { if (debug) { - Pout<< "PrimitivePatch<Face, FaceList, PointField, PointType>::" + Pout<< "PrimitivePatch<FaceList, PointField>::" "calcMagFaceAreas() : " "calculating magFaceAreas in PrimitivePatch" << endl; @@ -371,8 +316,8 @@ calcMagFaceAreas() const << abort(FatalError); } - magFaceAreasPtr_ = new Field<scalar>(this->size()); - Field<scalar>& a = *magFaceAreasPtr_; + magFaceAreasPtr_.reset(new Field<scalar>(this->size())); + auto& a = *magFaceAreasPtr_; forAll(a, facei) { @@ -381,7 +326,7 @@ calcMagFaceAreas() const if (debug) { - Pout<< "PrimitivePatch<Face, FaceList, PointField, PointType>::" + Pout<< "PrimitivePatch<FaceList, PointField>::" "calcMagFaceAreas() : " "finished calculating magFaceAreas in PrimitivePatch" << endl; @@ -389,20 +334,13 @@ calcMagFaceAreas() const } -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> +template<class FaceList, class PointField> void -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -calcFaceAreas() const +Foam::PrimitivePatch<FaceList, PointField>::calcFaceAreas() const { if (debug) { - Pout<< "PrimitivePatch<Face, FaceList, PointField, PointType>::" + Pout<< "PrimitivePatch<FaceList, PointField>::" "calcFaceAreas() : " "calculating faceAreas in PrimitivePatch" << endl; @@ -416,9 +354,8 @@ calcFaceAreas() const << abort(FatalError); } - faceAreasPtr_ = new Field<PointType>(this->size()); - - Field<PointType>& n = *faceAreasPtr_; + faceAreasPtr_.reset(new Field<point_type>(this->size())); + auto& n = *faceAreasPtr_; forAll(n, facei) { @@ -427,7 +364,7 @@ calcFaceAreas() const if (debug) { - Pout<< "PrimitivePatch<Face, FaceList, PointField, PointType>::" + Pout<< "PrimitivePatch<FaceList, PointField>::" "calcFaceAreas() : " "finished calculating faceAreas in PrimitivePatch" << endl; @@ -435,20 +372,13 @@ calcFaceAreas() const } -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> +template<class FaceList, class PointField> void -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -calcFaceNormals() const +Foam::PrimitivePatch<FaceList, PointField>::calcFaceNormals() const { if (debug) { - Pout<< "PrimitivePatch<Face, FaceList, PointField, PointType>::" + Pout<< "PrimitivePatch<FaceList, PointField>::" "calcFaceNormals() : " "calculating faceNormals in PrimitivePatch" << endl; @@ -462,9 +392,8 @@ calcFaceNormals() const << abort(FatalError); } - faceNormalsPtr_ = new Field<PointType>(this->size()); - - Field<PointType>& n = *faceNormalsPtr_; + faceNormalsPtr_.reset(new Field<point_type>(this->size())); + auto& n = *faceNormalsPtr_; forAll(n, facei) { @@ -473,7 +402,7 @@ calcFaceNormals() const if (debug) { - Pout<< "PrimitivePatch<Face, FaceList, PointField, PointType>::" + Pout<< "PrimitivePatch<FaceList, PointField>::" "calcFaceNormals() : " "finished calculating faceNormals in PrimitivePatch" << endl; diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchMeshEdges.C b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchMeshEdges.C index a311a86f738e80ed4edd3cb08fc824bbf7523d9f..9af7dcea2a01888a05f0f850441de51446a6694e 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchMeshEdges.C +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchMeshEdges.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. @@ -27,18 +28,11 @@ License #include "PrimitivePatch.H" - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> +template<class FaceList, class PointField> Foam::labelList -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: +Foam::PrimitivePatch<FaceList, PointField>:: meshEdges ( const edgeList& allEdges, @@ -46,13 +40,8 @@ meshEdges const labelList& faceCells ) const { - if (debug) - { - Info<< "labelList PrimitivePatch<Face, FaceList, PointField, PointType>" - << "::meshEdges() : " - << "calculating labels of patch edges in mesh edge list" - << endl; - } + DebugInFunction + << "Calculating labels of patch edges in mesh edge list" << nl; // get reference to the list of edges on the patch const edgeList& PatchEdges = edges(); @@ -107,28 +96,16 @@ meshEdges } -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> +template<class FaceList, class PointField> Foam::labelList -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -meshEdges +Foam::PrimitivePatch<FaceList, PointField>::meshEdges ( const edgeList& allEdges, const labelListList& pointEdges ) const { - if (debug) - { - Info<< "labelList PrimitivePatch<Face, FaceList, PointField, PointType>" - << "::meshEdges() : " - << "calculating labels of patch edges in mesh edge list" - << endl; - } + DebugInFunction + << "Calculating labels of patch edges in mesh edge list" << nl; // get reference to the list of edges on the patch const edgeList& PatchEdges = edges(); @@ -164,16 +141,9 @@ meshEdges // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> +template<class FaceList, class PointField> Foam::label -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -whichEdge +Foam::PrimitivePatch<FaceList, PointField>::whichEdge ( const edge& e ) const diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchPointAddressing.C b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchPointAddressing.C index bb5d171fdcfd455b7314613987345668b9ab061c..d564e3e939f646213650fb33644ca935074844f7 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchPointAddressing.C +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchPointAddressing.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -35,19 +35,11 @@ Description // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> +template<class FaceList, class PointField> void -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -calcPointEdges() const +Foam::PrimitivePatch<FaceList, PointField>::calcPointEdges() const { - DebugInFunction - << "Calculating pointEdges" << endl; + DebugInFunction << "Calculating pointEdges" << endl; if (pointEdgesPtr_) { @@ -57,9 +49,8 @@ calcPointEdges() const << abort(FatalError); } - pointEdgesPtr_ = new labelListList(meshPoints().size()); - - labelListList& pe = *pointEdgesPtr_; + pointEdgesPtr_.reset(new labelListList(meshPoints().size())); + auto& pe = *pointEdgesPtr_; invertManyToMany(pe.size(), edges(), pe); @@ -68,16 +59,9 @@ calcPointEdges() const } -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> +template<class FaceList, class PointField> void -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -calcPointFaces() const +Foam::PrimitivePatch<FaceList, PointField>::calcPointFaces() const { DebugInFunction << "Calculating pointFaces" << endl; @@ -90,14 +74,14 @@ calcPointFaces() const << abort(FatalError); } - const List<Face>& f = localFaces(); + const List<face_type>& locFcs = localFaces(); // set up storage for pointFaces List<SLList<label>> pointFcs(meshPoints().size()); - forAll(f, facei) + forAll(locFcs, facei) { - const Face& curPoints = f[facei]; + const face_type& curPoints = locFcs[facei]; for (const label pointi : curPoints) { @@ -105,20 +89,13 @@ calcPointFaces() const } } - // sort out the list - pointFacesPtr_ = new labelListList(pointFcs.size()); - - labelListList& pf = *pointFacesPtr_; + // Copy the list + pointFacesPtr_.reset(new labelListList(pointFcs.size())); + auto& pf = *pointFacesPtr_; forAll(pointFcs, pointi) { - pf[pointi].setSize(pointFcs[pointi].size()); - - label i = 0; - for (const label facei : pointFcs[pointi]) - { - pf[pointi][i++] = facei; - } + pf[pointi] = pointFcs[pointi]; } DebugInfo diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchProjectPoints.C b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchProjectPoints.C index 52ed2479fdb01ab10a789848be2cec60391af82f..886a6062007f558934c8cf3ce407be1e4de71abc 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchProjectPoints.C +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchProjectPoints.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. @@ -36,20 +37,16 @@ Description // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> +template<class FaceList, class PointField> template<class ToPatch> Foam::List<Foam::objectHit> -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -projectPoints +Foam::PrimitivePatch<FaceList, PointField>::projectPoints ( const ToPatch& targetPatch, - const Field<PointType>& projectionDirection, + const Field + < + typename Foam::PrimitivePatch<FaceList, PointField>::point_type + >& projectionDirection, const intersection::algorithm alg, const intersection::direction dir ) const @@ -77,10 +74,10 @@ projectPoints const ToPatch& masterFaces = targetPatch; - const Field<PointType>& masterPoints = targetPatch.points(); + const Field<point_type>& masterPoints = targetPatch.points(); // Estimate face centre of target side - Field<PointType> masterFaceCentres(targetPatch.size()); + Field<point_type> masterFaceCentres(targetPatch.size()); forAll(masterFaceCentres, facei) { @@ -104,10 +101,10 @@ projectPoints // Pick up slave point and direction const label curLocalPointLabel = slavePointOrder[pointi]; - const PointType& curPoint = + const point_type& curPoint = points_[slaveMeshPoints[curLocalPointLabel]]; - const PointType& curProjectionDir = + const point_type& curProjectionDir = projectionDirection[curLocalPointLabel]; bool closer; @@ -133,7 +130,7 @@ projectPoints doNSquaredSearch = false; // Calculate intersection with curFace - PointHit<PointType> curHit = + PointHit<point_type> curHit = masterFaces[curFace].ray ( curPoint, @@ -169,7 +166,7 @@ projectPoints // face. This is cooked (illogical!) for fastest // surface walk. // - PointType missPlanePoint = + point_type missPlanePoint = curPoint + curProjectionDir*curHit.distance(); const labelList& masterNbrs = masterFaceFaces[curFace]; @@ -224,7 +221,7 @@ projectPoints forAll(masterFaces, facei) { - PointHit<PointType> curHit = + PointHit<point_type> curHit = masterFaces[facei].ray ( curPoint, @@ -279,20 +276,16 @@ projectPoints } -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> +template<class FaceList, class PointField> template<class ToPatch> Foam::List<Foam::objectHit> -Foam::PrimitivePatch<Face, FaceList, PointField, PointType>:: -projectFaceCentres +Foam::PrimitivePatch<FaceList, PointField>::projectFaceCentres ( const ToPatch& targetPatch, - const Field<PointType>& projectionDirection, + const Field + < + typename Foam::PrimitivePatch<FaceList, PointField>::point_type + >& projectionDirection, const intersection::algorithm alg, const intersection::direction dir ) const @@ -311,7 +304,7 @@ projectFaceCentres labelList slaveFaceOrder = bandCompression(faceFaces()); // calculate master face centres - Field<PointType> masterFaceCentres(targetPatch.size()); + Field<point_type> masterFaceCentres(targetPatch.size()); const labelListList& masterFaceFaces = targetPatch.faceFaces(); @@ -328,8 +321,7 @@ projectFaceCentres // Result List<objectHit> result(this->size()); - const PrimitivePatch<Face, FaceList, PointField, PointType>& slaveFaces = - *this; + const PrimitivePatch<FaceList, PointField>& slaveFaces = *this; const PointField& slaveGlobalPoints = points(); @@ -378,7 +370,7 @@ projectFaceCentres doNSquaredSearch = false; // Calculate intersection with curFace - PointHit<PointType> curHit = + PointHit<point_type> curHit = masterFaces[curFace].ray ( curFaceCentre, @@ -413,7 +405,7 @@ projectFaceCentres // Calculate the miss point. This is // cooked (illogical!) for fastest surface walk. // - PointType missPlanePoint = + point_type missPlanePoint = curFaceCentre + curProjectionDir*curHit.distance(); sqrDistance = @@ -465,7 +457,7 @@ projectFaceCentres forAll(masterFaces, facei) { - PointHit<PointType> curHit = + PointHit<point_type> curHit = masterFaces[facei].ray ( curFaceCentre, diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitivePatch/indirectPrimitivePatch.H b/src/OpenFOAM/meshes/primitiveMesh/primitivePatch/indirectPrimitivePatch.H index a170f8cfd5104586eb9dc94be1e917e0a0532f8c..8363ce8f83375a19d9c036963c6209d7961a10ae 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitivePatch/indirectPrimitivePatch.H +++ b/src/OpenFOAM/meshes/primitiveMesh/primitivePatch/indirectPrimitivePatch.H @@ -45,7 +45,7 @@ Description namespace Foam { - typedef PrimitivePatch<face, IndirectList, const pointField&> + typedef PrimitivePatch<IndirectList<face>, const pointField&> indirectPrimitivePatch; } diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitivePatch/primitiveFacePatch.H b/src/OpenFOAM/meshes/primitiveMesh/primitivePatch/primitiveFacePatch.H index 0406e4cbc1050eb0bf3a4ed5a2e906fbd8a7fc27..a84f122510cf24d46ac80ae4ee7258e79569b9d3 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitivePatch/primitiveFacePatch.H +++ b/src/OpenFOAM/meshes/primitiveMesh/primitivePatch/primitiveFacePatch.H @@ -47,7 +47,7 @@ Description namespace Foam { - typedef PrimitivePatch<face, List, const pointField&> + typedef PrimitivePatch<List<face>, const pointField&> primitiveFacePatch; } diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitivePatch/primitivePatch.H b/src/OpenFOAM/meshes/primitiveMesh/primitivePatch/primitivePatch.H index 2b78ffc6378e0992c175da9b1d986a72f573e7f7..4d811d22040635cace9df4b81cb96a19e731186d 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitivePatch/primitivePatch.H +++ b/src/OpenFOAM/meshes/primitiveMesh/primitivePatch/primitivePatch.H @@ -47,7 +47,7 @@ Description namespace Foam { - typedef PrimitivePatch<face, SubList, const pointField&> + typedef PrimitivePatch<SubList<face>, const pointField&> primitivePatch; } diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitivePatch/uindirectPrimitivePatch.H b/src/OpenFOAM/meshes/primitiveMesh/primitivePatch/uindirectPrimitivePatch.H index 4c5ca8a6a340b6703118454252af018f56a00513..15e6de830d63b1b59819d2bd25ab9f3688f75935 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitivePatch/uindirectPrimitivePatch.H +++ b/src/OpenFOAM/meshes/primitiveMesh/primitivePatch/uindirectPrimitivePatch.H @@ -45,7 +45,7 @@ Description namespace Foam { - typedef PrimitivePatch<face, UIndirectList, const pointField&> + typedef PrimitivePatch<UIndirectList<face>, const pointField&> uindirectPrimitivePatch; } diff --git a/src/dynamicFaMesh/interfaceTrackingFvMesh/interfaceTrackingFvMesh.C b/src/dynamicFaMesh/interfaceTrackingFvMesh/interfaceTrackingFvMesh.C index 880c98ca0e3b950ed747a8ff50ffce2c33e34b8d..eb9383a825dea644c6993d5b561b759cd7c0ccb6 100644 --- a/src/dynamicFaMesh/interfaceTrackingFvMesh/interfaceTrackingFvMesh.C +++ b/src/dynamicFaMesh/interfaceTrackingFvMesh/interfaceTrackingFvMesh.C @@ -45,6 +45,7 @@ License #include "twoDPointCorrector.H" #include "gravityMeshObject.H" #include "turbulentTransportModel.H" +#include "demandDrivenData.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // diff --git a/src/dynamicFaMesh/interfaceTrackingFvMesh/interfaceTrackingFvMesh.H b/src/dynamicFaMesh/interfaceTrackingFvMesh/interfaceTrackingFvMesh.H index 638ad8cce4d139e003da1e8cb4826cee739d29c6..33c4c4c95101731eafe44de623f221e267871357 100644 --- a/src/dynamicFaMesh/interfaceTrackingFvMesh/interfaceTrackingFvMesh.H +++ b/src/dynamicFaMesh/interfaceTrackingFvMesh/interfaceTrackingFvMesh.H @@ -44,6 +44,7 @@ SourceFiles #include "surfaceFields.H" #include "surfactantProperties.H" #include "singlePhaseTransportModel.H" +#include "demandDrivenData.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/dynamicMesh/attachDetach/attachDetach.C b/src/dynamicMesh/attachDetach/attachDetach.C index eb05ece4de0262f59f89ce10195d189a9494292f..151d104e24e19ce86a1e7bbb1ae8bc1bc7ae3c03 100644 --- a/src/dynamicMesh/attachDetach/attachDetach.C +++ b/src/dynamicMesh/attachDetach/attachDetach.C @@ -24,11 +24,6 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. -Description - Attach/detach boundary mesh modifier. This modifier takes a set of - internal faces and converts them into boundary faces and vice versa - based on the given activation switch. - \*---------------------------------------------------------------------------*/ #include "attachDetach.H" @@ -38,6 +33,7 @@ Description #include "primitiveMesh.H" #include "polyTopoChange.H" #include "addToRunTimeSelectionTable.H" +#include "demandDrivenData.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // diff --git a/src/dynamicMesh/boundaryMesh/bMesh.H b/src/dynamicMesh/boundaryMesh/bMesh.H index 5f7160815c4ba481fdaa2f43ae03133fbfba1e69..a41a250204f6a4ce4a17baf1ab05a286ca159fb5 100644 --- a/src/dynamicMesh/boundaryMesh/bMesh.H +++ b/src/dynamicMesh/boundaryMesh/bMesh.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -44,7 +45,7 @@ Description namespace Foam { - typedef PrimitivePatch<face, List, const pointField> bMesh; + typedef PrimitivePatch<List<face>, const pointField> bMesh; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/dynamicMesh/layerAdditionRemoval/layerAdditionRemoval.C b/src/dynamicMesh/layerAdditionRemoval/layerAdditionRemoval.C index 56c297267de76afb9758381fa87f10b7f1c37f56..a7d9b46b619869e39fa5b6b75eb9f7195b0be0a4 100644 --- a/src/dynamicMesh/layerAdditionRemoval/layerAdditionRemoval.C +++ b/src/dynamicMesh/layerAdditionRemoval/layerAdditionRemoval.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. @@ -23,9 +24,6 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. -Description - Cell layer addition/removal mesh modifier - \*---------------------------------------------------------------------------*/ #include "layerAdditionRemoval.H" @@ -35,6 +33,7 @@ Description #include "primitiveMesh.H" #include "polyTopoChange.H" #include "addToRunTimeSelectionTable.H" +#include "demandDrivenData.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // diff --git a/src/dynamicMesh/slidingInterface/coupleSlidingInterface.C b/src/dynamicMesh/slidingInterface/coupleSlidingInterface.C index 74fc0f4a872f5e039ac4859d098cbc7a4c9889a1..500eba7ee1bf1ba47b6101284d0923aec809cc48 100644 --- a/src/dynamicMesh/slidingInterface/coupleSlidingInterface.C +++ b/src/dynamicMesh/slidingInterface/coupleSlidingInterface.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. @@ -42,6 +42,7 @@ License #include "polyModifyPoint.H" #include "polyModifyFace.H" #include "polyRemoveFace.H" +#include "demandDrivenData.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // diff --git a/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatchCutFaces.C b/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatchCutFaces.C index 938cdfa2c09b8629dad495917ccd8cd4c2a4aa28..3452c0d4fa28cb8421d50d4148d39926faf5b59c 100644 --- a/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatchCutFaces.C +++ b/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatchCutFaces.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. @@ -36,6 +36,7 @@ Description #include "labelPair.H" #include "primitiveMesh.H" #include "edgeHashes.H" +#include "demandDrivenData.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // diff --git a/src/dynamicMesh/slidingInterface/slidingInterface.C b/src/dynamicMesh/slidingInterface/slidingInterface.C index 6498192299f2955d74ecb3b28709584ca0a0f431..d674a6bd909e5cc52779ab29cc9868218921bd2e 100644 --- a/src/dynamicMesh/slidingInterface/slidingInterface.C +++ b/src/dynamicMesh/slidingInterface/slidingInterface.C @@ -32,6 +32,7 @@ License #include "polyTopoChange.H" #include "addToRunTimeSelectionTable.H" #include "plane.H" +#include "demandDrivenData.H" // Index of debug signs: // p - adjusting a projection point diff --git a/src/dynamicMesh/slidingInterface/slidingInterfaceAttachedAddressing.C b/src/dynamicMesh/slidingInterface/slidingInterfaceAttachedAddressing.C index 193c67c871c40b89c76270633daee67a5b1879c4..cb9429a18c41323068bd2d894d55b123734c2b7f 100644 --- a/src/dynamicMesh/slidingInterface/slidingInterfaceAttachedAddressing.C +++ b/src/dynamicMesh/slidingInterface/slidingInterfaceAttachedAddressing.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2017-2019 OpenCFD Ltd. + Copyright (C) 2017-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -30,6 +30,7 @@ License #include "polyMesh.H" #include "mapPolyMesh.H" #include "polyTopoChanger.H" +#include "demandDrivenData.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/dynamicMesh/slidingInterface/slidingInterfaceProjectPoints.C b/src/dynamicMesh/slidingInterface/slidingInterfaceProjectPoints.C index a0537581130fb7a779b629ff01d4e5d441a17f62..0ec1736e5af993db7234ac839d0addf32cdd51ef 100644 --- a/src/dynamicMesh/slidingInterface/slidingInterfaceProjectPoints.C +++ b/src/dynamicMesh/slidingInterface/slidingInterfaceProjectPoints.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. @@ -30,6 +30,7 @@ License #include "polyMesh.H" #include "line.H" #include "polyTopoChanger.H" +#include "demandDrivenData.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // diff --git a/src/finiteArea/faMesh/faMeshMapper/faAreaMapper.C b/src/finiteArea/faMesh/faMeshMapper/faAreaMapper.C index d46642f506947546ecb941edf431d54ce4a31e5f..3f179bc6b7c7d02c130a17492502f0299c779ded 100644 --- a/src/finiteArea/faMesh/faMeshMapper/faAreaMapper.C +++ b/src/finiteArea/faMesh/faMeshMapper/faAreaMapper.C @@ -23,13 +23,11 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. -Description - FV surface mapper. - \*---------------------------------------------------------------------------*/ #include "faAreaMapper.H" #include "mapPolyMesh.H" +#include "demandDrivenData.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/finiteArea/faMesh/faMeshMapper/faEdgeMapper.C b/src/finiteArea/faMesh/faMeshMapper/faEdgeMapper.C index 65366cd224a6c65315fadac56d7e919af49d8433..dd0684a39c5a5e982a6852edd7280d2803f7304e 100644 --- a/src/finiteArea/faMesh/faMeshMapper/faEdgeMapper.C +++ b/src/finiteArea/faMesh/faMeshMapper/faEdgeMapper.C @@ -23,13 +23,11 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. -Description - FA edge mapper. - \*---------------------------------------------------------------------------*/ #include "faEdgeMapper.H" #include "mapPolyMesh.H" +#include "demandDrivenData.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/finiteArea/faMesh/faMeshMapper/faPatchMapper.C b/src/finiteArea/faMesh/faMeshMapper/faPatchMapper.C index 43b09850e9217adb8813ed1b000a4f1180cbd36e..569a2c02f38bd35ec80dde76f64c0fb8cc0615d5 100644 --- a/src/finiteArea/faMesh/faMeshMapper/faPatchMapper.C +++ b/src/finiteArea/faMesh/faMeshMapper/faPatchMapper.C @@ -31,6 +31,7 @@ License #include "faMesh.H" #include "mapPolyMesh.H" #include "faceMapper.H" +#include "demandDrivenData.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/finiteArea/faMesh/faPatches/constraint/processor/processorFaPatch.C b/src/finiteArea/faMesh/faPatches/constraint/processor/processorFaPatch.C index 53668ec07a57307b955abb5ab2ddba6f1f5e76bb..b05ae98dee06cd1a817dc44e32896f1c65676c16 100644 --- a/src/finiteArea/faMesh/faPatches/constraint/processor/processorFaPatch.C +++ b/src/finiteArea/faMesh/faPatches/constraint/processor/processorFaPatch.C @@ -33,6 +33,7 @@ License #include "faBoundaryMesh.H" #include "faMesh.H" #include "globalMeshData.H" +#include "demandDrivenData.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteArea/faMesh/faPatches/faPatch/faPatch.C b/src/finiteArea/faMesh/faPatches/faPatch/faPatch.C index be6d21cc9054e61ff5da2872e0067cb7a025f35f..2c954b2eea8917773061527d2a9878e975733e16 100644 --- a/src/finiteArea/faMesh/faPatches/faPatch/faPatch.C +++ b/src/finiteArea/faMesh/faPatches/faPatch/faPatch.C @@ -33,6 +33,7 @@ License #include "areaFields.H" #include "edgeFields.H" #include "polyMesh.H" +#include "demandDrivenData.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // diff --git a/src/finiteArea/finiteArea/gradSchemes/leastSquaresFaGrad/leastSquaresFaVectors.C b/src/finiteArea/finiteArea/gradSchemes/leastSquaresFaGrad/leastSquaresFaVectors.C index 04e2ad832e017df6a3fdf5b8458371de6616642f..730aeaa699def642de9af1076eda95692e9e7869 100644 --- a/src/finiteArea/finiteArea/gradSchemes/leastSquaresFaGrad/leastSquaresFaVectors.C +++ b/src/finiteArea/finiteArea/gradSchemes/leastSquaresFaGrad/leastSquaresFaVectors.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2016-2017 Wikki Ltd + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -29,6 +30,7 @@ License #include "edgeFields.H" #include "areaFields.H" #include "mapPolyMesh.H" +#include "demandDrivenData.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -61,12 +63,8 @@ Foam::leastSquaresFaVectors::~leastSquaresFaVectors() void Foam::leastSquaresFaVectors::makeLeastSquaresVectors() const { - if (debug) - { - Info<< "leastSquaresFaVectors::makeLeastSquaresVectors() :" - << "Constructing finite area least square gradient vectors" - << endl; - } + DebugInFunction + << "Constructing finite area least square gradient vectors" << nl; pVectorsPtr_ = new edgeVectorField ( @@ -213,12 +211,8 @@ void Foam::leastSquaresFaVectors::makeLeastSquaresVectors() const } } - if (debug) - { - Info<< "leastSquaresFaVectors::makeLeastSquaresVectors() :" - << "Finished constructing finite area least square gradient vectors" - << endl; - } + DebugInFunction + << "Done constructing finite area least square gradient vectors" << nl; } @@ -246,11 +240,8 @@ const Foam::edgeVectorField& Foam::leastSquaresFaVectors::nVectors() const bool Foam::leastSquaresFaVectors::movePoints() { - if (debug) - { - InfoIn("bool leastSquaresFaVectors::movePoints()") - << "Clearing least square data" << endl; - } + DebugInFunction + << "Clearing least square data" << nl; deleteDemandDrivenData(pVectorsPtr_); deleteDemandDrivenData(nVectorsPtr_); diff --git a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C index 1aeeb961e0985ef1c3a4a7c3c12f92d1f5d138a4..1e1b5b626577097734f87818a0875a37c534aa73 100644 --- a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C +++ b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2016-2019 OpenCFD Ltd. + Copyright (C) 2016-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -32,6 +32,7 @@ License #include "extrapolatedCalculatedFvPatchFields.H" #include "coupledFvPatchFields.H" #include "UIndirectList.H" +#include "demandDrivenData.H" // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // diff --git a/src/finiteVolume/fvMesh/fvMeshMapper/fvPatchMapper.C b/src/finiteVolume/fvMesh/fvMeshMapper/fvPatchMapper.C index 1aa1dca8af45a86d7fde7227ace61bd77b8ff4e3..f20ee1c78ef9c90bb8318ad75643ea97660c0d56 100644 --- a/src/finiteVolume/fvMesh/fvMeshMapper/fvPatchMapper.C +++ b/src/finiteVolume/fvMesh/fvMeshMapper/fvPatchMapper.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. @@ -31,6 +32,7 @@ License #include "fvMesh.H" #include "mapPolyMesh.H" #include "faceMapper.H" +#include "demandDrivenData.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/finiteVolume/fvMesh/fvMeshMapper/fvSurfaceMapper.C b/src/finiteVolume/fvMesh/fvMeshMapper/fvSurfaceMapper.C index 0fc3a3115ef489d3bb694f45ab099d8be48a6f7f..a03873f01a63a9ece8aa92ea8dfb06da42f2aefc 100644 --- a/src/finiteVolume/fvMesh/fvMeshMapper/fvSurfaceMapper.C +++ b/src/finiteVolume/fvMesh/fvMeshMapper/fvSurfaceMapper.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. @@ -23,15 +24,13 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. -Description - FV surface mapper. - \*---------------------------------------------------------------------------*/ #include "fvSurfaceMapper.H" #include "fvMesh.H" #include "mapPolyMesh.H" #include "faceMapper.H" +#include "demandDrivenData.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/weightedFlux/weightedFlux.C b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/weightedFlux/weightedFlux.C index 3f09d27bd7df6b81a42a5e9b16576f3052b12cf3..2c05456f9c7b218ec72d02a841f91de2d9da194a 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/weightedFlux/weightedFlux.C +++ b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/weightedFlux/weightedFlux.C @@ -26,6 +26,7 @@ License \*---------------------------------------------------------------------------*/ #include "weightedFlux.H" +#include "demandDrivenData.H" // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // diff --git a/src/fvAgglomerationMethods/pairPatchAgglomeration/pairPatchAgglomeration.H b/src/fvAgglomerationMethods/pairPatchAgglomeration/pairPatchAgglomeration.H index ba523fb5c4e9848d60ab2764cd88df7dbff73247..bf2827ce9a78eeb47ec21843df06e8da5b5c83e5 100644 --- a/src/fvAgglomerationMethods/pairPatchAgglomeration/pairPatchAgglomeration.H +++ b/src/fvAgglomerationMethods/pairPatchAgglomeration/pairPatchAgglomeration.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2016 OpenCFD Ltd. + Copyright (C) 2016-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -56,7 +56,7 @@ class pairPatchAgglomeration { protected: - typedef PrimitivePatch<face, List, const pointField> bPatch; + typedef PrimitivePatch<List<face>, const pointField> bPatch; // Protected data diff --git a/src/meshTools/edgeMesh/extendedEdgeMesh/extendedEdgeMesh.C b/src/meshTools/edgeMesh/extendedEdgeMesh/extendedEdgeMesh.C index 6cbf27880748a9f7849f331aa76a3fd6897f51b0..439efb3fdeb9850296ebf0a406146f07616bbda7 100644 --- a/src/meshTools/edgeMesh/extendedEdgeMesh/extendedEdgeMesh.C +++ b/src/meshTools/edgeMesh/extendedEdgeMesh/extendedEdgeMesh.C @@ -541,7 +541,7 @@ Foam::extendedEdgeMesh::extendedEdgeMesh Foam::extendedEdgeMesh::extendedEdgeMesh ( - const PrimitivePatch<face, List, pointField, point>& surf, + const PrimitivePatch<faceList, pointField>& surf, const labelUList& featureEdges, const labelUList& regionFeatureEdges, const labelUList& featurePoints diff --git a/src/meshTools/edgeMesh/extendedEdgeMesh/extendedEdgeMesh.H b/src/meshTools/edgeMesh/extendedEdgeMesh/extendedEdgeMesh.H index 3ae1747a3b996fba72a7ba1920d99cc171eac1ea..3eb6d3395f06b88ba3efc469cf4ca444f45761ce 100644 --- a/src/meshTools/edgeMesh/extendedEdgeMesh/extendedEdgeMesh.H +++ b/src/meshTools/edgeMesh/extendedEdgeMesh/extendedEdgeMesh.H @@ -308,7 +308,7 @@ public: //- Construct from PrimitivePatch extendedEdgeMesh ( - const PrimitivePatch<face, List, pointField, point>& surf, + const PrimitivePatch<faceList, pointField>& surf, const labelUList& featureEdges, const labelUList& regionFeatureEdges, const labelUList& featurePoints diff --git a/src/meshTools/edgeMesh/extendedEdgeMesh/extendedFeatureEdgeMesh/extendedFeatureEdgeMesh.C b/src/meshTools/edgeMesh/extendedEdgeMesh/extendedFeatureEdgeMesh/extendedFeatureEdgeMesh.C index 6e8a4a069dad58ad006804211da3379ec4fbb436..b51de2697beebf56043c156bc05aa2f429678368 100644 --- a/src/meshTools/edgeMesh/extendedEdgeMesh/extendedFeatureEdgeMesh/extendedFeatureEdgeMesh.C +++ b/src/meshTools/edgeMesh/extendedEdgeMesh/extendedFeatureEdgeMesh/extendedFeatureEdgeMesh.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -122,7 +123,7 @@ Foam::extendedFeatureEdgeMesh::extendedFeatureEdgeMesh Foam::extendedFeatureEdgeMesh::extendedFeatureEdgeMesh ( const IOobject& io, - const PrimitivePatch<face, List, pointField, point>& surf, + const PrimitivePatch<faceList, pointField>& surf, const labelUList& featureEdges, const labelUList& regionFeatureEdges, const labelUList& featurePoints diff --git a/src/meshTools/edgeMesh/extendedEdgeMesh/extendedFeatureEdgeMesh/extendedFeatureEdgeMesh.H b/src/meshTools/edgeMesh/extendedEdgeMesh/extendedFeatureEdgeMesh/extendedFeatureEdgeMesh.H index 940dd2e87c685dc742e805be2e8c3e0d275efce7..26190e2f1a8942f006f9ad0dacb1c8d6593fb4fb 100644 --- a/src/meshTools/edgeMesh/extendedEdgeMesh/extendedFeatureEdgeMesh/extendedFeatureEdgeMesh.H +++ b/src/meshTools/edgeMesh/extendedEdgeMesh/extendedFeatureEdgeMesh/extendedFeatureEdgeMesh.H @@ -94,7 +94,7 @@ public: extendedFeatureEdgeMesh ( const IOobject& io, - const PrimitivePatch<face, List, pointField, point>& surf, + const PrimitivePatch<faceList, pointField>& surf, const labelUList& featureEdges, const labelUList& regionFeatureEdges, const labelUList& featurePoints diff --git a/src/meshTools/searchableSurfaces/triSurfaceMesh/triSurfaceMesh.C b/src/meshTools/searchableSurfaces/triSurfaceMesh/triSurfaceMesh.C index fadb41dab1460f1ca3be24131ad2bc8330d16485..f80643164b930f9d3423f99bb69e62434e8008b7 100644 --- a/src/meshTools/searchableSurfaces/triSurfaceMesh/triSurfaceMesh.C +++ b/src/meshTools/searchableSurfaces/triSurfaceMesh/triSurfaceMesh.C @@ -554,7 +554,7 @@ Foam::tmp<Foam::pointField> Foam::triSurfaceMesh::coordinates() const // Calculate face centres from a copy to avoid incurring // additional storage - pts = PrimitivePatch<labelledTri, SubList, const pointField&> + pts = PrimitivePatch<FaceListType, const pointField&> ( FaceListType(*this, triSurface::size()), triSurface::points() diff --git a/src/meshTools/triSurface/triSurfaceSearch/triSurfaceRegionSearch.H b/src/meshTools/triSurface/triSurfaceSearch/triSurfaceRegionSearch.H index 1c2f98243581f179438272350097b32e84a88039..724617d1321275ddc266ca0f305fc89170da2e6e 100644 --- a/src/meshTools/triSurface/triSurfaceSearch/triSurfaceRegionSearch.H +++ b/src/meshTools/triSurface/triSurfaceSearch/triSurfaceRegionSearch.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -59,14 +60,10 @@ class triSurfaceRegionSearch : public triSurfaceSearch { - // Private typedefs - - typedef PrimitivePatch - < - labelledTri, - IndirectList, - const pointField& - > indirectTriSurface; + // Private Typedefs + + typedef PrimitivePatch<IndirectList<labelledTri>, const pointField&> + indirectTriSurface; typedef treeDataPrimitivePatch<indirectTriSurface> treeDataIndirectTriSurface; diff --git a/src/meshTools/twoDPointCorrector/twoDPointCorrector.C b/src/meshTools/twoDPointCorrector/twoDPointCorrector.C index 5ad768485af48582296d8a01d3f0919bffdee5d7..29fcae294fab799a20039f92b627d00c42428442 100644 --- a/src/meshTools/twoDPointCorrector/twoDPointCorrector.C +++ b/src/meshTools/twoDPointCorrector/twoDPointCorrector.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -32,6 +32,7 @@ License #include "emptyPolyPatch.H" #include "SubField.H" #include "meshTools.H" +#include "demandDrivenData.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // diff --git a/src/surfMesh/MeshedSurface/MeshedSurface.H b/src/surfMesh/MeshedSurface/MeshedSurface.H index 294efe5a203e749198dd3615d5044ad00a3b9c19..9e9e0e473fe08033f65221dfb3f2616f6a5204dd 100644 --- a/src/surfMesh/MeshedSurface/MeshedSurface.H +++ b/src/surfMesh/MeshedSurface/MeshedSurface.H @@ -95,7 +95,7 @@ Ostream& operator<<(Ostream&, const MeshedSurface<Face>&); template<class Face> class MeshedSurface : - public PrimitivePatch<Face, ::Foam::List, pointField, point>, + public PrimitivePatch<::Foam::List<Face>, pointField>, public fileFormats::surfaceFormatsCore { // Friends, regardless of face representations @@ -111,7 +111,7 @@ private: // Private Typedefs (convenience) //- Internal mesh storage type - typedef PrimitivePatch<Face, ::Foam::List, pointField, point> + typedef PrimitivePatch<::Foam::List<Face>, pointField> MeshReference; typedef UnsortedMeshedSurface<Face> FriendType; diff --git a/src/surfMesh/polySurface/polySurface.H b/src/surfMesh/polySurface/polySurface.H index c0ffc66e1e699b89271e4cc0f22ab9fa265f4e5d..98fa34f72563db01a99c2f3815c22f1964178172 100644 --- a/src/surfMesh/polySurface/polySurface.H +++ b/src/surfMesh/polySurface/polySurface.H @@ -68,7 +68,7 @@ template<class Face> class MeshedSurface; class polySurface : public objectRegistry, - public PrimitivePatch<face, ::Foam::List, pointField, point>, + public PrimitivePatch<::Foam::List<face>, pointField>, public meshedSurf { public: @@ -88,7 +88,7 @@ private: // Private Typedefs //- Internal mesh storage type - typedef PrimitivePatch<face, ::Foam::List, pointField, point> + typedef PrimitivePatch<::Foam::List<face>, pointField> MeshReference; diff --git a/src/surfMesh/surfMesh/surfMesh.H b/src/surfMesh/surfMesh/surfMesh.H index dd3582fb616ffde0ee7a88c40e73421489520e01..70e0bad1e0398fce37b2e09d43e549ed660ecbd5 100644 --- a/src/surfMesh/surfMesh/surfMesh.H +++ b/src/surfMesh/surfMesh/surfMesh.H @@ -65,7 +65,7 @@ class surfMesh : public surfaceRegistry, private Detail::MeshedSurfaceIOAllocator, - public PrimitivePatch<face, UList, const pointField&, point> + public PrimitivePatch<::Foam::UList<face>, const pointField&> { public: @@ -91,7 +91,7 @@ private: typedef Detail::MeshedSurfaceIOAllocator Allocator; //- Internal mesh storage type - typedef PrimitivePatch<face, UList, const pointField&, point> + typedef PrimitivePatch<::Foam::UList<face>, const pointField&> MeshReference; diff --git a/src/surfMesh/surfaceFormats/ac3d/AC3DsurfaceFormat.C b/src/surfMesh/surfaceFormats/ac3d/AC3DsurfaceFormat.C index ae6d279015f09422f30efecd299c2ceaf42540b2..c5a2c35949229fa4cdc42850deffc3fbcfe6dbc1 100644 --- a/src/surfMesh/surfaceFormats/ac3d/AC3DsurfaceFormat.C +++ b/src/surfMesh/surfaceFormats/ac3d/AC3DsurfaceFormat.C @@ -335,7 +335,7 @@ void Foam::fileFormats::AC3DsurfaceFormat<Face>::write if (zones.size() == 1) { - PrimitivePatch<Face, UList, const pointField&> patch + PrimitivePatch<UList<Face>, const pointField&> patch ( faceLst, pointLst ); @@ -349,10 +349,13 @@ void Foam::fileFormats::AC3DsurfaceFormat<Face>::write { if (useFaceMap) { + typedef UIndirectList<Face> FaceListType; + SubList<label> zoneMap(surf.faceMap(), zone.range()); - PrimitivePatch<Face, UIndirectList, const pointField&> patch + + PrimitivePatch<FaceListType, const pointField&> patch ( - UIndirectList<Face>(faceLst, zoneMap), + FaceListType(faceLst, zoneMap), pointLst ); @@ -360,9 +363,11 @@ void Foam::fileFormats::AC3DsurfaceFormat<Face>::write } else { - PrimitivePatch<Face, UList, const pointField&> patch + typedef SubList<Face> FaceListType; + + PrimitivePatch<FaceListType, const pointField&> patch ( - SubList<Face>(faceLst, zone.range()), + FaceListType(faceLst, zone.range()), pointLst ); @@ -416,10 +421,13 @@ void Foam::fileFormats::AC3DsurfaceFormat<Face>::write label zoneIndex = 0; for (const surfZone& zone : zoneLst) { + typedef UIndirectList<Face> FaceListType; + SubList<label> zoneMap(faceMap, zone.range()); - PrimitivePatch<Face, UIndirectList, const pointField&> patch + + PrimitivePatch<FaceListType, const pointField&> patch ( - UIndirectList<Face>(surf.surfFaces(), zoneMap), + FaceListType(surf.surfFaces(), zoneMap), surf.points() ); diff --git a/src/surfMesh/triSurface/triSurface.H b/src/surfMesh/triSurface/triSurface.H index c87a3525a0d05f10940fdb244f842e4da4de012d..b920abc69a839bb286288decd8bde18e5916a4ca 100644 --- a/src/surfMesh/triSurface/triSurface.H +++ b/src/surfMesh/triSurface/triSurface.H @@ -76,12 +76,12 @@ Ostream& operator<<(Ostream&, const triSurface&); class triSurface : - public PrimitivePatch<labelledTri, ::Foam::List, pointField, point> + public PrimitivePatch<::Foam::List<labelledTri>, pointField> { // Private Typedefs //- Internal mesh storage type - typedef PrimitivePatch<labelledTri, ::Foam::List, pointField, point> + typedef PrimitivePatch<::Foam::List<labelledTri>, pointField> MeshReference; diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/TDACChemistryModel/tabulation/ISAT/ISAT.C b/src/thermophysicalModels/chemistryModel/chemistryModel/TDACChemistryModel/tabulation/ISAT/ISAT.C index fba683dfd3e81ccabd1c18c59c3fb0ee0174a74d..4164a3cab15cf9171a9e729854054587ab9d197b 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/TDACChemistryModel/tabulation/ISAT/ISAT.C +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/TDACChemistryModel/tabulation/ISAT/ISAT.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2016-2017 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -28,6 +28,7 @@ License #include "ISAT.H" #include "LUscalarMatrix.H" +#include "demandDrivenData.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/TDACChemistryModel/tabulation/ISAT/binaryTree/binaryTree.C b/src/thermophysicalModels/chemistryModel/chemistryModel/TDACChemistryModel/tabulation/ISAT/binaryTree/binaryTree.C index 5ec78f440b2f9ee259a7d1fe2af6264793ed1cf0..3455b29606223e8f14a78e91bece2aab1b5cd7f5 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/TDACChemistryModel/tabulation/ISAT/binaryTree/binaryTree.C +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/TDACChemistryModel/tabulation/ISAT/binaryTree/binaryTree.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2016-2017 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -28,6 +28,7 @@ License #include "binaryTree.H" #include "SortableList.H" +#include "demandDrivenData.H" // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // diff --git a/src/topoChangerFvMesh/mixerFvMesh/mixerFvMesh.C b/src/topoChangerFvMesh/mixerFvMesh/mixerFvMesh.C index b43173f6c773707dc7664b92144815ba1927f490..688ddc4af54c8e355314374938cb2d0d6009b982 100644 --- a/src/topoChangerFvMesh/mixerFvMesh/mixerFvMesh.C +++ b/src/topoChangerFvMesh/mixerFvMesh/mixerFvMesh.C @@ -33,6 +33,7 @@ License #include "addToRunTimeSelectionTable.H" #include "mapPolyMesh.H" #include "unitConversion.H" +#include "demandDrivenData.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //