33 #ifndef __H__UG__LIB_DISC__DOF_MANAGER__DOF_DISTRIBUTION__
34 #define __H__UG__LIB_DISC__DOF_MANAGER__DOF_DISTRIBUTION__
77 template <
typename TElem>
95 template <
typename TElem>
99 template <
typename TElem>
104 template <
typename TElem>
108 template <
typename TElem>
113 template <
typename TElem>
117 template <
typename TElem>
122 template <
typename TElem>
126 template <
typename TElem>
134 template <
typename TElem>
138 template <
typename TElem>
143 template <
typename TElem>
147 template <
typename TElem>
152 template <
typename TElem>
156 template <
typename TElem>
161 template <
typename TElem>
165 template <
typename TElem>
175 template <
typename TElem,
typename TBaseElem>
177 TElem* elem,
bool clearContainer =
true)
const{
185 template <
typename TBaseElem>
188 std::vector<TBaseElem*>& vAssElem,
190 bool clearContainer =
true
193 if (
dynamic_cast<Vertex*
>(elem))
194 collect_associated<Vertex, TBaseElem>(vAssElem,
dynamic_cast<Vertex*
>(elem), clearContainer);
195 else if (
dynamic_cast<Edge*
>(elem))
196 collect_associated<Edge, TBaseElem>(vAssElem,
dynamic_cast<Edge*
>(elem), clearContainer);
197 else if (
dynamic_cast<Face*
>(elem))
198 collect_associated<Face, TBaseElem>(vAssElem,
dynamic_cast<Face*
>(elem), clearContainer);
199 else if (
dynamic_cast<Volume*
>(elem))
200 collect_associated<Volume, TBaseElem>(vAssElem,
dynamic_cast<Volume*
>(elem), clearContainer);
202 UG_THROW(
"Element is neither Vertex nor Edge, Face or Volume. "
203 "Other elements not implemented.");
207 template <
class TGeomObj>
265 bool bHang =
false,
bool bClear =
true)
const;
267 bool bHang =
false,
bool bClear =
true)
const;
269 bool bHang =
false,
bool bClear =
true)
const;
271 bool bHang =
false,
bool bClear =
true)
const;
273 bool bHang =
false,
bool bClear =
true)
const;
291 bool bClear =
true)
const;
293 bool bClear =
true)
const;
295 bool bClear =
true)
const;
297 bool bClear =
true)
const;
299 bool bClear =
true)
const;
315 bool bClear =
true)
const;
317 bool bClear =
true)
const;
319 bool bClear =
true)
const;
321 bool bClear =
true)
const;
323 bool bClear =
true)
const;
327 bool bClear,
int fct)
const;
342 bool bClear =
true)
const;
344 bool bClear =
true)
const;
346 bool bClear =
true)
const;
348 bool bClear =
true)
const;
350 bool bClear =
true)
const;
354 template <
typename TBaseElem>
357 template<
typename TBaseElem>
359 std::vector<DoFIndex>& ind,
360 bool bHang =
false,
bool bClear =
true)
const;
362 template<
typename TBaseElem>
364 std::vector<DoFIndex>& ind,
365 bool bClear =
true)
const;
367 template<
typename TBaseElem>
369 bool bClear =
true)
const;
371 template<
typename TBaseElem>
373 bool bClear =
true)
const;
376 template <
typename TBaseElem>
378 const std::vector<TBaseElem*>& vElem)
const;
381 template<
typename TBaseElem>
387 template <
typename TConstraining,
typename TConstrained,
typename TBaseElem>
391 template <
typename TBaseElem,
typename TConstraining,
typename TConstrained,
typename TSubElem>
395 template <
typename TBaseElem,
typename TConstraining,
typename TConstrained,
typename TSubElem>
400 template <
typename TBaseElem,
typename TConstraining,
typename TConstrained>
404 template <
typename TBaseElem,
typename TConstraining,
typename TConstrained>
408 template<
typename TBaseElem,
typename TSubBaseElem>
414 template<
typename TBaseElem,
typename TSubBaseElem>
416 size_t fct, std::vector<DoFIndex>& ind,
420 template <
typename TConstraining,
typename TConstrained,
typename TBaseElem>
425 template <
typename TBaseElem,
typename TConstraining,
typename TConstrained,
typename TSubElem>
430 template <
typename TBaseElem,
typename TConstraining,
typename TConstrained,
typename TSubElem>
435 template <
typename TBaseElem>
437 std::vector<size_t>& ind)
const;
440 template<
typename TBaseElem>
442 std::vector<size_t>& ind)
const;
446 template <
typename TBaseObject>
454 template <
typename TElem>
457 template <
typename TElem>
490 void get_connections(std::vector<std::vector<size_t> >& vvConnection)
const;
500 template <
typename TBaseElem>
503 template <
typename TBaseElem>
507 template <
typename TBaseElem>
508 void get_connections(std::vector<std::vector<size_t> >& vvConnection)
const;
522 void copy_values(
const std::vector<std::pair<size_t, size_t> >& vIndexMap,
556 template <
typename TBaseElem>
564 template <
typename TBaseElem>
Definition: smart_pointer.h:296
Definition: dof_count.h:43
Definition: dof_distribution.h:51
void constrained_face_indices(TBaseElem *elem, LocalIndices &ind, const typename Grid::traits< TSubElem >::secure_container &vSubElem) const
Definition: dof_distribution.cpp:1063
std::vector< size_t > m_vNumIndexOnSubset
number of distributed indices on each subset
Definition: dof_distribution.h:486
size_t _algebra_indices(TBaseElem *elem, std::vector< size_t > &ind, bool bClear=true) const
Definition: dof_distribution.cpp:300
SmartPtr< AlgebraLayouts > m_spAlgebraLayouts
algebra layouts
Definition: dof_distribution.h:550
MultiGrid * m_pMG
Definition: dof_distribution.h:467
void constrained_vertex_indices(LocalIndices &ind, const typename Grid::traits< TBaseElem >::secure_container &vSubElem) const
extract dofs on constrained objects
Definition: dof_distribution.cpp:853
void _indices(TBaseElem *elem, LocalIndices &ind, bool bHang=false) const
Definition: dof_distribution.cpp:1118
size_t _inner_dof_indices(TBaseElem *elem, size_t fct, std::vector< DoFIndex > &ind, bool bClear=true) const
Definition: dof_distribution.cpp:410
void resize_values(size_t newSize)
changes values in managed functions, number of indices changed
Definition: dof_distribution.cpp:1326
traits< TElem >::iterator begin(SurfaceView::SurfaceConstants validStates)
Definition: dof_distribution.h:101
void constrained_edge_indices(TBaseElem *elem, LocalIndices &ind, const typename Grid::traits< TSubElem >::secure_container &vSubElem) const
Definition: dof_distribution.cpp:1008
traits< TElem >::iterator end(SurfaceView::SurfaceConstants validStates)
Definition: dof_distribution.h:110
traits< TElem >::const_iterator begin(int si, SurfaceView::SurfaceConstants validStates) const
Definition: dof_distribution.h:158
traits< TElem >::const_iterator begin(SurfaceView::SurfaceConstants validStates) const
Definition: dof_distribution.h:119
traits< TElem >::const_iterator end(SurfaceView::SurfaceConstants validStates) const
Definition: dof_distribution.h:128
traits< TElem >::const_iterator begin(int si) const
Definition: dof_distribution.h:153
void reinit()
initializes the indices
Definition: dof_distribution.cpp:1430
size_t dof_indices(GridObject *elem, size_t fct, std::vector< DoFIndex > &ind, bool bHang=false, bool bClear=true) const
extracts all multiindices for a function (sorted)
Definition: dof_distribution.cpp:1227
const GridLevel & grid_level() const
returns grid level
Definition: dof_distribution.h:74
void indices(GridObject *elem, LocalIndices &ind, bool bHang=false) const
extracts all indices of the element (sorted)
Definition: dof_distribution.cpp:1211
traits< TElem >::iterator begin(int si, SurfaceView::SurfaceConstants validStates)
Definition: dof_distribution.h:140
ConstSmartPtr< MultiGrid > multi_grid() const
Definition: dof_distribution.h:70
SmartPtr< MultiGrid > m_spMG
Multi Grid.
Definition: dof_distribution.h:466
void check_subsets()
checks that subset assignment is ok
Definition: dof_distribution.cpp:94
traits< TElem >::const_iterator end() const
Definition: dof_distribution.h:123
SmartPtr< AlgebraLayouts > layouts()
Definition: dof_distribution.h:545
size_t algebra_indices(GridObject *elem, std::vector< size_t > &ind, bool bClear=true) const
extracts all algebra indices of an element (not sorted)
Definition: dof_distribution.cpp:1260
void add_indices_from_layouts(IndexLayout &indexLayout, int keyType)
Definition: dof_distribution.cpp:1501
size_t _inner_algebra_indices(TBaseElem *elem, std::vector< size_t > &ind, bool bClear=true) const
Definition: dof_distribution.cpp:243
void sort_constrained_faces(std::vector< size_t > &sortedInd, TBaseElem *elem, TConstraining *constrainingObj, size_t objIndex) const
Definition: dof_distribution.cpp:957
traits< TElem >::iterator begin()
Definition: dof_distribution.h:96
void collect_associated(std::vector< TBaseElem * > &vAssElem, TElem *elem, bool clearContainer=true) const
returns the adjacent elements
Definition: dof_distribution.h:176
void copy_values(const std::vector< std::pair< size_t, size_t > > &vIndexMap, bool bDisjunct)
swaps values in managed functions, if indices swapped
Definition: dof_distribution.cpp:1318
traits< TElem >::const_iterator end(int si) const
Definition: dof_distribution.h:162
void unmanage_grid_function(IGridFunction &gridFct)
unregisters a grid function for adaptation management
Definition: dof_distribution.cpp:1304
size_t _dof_indices(TBaseElem *elem, size_t fct, std::vector< DoFIndex > &ind, bool bHang=false, bool bClear=true) const
Definition: dof_distribution.cpp:665
void get_connections(std::vector< std::vector< size_t > > &vvConnection) const
returns the connections
Definition: dof_distribution.cpp:1697
size_t m_numIndex
number of distributed indices on whole domain
Definition: dof_distribution.h:483
SurfaceView::SurfaceConstants defaultValidSurfState() const
returns the default valid surface state
Definition: dof_distribution.cpp:135
void reinit_layouts_and_communicator()
Definition: dof_distribution.cpp:1448
traits< TElem >::iterator end(int si)
Definition: dof_distribution.h:144
void constrained_face_dof_indices(TBaseElem *elem, size_t fct, std::vector< DoFIndex > &ind, const typename Grid::traits< TSubElem >::secure_container &vSubElem) const
multi indices on constrained faces
Definition: dof_distribution.cpp:590
size_t inner_algebra_indices_for_fct(GridObject *elem, std::vector< size_t > &ind, bool bClear, int fct) const
Definition: dof_distribution.cpp:256
size_t inner_algebra_indices(GridObject *elem, std::vector< size_t > &ind, bool bClear=true) const
extracts all algebra indices in the inner of the element (not sorted)
Definition: dof_distribution.cpp:1276
void indices_on_vertex(TBaseElem *elem, const ReferenceObjectID roid, LocalIndices &ind, const Grid::SecureVertexContainer &vElem) const
extracts the indices of the vertices
Definition: dof_distribution.cpp:729
void reinit_index_layout(IndexLayout &layout, int keyType)
Definition: dof_distribution.cpp:1483
size_t inner_dof_indices(GridObject *elem, size_t fct, std::vector< DoFIndex > &ind, bool bClear=true) const
extracts all multiindices of a function in the inner (sorted)
Definition: dof_distribution.cpp:1243
size_t num_indices() const
return the number of dofs distributed
Definition: dof_distribution.h:218
traits< TElem >::iterator begin(int si)
Definition: dof_distribution.h:135
DoFDistribution(SmartPtr< MultiGrid > spMG, SmartPtr< MGSubsetHandler > spMGSH, ConstSmartPtr< DoFDistributionInfo > spDDInfo, SmartPtr< SurfaceView > spSurfView, const GridLevel &level, bool bGrouped, SmartPtr< DoFIndexStorage > spDoFIndexStorage=SPNULL)
constructor
Definition: dof_distribution.cpp:60
void constrained_vertex_dof_indices(size_t fct, std::vector< DoFIndex > &ind, const typename Grid::traits< TBaseElem >::secure_container &vSubElem) const
multi indices on constrained vertices
Definition: dof_distribution.cpp:457
ConstSmartPtr< AlgebraLayouts > layouts() const
Definition: dof_distribution.h:544
bool m_bGrouped
grouping
Definition: dof_distribution.h:463
size_t & obj_index(TElem *obj)
Definition: dof_distribution.h:455
traits< TElem >::const_iterator begin() const
Definition: dof_distribution.h:114
size_t extract_inner_algebra_indices(TBaseElem *elem, std::vector< size_t > &ind) const
adds all algebra indices of an geom object to the LocalIndices
Definition: dof_distribution.cpp:190
void permute_indices(const std::vector< size_t > &vIndNew)
renames the indices
Definition: dof_distribution.cpp:1754
void manage_grid_function(IGridFunction &gridFct)
registers a grid function for adaptation management
Definition: dof_distribution.cpp:1293
void add(TBaseObject *obj, const ReferenceObjectID roid, const int si)
adds indices to a geometric object
Definition: dof_distribution.cpp:147
ConstSmartPtr< SurfaceView > surface_view() const
returns the surface view
Definition: dof_distribution.h:65
void collect_associated(std::vector< TBaseElem * > &vAssElem, GridObject *elem, bool clearContainer=true) const
Definition: dof_distribution.h:187
traits< TElem >::const_iterator end(int si, SurfaceView::SurfaceConstants validStates) const
Definition: dof_distribution.h:167
bool is_contained(TGeomObj *obj) const
returns if the grid object is part of the dof distribution
Definition: dof_distribution.h:208
bool grouped() const
returns if dofs are grouped
Definition: dof_distribution.h:215
traits< TElem >::iterator end()
Definition: dof_distribution.h:105
SmartPtr< SurfaceView > m_spSurfView
MultiGrid Subset Handler.
Definition: dof_distribution.h:473
void changable_indices(std::vector< size_t > &vIndex, const std::vector< TBaseElem * > &vElem) const
returns indices, that can be changed on the element
Definition: dof_distribution.cpp:1183
GridLevel m_gridLevel
Grid level.
Definition: dof_distribution.h:476
void sort_constrained_edges(std::vector< size_t > &sortedInd, TBaseElem *elem, TConstraining *constrainingObj, size_t objIndex) const
Definition: dof_distribution.cpp:906
const size_t & obj_index(TElem *obj) const
Definition: dof_distribution.h:458
SmartPtr< MGSubsetHandler > m_spMGSH
Subset Handler.
Definition: dof_distribution.h:470
DoFCount dof_count() const
Definition: dof_distribution.cpp:1609
void constrained_edge_dof_indices(TBaseElem *elem, size_t fct, std::vector< DoFIndex > &ind, const typename Grid::traits< TSubElem >::secure_container &vSubElem) const
multi indices on constrained edges
Definition: dof_distribution.cpp:515
SmartPtr< MultiGrid > multi_grid()
Definition: dof_distribution.h:69
~DoFDistribution()
destructor
Definition: dof_distribution.cpp:91
traits< TElem >::iterator end(int si, SurfaceView::SurfaceConstants validStates)
Definition: dof_distribution.h:149
void permute_values(const std::vector< size_t > &vIndNew)
permutes values in managed functions, if indices permuted
Definition: dof_distribution.cpp:1311
size_t num_indices(int si) const
return the number of dofs distributed on subset si
Definition: dof_distribution.h:221
std::vector< IGridFunction * > m_vpGridFunction
managed grid functions
Definition: dof_distribution.h:538
void sum_dof_count(DoFCount &cnt) const
Definition: dof_distribution.cpp:1571
SmartPtr< DoFIndexStorage > m_spDoFIndexStorage
DoF-Index Memory Storage.
Definition: dof_distribution.h:479
Definition: dof_distribution_info.h:152
Base-class for edges.
Definition: grid_base_objects.h:397
Faces are 2-dimensional objects.
Definition: grid_base_objects.h:510
Definition: grid_level.h:42
The base class for all geometric objects, such as vertices, edges, faces, volumes,...
Definition: grid_base_objects.h:157
Base class for all Grid Functions.
Definition: grid_function.h:56
Definition: local_algebra.h:50
Definition: multi_grid.h:72
Container which holds an array of pointers.
Definition: pointer_const_array.h:84
Const iterator to traverse the surface of a multi-grid hierarchy.
Definition: surface_view.h:237
Iterator to traverse the surface of a multi-grid hierarchy.
Definition: surface_view.h:178
SurfaceConstants
Definition: surface_view.h:72
Base-class for all vertex-types.
Definition: grid_base_objects.h:231
Volumes are 3-dimensional objects.
Definition: grid_base_objects.h:754
base_type::TBaseElem TBaseElem
const NullSmartPtr SPNULL
The equivalent to NULL for smart pointers.
Definition: smart_pointer.h:90
#define UG_THROW(msg)
Definition: error.h:57
ReferenceObjectID
these ids are used to identify the shape of a geometric object.
Definition: grid_base_objects.h:74
Definition: dof_distribution.h:87
domain_traits< dim >::grid_base_object grid_base_object
Definition: dof_distribution.h:88
SurfaceView::traits< grid_base_object >::iterator iterator
Definition: dof_distribution.h:89
SurfaceView::traits< grid_base_object >::const_iterator const_iterator
Definition: dof_distribution.h:90
Definition: dof_distribution.h:79
TElem grid_object
Definition: dof_distribution.h:80
SurfaceView::traits< TElem >::const_iterator const_iterator
Definition: dof_distribution.h:82
SurfaceView::traits< TElem >::iterator iterator
Definition: dof_distribution.h:81
Definition: domain_traits.h:53