LCOV - code coverage report
Current view: top level - ugbase/lib_disc/dof_manager - dof_distribution.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 33 0
Test Date: 2025-09-21 23:31:46 Functions: 0.0 % 91 0

            Line data    Source code
       1              : /*
       2              :  * Copyright (c) 2010-2015:  G-CSC, Goethe University Frankfurt
       3              :  * Author: Andreas Vogel
       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__UG__LIB_DISC__DOF_MANAGER__DOF_DISTRIBUTION__
      34              : #define __H__UG__LIB_DISC__DOF_MANAGER__DOF_DISTRIBUTION__
      35              : 
      36              : #include "lib_grid/tools/surface_view.h"
      37              : #include "lib_disc/domain_traits.h"
      38              : #include "lib_disc/common/local_algebra.h"
      39              : #include "dof_index_storage.h"
      40              : #include "dof_count.h"
      41              : 
      42              : #ifdef UG_PARALLEL
      43              : #include "lib_algebra/parallelization/algebra_layouts.h"
      44              : #endif
      45              : 
      46              : namespace ug{
      47              : 
      48              : class IGridFunction;
      49              : 
      50              : class DoFDistribution : public DoFDistributionInfoProvider
      51              : {
      52              :         public:
      53              :                 ///     constructor
      54              :                 DoFDistribution(SmartPtr<MultiGrid> spMG,
      55              :                                 SmartPtr<MGSubsetHandler> spMGSH,
      56              :                                 ConstSmartPtr<DoFDistributionInfo> spDDInfo,
      57              :                                 SmartPtr<SurfaceView> spSurfView,
      58              :                                 const GridLevel& level, bool bGrouped,
      59              :                                 SmartPtr<DoFIndexStorage> spDoFIndexStorage = SPNULL);
      60              : 
      61              :                 /// destructor
      62              :                 ~DoFDistribution();
      63              : 
      64              :                 ///     returns the surface view
      65              :                 ConstSmartPtr<SurfaceView> surface_view() const {return m_spSurfView;}
      66              : 
      67              :                 ///     returns the multigrid
      68              :                 /// \{
      69              :                 SmartPtr<MultiGrid> multi_grid() {return m_spMG;}
      70              :                 ConstSmartPtr<MultiGrid> multi_grid() const {return m_spMG;}
      71              :                 /// \}
      72              : 
      73              :                 ///     returns grid level
      74            0 :                 const GridLevel& grid_level() const {return m_gridLevel;}
      75              : 
      76              :         public:
      77              :                 template <typename TElem>
      78              :                 struct traits
      79              :                 {
      80              :                         typedef TElem grid_object;
      81              :                         typedef typename SurfaceView::traits<TElem>::iterator iterator;
      82              :                         typedef typename SurfaceView::traits<TElem>::const_iterator const_iterator;
      83              :                 };
      84              : 
      85              :                 template <int dim>
      86              :                 struct dim_traits
      87              :                 {
      88              :                         typedef typename domain_traits<dim>::grid_base_object grid_base_object;
      89              :                         typedef typename SurfaceView::traits<grid_base_object>::iterator iterator;
      90              :                         typedef typename SurfaceView::traits<grid_base_object>::const_iterator const_iterator;
      91              :                 };
      92              : 
      93              :                 /// iterator for elements where dofs are defined
      94              :                 /// \{
      95              :                 template <typename TElem>
      96              :                 typename traits<TElem>::iterator begin()
      97              :                 {return m_spSurfView->begin<TElem>(m_gridLevel, defaultValidSurfState());}
      98              : 
      99              :                 template <typename TElem>
     100              :                 typename traits<TElem>::iterator
     101              :                 begin(SurfaceView::SurfaceConstants validStates)
     102              :                 {return m_spSurfView->begin<TElem>(m_gridLevel, validStates);}
     103              : 
     104              :                 template <typename TElem>
     105              :                 typename traits<TElem>::iterator end()
     106              :                 {return m_spSurfView->end<TElem>(m_gridLevel, defaultValidSurfState());}
     107              : 
     108              :                 template <typename TElem>
     109              :                 typename traits<TElem>::iterator
     110              :                 end(SurfaceView::SurfaceConstants validStates)
     111            0 :                 {return m_spSurfView->end<TElem>(m_gridLevel, validStates);}
     112              : 
     113              :                 template <typename TElem>
     114            0 :                 typename traits<TElem>::const_iterator begin() const
     115            0 :                 {return m_spSurfView->begin<TElem>(m_gridLevel, defaultValidSurfState());}
     116              : 
     117              :                 template <typename TElem>
     118              :                 typename traits<TElem>::const_iterator
     119              :                 begin(SurfaceView::SurfaceConstants validStates) const
     120            0 :                 {return m_spSurfView->begin<TElem>(m_gridLevel, validStates);}
     121              : 
     122              :                 template <typename TElem>
     123            0 :                 typename traits<TElem>::const_iterator end() const
     124            0 :                 {return m_spSurfView->end<TElem>(m_gridLevel, defaultValidSurfState());}
     125              : 
     126              :                 template <typename TElem>
     127              :                 typename traits<TElem>::const_iterator
     128              :                 end(SurfaceView::SurfaceConstants validStates) const
     129            0 :                 {return m_spSurfView->end<TElem>(m_gridLevel, validStates);}
     130              :                 ///     \}
     131              : 
     132              :                 /// iterator for elements where dofs are defined
     133              :                 /// \{
     134              :                 template <typename TElem>
     135            0 :                 typename traits<TElem>::iterator begin(int si)
     136            0 :                 {return m_spSurfView->begin<TElem>(si, m_gridLevel, defaultValidSurfState());}
     137              : 
     138              :                 template <typename TElem>
     139              :                 typename traits<TElem>::iterator
     140              :                 begin(int si, SurfaceView::SurfaceConstants validStates)
     141            0 :                 {return m_spSurfView->begin<TElem>(si, m_gridLevel, validStates);}
     142              : 
     143              :                 template <typename TElem>
     144            0 :                 typename traits<TElem>::iterator end(int si)
     145            0 :                 {return m_spSurfView->end<TElem>(si, m_gridLevel, defaultValidSurfState());}
     146              : 
     147              :                 template <typename TElem>
     148              :                 typename traits<TElem>::iterator
     149              :                 end(int si, SurfaceView::SurfaceConstants validStates)
     150            0 :                 {return m_spSurfView->end<TElem>(si, m_gridLevel, validStates);}
     151              : 
     152              :                 template <typename TElem>
     153            0 :                 typename traits<TElem>::const_iterator begin(int si) const
     154            0 :                 {return m_spSurfView->begin<TElem>(si, m_gridLevel, defaultValidSurfState());}
     155              : 
     156              :                 template <typename TElem>
     157              :                 typename traits<TElem>::const_iterator
     158              :                 begin(int si, SurfaceView::SurfaceConstants validStates) const
     159            0 :                 {return m_spSurfView->begin<TElem>(si, m_gridLevel, validStates);}
     160              : 
     161              :                 template <typename TElem>
     162            0 :                 typename traits<TElem>::const_iterator end(int si) const
     163            0 :                 {return m_spSurfView->end<TElem>(si, m_gridLevel, defaultValidSurfState());}
     164              : 
     165              :                 template <typename TElem>
     166              :                 typename traits<TElem>::const_iterator
     167              :                 end(int si, SurfaceView::SurfaceConstants validStates) const
     168            0 :                 {return m_spSurfView->end<TElem>(si, m_gridLevel, validStates);}
     169              :                 ///     \}
     170              : 
     171              :                 /// returns the default valid surface state
     172              :                 SurfaceView::SurfaceConstants defaultValidSurfState() const;
     173              : 
     174              :                 ///     returns the adjacent elements
     175              :                 template <typename TElem, typename TBaseElem>
     176              :                 void collect_associated(std::vector<TBaseElem*>& vAssElem,
     177              :                                                                 TElem* elem, bool clearContainer = true) const{
     178              : //                      if(grid_level().is_level())
     179              : //                              CollectAssociated(vAssElem, *m_pMG, elem, clearContainer);
     180              : //                      else{
     181            0 :                                 m_spSurfView->collect_associated(vAssElem, elem, grid_level(), clearContainer);
     182              : //                      }
     183            0 :                 }
     184              : 
     185              :                 template <typename TBaseElem>
     186            0 :                 void collect_associated
     187              :                 (
     188              :                         std::vector<TBaseElem*>& vAssElem,
     189              :                         GridObject* elem,
     190              :                         bool clearContainer = true
     191              :                 ) const
     192              :                 {
     193            0 :                         if (dynamic_cast<Vertex*>(elem))
     194              :                                 collect_associated<Vertex, TBaseElem>(vAssElem, dynamic_cast<Vertex*>(elem), clearContainer);
     195            0 :                         else if (dynamic_cast<Edge*>(elem))
     196              :                                 collect_associated<Edge, TBaseElem>(vAssElem, dynamic_cast<Edge*>(elem), clearContainer);
     197            0 :                         else if (dynamic_cast<Face*>(elem))
     198              :                                 collect_associated<Face, TBaseElem>(vAssElem, dynamic_cast<Face*>(elem), clearContainer);
     199            0 :                         else if (dynamic_cast<Volume*>(elem))
     200              :                                 collect_associated<Volume, TBaseElem>(vAssElem, dynamic_cast<Volume*>(elem), clearContainer);
     201              :                         else
     202            0 :                                 UG_THROW("Element is neither Vertex nor Edge, Face or Volume. "
     203              :                                         "Other elements not implemented.");
     204            0 :                 }
     205              : 
     206              :                 /// returns if the grid object is part of the dof distribution
     207              :                 template <class TGeomObj>
     208              :                 bool is_contained(TGeomObj* obj) const{
     209            0 :                         return m_spSurfView->is_contained(obj, grid_level());
     210              :                 }
     211              : 
     212              : 
     213              :         public:
     214              :                 ///     returns if dofs are grouped
     215            0 :                 bool grouped() const {return m_bGrouped;}
     216              : 
     217              :                 /// return the number of dofs distributed
     218            0 :                 size_t num_indices() const {return m_numIndex;}
     219              : 
     220              :                 /// return the number of dofs distributed on subset si
     221              :                 size_t num_indices(int si) const {return m_vNumIndexOnSubset[si];}
     222              : 
     223              :         public:
     224              :                 /// extracts all indices of the element (sorted)
     225              :                 /**
     226              :                  * All Indices of the element (including the subelements) are extracted
     227              :                  * and stored in the LocalIndices structure. The order of the indices
     228              :                  * is sorted, i.e. the dofs are provided as specified in the local
     229              :                  * dof set of the local finite element trial space.
     230              :                  * If bHang is set to true, also the DoFs on the Constained Objects
     231              :                  * belonging to the constraining Subelements are extracted and added at
     232              :                  * the end of the indices.
     233              :                  *
     234              :                  * \param[in]           elem            the element
     235              :                  * \param[out]          ind                     Local indices
     236              :                  * \param[in]           bHang           flag if extracting of constrained dofs required
     237              :                  */
     238              :                 /// \{
     239              :                 void indices(GridObject* elem, LocalIndices& ind, bool bHang = false) const;
     240              :                 void indices(Vertex* elem, LocalIndices& ind, bool bHang = false) const;
     241              :                 void indices(Edge* elem, LocalIndices& ind, bool bHang = false) const;
     242              :                 void indices(Face* elem, LocalIndices& ind, bool bHang = false) const;
     243              :                 void indices(Volume* elem, LocalIndices& ind, bool bHang = false) const;
     244              :                 /// \}
     245              : 
     246              :                 /// extracts all multiindices for a function (sorted)
     247              :                 /**
     248              :                  * All Multi-Indices of a function living on the element (including the
     249              :                  * subelements) are extracted and stored in a std::vector. The order of
     250              :                  * the indices is sorted, i.e. the dofs are provided as specified in the
     251              :                  * local dof set of the local finite element trial space.
     252              :                  * If bHang is set to true, also the DoFs on the Constrained Objects
     253              :                  * belonging to the constraining Subelements are extracted and added at
     254              :                  * the end of the indices.
     255              :                  * If bClear is set to true, the vector is cleared before insertion.
     256              :                  *
     257              :                  * \param[in]           elem            the element
     258              :                  * \param[in]           fct                     the function
     259              :                  * \param[out]          ind                     vector of multi indices
     260              :                  * \param[in]           bHang           flag if extracting of constrained dofs required
     261              :                  * \param[in]           bClear          flag if vector has to be clear before insertion
     262              :                  */
     263              :                 /// \{
     264              :                 size_t dof_indices(GridObject* elem, size_t fct, std::vector<DoFIndex>& ind,
     265              :                                    bool bHang = false, bool bClear = true) const;
     266              :                 size_t dof_indices(Vertex* elem, size_t fct, std::vector<DoFIndex>& ind,
     267              :                                    bool bHang = false, bool bClear = true) const;
     268              :                 size_t dof_indices(Edge* elem, size_t fct, std::vector<DoFIndex>& ind,
     269              :                                    bool bHang = false, bool bClear = true) const;
     270              :                 size_t dof_indices(Face* elem, size_t fct, std::vector<DoFIndex>& ind,
     271              :                                    bool bHang = false, bool bClear = true) const;
     272              :                 size_t dof_indices(Volume* elem, size_t fct, std::vector<DoFIndex>& ind,
     273              :                                    bool bHang = false, bool bClear = true) const;
     274              :                 /// \}
     275              : 
     276              :                 /// extracts all multiindices of a function in the inner (sorted)
     277              :                 /**
     278              :                  * All Multi-Indices of a function living on the element (including the
     279              :                  * subelements) are extracted and stored in a std::vector. The order of
     280              :                  * the indices is sorted, i.e. the dofs are provided as specified in the
     281              :                  * local dof set of the local finite element trial space.
     282              :                  * If bClear is set to true, the vector is cleared before insertion.
     283              :                  *
     284              :                  * \param[in]           elem            the element
     285              :                  * \param[in]           fct                     the function
     286              :                  * \param[out]          ind                     vector of multi indices
     287              :                  * \param[in]           bClear          flag if vector has to be clear before insertion
     288              :                  */
     289              :                 /// \{
     290              :                 size_t inner_dof_indices(GridObject* elem, size_t fct, std::vector<DoFIndex>& ind,
     291              :                                          bool bClear = true) const;
     292              :                 size_t inner_dof_indices(Vertex* elem, size_t fct, std::vector<DoFIndex>& ind,
     293              :                                          bool bClear = true) const;
     294              :                 size_t inner_dof_indices(Edge* elem, size_t fct, std::vector<DoFIndex>& ind,
     295              :                                          bool bClear = true) const;
     296              :                 size_t inner_dof_indices(Face* elem, size_t fct, std::vector<DoFIndex>& ind,
     297              :                                          bool bClear = true) const;
     298              :                 size_t inner_dof_indices(Volume* elem, size_t fct, std::vector<DoFIndex>& ind,
     299              :                                          bool bClear = true) const;
     300              :                 /// \}
     301              : 
     302              :                 /// extracts all algebra indices of an element (not sorted)
     303              :                 /**
     304              :                  * All Algebra-Indices of the element (including the subelements) are
     305              :                  * extracted and stored in a std::vector. The order of the indices is
     306              :                  * not sorted, no constrained DoFs are extracted.
     307              :                  * If bClear is set to true, the vector is cleared before insertion.
     308              :                  *
     309              :                  * \param[in]           elem            the element
     310              :                  * \param[out]          ind                     vector of algebra indices
     311              :                  * \param[in]           bClear          flag if vector has to be clear before insertion
     312              :                  */
     313              :                 /// \{
     314              :                 size_t algebra_indices(GridObject* elem,        std::vector<size_t>& ind,
     315              :                                        bool bClear = true) const;
     316              :                 size_t algebra_indices(Vertex* elem, std::vector<size_t>& ind,
     317              :                                        bool bClear = true) const;
     318              :                 size_t algebra_indices(Edge* elem, std::vector<size_t>& ind,
     319              :                                        bool bClear = true) const;
     320              :                 size_t algebra_indices(Face* elem, std::vector<size_t>& ind,
     321              :                                        bool bClear = true) const;
     322              :                 size_t algebra_indices(Volume* elem, std::vector<size_t>& ind,
     323              :                                        bool bClear = true) const;
     324              :                 /// \}
     325              : 
     326              :                 size_t inner_algebra_indices_for_fct(GridObject* elem, std::vector<size_t>& ind,
     327              :                                                         bool bClear, int fct) const;
     328              : 
     329              :                 /// extracts all algebra indices in the inner of the element (not sorted)
     330              :                 /**
     331              :                  * All Algebra-Indices of the element (excluding the subelements) are
     332              :                  * extracted and stored in a std::vector. The order of the indices is
     333              :                  * not sorted, no constrained DoFs are extracted.
     334              :                  * If bClear is set to true, the vector is cleared before insertion.
     335              :                  *
     336              :                  * \param[in]           elem            the element
     337              :                  * \param[out]          ind                     vector of algebra indices
     338              :                  * \param[in]           bClear          flag if vector has to be clear before insertion
     339              :                  */
     340              :                 /// \{
     341              :                 size_t inner_algebra_indices(GridObject* elem, std::vector<size_t>& ind,
     342              :                                              bool bClear = true) const;
     343              :                 size_t inner_algebra_indices(Vertex* elem, std::vector<size_t>& ind,
     344              :                                              bool bClear = true) const;
     345              :                 size_t inner_algebra_indices(Edge* elem, std::vector<size_t>& ind,
     346              :                                              bool bClear = true) const;
     347              :                 size_t inner_algebra_indices(Face* elem, std::vector<size_t>& ind,
     348              :                                              bool bClear = true) const;
     349              :                 size_t inner_algebra_indices(Volume* elem, std::vector<size_t>& ind,
     350              :                                              bool bClear = true) const;
     351              :                 /// \}
     352              : 
     353              :         protected:
     354              :                 template <typename TBaseElem>
     355              :                 void _indices(TBaseElem* elem, LocalIndices& ind, bool bHang = false) const;
     356              : 
     357              :                 template<typename TBaseElem>
     358              :                 size_t _dof_indices(TBaseElem* elem, size_t fct,
     359              :                                      std::vector<DoFIndex>& ind,
     360              :                                      bool bHang = false, bool bClear = true) const;
     361              : 
     362              :                 template<typename TBaseElem>
     363              :                 size_t _inner_dof_indices(TBaseElem* elem, size_t fct,
     364              :                                            std::vector<DoFIndex>& ind,
     365              :                                            bool bClear = true) const;
     366              : 
     367              :                 template<typename TBaseElem>
     368              :                 size_t _algebra_indices(TBaseElem* elem,        std::vector<size_t>& ind,
     369              :                                        bool bClear = true) const;
     370              : 
     371              :                 template<typename TBaseElem>
     372              :                 size_t _inner_algebra_indices(TBaseElem* elem, std::vector<size_t>& ind,
     373              :                                              bool bClear = true) const;
     374              : 
     375              :         ///     returns indices, that can be changed on the element
     376              :                 template <typename TBaseElem>
     377              :                 void changable_indices(std::vector<size_t>& vIndex,
     378              :                                        const std::vector<TBaseElem*>& vElem) const;
     379              : 
     380              :                 ///     extracts the indices of the vertices
     381              :                 template<typename TBaseElem>
     382              :                 void indices_on_vertex(TBaseElem* elem, const ReferenceObjectID roid,
     383              :                                        LocalIndices& ind,
     384              :                                        const Grid::SecureVertexContainer& vElem) const;
     385              : 
     386              :                 ///     extract dofs on constrained objects
     387              :                 template <typename TConstraining, typename TConstrained, typename TBaseElem>
     388              :                 void constrained_vertex_indices(LocalIndices& ind,
     389              :                                          const typename Grid::traits<TBaseElem>::secure_container& vSubElem) const;
     390              : 
     391              :                 template <typename TBaseElem,typename TConstraining, typename TConstrained, typename TSubElem>
     392              :                 void constrained_edge_indices(TBaseElem* elem,LocalIndices& ind,
     393              :                                          const typename Grid::traits<TSubElem>::secure_container& vSubElem) const;
     394              : 
     395              :                 template <typename TBaseElem,typename TConstraining, typename TConstrained, typename TSubElem>
     396              :                 void constrained_face_indices(TBaseElem* elem,LocalIndices& ind,
     397              :                                          const typename Grid::traits<TSubElem>::secure_container& vSubElem) const;
     398              : 
     399              :                 // sorts indices on constrained edges
     400              :                 template <typename TBaseElem,typename TConstraining, typename TConstrained>
     401              :                 void sort_constrained_edges(std::vector<size_t>& sortedInd,TBaseElem* elem,TConstraining* constrainingObj,size_t objIndex) const;
     402              : 
     403              :                 // sorts indices on constrained faces
     404              :                 template <typename TBaseElem,typename TConstraining, typename TConstrained>
     405              :                 void sort_constrained_faces(std::vector<size_t>& sortedInd,TBaseElem* elem,TConstraining* constrainingObj,size_t objIndex) const;
     406              : 
     407              :                 /// extracts the indices of the subelement of an element
     408              :                 template<typename TBaseElem, typename TSubBaseElem>
     409              :                 void indices(TBaseElem* elem, const ReferenceObjectID roid,
     410              :                              LocalIndices& ind,
     411              :                              const typename Grid::traits<TSubBaseElem>::secure_container& vElem) const;
     412              : 
     413              :                 /// extracts the indices of a subelement of an element
     414              :                 template<typename TBaseElem, typename TSubBaseElem>
     415              :                 void dof_indices(TBaseElem* elem, const ReferenceObjectID roid,
     416              :                                    size_t fct, std::vector<DoFIndex>& ind,
     417              :                                    const typename Grid::traits<TSubBaseElem>::secure_container& vElem) const;
     418              : 
     419              :                 /// multi indices on constrained vertices
     420              :                 template <typename TConstraining, typename TConstrained, typename TBaseElem>
     421              :                 void constrained_vertex_dof_indices(size_t fct,std::vector<DoFIndex>& ind,
     422              :                                                                         const typename Grid::traits<TBaseElem>::secure_container& vSubElem) const;
     423              : 
     424              :                 /// multi indices on constrained edges
     425              :                 template <typename TBaseElem,typename TConstraining, typename TConstrained, typename TSubElem>
     426              :                 void constrained_edge_dof_indices(TBaseElem* elem,size_t fct,std::vector<DoFIndex>& ind,
     427              :                                                                         const typename Grid::traits<TSubElem>::secure_container& vSubElem) const;
     428              : 
     429              :                 /// multi indices on constrained faces
     430              :                 template <typename TBaseElem,typename TConstraining, typename TConstrained, typename TSubElem>
     431              :                 void constrained_face_dof_indices(TBaseElem* elem,size_t fct,std::vector<DoFIndex>& ind,
     432              :                                                                         const typename Grid::traits<TSubElem>::secure_container& vSubElem) const;
     433              : 
     434              :                 /// adds all algebra indices of an geom object to the LocalIndices
     435              :                 template <typename TBaseElem>
     436              :                 size_t extract_inner_algebra_indices(TBaseElem* elem,
     437              :                                                      std::vector<size_t>& ind) const;
     438              : 
     439              :                 ///     adds all algebra indices of a set of geometric objects
     440              :                 template<typename TBaseElem>
     441              :                 void extract_inner_algebra_indices(const typename Grid::traits<TBaseElem>::secure_container& vElem,
     442              :                                                    std::vector<size_t>& ind) const;
     443              : 
     444              :         protected:
     445              :                 /// adds indices to a geometric object
     446              :                 template <typename TBaseObject>
     447              :                 void add(TBaseObject* obj, const ReferenceObjectID roid, const int si);
     448              : 
     449              :                 ///     checks that subset assignment is ok
     450              :                 void check_subsets();
     451              : 
     452              :                 /// returns the index assigned to a grid object
     453              :                 /// \{
     454              :                 template <typename TElem>
     455              :                 inline size_t& obj_index(TElem* obj) {return m_spDoFIndexStorage->obj_index(obj);}
     456              : 
     457              :                 template <typename TElem>
     458            0 :                 inline const size_t& obj_index(TElem* obj) const {return m_spDoFIndexStorage->obj_index(obj);}
     459              :                 /// \}
     460              : 
     461              :         protected:
     462              :                 ///     grouping
     463              :                 bool m_bGrouped;
     464              : 
     465              :                 ///     Multi Grid
     466              :                 SmartPtr<MultiGrid> m_spMG;
     467              :                 MultiGrid* m_pMG;
     468              : 
     469              :                 /// Subset Handler
     470              :                 SmartPtr<MGSubsetHandler> m_spMGSH;
     471              : 
     472              :                 ///     MultiGrid Subset Handler
     473              :                 SmartPtr<SurfaceView> m_spSurfView;
     474              : 
     475              :                 ///     Grid level
     476              :                 GridLevel m_gridLevel;
     477              : 
     478              :                 /// DoF-Index Memory Storage
     479              :                 SmartPtr<DoFIndexStorage> m_spDoFIndexStorage;
     480              : 
     481              :         protected:
     482              :                 /// number of distributed indices on whole domain
     483              :                 size_t m_numIndex;
     484              : 
     485              :                 /// number of distributed indices on each subset
     486              :                 std::vector<size_t> m_vNumIndexOnSubset;
     487              : 
     488              :         public:
     489              :                 /// returns the connections
     490              :                 void get_connections(std::vector<std::vector<size_t> >& vvConnection) const;
     491              : 
     492              :                 ///     renames the indices
     493              :                 void permute_indices(const std::vector<size_t>& vIndNew);
     494              : 
     495              :                 ///     initializes the indices
     496              :                 void reinit();
     497              : 
     498              :         protected:
     499              :                 ///     initializes the indices
     500              :                 template <typename TBaseElem>
     501              :                 void reinit();
     502              : 
     503              :                 template <typename TBaseElem>
     504              :                 void permute_indices(const std::vector<size_t>& vNewInd);
     505              : 
     506              :         public:
     507              :                 template <typename TBaseElem>
     508              :                 void get_connections(std::vector<std::vector<size_t> >& vvConnection) const;
     509              : 
     510              :         public:
     511              :         ///     registers a grid function for adaptation management
     512              :                 void manage_grid_function(IGridFunction& gridFct);
     513              : 
     514              :         ///     unregisters a grid function for adaptation management
     515              :                 void unmanage_grid_function(IGridFunction& gridFct);
     516              : 
     517              :         public:
     518              :         ///     permutes values in managed functions, if indices permuted
     519              :                 void permute_values(const std::vector<size_t>& vIndNew);
     520              : 
     521              :         ///     swaps values in managed functions, if indices swapped
     522              :                 void copy_values(const std::vector<std::pair<size_t, size_t> >& vIndexMap,
     523              :                                                          bool bDisjunct);
     524              : 
     525              :         ///     changes values in managed functions, number of indices changed
     526              :                 void resize_values(size_t newSize);
     527              : 
     528              :         protected:
     529              :         ///     managed grid functions
     530              :         /**
     531              :          * This vector holds a pointer to all grid functions, that should be
     532              :          * managed (i.e. adapted), when the dof distribution is changed.
     533              :          * NOTE:        No SmartPtr is used here on purpose. The GridFunction stores a
     534              :          *                      SmartPtr to the DoFDistribution. If we would use a SmartPtr
     535              :          *                      here those objects would reference each other and would never
     536              :          *                      be deleted.
     537              :          */
     538              :                 std::vector<IGridFunction*> m_vpGridFunction;
     539              : 
     540              : #ifdef UG_PARALLEL
     541              :                 public:
     542              :                 ///     returns algebra layouts
     543              :                 ///     \{
     544              :                 ConstSmartPtr<AlgebraLayouts> layouts() const     {return m_spAlgebraLayouts;}
     545              :                 SmartPtr<AlgebraLayouts> layouts()                                {return m_spAlgebraLayouts;}
     546              :                 ///     \}
     547              : 
     548              :         protected:
     549              :                 ///     algebra layouts
     550              :                 SmartPtr<AlgebraLayouts> m_spAlgebraLayouts;
     551              : 
     552              :                 void reinit_layouts_and_communicator();
     553              : 
     554              :                 void reinit_index_layout(IndexLayout& layout, int keyType);
     555              : 
     556              :                 template <typename TBaseElem>
     557              :                 void add_indices_from_layouts(IndexLayout& indexLayout, int keyType);
     558              : #endif
     559              : 
     560              :         public:
     561              :                 DoFCount dof_count() const;
     562              : 
     563              :         protected:
     564              :                 template <typename TBaseElem>
     565              :                 void sum_dof_count(DoFCount& cnt) const;
     566              : 
     567              : };
     568              : 
     569              : } // end namespace ug
     570              : 
     571              : #endif /* __H__UG__LIB_DISC__DOF_MANAGER__DOF_DISTRIBUTION__ */
        

Generated by: LCOV version 2.0-1