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