thermophysicalFunction.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2019-2021 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "thermophysicalFunction.H"
30 #include "HashTable.H"
31 
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
36  defineTypeNameAndDebug(thermophysicalFunction, 0);
37  defineRunTimeSelectionTable(thermophysicalFunction, Istream);
38  defineRunTimeSelectionTable(thermophysicalFunction, dictionary);
39 }
40 
41 
42 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
43 
45 (
46  Istream& is
47 )
48 {
49  DebugInFunction << "Constructing thermophysicalFunction" << endl;
50 
51  const word functionType(is);
52 
53  auto* ctorPtr = IstreamConstructorTable(functionType);
54 
55  if (!ctorPtr)
56  {
58  (
59  "thermophysicalFunction",
60  functionType,
61  *IstreamConstructorTablePtr_
62  ) << abort(FatalError);
63  }
64 
65  return autoPtr<thermophysicalFunction>(ctorPtr(is));
66 }
67 
68 
70 (
71  const dictionary& dict
72 )
73 {
74  DebugInFunction << "Constructing thermophysicalFunction" << endl;
75 
76  const word functionType(dict.get<word>("functionType"));
77 
78  auto* ctorPtr = dictionaryConstructorTable(functionType);
79 
80  if (!ctorPtr)
81  {
83  (
84  dict,
85  "thermophysicalFunction",
86  functionType,
87  *dictionaryConstructorTablePtr_
88  ) << abort(FatalIOError);
89  }
90 
91  return autoPtr<thermophysicalFunction>(ctorPtr(dict));
92 }
93 
94 
95 // ************************************************************************* //
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
HashTable.H
Foam::defineRunTimeSelectionTable
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
Foam::FatalIOError
IOerror FatalIOError
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
FatalIOErrorInLookup
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
Definition: error.H:478
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
DebugInFunction
#define DebugInFunction
Report an information message using Foam::Info.
Definition: messageStream.H:388
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::FatalError
error FatalError
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
FatalErrorInLookup
#define FatalErrorInLookup(lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalError.
Definition: error.H:457
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:144
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
Foam::thermophysicalFunction::New
static autoPtr< thermophysicalFunction > New(Istream &is)
Return pointer to new thermophysicalFunction created from input.
Definition: thermophysicalFunction.C:45
thermophysicalFunction.H