ensightSurfaceWriter.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::ensightSurfaceWriter
26 
27 Description
28  A surfaceWriter for Ensight format.
29 
30 SourceFiles
31  ensightSurfaceWriter.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef ensightSurfaceWriter_H
36 #define ensightSurfaceWriter_H
37 
38 #include "surfaceWriter.H"
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 /*---------------------------------------------------------------------------*\
46  Class ensightSurfaceWriter Declaration
47 \*---------------------------------------------------------------------------*/
48 
50 :
51  public surfaceWriter
52 {
53  // Private data
54 
55  //- Write option (default is IOstream::ASCII
57 
58  bool collateTimes_;
59 
60 
61  // Private Member Functions
62 
63  //- Templated write operation - one file per timestep
64  template<class Type>
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 bool verbose
75  ) const;
76 
77  //- Templated write operation - all time steps in single file
78  template<class Type>
80  (
81  const fileName& outputDir,
82  const fileName& surfaceName,
83  const pointField& points,
84  const faceList& faces,
85  const word& fieldName,
86  const Field<Type>& values,
87  const bool isNodeValues,
88  const bool verbose
89  ) const;
90 
91  //- Templated write operation
92  template<class Type>
94  (
95  const fileName& outputDir,
96  const fileName& surfaceName,
97  const pointField& points,
98  const faceList& faces,
99  const word& fieldName,
100  const Field<Type>& values,
101  const bool isNodeValues,
102  const bool verbose
103  ) const;
104 
105 
106 public:
107 
108  //- Runtime type information
109  TypeName("ensight");
110 
111 
112  // Constructors
113 
114  //- Construct null
116 
117  //- Construct with some output options
118  ensightSurfaceWriter(const dictionary& options);
119 
120 
121  //- Destructor
122  virtual ~ensightSurfaceWriter();
123 
124 
125  // Member Functions
126 
127  //- True if the surface format supports geometry in a separate file.
128  // False if geometry and field must be in a single file
129  virtual bool separateGeometry() const
130  {
131  return !collateTimes_;
132  }
133 
134 
135  //- Write single surface geometry to file.
136  virtual fileName write
137  (
138  const fileName& outputDir,
139  const fileName& surfaceName,
140  const pointField& points,
141  const faceList& faces,
142  const bool verbose = false
143  ) const;
144 
145 
146  //- Write scalarField for a single surface to file.
147  // One value per face or vertex (isNodeValues = true)
148  virtual fileName 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<scalar>& values,
156  const bool isNodeValues,
157  const bool verbose = false
158  ) const;
159 
160  //- Write vectorField for a single surface to file.
161  // One value per face or vertex (isNodeValues = true)
162  virtual fileName 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<vector>& values,
170  const bool isNodeValues,
171  const bool verbose = false
172  ) const;
173 
174  //- Write sphericalTensorField for a single surface to file.
175  // One value per face or vertex (isNodeValues = true)
176  virtual fileName write
177  (
178  const fileName& outputDir, // <case>/surface/TIME
179  const fileName& surfaceName, // name of surface
180  const pointField& points,
181  const faceList& faces,
182  const word& fieldName, // name of field
183  const Field<sphericalTensor>& values,
184  const bool isNodeValues,
185  const bool verbose = false
186  ) const;
187 
188  //- Write symmTensorField for a single surface to file.
189  // One value per face or vertex (isNodeValues = true)
190  virtual fileName write
191  (
192  const fileName& outputDir, // <case>/surface/TIME
193  const fileName& surfaceName, // name of surface
194  const pointField& points,
195  const faceList& faces,
196  const word& fieldName, // name of field
197  const Field<symmTensor>& values,
198  const bool isNodeValues,
199  const bool verbose = false
200  ) const;
201 
202  //- Write tensorField for a single surface to file.
203  // One value per face or vertex (isNodeValues = true)
204  virtual fileName write
205  (
206  const fileName& outputDir, // <case>/surface/TIME
207  const fileName& surfaceName, // name of surface
208  const pointField& points,
209  const faceList& faces,
210  const word& fieldName, // name of field
211  const Field<tensor>& values,
212  const bool isNodeValues,
213  const bool verbose = false
214  ) const;
215 };
216 
217 
218 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
219 
220 } // End namespace Foam
221 
222 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
223 
224 #ifdef NoRepository
226 #endif
227 
228 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
229 
230 #endif
231 
232 // ************************************************************************* //
Foam::ensightSurfaceWriter::~ensightSurfaceWriter
virtual ~ensightSurfaceWriter()
Destructor.
Definition: ensightSurfaceWriter.C:65
Foam::ensightSurfaceWriter::writeCollated
fileName writeCollated(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 - one file per timestep.
Foam::ensightSurfaceWriter::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.
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::ensightSurfaceWriter::collateTimes_
bool collateTimes_
Definition: ensightSurfaceWriter.H:57
Foam::ensightSurfaceWriter::TypeName
TypeName("ensight")
Runtime type information.
Foam::ensightSurfaceWriter::writeUncollated
fileName writeUncollated(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 - all time steps in single file.
Foam::ensightSurfaceWriter
A surfaceWriter for Ensight format.
Definition: ensightSurfaceWriter.H:48
surfaceWriter.H
ensightSurfaceWriterTemplates.C
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::ensightSurfaceWriter::separateGeometry
virtual bool separateGeometry() const
True if the surface format supports geometry in a separate file.
Definition: ensightSurfaceWriter.H:128
Foam::ensightSurfaceWriter::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: ensightSurfaceWriter.C:72
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
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::ensightSurfaceWriter::writeFormat_
IOstream::streamFormat writeFormat_
Write option (default is IOstream::ASCII.
Definition: ensightSurfaceWriter.H:55
Foam::ensightSurfaceWriter::ensightSurfaceWriter
ensightSurfaceWriter()
Construct null.
Definition: ensightSurfaceWriter.C:41
Foam::IOstream::streamFormat
streamFormat
Enumeration for the format of data in the stream.
Definition: IOstream.H:86