FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

DataEntry.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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 Class
00025     Foam::DataEntry
00026 
00027 Description
00028     Top level data entry class for use in dictionaries. Provides a mechanism
00029     to specify a variable as a certain type, e.g. constant or table, and
00030     provide functions to return the (interpolated) value, and integral between
00031     limits.
00032 
00033 SourceFiles
00034     DataEntry.C
00035     NewDataEntry.C
00036 
00037 \*---------------------------------------------------------------------------*/
00038 
00039 #ifndef DataEntry_H
00040 #define DataEntry_H
00041 
00042 #include <OpenFOAM/dictionary.H>
00043 
00044 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00045 
00046 namespace Foam
00047 {
00048 
00049 template<class Type>
00050 class DataEntry;
00051 
00052 template<class Type>
00053 Ostream& operator<<
00054 (
00055     Ostream&,
00056     const DataEntry<Type>&
00057 );
00058 
00059 /*---------------------------------------------------------------------------*\
00060                          Class DataEntry Declaration
00061 \*---------------------------------------------------------------------------*/
00062 
00063 template<class Type>
00064 class DataEntry
00065 {
00066     // Private Member Functions
00067 
00068         //- Disallow default bitwise assignment
00069         void operator=(const DataEntry<Type>&);
00070 
00071 
00072 protected:
00073 
00074     // Protected data
00075 
00076         //- Name of entry
00077         const word name_;
00078 
00079 
00080 public:
00081 
00082     //- Runtime type information
00083     TypeName("DataEntry")
00084 
00085     //- Declare runtime constructor selection table
00086     declareRunTimeSelectionTable
00087     (
00088         autoPtr,
00089         DataEntry,
00090         dictionary,
00091         (
00092             const word& entryName,
00093             Istream& is
00094         ),
00095         (entryName, is)
00096     );
00097 
00098 
00099     // Constructor
00100 
00101         //- Construct from entry name
00102         DataEntry(const word& entryName);
00103 
00104         //- Copy constructor
00105         DataEntry(const DataEntry<Type>& de);
00106 
00107 
00108     //- Selector
00109     static autoPtr<DataEntry<Type> > New
00110     (
00111         const word& entryName,
00112         const dictionary& dict
00113     );
00114 
00115 
00116     //- Destructor
00117     virtual ~DataEntry();
00118 
00119 
00120     // Member Functions
00121 
00122         // Access
00123 
00124             //- Return the name of the entry
00125             const word& name() const;
00126 
00127 
00128         // Evaluation
00129 
00130             //- Return value as a function of (scalar) independent variable
00131             virtual Type value(const scalar x) const = 0;
00132 
00133             //- Integrate between two (scalar) values
00134             virtual Type integrate(const scalar x1, const scalar x2) const = 0;
00135 
00136 
00137     //- Ostream Operator
00138     friend Ostream& operator<< <Type>
00139     (
00140         Ostream&,
00141         const DataEntry<Type>&
00142     );
00143 };
00144 
00145 
00146 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00147 
00148 } // End namespace Foam
00149 
00150 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00151 
00152 #define makeDataEntry(Type)                                                   \
00153                                                                               \
00154     defineNamedTemplateTypeNameAndDebug(DataEntry<Type>, 0);                  \
00155                                                                               \
00156     defineTemplateRunTimeSelectionTable                                       \
00157     (                                                                         \
00158         DataEntry<Type>,                                                      \
00159         dictionary                                                            \
00160     );
00161 
00162 
00163 #define makeDataEntryType(SS, Type)                                           \
00164                                                                               \
00165     defineNamedTemplateTypeNameAndDebug(SS<Type>, 0);                         \
00166                                                                               \
00167     DataEntry<Type>::adddictionaryConstructorToTable<SS<Type> >               \
00168         add##SS##Type##ConstructorToTable_;
00169 
00170 
00171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00172 
00173 #ifdef NoRepository
00174 #   include <lagrangianIntermediate/DataEntry.C>
00175 #   include <lagrangianIntermediate/NewDataEntry.C>
00176 #endif
00177 
00178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00179 
00180 #endif
00181 
00182 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines