DARadiationModel.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2 
3  DAFoam : Discrete Adjoint with OpenFOAM
4  Version : v3
5 
6 \*---------------------------------------------------------------------------*/
7 
8 #include "DARadiationModel.H"
9 
10 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
11 
12 namespace Foam
13 {
14 
15 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
16 
17 defineTypeNameAndDebug(DARadiationModel, 0);
18 defineRunTimeSelectionTable(DARadiationModel, dictionary);
19 
20 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
21 
22 DARadiationModel::DARadiationModel(
23  const word modelType,
24  const fvMesh& mesh,
25  const DAOption& daOption)
26  : regIOobject(
27  IOobject(
28  "DARadiationModel",
29  mesh.time().timeName(),
30  mesh, // register to mesh
31  IOobject::NO_READ,
32  IOobject::NO_WRITE,
33  true // always register object
34  )),
35  mesh_(mesh),
36  daOption_(daOption)
37 {
38 }
39 
40 // * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
41 
42 autoPtr<DARadiationModel> DARadiationModel::New(
43  const word modelType,
44  const fvMesh& mesh,
45  const DAOption& daOption)
46 {
47  if (daOption.getAllOptions().lookupOrDefault<label>("debug", 0))
48  {
49  Info << "Selecting " << modelType << " for DARadiationModel" << endl;
50  }
51 
52  dictionaryConstructorTable::iterator cstrIter =
53  dictionaryConstructorTablePtr_->find(modelType);
54 
55  if (cstrIter == dictionaryConstructorTablePtr_->end())
56  {
57  FatalErrorIn(
58  "DARadiationModel::New"
59  "("
60  " const word,"
61  " const fvMesh&,"
62  " const DAOption&"
63  ")")
64  << "Unknown DARadiationModel type "
65  << modelType << nl << nl
66  << "Valid DARadiationModel types:" << endl
67  << dictionaryConstructorTablePtr_->sortedToc()
68  << exit(FatalError);
69  }
70 
71  return autoPtr<DARadiationModel>(
72  cstrIter()(modelType, mesh, daOption));
73 }
74 
75 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
76 
77 // this is a virtual function for regIOobject
78 bool DARadiationModel::writeData(Ostream& os) const
79 {
80  // do nothing
81  return true;
82 }
83 
84 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
85 
86 } // End namespace Foam
87 
88 // ************************************************************************* //
Foam::DAOption
Definition: DAOption.H:29
daOption
DAOption daOption(mesh, pyOptions_)
mesh
fvMesh & mesh
Definition: createRefsHeatTransfer.H:4
Foam::defineRunTimeSelectionTable
defineRunTimeSelectionTable(DAFvSource, dictionary)
Foam
Definition: multiFreqScalarFvPatchField.C:144
Foam::DARadiationModel::New
static autoPtr< DARadiationModel > New(const word modelType, const fvMesh &mesh, const DAOption &daOption)
Definition: DARadiationModel.C:42
Foam::DARadiationModel::writeData
bool writeData(Ostream &os) const
this is a virtual function for regIOobject
Definition: DARadiationModel.C:78
DARadiationModel.H
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(DAFvSource, 0)