foamVtkPatchWriter.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-2021 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::patchWriter
28 
29 Description
30  Write OpenFOAM patches and patch fields in VTP or legacy vtk format.
31 
32  The file output states are managed by the Foam::vtk::fileWriter class.
33  FieldData (eg, TimeValue) must appear before any geometry pieces.
34 
35 Note
36  Parallel output is combined into a single Piece without point merging,
37  which is similar to using multi-piece data sets, but allows more
38  convenient creation as a streaming process.
39  In the future, the duplicate points at processor connections
40  may be addressed using ghost points.
41 
42 See Also
43  Foam::vtk::patchMeshWriter
44 
45 SourceFiles
46  foamVtkPatchWriterTemplates.C
47 
48 \*---------------------------------------------------------------------------*/
49 
50 #ifndef Foam_vtk_patchWriter_H
51 #define Foam_vtk_patchWriter_H
52 
53 #include "foamVtkPatchMeshWriter.H"
54 #include "volFields.H"
55 #include "pointFields.H"
57 
58 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
59 
60 namespace Foam
61 {
62 namespace vtk
63 {
64 
65 /*---------------------------------------------------------------------------*\
66  Class vtk::patchWriter Declaration
67 \*---------------------------------------------------------------------------*/
68 
69 class patchWriter
70 :
72 {
73  // Private Member Data
74 
75  //- Use internal field value instead of patch value
76  bool useNearCellValue_;
77 
78 
79  // Private Member Functions
80 
81  //- No copy construct
82  patchWriter(const patchWriter&) = delete;
83 
84  //- No copy assignment
85  void operator=(const patchWriter&) = delete;
86 
87 
88 public:
89 
90  // Constructors
91 
92  //- Construct from components (default format INLINE_BASE64)
93  //
94  // \param useNearCellValue to use cell instead of patch values
96  (
97  const polyMesh& mesh,
98  const labelList& patchIDs,
100  const bool useNearCellValue = false
101  )
102  :
104  useNearCellValue_(useNearCellValue)
105  {}
106 
107  //- Construct from components (default format INLINE_BASE64),
108  //- and open the file for writing.
109  // The file name is with/without an extension.
111  (
112  const polyMesh& mesh,
113  const labelList& patchIDs,
114  const fileName& file,
115  bool parallel = Pstream::parRun()
116  )
117  :
118  vtk::patchMeshWriter(mesh, patchIDs, file, parallel),
119  useNearCellValue_(false)
120  {}
121 
122  //- Construct from components (default format INLINE_BASE64),
123  //- and open the file for writing.
124  // The file name is with/without an extension.
126  (
127  const polyMesh& mesh,
128  const labelList& patchIDs,
129  const vtk::outputOptions opts,
130  const fileName& file,
131  bool parallel = Pstream::parRun()
132  )
133  :
134  vtk::patchMeshWriter(mesh, patchIDs, opts, file, parallel),
135  useNearCellValue_(false)
136  {}
137 
138  //- Construct from components and open the file for writing.
139  // The file name is with/without an extension.
140  //
141  // \param useNearCellValue to use cell instead of patch values
143  (
144  const polyMesh& mesh,
145  const labelList& patchIDs,
146  const vtk::outputOptions opts,
147  const bool useNearCellValue,
148  const fileName& file,
149  bool parallel = Pstream::parRun()
150  )
151  :
152  vtk::patchMeshWriter(mesh, patchIDs, opts, file, parallel),
153  useNearCellValue_(useNearCellValue)
154  {}
155 
156 
157  //- Destructor
158  virtual ~patchWriter() = default;
159 
160 
161  // Member Functions
162 
163  // Write
164 
165  //- Write point field
166  template<class Type, template<class> class PatchField>
167  void write
168  (
170  );
171 
172  //- Write volume field
173  template<class Type, template<class> class PatchField>
174  void write
175  (
177  );
178 
179  //- Write volume field with point interpolation
180  template<class Type>
181  void write
182  (
185  );
186 
187  //- Write volume field with point interpolation
188  template<class Type>
189  void write
190  (
193  );
194 };
195 
196 
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198 
199 } // End namespace vtk
200 } // End namespace Foam
201 
202 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
203 
204 #ifdef NoRepository
206 #endif
207 
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 
210 #endif
211 
212 // ************************************************************************* //
Foam::vtk::outputOptions
Encapsulated combinations of output format options. This is primarily useful when defining the output...
Definition: foamVtkOutputOptions.H:59
volFields.H
Foam::vtk::patchMeshWriter
Write OpenFOAM patches and patch fields in VTP or legacy vtk format.
Definition: foamVtkPatchMeshWriter.H:67
Foam::fileName
A class for handling file names.
Definition: fileName.H:73
PrimitivePatchInterpolation.H
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::patchWriter::~patchWriter
virtual ~patchWriter()=default
Destructor.
foamVtkPatchMeshWriter.H
field
rDeltaTY field()
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::patchWriter
Write OpenFOAM patches and patch fields in VTP or legacy vtk format.
Definition: foamVtkPatchWriter.H:68
Foam::PrimitivePatchInterpolation
Interpolation class within a primitive patch. Allows interpolation from points to faces and vice vers...
Definition: PrimitivePatchInterpolation.H:53
Foam::UPstream::parRun
static bool & parRun() noexcept
Test if this a parallel run.
Definition: UPstream.H:433
Foam::List< label >
Foam::vtk::patchWriter::write
void write(const GeometricField< Type, PatchField, pointMesh > &field)
Write point field.
Definition: foamVtkPatchWriterTemplates.C:35
Foam::vtk::patchMeshWriter::patchIDs
const labelList & patchIDs() const noexcept
The patch IDs.
Definition: foamVtkPatchMeshWriter.H:174
Foam::GeometricField
Generic GeometricField class.
Definition: areaFieldsFwd.H:53
foamVtkPatchWriterTemplates.C
pointFields.H
pInterp
autoPtr< volPointInterpolation > pInterp
Definition: convertVolumeFields.H:81