PackedBoolListI.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 | Copyright (C) 2011 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 Foam::PackedBoolList&
131 {
133  return *this;
134 }
135 
136 
137 inline Foam::PackedBoolList&
139 {
141  return *this;
142 }
143 
144 
145 inline Foam::PackedBoolList&
147 {
149  return *this;
150 }
151 
152 
153 inline Foam::PackedBoolList&
155 {
156  clear();
157  set(indices);
158 
159  return *this;
160 }
161 
162 
163 inline Foam::PackedBoolList&
165 {
166  clear();
167  set(indices);
168 
169  return *this;
170 }
171 
172 
175 {
176  PackedBoolList result(*this);
177  result.flip();
178 
179  return result;
180 }
181 
182 
183 inline Foam::PackedBoolList&
185 {
186  subset(lst);
187  return *this;
188 }
189 
190 
191 inline Foam::PackedBoolList&
193 {
194  subset(indices);
195  return *this;
196 }
197 
198 
199 inline Foam::PackedBoolList&
201 {
202  subset(indices);
203  return *this;
204 }
205 
206 
207 inline Foam::PackedBoolList&
209 {
210  set(lst);
211  return *this;
212 }
213 
214 
215 inline Foam::PackedBoolList&
217 {
218  set(indices);
219  return *this;
220 }
221 
222 
223 inline Foam::PackedBoolList&
225 {
226  set(indices);
227  return *this;
228 }
229 
230 
231 inline Foam::PackedBoolList&
233 {
234  return operator|=(lst);
235 }
236 
237 
238 inline Foam::PackedBoolList&
240 {
241  return operator|=(indices);
242 }
243 
244 
245 inline Foam::PackedBoolList&
247 {
248  return operator|=(indices);
249 }
250 
251 
252 inline Foam::PackedBoolList&
254 {
255  unset(lst);
256  return *this;
257 }
258 
259 
260 inline Foam::PackedBoolList&
262 {
263  unset(indices);
264  return *this;
265 }
266 
267 
268 inline Foam::PackedBoolList&
270 {
271  unset(indices);
272  return *this;
273 }
274 
275 
276 // ************************************************************************* //
Foam::PackedBoolList::clone
autoPtr< PackedBoolList > clone() const
Clone.
Definition: PackedBoolListI.H:101
Foam::PackedBoolList::xfer
Xfer< PackedBoolList > xfer()
Transfer contents to the Xfer container.
Definition: PackedBoolListI.H:121
Foam::PackedBoolList
A bit-packed bool list.
Definition: PackedBoolList.H:63
clear
UEqn clear()
Foam::PackedBoolList::set
void set(const PackedList< 1 > &)
Set specified bits.
Definition: PackedBoolList.C:169
Foam::PackedBoolList::PackedBoolList
PackedBoolList()
Construct null.
Definition: PackedBoolListI.H:28
Foam::PackedBoolList::operator=
PackedBoolList & operator=(const bool val)
Assignment of all entries to the given value.
Definition: PackedBoolListI.H:130
Foam::PackedBoolList::transfer
void transfer(PackedBoolList &)
Transfer the contents of the argument list into this list.
Definition: PackedBoolListI.H:109
Foam::PackedBoolList::operator&=
PackedBoolList & operator&=(const PackedList< 1 > &)
And operator (lists may be dissimilar sizes)
Definition: PackedBoolListI.H:184
Foam::Xfer
A simple container for copying or transferring objects of type <T>.
Definition: Xfer.H:85
Foam::label
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
Foam::PackedBoolList::operator|=
PackedBoolList & operator|=(const PackedList< 1 > &)
Or operator (lists may be dissimilar sizes)
Definition: PackedBoolListI.H:208
Foam::PackedList::flip
void flip()
Invert the bits in the addressable region.
Definition: PackedList.C:104
Foam::PackedBoolList::operator+=
PackedBoolList & operator+=(const PackedList< 1 > &)
Add entries to this list, synonymous with the or operator.
Definition: PackedBoolListI.H:232
Foam::subset
ListType subset(const UList< T > &select, const T &value, const ListType &)
Extract elements of List when select is a certain value.
Definition: ListOpsTemplates.C:290
Foam::autoPtr< Foam::PackedBoolList >
Foam::PackedBoolList::operator~
PackedBoolList operator~() const
Complement operator.
Definition: PackedBoolListI.H:174
Foam::xferMove
Xfer< T > xferMove(T &)
Construct by transferring the contents of the arg.
Foam::PackedList
A dynamically allocatable list of packed unsigned integers.
Definition: PackedList.H:117
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:60
Foam::UIndirectList
A List with indirect addressing.
Definition: fvMatrix.H:106
Foam::PackedBoolList::operator-=
PackedBoolList & operator-=(const PackedList< 1 > &)
Remove entries from this list - unset the specified bits.
Definition: PackedBoolListI.H:253
Foam::PackedList::transfer
void transfer(PackedList< nBits > &)
Transfer the contents of the argument list into this list.
Definition: PackedListI.H:947
Foam::PackedList::operator=
PackedList< nBits > & operator=(const unsigned int val)
Assignment of all entries to the given value. Takes linear time.
Definition: PackedListI.H:1070