Newer
Older
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018 OpenCFD Ltd.
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::topoBitSet
Description
Base for a special purpose topoSet using labels stored as a bitSet.
SourceFiles
topoBitSet.C
\*---------------------------------------------------------------------------*/
#ifndef topoBitSet_H
#define topoBitSet_H
#include "topoSet.H"
#include "bitSet.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class topoBitSet Declaration
\*---------------------------------------------------------------------------*/
class topoBitSet
:
public topoSet
{
protected:
bitSet selected_;
// Protected Member Functions
//- Update map from map.
// Used to update cell/face labels after morphing
virtual void updateLabels(const labelUList& map);
//- Check limits on addressable range.
virtual void check(const label maxSize);
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
//- Construct with empty selection
topoBitSet(const polyMesh& mesh, const word& setName);
//- Construct with size elements
topoBitSet
(
const polyMesh& mesh,
const word& setName,
const label size,
const bool val
);
//- Copy construct with bitset values, size elements
topoBitSet
(
const polyMesh& mesh,
const word& setName,
const label size,
const bitSet& bits
);
//- Move construct with bitset values, size elements
topoBitSet
(
const polyMesh& mesh,
const word& setName,
const label size,
bitSet&& bits
);
public:
//- Destructor
virtual ~topoBitSet() = default;
// Member Functions
//- Return the bitSet
const bitSet& addressing() const
{
return selected_;
}
//- Access the bitSet
bitSet& addressing()
{
return selected_;
}
//- Set values to false, leaving the size untouched
void reset()
{
selected_.reset();
}
//- Has the given index?
virtual bool found(const label id) const;
//- Set an index
virtual bool set(const label id);
//- Unset an index
virtual bool unset(const label id);
//- Set multiple indices
virtual void set(const labelUList& labels);
//- Unset multiple indices
virtual void unset(const labelUList& labels);
//- Invert contents.
// Insert all members [0,maxLen) which were not in set.
virtual void invert(const label maxLen);
//- Subset contents. Only elements present in both sets remain.
virtual void subset(const topoSet& set);
//- Add elements present in set.
virtual void addSet(const topoSet& set);
//- Subtract elements present in set.
virtual void subtractSet(const topoSet& set);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //