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 | 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::rawWriter
29
30Description
31 A surfaceWriter for raw output.
32
33 The formatOptions for raw:
34 \table
35 Property | Description | Required | Default
36 compression | Use file compression | no | false
37 precision | Write precision in ascii | no | same as IOstream
38 scale | Output geometry scaling | no | 1
39 transform | Output coordinate transform | no |
40 fieldLevel | Subtract field level before scaling | no | empty dict
41 fieldScale | Output field scaling | no | empty dict
42 normal | Write face area normal in output | no | false
43 \endtable
44
45 For example,
46 \verbatim
47 formatOptions
48 {
49 raw
50 {
51 compression on;
52
53 scale 1000; // [m] -> [mm]
54 normal yes;
55 precision 10;
56 fieldScale
57 {
58 "p.*" 0.01; // [Pa] -> [mbar]
59 }
60 }
61 }
62 \endverbatim
63
64 \section Output file locations
65
66 The \c rootdir normally corresponds to something like
67 \c postProcessing/<name>
68
69 \subsection Geometry
70 \verbatim
71 rootdir
72 `-- timeName
73 `-- surfaceName.{raw}
74 \endverbatim
75
76 \subsection Fields
77 \verbatim
78 rootdir
79 `-- timeName
80 |-- <field0>_surfaceName.{raw}
81 `-- <field1>_surfaceName.{raw}
82 \endverbatim
83
84SourceFiles
85 rawSurfaceWriter.C
86
87\*---------------------------------------------------------------------------*/
88
89#ifndef Foam_surfaceWriters_rawWriter_H
90#define Foam_surfaceWriters_rawWriter_H
91
92#include "surfaceWriter.H"
93
94// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
95
96namespace Foam
97{
98namespace surfaceWriters
99{
100
101/*---------------------------------------------------------------------------*\
102 Class rawWriter Declaration
103\*---------------------------------------------------------------------------*/
104
105class rawWriter
106:
107 public surfaceWriter
108{
109 // Private Data
110
111 //- Output stream option
112 IOstreamOption streamOpt_;
113
114 //- ASCII write precision
115 unsigned precision_;
116
117 //- Output face area normal
118 const bool writeNormal_;
119
120
121 // Private Member Functions
122
123 //- Templated write operation
124 template<class Type>
125 fileName writeTemplate
126 (
127 const word& fieldName,
128 const Field<Type>& localValues
129 );
130
131
132public:
133
134 //- Declare type-name, virtual type (without debug switch)
135 TypeNameNoDebug("raw");
136
137
138 // Constructors
139
140 //- Default construct
141 rawWriter();
142
143 //- Construct with some output options
144 explicit rawWriter(const dictionary& options);
145
146 //- Construct from components
148 (
149 const meshedSurf& surf,
150 const fileName& outputPath,
151 bool parallel = Pstream::parRun(),
152 const dictionary& options = dictionary()
153 );
154
155 //- Construct from components
157 (
158 const pointField& points,
159 const faceList& faces,
160 const fileName& outputPath,
161 bool parallel = Pstream::parRun(),
162 const dictionary& options = dictionary()
163 );
164
165
166 //- Destructor
167 virtual ~rawWriter() = default;
168
169
170 // Member Functions
171
172 //- Write surface geometry to file.
173 virtual fileName write(); // override
181};
182
183
184// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185
186} // End namespace surfaceWriters
187} // End namespace Foam
188
189// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190
191#endif
192
193// ************************************************************************* //
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 raw output.
declareSurfaceWriterWriteMethod(symmTensor)
declareSurfaceWriterWriteMethod(sphericalTensor)
virtual ~rawWriter()=default
Destructor.
TypeNameNoDebug("raw")
Declare type-name, virtual type (without debug switch)
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