OpenFOAM
v2506
The open source CFD toolbox
CompactIOList.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-2017 OpenFOAM Foundation
9
Copyright (C) 2018-2024 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::CompactIOList
29
30
Description
31
A List of objects of type <T> with automated input and output using
32
a compact storage. Behaves like IOList except when binary output in
33
case it writes a CompactListList.
34
35
Useful for lists of small sublists e.g. faceList, cellList.
36
37
SourceFiles
38
CompactIOList.C
39
40
\*---------------------------------------------------------------------------*/
41
42
#ifndef Foam_CompactIOList_H
43
#define Foam_CompactIOList_H
44
45
#include "
IOList.H
"
46
47
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48
49
namespace
Foam
50
{
51
52
// Forward Declarations
53
template
<
class
T,
class
BaseType>
class
CompactIOList
;
54
55
template
<
class
T,
class
BaseType>
Istream
&
operator
>>
56
(
57
Istream
&,
58
CompactIOList<T, BaseType>
&
59
);
60
template
<
class
T,
class
BaseType>
Ostream
&
operator
<<
61
(
62
Ostream
&,
63
const
CompactIOList<T, BaseType>
&
64
);
65
66
/*---------------------------------------------------------------------------*\
67
Class CompactIOList Declaration
68
\*---------------------------------------------------------------------------*/
69
70
template
<
class
T,
class
BaseType>
71
class
CompactIOList
72
:
73
public
regIOobject
,
74
public
List
<T>
75
{
76
// Private Member Functions
77
78
//- Read if IOobject flags set. Return true if read.
79
//- Reads according to the header type.
80
// Return true if read.
81
bool
readIOcontents();
82
83
//- Has too many elements in it?
84
bool
overflows()
const
;
85
86
87
public
:
88
89
//- The underlying content type
90
typedef
List<T>
content_type
;
91
92
//- Runtime type information
93
TypeName
(
"CompactList"
);
94
95
96
// Constructors
97
98
//- Default copy construct
99
CompactIOList
(
const
CompactIOList
&) =
default
;
100
101
//- Construct from IOobject
102
explicit
CompactIOList
(
const
IOobject
&
io
);
103
104
//- Construct from IOobject and zero size (if not read)
105
CompactIOList
(
const
IOobject
&
io
,
Foam::zero
);
106
107
//- Construct from IOobject and default length of CompactIOList
108
CompactIOList
(
const
IOobject
&
io
,
const
label len);
109
110
//- Construct from IOobject and List content
111
CompactIOList
(
const
IOobject
&
io
,
const
UList<T>
& content);
112
113
//- Construct by transferring the List content
114
CompactIOList
(
const
IOobject
&
io
,
List<T>
&& content);
115
116
117
//- Destructor
118
virtual
~CompactIOList
() =
default
;
119
120
121
// Member Functions
122
123
//- Write using stream options. Checks for overflow in binary
124
virtual
bool
writeObject
125
(
126
IOstreamOption
streamOpt,
127
const
bool
writeOnProc
128
)
const
;
129
130
virtual
bool
writeData
(
Ostream
&
os
)
const
;
131
132
133
// Member Operators
134
135
//- Copy assignment of entries
136
void
operator=
(
const
CompactIOList<T, BaseType>
& rhs);
137
138
//- Copy or move assignment of entries
139
using
List<T>::operator
=;
140
};
141
142
143
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
144
145
}
// End namespace Foam
146
147
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
148
149
#ifdef NoRepository
150
#include "
CompactIOList.C
"
151
#endif
152
153
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154
155
#endif
156
157
// ************************************************************************* //
IOList.H
Foam::CompactIOList::content_type
List< T > content_type
The underlying content type.
Definition:
CompactIOList.H:92
Foam::CompactIOList::CompactIOList
CompactIOList(const CompactIOList &)=default
Default copy construct.
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition:
BitOps.H:56
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition:
Istream.H:57
Foam::IOstreamOption
A simple container for options an IOstream can normally have.
Definition:
IOstreamOption.H:59
Foam::CompactIOList::writeData
virtual bool writeData(Ostream &os) const
Pure virtual writeData function.
Definition:
CompactIOList.C:198
Foam::CompactIOList::operator=
void operator=(const CompactIOList< T, BaseType > &rhs)
Copy assignment of entries.
Definition:
CompactIOList.C:208
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:
HashTable.H:105
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition:
Ostream.H:56
Foam::CompactIOList::writeObject
virtual bool writeObject(IOstreamOption streamOpt, const bool writeOnProc) const
Write using stream options. Checks for overflow in binary.
Definition:
CompactIOList.C:159
os
OBJstream os(runTime.globalPath()/outputName)
Foam::CompactIOList
A List of objects of type <T> with automated input and output using a compact storage. Behaves like IOList except when binary output in case it writes a CompactListList.
Definition:
CompactIOList.H:48
Foam::CompactIOList::~CompactIOList
virtual ~CompactIOList()=default
Destructor.
Foam::CompactIOList::TypeName
TypeName("CompactList")
Runtime type information.
Foam::regIOobject
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition:
regIOobject.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:57
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:180
CompactIOList.C
Foam
Namespace for OpenFOAM.
Definition:
atmBoundaryLayer.C:26
src
OpenFOAM
db
IOobjects
CompactIOList
CompactIOList.H
Generated by
1.8.14