OpenFOAM: API Guide
v2112
The open source CFD toolbox
IOList.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-2016 OpenFOAM Foundation
9
Copyright (C) 2016-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 "
IOList.H
"
30
31
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
32
33
template
<
class
T>
34
bool
Foam::IOList<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
readStream(typeName) >> *
this
;
46
close();
47
return
true
;
48
}
49
50
return
false
;
51
}
52
53
54
// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
55
56
template
<
class
T>
57
Foam::IOList<T>::IOList
(
const
IOobject
&
io
)
58
:
59
regIOobject
(
io
)
60
{
61
// Check for MUST_READ_IF_MODIFIED
62
warnNoRereading<IOList<T>>();
63
64
readContents();
65
}
66
67
68
template
<
class
T>
69
Foam::IOList<T>::IOList
(
const
IOobject
&
io
,
Foam::zero
)
70
:
71
regIOobject
(
io
)
72
{
73
// Check for MUST_READ_IF_MODIFIED
74
warnNoRereading<IOList<T>>();
75
76
readContents();
77
}
78
79
80
template
<
class
T>
81
Foam::IOList<T>::IOList
(
const
IOobject
&
io
,
const
label len)
82
:
83
regIOobject
(
io
)
84
{
85
// Check for MUST_READ_IF_MODIFIED
86
warnNoRereading<IOList<T>>();
87
88
if
(!readContents())
89
{
90
List<T>::resize
(len);
91
}
92
}
93
94
95
template
<
class
T>
96
Foam::IOList<T>::IOList
(
const
IOobject
&
io
,
const
UList<T>
& content)
97
:
98
regIOobject
(
io
)
99
{
100
// Check for MUST_READ_IF_MODIFIED
101
warnNoRereading<IOList<T>>();
102
103
if
(!readContents())
104
{
105
List<T>::operator=
(content);
106
}
107
}
108
109
110
template
<
class
T>
111
Foam::IOList<T>::IOList
(
const
IOobject
&
io
,
List<T>
&& content)
112
:
113
regIOobject
(
io
)
114
{
115
// Check for MUST_READ_IF_MODIFIED
116
warnNoRereading<IOList<T>>();
117
118
List<T>::transfer
(content);
119
120
readContents();
121
}
122
123
124
template
<
class
T>
125
Foam::IOListRef<T>::IOListRef
126
(
127
const
IOobject
&
io
,
128
const
List<T>
& content
129
)
130
:
131
regIOobject
(
io
),
132
contentRef_(content)
133
{}
134
135
136
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
137
138
template
<
class
T>
139
bool
Foam::IOList<T>::writeData
(
Ostream
&
os
)
const
140
{
141
os << static_cast<const List<T>&>(*this);
142
return
os
.
good
();
143
}
144
145
146
template
<
class
T>
147
bool
Foam::IOListRef<T>::writeData
(
Ostream
&
os
)
const
148
{
149
os
<< contentRef_.cref();
150
return
os
.
good
();
151
}
152
153
154
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
155
156
template
<
class
T>
157
void
Foam::IOList<T>::operator=
(
const
IOList<T>
& rhs)
158
{
159
List<T>::operator=
(rhs);
160
}
161
162
163
// ************************************************************************* //
IOList.H
Foam::Euler::resize
virtual bool resize()
Resize the ODE solver.
Definition:
Euler.C:53
Foam::IOListRef
A IOList wrapper for writing external data.
Definition:
IOList.H:123
Foam::IOListRef::IOListRef
IOListRef()=delete
No default construct.
Foam::IOList
A List of objects of type <T> with automated input and output.
Definition:
IOList.H:58
Foam::IOList::operator=
void operator=(const IOList< T > &rhs)
Copy assignment of entries.
Definition:
IOList.C:157
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::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition:
List.H:77
Foam::List::operator=
void operator=(const UList< T > &a)
Assignment to UList operator. Takes linear time.
Definition:
List.C:480
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition:
Ostream.H:62
Foam::UList
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition:
UList.H:94
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
Foam::zero
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Definition:
zero.H:63
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
IOList
IOList.C
Generated by
1.9.5
OPENFOAM® is a registered
trademark
of OpenCFD Ltd.