foamVtkInternalWriter.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) 2016-2020 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::internalWriter
28 
29 Description
30  Write an OpenFOAM volume (internal) geometry and internal fields
31  as a vtu file or a legacy vtk file.
32 
33  The file output states are managed by the Foam::vtk::fileWriter class.
34  FieldData (eg, TimeValue) must appear before any geometry pieces.
35 
36 Note
37  Parallel output is combined into a single Piece without point merging,
38  which is similar to using multi-piece data sets, but allows more
39  convenient creation as a streaming process.
40  In the future, the duplicate points at processor connections
41  may be addressed using ghost points.
42 
43 See Also
44  Foam::vtk::internalMeshWriter
45 
46 SourceFiles
47  foamVtkInternalWriterTemplates.C
48 
49 \*---------------------------------------------------------------------------*/
50 
51 #ifndef Foam_vtk_internalWriter_H
52 #define Foam_vtk_internalWriter_H
53 
55 #include "volFields.H"
56 #include "pointFields.H"
57 
58 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
59 
60 namespace Foam
61 {
62 
63 // Forward Declarations
64 class volPointInterpolation;
65 
66 namespace vtk
67 {
68 
69 /*---------------------------------------------------------------------------*\
70  Class vtk::internalWriter Declaration
71 \*---------------------------------------------------------------------------*/
72 
73 class internalWriter
74 :
76 {
77  // Private Member Functions
78 
79  //- No copy construct
80  internalWriter(const internalWriter&) = delete;
81 
82  //- No copy assignment
83  void operator=(const internalWriter&) = delete;
84 
85 
86 public:
87 
88  // Constructors
89 
90  //- Construct from components (default format INLINE_BASE64),
92  (
93  const polyMesh& mesh,
94  const vtk::vtuCells& cells,
96  )
97  :
99  {}
100 
101 
102  //- Construct from components (default format INLINE_BASE64),
103  // The file name is with/without an extension.
105  (
106  const polyMesh& mesh,
107  const vtk::vtuCells& cells,
108  const fileName& file,
109  bool parallel = Pstream::parRun()
110  )
111  :
112  vtk::internalMeshWriter(mesh, cells, file, parallel)
113  {}
114 
115  //- Construct from components (default format INLINE_BASE64),
116  // The file name is with/without an extension.
118  (
119  const polyMesh& mesh,
120  const vtk::vtuCells& cells,
121  const vtk::outputOptions opts,
122  const fileName& file,
123  bool parallel = Pstream::parRun()
124  )
125  :
126  vtk::internalMeshWriter(mesh, cells, opts, file, parallel)
127  {}
128 
129 
130  //- Destructor
131  virtual ~internalWriter() = default;
132 
133 
134  // Member Functions
135 
136  // Write
137 
138  //- Write point field
139  // Interpolate to originating cell centre for decomposed cells.
140  template<class Type, template<class> class PatchField>
141  void write
142  (
144  );
145 
146  //- Write the internal field (CellData)
147  template<class Type>
148  void write
149  (
151  );
152 
153  //- Write the volume field (internal part)
154  template<class Type, template<class> class PatchField>
155  void write
156  (
158  );
159 
160  //- Write internal field with point interpolation
161  template<class Type>
162  void write
163  (
164  const DimensionedField<Type, volMesh>& vfield,
166  );
167 
168  //- Write volume field with point interpolation
169  template<class Type>
170  void write
171  (
174  );
175 };
176 
177 
178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 
180 } // End namespace vtk
181 } // End namespace Foam
182 
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 
185 #ifdef NoRepository
187 #endif
188 
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 
191 #endif
192 
193 // ************************************************************************* //
Foam::vtk::outputOptions
Encapsulated combinations of output format options. This is primarily useful when defining the output...
Definition: foamVtkOutputOptions.H:59
volFields.H
Foam::fileName
A class for handling file names.
Definition: fileName.H:73
Foam::vtk::fileWriter::opts
vtk::outputOptions opts() const
The output options in use.
Definition: foamVtkFileWriterI.H:62
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::vtk::fileWriter::parallel
bool parallel() const noexcept
Parallel output requested?
Definition: foamVtkFileWriterI.H:80
Foam::vtk::internalWriter
Write an OpenFOAM volume (internal) geometry and internal fields as a vtu file or a legacy vtk file.
Definition: foamVtkInternalWriter.H:72
field
rDeltaTY field()
Foam::vtk::internalWriter::write
void write(const GeometricField< Type, PatchField, pointMesh > &field)
Write point field.
Definition: foamVtkInternalWriterTemplates.C:37
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::vtk::formatType::INLINE_BASE64
XML inline base64, base64Formatter.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::vtk::internalWriter::~internalWriter
virtual ~internalWriter()=default
Destructor.
Foam::UPstream::parRun
static bool & parRun() noexcept
Test if this a parallel run.
Definition: UPstream.H:433
Foam::vtk::vtuCells
A deep-copy description of an OpenFOAM volume mesh in data structures suitable for VTK UnstructuredGr...
Definition: foamVtuCells.H:70
foamVtkInternalMeshWriter.H
cells
const cellShapeList & cells
Definition: gmvOutputHeader.H:3
Foam::vtk::internalMeshWriter
Write an OpenFOAM volume (internal) geometry and internal fields as a vtu file or a legacy vtk file.
Definition: foamVtkInternalMeshWriter.H:69
Foam::GeometricField
Generic GeometricField class.
Definition: areaFieldsFwd.H:53
Foam::volPointInterpolation
Interpolate from cell centres to points (vertices) using inverse distance weighting.
Definition: volPointInterpolation.H:59
foamVtkInternalWriterTemplates.C
pointFields.H
pInterp
autoPtr< volPointInterpolation > pInterp
Definition: convertVolumeFields.H:81
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54