DAOutputFunction.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2 
3  DAFoam : Discrete Adjoint with OpenFOAM
4  Version : v4
5 
6  Description:
7  Child class for residual output
8 
9 \*---------------------------------------------------------------------------*/
10 
11 #ifndef DAOutputFunction_H
12 #define DAOutputFunction_H
13 
14 #include "DAOutput.H"
15 #include "addToRunTimeSelectionTable.H"
16 #include "mixedFvPatchFields.H"
17 
18 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
19 
20 namespace Foam
21 {
22 
23 /*---------------------------------------------------------------------------*\
24  Class DAOutputFunction Declaration
25 \*---------------------------------------------------------------------------*/
26 
28  : public DAOutput
29 {
30 
31 protected:
32 public:
33  TypeName("function");
34  // Constructors
35 
36  //- Construct from components
38  const word outputName,
39  const word outputType,
40  fvMesh& mesh,
41  const DAOption& daOption,
42  DAModel& daModel,
43  const DAIndex& daIndex,
44  DAResidual& daResidual,
45  UPtrList<DAFunction>& daFunctionList);
46 
47  //- Destructor
49  {
50  }
51 
54  const word functionName,
55  UPtrList<DAFunction>& daFunctionList)
56  {
57  forAll(daFunctionList, idxI)
58  {
59  DAFunction& daFunction = daFunctionList[idxI];
60  word functionName1 = daFunction.getFunctionName();
61  if (functionName1 == functionName)
62  {
63  return idxI;
64  }
65  }
66  return -9999;
67  }
68 
69  virtual void run(scalarList& output);
70 
71  virtual label size()
72  {
73  return 1;
74  }
75 
76  virtual label distributed()
77  {
78  return 0;
79  }
80 };
81 
82 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
83 
84 } // End namespace Foam
85 
86 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
87 
88 #endif
89 
90 // ************************************************************************* //
DAOutput.H
Foam::DAOption
Definition: DAOption.H:29
Foam::DAOutputFunction::~DAOutputFunction
virtual ~DAOutputFunction()
Definition: DAOutputFunction.H:48
Foam::DAOutputFunction::size
virtual label size()
Definition: DAOutputFunction.H:71
Foam::DAOutputFunction::run
virtual void run(scalarList &output)
Definition: DAOutputFunction.C:40
mesh
fvMesh & mesh
Definition: createRefsHeatTransfer.H:4
Foam::DAFunction::getFunctionName
word getFunctionName()
return the name of objective function
Definition: DAFunction.H:142
Foam::DAIndex
Definition: DAIndex.H:32
Foam::DAOutput
Definition: DAOutput.H:32
Foam::DAModel
Definition: DAModel.H:57
Foam::DAFunction
Definition: DAFunction.H:31
Foam
Definition: checkGeometry.C:32
Foam::DAOutputFunction::DAOutputFunction
DAOutputFunction(const word outputName, const word outputType, fvMesh &mesh, const DAOption &daOption, DAModel &daModel, const DAIndex &daIndex, DAResidual &daResidual, UPtrList< DAFunction > &daFunctionList)
Definition: DAOutputFunction.C:19
forAll
forAll(nuTilda1, cellI)
Definition: nuTilda1EqnIrkPimple.H:19
Foam::DAResidual
Definition: DAResidual.H:36
Foam::DAOutputFunction::TypeName
TypeName("function")
Foam::DAOutputFunction
Definition: DAOutputFunction.H:27
Foam::DAOutputFunction::distributed
virtual label distributed()
Definition: DAOutputFunction.H:76
Foam::DAOutputFunction::getFunctionListIndex
label getFunctionListIndex(const word functionName, UPtrList< DAFunction > &daFunctionList)
return the index of a give functionName in daFunctionList
Definition: DAOutputFunction.H:53