OpenFOAM: API Guide
v2112
The open source CFD toolbox
IOList.H
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) 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
Class
28
Foam::IOList
29
30
Description
31
A List of objects of type <T> with automated input and output.
32
33
SourceFiles
34
IOList.C
35
36
\*---------------------------------------------------------------------------*/
37
38
#ifndef Foam_IOList_H
39
#define Foam_IOList_H
40
41
#include "
List.H
"
42
#include "
regIOobject.H
"
43
#include "
refPtr.H
"
44
45
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46
47
namespace
Foam
48
{
49
50
/*---------------------------------------------------------------------------*\
51
Class IOList Declaration
52
\*---------------------------------------------------------------------------*/
53
54
template
<
class
T>
55
class
IOList
56
:
57
public
regIOobject
,
58
public
List
<T>
59
{
60
// Private Member Functions
61
62
//- Read if IOobject flags set. Return true if read.
63
bool
readContents();
64
65
public
:
66
67
//- The underlying content type
68
typedef
List<T>
content_type
;
69
70
//- Runtime type information
71
TypeName
(
"List"
);
72
73
74
// Constructors
75
76
//- Default copy construct
77
IOList
(
const
IOList
&) =
default
;
78
79
//- Construct from IOobject
80
explicit
IOList
(
const
IOobject
&
io
);
81
82
//- Construct from IOobject and zero size (if not read)
83
IOList
(
const
IOobject
&
io
,
Foam::zero
);
84
85
//- Construct from IOobject and list size (if not read)
86
IOList
(
const
IOobject
&
io
,
const
label len);
87
88
//- Construct from IOobject and a copy of content
89
IOList
(
const
IOobject
&
io
,
const
UList<T>
& content);
90
91
//- Construct by transferring the content
92
IOList
(
const
IOobject
&
io
,
List<T>
&& content);
93
94
95
//- Destructor
96
virtual
~IOList
() =
default
;
97
98
99
// Member Functions
100
101
//- The writeData method for regIOobject write operation
102
virtual
bool
writeData
(
Ostream
&
os
)
const
;
103
104
105
// Member Operators
106
107
//- Copy assignment of entries
108
void
operator=
(
const
IOList<T>
& rhs);
109
110
//- Copy or move assignment of entries
111
using
List
<
T
>::operator=;
112
};
113
114
115
/*---------------------------------------------------------------------------*\
116
Class IOListRef Declaration
117
\*---------------------------------------------------------------------------*/
118
119
//- A IOList wrapper for writing external data.
120
template
<
class
T>
121
class
IOListRef
122
:
123
public
regIOobject
124
{
125
// Private Data
126
127
//- Reference to the external content
128
refPtr<List<T>
> contentRef_;
129
130
131
public
:
132
133
//- The underlying content type
134
typedef
List<T>
content_type
;
135
136
137
//- Type is identical to IOList
138
virtual
const
word
&
type
()
const
139
{
140
return
IOList<T>::typeName
;
141
}
142
143
144
// Generated Methods
145
146
//- No default construct
147
IOListRef
() =
delete
;
148
149
//- No copy construct
150
IOListRef
(
const
IOListRef
&) =
delete
;
151
152
//- No copy assignment
153
void
operator=
(
const
IOListRef
&) =
delete
;
154
155
156
// Constructors
157
158
//- Construct from IOobject and const data reference
159
IOListRef
(
const
IOobject
&
io
,
const
List<T>
& content);
160
161
162
//- Destructor
163
virtual
~IOListRef
() =
default
;
164
165
166
// Member Functions
167
168
//- Allow cast to const content
169
// Fatal if content is not set
170
operator
const
List<T>
&()
const
171
{
172
return
contentRef_.
cref
();
173
}
174
175
//- The writeData method for regIOobject write operation
176
// Fatal if content is not set
177
virtual
bool
writeData
(
Ostream
&
os
)
const
;
178
};
179
180
181
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
182
183
}
// End namespace Foam
184
185
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186
187
#ifdef NoRepository
188
#include "
IOList.C
"
189
#endif
190
191
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192
193
#endif
194
195
// ************************************************************************* //
IOList.C
List.H
Foam::IOListRef
A IOList wrapper for writing external data.
Definition:
IOList.H:123
Foam::IOListRef::content_type
List< T > content_type
The underlying content type.
Definition:
IOList.H:133
Foam::IOListRef::IOListRef
IOListRef()=delete
No default construct.
Foam::IOListRef::writeData
virtual bool writeData(Ostream &os) const
The writeData method for regIOobject write operation.
Definition:
IOList.C:147
Foam::IOListRef::~IOListRef
virtual ~IOListRef()=default
Destructor.
Foam::IOListRef::operator=
void operator=(const IOListRef &)=delete
No copy assignment.
Foam::IOListRef::type
virtual const word & type() const
Type is identical to IOList.
Definition:
IOList.H:137
Foam::IOListRef::IOListRef
IOListRef(const IOListRef &)=delete
No copy construct.
Foam::IOList
A List of objects of type <T> with automated input and output.
Definition:
IOList.H:58
Foam::IOList::content_type
List< T > content_type
The underlying content type.
Definition:
IOList.H:67
Foam::IOList::writeData
virtual bool writeData(Ostream &os) const
The writeData method for regIOobject write operation.
Definition:
IOList.C:139
Foam::IOList::~IOList
virtual ~IOList()=default
Destructor.
Foam::IOList::IOList
IOList(const IOList &)=default
Default copy construct.
Foam::IOList::TypeName
TypeName("List")
Runtime type information.
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::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::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::refPtr
A class for managing references or pointers (no reference counting)
Definition:
refPtr.H:58
Foam::refPtr::cref
const T & cref() const
Definition:
refPtrI.H:189
Foam::regIOobject
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition:
regIOobject.H:76
Foam::word
A class for handling words, derived from Foam::string.
Definition:
word.H:68
Foam::zero
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Definition:
zero.H:63
T
const volScalarField & T
Definition:
createFieldRefs.H:2
os
OBJstream os(runTime.globalPath()/outputName)
io
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
Foam
Namespace for OpenFOAM.
Definition:
atmBoundaryLayer.C:34
refPtr.H
regIOobject.H
TypeName
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition:
typeInfo.H:73
src
OpenFOAM
db
IOobjects
IOList
IOList.H
Generated by
1.9.5
OPENFOAM® is a registered
trademark
of OpenCFD Ltd.