DATimeOp.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2 
3  DAFoam : Discrete Adjoint with OpenFOAM
4  Version : v4
5 
6 \*---------------------------------------------------------------------------*/
7 
8 #include "DATimeOp.H"
9 
10 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
11 
12 namespace Foam
13 {
14 
15 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
16 
17 defineTypeNameAndDebug(DATimeOp, 0);
18 defineRunTimeSelectionTable(DATimeOp, dictionary);
19 
20 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
21 
22 DATimeOp::DATimeOp(
23  const word timeOpType,
24  const dictionary options)
25  : timeOpType_(timeOpType),
26  options_(options)
27 {
28 }
29 
30 // * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
31 
32 autoPtr<DATimeOp> DATimeOp::New(
33  const word timeOpType,
34  const dictionary options)
35 {
36  // standard setup for runtime selectable classes
37 
38  dictionaryConstructorTable::iterator cstrIter =
39  dictionaryConstructorTablePtr_->find(timeOpType);
40 
41  // if the solver name is not found in any child class, print an error
42  if (cstrIter == dictionaryConstructorTablePtr_->end())
43  {
44  FatalErrorIn(
45  "DATimeOp::New"
46  "("
47  " const word,"
48  " const dictionary,"
49  ")")
50  << "Unknown DATimeOp type "
51  << timeOpType << nl << nl
52  << "Valid DATimeOp types:" << endl
53  << dictionaryConstructorTablePtr_->sortedToc()
54  << exit(FatalError);
55  }
56 
57  // child class found
58  return autoPtr<DATimeOp>(
59  cstrIter()(timeOpType, options));
60 }
61 
62 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
63 
64 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
65 
66 } // End namespace Foam
67 
68 // ************************************************************************* //
Foam::defineRunTimeSelectionTable
defineRunTimeSelectionTable(DAFunction, dictionary)
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(DAFunction, 0)
Foam
Definition: checkGeometry.C:32
Foam::DATimeOp::New
static autoPtr< DATimeOp > New(const word timeOpType, const dictionary options)
Definition: DATimeOp.C:32
DATimeOp.H