diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkOpenFOAMTupleRemap.H b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkOpenFOAMTupleRemap.H new file mode 100644 index 0000000000..d6d511a49f --- /dev/null +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkOpenFOAMTupleRemap.H @@ -0,0 +1,72 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +InClass + vtkPV3Foam + +\*---------------------------------------------------------------------------*/ + +#ifndef vtkOpenFOAMTupleRemap_H +#define vtkOpenFOAMTupleRemap_H + +// OpenFOAM includes +#include "StaticAssert.H" +#include "Swap.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template +inline void vtkOpenFOAMTupleRemap(float vec[]); + + +// a symmTensor specialization to remap OpenFOAM -> ParaView naming order +// Qt/Core/pqScalarBarRepresentation.cxx defines this order +// { "XX", "YY", "ZZ", "XY", "YZ", "XZ" } +// in pqScalarBarRepresentation::getDefaultComponentLabel() +// whereas OpenFOAM uses this order +// { XX, XY, XZ, YY, YZ, ZZ } +// +// for extra safety, assert that symmTensor indeed has 6 components +StaticAssert(Foam::symmTensor::nComponents == 6); + + +// Template specialization for symmTensor +template<> +inline void vtkOpenFOAMTupleRemap(float vec[]) +{ + Foam::Swap(vec[1], vec[3]); // swap XY <-> YY + Foam::Swap(vec[2], vec[5]); // swap XZ <-> ZZ +} + + +template +inline void vtkOpenFOAMTupleRemap(float vec[]) +{} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamFaceField.H b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamFaceField.H index 72b23e4059..79c8b1aa97 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamFaceField.H +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamFaceField.H @@ -36,6 +36,8 @@ InClass #include "vtkMultiBlockDataSet.h" #include "vtkPolyData.h" +#include "vtkOpenFOAMTupleRemap.H" + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // template @@ -80,7 +82,7 @@ void Foam::vtkPV3Foam::convertFaceField { Type t = 0.5*(tf[faceOwner[faceNo]] + tf[faceNeigh[faceNo]]); - for (direction d=0; d(vec); cellData->InsertTuple(faceI, vec); } @@ -152,7 +155,7 @@ void Foam::vtkPV3Foam::convertFaceField { Type t = 0.5*(tf[faceOwner[faceNo]] + tf[faceNeigh[faceNo]]); - for (direction d=0; d(vec); cellData->InsertTuple(faceI, vec); ++faceI; diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamLagrangianFields.H b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamLagrangianFields.H index a88a7cfb9e..c3013022e8 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamLagrangianFields.H +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamLagrangianFields.H @@ -32,6 +32,8 @@ InClass #include "Cloud.H" +#include "vtkOpenFOAMTupleRemap.H" + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // template @@ -86,10 +88,11 @@ void Foam::vtkPV3Foam::convertLagrangianField forAll(tf, i) { const Type& t = tf[i]; - for (direction d=0; d(vec); pointData->InsertTuple(i, vec); } diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPatchField.H b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPatchField.H index da55b9f2c3..6276a73fa8 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPatchField.H +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPatchField.H @@ -37,6 +37,8 @@ InClass #include "vtkPointData.h" #include "vtkPolyData.h" +#include "vtkOpenFOAMTupleRemap.H" + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // template @@ -61,10 +63,12 @@ void Foam::vtkPV3Foam::convertPatchField forAll(ptf, i) { const Type& t = ptf[i]; - for (direction d=0; d(vec); + cellData->InsertTuple(i, vec); } @@ -101,10 +105,11 @@ void Foam::vtkPV3Foam::convertPatchPointField forAll(pptf, i) { const Type& t = pptf[i]; - for (direction d=0; d(vec); pointData->InsertTuple(i, vec); } diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPointFields.H b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPointFields.H index 38e5de9d25..1a4986682d 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPointFields.H +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPointFields.H @@ -33,6 +33,8 @@ InClass // Foam includes #include "interpolatePointToCell.H" +#include "vtkOpenFOAMTupleRemap.H" + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // template @@ -210,10 +212,12 @@ void Foam::vtkPV3Foam::convertPointField forAll(pointMap, i) { const Type& t = ptf[pointMap[i]]; - for (direction d=0; d(vec); + pointData->InsertTuple(i, vec); } } @@ -222,10 +226,12 @@ void Foam::vtkPV3Foam::convertPointField forAll(ptf, i) { const Type& t = ptf[i]; - for (direction d=0; d(vec); + pointData->InsertTuple(i, vec); } } @@ -238,10 +244,12 @@ void Foam::vtkPV3Foam::convertPointField forAll(addPointCellLabels, apI) { const Type& t = tf[addPointCellLabels[apI]]; - for (direction d=0; d(vec); + pointData->InsertTuple(i++, vec); } } @@ -250,10 +258,12 @@ void Foam::vtkPV3Foam::convertPointField forAll(addPointCellLabels, apI) { Type t = interpolatePointToCell(ptf, addPointCellLabels[apI]); - for (direction d=0; d(vec); + pointData->InsertTuple(i++, vec); } } diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamVolFields.H b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamVolFields.H index 7246542d75..3bcfefdb2a 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamVolFields.H +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamVolFields.H @@ -39,6 +39,8 @@ InClass #include "vtkPV3FoamFaceField.H" #include "vtkPV3FoamPatchField.H" +#include "vtkOpenFOAMTupleRemap.H" + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // template @@ -350,10 +352,12 @@ void Foam::vtkPV3Foam::convertVolField forAll(superCells, i) { const Type& t = tf[superCells[i]]; - for (direction d=0; d(vec); + celldata->InsertTuple(i, vec); }