ug4
proj_gauss_seidel.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__
34 #define __H__UG__LIB_ALGEBRA__OPERATOR__PRECONDITIONER__PROJECTED_GAUSS_SEIDEL__PROJ_GAUSS_SEIDEL__
35 
37 
38 namespace ug{
39 
41 
76 template <typename TDomain, typename TAlgebra>
78  public IProjGaussSeidel<TDomain,TAlgebra>
79 {
80  public:
83 
85  typedef TAlgebra algebra_type;
86 
88  typedef typename algebra_type::matrix_type matrix_type;
89 
91  typedef typename algebra_type::vector_type vector_type;
92 
93  protected:
95  virtual const char* name() const {return "Projected GaussSeidel";}
96 
97  public:
101  : base_type(parent)
102  { }
103 
106  {
108  }
109 
111  virtual void step(const matrix_type& mat, vector_type& c, const vector_type& d, const number relax);
112 };
113 
114 template <typename TDomain, typename TAlgebra>
116  public IProjGaussSeidel<TDomain,TAlgebra>
117 {
118  public:
121 
123  typedef TAlgebra algebra_type;
124 
126  typedef typename algebra_type::matrix_type matrix_type;
127 
129  typedef typename algebra_type::vector_type vector_type;
130 
131  protected:
133  virtual const char* name() const {return "Projected Backward GaussSeidel";}
134 
135  public:
139  : base_type(parent)
140  { }
141 
144  {
146  }
147 
148 
150  virtual void step(const matrix_type& mat, vector_type& c, const vector_type& d, const number relax);
151 };
152 
153 
154 template <typename TDomain, typename TAlgebra>
156  public IProjGaussSeidel<TDomain,TAlgebra>
157 {
158  public:
161 
163  typedef TAlgebra algebra_type;
164 
166  typedef typename algebra_type::matrix_type matrix_type;
167 
169  typedef typename algebra_type::vector_type vector_type;
170 
171  protected:
173  virtual const char* name() const {return "Projected Symmetric GaussSeidel";}
174 
175  public:
177 
180  : base_type(parent)
181  { }
182 
185  {
187  }
188 
190  virtual void step(const matrix_type& mat, vector_type& c, const vector_type& d, const number relax);
191 };
192 
193 } // end namespace ug
194 
195 // include implementation
196 #include "proj_gauss_seidel_impl.h"
197 
198 #endif /* __H__UG__LIB_ALGEBRA__OPERATOR__PRECONDITIONER__PROJECTED_GAUSS_SEIDEL__PROJ_GAUSS_SEIDEL__ */
Definition: smart_pointer.h:108
describes a linear iterator that is based on a matrix operator
Definition: preconditioner.h:103
Interface for Projected GaussSeidel Preconditioner.
Definition: proj_gauss_seidel_interface.h:74
Wrapper for sequential matrices to handle them in parallel.
Definition: parallel_matrix.h:65
Definition: proj_gauss_seidel.h:117
ProjBackwardGaussSeidel(const ProjBackwardGaussSeidel< TDomain, TAlgebra > &parent)
clone constructor
Definition: proj_gauss_seidel.h:138
algebra_type::vector_type vector_type
Vector type.
Definition: proj_gauss_seidel.h:129
virtual SmartPtr< ILinearIterator< vector_type > > clone()
Clone.
Definition: proj_gauss_seidel.h:143
algebra_type::matrix_type matrix_type
Matrix type.
Definition: proj_gauss_seidel.h:126
IProjGaussSeidel< TDomain, TAlgebra > base_type
Base class type.
Definition: proj_gauss_seidel.h:120
virtual const char * name() const
name
Definition: proj_gauss_seidel.h:133
ProjBackwardGaussSeidel()
Definition: proj_gauss_seidel.h:136
TAlgebra algebra_type
Algebra type.
Definition: proj_gauss_seidel.h:123
virtual void step(const matrix_type &mat, vector_type &c, const vector_type &d, const number relax)
computes a new correction c = B*d and projects on the underlying constraint
Definition: proj_gauss_seidel_impl.h:91
Projected GaussSeidel (SOR) -method.
Definition: proj_gauss_seidel.h:79
ProjGaussSeidel(const ProjGaussSeidel< TDomain, TAlgebra > &parent)
copy constructor
Definition: proj_gauss_seidel.h:100
virtual SmartPtr< ILinearIterator< vector_type > > clone()
Clone.
Definition: proj_gauss_seidel.h:105
algebra_type::matrix_type matrix_type
Matrix type.
Definition: proj_gauss_seidel.h:88
algebra_type::vector_type vector_type
Vector type.
Definition: proj_gauss_seidel.h:91
ProjGaussSeidel()
Definition: proj_gauss_seidel.h:98
virtual const char * name() const
name
Definition: proj_gauss_seidel.h:95
TAlgebra algebra_type
Algebra type.
Definition: proj_gauss_seidel.h:85
IProjGaussSeidel< TDomain, TAlgebra > base_type
Base class type.
Definition: proj_gauss_seidel.h:82
virtual void step(const matrix_type &mat, vector_type &c, const vector_type &d, const number relax)
computes a new correction c = B*d and projects on the underlying constraint
Definition: proj_gauss_seidel_impl.h:77
Definition: proj_gauss_seidel.h:157
virtual void step(const matrix_type &mat, vector_type &c, const vector_type &d, const number relax)
computes a new correction c = B*d and projects on the underlying constraint
Definition: proj_gauss_seidel_impl.h:108
TAlgebra algebra_type
Algebra type.
Definition: proj_gauss_seidel.h:163
ProjSymmetricGaussSeidel()
Definition: proj_gauss_seidel.h:176
algebra_type::matrix_type matrix_type
Matrix type.
Definition: proj_gauss_seidel.h:166
ProjSymmetricGaussSeidel(const ProjSymmetricGaussSeidel< TDomain, TAlgebra > &parent)
copy constructor
Definition: proj_gauss_seidel.h:179
virtual const char * name() const
name
Definition: proj_gauss_seidel.h:173
IProjGaussSeidel< TDomain, TAlgebra > base_type
Base class type.
Definition: proj_gauss_seidel.h:160
virtual SmartPtr< ILinearIterator< vector_type > > clone()
Clone.
Definition: proj_gauss_seidel.h:184
algebra_type::vector_type vector_type
Vector type.
Definition: proj_gauss_seidel.h:169
double number
Definition: types.h:124
CPUAlgebra::vector_type vector_type
the ug namespace
SmartPtr< T, FreePolicy > make_sp(T *inst)
returns a SmartPtr for the passed raw pointer
Definition: smart_pointer.h:836