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-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::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 | ascii
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 \endtable
54
55 The collated format maintains an internal list of the known times
56 as well as a file-cached version with the field information.
57 The information is used for restarts.
58
59SourceFiles
60 ensightSurfaceWriter.C
61
62\*---------------------------------------------------------------------------*/
63
64#ifndef Foam_surfaceWriters_ensightWriter_H
65#define Foam_surfaceWriters_ensightWriter_H
66
67#include "surfaceWriter.H"
69
70// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
71
72namespace Foam
73{
74namespace surfaceWriters
75{
76
77/*---------------------------------------------------------------------------*\
78 Class ensightWriter Declaration
79\*---------------------------------------------------------------------------*/
80
81class ensightWriter
82:
83 public surfaceWriter
84{
85 // Private Data
86
87 //- Output format option (default: ASCII)
89
90 //- Collate times (default: true)
91 bool collateTimes_;
92
93 //- Cached information for times, geometry, fields (collated)
94 ensightOutput::writerCaching caching_;
95
96
97 // Private Member Functions
98
99 //- Write geometry
100 fileName writeCollated();
101
102 //- Write geometry
103 fileName writeUncollated();
104
105 //- Templated write operation - one file per timestep
106 template<class Type>
107 fileName writeCollated
108 (
109 const word& fieldName,
110 const Field<Type>& localValues
111 );
112
113 //- Templated write operation - all time steps in single file
114 template<class Type>
115 fileName writeUncollated
116 (
117 const word& fieldName,
118 const Field<Type>& localValues
119 );
120
121 //- Templated write operation
122 template<class Type>
123 fileName writeTemplate
124 (
125 const word& fieldName,
126 const Field<Type>& localValues
127 );
128
129public:
130
131 //- Declare type-name, virtual type (without debug switch)
132 TypeNameNoDebug("ensight");
133
134
135 // Constructors
136
137 //- Default construct
139
140 //- Construct with some output options
141 explicit ensightWriter(const dictionary& options);
142
143 //- Construct from components
145 (
146 const meshedSurf& surf,
147 const fileName& outputPath,
148 bool parallel = Pstream::parRun(),
149 const dictionary& options = dictionary()
150 );
151
152 //- Construct from components
154 (
155 const pointField& points,
156 const faceList& faces,
157 const fileName& outputPath,
158 bool parallel = Pstream::parRun(),
159 const dictionary& options = dictionary()
160 );
161
162
163 //- Destructor
164 virtual ~ensightWriter() = default;
165
167 // Member Functions
168
169 //- Finish output, clears output times.
170 // Later reuse will rebuild times from fieldsDict file cache.
171 virtual void close(); // override
172
173 //- True if the surface format supports geometry in a separate file.
174 // False if geometry and field must be in a single file
175 virtual bool separateGeometry() const;
176
177 //- Write surface geometry to file.
178 virtual fileName write(); // override
179
186};
187
188
189// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190
191} // End namespace surfaceWriters
192} // End namespace Foam
193
194// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
195
196#endif
197
198// ************************************************************************* //
Generic templated field type.
Definition: Field.H:82
streamFormat
Data format (ascii | binary)
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
State information for writers with collated times.
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 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: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