fvIOoptionListAdjoint.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2007-2019 PCOpt/NTUA
9  Copyright (C) 2013-2019 FOSS GP
10  Copyright (C) 2019 OpenCFD Ltd.
11 -------------------------------------------------------------------------------
12 License
13  This file is part of OpenFOAM.
14 
15  OpenFOAM is free software: you can redistribute it and/or modify it
16  under the terms of the GNU General Public License as published by
17  the Free Software Foundation, either version 3 of the License, or
18  (at your option) any later version.
19 
20  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
21  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
22  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23  for more details.
24 
25  You should have received a copy of the GNU General Public License
26  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
27 
28 \*---------------------------------------------------------------------------*/
29 
30 #include "fvIOoptionListAdjoint.H"
31 #include "fvMesh.H"
32 #include "Time.H"
33 
34 // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
35 
36 Foam::IOobject Foam::fv::IOoptionListAdjoint::createIOobject
37 (
38  const fvMesh& mesh
39 ) const
40 {
41  IOobject io
42  (
43  "fvOptionsAdjoint",
44  mesh.time().system(),
45  mesh,
48  );
49 
50  if (io.typeHeaderOk<IOdictionary>(true))
51  {
52  Info<< "Creating fintite volume adjoint options from " << io.name()
53  << nl << endl;
54 
55  io.readOpt() = IOobject::MUST_READ_IF_MODIFIED;
56  return io;
57  }
58  else
59  {
60  Info<< "No finite volume adjoint options present" << nl << endl;
61 
62  io.readOpt() = IOobject::NO_READ;
63  return io;
64  }
65 }
66 
67 
68 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
69 
70 Foam::fv::IOoptionListAdjoint::IOoptionListAdjoint
71 (
72  const fvMesh& mesh
73 )
74 :
75  IOdictionary(createIOobject(mesh)),
76  optionList(mesh, *this)
77 {}
78 
79 
81 {
82  if (regIOobject::read())
83  {
84  optionList::read(*this);
85  return true;
86  }
87  else
88  {
89  return false;
90  }
91 }
92 
93 
94 // ************************************************************************* //
Foam::IOobject::NO_WRITE
Definition: IOobject.H:130
Foam::IOdictionary
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:54
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:104
Foam::IOdictionary::IOdictionary
IOdictionary(const IOobject &)
Construct given an IOobject.
Definition: IOdictionary.C:35
Foam::regIOobject::read
virtual bool read()
Read object.
Definition: regIOobjectRead.C:202
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:337
Foam::fv::IOoptionListAdjoint::read
virtual bool read()
Read dictionary.
Definition: fvIOoptionListAdjoint.C:80
Foam::Info
messageStream Info
Information stream (uses stdout - output is on the master only)
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:84
fvMesh.H
Time.H
fvIOoptionListAdjoint.H
Foam::nl
constexpr char nl
Definition: Ostream.H:372
Foam::IOobject::IOobject
IOobject(const word &name, const fileName &instance, const objectRegistry &registry, readOption r=NO_READ, writeOption w=NO_WRITE, bool registerObject=true)
Construct from name, instance, registry, io options.
Definition: IOobject.C:276
Foam::IOobject::MUST_READ_IF_MODIFIED
Definition: IOobject.H:121
Foam::IOobject::NO_READ
Definition: IOobject.H:123
Foam::fv::optionList
List of finite volume options.
Definition: fvOptionList.H:67
Foam::fv::optionList::read
virtual bool read(const dictionary &dict)
Read dictionary.
Definition: fvOptionList.C:160
Foam::IOobject::MUST_READ
Definition: IOobject.H:120