meshSubset.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | cfMesh: A library for mesh generation
4  \\ / O peration |
5  \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6  \\/ M anipulation | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
8 License
9  This file is part of cfMesh.
10 
11  cfMesh is free software; you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by the
13  Free Software Foundation; either version 3 of the License, or (at your
14  option) any later version.
15 
16  cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  meshSubset
26 
27 Description
28  A class containing labels of elements
29 
30 SourceFiles
31  meshSubsetI.H
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef meshSubset_H
36 #define meshSubset_H
37 
38 #include "label.H"
39 #include "HashSet.H"
40 #include "VRWGraph.H"
41 
42 #include <set>
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 class Ostream;
50 class VRWGraph;
51 
52 /*---------------------------------------------------------------------------*\
53  class meshSubset Declaration
54 \*---------------------------------------------------------------------------*/
55 
56 class meshSubset
57 {
58  // Private data
59  //- name of the given subset
60  word name_;
61 
62  //- type of subset
63  label type_;
64 
65  //- labels of elements
66  //HashSet<label> data_;
67  std::set<label> data_;
68 
69 public:
70 
71  // Enumerators
72 
73  enum subsetType_
74  {
75  UNKNOWN = 0,
80  };
81 
82  // Constructors
83  //- Null constructor
84  inline meshSubset();
85 
86  //- Construct from name. Creates an empty subset
87  inline meshSubset(const word& name, const subsetType_&);
88 
89  //- Construct from name and element labels
90  template<class ListType>
91  inline meshSubset
92  (
93  const word& name,
94  const subsetType_&,
95  const ListType& elements
96  );
97 
98  //- Copy construct
99  inline meshSubset(const meshSubset&);
100 
101  //- Construct from Istream
102  inline meshSubset(Istream&);
103 
104  // Destructor
105  ~meshSubset();
106 
107 
108  // Member Functions
109 
110  // Access
111 
112  //- Return name
113  inline const word& name() const;
114 
115  //- Type of subset
116  inline label type() const;
117 
118  //- elements contained in the subset
119  template<class ListType>
120  inline void containedElements(ListType&) const;
121 
122  // Edit
123 
124  //- add element label to subset
125  inline void addElement(const label);
126 
127  //- remove element from subset
128  inline void removeElement(const label);
129 
130  //- update subset after mesh modification
131  //- the list contains new labels of mesh elements
132  //- removed elements have a negative label
133  template<class ListType>
134  inline void updateSubset(const ListType&);
135 
136  //- update subset after modification
137  //- this modifier is used in case when elements are decomposed
138  inline void updateSubset(const VRWGraph&);
139 
140  // Searches
141  //- find if the element exists in the subset
142  inline bool contains(const label) const;
143 
144  // operators
145 
146  inline void operator=(const meshSubset&);
147  inline bool operator==(const meshSubset&) const;
148  inline bool operator!=(const meshSubset&) const;
149 
150  // IOstream operators
151 
152  friend inline Ostream& operator<<(Ostream&, const meshSubset&);
153  friend inline Istream& operator>>(Istream&, meshSubset&);
154 };
155 
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 
158 } // End namespace Foam
159 
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 
162 #include "meshSubsetI.H"
163 
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 
166 #endif
167 
168 // ************************************************************************* //
Foam::meshSubset::operator!=
bool operator!=(const meshSubset &) const
Definition: meshSubsetI.H:183
Foam::meshSubset::subsetType_
subsetType_
Definition: meshSubset.H:72
Foam::meshSubset::data_
std::set< label > data_
labels of elements
Definition: meshSubset.H:66
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::meshSubset::FEATUREEDGESUBSET
@ FEATUREEDGESUBSET
Definition: meshSubset.H:78
Foam::meshSubset::operator>>
friend Istream & operator>>(Istream &, meshSubset &)
Definition: meshSubsetI.H:206
VRWGraph.H
Foam::meshSubset::name_
word name_
name of the given subset
Definition: meshSubset.H:59
Foam::meshSubset::name
const word & name() const
Return name.
Definition: meshSubsetI.H:96
Foam::meshSubset::updateSubset
void updateSubset(const ListType &)
Definition: meshSubsetI.H:127
Foam::meshSubset::FACESUBSET
@ FACESUBSET
Definition: meshSubset.H:76
Foam::meshSubset::CELLSUBSET
@ CELLSUBSET
Definition: meshSubset.H:75
Foam::meshSubset::contains
bool contains(const label) const
find if the element exists in the subset
Definition: meshSubsetI.H:155
Foam::meshSubset::~meshSubset
~meshSubset()
Definition: meshSubsetI.H:91
Foam::meshSubset
Definition: meshSubset.H:55
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::meshSubset::addElement
void addElement(const label)
add element label to subset
Definition: meshSubsetI.H:116
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:57
Foam::meshSubset::removeElement
void removeElement(const label)
remove element from subset
Definition: meshSubsetI.H:121
Foam::meshSubset::type_
label type_
type of subset
Definition: meshSubset.H:62
HashSet.H
Foam::meshSubset::containedElements
void containedElements(ListType &) const
elements contained in the subset
Definition: meshSubsetI.H:107
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::meshSubset::POINTSUBSET
@ POINTSUBSET
Definition: meshSubset.H:77
Foam::meshSubset::UNKNOWN
@ UNKNOWN
Definition: meshSubset.H:74
Foam::meshSubset::operator==
bool operator==(const meshSubset &) const
Definition: meshSubsetI.H:169
meshSubsetI.H
Foam::meshSubset::meshSubset
meshSubset()
Null constructor.
Definition: meshSubsetI.H:39
Foam::meshSubset::operator<<
friend Ostream & operator<<(Ostream &, const meshSubset &)
Definition: meshSubsetI.H:190
label.H
VRWGraph
This class is an implementation of a graph with variable column width. The imoplementation is memory ...
Foam::meshSubset::type
label type() const
Type of subset.
Definition: meshSubsetI.H:101
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::meshSubset::operator=
void operator=(const meshSubset &)
Definition: meshSubsetI.H:160
Foam::VRWGraph
Definition: VRWGraph.H:101