BUG: UListIO: byteSize overflowing on really big faceLists
[OpenFOAM-2.0.x.git] / src / thermophysicalModels / thermophysicalFunctions / thermophysicalFunction / thermophysicalFunction.C
blob12253ca03ea0ae33e97f3f9a91cd7799ad69044a
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
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 \*---------------------------------------------------------------------------*/
26 #include "error.H"
28 #include "thermophysicalFunction.H"
29 #include "HashTable.H"
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33 namespace Foam
35     defineTypeNameAndDebug(thermophysicalFunction, 0);
36     defineRunTimeSelectionTable(thermophysicalFunction, Istream);
37     defineRunTimeSelectionTable(thermophysicalFunction, dictionary);
41 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
43 Foam::autoPtr<Foam::thermophysicalFunction> Foam::thermophysicalFunction::New
45     Istream& is
48     if (debug)
49     {
50         Info<< "thermophysicalFunction::New(Istream&) : "
51             << "constructing thermophysicalFunction"
52             << endl;
53     }
55     const word thermophysicalFunctionType(is);
57     IstreamConstructorTable::iterator cstrIter =
58         IstreamConstructorTablePtr_->find(thermophysicalFunctionType);
60     if (cstrIter == IstreamConstructorTablePtr_->end())
61     {
62         FatalErrorIn("thermophysicalFunction::New(Istream&)")
63             << "Unknown thermophysicalFunction type "
64             << thermophysicalFunctionType
65             << nl << nl
66             << "Valid thermophysicalFunction types are :" << endl
67             << IstreamConstructorTablePtr_->sortedToc()
68             << abort(FatalError);
69     }
71     return autoPtr<thermophysicalFunction>(cstrIter()(is));
75 Foam::autoPtr<Foam::thermophysicalFunction> Foam::thermophysicalFunction::New
77     const dictionary& dict
80     if (debug)
81     {
82         Info<< "thermophysicalFunction::New(const dictionary&) : "
83             << "constructing thermophysicalFunction"
84             << endl;
85     }
87     const word thermophysicalFunctionType(dict.lookup("functionType"));
89     dictionaryConstructorTable::iterator cstrIter =
90         dictionaryConstructorTablePtr_->find(thermophysicalFunctionType);
92     if (cstrIter == IstreamConstructorTablePtr_->end())
93     {
94         FatalErrorIn("thermophysicalFunction::New(const dictionary&)")
95             << "Unknown thermophysicalFunction type "
96             << thermophysicalFunctionType
97             << nl << nl
98             << "Valid thermophysicalFunction types are :" << endl
99             << dictionaryConstructorTablePtr_->sortedToc()
100             << abort(FatalError);
101     }
103     return autoPtr<thermophysicalFunction>(cstrIter()(dict));
107 // ************************************************************************* //