Loading [MathJax]/extensions/tex2jax.js
ug4
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
proj_gauss_seidel_interface.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__PROJ_GAUSS_SEIDEL_INTERFACE__
34#define __H__UG__LIB_ALGEBRA__OPERATOR__PRECONDITIONER__PROJECTED_GAUSS_SEIDEL__PROJ_GAUSS_SEIDEL_INTERFACE__
35
38
39namespace ug{
40
42
71template <typename TDomain, typename TAlgebra>
73 public GaussSeidelBase<TAlgebra>
74{
75 public:
78
80 typedef TAlgebra algebra_type;
81
83 typedef typename algebra_type::matrix_type matrix_type;
84
86 typedef typename algebra_type::vector_type vector_type;
87
89 typedef typename vector_type::value_type value_type;
90
93
94 public:
97 m_spvObsConstraint.clear();
98 m_bObsCons = false;
99 };
100
101
109
112 {
113 m_spvObsConstraint.push_back(spObsCons);
114 m_bObsCons = true;
115
116 // inits the obstacle constraint
117 spObsCons->init();
118 }
119
122
124 virtual const char* name() const = 0;
125
127 virtual bool init(SmartPtr<ILinearOperator<vector_type> > J, const vector_type& u);
128
130
138 virtual void step(const matrix_type& mat, vector_type& c, const vector_type& d, const number relax) = 0;
139
141 void project_correction(value_type& c_i, const size_t i);
142
144 virtual bool apply(vector_type& c, const vector_type& d);
145
147 virtual bool apply_update_defect(vector_type& c, vector_type& d);
148
149 private:
152 void truncateVec(vector_type& vec, vector<DoFIndex>& vInd);
153
156 void truncateMat(matrix_type& mat, vector<DoFIndex>& vInd);
157
158 protected:
160 vector<SmartPtr<IObstacleConstraint<TDomain,TAlgebra> > > m_spvObsConstraint;
161
162 private:
165
168
171
172};
173
174
175} // end namespace ug
176
177// include implementation
179
180#endif /* __H__UG__LIB_ALGEBRA__OPERATOR__PRECONDITIONER__PROJECTED_GAUSS_SEIDEL__PROJ_GAUSS_SEIDEL_INTERFACE__ */
Definition smart_pointer.h:108
Definition gauss_seidel.h:52
represents numerical solutions on a grid using an algebraic vector
Definition grid_function.h:121
describes a linear mapping X->Y
Definition linear_operator.h:80
Interface for Obstacle Constraints.
Definition obstacle_constraint_interface.h:73
Interface for Projected GaussSeidel Preconditioner.
Definition proj_gauss_seidel_interface.h:74
vector_type::value_type value_type
Value type.
Definition proj_gauss_seidel_interface.h:89
IProjGaussSeidel()
constructor
Definition proj_gauss_seidel_interface.h:96
virtual void step(const matrix_type &mat, vector_type &c, const vector_type &d, const number relax)=0
computes a new correction c = B*d and projects on the underlying constraint
~IProjGaussSeidel()
Destructor.
Definition proj_gauss_seidel_interface.h:121
SmartPtr< vector_type > m_spSol
pointer to solution
Definition proj_gauss_seidel_interface.h:164
void truncateMat(matrix_type &mat, vector< DoFIndex > &vInd)
Definition proj_gauss_seidel_interface_impl.h:73
void add_obstacle_constraint(SmartPtr< IObstacleConstraint< TDomain, TAlgebra > > spObsCons)
adds the obstacle constraint function c(u)
Definition proj_gauss_seidel_interface.h:111
void project_correction(value_type &c_i, const size_t i)
projects the correction on the underlying constraints set by the obstacleConstraints
Definition proj_gauss_seidel_interface_impl.h:130
bool m_bInit
init flag indicating if init has been called
Definition proj_gauss_seidel_interface.h:170
GridFunction< TDomain, TAlgebra > GF
Grid Function type.
Definition proj_gauss_seidel_interface.h:92
TAlgebra algebra_type
Algebra type.
Definition proj_gauss_seidel_interface.h:80
algebra_type::matrix_type matrix_type
Matrix type.
Definition proj_gauss_seidel_interface.h:83
GaussSeidelBase< TAlgebra > base_type
Base class type.
Definition proj_gauss_seidel_interface.h:77
algebra_type::vector_type vector_type
Vector type.
Definition proj_gauss_seidel_interface.h:86
virtual const char * name() const =0
name
virtual bool apply_update_defect(vector_type &c, vector_type &d)
Compute new correction c = B*d and return new defect d := d - A*c.
Definition proj_gauss_seidel_interface_impl.h:298
bool m_bObsCons
flag indicating if obstacle constraint has been set
Definition proj_gauss_seidel_interface.h:167
void truncateVec(vector_type &vec, vector< DoFIndex > &vInd)
Definition proj_gauss_seidel_interface_impl.h:54
IProjGaussSeidel(const IProjGaussSeidel< TDomain, TAlgebra > &parent)
clone constructor
Definition proj_gauss_seidel_interface.h:103
vector< SmartPtr< IObstacleConstraint< TDomain, TAlgebra > > > m_spvObsConstraint
obstacle constraint
Definition proj_gauss_seidel_interface.h:160
virtual bool apply(vector_type &c, const vector_type &d)
Compute new correction c = B*d.
Definition proj_gauss_seidel_interface_impl.h:174
virtual void init()
double number
Definition types.h:124
the ug namespace