Commit d06d0e8f authored by Mark Olesen's avatar Mark Olesen

ENH: change vtk::Tools from a class to a namespace

- allows localized extension of functionality
parent bd248fc0
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -78,8 +78,6 @@ namespace vtk
\*---------------------------------------------------------------------------*/
class faMeshAdaptor
:
protected vtk::Tools
{
public:
......
......@@ -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
......@@ -91,8 +91,6 @@ namespace vtk
\*---------------------------------------------------------------------------*/
class fvMeshAdaptor
:
protected vtk::Tools
{
public:
......
......@@ -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
......@@ -94,7 +94,7 @@ void Foam::vtk::fvMeshAdaptor::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()
......@@ -121,7 +121,7 @@ void Foam::vtk::fvMeshAdaptor::convertVolField
fvPatchField<Type>(p, fld).patchInternalField()
);
transcribeFloatData(cdata, tpptf());
vtk::Tools::transcribeFloatData(cdata, tpptf());
if
(
......@@ -138,7 +138,7 @@ void Foam::vtk::fvMeshAdaptor::convertVolField
}
else
{
transcribeFloatData(cdata, ptf);
vtk::Tools::transcribeFloatData(cdata, ptf);
if
(
......@@ -291,7 +291,7 @@ vtkSmartPointer<vtkFloatArray> Foam::vtk::fvMeshAdaptor::convertPointField
{
for (const label meshPointi : pointMap)
{
foamToVtkTuple(scratch, pfld[meshPointi]);
vtk::Tools::foamToVtkTuple(scratch, pfld[meshPointi]);
data->SetTuple(pointi++, scratch);
}
}
......@@ -299,7 +299,7 @@ vtkSmartPointer<vtkFloatArray> Foam::vtk::fvMeshAdaptor::convertPointField
{
for (const Type& val : pfld)
{
foamToVtkTuple(scratch, val);
vtk::Tools::foamToVtkTuple(scratch, val);
data->SetTuple(pointi++, scratch);
}
}
......@@ -311,7 +311,7 @@ vtkSmartPointer<vtkFloatArray> Foam::vtk::fvMeshAdaptor::convertPointField
{
for (const label meshCelli : addPointCellLabels)
{
foamToVtkTuple(scratch, vfld[meshCelli]);
vtk::Tools::foamToVtkTuple(scratch, vfld[meshCelli]);
data->SetTuple(pointi++, scratch);
}
}
......@@ -319,7 +319,10 @@ vtkSmartPointer<vtkFloatArray> Foam::vtk::fvMeshAdaptor::convertPointField
{
for (const label meshCelli : addPointCellLabels)
{
foamToVtkTuple(scratch, interpolatePointToCell(pfld, meshCelli));
vtk::Tools::foamToVtkTuple
(
scratch, interpolatePointToCell(pfld, meshCelli)
);
data->SetTuple(pointi++, scratch);
}
}
......@@ -362,7 +365,7 @@ Foam::vtk::fvMeshAdaptor::convertVolFieldToVTK
vtkIdType celli = 0;
for (const label meshCelli : cellMap)
{
foamToVtkTuple(scratch, fld[meshCelli]);
vtk::Tools::foamToVtkTuple(scratch, fld[meshCelli]);
data->SetTuple(celli++, scratch);
}
......
......@@ -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
(
fld.name(),
fld
);
vtkSmartPointer<vtkFloatArray> cdata =
vtk::Tools::convertFieldToVTK
(
fld.name(),
fld
);
dataset->GetCellData()->AddArray(cdata);
}
}
......@@ -585,11 +589,12 @@ void Foam::vtkPVFoam::convertPointFields
const label patchId = patchIds[0];
vtkSmartPointer<vtkFloatArray> pdata = convertFieldToVTK
(
fieldName,
pfld.boundaryField()[patchId].patchInternalField()()
);
vtkSmartPointer<vtkFloatArray> pdata =
vtk::Tools::convertFieldToVTK
(
fieldName,
pfld.boundaryField()[patchId].patchInternalField()()
);
dataset->GetPointData()->AddArray(pdata);
}
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment