vtkSurfaceWriter.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::vtkSurfaceWriter
26 
27 Description
28  A surfaceWriter for VTK legacy format
29  with support for writing ASCII or binary.
30 
31 SourceFiles
32  vtkSurfaceWriter.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef vtkSurfaceWriter_H
37 #define vtkSurfaceWriter_H
38 
39 #include "surfaceWriter.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 /*---------------------------------------------------------------------------*\
47  Class vtkSurfaceWriter Declaration
48 \*---------------------------------------------------------------------------*/
49 
50 class vtkSurfaceWriter
51 :
52  public surfaceWriter
53 {
54  // Private Member Functions
55 
56  //- Templated write operation
57  template<class Type>
58  void Write
59  (
60  const fileName& outputDir,
61  const fileName& surfaceName,
62  const pointField& points,
63  const faceList& faces,
64  const word& fieldName,
65  const Field<Type>& values,
66  const bool isNodeValues
67  ) const;
68 
69 
70 public:
71 
72  //- Runtime type information
73  TypeName("vtk");
74 
75 
76  // Constructors
77 
78  //- Construct given write format
79  vtkSurfaceWriter(const IOstream::streamFormat writeFormat);
80 
81 
82  //- Destructor
83  virtual ~vtkSurfaceWriter();
84 
85 
86  // Member Functions
87 
88  //- Write single surface geometry to file.
89  virtual void write
90  (
91  const fileName& outputDir,
92  const fileName& surfaceName,
93  const pointField& points,
94  const faceList& faces
95  ) const;
96 
97  //- Write scalarField for a single surface to file.
98  // One value per face or vertex (isNodeValues = true)
99  virtual void write
100  (
101  const fileName& outputDir, // <case>/surface/TIME
102  const fileName& surfaceName, // name of surface
103  const pointField& points,
104  const faceList& faces,
105  const word& fieldName, // name of field
106  const Field<scalar>& values,
107  const bool isNodeValues
108  ) const;
109 
110  //- Write vectorField for a single surface to file.
111  // One value per face or vertex (isNodeValues = true)
112  virtual void write
113  (
114  const fileName& outputDir, // <case>/surface/TIME
115  const fileName& surfaceName, // name of surface
116  const pointField& points,
117  const faceList& faces,
118  const word& fieldName, // name of field
119  const Field<vector>& values,
120  const bool isNodeValues
121  ) const;
122 
123  //- Write sphericalTensorField for a single surface to file.
124  // One value per face or vertex (isNodeValues = true)
125  virtual void write
126  (
127  const fileName& outputDir, // <case>/surface/TIME
128  const fileName& surfaceName, // name of surface
129  const pointField& points,
130  const faceList& faces,
131  const word& fieldName, // name of field
132  const Field<sphericalTensor>& values,
133  const bool isNodeValues
134  ) const;
135 
136  //- Write symmTensorField for a single surface to file.
137  // One value per face or vertex (isNodeValues = true)
138  virtual void write
139  (
140  const fileName& outputDir, // <case>/surface/TIME
141  const fileName& surfaceName, // name of surface
142  const pointField& points,
143  const faceList& faces,
144  const word& fieldName, // name of field
145  const Field<symmTensor>& values,
146  const bool isNodeValues
147  ) const;
148 
149  //- Write tensorField for a single surface to file.
150  // One value per face or vertex (isNodeValues = true)
151  virtual void write
152  (
153  const fileName& outputDir, // <case>/surface/TIME
154  const fileName& surfaceName, // name of surface
155  const pointField& points,
156  const faceList& faces,
157  const word& fieldName, // name of field
158  const Field<tensor>& values,
159  const bool isNodeValues
160  ) const;
161 };
162 
163 
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 
166 } // End namespace Foam
167 
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 
170 #endif
171 
172 // ************************************************************************* //
A class for handling file names.
Definition: fileName.H:79
virtual ~vtkSurfaceWriter()
Destructor.
virtual void write(const fileName &outputDir, const fileName &surfaceName, const pointField &points, const faceList &faces) const
Write single surface geometry to file.
const pointField & points
A class for handling words, derived from string.
Definition: word.H:59
streamFormat
Enumeration for the format of data in the stream.
Definition: IOstream.H:86
A surfaceWriter for VTK legacy format with support for writing ASCII or binary.
vtkSurfaceWriter(const IOstream::streamFormat writeFormat)
Construct given write format.
Base class for surface writers.
Definition: surfaceWriter.H:54
TypeName("vtk")
Runtime type information.
Namespace for OpenFOAM.