All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
thermalBaffleModelNew.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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.
20 
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/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "thermalBaffleModel.H"
27 
28 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
29 
30 namespace Foam
31 {
32 namespace regionModels
33 {
34 namespace thermalBaffleModels
35 {
36 
37 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
38 
40 {
41  word modelType;
42  {
43  IOdictionary thermalBafflePropertiesDict
44  (
45  IOobject
46  (
47  "thermalBaffleProperties",
48  mesh.time().constant(),
49  mesh,
52  false
53  )
54  );
55 
56  word modelType =
57  thermalBafflePropertiesDict.lookupOrDefault<word>
58  (
59  "thermalBaffleModel",
60  "thermalBaffle"
61  );
62  }
63 
64  meshConstructorTable::iterator cstrIter =
65  meshConstructorTablePtr_->find(modelType);
66 
67  if (cstrIter == meshConstructorTablePtr_->end())
68  {
69 
71  << "Unknown thermalBaffleModel type " << modelType
72  << nl << nl
73  << "Valid thermalBaffleModel types are:" << nl
74  << meshConstructorTablePtr_->sortedToc()
75  << exit(FatalError);
76  }
77 
78  return autoPtr<thermalBaffleModel>(cstrIter()(modelType, mesh));
79 }
80 
81 
83 (
84  const fvMesh& mesh,
85  const dictionary& dict
86 )
87 {
88  word modelType =
89  dict.lookupOrDefault<word>("thermalBaffleModel", "thermalBaffle");
90 
91  dictionaryConstructorTable::iterator cstrIter =
92  dictionaryConstructorTablePtr_->find(modelType);
93 
94  if (cstrIter == dictionaryConstructorTablePtr_->end())
95  {
96 
98  << "Unknown thermalBaffleModel type " << modelType
99  << nl << nl
100  << "Valid thermalBaffleModel types are:" << nl
101  << dictionaryConstructorTablePtr_->sortedToc()
102  << exit(FatalError);
103  }
104 
105  return autoPtr<thermalBaffleModel>(cstrIter()(modelType, mesh, dict));
106 }
107 
108 
109 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
110 
111 } // End namespace thermalBaffleModels
112 } // End namespace regionModels
113 } // End namespace Foam
114 
115 // ************************************************************************* //
dictionary dict
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
error FatalError
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:319
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:239
static autoPtr< thermalBaffleModel > New(const fvMesh &mesh)
Return a reference to the selected model.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:52
dynamicFvMesh & mesh
A class for handling words, derived from string.
Definition: word.H:59
const word & constant() const
Return constant name.
Definition: TimePaths.H:124
static const char nl
Definition: Ostream.H:260
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:92
Namespace for OpenFOAM.