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-2018 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  transfer(lst());
67 }
68 
69 
71 :
72  PackedList<1>(lst)
73 {}
74 
75 
77 :
78  PackedList<1>()
79 {
80  operator=(lst);
81 }
82 
83 
85 :
86  PackedList<1>(indices.size(), 0u)
87 {
88  set(indices);
89 }
90 
91 
93 :
94  PackedList<1>(indices.size(), 0u)
95 {
96  set(indices);
97 }
98 
99 
102 {
103  return autoPtr<PackedBoolList>(new PackedBoolList(*this));
104 }
105 
106 
107 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
108 
110 {
111  PackedList<1>::transfer(static_cast<PackedList<1>&>(lst));
112 }
113 
114 
116 {
118 }
119 
120 
122 {
123  return xferMove(*this);
124 }
125 
126 
127 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
128 
129 inline void Foam::PackedBoolList::operator=(const bool val)
130 {
132 }
133 
134 
136 {
138 }
139 
140 
142 {
144 }
145 
146 
147 inline void Foam::PackedBoolList::operator=(const labelUList& indices)
148 {
149  clear();
150  set(indices);
151 }
152 
153 
155 {
156  clear();
157  set(indices);
158 }
159 
160 
163 {
164  PackedBoolList result(*this);
165  result.flip();
166 
167  return result;
168 }
169 
170 
171 inline Foam::PackedBoolList&
173 {
174  subset(lst);
175  return *this;
176 }
177 
178 
179 inline Foam::PackedBoolList&
181 {
182  subset(indices);
183  return *this;
184 }
185 
186 
187 inline Foam::PackedBoolList&
189 {
190  subset(indices);
191  return *this;
192 }
193 
194 
195 inline Foam::PackedBoolList&
197 {
198  set(lst);
199  return *this;
200 }
201 
202 
203 inline Foam::PackedBoolList&
205 {
206  set(indices);
207  return *this;
208 }
209 
210 
211 inline Foam::PackedBoolList&
213 {
214  set(indices);
215  return *this;
216 }
217 
218 
219 inline Foam::PackedBoolList&
221 {
222  return operator|=(lst);
223 }
224 
225 
226 inline Foam::PackedBoolList&
228 {
229  return operator|=(indices);
230 }
231 
232 
233 inline Foam::PackedBoolList&
235 {
236  return operator|=(indices);
237 }
238 
239 
240 inline Foam::PackedBoolList&
242 {
243  unset(lst);
244  return *this;
245 }
246 
247 
248 inline Foam::PackedBoolList&
250 {
251  unset(indices);
252  return *this;
253 }
254 
255 
256 inline Foam::PackedBoolList&
258 {
259  unset(indices);
260  return *this;
261 }
262 
263 
264 // ************************************************************************* //
PackedBoolList & operator &=(const PackedList< 1 > &)
And operator (lists may be dissimilar sizes)
void subset(const PackedList< 1 > &)
Subset with the specified list.
A simple container for copying or transferring objects of type <T>.
Definition: Xfer.H:85
void flip()
Invert the bits in the addressable region.
Definition: PackedList.C:104
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
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:117
Xfer< PackedBoolList > xfer()
Transfer contents to the Xfer container.
Xfer< T > xferMove(T &)
Construct by transferring the contents of the arg.
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:61
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:1066
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)