pyrolysisModelNew.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 | Copyright (C) 2011-2015 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 "pyrolysisModel.H"
27 #include "fvMesh.H"
28 #include "Time.H"
29 
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 namespace regionModels
35 {
36 namespace pyrolysisModels
37 {
38 
39 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
40 
41 autoPtr<pyrolysisModel> pyrolysisModel::New
42 (
43  const fvMesh& mesh,
44  const word& regionType
45 )
46 {
47  // get model name, but do not register the dictionary
48  const word modelType
49  (
51  (
52  IOobject
53  (
54  regionType + "Properties",
55  mesh.time().constant(),
56  mesh,
59  false
60  )
61  ).lookup("pyrolysisModel")
62  );
63 
64  Info<< "Selecting pyrolysisModel " << modelType << endl;
65 
66  meshConstructorTable::iterator cstrIter =
67  meshConstructorTablePtr_->find(modelType);
68 
69  if (cstrIter == meshConstructorTablePtr_->end())
70  {
72  << "Unknown pyrolysisModel type " << modelType
73  << nl << nl << "Valid pyrolisisModel types are:" << nl
74  << meshConstructorTablePtr_->sortedToc()
75  << exit(FatalError);
76  }
77 
78  return autoPtr<pyrolysisModel>(cstrIter()(modelType, mesh, regionType));
79 }
80 
81 
83 (
84  const fvMesh& mesh,
85  const dictionary& dict,
86  const word& regionType
87 )
88 {
89 
90  const word modelType = dict.lookup("pyrolysisModel");
91 
92  Info<< "Selecting pyrolysisModel " << modelType << endl;
93 
94  dictionaryConstructorTable::iterator cstrIter =
95  dictionaryConstructorTablePtr_->find(modelType);
96 
97  if (cstrIter == dictionaryConstructorTablePtr_->end())
98  {
100  << "Unknown pyrolysisModel type " << modelType
101  << nl << nl << "Valid pyrolisisModel types are:" << nl
102  << dictionaryConstructorTablePtr_->sortedToc()
103  << exit(FatalError);
104  }
105 
107  (
108  cstrIter()
109  (
110  modelType,
111  mesh,
112  dict,
113  regionType
114  )
115  );
116 }
117 
118 
119 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
120 
121 } // End namespace surfaceFilmModels
122 } // End namespace regionModels
123 } // End namespace Foam
124 
125 // ************************************************************************* //
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:137
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:319
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:253
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:53
dynamicFvMesh & mesh
static autoPtr< pyrolysisModel > New(const fvMesh &mesh, const word &regionType="pyrolysis")
Return a reference to the selected pyrolysis model.
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:262
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
messageStream Info
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:53
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
Namespace for OpenFOAM.
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:243
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:451