BUG: match order of symmTensor tuples to match the paraview pqScalarBarRepresentation
This commit is contained in:
parent
7c70919cfe
commit
8c6a5dde5c
@ -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<class Type>
|
||||
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<Foam::symmTensor>(float vec[])
|
||||
{
|
||||
Foam::Swap(vec[1], vec[3]); // swap XY <-> YY
|
||||
Foam::Swap(vec[2], vec[5]); // swap XZ <-> ZZ
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
inline void vtkOpenFOAMTupleRemap(float vec[])
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
@ -36,6 +36,8 @@ InClass
|
||||
#include "vtkMultiBlockDataSet.h"
|
||||
#include "vtkPolyData.h"
|
||||
|
||||
#include "vtkOpenFOAMTupleRemap.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
@ -80,7 +82,7 @@ void Foam::vtkPV3Foam::convertFaceField
|
||||
{
|
||||
Type t = 0.5*(tf[faceOwner[faceNo]] + tf[faceNeigh[faceNo]]);
|
||||
|
||||
for (direction d=0; d<nComp; d++)
|
||||
for (direction d=0; d<nComp; ++d)
|
||||
{
|
||||
vec[d] = component(t, d);
|
||||
}
|
||||
@ -88,11 +90,12 @@ void Foam::vtkPV3Foam::convertFaceField
|
||||
else
|
||||
{
|
||||
const Type& t = tf[faceOwner[faceNo]];
|
||||
for (direction d=0; d<nComp; d++)
|
||||
for (direction d=0; d<nComp; ++d)
|
||||
{
|
||||
vec[d] = component(t, d);
|
||||
}
|
||||
}
|
||||
vtkOpenFOAMTupleRemap<Type>(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<nComp; d++)
|
||||
for (direction d=0; d<nComp; ++d)
|
||||
{
|
||||
vec[d] = component(t, d);
|
||||
}
|
||||
@ -160,11 +163,12 @@ void Foam::vtkPV3Foam::convertFaceField
|
||||
else
|
||||
{
|
||||
const Type& t = tf[faceOwner[faceNo]];
|
||||
for (direction d=0; d<nComp; d++)
|
||||
for (direction d=0; d<nComp; ++d)
|
||||
{
|
||||
vec[d] = component(t, d);
|
||||
}
|
||||
}
|
||||
vtkOpenFOAMTupleRemap<Type>(vec);
|
||||
|
||||
cellData->InsertTuple(faceI, vec);
|
||||
++faceI;
|
||||
|
@ -32,6 +32,8 @@ InClass
|
||||
|
||||
#include "Cloud.H"
|
||||
|
||||
#include "vtkOpenFOAMTupleRemap.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
@ -86,10 +88,11 @@ void Foam::vtkPV3Foam::convertLagrangianField
|
||||
forAll(tf, i)
|
||||
{
|
||||
const Type& t = tf[i];
|
||||
for (direction d=0; d<nComp; d++)
|
||||
for (direction d=0; d<nComp; ++d)
|
||||
{
|
||||
vec[d] = component(t, d);
|
||||
}
|
||||
vtkOpenFOAMTupleRemap<Type>(vec);
|
||||
|
||||
pointData->InsertTuple(i, vec);
|
||||
}
|
||||
|
@ -37,6 +37,8 @@ InClass
|
||||
#include "vtkPointData.h"
|
||||
#include "vtkPolyData.h"
|
||||
|
||||
#include "vtkOpenFOAMTupleRemap.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
@ -61,10 +63,12 @@ void Foam::vtkPV3Foam::convertPatchField
|
||||
forAll(ptf, i)
|
||||
{
|
||||
const Type& t = ptf[i];
|
||||
for (direction d=0; d<nComp; d++)
|
||||
for (direction d=0; d<nComp; ++d)
|
||||
{
|
||||
vec[d] = component(t, d);
|
||||
}
|
||||
vtkOpenFOAMTupleRemap<Type>(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<nComp; d++)
|
||||
for (direction d=0; d<nComp; ++d)
|
||||
{
|
||||
vec[d] = component(t, d);
|
||||
}
|
||||
vtkOpenFOAMTupleRemap<Type>(vec);
|
||||
|
||||
pointData->InsertTuple(i, vec);
|
||||
}
|
||||
|
@ -33,6 +33,8 @@ InClass
|
||||
// Foam includes
|
||||
#include "interpolatePointToCell.H"
|
||||
|
||||
#include "vtkOpenFOAMTupleRemap.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
@ -210,10 +212,12 @@ void Foam::vtkPV3Foam::convertPointField
|
||||
forAll(pointMap, i)
|
||||
{
|
||||
const Type& t = ptf[pointMap[i]];
|
||||
for (direction d=0; d<nComp; d++)
|
||||
for (direction d=0; d<nComp; ++d)
|
||||
{
|
||||
vec[d] = component(t, d);
|
||||
}
|
||||
vtkOpenFOAMTupleRemap<Type>(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<nComp; d++)
|
||||
for (direction d=0; d<nComp; ++d)
|
||||
{
|
||||
vec[d] = component(t, d);
|
||||
}
|
||||
vtkOpenFOAMTupleRemap<Type>(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<nComp; d++)
|
||||
for (direction d=0; d<nComp; ++d)
|
||||
{
|
||||
vec[d] = component(t, d);
|
||||
}
|
||||
vtkOpenFOAMTupleRemap<Type>(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<nComp; d++)
|
||||
for (direction d=0; d<nComp; ++d)
|
||||
{
|
||||
vec[d] = component(t, d);
|
||||
}
|
||||
vtkOpenFOAMTupleRemap<Type>(vec);
|
||||
|
||||
pointData->InsertTuple(i++, vec);
|
||||
}
|
||||
}
|
||||
|
@ -39,6 +39,8 @@ InClass
|
||||
#include "vtkPV3FoamFaceField.H"
|
||||
#include "vtkPV3FoamPatchField.H"
|
||||
|
||||
#include "vtkOpenFOAMTupleRemap.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
@ -350,10 +352,12 @@ void Foam::vtkPV3Foam::convertVolField
|
||||
forAll(superCells, i)
|
||||
{
|
||||
const Type& t = tf[superCells[i]];
|
||||
for (direction d=0; d<nComp; d++)
|
||||
for (direction d=0; d<nComp; ++d)
|
||||
{
|
||||
vec[d] = component(t, d);
|
||||
}
|
||||
vtkOpenFOAMTupleRemap<Type>(vec);
|
||||
|
||||
celldata->InsertTuple(i, vec);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user