ug4
grid_object_collection.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2009-2015: G-CSC, Goethe University Frankfurt
3  * Author: Sebastian Reiter
4  *
5  * This file is part of UG4.
6  *
7  * UG4 is free software: you can redistribute it and/or modify it under the
8  * terms of the GNU Lesser General Public License version 3 (as published by the
9  * Free Software Foundation) with the following additional attribution
10  * requirements (according to LGPL/GPL v3 §7):
11  *
12  * (1) The following notice must be displayed in the Appropriate Legal Notices
13  * of covered and combined works: "Based on UG4 (www.ug4.org/license)".
14  *
15  * (2) The following notice must be displayed at a prominent place in the
16  * terminal output of covered works: "Based on UG4 (www.ug4.org/license)".
17  *
18  * (3) The following bibliography is recommended for citation and must be
19  * preserved in all covered files:
20  * "Reiter, S., Vogel, A., Heppner, I., Rupp, M., and Wittum, G. A massively
21  * parallel geometric multigrid solver on hierarchically distributed grids.
22  * Computing and visualization in science 16, 4 (2013), 151-164"
23  * "Vogel, A., Reiter, S., Rupp, M., Nägel, A., and Wittum, G. UG4 -- a novel
24  * flexible software system for simulating pde based models on high performance
25  * computers. Computing and visualization in science 16, 4 (2013), 165-179"
26  *
27  * This program is distributed in the hope that it will be useful,
28  * but WITHOUT ANY WARRANTY; without even the implied warranty of
29  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30  * GNU Lesser General Public License for more details.
31  */
32 
33 #ifndef __H__LIB_GRID__GEOMETRIC_OBJECT_COLLECTION__
34 #define __H__LIB_GRID__GEOMETRIC_OBJECT_COLLECTION__
35 
36 #include <list>
37 #include "grid_base_objects.h"
39 #include "element_storage.h"
41 
42 namespace ug
43 {
44 
47 
49 // GridObjectCollection
51 
96 {
97  public:
99  template <class TElem>
100  struct traits{
103  };
104 
106 
108  GridObjectCollection(size_t levelEstimate = 1);
109 
115 
116  // copy constructor.
118 
119  GridObjectCollection& operator =(const GridObjectCollection& mgoc);
120 
122  void add_level(ElementStorage<Vertex>::SectionContainer* vrtCon,
126 
128  inline size_t num_levels() const {return m_levels.size();}
129 
130  // Iterators
131  // begin
134  template <class TGeomObj>
135  inline
137  begin(size_t level = 0);
138 
139  // end
142  template <class TGeomObj>
143  inline
145  end(size_t level = 0);
146 
147  inline VertexIterator vertices_begin(size_t level = 0) {return begin<Vertex>(level);}
148  inline VertexIterator vertices_end(size_t level = 0) {return end<Vertex>(level);}
149  inline EdgeIterator edges_begin(size_t level = 0) {return begin<Edge>(level);}
150  inline EdgeIterator edges_end(size_t level = 0) {return end<Edge>(level);}
151  inline FaceIterator faces_begin(size_t level = 0) {return begin<Face>(level);}
152  inline FaceIterator faces_end(size_t level = 0) {return end<Face>(level);}
153  inline VolumeIterator volumes_begin(size_t level = 0) {return begin<Volume>(level);}
154  inline VolumeIterator volumes_end(size_t level = 0) {return end<Volume>(level);}
155 
156  // const iterators
157  // begin
158  template <class TGeomObj>
159  inline
161  begin(size_t level = 0) const;
162 
163  // end
164  template <class TGeomObj>
165  inline
167  end(size_t level = 0) const;
168 
169  inline ConstVertexIterator vertices_begin(size_t level = 0) const {return begin<Vertex>(level);}
170  inline ConstVertexIterator vertices_end(size_t level = 0) const {return end<Vertex>(level);}
171  inline ConstEdgeIterator edges_begin(size_t level = 0) const {return begin<Edge>(level);}
172  inline ConstEdgeIterator edges_end(size_t level = 0) const {return end<Edge>(level);}
173  inline ConstFaceIterator faces_begin(size_t level = 0) const {return begin<Face>(level);}
174  inline ConstFaceIterator faces_end(size_t level = 0) const {return end<Face>(level);}
175  inline ConstVolumeIterator volumes_begin(size_t level = 0) const {return begin<Volume>(level);}
176  inline ConstVolumeIterator volumes_end(size_t level = 0) const {return end<Volume>(level);}
177 
178  // element numbers
179  template <class TGeomObj>
180  size_t num() const;
181 
182  inline size_t num_vertices() const {return num<Vertex>();}
183  inline size_t num_edges() const {return num<Edge>();}
184  inline size_t num_faces() const {return num<Face>();}
185  inline size_t num_volumes() const {return num<Volume>();}
186 
187  template <class TGeomObj>
188  inline
189  size_t num(size_t level) const;
190 
191  inline size_t num_vertices(size_t level) const {return num<Vertex>(level);}
192  inline size_t num_edges(size_t level) const {return num<Edge>(level);}
193  inline size_t num_faces(size_t level) const {return num<Face>(level);}
194  inline size_t num_volumes(size_t level) const {return num<Volume>(level);}
195 
196  protected:
197  void assign(const GridObjectCollection& goc);
198 
199  template <class TGeomObj> inline
201  SectionContainer* get_container(size_t level) const;
202 
203  template <class TGeomObj> inline
205  SectionContainer* get_container(size_t level);
206 
207  protected:
214 
219  };
220 
221  typedef std::vector<ContainerCollection> ContainerVec;
222  //typedef std::vector<GridObjectCollection> GOCVec;
223 
224  protected:
226 };
227 
229 }// end of namespace
230 
232 // include implementation
234 
235 #endif
This struct is used to hold GridObjects and their attachment pipes.
Definition: element_storage.h:44
a helper class that holds a collection of possibly unconnected geometric-objects.
Definition: grid_object_collection.h:96
size_t num_vertices() const
Definition: grid_object_collection.h:182
size_t num_edges(size_t level) const
Definition: grid_object_collection.h:192
ConstVolumeIterator volumes_end(size_t level=0) const
Definition: grid_object_collection.h:176
size_t num_volumes() const
Definition: grid_object_collection.h:185
size_t num_volumes(size_t level) const
Definition: grid_object_collection.h:194
size_t num_edges() const
Definition: grid_object_collection.h:183
ConstFaceIterator faces_begin(size_t level=0) const
Definition: grid_object_collection.h:173
EdgeIterator edges_begin(size_t level=0)
Definition: grid_object_collection.h:149
ConstEdgeIterator edges_begin(size_t level=0) const
Definition: grid_object_collection.h:171
FaceIterator faces_end(size_t level=0)
Definition: grid_object_collection.h:152
size_t num_levels() const
returns the number of levels
Definition: grid_object_collection.h:128
VertexIterator vertices_end(size_t level=0)
Definition: grid_object_collection.h:148
ConstVertexIterator vertices_end(size_t level=0) const
Definition: grid_object_collection.h:170
FaceIterator faces_begin(size_t level=0)
Definition: grid_object_collection.h:151
EdgeIterator edges_end(size_t level=0)
Definition: grid_object_collection.h:150
ContainerVec m_levels
Definition: grid_object_collection.h:225
size_t num_faces(size_t level) const
Definition: grid_object_collection.h:193
VertexIterator vertices_begin(size_t level=0)
Definition: grid_object_collection.h:147
size_t num_faces() const
Definition: grid_object_collection.h:184
VolumeIterator volumes_begin(size_t level=0)
Definition: grid_object_collection.h:153
ConstVolumeIterator volumes_begin(size_t level=0) const
Definition: grid_object_collection.h:175
ConstVertexIterator vertices_begin(size_t level=0) const
Definition: grid_object_collection.h:169
size_t num_vertices(size_t level) const
Definition: grid_object_collection.h:191
ConstFaceIterator faces_end(size_t level=0) const
Definition: grid_object_collection.h:174
std::vector< ContainerCollection > ContainerVec
Definition: grid_object_collection.h:221
ConstEdgeIterator edges_end(size_t level=0) const
Definition: grid_object_collection.h:172
VolumeIterator volumes_end(size_t level=0)
Definition: grid_object_collection.h:154
Definition: grid_base_object_traits.h:68
#define UG_API
Definition: ug_config.h:65
the ug namespace
ElementStorage< Vertex >::SectionContainer::iterator VertexIterator
This Iterator will be used as base-class for iterators of specialized geometric objects.
Definition: grid_base_object_traits.h:73
ElementStorage< Face >::SectionContainer::iterator FaceIterator
Definition: grid_base_object_traits.h:79
ElementStorage< Face >::SectionContainer::const_iterator ConstFaceIterator
Definition: grid_base_object_traits.h:80
ElementStorage< Edge >::SectionContainer::iterator EdgeIterator
Definition: grid_base_object_traits.h:76
ElementStorage< Edge >::SectionContainer::const_iterator ConstEdgeIterator
Definition: grid_base_object_traits.h:77
ElementStorage< Volume >::SectionContainer::const_iterator ConstVolumeIterator
Definition: grid_base_object_traits.h:83
ElementStorage< Volume >::SectionContainer::iterator VolumeIterator
Definition: grid_base_object_traits.h:82
ElementStorage< Vertex >::SectionContainer::const_iterator ConstVertexIterator
Definition: grid_base_object_traits.h:74
Definition: grid_object_collection.h:208
ElementStorage< Volume >::SectionContainer * volContainer
Definition: grid_object_collection.h:218
ElementStorage< Vertex >::SectionContainer * vrtContainer
Definition: grid_object_collection.h:215
ContainerCollection()
Definition: grid_object_collection.h:209
ElementStorage< Edge >::SectionContainer * edgeContainer
Definition: grid_object_collection.h:216
ElementStorage< Face >::SectionContainer * faceContainer
Definition: grid_object_collection.h:217
The traits class holds some important types for each element-type.
Definition: grid_object_collection.h:100
geometry_traits< TElem >::const_iterator const_iterator
Definition: grid_object_collection.h:102
geometry_traits< TElem >::iterator iterator
Definition: grid_object_collection.h:101