ug4
smooth_projector.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_smooth_projector
34 #define __H__UG_smooth_projector
35 
36 #include "refinement_projector.h"
37 
38 namespace ug{
39 
40 
43 public:
45  m_iterations (10),
46  m_changeRate (0.25)
47  {}
48 
50  number changeRate) :
52  m_changeRate (changeRate)
53  {}
54 
57  int iterations,
58  number changeRate) :
61  m_changeRate (changeRate)
62  {}
63 
64  int iterations () const {return m_iterations;}
66 
67  number change_rate () const {return m_changeRate;}
68  void set_change_rate (number changeRate) {m_changeRate = changeRate;}
69 
71  virtual void refinement_begins(const ISubGrid* sg)
72  {
74  m_newVrts.clear();
75  }
76 
78 
79  virtual void refinement_ends();
80 
82  virtual number new_vertex(Vertex* vrt, Edge* parent)
83  {
84  m_newVrts.push_back(vrt);
85  return RefinementProjector::new_vertex(vrt, parent);
86  }
87 
89  virtual number new_vertex(Vertex* vrt, Face* parent)
90  {
91  m_newVrts.push_back(vrt);
92  return RefinementProjector::new_vertex(vrt, parent);
93  }
94 
96  virtual number new_vertex(Vertex* vrt, Volume* parent)
97  {
98  m_newVrts.push_back(vrt);
99  return RefinementProjector::new_vertex(vrt, parent);
100  }
101 
102 private:
104 
105  template <class Archive>
106  void serialize( Archive& ar, const unsigned int version)
107  {
108  ar & make_nvp("iterations", m_iterations);
109  ar & make_nvp("change rate", m_changeRate);
111  }
112 
113  std::vector<Vertex*> m_newVrts;
116 };
117 
118 }// end of namespace
119 
120 #endif //__H__UG_smooth_projector
#define UG_EMPTY_BASE_CLASS_SERIALIZATION(clsDerived, clsBase)
Definition: boost_serialization.h:51
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
Adjusts vertex coordinates during refinement.
Definition: refinement_projector.h:55
virtual number new_vertex(Vertex *vrt, Vertex *parent)
called when a new vertex was created from an old vertex.
Definition: refinement_projector.h:121
virtual void refinement_begins(const ISubGrid *sg)
called before refinement begins
Definition: refinement_projector.h:107
virtual SPIGeometry3d geometry() const
Definition: refinement_projector.h:81
Smoothes vertices during refinement.
Definition: smooth_projector.h:42
virtual number new_vertex(Vertex *vrt, Edge *parent)
called when a new vertex was created from an old edge.
Definition: smooth_projector.h:82
virtual number new_vertex(Vertex *vrt, Volume *parent)
called when a new vertex was created from an old volume.
Definition: smooth_projector.h:96
SmoothProjector()
Definition: smooth_projector.h:44
SmoothProjector(int iterations, number changeRate)
Definition: smooth_projector.h:49
void serialize(Archive &ar, const unsigned int version)
Definition: smooth_projector.h:106
number change_rate() const
Definition: smooth_projector.h:67
virtual void refinement_begins(const ISubGrid *sg)
called before refinement begins
Definition: smooth_projector.h:71
int iterations() const
Definition: smooth_projector.h:64
SmoothProjector(SPIGeometry3d geometry, int iterations, number changeRate)
Definition: smooth_projector.h:56
number m_changeRate
Definition: smooth_projector.h:115
friend class boost::serialization::access
Definition: smooth_projector.h:103
std::vector< Vertex * > m_newVrts
Definition: smooth_projector.h:113
virtual void refinement_ends()
called when refinement is done.
Definition: smooth_projector.cpp:38
void set_change_rate(number changeRate)
Definition: smooth_projector.h:68
virtual number new_vertex(Vertex *vrt, Face *parent)
called when a new vertex was created from an old face.
Definition: smooth_projector.h:89
void set_iterations(int iterations)
Definition: smooth_projector.h:65
int m_iterations
Definition: smooth_projector.h:114
Base-class for all vertex-types.
Definition: grid_base_objects.h:231
Volumes are 3-dimensional objects.
Definition: grid_base_objects.h:754
double number
Definition: types.h:124
the ug namespace