From 374babde39642eb388d764898a8ea4e00bf133d0 Mon Sep 17 00:00:00 2001 From: mattijs <mattijs> Date: Mon, 2 Apr 2012 11:52:58 +0100 Subject: [PATCH] ENH: accessOp: move to classes --- .../Lists/ListListOps/ListListOps.C | 3 +- .../Lists/ListListOps/ListListOps.H | 10 ++-- src/OpenFOAM/meshes/meshShapes/face/face.H | 27 +++++++++- .../meshes/meshShapes/triFace/triFace.H | 27 +++++++++- .../PatchTools/PatchToolsGatherAndMerge.C | 53 +------------------ .../tools/labelledTri/labelledTri.H | 6 ++- 6 files changed, 63 insertions(+), 63 deletions(-) diff --git a/src/OpenFOAM/containers/Lists/ListListOps/ListListOps.C b/src/OpenFOAM/containers/Lists/ListListOps/ListListOps.C index 443e188ed1d..d83b4a9f3af 100644 --- a/src/OpenFOAM/containers/Lists/ListListOps/ListListOps.C +++ b/src/OpenFOAM/containers/Lists/ListListOps/ListListOps.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -106,6 +106,7 @@ AccessType ListListOps::combineOffset return result; } + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/OpenFOAM/containers/Lists/ListListOps/ListListOps.H b/src/OpenFOAM/containers/Lists/ListListOps/ListListOps.H index c35fc714c61..05cef4a723b 100644 --- a/src/OpenFOAM/containers/Lists/ListListOps/ListListOps.H +++ b/src/OpenFOAM/containers/Lists/ListListOps/ListListOps.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -92,10 +92,8 @@ SourceFiles namespace Foam { -// -//template <class T> class accessOp; -//template <class T> class offsetOp; -// Dummy access operator for combine() + +// Dummy access operator for ListListOps::combine() template <class T> class accessOp { @@ -108,7 +106,7 @@ public: }; -// Offset operator for combineOffset() +// Offset operator for ListListOps::combineOffset() template <class T> class offsetOp { diff --git a/src/OpenFOAM/meshes/meshShapes/face/face.H b/src/OpenFOAM/meshes/meshShapes/face/face.H index 3b2ffcc757a..c9cd3724dca 100644 --- a/src/OpenFOAM/meshes/meshShapes/face/face.H +++ b/src/OpenFOAM/meshes/meshShapes/face/face.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -50,6 +50,7 @@ SourceFiles #include "faceListFwd.H" #include "intersection.H" #include "pointHit.H" +#include "ListListOps.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -386,6 +387,30 @@ public: }; +//- Hash specialization to offset faces in ListListOps::combineOffset +template<> +class offsetOp<face> +{ + +public: + + inline face operator() + ( + const face& x, + const label offset + ) const + { + face result(x.size()); + + forAll(x, xI) + { + result[xI] = x[xI] + offset; + } + return result; + } +}; + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/OpenFOAM/meshes/meshShapes/triFace/triFace.H b/src/OpenFOAM/meshes/meshShapes/triFace/triFace.H index 8e5103ac2cb..24ad5d3d1cc 100644 --- a/src/OpenFOAM/meshes/meshShapes/triFace/triFace.H +++ b/src/OpenFOAM/meshes/meshShapes/triFace/triFace.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -46,6 +46,7 @@ SourceFiles #include "intersection.H" #include "pointField.H" #include "triPointRef.H" +#include "ListListOps.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -249,6 +250,30 @@ template<> inline bool contiguous<triFace>() {return true;} +//- Hash specialization to offset faces in ListListOps::combineOffset +template<> +class offsetOp<triFace> +{ + +public: + + inline triFace operator() + ( + const triFace& x, + const label offset + ) const + { + triFace result(x); + + forAll(x, xI) + { + result[xI] = x[xI] + offset; + } + return result; + } +}; + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsGatherAndMerge.C b/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsGatherAndMerge.C index 1d759d37835..89ffdec2ae2 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsGatherAndMerge.C +++ b/src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsGatherAndMerge.C @@ -28,58 +28,7 @@ License #include "mergePoints.H" #include "face.H" #include "triFace.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ - //- Used to offset faces in Pstream::combineOffset - template<> - class offsetOp<face> - { - - public: - - face operator() - ( - const face& x, - const label offset - ) const - { - face result(x.size()); - - forAll(x, xI) - { - result[xI] = x[xI] + offset; - } - return result; - } - }; - - //- Used to offset faces in Pstream::combineOffset - template<> - class offsetOp<triFace> - { - - public: - - triFace operator() - ( - const triFace& x, - const label offset - ) const - { - triFace result(x); - - forAll(x, xI) - { - result[xI] = x[xI] + offset; - } - return result; - } - }; -} - +#include "ListListOps.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // diff --git a/src/triSurface/tools/labelledTri/labelledTri.H b/src/triSurface/tools/labelledTri/labelledTri.H index a4bd26f825d..6f0c13065d5 100644 --- a/src/triSurface/tools/labelledTri/labelledTri.H +++ b/src/triSurface/tools/labelledTri/labelledTri.H @@ -36,6 +36,7 @@ SourceFiles #define labelledTri_H #include "triFace.H" +#include "ListListOps.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -114,14 +115,15 @@ public: template<> inline bool contiguous<labelledTri>() {return true;} -//- Used to offset faces in ListListOps::combineOffset + +//- Hash specialization to offset faces in ListListOps::combineOffset template<> class offsetOp<labelledTri> { public: - labelledTri operator() + inline labelledTri operator() ( const labelledTri& x, const label offset -- GitLab