All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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-2020 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  void writeGeometry
57  (
58  std::ostream&,
59  const pointField&,
60  const faceList&
61  ) const;
62 
63  //- Templated write operation
64  template<class Type>
65  void Write
66  (
67  const fileName& outputDir,
68  const fileName& surfaceName,
69  const pointField& points,
70  const faceList& faces,
71  const word& fieldName,
72  const Field<Type>& values,
73  const bool isNodeValues
74  ) const;
75 
76 
77 public:
78 
79  //- Runtime type information
80  TypeName("vtk");
81 
82 
83  // Constructors
84 
85  //- Construct given write format
86  vtkSurfaceWriter(const IOstream::streamFormat writeFormat);
87 
88 
89  //- Destructor
90  virtual ~vtkSurfaceWriter();
91 
92 
93  // Member Functions
94 
95  //- Write single surface geometry to file.
96  virtual void write
97  (
98  const fileName& outputDir,
99  const fileName& surfaceName,
100  const pointField& points,
101  const faceList& faces
102  ) const;
103 
104 
105  //- Write scalarField for a single surface to file.
106  // One value per face or vertex (isNodeValues = true)
107  virtual void write
108  (
109  const fileName& outputDir, // <case>/surface/TIME
110  const fileName& surfaceName, // name of surface
111  const pointField& points,
112  const faceList& faces,
113  const word& fieldName, // name of field
114  const Field<scalar>& values,
115  const bool isNodeValues
116  ) const;
117 
118  //- Write vectorField for a single surface to file.
119  // One value per face or vertex (isNodeValues = true)
120  virtual void write
121  (
122  const fileName& outputDir, // <case>/surface/TIME
123  const fileName& surfaceName, // name of surface
124  const pointField& points,
125  const faceList& faces,
126  const word& fieldName, // name of field
127  const Field<vector>& values,
128  const bool isNodeValues
129  ) const;
130 
131  //- Write sphericalTensorField for a single surface to file.
132  // One value per face or vertex (isNodeValues = true)
133  virtual void write
134  (
135  const fileName& outputDir, // <case>/surface/TIME
136  const fileName& surfaceName, // name of surface
137  const pointField& points,
138  const faceList& faces,
139  const word& fieldName, // name of field
140  const Field<sphericalTensor>& values,
141  const bool isNodeValues
142  ) const;
143 
144  //- Write symmTensorField for a single surface to file.
145  // One value per face or vertex (isNodeValues = true)
146  virtual void write
147  (
148  const fileName& outputDir, // <case>/surface/TIME
149  const fileName& surfaceName, // name of surface
150  const pointField& points,
151  const faceList& faces,
152  const word& fieldName, // name of field
153  const Field<symmTensor>& values,
154  const bool isNodeValues
155  ) const;
156 
157  //- Write tensorField for a single surface to file.
158  // One value per face or vertex (isNodeValues = true)
159  virtual void write
160  (
161  const fileName& outputDir, // <case>/surface/TIME
162  const fileName& surfaceName, // name of surface
163  const pointField& points,
164  const faceList& faces,
165  const word& fieldName, // name of field
166  const Field<tensor>& values,
167  const bool isNodeValues
168  ) const;
169 };
170 
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 
174 } // End namespace Foam
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 #endif
179 
180 // ************************************************************************* //
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.