OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

Table.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     Foam::Table
00027 
00028 Description
00029     Templated table container data entry. Items are stored in a list of
00030     Tuple2's. First column is always stored as scalar entries. Data is read
00031     in the form, e.g. for an entry <entryName> that is (scalar, vector):
00032 
00033     @verbatim
00034         <entryName>   table
00035         (
00036             0.0 (1 2 3)
00037             1.0 (4 5 6)
00038         );
00039     @endverbatim
00040 
00041 SourceFiles
00042     Table.C
00043 
00044 \*---------------------------------------------------------------------------*/
00045 
00046 #ifndef Table_H
00047 #define Table_H
00048 
00049 #include "DataEntry.H"
00050 #include "Tuple2.H"
00051 
00052 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00053 
00054 namespace Foam
00055 {
00056 
00057 template<class Type>
00058 class Table;
00059 
00060 template<class Type>
00061 Ostream& operator<<
00062 (
00063     Ostream&,
00064     const Table<Type>&
00065 );
00066 
00067 /*---------------------------------------------------------------------------*\
00068                            Class Table Declaration
00069 \*---------------------------------------------------------------------------*/
00070 
00071 template<class Type>
00072 class Table
00073 :
00074     public DataEntry<Type>
00075 {
00076     // Private data
00077 
00078         //- Table data
00079         List<Tuple2<scalar, Type> > table_;
00080 
00081 
00082     // Private Member Functions
00083 
00084         //- Disallow default bitwise assignment
00085         void operator=(const Table<Type>&);
00086 
00087 
00088 public:
00089 
00090     //- Runtime type information
00091     TypeName("table");
00092 
00093 
00094     // Constructors
00095 
00096         //- Construct from entry name and Istream
00097         Table(const word& entryName, Istream& is);
00098 
00099         //- Copy constructor
00100         Table(const Table<Type>& tbl);
00101 
00102 
00103     //- Destructor
00104     virtual ~Table();
00105 
00106 
00107     // Member Functions
00108 
00109         //- Return Table value
00110         Type value(const scalar x) const;
00111 
00112         //- Integrate between two (scalar) values
00113         Type integrate(const scalar x1, const scalar x2) const;
00114 
00115 
00116     //- Ostream Operator
00117     friend Ostream& operator<< <Type>
00118     (
00119         Ostream&,
00120         const Constant<Type>&
00121     );
00122 };
00123 
00124 
00125 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00126 
00127 } // End namespace Foam
00128 
00129 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00130 
00131 #ifdef NoRepository
00132 #   include "Table.C"
00133 #endif
00134 
00135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00136 
00137 #endif
00138 
00139 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd