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 |
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
56  IOstream::streamFormat writeFormat_;
57 
58 
59  // Private Member Functions
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 
76 public:
77 
78  //- Runtime type information
79  TypeName("ensight");
80 
81 
82  // Constructors
83 
84  //- Construct null
86 
87  //- Construct with some output options
88  ensightSurfaceWriter(const dictionary& options);
89 
90 
91  //- Destructor
92  virtual ~ensightSurfaceWriter();
93 
94 
95  // Member Functions
96 
97  //- True if the surface format supports geometry in a separate file.
98  // False if geometry and field must be in a single file
99  virtual bool separateGeometry()
100  {
101  return true;
102  }
103 
104 
105  //- Write single surface geometry to file.
106  virtual void write
107  (
108  const fileName& outputDir,
109  const fileName& surfaceName,
110  const pointField& points,
111  const faceList& faces,
112  const bool verbose = false
113  ) const;
114 
115 
116  //- Write scalarField for a single surface to file.
117  // One value per face or vertex (isNodeValues = true)
118  virtual void write
119  (
120  const fileName& outputDir, // <case>/surface/TIME
121  const fileName& surfaceName, // name of surface
122  const pointField& points,
123  const faceList& faces,
124  const word& fieldName, // name of field
125  const Field<scalar>& values,
126  const bool isNodeValues,
127  const bool verbose = false
128  ) const;
129 
130  //- Write vectorField for a single surface to file.
131  // One value per face or vertex (isNodeValues = true)
132  virtual void write
133  (
134  const fileName& outputDir, // <case>/surface/TIME
135  const fileName& surfaceName, // name of surface
136  const pointField& points,
137  const faceList& faces,
138  const word& fieldName, // name of field
139  const Field<vector>& values,
140  const bool isNodeValues,
141  const bool verbose = false
142  ) const;
143 
144  //- Write sphericalTensorField 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<sphericalTensor>& values,
154  const bool isNodeValues,
155  const bool verbose = false
156  ) const;
157 
158  //- Write symmTensorField for a single surface to file.
159  // One value per face or vertex (isNodeValues = true)
160  virtual void write
161  (
162  const fileName& outputDir, // <case>/surface/TIME
163  const fileName& surfaceName, // name of surface
164  const pointField& points,
165  const faceList& faces,
166  const word& fieldName, // name of field
167  const Field<symmTensor>& values,
168  const bool isNodeValues,
169  const bool verbose = false
170  ) const;
171 
172  //- Write tensorField for a single surface to file.
173  // One value per face or vertex (isNodeValues = true)
174  virtual void write
175  (
176  const fileName& outputDir, // <case>/surface/TIME
177  const fileName& surfaceName, // name of surface
178  const pointField& points,
179  const faceList& faces,
180  const word& fieldName, // name of field
181  const Field<tensor>& values,
182  const bool isNodeValues,
183  const bool verbose = false
184  ) const;
185 
186 };
187 
188 
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 
191 } // End namespace Foam
192 
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194 
195 #endif
196 
197 // ************************************************************************* //
A class for handling file names.
Definition: fileName.H:69
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
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.
ensightSurfaceWriter()
Construct null.
virtual ~ensightSurfaceWriter()
Destructor.
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 Ensight format.
virtual bool separateGeometry()
True if the surface format supports geometry in a separate file.
Base class for surface writers.
Definition: surfaceWriter.H:54
TypeName("ensight")
Runtime type information.
Namespace for OpenFOAM.