IOMRFZoneList.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "IOMRFZoneList.H"
27 #include "fvMesh.H"
28 #include "Time.H"
29 
30 // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
31 
32 Foam::IOobject Foam::IOMRFZoneList::createIOobject
33 (
34  const fvMesh& mesh
35 ) const
36 {
37  IOobject io
38  (
39  "MRFProperties",
40  mesh.time().constant(),
41  mesh,
44  );
45 
46  if (io.typeHeaderOk<IOdictionary>(true))
47  {
48  Info<< "Creating MRF zone list from " << io.name() << endl;
49 
50  io.readOpt() = IOobject::MUST_READ_IF_MODIFIED;
51  return io;
52  }
53  else
54  {
55  Info<< "No MRF models present" << nl << endl;
56 
57  io.readOpt() = IOobject::NO_READ;
58  return io;
59  }
60 }
61 
62 
63 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
64 
65 Foam::IOMRFZoneList::IOMRFZoneList
66 (
67  const fvMesh& mesh
68 )
69 :
70  IOdictionary(createIOobject(mesh)),
71  MRFZoneList(mesh, *this)
72 {}
73 
74 
76 {
77  if (regIOobject::read())
78  {
79  MRFZoneList::read(*this);
80  return true;
81  }
82  else
83  {
84  return false;
85  }
86 }
87 
88 
89 // ************************************************************************* //
virtual bool read()
Read object.
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:209
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:256
dynamicFvMesh & mesh
static const char nl
Definition: Ostream.H:265
virtual bool read()
Read dictionary.
Definition: IOMRFZoneList.C:75
List container for MRF zomes.
Definition: MRFZoneList.H:55
IOdictionary(const IOobject &)
Construct given an IOobject.
Definition: IOdictionary.C:30
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
messageStream Info
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:92
bool read(const dictionary &dict)
Read dictionary.
Definition: MRFZoneList.C:104