TableFileReader.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2020 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::TableFileReader
26 
27 Description
28  Base class to read table data for tables
29 
30 SourceFiles
31  TableFileReader.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef TableFileReader_H
36 #define TableFileReader_H
37 
38 #include "TableReader.H"
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 /*---------------------------------------------------------------------------*\
46  Class TableFileReader Declaration
47 \*---------------------------------------------------------------------------*/
48 
49 template<class Type>
50 class TableFileReader
51 :
52  public TableReader<Type>
53 {
54  // Private Data
55 
56  //- File name for table
57  const fileName fName_;
58 
59 
60  // Private Member Functions
61 
62  //- Read a 1D table
63  virtual void read(ISstream&, List<Tuple2<scalar, Type>>&) const = 0;
64 
65 
66 protected:
67 
68  //- Read a 1D table
69  void read(const dictionary& dict, List<Tuple2<scalar, Type>>&) const;
70 
71 
72 public:
73 
74  // Constructors
75 
76  //- Construct from dictionary
77  TableFileReader(const dictionary& dict);
78 
79 
80  //- Destructor
81  virtual ~TableFileReader();
82 
83 
84  // Member Functions
85 
86  //- Write additional information
87  virtual void write
88  (
89  Ostream& os,
90  const List<Tuple2<scalar, Type>>& table
91  ) const;
92 };
93 
94 
95 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
96 
97 } // End namespace Foam
98 
99 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
100 
101 #ifdef NoRepository
102  #include "TableFileReader.C"
103 #endif
104 
105 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
106 
107 #endif
108 
109 // ************************************************************************* //
Base class to read table data for tables.
Definition: TableReader.H:49
dictionary dict
A class for handling file names.
Definition: fileName.H:79
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
A 2-tuple for storing two objects of different types.
Definition: HashTable.H:65
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Base class to read table data for tables.
virtual void write(Ostream &os, const List< Tuple2< scalar, Type >> &table) const
Write additional information.
virtual ~TableFileReader()
Destructor.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
Generic input stream.
Definition: ISstream.H:52
TableFileReader(const dictionary &dict)
Construct from dictionary.
Namespace for OpenFOAM.