OpenFOAM
v2312
The open source CFD toolbox
localIOdictionary.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) 2015-2017 OpenFOAM Foundation
9
Copyright (C) 2021-2023 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 "
localIOdictionary.H
"
30
31
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32
33
Foam::localIOdictionary::localIOdictionary
34
(
35
const
IOobject
&
io
,
36
const
dictionary
* fallback
37
)
38
:
39
localIOdictionary
(
io
, typeName, fallback)
40
{}
41
42
43
Foam::localIOdictionary::localIOdictionary
44
(
45
const
IOobject
&
io
,
46
const
dictionary
&
dict
47
)
48
:
49
localIOdictionary
(
io
, typeName, &
dict
)
50
{}
51
52
53
Foam::localIOdictionary::localIOdictionary
54
(
55
const
IOobject
&
io
,
56
const
word
& wantedType,
57
const
dictionary
* fallback
58
)
59
:
60
baseIOdictionary
(
io
, fallback)
61
{
62
if
(!
readHeaderOk
(
IOstreamOption::ASCII
, wantedType) && fallback)
63
{
64
dictionary::operator=
(*fallback);
65
}
66
67
// For if MUST_READ_IF_MODIFIED
68
addWatch
();
69
}
70
71
72
Foam::localIOdictionary::localIOdictionary
73
(
74
const
IOobject
&
io
,
75
Istream
& is
76
)
77
:
78
baseIOdictionary
(
io
, is)
79
{
80
// Default construct dictionary and read in afterwards
81
// so that if there is some fancy massaging due to a
82
// functionEntry in
83
// the dictionary at least the type information is already complete.
84
is >> *
this
;
85
86
// For if MUST_READ_IF_MODIFIED
87
addWatch
();
88
}
89
90
91
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
92
93
Foam::dictionary
Foam::localIOdictionary::readContents
(
const
IOobject
&
io
)
94
{
95
IOobject
rio(
io
,
IOobjectOption::NO_REGISTER
);
96
if
(rio.readOpt() ==
IOobjectOption::MUST_READ_IF_MODIFIED
)
97
{
98
rio.readOpt(
IOobjectOption::MUST_READ
);
99
}
100
101
localIOdictionary reader(rio);
102
103
return
dictionary
(std::move(static_cast<dictionary&>(reader)));
104
}
105
106
107
// ************************************************************************* //
Foam::localIOdictionary::localIOdictionary
localIOdictionary(const IOobject &io, const dictionary *fallback=nullptr)
Construct given an IOobject and optional fallback dictionary content.
Definition:
localIOdictionary.C:27
dict
dictionary dict
Definition:
searchingEngine.H:11
Foam::baseIOdictionary
baseIOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO function...
Definition:
baseIOdictionary.H:52
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition:
dictionary.H:129
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition:
Istream.H:57
Foam::IOstreamOption::ASCII
"ascii" (normal default)
Definition:
IOstreamOption.H:73
Foam::localIOdictionary
localIOdictionary is derived from IOdictionary but excludes parallel master reading.
Definition:
localIOdictionary.H:48
Foam::dictionary::operator=
void operator=(const dictionary &rhs)
Copy assignment.
Definition:
dictionary.C:868
Foam::word
A class for handling words, derived from Foam::string.
Definition:
word.H:63
Foam::IOobjectOption::MUST_READ_IF_MODIFIED
Definition:
IOobjectOption.H:71
Foam::IOobjectOption::MUST_READ
Reading required.
Definition:
IOobjectOption.H:63
Foam::regIOobject::addWatch
virtual void addWatch()
Add file watch on object (if registered and READ_IF_MODIFIED)
Definition:
regIOobject.C:277
Foam::localIOdictionary::readContents
static dictionary readContents(const IOobject &io)
Read and return contents. The IOobject will not be registered.
Definition:
localIOdictionary.C:86
writeChecksFormatType::dictionary
io
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported...
Definition:
IOobject.H:172
Foam::regIOobject::readHeaderOk
bool readHeaderOk(const IOstreamOption::streamFormat fmt, const word &typeName)
Helper: check readOpt flags and read if necessary.
Definition:
regIOobjectRead.C:32
Foam::IOobjectOption::NO_REGISTER
Do not request registration (bool: false)
Definition:
IOobjectOption.H:99
localIOdictionary.H
src
OpenFOAM
db
IOobjects
IOdictionary
localIOdictionary.C
Generated by
1.8.14