IOporosityModelList.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 | Copyright (C) 2012 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 
33 (
34  const fvMesh& mesh
35 ) const
36 {
37  IOobject io
38  (
39  "porosityProperties",
40  mesh.time().constant(),
41  mesh,
42  IOobject::MUST_READ,
43  IOobject::NO_WRITE
44  );
45 
46  if (io.headerOk())
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 
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 // ************************************************************************* //
90 
Foam::IOdictionary
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:53
Foam::IOobject
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
Foam::IOporosityModelList::IOporosityModelList
IOporosityModelList(const IOporosityModelList &)
Disallow default bitwise copy construct.
Foam::regIOobject::read
virtual bool read()
Read object.
Definition: regIOobjectRead.C:171
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Foam::porosityModelList
List container for porosity models.
Definition: porosityModelList.H:55
Foam::IOobject::headerOk
bool headerOk()
Read and check header info.
Definition: IOobject.C:439
Foam::IOobject::readOpt
readOption readOpt() const
Definition: IOobject.H:317
Foam::nl
static const char nl
Definition: Ostream.H:260
Foam::Info
messageStream Info
Foam::IOobject::name
const word & name() const
Return name.
Definition: IOobject.H:273
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
Foam::porosityModelList::read
bool read(const dictionary &dict)
Read dictionary.
Definition: porosityModelList.C:101
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
fvMesh.H
Foam::IOporosityModelList::createIOobject
IOobject createIOobject(const fvMesh &mesh) const
Create IO object if dictionary is present.
Definition: IOporosityModelList.C:33
IOporosityModelList.H
Foam::IOporosityModelList::read
virtual bool read()
Read dictionary.
Definition: IOporosityModelList.C:75