Initial commit for version 2.0.x patch release
[OpenFOAM-2.0.x.git] / src / thermophysicalModels / thermophysicalFunctions / thermophysicalFunction / thermophysicalFunction.H
blob573369fb39237e3c3db06658f50533c7e28b4a26
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2004-2010 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
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.
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.
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/>.
24 Class
25     Foam::thermophysicalFunction
27 Description
28     Abstract base class for thermo-physical functions
30 \*---------------------------------------------------------------------------*/
32 #ifndef thermophysicalFunction_H
33 #define thermophysicalFunction_H
35 #include "scalar.H"
36 #include "IOstreams.H"
37 #include "typeInfo.H"
38 #include "autoPtr.H"
39 #include "runTimeSelectionTables.H"
40 #include "dictionary.H"
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 namespace Foam
47 /*---------------------------------------------------------------------------*\
48                     Class thermophysicalFunction Declaration
49 \*---------------------------------------------------------------------------*/
51 class thermophysicalFunction
54 public:
56     //- Runtime type information
57     TypeName("thermophysicalFunction");
60     // Declare run-time constructor selection tables
62         declareRunTimeSelectionTable
63         (
64             autoPtr,
65             thermophysicalFunction,
66             Istream,
67             (Istream& is),
68             (is)
69         );
71         declareRunTimeSelectionTable
72         (
73             autoPtr,
74             thermophysicalFunction,
75             dictionary,
76             (const dictionary& dict),
77             (dict)
78         );
81     // Constructors
83         //- Construct null
84         thermophysicalFunction()
85         {}
87         //- Return pointer to new thermophysicalFunction created from input
88         static autoPtr<thermophysicalFunction> New(Istream& is);
90         //- Return pointer to new thermophysicalFunction created from dict
91         static autoPtr<thermophysicalFunction> New(const dictionary& dict);
94     //- Destructor
95     virtual ~thermophysicalFunction()
96     {}
99     // Member Functions
101         //- Evaluate the function and return the result
102         virtual scalar f(scalar p, scalar T) const = 0;
104         //- Write the function coefficients
105         virtual void writeData(Ostream& os) const = 0;
108     // Ostream Operator
110         friend Ostream& operator<<(Ostream& os, const thermophysicalFunction& f)
111         {
112             f.writeData(os);
113             return os;
114         }
118 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
120 } // End namespace Foam
122 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
124 #endif
126 // ************************************************************************* //