ug4
adaption_surface_grid_function.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013-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__FUNCTION_SPACE__ADAPTION_SURFACE_GRID_FUNCTION__
34 #define __H__UG__LIB_DISC__FUNCTION_SPACE__ADAPTION_SURFACE_GRID_FUNCTION__
35 
36 #include "grid_function.h"
38 
39 namespace ug{
40 
41 template <typename TDomain>
43 {
44  public:
45  typedef std::vector<std::vector<number> > Values;
47 
48  public:
50  bool bObserveStorage = true);
51 
52  public:
53  template <typename TAlgebra>
54  void copy_from_surface(const GridFunction<TDomain,TAlgebra>& rSurfaceFct);
55 
56  template <typename TAlgebra>
58 
60 
61  protected:
62  template <typename TElem, typename TAlgebra>
63  void copy_from_surface(const GridFunction<TDomain,TAlgebra>& rSurfaceFct, TElem* elem);
64  template <typename TElem, typename TAlgebra>
65  void copy_from_surface(const GridFunction<TDomain,TAlgebra>& rSurfaceFct);
66 
67  template <typename TElem, typename TAlgebra>
68  void copy_to_surface(GridFunction<TDomain,TAlgebra>& rSurfaceFct, TElem* elem);
69  template <typename TElem, typename TAlgebra>
71 
72  public:
73  void prolongate(const GridMessage_Adaption& msg);
74  void do_restrict(const GridMessage_Adaption& msg);
75 
76  protected:
77  template <typename TBaseElem>
78  void prolongate(const GridMessage_Adaption& msg, const size_t lvl);
79 
80  template <typename TBaseElem>
81  void do_restrict(const MGSelector& sel, const GridMessage_Adaption& msg);
82 
83  template <typename TBaseElem>
84  void select_parents(MGSelector& sel, const GridMessage_Adaption& msg);
85 
86  protected:
88  {
89  public:
91  size_t fct);
92 
93  void access_inner(GridObject* elem);
94 
95  void access_closure(GridObject* elem);
96 
97  protected:
98  template <typename TBaseElem, typename TSubBaseElem>
99  void access_closure(TBaseElem* elem);
100 
101  template <typename TBaseElem>
102  void access_closure(TBaseElem* elem);
103 
104  protected:
106  const size_t m_fct;
108  };
109  friend class ValueAccessor;
110 
111  public:
113  template <typename TBaseElem>
114  inline void obj_created(TBaseElem* elem);
115 
118  virtual void vertex_created(Grid* grid, Vertex* vrt, GridObject* pParent = NULL, bool replacesParent = false){obj_created(vrt);}
119  virtual void edge_created(Grid* grid, Edge* e, GridObject* pParent = NULL, bool replacesParent = false){obj_created(e);}
120  virtual void face_created(Grid* grid, Face* f, GridObject* pParent = NULL, bool replacesParent = false){obj_created(f);}
121  virtual void volume_created(Grid* grid, Volume* vol, GridObject* pParent = NULL, bool replacesParent = false){obj_created(vol);}
123 
124  protected:
130 
132 
133  template <typename TElem> void detach_entries();
135 
138 
139  std::vector<SmartPtr<IElemProlongation<TDomain> > > m_vpProlong;
140  std::vector<SmartPtr<IElemRestriction<TDomain> > > m_vpRestrict;
141 
142 };
143 
144 } // end namespace ug
145 
147 
148 #endif /* __H__UG__LIB_DISC__FUNCTION_SPACE__ADAPTION_SURFACE_GRID_FUNCTION__ */
Definition: smart_pointer.h:296
Definition: adaption_surface_grid_function.h:88
ValueAccessor(AdaptionSurfaceGridFunction< TDomain > &rASGF, size_t fct)
Definition: adaption_surface_grid_function.cpp:333
bool m_HasDoFs[NUM_GEOMETRIC_BASE_OBJECTS]
Definition: adaption_surface_grid_function.h:107
void access_closure(GridObject *elem)
Definition: adaption_surface_grid_function.cpp:413
AdaptionSurfaceGridFunction< TDomain > & m_rASGF
Definition: adaption_surface_grid_function.h:105
void access_inner(GridObject *elem)
Definition: adaption_surface_grid_function.cpp:347
const size_t m_fct
Definition: adaption_surface_grid_function.h:106
Definition: adaption_surface_grid_function.h:43
Attachment< Values > AValues
Definition: adaption_surface_grid_function.h:46
void copy_to_surface(GridFunction< TDomain, TAlgebra > &rSurfaceFct)
Definition: adaption_surface_grid_function_impl.h:163
virtual void edge_created(Grid *grid, Edge *e, GridObject *pParent=NULL, bool replacesParent=false)
Definition: adaption_surface_grid_function.h:119
SmartPtr< TDomain > m_spDomain
Definition: adaption_surface_grid_function.h:125
std::vector< std::vector< number > > Values
Definition: adaption_surface_grid_function.h:45
ConstSmartPtr< DoFDistributionInfo > m_spDDInfo
Definition: adaption_surface_grid_function.h:127
bool m_bObserveStorage
Definition: adaption_surface_grid_function.h:129
std::vector< SmartPtr< IElemProlongation< TDomain > > > m_vpProlong
Definition: adaption_surface_grid_function.h:139
void attach_entries(ConstSmartPtr< DoFDistributionInfo > spDDInfo)
Definition: adaption_surface_grid_function.cpp:265
void obj_created(TBaseElem *elem)
creates storage when object created
Definition: adaption_surface_grid_function_impl.h:181
AValues m_aValue
Definition: adaption_surface_grid_function.h:136
virtual void face_created(Grid *grid, Face *f, GridObject *pParent=NULL, bool replacesParent=false)
Definition: adaption_surface_grid_function.h:120
std::vector< SmartPtr< IElemRestriction< TDomain > > > m_vpRestrict
Definition: adaption_surface_grid_function.h:140
void do_restrict(const GridMessage_Adaption &msg)
Definition: adaption_surface_grid_function.cpp:187
void detach_entries()
Definition: adaption_surface_grid_function.cpp:303
void prolongate(const GridMessage_Adaption &msg)
Definition: adaption_surface_grid_function.cpp:50
virtual void vertex_created(Grid *grid, Vertex *vrt, GridObject *pParent=NULL, bool replacesParent=false)
Definition: adaption_surface_grid_function.h:118
int m_ParallelStorageType
Definition: adaption_surface_grid_function.h:128
void select_parents(MGSelector &sel, const GridMessage_Adaption &msg)
Definition: adaption_surface_grid_function.cpp:149
SmartPtr< MultiGrid > m_spGrid
Definition: adaption_surface_grid_function.h:126
virtual void volume_created(Grid *grid, Volume *vol, GridObject *pParent=NULL, bool replacesParent=false)
Definition: adaption_surface_grid_function.h:121
AdaptionSurfaceGridFunction(SmartPtr< TDomain > spDomain, bool bObserveStorage=true)
Definition: adaption_surface_grid_function.cpp:41
void copy_from_surface(const GridFunction< TDomain, TAlgebra > &rSurfaceFct)
Definition: adaption_surface_grid_function_impl.h:91
AValues value_attachment()
Definition: adaption_surface_grid_function.h:59
MultiElementAttachmentAccessor< AValues > m_aaValue
Definition: adaption_surface_grid_function.h:137
Base-class for edges.
Definition: grid_base_objects.h:397
Faces are 2-dimensional objects.
Definition: grid_base_objects.h:510
represents numerical solutions on a grid using an algebraic vector
Definition: grid_function.h:121
Manages the elements of a grid and their interconnection.
Definition: grid.h:132
A message sent along with "GridRefinement" messages.
Definition: lib_grid_messages.h:91
The base class for all geometric objects, such as vertices, edges, faces, volumes,...
Definition: grid_base_objects.h:157
Definition: grid_observer.h:80
specialization of ISelector for grids of class MultiGrid.
Definition: selector_multi_grid.h:108
Accesses attachements in different element types at the same time.
Definition: attachment_util.h:56
Definition: local_transfer_interface.h:46
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
the ug namespace
@ NUM_GEOMETRIC_BASE_OBJECTS
Definition: grid_base_objects.h:64