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
|
||||
\\ / O peration |
|
||||
\\ / 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
|
||||
This file is part of OpenFOAM.
|
||||
@ -116,8 +116,7 @@ template<class Type> class List;
|
||||
|
||||
class vtkPVFoam
|
||||
:
|
||||
private foamPvCore,
|
||||
protected vtk::Tools
|
||||
private foamPvCore
|
||||
{
|
||||
// Convenience typedefs
|
||||
typedef PrimitivePatchInterpolation<primitivePatch> patchInterpolator;
|
||||
|
||||
@ -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
|
||||
@ -116,7 +116,7 @@ void Foam::vtkPVFoam::convertVolField
|
||||
// To improve code reuse, we allocate the CellData as a zeroed-field
|
||||
// ahead of time.
|
||||
|
||||
vtkSmartPointer<vtkFloatArray> cdata = zeroField<Type>
|
||||
vtkSmartPointer<vtkFloatArray> cdata = vtk::Tools::zeroField<Type>
|
||||
(
|
||||
fld.name(),
|
||||
dataset->GetNumberOfPolys()
|
||||
@ -147,11 +147,12 @@ void Foam::vtkPVFoam::convertVolField
|
||||
fvPatchField<Type>(p, fld).patchInternalField()
|
||||
);
|
||||
|
||||
coffset += transcribeFloatData(cdata, tpptf(), coffset);
|
||||
coffset +=
|
||||
vtk::Tools::transcribeFloatData(cdata, tpptf(), coffset);
|
||||
|
||||
if (allowPdata && patchId < patchInterpList.size())
|
||||
{
|
||||
pdata = convertFieldToVTK
|
||||
pdata = vtk::Tools::convertFieldToVTK
|
||||
(
|
||||
fld.name(),
|
||||
patchInterpList[patchId].faceToPointInterpolate(tpptf)()
|
||||
@ -160,11 +161,12 @@ void Foam::vtkPVFoam::convertVolField
|
||||
}
|
||||
else
|
||||
{
|
||||
coffset += transcribeFloatData(cdata, ptf, coffset);
|
||||
coffset +=
|
||||
vtk::Tools::transcribeFloatData(cdata, ptf, coffset);
|
||||
|
||||
if (allowPdata && patchId < patchInterpList.size())
|
||||
{
|
||||
pdata = convertFieldToVTK
|
||||
pdata = vtk::Tools::convertFieldToVTK
|
||||
(
|
||||
fld.name(),
|
||||
patchInterpList[patchId].faceToPointInterpolate(ptf)()
|
||||
@ -488,11 +490,13 @@ void Foam::vtkPVFoam::convertAreaFields
|
||||
foamVtpData& vtpData = iter.val();
|
||||
auto dataset = vtpData.dataset;
|
||||
|
||||
vtkSmartPointer<vtkFloatArray> cdata = convertFieldToVTK
|
||||
vtkSmartPointer<vtkFloatArray> cdata =
|
||||
vtk::Tools::convertFieldToVTK
|
||||
(
|
||||
fld.name(),
|
||||
fld
|
||||
);
|
||||
|
||||
dataset->GetCellData()->AddArray(cdata);
|
||||
}
|
||||
}
|
||||
@ -585,7 +589,8 @@ void Foam::vtkPVFoam::convertPointFields
|
||||
|
||||
const label patchId = patchIds[0];
|
||||
|
||||
vtkSmartPointer<vtkFloatArray> pdata = convertFieldToVTK
|
||||
vtkSmartPointer<vtkFloatArray> pdata =
|
||||
vtk::Tools::convertFieldToVTK
|
||||
(
|
||||
fieldName,
|
||||
pfld.boundaryField()[patchId].patchInternalField()()
|
||||
@ -629,7 +634,7 @@ void Foam::vtkPVFoam::convertPointFields
|
||||
);
|
||||
|
||||
vtkSmartPointer<vtkFloatArray> pdata =
|
||||
convertFieldToVTK
|
||||
vtk::Tools::convertFieldToVTK
|
||||
(
|
||||
fieldName,
|
||||
znfld
|
||||
@ -807,7 +812,7 @@ void Foam::vtkPVFoam::convertLagrangianFields
|
||||
IOField<Type> fld(ioobj);
|
||||
|
||||
vtkSmartPointer<vtkFloatArray> data =
|
||||
convertFieldToVTK
|
||||
vtk::Tools::convertFieldToVTK
|
||||
(
|
||||
ioobj.name(),
|
||||
fld
|
||||
|
||||
@ -21,7 +21,7 @@ License
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Namespace
|
||||
Foam::vtk::Tools
|
||||
|
||||
Description
|
||||
@ -50,19 +50,26 @@ SourceFiles
|
||||
#include "symmTensor.H"
|
||||
|
||||
// VTK includes
|
||||
#include <vtkCellArray.h>
|
||||
#include <vtkFloatArray.h>
|
||||
#include <vtkDoubleArray.h>
|
||||
#include <vtkIdTypeArray.h>
|
||||
#include <vtkSmartPointer.h>
|
||||
#include <vtkUnsignedCharArray.h>
|
||||
#include <vtkPoints.h>
|
||||
#include <vtkPolyData.h>
|
||||
#include "vtkCellArray.h"
|
||||
#include "vtkFloatArray.h"
|
||||
#include "vtkDoubleArray.h"
|
||||
#include "vtkIdTypeArray.h"
|
||||
#include "vtkSmartPointer.h"
|
||||
#include "vtkUnsignedCharArray.h"
|
||||
#include "vtkPoints.h"
|
||||
#include "vtkPolyData.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Forward declarations
|
||||
class vtkDataSet;
|
||||
class vtkCellData;
|
||||
class vtkPointData;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace vtk
|
||||
@ -72,7 +79,6 @@ namespace vtk
|
||||
Class vtk::Caching Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
//- Bookkeeping for internal caching.
|
||||
// Retain an original copy of the geometry as well as a shallow copy
|
||||
// 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
|
||||
inline static UList<uint8_t> asUList
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user