1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
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
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 \*---------------------------------------------------------------------------*/
28 #include "thermophysicalFunction.H"
29 #include "HashTable.H"
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 defineTypeNameAndDebug(thermophysicalFunction, 0);
36 defineRunTimeSelectionTable(thermophysicalFunction, Istream);
37 defineRunTimeSelectionTable(thermophysicalFunction, dictionary);
41 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
43 Foam::autoPtr<Foam::thermophysicalFunction> Foam::thermophysicalFunction::New
50 Info<< "thermophysicalFunction::New(Istream&) : "
51 << "constructing thermophysicalFunction"
55 const word thermophysicalFunctionType(is);
57 IstreamConstructorTable::iterator cstrIter =
58 IstreamConstructorTablePtr_->find(thermophysicalFunctionType);
60 if (cstrIter == IstreamConstructorTablePtr_->end())
62 FatalErrorIn("thermophysicalFunction::New(Istream&)")
63 << "Unknown thermophysicalFunction type "
64 << thermophysicalFunctionType
66 << "Valid thermophysicalFunction types are :" << endl
67 << IstreamConstructorTablePtr_->sortedToc()
71 return autoPtr<thermophysicalFunction>(cstrIter()(is));
75 Foam::autoPtr<Foam::thermophysicalFunction> Foam::thermophysicalFunction::New
77 const dictionary& dict
82 Info<< "thermophysicalFunction::New(const dictionary&) : "
83 << "constructing thermophysicalFunction"
87 const word thermophysicalFunctionType(dict.lookup("functionType"));
89 dictionaryConstructorTable::iterator cstrIter =
90 dictionaryConstructorTablePtr_->find(thermophysicalFunctionType);
92 if (cstrIter == IstreamConstructorTablePtr_->end())
94 FatalErrorIn("thermophysicalFunction::New(const dictionary&)")
95 << "Unknown thermophysicalFunction type "
96 << thermophysicalFunctionType
98 << "Valid thermophysicalFunction types are :" << endl
99 << dictionaryConstructorTablePtr_->sortedToc()
100 << abort(FatalError);
103 return autoPtr<thermophysicalFunction>(cstrIter()(dict));
107 // ************************************************************************* //