mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: change vtk::Tools from a class to a namespace
- allows localized extension of functionality
This commit is contained in:
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2017-2019 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -116,8 +116,7 @@ template<class Type> class List;
|
|||||||
|
|
||||||
class vtkPVFoam
|
class vtkPVFoam
|
||||||
:
|
:
|
||||||
private foamPvCore,
|
private foamPvCore
|
||||||
protected vtk::Tools
|
|
||||||
{
|
{
|
||||||
// Convenience typedefs
|
// Convenience typedefs
|
||||||
typedef PrimitivePatchInterpolation<primitivePatch> patchInterpolator;
|
typedef PrimitivePatchInterpolation<primitivePatch> patchInterpolator;
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -116,7 +116,7 @@ void Foam::vtkPVFoam::convertVolField
|
|||||||
// To improve code reuse, we allocate the CellData as a zeroed-field
|
// To improve code reuse, we allocate the CellData as a zeroed-field
|
||||||
// ahead of time.
|
// ahead of time.
|
||||||
|
|
||||||
vtkSmartPointer<vtkFloatArray> cdata = zeroField<Type>
|
vtkSmartPointer<vtkFloatArray> cdata = vtk::Tools::zeroField<Type>
|
||||||
(
|
(
|
||||||
fld.name(),
|
fld.name(),
|
||||||
dataset->GetNumberOfPolys()
|
dataset->GetNumberOfPolys()
|
||||||
@ -147,11 +147,12 @@ void Foam::vtkPVFoam::convertVolField
|
|||||||
fvPatchField<Type>(p, fld).patchInternalField()
|
fvPatchField<Type>(p, fld).patchInternalField()
|
||||||
);
|
);
|
||||||
|
|
||||||
coffset += transcribeFloatData(cdata, tpptf(), coffset);
|
coffset +=
|
||||||
|
vtk::Tools::transcribeFloatData(cdata, tpptf(), coffset);
|
||||||
|
|
||||||
if (allowPdata && patchId < patchInterpList.size())
|
if (allowPdata && patchId < patchInterpList.size())
|
||||||
{
|
{
|
||||||
pdata = convertFieldToVTK
|
pdata = vtk::Tools::convertFieldToVTK
|
||||||
(
|
(
|
||||||
fld.name(),
|
fld.name(),
|
||||||
patchInterpList[patchId].faceToPointInterpolate(tpptf)()
|
patchInterpList[patchId].faceToPointInterpolate(tpptf)()
|
||||||
@ -160,11 +161,12 @@ void Foam::vtkPVFoam::convertVolField
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
coffset += transcribeFloatData(cdata, ptf, coffset);
|
coffset +=
|
||||||
|
vtk::Tools::transcribeFloatData(cdata, ptf, coffset);
|
||||||
|
|
||||||
if (allowPdata && patchId < patchInterpList.size())
|
if (allowPdata && patchId < patchInterpList.size())
|
||||||
{
|
{
|
||||||
pdata = convertFieldToVTK
|
pdata = vtk::Tools::convertFieldToVTK
|
||||||
(
|
(
|
||||||
fld.name(),
|
fld.name(),
|
||||||
patchInterpList[patchId].faceToPointInterpolate(ptf)()
|
patchInterpList[patchId].faceToPointInterpolate(ptf)()
|
||||||
@ -488,11 +490,13 @@ void Foam::vtkPVFoam::convertAreaFields
|
|||||||
foamVtpData& vtpData = iter.val();
|
foamVtpData& vtpData = iter.val();
|
||||||
auto dataset = vtpData.dataset;
|
auto dataset = vtpData.dataset;
|
||||||
|
|
||||||
vtkSmartPointer<vtkFloatArray> cdata = convertFieldToVTK
|
vtkSmartPointer<vtkFloatArray> cdata =
|
||||||
|
vtk::Tools::convertFieldToVTK
|
||||||
(
|
(
|
||||||
fld.name(),
|
fld.name(),
|
||||||
fld
|
fld
|
||||||
);
|
);
|
||||||
|
|
||||||
dataset->GetCellData()->AddArray(cdata);
|
dataset->GetCellData()->AddArray(cdata);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -585,7 +589,8 @@ void Foam::vtkPVFoam::convertPointFields
|
|||||||
|
|
||||||
const label patchId = patchIds[0];
|
const label patchId = patchIds[0];
|
||||||
|
|
||||||
vtkSmartPointer<vtkFloatArray> pdata = convertFieldToVTK
|
vtkSmartPointer<vtkFloatArray> pdata =
|
||||||
|
vtk::Tools::convertFieldToVTK
|
||||||
(
|
(
|
||||||
fieldName,
|
fieldName,
|
||||||
pfld.boundaryField()[patchId].patchInternalField()()
|
pfld.boundaryField()[patchId].patchInternalField()()
|
||||||
@ -629,7 +634,7 @@ void Foam::vtkPVFoam::convertPointFields
|
|||||||
);
|
);
|
||||||
|
|
||||||
vtkSmartPointer<vtkFloatArray> pdata =
|
vtkSmartPointer<vtkFloatArray> pdata =
|
||||||
convertFieldToVTK
|
vtk::Tools::convertFieldToVTK
|
||||||
(
|
(
|
||||||
fieldName,
|
fieldName,
|
||||||
znfld
|
znfld
|
||||||
@ -807,7 +812,7 @@ void Foam::vtkPVFoam::convertLagrangianFields
|
|||||||
IOField<Type> fld(ioobj);
|
IOField<Type> fld(ioobj);
|
||||||
|
|
||||||
vtkSmartPointer<vtkFloatArray> data =
|
vtkSmartPointer<vtkFloatArray> data =
|
||||||
convertFieldToVTK
|
vtk::Tools::convertFieldToVTK
|
||||||
(
|
(
|
||||||
ioobj.name(),
|
ioobj.name(),
|
||||||
fld
|
fld
|
||||||
|
|||||||
@ -21,7 +21,7 @@ License
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Class
|
Namespace
|
||||||
Foam::vtk::Tools
|
Foam::vtk::Tools
|
||||||
|
|
||||||
Description
|
Description
|
||||||
@ -50,19 +50,26 @@ SourceFiles
|
|||||||
#include "symmTensor.H"
|
#include "symmTensor.H"
|
||||||
|
|
||||||
// VTK includes
|
// VTK includes
|
||||||
#include <vtkCellArray.h>
|
#include "vtkCellArray.h"
|
||||||
#include <vtkFloatArray.h>
|
#include "vtkFloatArray.h"
|
||||||
#include <vtkDoubleArray.h>
|
#include "vtkDoubleArray.h"
|
||||||
#include <vtkIdTypeArray.h>
|
#include "vtkIdTypeArray.h"
|
||||||
#include <vtkSmartPointer.h>
|
#include "vtkSmartPointer.h"
|
||||||
#include <vtkUnsignedCharArray.h>
|
#include "vtkUnsignedCharArray.h"
|
||||||
#include <vtkPoints.h>
|
#include "vtkPoints.h"
|
||||||
#include <vtkPolyData.h>
|
#include "vtkPolyData.h"
|
||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Forward declarations
|
||||||
|
class vtkDataSet;
|
||||||
|
class vtkCellData;
|
||||||
|
class vtkPointData;
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
namespace vtk
|
namespace vtk
|
||||||
@ -72,7 +79,6 @@ namespace vtk
|
|||||||
Class vtk::Caching Declaration
|
Class vtk::Caching Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
//- Bookkeeping for internal caching.
|
//- Bookkeeping for internal caching.
|
||||||
// Retain an original copy of the geometry as well as a shallow copy
|
// Retain an original copy of the geometry as well as a shallow copy
|
||||||
// with the output fields.
|
// with the output fields.
|
||||||
@ -158,13 +164,11 @@ struct Caching
|
|||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class vtk::Tools Declaration
|
Namespace vtk::Tools
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class Tools
|
namespace Tools
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
|
|
||||||
//- Wrap vtkUnsignedCharArray as a UList
|
//- Wrap vtkUnsignedCharArray as a UList
|
||||||
inline static UList<uint8_t> asUList
|
inline static UList<uint8_t> asUList
|
||||||
(
|
(
|
||||||
|
|||||||
Reference in New Issue
Block a user