Loading...
Searching...
No Matches
gnuplotCoordSetWriter.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) 2021-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::coordSetWriters::gnuplotWriter
29
30Description
31 A coordSet(s) writer in gnuplot format.
32
33 The formatOptions for gnuplot:
34 \table
35 Property | Description | Required | Default
36 buffer | Use buffered output | no | true
37 compression | Use file compression | no | false
38 precision | Write precision in ascii | no | same as IOstream
39 \endtable
40
41 When called with a single coordSet, will buffer the output of
42 all fields and output together in the order of label/scalar/vector/...
43 each of which is sorted alphabetically according to the field name.
44
45 When called as a track writer (eg, with multiple coordSets),
46 will emit one file per field.
47
48SourceFiles
49 gnuplotCoordSetWriter.C
50 gnuplotCoordSetWriterImpl.C
51
52\*---------------------------------------------------------------------------*/
53
54#ifndef Foam_coordSetWriters_gnuplotWriter_H
55#define Foam_coordSetWriters_gnuplotWriter_H
56
57#include "coordSetWriter.H"
58
59// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
60
61namespace Foam
62{
63namespace coordSetWriters
64{
65
66/*---------------------------------------------------------------------------*\
67 Class gnuplotWriter Declaration
68\*---------------------------------------------------------------------------*/
69
70class gnuplotWriter
71:
72 public coordSetWriter
73{
74 // Private Data
75
76 //- Output stream option
77 IOstreamOption streamOpt_;
78
79 //- ASCII write precision
80 unsigned precision_;
81
82
83 // Private Member Functions
84
85 //- Templated write operation
86 template<class Type>
87 fileName writeTemplate
88 (
89 const word& fieldName,
90 const UPtrList<const Field<Type>>& fieldPtrs
91 );
92
93 //- Templated write operation
94 template<class Type>
95 fileName writeTemplate
96 (
97 const word& fieldName,
98 const Field<Type>& vals
99 );
100
101 //- Templated write operation
102 template<class Type>
103 fileName writeTemplate
104 (
105 const word& fieldName,
106 const List<Field<Type>>& fieldValues
107 );
108
109
110protected:
111
112 // Protected Member Functions
113
114 //- Write buffered data
115 virtual bool writeBuffered();
116
117
118public:
119
120 //- Runtime type information (no debug)
121 TypeNameNoDebug("gnuplot");
122
123
124 // Constructors
125
126 //- Default construct
128
129 //- Default construct with specified options
130 explicit gnuplotWriter(const dictionary& options);
131
132 //- Construct from components
134 (
135 const coordSet& coords,
136 const fileName& outputPath,
137 const dictionary& options = dictionary()
138 );
139
140 //- Construct from components
142 (
143 const UPtrList<coordSet>& tracks,
144 const fileName& outputPath,
145 const dictionary& options = dictionary()
146 );
147
148
149 //- Destructor. Calls close()
150 virtual ~gnuplotWriter();
151
152
153 // Member Functions
154
155 //- Enable/disable internal buffering
156 virtual bool buffering(const bool on); // override
157
158 //- Characteristic output file name - information only
159 virtual fileName path() const; // override
160
167};
168
169
170// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171
172} // Endnamespace coordSetWriters
173} // End namespace Foam
174
175// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176
177#endif
178
179// ************************************************************************* //
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
Definition Field.H:172
A simple container for options an IOstream can normally have.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition List.H:72
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
Definition UPtrList.H:101
virtual bool buffering() const
True if the format uses internal buffering (eg, column output).
coordSetWriter(const coordSetWriter &)=delete
No copy construct.
A coordSet(s) writer in gnuplot format.
virtual bool writeBuffered()
Write buffered data.
declareCoordSetWriterWriteMethod(sphericalTensor)
virtual fileName path() const
Characteristic output file name - information only.
virtual ~gnuplotWriter()
Destructor. Calls close().
TypeNameNoDebug("gnuplot")
Runtime type information (no debug).
Holds list of sampling positions.
Definition coordSet.H:52
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
A class for handling file names.
Definition fileName.H:75
A class for handling words, derived from Foam::string.
Definition word.H:66
#define declareCoordSetWriterWriteMethod(Type)
Namespace for OpenFOAM.
Tensor< scalar > tensor
Definition symmTensor.H:57
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 TypeNameNoDebug(TypeNameString)
Declare a ClassNameNoDebug() with extra virtual type info.
Definition typeInfo.H:61