Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
fe21c9c3
Commit
fe21c9c3
authored
Jan 31, 2019
by
Mark OLESEN
Browse files
ENH: change vtk::Tools from a class to a namespace
- allows localized extension of functionality
parent
acc66c21
Changes
3
Hide whitespace changes
Inline
Side-by-side
applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/vtkPVFoam.H
View file @
fe21c9c3
...
...
@@ -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-201
8
OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2017-201
9
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
;
...
...
applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/vtkPVFoamFieldTemplates.C
View file @
fe21c9c3
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017-201
8
OpenCFD Ltd.
\\ / A nd | Copyright (C) 2017-201
9
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
...
...
src/conversion/vtk/adaptor/foamVtkTools.H
View file @
fe21c9c3
...
...
@@ -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
(
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment