33 #ifndef __H__LIBGRID__SUBSET_HANDLER_MULTI_GRID_IMPL__
34 #define __H__LIBGRID__SUBSET_HANDLER_MULTI_GRID_IMPL__
41 template <
class TElem>
42 typename geometry_traits<TElem>::iterator
44 begin(
int subsetIndex,
int level)
49 "ERROR in SubsetHandler::begin(): bad subset index.");
54 return iterator_cast<typename geometry_traits<TElem>::iterator>(
55 section_container<TElem>(subsetIndex, level).begin());
57 return iterator_cast<typename geometry_traits<TElem>::iterator>(
58 section_container<TElem>(subsetIndex, level).section_begin(sectionInd));
61 template <
class TElem>
64 end(
int subsetIndex,
int level)
69 "ERROR in SubsetHandler::end(): bad subset index.");
74 return iterator_cast<typename geometry_traits<TElem>::iterator>(
75 section_container<TElem>(subsetIndex, level).end());
77 return iterator_cast<typename geometry_traits<TElem>::iterator>(
78 section_container<TElem>(subsetIndex, level).section_end(sectionInd));
81 template <
class TElem>
84 begin(
int subsetIndex,
int level)
const
86 UG_ASSERT(subsetIndex >= 0,
"-1 is not a valid subset index when accessing iterators!");
88 return end<TElem>(subsetIndex, level);
93 return iterator_cast<typename geometry_traits<TElem>::const_iterator>(
94 section_container<TElem>(subsetIndex, level).begin());
96 return iterator_cast<typename geometry_traits<TElem>::const_iterator>(
97 section_container<TElem>(subsetIndex, level).section_begin(sectionInd));
100 template <
class TElem>
103 end(
int subsetIndex,
int level)
const
105 UG_ASSERT(subsetIndex >= 0,
"-1 is not a valid subset index when accessing iterators!");
114 return iterator_cast<typename geometry_traits<TElem>::const_iterator>(
115 section_container<TElem>(subsetIndex, level).end());
117 return iterator_cast<typename geometry_traits<TElem>::const_iterator>(
118 section_container<TElem>(subsetIndex, level).section_end(sectionInd));
120 template <
class TElem>
126 clear_subset_elements<TElem>(subsetIndex, i);
129 template <
class TElem>
136 "ERROR in SubsetHandler::clear_subsets_elements(): bad subset index.");
142 section_container<TElem>(subsetIndex, level);
145 while(iter != end<TElem>(subsetIndex, level))
149 secCon.
erase(iterErase, sectionInd);
154 template <
class TElem>
157 num(
int subsetIndex,
int level)
const
162 "ERROR in SubsetHandler::num_elements(): bad subset index.");
169 return section_container<TElem>(subsetIndex, level).num_elements();
171 return section_container<TElem>(subsetIndex, level).num_elements(sectionInd);
174 template <
class TElem>
177 num(
int subsetIndex)
const
182 "ERROR in SubsetHandler::num_elements(): bad subset index.");
187 for(
size_t i = 0; i <
m_levels.size(); ++i)
188 numElems += section_container<TElem>(subsetIndex, (
int)i).num_elements();
192 for(
size_t i = 0; i <
m_levels.size(); ++i)
193 numElems += section_container<TElem>(subsetIndex, (
int)i).num_elements(sectionInd);
199 template <
class TElem>
211 template<
class TElem>
217 for(
size_t i = 0; i <
m_levels.size(); ++i)
219 for(iterator iter = begin<TElem>(indOld, i);
220 iter != end<TElem>(indOld, i); iter++)
235 UG_THROW(
"Can't create additional levels in const MGSubsetHandler. "
237 <<
" required level: " << level);
241 template <
class TElem>
252 template <
class TElem>
Grid * m_pGrid
Definition: subset_handler_interface.h:736
void alter_subset_index(Vertex *v, int subsetIndex)
Definition: subset_handler_interface.h:599
uint num_subsets_in_list() const
returns the number of subsets in the local list
Definition: subset_handler_multi_grid.h:221
void level_required(int level)
creates the required levels, if they do not yet exist
Definition: subset_handler_multi_grid_impl.hpp:226
void add_level()
Definition: subset_handler_multi_grid.cpp:448
Grid::traits< TElem >::SectionContainer & section_container(int si, int lvl)
returns the section container for the given type, subset and level
Definition: subset_handler_multi_grid_impl.hpp:244
uint num() const
returns the total number of elements
Definition: subset_handler_multi_grid_impl.hpp:202
geometry_traits< TElem >::iterator end(int subsetIndex, int level)
returns the end-iterator for the elements of type TElem in the given subset.
Definition: subset_handler_multi_grid_impl.hpp:64
void change_elem_subset_indices(int indOld, int indNew)
helper for change_subset_indices
Definition: subset_handler_multi_grid_impl.hpp:213
LevelVec m_levels
Definition: subset_handler_multi_grid.h:365
Subset * subset(int si, int level)
returns the subset with index si on the given level
Definition: subset_handler_multi_grid.h:305
uint num_levels() const
returns the number of levels
Definition: subset_handler_multi_grid.h:80
void clear_subset_elements(int subsetIndex)
removes all elements of type TElem from the specified subset.
Definition: subset_handler_multi_grid_impl.hpp:123
geometry_traits< TElem >::iterator begin(int subsetIndex, int level)
returns the begin-iterator for the elements of type TElem in the given subset.
Definition: subset_handler_multi_grid_impl.hpp:44
void erase(const iterator &iter, int sectionIndex)
Definition: section_container.hpp:296
Definition: grid_base_object_traits.h:68
#define UG_ASSERT(expr, msg)
Definition: assert.h:70
#define UG_THROW(msg)
Definition: error.h:57
unsigned int uint
Definition: types.h:114
Definition: subset_handler_multi_grid.h:294
VolumeSectionContainer m_volumes
Definition: subset_handler_multi_grid.h:298
FaceSectionContainer m_faces
Definition: subset_handler_multi_grid.h:297
EdgeSectionContainer m_edges
Definition: subset_handler_multi_grid.h:296
VertexSectionContainer m_vertices
Definition: subset_handler_multi_grid.h:295
Helper class to access the correct element storage from its element type.
Definition: element_storage.h:210