DAInputVolCoord.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2 
3  DAFoam : Discrete Adjoint with OpenFOAM
4  Version : v4
5 
6 \*---------------------------------------------------------------------------*/
7 
8 #include "DAInputVolCoord.H"
9 
10 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
11 
12 namespace Foam
13 {
14 
15 defineTypeNameAndDebug(DAInputVolCoord, 0);
16 addToRunTimeSelectionTable(DAInput, DAInputVolCoord, dictionary);
17 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
18 
20  const word inputName,
21  const word inputType,
22  fvMesh& mesh,
23  const DAOption& daOption,
24  const DAModel& daModel,
25  const DAIndex& daIndex)
26  : DAInput(
27  inputName,
28  inputType,
29  mesh,
30  daOption,
31  daModel,
32  daIndex)
33 {
34 }
35 
36 void DAInputVolCoord::run(const scalarList& input)
37 {
38  /*
39  Description:
40  Assign the input array to the OF's volume coordinates and call movePoints
41  */
42 
43 #ifndef CODI_ADR
44  Info << "DAInputVolCoord. " << endl;
45  Info << "Setting volume coordinates. " << endl;
46 #endif
47 
48  pointField meshPoints = mesh_.points();
49 
50  label counterI = 0;
51  forAll(meshPoints, i)
52  {
53  for (label j = 0; j < 3; j++)
54  {
55  meshPoints[i][j] = input[counterI];
56  counterI++;
57  }
58  }
59  mesh_.movePoints(meshPoints);
60  if (daOption_.getAllOptions().subDict("dynamicMesh").getLabel("active"))
61  {
62  mesh_.moving(true);
63  }
64  else
65  {
66  mesh_.moving(false);
67  }
68 
69  return;
70 }
71 
72 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
73 
74 } // End namespace Foam
75 
76 // ************************************************************************* //
Foam::DAOption
Definition: DAOption.H:29
Foam::DAInputVolCoord::run
virtual void run(const scalarList &input)
Definition: DAInputVolCoord.C:36
Foam::addToRunTimeSelectionTable
addToRunTimeSelectionTable(DAFunction, DAFunctionForce, dictionary)
Foam::DAInputVolCoord::DAInputVolCoord
DAInputVolCoord(const word inputName, const word inputType, fvMesh &mesh, const DAOption &daOption, const DAModel &daModel, const DAIndex &daIndex)
Definition: DAInputVolCoord.C:19
Foam::DAOption::getAllOptions
const dictionary & getAllOptions() const
return a reference of allOptions_ dictionary
Definition: DAOption.H:56
DAInputVolCoord.H
mesh
fvMesh & mesh
Definition: createRefsHeatTransfer.H:4
Foam::DAIndex
Definition: DAIndex.H:32
Foam::DAInput::daOption_
const DAOption & daOption_
DAOption object.
Definition: DAInput.H:51
Foam::DAModel
Definition: DAModel.H:57
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(DAFunction, 0)
Foam
Definition: checkGeometry.C:32
Foam::DAInput
Definition: DAInput.H:30
forAll
forAll(nuTilda1, cellI)
Definition: nuTilda1EqnIrkPimple.H:19
Foam::DAInput::mesh_
fvMesh & mesh_
fvMesh
Definition: DAInput.H:48