OpenFOAM: API Guide
v2112
The open source CFD toolbox
GlobalIOList.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 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 "
GlobalIOList.H
"
30
31
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32
33
template
<
class
Type>
34
Foam::GlobalIOList<Type>::GlobalIOList
(
const
IOobject
&
io
)
35
:
36
regIOobject
(
io
)
37
{
38
// Check for MUST_READ_IF_MODIFIED
39
warnNoRereading<GlobalIOList<Type>>();
40
41
readHeaderOk
(
IOstream::BINARY
,
typeName
);
42
}
43
44
45
template
<
class
Type>
46
Foam::GlobalIOList<Type>::GlobalIOList
(
const
IOobject
&
io
,
Foam::zero
)
47
:
48
regIOobject
(
io
)
49
{
50
// Check for MUST_READ_IF_MODIFIED
51
warnNoRereading<GlobalIOList<Type>>();
52
53
readHeaderOk
(
IOstream::BINARY
,
typeName
);
54
}
55
56
57
template
<
class
Type>
58
Foam::GlobalIOList<Type>::GlobalIOList
(
const
IOobject
&
io
,
const
label len)
59
:
60
regIOobject
(
io
)
61
{
62
// Check for MUST_READ_IF_MODIFIED
63
warnNoRereading<GlobalIOList<Type>>();
64
65
if
(!
readHeaderOk
(
IOstream::BINARY
,
typeName
))
66
{
67
List<Type>::resize
(len);
68
}
69
}
70
71
72
template
<
class
Type>
73
Foam::GlobalIOList<Type>::GlobalIOList
74
(
75
const
IOobject
&
io
,
76
const
UList<Type>
& content
77
)
78
:
79
regIOobject
(
io
)
80
{
81
// Check for MUST_READ_IF_MODIFIED
82
warnNoRereading<GlobalIOList<Type>>();
83
84
if
(!readHeaderOk(
IOstream::BINARY
, typeName))
85
{
86
List<Type>::operator=
(content);
87
}
88
}
89
90
91
template
<
class
Type>
92
Foam::GlobalIOList<Type>::GlobalIOList
93
(
94
const
IOobject
&
io
,
95
List<Type>
&& content
96
)
97
:
98
regIOobject
(
io
)
99
{
100
// Check for MUST_READ_IF_MODIFIED
101
warnNoRereading<GlobalIOList<Type>>();
102
103
List<Type>::transfer
(content);
104
105
readHeaderOk
(
IOstream::BINARY
,
typeName
);
106
}
107
108
109
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
110
111
template
<
class
Type>
112
bool
Foam::GlobalIOList<Type>::readData
(
Istream
& is)
113
{
114
is >> *
this
;
115
return
is.
good
();
116
}
117
118
119
template
<
class
Type>
120
bool
Foam::GlobalIOList<Type>::writeData
(
Ostream
&
os
)
const
121
{
122
return
(
os
<< *
this
).
good
();
123
}
124
125
126
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
127
128
template
<
class
Type>
129
void
Foam::GlobalIOList<Type>::operator=
(
const
GlobalIOList<Type>
& rhs)
130
{
131
List<Type>::operator=
(rhs);
132
}
133
134
135
// ************************************************************************* //
GlobalIOList.H
Foam::Euler::resize
virtual bool resize()
Resize the ODE solver.
Definition:
Euler.C:53
Foam::GlobalIOList
IOList with global data (so optionally read from master)
Definition:
GlobalIOList.H:57
Foam::GlobalIOList::typeName
const word typeName("scalarVectorTable")
Foam::GlobalIOList::readData
virtual bool readData(Istream &is)
The readData method for regIOobject read operation.
Definition:
GlobalIOList.C:112
Foam::GlobalIOList::operator=
void operator=(const GlobalIOList< Type > &rhs)
Copy assignment of entries.
Definition:
GlobalIOList.C:129
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition:
IOobject.H:170
Foam::IOobject::good
bool good() const noexcept
Did last readHeader() succeed?
Definition:
IOobjectI.H:222
Foam::IOstream::good
bool good() const noexcept
True if next operation might succeed.
Definition:
IOstream.H:233
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition:
Istream.H:64
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::fileFormats::STLCore::BINARY
@ BINARY
BINARY.
Definition:
STLCore.H:64
Foam::regIOobject
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition:
regIOobject.H:76
Foam::regIOobject::readHeaderOk
bool readHeaderOk(const IOstreamOption::streamFormat fmt, const word &typeName)
Helper: check readOpt flags and read if necessary.
Definition:
regIOobjectRead.C:39
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
GlobalIOList
GlobalIOList.C
Generated by
1.9.5
OPENFOAM® is a registered
trademark
of OpenCFD Ltd.