foamSurfaceWriter.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2020 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::foamSurfaceWriter
26 
27 Description
28  A surfaceWriter for native OpenFOAM format
29  with support for writing ASCII or binary.
30 
31 SourceFiles
32  foamSurfaceWriter.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef foamSurfaceWriter_H
37 #define foamSurfaceWriter_H
38 
39 #include "surfaceWriter.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 /*---------------------------------------------------------------------------*\
47  Class foamSurfaceWriter Declaration
48 \*---------------------------------------------------------------------------*/
49 
51 :
52  public surfaceWriter
53 {
54  // Private Member Functions
55 
56  //- Templated write operation
57  template<class Type>
58  void Write
59  (
60  const fileName& outputDir,
61  const fileName& surfaceName,
62  const pointField& points,
63  const faceList& faces,
64  const word& fieldName,
65  const Field<Type>& values,
66  const bool isNodeValues
67  ) const;
68 
69 
70 public:
71 
72  //- Runtime type information
73  TypeName("foam");
74 
75 
76  // Constructors
77 
78  //- Construct given write format
79  foamSurfaceWriter(const IOstream::streamFormat writeFormat);
80 
81 
82  //- Destructor
83  virtual ~foamSurfaceWriter();
84 
85 
86  // Member Functions
87 
88  //- True if the surface format supports geometry in a separate file.
89  // False if geometry and field must be in a single file
90  virtual bool separateGeometry()
91  {
92  return true;
93  }
94 
95  //- Write single surface geometry to file.
96  virtual void write
97  (
98  const fileName& outputDir,
99  const fileName& surfaceName,
100  const pointField& points,
101  const faceList& faces
102  ) const;
103 
104 
105  //- Write scalarField for a single surface to file.
106  // One value per face or vertex (isNodeValues = true)
107  virtual void write
108  (
109  const fileName& outputDir, // <case>/surface/TIME
110  const fileName& surfaceName, // name of surface
111  const pointField& points,
112  const faceList& faces,
113  const word& fieldName, // name of field
114  const Field<scalar>& values,
115  const bool isNodeValues
116  ) const;
117 
118  //- Write vectorField for a single surface to file.
119  // One value per face or vertex (isNodeValues = true)
120  virtual void write
121  (
122  const fileName& outputDir, // <case>/surface/TIME
123  const fileName& surfaceName, // name of surface
124  const pointField& points,
125  const faceList& faces,
126  const word& fieldName, // name of field
127  const Field<vector>& values,
128  const bool isNodeValues
129  ) const;
130 
131  //- Write sphericalTensorField for a single surface to file.
132  // One value per face or vertex (isNodeValues = true)
133  virtual void write
134  (
135  const fileName& outputDir, // <case>/surface/TIME
136  const fileName& surfaceName, // name of surface
137  const pointField& points,
138  const faceList& faces,
139  const word& fieldName, // name of field
140  const Field<sphericalTensor>& values,
141  const bool isNodeValues
142  ) const;
143 
144  //- Write symmTensorField 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<symmTensor>& values,
154  const bool isNodeValues
155  ) const;
156 
157  //- Write tensorField for a single surface to file.
158  // One value per face or vertex (isNodeValues = true)
159  virtual void write
160  (
161  const fileName& outputDir, // <case>/surface/TIME
162  const fileName& surfaceName, // name of surface
163  const pointField& points,
164  const faceList& faces,
165  const word& fieldName, // name of field
166  const Field<tensor>& values,
167  const bool isNodeValues
168  ) const;
169 };
170 
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 
174 } // End namespace Foam
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 #endif
179 
180 // ************************************************************************* //
virtual ~foamSurfaceWriter()
Destructor.
foamSurfaceWriter(const IOstream::streamFormat writeFormat)
Construct given write format.
A class for handling file names.
Definition: fileName.H:79
TypeName("foam")
Runtime type information.
A surfaceWriter for native OpenFOAM format with support for writing ASCII or binary.
virtual bool separateGeometry()
True if the surface format supports geometry in a separate file.
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
Base class for surface writers.
Definition: surfaceWriter.H:54
Namespace for OpenFOAM.
virtual void write(const fileName &outputDir, const fileName &surfaceName, const pointField &points, const faceList &faces) const
Write single surface geometry to file.