rawSurfaceWriter.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-2016 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::rawSurfaceWriter
26 
27 Description
28  A surfaceWriter for raw output.
29 
30 SourceFiles
31  rawSurfaceWriter.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef rawSurfaceWriter_H
36 #define rawSurfaceWriter_H
37 
38 #include "surfaceWriter.H"
39 
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 /*---------------------------------------------------------------------------*\
47  Class rawSurfaceWriter Declaration
48 \*---------------------------------------------------------------------------*/
49 
50 class rawSurfaceWriter
51 :
52  public surfaceWriter
53 {
54  // Private data
55 
56  //- Output compression, defaults to uncompressed
57  IOstream::compressionType writeCompression_;
58 
59 
60  // Private Member Functions
61 
62  static inline void writeLocation
63  (
64  Ostream&,
65  const pointField&,
66  const label pointi
67  );
68 
69  static inline void writeLocation
70  (
71  Ostream&,
72  const pointField&,
73  const faceList&,
74  const label facei
75  );
76 
77  template<class Type>
78  static void writeHeader
79  (
80  Ostream&,
81  const word& fieldName,
82  const Field<Type>&
83  );
84 
85  template<class Type>
86  static inline void writeData(Ostream&, const Type&);
87 
88 
89  //- Templated write operation
90  template<class Type>
91  void writeTemplate
92  (
93  const fileName& outputDir,
94  const fileName& surfaceName,
95  const pointField& points,
96  const faceList& faces,
97  const word& fieldName,
98  const Field<Type>& values,
99  const bool isNodeValues,
100  const bool verbose
101  ) const;
102 
103 
104 public:
105 
106  //- Runtime type information
107  TypeName("raw");
108 
109 
110  // Constructors
111 
112  //- Construct null
114 
115  //- Construct with some output options
116  rawSurfaceWriter(const dictionary& options);
117 
118 
119  //- Destructor
120  virtual ~rawSurfaceWriter();
121 
122 
123  // Member Functions
124 
125  //- Write single surface geometry to file.
126  virtual void write
127  (
128  const fileName& outputDir,
129  const fileName& surfaceName,
130  const pointField& points,
131  const faceList& faces,
132  const bool verbose = false
133  ) const;
134 
135 
136  //- Write scalarField for a single surface to file.
137  // One value per face or vertex (isNodeValues = true)
138  virtual void write
139  (
140  const fileName& outputDir, // <case>/surface/TIME
141  const fileName& surfaceName, // name of surface
142  const pointField& points,
143  const faceList& faces,
144  const word& fieldName, // name of field
145  const Field<scalar>& values,
146  const bool isNodeValues,
147  const bool verbose = false
148  ) const;
149 
150  //- Write vectorField for a single surface to file.
151  // One value per face or vertex (isNodeValues = true)
152  virtual void write
153  (
154  const fileName& outputDir, // <case>/surface/TIME
155  const fileName& surfaceName, // name of surface
156  const pointField& points,
157  const faceList& faces,
158  const word& fieldName, // name of field
159  const Field<vector>& values,
160  const bool isNodeValues,
161  const bool verbose = false
162  ) const;
163 
164  //- Write sphericalTensorField for a single surface to file.
165  // One value per face or vertex (isNodeValues = true)
166  virtual void write
167  (
168  const fileName& outputDir, // <case>/surface/TIME
169  const fileName& surfaceName, // name of surface
170  const pointField& points,
171  const faceList& faces,
172  const word& fieldName, // name of field
173  const Field<sphericalTensor>& values,
174  const bool isNodeValues,
175  const bool verbose = false
176  ) const;
177 
178  //- Write symmTensorField for a single surface to file.
179  // One value per face or vertex (isNodeValues = true)
180  virtual void write
181  (
182  const fileName& outputDir, // <case>/surface/TIME
183  const fileName& surfaceName, // name of surface
184  const pointField& points,
185  const faceList& faces,
186  const word& fieldName, // name of field
187  const Field<symmTensor>& values,
188  const bool isNodeValues,
189  const bool verbose = false
190  ) const;
191 
192  //- Write tensorField for a single surface to file.
193  // One value per face or vertex (isNodeValues = true)
194  virtual void write
195  (
196  const fileName& outputDir, // <case>/surface/TIME
197  const fileName& surfaceName, // name of surface
198  const pointField& points,
199  const faceList& faces,
200  const word& fieldName, // name of field
201  const Field<tensor>& values,
202  const bool isNodeValues,
203  const bool verbose = false
204  ) const;
205 };
206 
207 
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 
210 } // End namespace Foam
211 
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 
214 #endif
215 
216 // ************************************************************************* //
A surfaceWriter for raw output.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
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
TypeName("raw")
Runtime type information.
virtual ~rawSurfaceWriter()
Destructor.
const pointField & points
A class for handling words, derived from string.
Definition: word.H:59
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.
compressionType
Enumeration for the format of data in the stream.
Definition: IOstream.H:193
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
rawSurfaceWriter()
Construct null.
Base class for surface writers.
Definition: surfaceWriter.H:54
Namespace for OpenFOAM.