IOMRFZoneList.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) 2012-2017 OpenFOAM Foundation
9  Copyright (C) 2019 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "IOMRFZoneList.H"
30 #include "fvMesh.H"
31 #include "Time.H"
32 
33 // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
34 
35 Foam::IOobject Foam::IOMRFZoneList::createIOobject
36 (
37  const fvMesh& mesh
38 ) const
39 {
40  IOobject io
41  (
42  "MRFProperties",
43  mesh.time().constant(),
44  mesh,
47  );
48 
49  if (io.typeHeaderOk<IOdictionary>(true))
50  {
51  Info<< "Creating MRF zone list from " << io.name() << endl;
52 
53  io.readOpt() = IOobject::MUST_READ_IF_MODIFIED;
54  return io;
55  }
56  else
57  {
58  Info<< "No MRF models present" << nl << endl;
59 
60  io.readOpt() = IOobject::NO_READ;
61  return io;
62  }
63 }
64 
65 
66 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
67 
68 Foam::IOMRFZoneList::IOMRFZoneList
69 (
70  const fvMesh& mesh
71 )
72 :
73  IOdictionary(createIOobject(mesh)),
74  MRFZoneList(mesh, *this)
75 {}
76 
77 
79 {
80  if (regIOobject::read())
81  {
82  MRFZoneList::read(*this);
83  return true;
84  }
85 
86  return false;
87 }
88 
89 
90 // ************************************************************************* //
91 
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::MRFZoneList
List container for MRF zomes.
Definition: MRFZoneList.H:57
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::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
IOMRFZoneList.H
Time.H
Foam::IOMRFZoneList::read
virtual bool read()
Read dictionary.
Definition: IOMRFZoneList.C:78
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::MRFZoneList::read
bool read(const dictionary &dict)
Read dictionary.
Definition: MRFZoneList.C:107
Foam::IOobject::NO_READ
Definition: IOobject.H:123
Foam::IOobject::MUST_READ
Definition: IOobject.H:120