foamVtkVtuAdaptor.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2017-2019 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::vtk::vtuAdaptor
28 
29 Description
30  A low-level backend adaptor for converting OpenFOAM volume meshes/fields
31  to VTK internal representation.
32  The output is a single piece vtkUnstructuredGrid dataset.
33  Multiblock composition is done by the caller.
34 
35 Note
36  This was originally part of the catalystFvMesh function object backend,
37  which was prototyped in the ParaView reader module.
38  This adaptor unifies many common elements of both.
39 
40 SourceFiles
41  foamVtkVtuAdaptorI.H
42  foamVtkVtuAdaptorTemplates.C
43 
44 \*---------------------------------------------------------------------------*/
45 
46 #ifndef foamVtk_vtuAdaptor_H
47 #define foamVtk_vtuAdaptor_H
48 
49 #include "fvMesh.H"
50 #include "volFieldsFwd.H"
51 #include "foamVtkTools.H"
52 #include "foamVtkMeshMaps.H"
53 #include "foamVtuSizing.H"
54 
55 #include "vtkSmartPointer.h"
56 #include "vtkPoints.h"
57 #include "vtkPolyData.h"
58 #include "vtkUnstructuredGrid.h"
59 #include "vtkMultiBlockDataSet.h"
60 
61 // * * * * * * * * * * * * * Forward Declarations * * * * * * * * * * * * * //
62 
63 class vtkCellArray;
64 class vtkDataSet;
65 class vtkFloatArray;
66 
67 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
68 
69 namespace Foam
70 {
71 namespace vtk
72 {
73 
74 /*---------------------------------------------------------------------------*\
75  Class vtk::vtuAdaptor Declaration
76 \*---------------------------------------------------------------------------*/
77 
78 //- Bookkeeping for vtkUnstructuredGrid
79 class vtuAdaptor
80 :
81  public vtk::Caching<vtkUnstructuredGrid>,
82  public foamVtkMeshMaps
83 {
84 public:
85 
86  // Member Functions
87 
88  // Mesh Conversion
89 
90  //- The vtk points for the mesh (and decomposition)
92  (
93  const fvMesh& mesh
94  ) const;
95 
96  //- The vtk points for the mesh (and decomposition)
97  //- using the provided pointMap
99  (
100  const fvMesh& mesh,
101  const labelUList& pointMap
102  ) const;
103 
104  //- Internal mesh as vtkUnstructuredGrid.
105  // Calling this automatically populates the sizing and vtk::Caching
107  (
108  const fvMesh& mesh,
109  const bool decompPoly = false
110  );
111 
112 
113  // Field Conversion
114 
115  //- Convert internal volume field (CellData)
116  template<class Type>
119  (
121  const vtuAdaptor& vtuData
122  );
123 
124  //- Convert internal volume field (CellData)
125  template<class Type>
128  (
130  const vtuAdaptor& vtuData
131  );
132 
133 
134  //- Convert internal volume field (CellData)
135  template<class Type>
138  (
140  ) const;
141 
142  //- Convert internal volume field (CellData)
143  template<class Type>
146  (
148  ) const;
149 };
150 
151 
152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153 
154 } // End namespace vtk
155 } // End namespace Foam
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 #include "foamVtkVtuAdaptorI.H"
160 
161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162 
163 #ifdef NoRepository
165 #endif
166 
167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168 
169 #endif
170 
171 // ************************************************************************* //
volFieldsFwd.H
foamVtkTools.H
Foam::foamVtkMeshMaps::pointMap
const labelList & pointMap() const
Point labels for subsetted meshes.
Definition: foamVtkMeshMapsI.H:65
vtkSmartPointer
Definition: runTimePostProcessing.H:148
Foam::vtk::vtuAdaptor::points
vtkSmartPointer< vtkPoints > points(const fvMesh &mesh) const
The vtk points for the mesh (and decomposition)
Definition: foamVtkVtuAdaptorI.H:32
foamVtuSizing.H
foamVtkVtuAdaptorI.H
fld
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< ' ';}gmvFile<< nl;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Definition: gmvOutputLagrangian.H:23
Foam::vtk::vtuAdaptor::convertField
static vtkSmartPointer< vtkFloatArray > convertField(const DimensionedField< Type, volMesh > &fld, const vtuAdaptor &vtuData)
Convert internal volume field (CellData)
Definition: foamVtkVtuAdaptorTemplates.C:39
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:84
fvMesh.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::UList< label >
Foam::vtk::vtuAdaptor
Bookkeeping for vtkUnstructuredGrid.
Definition: foamVtkVtuAdaptor.H:78
Foam::GeometricField< Type, fvPatchField, volMesh >
foamVtkVtuAdaptorTemplates.C
foamVtkMeshMaps.H
Foam::foamVtkMeshMaps
Bookkeeping for mesh subsetting and/or polyhedral cell decomposition. Although the main use case is f...
Definition: foamVtkMeshMaps.H:57
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54
Foam::vtk::Caching
Bookkeeping for internal caching.
Definition: foamVtkTools.H:89