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-2018 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 
30 SourceFiles
31  vtkSurfaceWriter.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef vtkSurfaceWriter_H
36 #define vtkSurfaceWriter_H
37 
38 #include "surfaceWriter.H"
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 /*---------------------------------------------------------------------------*\
46  Class vtkSurfaceWriter Declaration
47 \*---------------------------------------------------------------------------*/
48 
49 class vtkSurfaceWriter
50 :
51  public surfaceWriter
52 {
53  // Private Member Functions
54 
55  static void writeGeometry(Ostream&, const pointField&, const faceList&);
56 
57  template<class Type>
58  static void writeData(Ostream&, const Field<Type>&);
59 
60 
61  //- Templated write operation
62  template<class Type>
63  void writeTemplate
64  (
65  const fileName& outputDir,
66  const fileName& surfaceName,
67  const pointField& points,
68  const faceList& faces,
69  const word& fieldName,
70  const Field<Type>& values,
71  const bool isNodeValues,
72  const bool verbose
73  ) const;
74 
75 public:
76 
77  //- Runtime type information
78  TypeName("vtk");
79 
80 
81  // Constructors
82 
83  //- Construct null
85 
86 
87  //- Destructor
88  virtual ~vtkSurfaceWriter();
89 
90 
91  // Member Functions
92 
93  //- Write single surface geometry to file.
94  virtual void write
95  (
96  const fileName& outputDir,
97  const fileName& surfaceName,
98  const pointField& points,
99  const faceList& faces,
100  const bool verbose = false
101  ) const;
102 
103 
104  //- Write scalarField for a single surface to file.
105  // One value per face or vertex (isNodeValues = true)
106  virtual void write
107  (
108  const fileName& outputDir, // <case>/surface/TIME
109  const fileName& surfaceName, // name of surface
110  const pointField& points,
111  const faceList& faces,
112  const word& fieldName, // name of field
113  const Field<scalar>& values,
114  const bool isNodeValues,
115  const bool verbose = false
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 bool verbose = false
130  ) const;
131 
132  //- Write sphericalTensorField for a single surface to file.
133  // One value per face or vertex (isNodeValues = true)
134  virtual void write
135  (
136  const fileName& outputDir, // <case>/surface/TIME
137  const fileName& surfaceName, // name of surface
138  const pointField& points,
139  const faceList& faces,
140  const word& fieldName, // name of field
141  const Field<sphericalTensor>& values,
142  const bool isNodeValues,
143  const bool verbose = false
144  ) const;
145 
146  //- Write symmTensorField for a single surface to file.
147  // One value per face or vertex (isNodeValues = true)
148  virtual void write
149  (
150  const fileName& outputDir, // <case>/surface/TIME
151  const fileName& surfaceName, // name of surface
152  const pointField& points,
153  const faceList& faces,
154  const word& fieldName, // name of field
155  const Field<symmTensor>& values,
156  const bool isNodeValues,
157  const bool verbose = false
158  ) const;
159 
160  //- Write tensorField for a single surface to file.
161  // One value per face or vertex (isNodeValues = true)
162  virtual void write
163  (
164  const fileName& outputDir, // <case>/surface/TIME
165  const fileName& surfaceName, // name of surface
166  const pointField& points,
167  const faceList& faces,
168  const word& fieldName, // name of field
169  const Field<tensor>& values,
170  const bool isNodeValues,
171  const bool verbose = false
172  ) const;
173 };
174 
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 } // End namespace Foam
179 
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 
182 #endif
183 
184 // ************************************************************************* //
A class for handling file names.
Definition: fileName.H:79
virtual ~vtkSurfaceWriter()
Destructor.
const pointField & points
A class for handling words, derived from string.
Definition: word.H:59
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
virtual void write(const fileName &outputDir, const fileName &surfaceName, const pointField &points, const faceList &faces, const bool verbose=false) const
Write single surface geometry to file.
vtkSurfaceWriter()
Construct null.
A surfaceWriter for VTK legacy format.
Base class for surface writers.
Definition: surfaceWriter.H:54
TypeName("vtk")
Runtime type information.
Namespace for OpenFOAM.