IOporosityModelList.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 "IOporosityModelList.H"
27 #include "fvMesh.H"
28 #include "Time.H"
29 
30 // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
31 
32 Foam::IOobject Foam::IOporosityModelList::createIOobject
33 (
34  const fvMesh& mesh
35 ) const
36 {
37  IOobject io
38  (
39  "porosityProperties",
40  mesh.time().constant(),
41  mesh,
44  );
45 
46  if (io.typeHeaderOk<IOdictionary>(true))
47  {
48  Info<< "Creating porosity model list from " << io.name() << nl << endl;
49 
50  io.readOpt() = IOobject::MUST_READ_IF_MODIFIED;
51  return io;
52  }
53  else
54  {
55  Info<< "No porosity models present" << nl << endl;
56 
57  io.readOpt() = IOobject::NO_READ;
58  return io;
59  }
60 }
61 
62 
63 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
64 
65 Foam::IOporosityModelList::IOporosityModelList
66 (
67  const fvMesh& mesh
68 )
69 :
70  IOdictionary(createIOobject(mesh)),
71  porosityModelList(mesh, *this)
72 {}
73 
74 
76 {
77  if (regIOobject::read())
78  {
80  return true;
81  }
82  else
83  {
84  return false;
85  }
86 }
87 
88 
89 // ************************************************************************* //
bool read(const dictionary &dict)
Read dictionary.
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
virtual bool read()
Read dictionary.
static const char nl
Definition: Ostream.H:265
IOdictionary(const IOobject &)
Construct given an IOobject.
Definition: IOdictionary.C:30
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
List container for porosity models.
messageStream Info
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:92