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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2012-2014 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "IOporosityModelList.H"
29 #include "fvMesh.H"
30 #include "Time.H"
31 
32 // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
33 
34 Foam::IOobject Foam::IOporosityModelList::createIOobject
35 (
36  const fvMesh& mesh
37 ) const
38 {
39  IOobject io
40  (
41  "porosityProperties",
42  mesh.time().constant(),
43  mesh,
46  );
47 
48  if (io.typeHeaderOk<IOdictionary>(true))
49  {
50  Info<< "Creating porosity model list from " << io.name() << nl << endl;
51 
52  io.readOpt() = IOobject::MUST_READ_IF_MODIFIED;
53  }
54  else
55  {
56  Info<< "No porosity models present" << nl << endl;
57 
58  io.readOpt() = IOobject::NO_READ;
59  }
60 
61  return io;
62 }
63 
64 
65 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
66 
67 Foam::IOporosityModelList::IOporosityModelList
68 (
69  const fvMesh& mesh
70 )
71 :
72  IOdictionary(createIOobject(mesh)),
73  porosityModelList(mesh, *this)
74 {}
75 
76 
78 {
79  if (regIOobject::read())
80  {
82  return true;
83  }
84 
85  return false;
86 }
87 
88 
89 // ************************************************************************* //
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::IOobject::IOobject
IOobject(const IOobject &)=default
Copy construct.
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:350
Foam::porosityModelList
List container for porosity models.
Definition: porosityModelList.H:57
Foam::Info
messageStream Info
Information stream (uses stdout - output is on the master only)
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::porosityModelList::read
bool read(const dictionary &dict)
Read dictionary.
Definition: porosityModelList.C:97
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:83
fvMesh.H
Time.H
IOporosityModelList.H
Foam::nl
constexpr char nl
Definition: Ostream.H:385
Foam::IOporosityModelList::read
virtual bool read()
Read dictionary.
Definition: IOporosityModelList.C:77
Foam::IOobject::MUST_READ_IF_MODIFIED
Definition: IOobject.H:121
Foam::IOobject::NO_READ
Definition: IOobject.H:123
Foam::IOobject::MUST_READ
Definition: IOobject.H:120