ug4
obstacle_in_normal_dir.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013-2015: G-CSC, Goethe University Frankfurt
3  * Author: Raphael Prohl
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_ALGEBRA__OPERATOR__PRECONDITIONER__PROJECTED_GAUSS_SEIDEL__OBSTACLE_IN_NORMAL_DIR__
34 #define __H__UG__LIB_ALGEBRA__OPERATOR__PRECONDITIONER__PROJECTED_GAUSS_SEIDEL__OBSTACLE_IN_NORMAL_DIR__
35 
38 
39 namespace ug{
40 
42 
59 template <typename TDomain, typename TAlgebra>
61  public IObstacleConstraint<TDomain,TAlgebra>
62 {
63  public:
66 
68  typedef TAlgebra algebra_type;
69 
71  typedef typename algebra_type::matrix_type matrix_type;
72 
74  typedef typename algebra_type::vector_type vector_type;
75 
78 
81 
83  typedef TDomain domain_type;
84 
86  static const int dim = domain_type::dim;
87 
89  typedef typename domain_type::position_type position_type;
90 
91  public:
95  IObstacleConstraint<TDomain,TAlgebra>(u){
97  m_spDomain = u.domain();
98 
99  UG_LOG("In ObstacleInNormalDir::constructor u hat "<<u.size()<<"Eintraege \n");
100  UG_LOG("\n");
101  };
102 
104  ObstacleInNormalDir(): IObstacleConstraint<TDomain,TAlgebra>(){};
105 
107  void preprocess();
108 
110  void adjust_sol_and_cor(value_type& sol_i, value_type& c_i, bool& dofIsActive,
111  const DoFIndex& dof);
112 
114 
115  void restrict_obs_values();
116 
119 
120  private:
121  void transform_eulerian_coord_sys(MathVector<dim> transformedONB[],
122  const MathVector<dim>& firstTransformedBaseVec);
123 
124  template <typename TElem, typename TIterator>
125  void adjust_sol_and_cor_elem(TIterator iterBegin, TIterator iterEnd, value_type& sol_i,
126  value_type& c_i, bool& dofIsAdmissible, const DoFIndex& dof);
127 
128  private:
131 
134 
137 
140 
143 
145  struct obsDoFData{
148  };
149 };
150 
151 } // end namespace ug
152 
153 // include implementation
155 
156 #endif /* __H__UG__LIB_ALGEBRA__OPERATOR__PRECONDITIONER__PROJECTED_GAUSS_SEIDEL__OBSTACLE_IN_NORMAL_DIR__ */
157 
Definition: smart_pointer.h:296
represents numerical solutions on a grid using an algebraic vector
Definition: grid_function.h:121
SmartPtr< TDomain > domain()
returns domain
Definition: grid_function.h:342
SmartPtr< DoFDistribution > dof_distribution()
Definition: grid_function.h:236
Interface for Obstacle Constraints.
Definition: obstacle_constraint_interface.h:73
map< DoFIndex, number > m_mObstacleValues
map to store obstacle values with its corresponding DoFs
Definition: obstacle_constraint_interface.h:259
vector< int > m_vObsSubsets
stores the subset-indices of the obstacle subsets
Definition: obstacle_constraint_interface.h:262
vector< DoFIndex > m_vActiveDofs
stores the dofs, which satisfy the constraints with equality
Definition: obstacle_constraint_interface.h:265
Definition: multi_index.h:50
Obstacle Class for Obstacle in normal direction.
Definition: obstacle_in_normal_dir.h:62
ConstSmartPtr< TDomain > m_spDomain
pointer to the domain
Definition: obstacle_in_normal_dir.h:142
ObstacleInNormalDir()
constructor
Definition: obstacle_in_normal_dir.h:104
void adjust_sol_and_cor(value_type &sol_i, value_type &c_i, bool &dofIsActive, const DoFIndex &dof)
projects the i-th index of the solution onto the admissible set and adjusts the correction
Definition: obstacle_in_normal_dir_impl.h:199
TDomain domain_type
Domain type.
Definition: obstacle_in_normal_dir.h:83
void transform_eulerian_coord_sys(MathVector< dim > transformedONB[], const MathVector< dim > &firstTransformedBaseVec)
Definition: obstacle_in_normal_dir_impl.h:61
void adjust_defect_to_constraint(vector_type &d)
the defect needs to be adjusted for the active indices (those indices, which are in contact)
Definition: obstacle_in_normal_dir_impl.h:237
algebra_type::matrix_type matrix_type
Matrix type.
Definition: obstacle_in_normal_dir.h:71
TAlgebra algebra_type
Algebra type.
Definition: obstacle_in_normal_dir.h:68
algebra_type::vector_type vector_type
Vector type.
Definition: obstacle_in_normal_dir.h:74
static const int dim
World dimension.
Definition: obstacle_in_normal_dir.h:86
vector_type::value_type value_type
Value type.
Definition: obstacle_in_normal_dir.h:77
domain_type::position_type position_type
Type of position coordinates (e.g. position_type)
Definition: obstacle_in_normal_dir.h:89
ConstSmartPtr< DoFDistribution > m_spDD
pointer to the DofDistribution on the whole domain
Definition: obstacle_in_normal_dir.h:139
ObstacleInNormalDir(const function_type &u)
Definition: obstacle_in_normal_dir.h:94
IObstacleConstraint< TDomain, TAlgebra > base_type
Base class type.
Definition: obstacle_in_normal_dir.h:65
void preprocess()
preprocess is useful to attach the normals for every obstacle DoF
Definition: obstacle_in_normal_dir_impl.h:46
GridFunction< TDomain, TAlgebra > function_type
Type of grid function.
Definition: obstacle_in_normal_dir.h:80
void restrict_obs_values()
restricts the obstacle values to a coarser grid in a multigrid hierarchy
Definition: obstacle_in_normal_dir_impl.h:253
void adjust_sol_and_cor_elem(TIterator iterBegin, TIterator iterEnd, value_type &sol_i, value_type &c_i, bool &dofIsAdmissible, const DoFIndex &dof)
Definition: obstacle_in_normal_dir_impl.h:126
~ObstacleInNormalDir()
Destructor.
Definition: obstacle_in_normal_dir.h:118
static const int dim
#define UG_LOG(msg)
Definition: log.h:367
double number
Definition: types.h:124
CPUAlgebra::vector_type vector_type
the ug namespace
T value_type
Definition: sparsematrix_interface.h:2
struct to store data for a specific obstacle DoF
Definition: obstacle_in_normal_dir.h:145
number obsVal
Definition: obstacle_in_normal_dir.h:146
MathVector< dim > transformedONB[dim]
Definition: obstacle_in_normal_dir.h:147