OpenFOAM: API Guide
v2112
The open source CFD toolbox
fvOptions.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) 2011-2017 OpenFOAM Foundation
9
Copyright (C) 2019-2021 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 "
fvOptions.H
"
30
#include "
fvMesh.H
"
31
#include "
Time.H
"
32
33
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34
35
namespace
Foam
36
{
37
namespace
fv
38
{
39
defineTypeNameAndDebug
(
options
, 0);
40
}
41
}
42
43
44
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
45
46
Foam::IOobject
Foam::fv::options::createIOobject
47
(
48
const
fvMesh&
mesh
49
)
const
50
{
51
IOobject
io
52
(
53
typeName,
54
mesh
.
time
().
constant
(),
55
mesh
,
56
IOobject::MUST_READ
,
57
IOobject::NO_WRITE
58
);
59
60
if
(
io
.
typeHeaderOk
<IOdictionary>(
true
))
61
{
62
Info
<<
"Creating finite volume options from "
63
<<
io
.
instance
()/
io
.
name
() <<
nl
64
<<
endl
;
65
66
io
.
readOpt
(
IOobject::MUST_READ_IF_MODIFIED
);
67
}
68
else
69
{
70
// Check if the fvOptions file is in system
71
io
.
instance
() =
mesh
.
time
().
system
();
72
73
if
(
io
.
typeHeaderOk
<IOdictionary>(
true
))
74
{
75
Info
<<
"Creating finite volume options from "
76
<<
io
.
instance
()/
io
.
name
() <<
nl
77
<<
endl
;
78
79
io
.
readOpt
(
IOobject::MUST_READ_IF_MODIFIED
);
80
}
81
else
82
{
83
io
.
readOpt
(
IOobject::NO_READ
);
84
}
85
}
86
87
return
io
;
88
}
89
90
91
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
92
93
Foam::fv::options::options
94
(
95
const
fvMesh
&
mesh
96
)
97
:
98
IOdictionary
(createIOobject(
mesh
)),
99
optionList
(
mesh
, *this)
100
{}
101
102
103
Foam::fv::options
&
Foam::fv::options::New
(
const
fvMesh
&
mesh
)
104
{
105
if
(
mesh
.thisDb().foundObject<
options
>(typeName))
106
{
107
return
const_cast<
options
&
>
108
(
109
mesh
.lookupObject<
options
>(typeName)
110
);
111
}
112
else
113
{
114
DebugInFunction
115
<<
"Constructing "
<< typeName
116
<<
" for region "
<<
mesh
.name() <<
nl
;
117
118
options
* objectPtr =
new
options
(
mesh
);
119
regIOobject::store
(objectPtr);
120
return
*objectPtr;
121
}
122
}
123
124
125
bool
Foam::fv::options::read
()
126
{
127
if
(IOdictionary::regIOobject::read())
128
{
129
optionList::read
(*
this
);
130
return
true
;
131
}
132
133
return
false
;
134
}
135
136
137
// ************************************************************************* //
Time.H
Foam::IOdictionary
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition:
IOdictionary.H:57
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition:
IOobject.H:170
Foam::IOobject::name
const word & name() const noexcept
Return the object name.
Definition:
IOobjectI.H:65
Foam::IOobject::readOpt
readOption readOpt() const noexcept
The read option.
Definition:
IOobjectI.H:164
Foam::IOobject::typeHeaderOk
bool typeHeaderOk(const bool checkType=true, const bool search=true, const bool verbose=true)
Read header (uses typeFilePath to find file) and check its info.
Definition:
IOobjectTemplates.C:39
Foam::IOobject::instance
const fileName & instance() const noexcept
Read access to instance path component.
Definition:
IOobjectI.H:196
Foam::IOobject::NO_WRITE
@ NO_WRITE
Definition:
IOobject.H:187
Foam::IOobject::NO_READ
@ NO_READ
Definition:
IOobject.H:178
Foam::IOobject::MUST_READ_IF_MODIFIED
@ MUST_READ_IF_MODIFIED
Definition:
IOobject.H:180
Foam::IOobject::MUST_READ
@ MUST_READ
Definition:
IOobject.H:179
Foam::RASModels::kEpsilonLopesdaCosta::read
virtual bool read()
Re-read model coefficients if they have changed.
Definition:
kEpsilonLopesdaCosta.C:380
Foam::TimePaths::system
const word & system() const
Return system name.
Definition:
TimePathsI.H:102
Foam::TimePaths::constant
const word & constant() const
Return constant name.
Definition:
TimePathsI.H:96
Foam::Time::New
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
Definition:
Time.C:717
Foam::ccm::reader::options
Definition:
ccmReader.H:588
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition:
fvMesh.H:91
Foam::fvMesh::time
const Time & time() const
Return the top-level database.
Definition:
fvMesh.H:290
Foam::fv::optionList
List of finite volume options.
Definition:
fvOptionList.H:72
Foam::fv::options
Finite-volume options.
Definition:
fvOptions.H:59
Foam::fv::options::read
virtual bool read()
Read dictionary.
Definition:
fvOptions.C:125
Foam::regIOobject::store
bool store()
Definition:
regIOobjectI.H:43
defineTypeNameAndDebug
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition:
className.H:121
mesh
dynamicFvMesh & mesh
Definition:
createDynamicFvMesh.H:6
fvMesh.H
fvOptions.H
io
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
DebugInFunction
#define DebugInFunction
Report an information message using Foam::Info.
Definition:
messageStream.H:388
Foam
Namespace for OpenFOAM.
Definition:
atmBoundaryLayer.C:34
Foam::Info
messageStream Info
Information stream (stdout output on master, null elsewhere)
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition:
Ostream.H:372
Foam::nl
constexpr char nl
The newline '\n' character (0x0a)
Definition:
Ostream.H:53
fv
labelList fv(nPoints)
src
finiteVolume
cfdTools
general
fvOptions
fvOptions.C
Generated by
1.9.5
OPENFOAM® is a registered
trademark
of OpenCFD Ltd.