ensightSurfaceWriter.C
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-2014 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
27\*---------------------------------------------------------------------------*/
28
30#include "IOmanip.H"
31#include "Fstream.H"
32#include "OSspecific.H"
33#include "ensightCase.H"
34#include "ensightOutput.H"
36#include "ensightPTraits.H"
39
40// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
41
42namespace Foam
43{
44namespace surfaceWriters
45{
49}
50}
51
52
53// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
54
56:
58 writeFormat_(IOstreamOption::ASCII),
59 collateTimes_(true),
60 caching_("fieldsDict") // Historic name
61{}
62
63
65(
66 const dictionary& options
67)
68:
69 surfaceWriter(options),
70 writeFormat_
71 (
72 IOstreamOption::formatEnum("format", options, IOstreamOption::ASCII)
73 ),
74 collateTimes_(options.getOrDefault("collateTimes", true)),
75 caching_("fieldsDict") // Historic name
76{}
77
78
80(
81 const meshedSurf& surf,
82 const fileName& outputPath,
83 bool parallel,
84 const dictionary& options
85)
86:
87 ensightWriter(options)
88{
89 open(surf, outputPath, parallel);
90}
91
92
94(
95 const pointField& points,
96 const faceList& faces,
97 const fileName& outputPath,
98 bool parallel,
99 const dictionary& options
100)
101:
102 ensightWriter(options)
103{
104 open(points, faces, outputPath, parallel);
105}
106
107
108// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
109
111{
112 caching_.clear();
114}
115
116
117// Note that ensight does supports geometry in a separate file,
118// but setting this true leaves geometry files in the wrong places
119// (when there are fields).
120//
121// Make this false to let the field writers take back control
123{
124 return false;
125}
126
127
129{
130 // if (collateTimes_)
131 // {
132 // return writeCollated();
133 // }
134 // else
135 // {
136 // return writeUncollated();
137 // }
138
139 return writeUncollated();
140}
141
142
143// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
144
147
148
149// Field writing implementations
150
151template<class Type>
152Foam::fileName Foam::surfaceWriters::ensightWriter::writeTemplate
153(
154 const word& fieldName,
155 const Field<Type>& localValues
156)
157{
158 if (collateTimes_)
159 {
160 return writeCollated(fieldName, localValues);
161 }
162 else
163 {
164 return writeUncollated(fieldName, localValues);
165 }
166}
167
168
170
171
172// ************************************************************************* //
Istream and Ostream manipulators taking arguments.
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
The IOstreamOption is a simple container for options an IOstream can normally have.
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.
virtual void open(const fileName &outputPath)
Open for output on specified path, using existing surface.
virtual void close()
Finish output, performing any necessary cleanup.
A surfaceWriter for Ensight format.
virtual void close()
Finish output, clears output times.
virtual bool separateGeometry() const
True if the surface format supports geometry in a separate file.
virtual fileName write()
Write surface geometry to file.
A class for handling words, derived from Foam::string.
Definition: word.H:68
#define defineTypeName(Type)
Define the typeName.
Definition: className.H:96
const pointField & points
Namespace for OpenFOAM.
Convenience macros for instantiating surfaceWriter methods.
#define defineSurfaceWriterWriteFields(ThisClass)