From 60513758431dc78e9c3fe6c1b29789a3d65dcc40 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 1 Feb 2019 10:20:29 +0100 Subject: [PATCH] COMP: template specialization in incorrect namespace STYLE: avoid local variable name masking --- src/conversion/vtk/adaptor/foamVtkTools.H | 9 +++++--- .../vtk/adaptor/foamVtkToolsTemplates.C | 21 +++++++------------ 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/src/conversion/vtk/adaptor/foamVtkTools.H b/src/conversion/vtk/adaptor/foamVtkTools.H index 4636c7af71..3d35938abf 100644 --- a/src/conversion/vtk/adaptor/foamVtkTools.H +++ b/src/conversion/vtk/adaptor/foamVtkTools.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -280,9 +280,11 @@ namespace Tools }; +// Specializations + //- Template specialization for symmTensor ordering template<> -inline void Foam::vtk::Tools::remapTuple(float data[]) +inline void Tools::remapTuple(float data[]) { std::swap(data[1], data[3]); // swap XY <-> YY std::swap(data[2], data[5]); // swap XZ <-> ZZ @@ -291,7 +293,7 @@ inline void Foam::vtk::Tools::remapTuple(float data[]) //- Template specialization for symmTensor ordering template<> -inline void Foam::vtk::Tools::remapTuple(double data[]) +inline void Tools::remapTuple(double data[]) { std::swap(data[1], data[3]); // swap XY <-> YY std::swap(data[2], data[5]); // swap XZ <-> ZZ @@ -303,6 +305,7 @@ inline void Foam::vtk::Tools::remapTuple(double data[]) } // End namespace vtk } // End namespace Foam + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #include "foamVtkToolsI.H" diff --git a/src/conversion/vtk/adaptor/foamVtkToolsTemplates.C b/src/conversion/vtk/adaptor/foamVtkToolsTemplates.C index 49f64b43e1..ce7abd026a 100644 --- a/src/conversion/vtk/adaptor/foamVtkToolsTemplates.C +++ b/src/conversion/vtk/adaptor/foamVtkToolsTemplates.C @@ -21,22 +21,19 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . -InClass +InNamespace Foam::vtk::Tools \*---------------------------------------------------------------------------*/ -#ifndef foamVtkToolsTemplates_C -#define foamVtkToolsTemplates_C - // OpenFOAM includes #include "error.H" // VTK includes -#include -#include -#include -#include +#include "vtkFloatArray.h" +#include "vtkCellData.h" +#include "vtkPointData.h" +#include "vtkSmartPointer.h" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -52,9 +49,9 @@ Foam::vtk::Tools::Patch::points(const PatchType& p) vtkpoints->SetNumberOfPoints(pts.size()); vtkIdType pointId = 0; - for (const point& p : pts) + for (const point& pt : pts) { - vtkpoints->SetPoint(pointId++, p.v_); + vtkpoints->SetPoint(pointId++, pt.v_); } return vtkpoints; @@ -258,8 +255,4 @@ Foam::vtk::Tools::convertFieldToVTK } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - // ************************************************************************* // -- GitLab