csvSetWriter.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 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
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 Class
28  Foam::csvSetWriter
29 
30 Description
31  Write set in csv format
32 
33 SourceFiles
34  csvSetWriter.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef csvSetWriter_H
39 #define csvSetWriter_H
40 
41 #include "writer.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class csvSetWriter Declaration
50 \*---------------------------------------------------------------------------*/
51 
52 template<class Type>
53 class csvSetWriter
54 :
55  public writer<Type>
56 {
57 
58  // Private Member Functions
59 
60  void writeCoordHeader(const coordSet&, Ostream&) const;
61 
62  void writeHeader(const coordSet&, const wordList&, Ostream&) const;
63 
64 
65 protected:
66 
67  virtual void writeSeparator(Ostream&) const;
68 
69 
70 public:
71 
72  //- Runtime type information
73  TypeName("csv");
74 
75 
76  // Constructors
77 
78  //- Default construct
79  csvSetWriter();
80 
81  //- Construct with dictionary
82  explicit csvSetWriter(const dictionary& dict);
83 
84 
85  //- Destructor
86  virtual ~csvSetWriter() = default;
87 
88 
89  // Member Functions
90 
91  virtual fileName getFileName
92  (
93  const coordSet&,
94  const wordList&
95  ) const;
96 
97  virtual void write
98  (
99  const coordSet&,
100  const wordList&,
101  const List<const Field<Type>*>&,
102  Ostream&
103  ) const;
104 
105  virtual void write
106  (
107  const bool writeTracks,
108  const List<scalarField>& times,
109  const PtrList<coordSet>& tracks,
110  const wordList& valueSetNames,
111  const List<List<Field<Type>>>& valueSets,
112  Ostream&
113  ) const;
114 };
115 
116 
117 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
118 
119 } // End namespace Foam
120 
121 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
122 
123 #ifdef NoRepository
124  #include "csvSetWriter.C"
125 #endif
126 
127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128 
129 #endif
130 
131 // ************************************************************************* //
Foam::csvSetWriter::write
virtual void write(const coordSet &, const wordList &, const List< const Field< Type > * > &, Ostream &) const
General entry point for writing.
Definition: csvSetWriter.C:65
Foam::fileName
A class for handling file names.
Definition: fileName.H:73
Foam::csvSetWriter::getFileName
virtual fileName getFileName(const coordSet &, const wordList &) const
Generate file name with correct extension.
Definition: csvSetWriter.C:54
Foam::csvSetWriter
Write set in csv format.
Definition: csvSetWriter.H:52
csvSetWriter.C
Foam::Field
Generic templated field type.
Definition: Field.H:63
Foam::PtrList
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: List.H:59
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::writer
Base class for graphics format writing. Entry points are.
Definition: writer.H:81
Foam::coordSet
Holds list of sampling positions.
Definition: coordSet.H:53
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::List< word >
Foam::csvSetWriter::csvSetWriter
csvSetWriter()
Default construct.
Definition: csvSetWriter.C:37
Foam::csvSetWriter::writeSeparator
virtual void writeSeparator(Ostream &) const
Writes a separator. Used by write functions.
Definition: csvSetWriter.C:124
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::csvSetWriter::~csvSetWriter
virtual ~csvSetWriter()=default
Destructor.
writer.H
Foam::csvSetWriter::TypeName
TypeName("csv")
Runtime type information.