ug4
projection_handler.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016: 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__UG_projection_handler_new
34 #define __H__UG_projection_handler_new
35 
36 #include <vector>
37 #include <algorithm>
38 #include "common/assert.h"
39 #include "refinement_projector.h"
43 
44 namespace ug{
45 
47 
54 public:
56 
62 
65 
71  ISubsetHandler* psh);
72 
74  template <class TGeomProvider>
75  ProjectionHandler (const TGeomProvider& geometry,
78  m_sh (psh.get()),
79  m_spSH (psh)
80  {
82  }
83 
84  virtual ~ProjectionHandler ();
85 
86  void clear();
87 
88  virtual void set_geometry (SPIGeometry3d geometry);
89 
91 
94 
99 
101 
102 
104  inline const ISubsetHandler* subset_handler() const {return m_sh;}
105 
107 
109 
112  void set_projector (int subsetIndex, SPRefinementProjector projector);
113 
115 
122  void set_projector (const char* subsetName, SPRefinementProjector projector);
123 
124  inline size_t num_projectors () const {return m_projectors.size() > 0 ? m_projectors.size() - 1 : 0;}
125 
126  inline SPRefinementProjector
127  projector (size_t i) {projector_required((int)i); return m_projectors.at(i + 1);}
128 
130  projector (size_t i) const {return m_projectors.at(i + 1);}
131 
132  inline SPRefinementProjector
134 
137 
139 // IMPLEMENTATION OF RefinementProjector
140  virtual bool refinement_begins_requires_subgrid () const;
141 
143 
145  virtual void refinement_begins (const ISubGrid* psg);
146 
147  virtual void refinement_ends();
148 
150  virtual number new_vertex (Vertex* vrt, Vertex* parent);
151 
153  virtual number new_vertex (Vertex* vrt, Edge* parent);
154 
156  virtual number new_vertex (Vertex* vrt, Face* parent);
157 
159  virtual number new_vertex (Vertex* vrt, Volume* parent);
160 
161 
162 private:
164 
165  void projector_required(int index);
166 
167  template <class TParent>
168  number handle_new_vertex (Vertex* vrt, TParent* parent);
169 
172  std::vector<SmartPtr<RefinementProjector> > m_projectors;
174 };
175 
177 
178 }// end of namespace
179 
180 #endif //__H__UG_projection_handler_new
Definition: smart_pointer.h:296
Definition: smart_pointer.h:108
Base-class for edges.
Definition: grid_base_objects.h:397
Faces are 2-dimensional objects.
Definition: grid_base_objects.h:510
Instances represent a part of a grid.
Definition: sub_grid.h:44
Definition: subset_handler_interface.h:223
Associates different projectors with individual subsets.
Definition: projection_handler.h:53
virtual void set_geometry_all(SPIGeometry3d geometry)
Sets the geometry of the ProjectionHandler and of all associated projectors.
Definition: projection_handler.cpp:86
std::vector< SmartPtr< RefinementProjector > > m_projectors
Definition: projection_handler.h:172
virtual bool refinement_begins_requires_subgrid() const
Definition: projection_handler.cpp:146
SmartPtr< RefinementProjector > m_defaultProjector
Definition: projection_handler.h:173
ConstSmartPtr< RefinementProjector > default_projector() const
Definition: projection_handler.h:136
void set_default_projector(SPRefinementProjector projector)
Definition: projection_handler.cpp:113
SmartPtr< ISubsetHandler > m_spSH
Definition: projection_handler.h:171
ProjectionHandler()
Definition: projection_handler.cpp:38
void set_projector(int subsetIndex, SPRefinementProjector projector)
associate a projector with a given subsetIndex. Note that '-1' is a valid index, too.
Definition: projection_handler.cpp:119
void set_subset_handler(ISubsetHandler *psh)
Definition: projection_handler.cpp:97
virtual void set_geometry(SPIGeometry3d geometry)
Definition: projection_handler.cpp:79
ISubsetHandler * m_sh
Definition: projection_handler.h:170
virtual number new_vertex(Vertex *vrt, Vertex *parent)
called when a new vertex was created from an old vertex.
Definition: projection_handler.cpp:289
virtual void refinement_begins(const ISubGrid *psg)
prepares associated projectors for refinement
Definition: projection_handler.cpp:159
SPRefinementProjector projector(size_t i)
Definition: projection_handler.h:127
virtual ~ProjectionHandler()
Definition: projection_handler.cpp:69
virtual void refinement_ends()
called when refinement is done
Definition: projection_handler.cpp:279
size_t num_projectors() const
Definition: projection_handler.h:124
const ISubsetHandler * subset_handler() const
return the subset handler that the projection handler is based on
Definition: projection_handler.h:104
friend class boost::serialization::access
Definition: projection_handler.h:163
void projector_required(int index)
Definition: projection_handler.cpp:315
number handle_new_vertex(Vertex *vrt, TParent *parent)
Definition: projection_handler.cpp:324
ConstSmartPtr< RefinementProjector > projector(size_t i) const
Definition: projection_handler.h:130
ProjectionHandler(const TGeomProvider &geometry, SmartPtr< ISubsetHandler > psh)
Definition: projection_handler.h:75
void clear()
Definition: projection_handler.cpp:72
SPRefinementProjector default_projector()
Definition: projection_handler.h:133
Adjusts vertex coordinates during refinement.
Definition: refinement_projector.h:55
virtual SPIGeometry3d geometry() const
Definition: refinement_projector.h:81
Base-class for all vertex-types.
Definition: grid_base_objects.h:231
Volumes are 3-dimensional objects.
Definition: grid_base_objects.h:754
#define UG_API
Definition: ug_config.h:65
double number
Definition: types.h:124
SM_edge_weight_map< typename T::value_type, ug::BidirectionalMatrix< T > > get(edge_weight_t, ug::BidirectionalMatrix< T > const &g)
Definition: bidirectional_boost.h:157
the ug namespace
SmartPtr< ProjectionHandler > SPProjectionHandler
Definition: projection_handler.h:176
SmartPtr< T, FreePolicy > make_sp(T *inst)
returns a SmartPtr for the passed raw pointer
Definition: smart_pointer.h:836