Loading...
Searching...
No Matches
ensightSurfaceWriter.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 OpenFOAM Foundation
9 Copyright (C) 2015-2023 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::ensightWriter
29
30Description
31 A surfaceWriter for Ensight format.
32
33 \verbatim
34 formatOptions
35 {
36 ensight
37 {
38 format ascii;
39 collateTimes true;
40 }
41 }
42 \endverbatim
43
44 Format options for ensight:
45 \table
46 Property | Description | Required | Default
47 format | ascii/binary | no | binary
48 collateTimes | Use common geometry for times | no | true
49 scale | Output geometry scaling | no | 1
50 transform | Output coordinate transform | no |
51 fieldLevel | Subtract field level before scaling | no | empty dict
52 fieldScale | Output field scaling | no | empty dict
53 timeFormat | Time format (ensight case) | no | scientific
54 timePrecision | Time precision (ensight case) | no | 5
55 \endtable
56
57 The collated format maintains an internal list of the known times
58 as well as a file-cached version with the field information.
59 The information is used for restarts.
60
61SourceFiles
62 ensightSurfaceWriter.C
63
64\*---------------------------------------------------------------------------*/
65
66#ifndef Foam_surfaceWriters_ensightWriter_H
67#define Foam_surfaceWriters_ensightWriter_H
68
69#include "surfaceWriter.H"
70#include "ensightCase.H"
72
73// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
74
75namespace Foam
76{
77namespace surfaceWriters
78{
79
80/*---------------------------------------------------------------------------*\
81 Class ensightWriter Declaration
82\*---------------------------------------------------------------------------*/
83
84class ensightWriter
85:
86 public surfaceWriter
87{
88 // Private Data
89
90 //- Ensight case options
91 ensightCase::options caseOpts_;
92
93 //- Collate times (default: true)
94 bool collateTimes_;
95
96 //- Cached information for times, geometry, fields (collated)
97 ensightOutput::writerCaching caching_;
98
99
100 // Private Member Functions
101
102 //- Write geometry
103 fileName writeCollated();
104
105 //- Write geometry
106 fileName writeUncollated();
107
108 //- Templated write operation - one file per timestep
109 template<class Type>
110 fileName writeCollated
111 (
112 const word& fieldName,
113 const Field<Type>& localValues
114 );
115
116 //- Templated write operation - all time steps in single file
117 template<class Type>
118 fileName writeUncollated
119 (
120 const word& fieldName,
121 const Field<Type>& localValues
122 );
123
124 //- Templated write operation
125 template<class Type>
126 fileName writeTemplate
127 (
128 const word& fieldName,
129 const Field<Type>& localValues
130 );
131
132public:
133
134 //- Declare type-name, virtual type (without debug switch)
135 TypeNameNoDebug("ensight");
136
137
138 // Constructors
139
140 //- Default construct
142
143 //- Construct with some output options
144 explicit ensightWriter(const dictionary& options);
145
146 //- Construct from components
148 (
149 const meshedSurf& surf,
150 const fileName& outputPath,
151 bool parallel = UPstream::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 = UPstream::parRun(),
162 const dictionary& options = dictionary()
163 );
164
165
166 //- Destructor
167 virtual ~ensightWriter() = default;
168
169
170 // Member Functions
171
172 //- Finish output, clears output times.
173 // Later reuse will rebuild times from fieldsDict file cache.
174 virtual void close(); // override
175
176 //- True if the surface format supports geometry in a separate file.
177 // False if geometry and field must be in a single file
178 virtual bool separateGeometry() const;
179
180 //- Write surface geometry to file.
181 virtual fileName write(); // override
182
189};
190
191
192// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194} // End namespace surfaceWriters
195} // End namespace Foam
196
197// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198
199#endif
200
201// ************************************************************************* //
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
Definition Field.H:172
static bool parRun(const bool on) noexcept
Set as parallel run on/off.
Definition UPstream.H:1669
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Configuration options for the ensightCase.
State information for writers with collated times.
A class for handling file names.
Definition fileName.H:75
Abstract definition of a meshed surface defined by faces and points.
Definition meshedSurf.H:44
surfaceWriter()
Default construct.
A surfaceWriter for Ensight format.
virtual ~ensightWriter()=default
Destructor.
declareSurfaceWriterWriteMethod(sphericalTensor)
virtual void close()
Finish output, clears output times.
virtual bool separateGeometry() const
True if the surface format supports geometry in a separate file.
TypeNameNoDebug("ensight")
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:66
const pointField & points
Namespace for surface writers.
Namespace for OpenFOAM.
List< face > faceList
List of faces.
Definition faceListFwd.H:41
Tensor< scalar > tensor
Definition symmTensor.H:57
vectorField pointField
pointField is a vectorField.
Vector< scalar > vector
Definition vector.H:57
SphericalTensor< scalar > sphericalTensor
SphericalTensor of scalars, i.e. SphericalTensor<scalar>.
SymmTensor< scalar > symmTensor
SymmTensor of scalars, i.e. SymmTensor<scalar>.
Definition symmTensor.H:55
#define declareSurfaceWriterWriteMethod(Type)
#define TypeNameNoDebug(TypeNameString)
Declare a ClassNameNoDebug() with extra virtual type info.
Definition typeInfo.H:61