PackedBoolListI.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
27 
29 :
30  PackedList<1>()
31 {}
32 
33 
35 :
36  PackedList<1>(size)
37 {}
38 
39 
41 (
42  const label size,
43  const bool val
44 )
45 :
46  PackedList<1>(size, (val ? 1u : 0u))
47 {}
48 
49 
51 :
52  PackedList<1>(lst)
53 {}
54 
55 
57 :
58  PackedList<1>(lst)
59 {}
60 
61 
63 :
64  PackedList<1>()
65 {
66  operator=(lst);
67 }
68 
69 
71 :
72  PackedList<1>(indices.size(), 0u)
73 {
74  set(indices);
75 }
76 
77 
79 :
80  PackedList<1>(indices.size(), 0u)
81 {
82  set(indices);
83 }
84 
85 
88 {
89  return autoPtr<PackedBoolList>(new PackedBoolList(*this));
90 }
91 
92 
93 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
94 
96 {
97  PackedList<1>::transfer(static_cast<PackedList<1>&>(lst));
98 }
99 
100 
102 {
104 }
105 
106 
107 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
108 
109 inline void Foam::PackedBoolList::operator=(const bool val)
110 {
112 }
113 
114 
116 {
118 }
119 
120 
122 {
124 }
125 
126 
127 inline void Foam::PackedBoolList::operator=(const labelUList& indices)
128 {
129  clear();
130  set(indices);
131 }
132 
133 
135 {
136  clear();
137  set(indices);
138 }
139 
140 
143 {
144  PackedBoolList result(*this);
145  result.flip();
146 
147  return result;
148 }
149 
150 
151 inline Foam::PackedBoolList&
153 {
154  subset(lst);
155  return *this;
156 }
157 
158 
159 inline Foam::PackedBoolList&
161 {
162  subset(indices);
163  return *this;
164 }
165 
166 
167 inline Foam::PackedBoolList&
169 {
170  subset(indices);
171  return *this;
172 }
173 
174 
175 inline Foam::PackedBoolList&
177 {
178  set(lst);
179  return *this;
180 }
181 
182 
183 inline Foam::PackedBoolList&
185 {
186  set(indices);
187  return *this;
188 }
189 
190 
191 inline Foam::PackedBoolList&
193 {
194  set(indices);
195  return *this;
196 }
197 
198 
199 inline Foam::PackedBoolList&
201 {
202  return operator|=(lst);
203 }
204 
205 
206 inline Foam::PackedBoolList&
208 {
209  return operator|=(indices);
210 }
211 
212 
213 inline Foam::PackedBoolList&
215 {
216  return operator|=(indices);
217 }
218 
219 
220 inline Foam::PackedBoolList&
222 {
223  unset(lst);
224  return *this;
225 }
226 
227 
228 inline Foam::PackedBoolList&
230 {
231  unset(indices);
232  return *this;
233 }
234 
235 
236 inline Foam::PackedBoolList&
238 {
239  unset(indices);
240  return *this;
241 }
242 
243 
244 // ************************************************************************* //
PackedBoolList & operator &=(const PackedList< 1 > &)
And operator (lists may be dissimilar sizes)
void subset(const PackedList< 1 > &)
Subset with the specified list.
void flip()
Invert the bits in the addressable region.
Definition: PackedList.C:104
void transfer(PackedList< nBits > &)
Transfer the contents of the argument list into this list.
Definition: PackedListI.H:944
A dynamically allocatable list of packed unsigned integers.
Definition: PackedList.H:116
void operator=(const bool val)
Assignment of all entries to the given value.
void clear()
Clear the list, i.e. set addressable size to zero.
Definition: PackedListI.H:889
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:60
PackedBoolList operator~() const
Complement operator.
PackedBoolList()
Construct null.
PackedBoolList & operator-=(const PackedList< 1 > &)
Remove entries from this list - unset the specified bits.
PackedBoolList & operator+=(const PackedList< 1 > &)
Add entries to this list, synonymous with the or operator.
A bit-packed bool list.
void transfer(PackedBoolList &)
Transfer the contents of the argument list into this list.
void operator=(const unsigned int val)
Assignment of all entries to the given value. Takes linear time.
Definition: PackedListI.H:1059
A List with indirect addressing.
Definition: fvMatrix.H:106
autoPtr< PackedBoolList > clone() const
Clone.
void unset(const PackedList< 1 > &)
Unset specified bits.
label size() const
Number of entries.
Definition: PackedListI.H:711
PackedBoolList & operator|=(const PackedList< 1 > &)
Or operator (lists may be dissimilar sizes)