OpenFOAM: API Guide
v2112
The open source CFD toolbox
IOMap.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) 2018-2022 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 "
IOMap.H
"
30
31
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
32
33
template
<
class
T>
34
bool
Foam::IOMap<T>::readContents
()
35
{
36
if
37
(
38
(
39
readOpt() == IOobject::MUST_READ
40
|| readOpt() == IOobject::MUST_READ_IF_MODIFIED
41
)
42
|| (readOpt() == IOobject::READ_IF_PRESENT && headerOk())
43
)
44
{
45
// For if MUST_READ_IF_MODIFIED
46
addWatch();
47
48
readStream(typeName) >> *
this
;
49
close();
50
51
return
true
;
52
}
53
54
return
false
;
55
}
56
57
58
// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
59
60
template
<
class
T>
61
Foam::IOMap<T>::IOMap
(
const
IOobject
&
io
)
62
:
63
regIOobject
(
io
)
64
{
65
readContents();
66
}
67
68
69
template
<
class
T>
70
Foam::IOMap<T>::IOMap
(
const
IOobject
&
io
,
const
label size)
71
:
72
regIOobject
(
io
)
73
{
74
if
(!readContents())
75
{
76
Map<T>::resize
(
size
);
77
}
78
}
79
80
81
template
<
class
T>
82
Foam::IOMap<T>::IOMap
(
const
IOobject
&
io
,
const
Map<T>
& content)
83
:
84
regIOobject
(
io
)
85
{
86
if
(!readContents())
87
{
88
Map<T>::operator=
(content);
89
}
90
}
91
92
93
template
<
class
T>
94
Foam::IOMap<T>::IOMap
(
const
IOobject
&
io
,
Map<T>
&& content)
95
:
96
regIOobject
(
io
)
97
{
98
Map<T>::transfer
(content);
99
100
readContents();
101
}
102
103
104
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
105
106
template
<
class
T>
107
bool
Foam::IOMap<T>::writeData
(
Ostream
&
os
)
const
108
{
109
os
<< *
this
;
110
return
os
.
good
();
111
}
112
113
114
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
115
116
template
<
class
T>
117
void
Foam::IOMap<T>::operator=
(
const
IOMap<T>
& rhs)
118
{
119
Map<T>::operator=
(rhs);
120
}
121
122
123
// ************************************************************************* //
IOMap.H
Foam::Euler::resize
virtual bool resize()
Resize the ODE solver.
Definition:
Euler.C:53
Foam::HashTable< T, label, Hash< label > >::size
label size() const noexcept
The number of elements in table.
Definition:
HashTableI.H:52
Foam::IOMap
A Map of objects of type <T> with automated input and output. Is a global object; i....
Definition:
IOMap.H:58
Foam::IOMap::operator=
void operator=(const IOMap< T > &rhs)
Copy assignment of entries.
Definition:
IOMap.C:117
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition:
IOobject.H:170
Foam::IOstream::good
bool good() const noexcept
True if next operation might succeed.
Definition:
IOstream.H:233
Foam::Map
A HashTable to objects of type <T> with a label key.
Definition:
Map.H:60
Foam::Map::operator=
void operator=(const this_type &rhs)
Copy assignment.
Definition:
Map.H:117
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition:
Ostream.H:62
Foam::regIOobject
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition:
regIOobject.H:76
Foam::regionModels::surfaceFilmModels::kinematicSingleLayer::transfer
transferModelList & transfer()
Transfer.
Definition:
kinematicSingleLayerI.H:188
os
OBJstream os(runTime.globalPath()/outputName)
io
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
src
OpenFOAM
db
IOobjects
IOMap
IOMap.C
Generated by
1.9.5
OPENFOAM® is a registered
trademark
of OpenCFD Ltd.