dxSurfaceWriter.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::dxSurfaceWriter
26 
27 Description
28  A surfaceWriter for OpenDX format.
29 
30 SourceFiles
31  dxSurfaceWriter.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef dxSurfaceWriter_H
36 #define dxSurfaceWriter_H
37 
38 #include "surfaceWriter.H"
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 /*---------------------------------------------------------------------------*\
46  Class dxSurfaceWriter Declaration
47 \*---------------------------------------------------------------------------*/
48 
49 class dxSurfaceWriter
50 :
51  public surfaceWriter
52 {
53 
54  // Private Member Functions
55 
56  static void writeGeometry(Ostream&, const pointField&, const faceList&);
57  static void writeTrailer(Ostream&, const bool isNodeValues);
58 
59  template<class Type>
60  static void writeData(Ostream&, const Field<Type>&);
61 
62  //- Templated write operation
63  template<class Type>
65  (
66  const fileName& outputDir,
67  const fileName& surfaceName,
68  const pointField& points,
69  const faceList& faces,
70  const word& fieldName,
71  const Field<Type>& values,
72  const bool isNodeValues,
73  const bool verbose
74  ) const;
75 
76 
77 public:
78 
79  //- Runtime type information
80  TypeName("dx");
81 
82 
83  // Constructors
84 
85  //- Construct null
87 
88 
89  //- Destructor
90  virtual ~dxSurfaceWriter();
91 
92 
93  // Member Functions
94 
95  //- Write scalarField for a single surface to file.
96  // One value per face or vertex (isNodeValues = true)
97  virtual fileName write
98  (
99  const fileName& outputDir, // <case>/surface/TIME
100  const fileName& surfaceName, // name of surface
101  const pointField& points,
102  const faceList& faces,
103  const word& fieldName, // name of field
104  const Field<scalar>& values,
105  const bool isNodeValues,
106  const bool verbose = false
107  ) const;
108 
109  //- Write vectorField for a single surface to file.
110  // One value per face or vertex (isNodeValues = true)
111  virtual fileName write
112  (
113  const fileName& outputDir, // <case>/surface/TIME
114  const fileName& surfaceName, // name of surface
115  const pointField& points,
116  const faceList& faces,
117  const word& fieldName, // name of field
118  const Field<vector>& values,
119  const bool isNodeValues,
120  const bool verbose = false
121  ) const;
122 
123  //- Write sphericalTensorField for a single surface to file.
124  // One value per face or vertex (isNodeValues = true)
125  virtual fileName write
126  (
127  const fileName& outputDir, // <case>/surface/TIME
128  const fileName& surfaceName, // name of surface
129  const pointField& points,
130  const faceList& faces,
131  const word& fieldName, // name of field
132  const Field<sphericalTensor>& values,
133  const bool isNodeValues,
134  const bool verbose = false
135  ) const;
136 
137  //- Write symmTensorField for a single surface to file.
138  // One value per face or vertex (isNodeValues = true)
139  virtual fileName write
140  (
141  const fileName& outputDir, // <case>/surface/TIME
142  const fileName& surfaceName, // name of surface
143  const pointField& points,
144  const faceList& faces,
145  const word& fieldName, // name of field
146  const Field<symmTensor>& values,
147  const bool isNodeValues,
148  const bool verbose = false
149  ) const;
150 
151  //- Write tensorField for a single surface to file.
152  // One value per face or vertex (isNodeValues = true)
153  virtual fileName write
154  (
155  const fileName& outputDir, // <case>/surface/TIME
156  const fileName& surfaceName, // name of surface
157  const pointField& points,
158  const faceList& faces,
159  const word& fieldName, // name of field
160  const Field<tensor>& values,
161  const bool isNodeValues,
162  const bool verbose = false
163  ) const;
164 };
165 
166 
167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168 
169 } // End namespace Foam
170 
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 
173 #ifdef NoRepository
174  #include "dxSurfaceWriterTemplates.C"
175 #endif
176 
177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178 
179 #endif
180 
181 // ************************************************************************* //
Foam::dxSurfaceWriter::writeData
static void writeData(Ostream &, const Field< Type > &)
Definition: dxSurfaceWriterTemplates.C:33
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::dxSurfaceWriter::writeGeometry
static void writeGeometry(Ostream &, const pointField &, const faceList &)
Definition: dxSurfaceWriter.C:40
dxSurfaceWriterTemplates.C
Foam::dxSurfaceWriter::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.
surfaceWriter.H
Foam::dxSurfaceWriter::~dxSurfaceWriter
virtual ~dxSurfaceWriter()
Destructor.
Definition: dxSurfaceWriter.C:222
Foam::dxSurfaceWriter::TypeName
TypeName("dx")
Runtime type information.
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::dxSurfaceWriter::writeTrailer
static void writeTrailer(Ostream &, const bool isNodeValues)
Definition: dxSurfaceWriter.C:85
Foam::dxSurfaceWriter::dxSurfaceWriter
dxSurfaceWriter()
Construct null.
Definition: dxSurfaceWriter.C:214
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::dxSurfaceWriter::write
virtual fileName write(const fileName &outputDir, const fileName &surfaceName, const pointField &points, const faceList &faces, const word &fieldName, const Field< scalar > &values, const bool isNodeValues, const bool verbose=false) const
Write scalarField for a single surface to file.
Foam::dxSurfaceWriter
A surfaceWriter for OpenDX format.
Definition: dxSurfaceWriter.H:48
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53