vtkSurfaceWriter.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 | Copyright (C) 2011 OpenFOAM Foundation
6  \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
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>
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 
76 public:
77 
78  //- Runtime type information
79  TypeName("vtk");
80 
81 
82  // Constructors
83 
84  //- Construct null
86 
87 
88  //- Destructor
89  virtual ~vtkSurfaceWriter();
90 
91 
92  // Member Functions
93 
94  //- Write single surface geometry to file.
95  virtual fileName write
96  (
97  const fileName& outputDir,
98  const fileName& surfaceName,
99  const pointField& points,
100  const faceList& faces,
101  const bool verbose = false
102  ) const;
103 
104 
105  //- Write scalarField for a single surface to file.
106  // One value per face or vertex (isNodeValues = true)
107  virtual fileName 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 bool verbose = false
117  ) const;
118 
119  //- Write vectorField for a single surface to file.
120  // One value per face or vertex (isNodeValues = true)
121  virtual fileName write
122  (
123  const fileName& outputDir, // <case>/surface/TIME
124  const fileName& surfaceName, // name of surface
125  const pointField& points,
126  const faceList& faces,
127  const word& fieldName, // name of field
128  const Field<vector>& values,
129  const bool isNodeValues,
130  const bool verbose = false
131  ) const;
132 
133  //- Write sphericalTensorField for a single surface to file.
134  // One value per face or vertex (isNodeValues = true)
135  virtual fileName write
136  (
137  const fileName& outputDir, // <case>/surface/TIME
138  const fileName& surfaceName, // name of surface
139  const pointField& points,
140  const faceList& faces,
141  const word& fieldName, // name of field
142  const Field<sphericalTensor>& values,
143  const bool isNodeValues,
144  const bool verbose = false
145  ) const;
146 
147  //- Write symmTensorField for a single surface to file.
148  // One value per face or vertex (isNodeValues = true)
149  virtual fileName write
150  (
151  const fileName& outputDir, // <case>/surface/TIME
152  const fileName& surfaceName, // name of surface
153  const pointField& points,
154  const faceList& faces,
155  const word& fieldName, // name of field
156  const Field<symmTensor>& values,
157  const bool isNodeValues,
158  const bool verbose = false
159  ) const;
160 
161  //- Write tensorField for a single surface to file.
162  // One value per face or vertex (isNodeValues = true)
163  virtual fileName write
164  (
165  const fileName& outputDir, // <case>/surface/TIME
166  const fileName& surfaceName, // name of surface
167  const pointField& points,
168  const faceList& faces,
169  const word& fieldName, // name of field
170  const Field<tensor>& values,
171  const bool isNodeValues,
172  const bool verbose = false
173  ) const;
174 
175 };
176 
177 
178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 
180 } // End namespace Foam
181 
182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183 
184 #ifdef NoRepository
185  #include "vtkSurfaceWriterTemplates.C"
186 #endif
187 
188 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189 
190 #endif
191 
192 // ************************************************************************* //
Foam::vtkSurfaceWriter::TypeName
TypeName("vtk")
Runtime type information.
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::surfaceWriter
Base class for surface writers.
Definition: surfaceWriter.H:54
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
Foam::vtkSurfaceWriter::write
virtual fileName write(const fileName &outputDir, const fileName &surfaceName, const pointField &points, const faceList &faces, const bool verbose=false) const
Write single surface geometry to file.
Definition: vtkSurfaceWriter.C:218
surfaceWriter.H
Foam::vtkSurfaceWriter::vtkSurfaceWriter
vtkSurfaceWriter()
Construct null.
Definition: vtkSurfaceWriter.C:203
Foam::vtkSurfaceWriter::writeData
static void writeData(Ostream &, const Field< Type > &)
Definition: vtkSurfaceWriterTemplates.C:33
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::vtkSurfaceWriter::writeGeometry
static void writeGeometry(Ostream &, const pointField &, const faceList &)
Definition: vtkSurfaceWriter.C:40
Foam::vtkSurfaceWriter::~vtkSurfaceWriter
virtual ~vtkSurfaceWriter()
Destructor.
Definition: vtkSurfaceWriter.C:211
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::vtkSurfaceWriter
A surfaceWriter for VTK legacy format.
Definition: vtkSurfaceWriter.H:48
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::vtkSurfaceWriter::writeTemplate
fileName writeTemplate(const fileName &outputDir, const fileName &surfaceName, const pointField &points, const faceList &faces, const word &fieldName, const Field< Type > &values, const bool isNodeValues, const bool verbose) const
Templated write operation.
vtkSurfaceWriterTemplates.C