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 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::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 Member Functions
55 
56  static inline void writeLocation
57  (
58  Ostream&,
59  const pointField&,
60  const label pointI
61  );
62 
63  static inline void writeLocation
64  (
65  Ostream&,
66  const pointField&,
67  const faceList&,
68  const label faceI
69  );
70 
71  template<class Type>
72  static void writeHeader
73  (
74  Ostream&,
75  const word& fieldName,
76  const Field<Type>&
77  );
78 
79  template<class Type>
80  static inline void writeData(Ostream&, const Type&);
81 
82 
83  //- Templated write operation
84  template<class Type>
86  (
87  const fileName& outputDir,
88  const fileName& surfaceName,
89  const pointField& points,
90  const faceList& faces,
91  const word& fieldName,
92  const Field<Type>& values,
93  const bool isNodeValues,
94  const bool verbose
95  ) const;
96 
97 
98 public:
99 
100  //- Runtime type information
101  TypeName("raw");
102 
103 
104  // Constructors
105 
106  //- Construct null
108 
109 
110  //- Destructor
111  virtual ~rawSurfaceWriter();
112 
113 
114  // Member Functions
115 
116  //- Write single surface geometry to file.
117  virtual fileName write
118  (
119  const fileName& outputDir,
120  const fileName& surfaceName,
121  const pointField& points,
122  const faceList& faces,
123  const bool verbose = false
124  ) const;
125 
126 
127  //- Write scalarField for a single surface to file.
128  // One value per face or vertex (isNodeValues = true)
129  virtual fileName write
130  (
131  const fileName& outputDir, // <case>/surface/TIME
132  const fileName& surfaceName, // name of surface
133  const pointField& points,
134  const faceList& faces,
135  const word& fieldName, // name of field
136  const Field<scalar>& values,
137  const bool isNodeValues,
138  const bool verbose = false
139  ) const;
140 
141  //- Write vectorField for a single surface to file.
142  // One value per face or vertex (isNodeValues = true)
143  virtual fileName write
144  (
145  const fileName& outputDir, // <case>/surface/TIME
146  const fileName& surfaceName, // name of surface
147  const pointField& points,
148  const faceList& faces,
149  const word& fieldName, // name of field
150  const Field<vector>& values,
151  const bool isNodeValues,
152  const bool verbose = false
153  ) const;
154 
155  //- Write sphericalTensorField for a single surface to file.
156  // One value per face or vertex (isNodeValues = true)
157  virtual fileName write
158  (
159  const fileName& outputDir, // <case>/surface/TIME
160  const fileName& surfaceName, // name of surface
161  const pointField& points,
162  const faceList& faces,
163  const word& fieldName, // name of field
164  const Field<sphericalTensor>& values,
165  const bool isNodeValues,
166  const bool verbose = false
167  ) const;
168 
169  //- Write symmTensorField for a single surface to file.
170  // One value per face or vertex (isNodeValues = true)
171  virtual fileName write
172  (
173  const fileName& outputDir, // <case>/surface/TIME
174  const fileName& surfaceName, // name of surface
175  const pointField& points,
176  const faceList& faces,
177  const word& fieldName, // name of field
178  const Field<symmTensor>& values,
179  const bool isNodeValues,
180  const bool verbose = false
181  ) const;
182 
183  //- Write tensorField for a single surface to file.
184  // One value per face or vertex (isNodeValues = true)
185  virtual fileName write
186  (
187  const fileName& outputDir, // <case>/surface/TIME
188  const fileName& surfaceName, // name of surface
189  const pointField& points,
190  const faceList& faces,
191  const word& fieldName, // name of field
192  const Field<tensor>& values,
193  const bool isNodeValues,
194  const bool verbose = false
195  ) const;
196 };
197 
198 
199 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
200 
201 } // End namespace Foam
202 
203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 
205 #ifdef NoRepository
206  #include "rawSurfaceWriterTemplates.C"
207 #endif
208 
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 
211 #endif
212 
213 // ************************************************************************* //
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::rawSurfaceWriter::rawSurfaceWriter
rawSurfaceWriter()
Construct null.
Definition: rawSurfaceWriter.C:208
Foam::rawSurfaceWriter
A surfaceWriter for raw output.
Definition: rawSurfaceWriter.H:49
surfaceWriter.H
Foam::rawSurfaceWriter::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::rawSurfaceWriter::~rawSurfaceWriter
virtual ~rawSurfaceWriter()
Destructor.
Definition: rawSurfaceWriter.C:216
Foam::rawSurfaceWriter::writeHeader
static void writeHeader(Ostream &, const word &fieldName, const Field< Type > &)
Foam::label
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
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::rawSurfaceWriter::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: rawSurfaceWriter.C:223
Foam::rawSurfaceWriter::TypeName
TypeName("raw")
Runtime type information.
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::rawSurfaceWriter::writeLocation
static void writeLocation(Ostream &, const pointField &, const label pointI)
Definition: rawSurfaceWriter.C:40
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
rawSurfaceWriterTemplates.C
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::rawSurfaceWriter::writeData
static void writeData(Ostream &, const Type &)