Loading...
Searching...
No Matches
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-2025 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
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
26Class
27 Foam::vtk::patchWriter
28
29Description
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
35Note
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
42See Also
43 Foam::vtk::patchMeshWriter
44
45SourceFiles
46 foamVtkPatchWriter.txx
47
48\*---------------------------------------------------------------------------*/
49
50#ifndef Foam_vtk_patchWriter_H
51#define Foam_vtk_patchWriter_H
52
54#include "volFields.H"
55#include "pointFields.H"
57
58// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
59
60namespace Foam
61{
62namespace vtk
63{
65/*---------------------------------------------------------------------------*\
66 Class vtk::patchWriter Declaration
67\*---------------------------------------------------------------------------*/
68
69class patchWriter
70:
72{
73 // Private Member Data
74
75 //- Use internal field value instead of patch value
76 bool useNearCellValue_;
77
78public:
79
80 // Generated Methods
81
82 //- No copy construct
83 patchWriter(const patchWriter&) = delete;
84
85 //- No copy assignment
86 void operator=(const patchWriter&) = delete;
88
89 // Constructors
90
91 //- Construct from components (default format INLINE_BASE64)
93 (
94 const polyMesh& mesh,
98 const bool useNearCellValue = false
99 )
100 :
102 useNearCellValue_(useNearCellValue)
103 {}
104
105 //- Construct from components (default format INLINE_BASE64),
106 //- and open the file for writing.
107 // The file name is with/without an extension.
109 (
110 const polyMesh& mesh,
111 const labelUList& patchIDs,
112 const fileName& file,
115 :
117 useNearCellValue_(false)
118 {}
119
120 //- Construct from components (default format INLINE_BASE64),
121 //- and open the file for writing.
122 // The file name is with/without an extension.
124 (
125 const polyMesh& mesh,
126 const labelUList& patchIDs,
128 const fileName& file,
130 )
131 :
133 useNearCellValue_(false)
134 {}
135
136
137 //- Destructor
138 virtual ~patchWriter() = default;
139
140
141 // Member Functions
142
143 // Access / Edit
144
145 //- Use patch internal field values?
146 bool useCellValue() const noexcept
147 {
148 return useNearCellValue_;
150
151 //- Select use of patch internal field values
152 // \returns the previous state
153 bool useCellValue(bool on) noexcept
154 {
155 bool old(useNearCellValue_);
156 useNearCellValue_ = on;
157 return old;
158 }
160
161 // Write
162
163 //- Write point field
164 template<class Type, template<class> class PatchField>
165 void write
166 (
168 );
170 //- Write volume field
171 template<class Type, template<class> class PatchField>
172 void write
173 (
175 );
176
177 //- Write volume field with point interpolation
178 template<class Type>
179 void write
180 (
183 );
184
185 //- Write volume field with point interpolation
186 template<class Type>
187 void write
188 (
191 );
193
194 // Housekeeping
195
196 //- Construct with \p useNearCellValue setting
197 // \deprecated
198 FOAM_DEPRECATED_FOR(2025-11, "use useCellValue() after construction")
200 (
202 const labelUList& patchIDs,
203 const vtk::outputOptions opts,
205 const bool useNearCellValue,
206 const fileName& file,
207 bool parallel = UPstream::parRun()
208 )
209 :
211 useNearCellValue_(useNearCellValue)
212 {}
213};
214
215
216// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217
218} // End namespace vtk
219} // End namespace Foam
220
221// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
222
223#ifdef NoRepository
224 #include "foamVtkPatchWriter.txx"
225#endif
227// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
228
229#endif
230
231// ************************************************************************* //
labelList patchIDs
Generic GeometricField class.
Interpolation class within a primitive patch. Allows interpolation from points to faces and vice vers...
Inter-processor communications stream.
Definition UPstream.H:69
static bool parRun(const bool on) noexcept
Set as parallel run on/off.
Definition UPstream.H:1669
A class for handling file names.
Definition fileName.H:75
Mesh consisting of general polyhedral cells.
Definition polyMesh.H:79
vtk::outputOptions opts() const noexcept
The output options in use.
bool parallel() const noexcept
Parallel output requested?
Encapsulated combinations of output format options. This is primarily useful when defining the output...
Write OpenFOAM patches and patch fields in VTP or legacy vtk format.
const labelList & patchIDs() const noexcept
The patch IDs.
patchMeshWriter(const patchMeshWriter &)=delete
No copy construct.
void write(const GeometricField< Type, PatchField, volMesh > &field)
Write volume field.
virtual ~patchWriter()=default
Destructor.
void write(const GeometricField< Type, fvPatchField, volMesh > &field, const PrimitivePatchInterpolation< primitivePatch > *pInterp)
Write volume field with point interpolation.
void operator=(const patchWriter &)=delete
No copy assignment.
patchWriter(const polyMesh &mesh, const labelUList &patchIDs, const fileName &file, bool parallel=UPstream::parRun())
Construct from components (default format INLINE_BASE64), and open the file for writing.
patchWriter(const polyMesh &mesh, const labelUList &patchIDs, const vtk::outputOptions opts=vtk::formatType::INLINE_BASE64, const bool useNearCellValue=false)
Construct from components (default format INLINE_BASE64).
void write(const GeometricField< Type, fvPatchField, volMesh > &field, const PrimitivePatchInterpolation< primitivePatch > &pInterp)
Write volume field with point interpolation.
patchWriter(const polyMesh &mesh, const labelUList &patchIDs, const vtk::outputOptions opts, const fileName &file, bool parallel=UPstream::parRun())
Construct from components (default format INLINE_BASE64), and open the file for writing.
void write(const GeometricField< Type, PatchField, pointMesh > &field)
Write point field.
bool useCellValue(bool on) noexcept
Select use of patch internal field values.
patchWriter(const patchWriter &)=delete
No copy construct.
bool useCellValue() const noexcept
Use patch internal field values?
rDeltaTY field()
dynamicFvMesh & mesh
autoPtr< volPointInterpolation > pInterp
Namespace for handling VTK output. Contains classes and functions for writing VTK file content.
@ INLINE_BASE64
XML inline base64, base64Formatter.
Definition foamVtkCore.H:91
Namespace for OpenFOAM.
const direction noexcept
Definition scalarImpl.H:265
UList< label > labelUList
A UList of labels.
Definition UList.H:75
runTime write()
#define FOAM_DEPRECATED_FOR(since, replacement)
Definition stdFoam.H:43