foamSurfaceWriter.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 | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011-2016 OpenFOAM Foundation
9 Copyright (C) 2015-2022 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::surfaceWriters::foamWriter
29
30Description
31 A surfaceWriter for OpenFOAM surfaces
32
33 \verbatim
34 formatOptions
35 {
36 foam
37 {
38 format ascii;
39 compression true;
40 fieldLevel
41 {
42 p 1e5; // Absolute -> gauge [Pa]
43 }
44 fieldScale
45 {
46 "p.*" 0.01; // [Pa] -> [mbar]
47 }
48 }
49 }
50 \endverbatim
51
52 Format options:
53 \table
54 Property | Description | Required | Default
55 format | ascii/binary | no | ascii
56 compression | Use file compression | no | false
57 scale | Output geometry scaling | no | 1
58 transform | Output coordinate transform | no |
59 fieldLevel | Subtract field level before scaling | no | empty dict
60 fieldScale | Output field scaling | no | empty dict
61 \endtable
62
63 \section Output file locations
64
65 The \c rootdir normally corresponds to something like
66 \c postProcessing/<name>
67
68 \subsection Geometry
69 \verbatim
70 rootdir
71 `-- timeName
72 `-- surfaceName
73 |-- "points"
74 |-- "faceCentres"
75 `-- "faces"
76 \endverbatim
77
78 \subsection Fields
79 \verbatim
80 rootdir
81 `-- timeName
82 `-- surfaceName
83 |-- scalarField
84 | |-- field
85 | `-- field
86 |-- vectorField
87 |-- field
88 `-- field
89 \endverbatim
90
91SourceFiles
92 foamSurfaceWriter.C
93
94\*---------------------------------------------------------------------------*/
95
96#ifndef Foam_surfaceWriters_foamWriter_H
97#define Foam_surfaceWriters_foamWriter_H
98
99#include "surfaceWriter.H"
100
101// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
102
103namespace Foam
104{
105namespace surfaceWriters
106{
107
108/*---------------------------------------------------------------------------*\
109 Class foamWriter Declaration
110\*---------------------------------------------------------------------------*/
111
112class foamWriter
113:
114 public surfaceWriter
115{
116 // Private Data
117
118 //- Output stream option (default: ASCII, uncompressed)
119 IOstreamOption streamOpt_;
120
121
122 // Private Member Functions
123
124 //- Templated write operation
125 template<class Type>
126 fileName writeTemplate
127 (
128 const word& fieldName,
129 const Field<Type>& localValues
130 );
131
132
133public:
134
135 //- Declare type-name, virtual type (without debug switch)
136 TypeNameNoDebug("foam");
137
138
139 // Constructors
140
141 //- Default construct
142 foamWriter();
143
144 //- Construct with some output options
145 explicit foamWriter(const dictionary& options);
147 //- Construct from components
149 (
150 const meshedSurf& surf,
151 const fileName& outputPath,
152 bool parallel = Pstream::parRun(),
153 const dictionary& options = dictionary()
154 );
155
156 //- Construct from components
158 (
159 const pointField& points,
160 const faceList& faces,
161 const fileName& outputPath,
162 bool parallel = Pstream::parRun(),
163 const dictionary& options = dictionary()
164 );
165
166
167 //- Destructor
168 virtual ~foamWriter() = default;
169
171 // Member Functions
172
173 //- The surface format has geometry in a separate file.
174 virtual bool separateGeometry() const
175 {
176 return true;
177 }
178
179 //- Write surface geometry to file.
180 virtual fileName write(); // override
181
188};
189
190
191// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192
193} // End namespace surfaceWriters
194} // End namespace Foam
195
196// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197
198#endif
199
200// ************************************************************************* //
Generic templated field type.
Definition: Field.H:82
The IOstreamOption is a simple container for options an IOstream can normally have.
static bool & parRun() noexcept
Test if this a parallel run.
Definition: UPstream.H:433
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A class for handling file names.
Definition: fileName.H:76
Abstract definition of a meshed surface defined by faces and points.
Definition: meshedSurf.H:50
Base class for surface writers.
A surfaceWriter for OpenFOAM surfaces.
TypeNameNoDebug("foam")
Declare type-name, virtual type (without debug switch)
declareSurfaceWriterWriteMethod(sphericalTensor)
virtual bool separateGeometry() const
The surface format has geometry in a separate file.
virtual ~foamWriter()=default
Destructor.
virtual fileName write()
Write surface geometry to file.
A class for handling words, derived from Foam::string.
Definition: word.H:68
const pointField & points
Namespace for OpenFOAM.
#define declareSurfaceWriterWriteMethod(Type)
#define TypeNameNoDebug(TypeNameString)
Declare a ClassNameNoDebug() with extra virtual type info.
Definition: typeInfo.H:68