Loading [MathJax]/extensions/tex2jax.js
ug4
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
linear_iterator.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2010-2015: G-CSC, Goethe University Frankfurt
3 * Author: Andreas Vogel
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__LIB_ALGEBRA__OPERATOR__INTERFACE__OPERATOR_ITERATOR__
34#define __H__LIB_ALGEBRA__OPERATOR__INTERFACE__OPERATOR_ITERATOR__
35
38
39namespace ug{
40
42// Iterator Operator
44
46
79template <typename X, typename Y = X>
81{
82 public:
85
88
89 public:
91
98 virtual const char* name() const = 0;
99
101 virtual bool supports_parallel() const = 0;
102
104
113 virtual bool init(SmartPtr<ILinearOperator<Y,X> > J, const Y& u) = 0;
114
116
123 virtual bool init(SmartPtr<ILinearOperator<Y,X> > L) = 0;
124
126
136 virtual bool apply(Y& c, const X& d) = 0;
137
139
152 virtual bool apply_update_defect(Y& c, X& d) = 0;
153
155
163 void set_damp(SmartPtr<IDamping<X,Y> > spScaling) {
164 m_spDamping = spScaling;
165 }
166
168 void set_damp(number factor) {
170 }
171
174
177
179 virtual ~ILinearIterator() {};
180
183
186 {
187 set_damp(parent.m_spDamping);
188 };
189
190 virtual std::string config_string() const
191 {
192 std::stringstream ss; ss << name() << "( damping = " << m_spDamping->config_string() << ")"; return ss.str();
193 }
194
195 protected:
198};
199
200} // end namespace ug
201
202#endif /* __H__LIB_ALGEBRA__OPERATOR__INTERFACE__OPERATOR_ITERATOR__ */
203
Definition smart_pointer.h:108
constant damping factor
Definition damping.h:101
Definition damping.h:60
describes a linear iterator
Definition linear_iterator.h:81
SmartPtr< IDamping< X, Y > > m_spDamping
the scaling
Definition linear_iterator.h:197
virtual bool supports_parallel() const =0
returns if parallel solving is supported
virtual bool apply_update_defect(Y &c, X &d)=0
compute new correction c = B*d and update defect d := d - A*c
void set_damp(number factor)
sets the damping to a constant factor
Definition linear_iterator.h:168
void set_damp(SmartPtr< IDamping< X, Y > > spScaling)
sets a scaling for the correction
Definition linear_iterator.h:163
virtual bool apply(Y &c, const X &d)=0
compute new correction c = B*d
virtual bool init(SmartPtr< ILinearOperator< Y, X > > L)=0
initialize for linear operator L
virtual std::string config_string() const
Definition linear_iterator.h:190
virtual SmartPtr< ILinearIterator< X, Y > > clone()=0
clone
virtual const char * name() const =0
returns the name of iterator
virtual ~ILinearIterator()
virtual destructor
Definition linear_iterator.h:179
SmartPtr< IDamping< X, Y > > damping()
returns the scaling
Definition linear_iterator.h:173
Y codomain_function_type
Range space.
Definition linear_iterator.h:87
X domain_function_type
Domain space.
Definition linear_iterator.h:84
virtual bool init(SmartPtr< ILinearOperator< Y, X > > J, const Y &u)=0
initialize for operator J(u) and linearization point u
ILinearIterator(const ILinearIterator< X, Y > &parent)
copy constructor
Definition linear_iterator.h:185
ILinearIterator()
constructor
Definition linear_iterator.h:182
describes a linear mapping X->Y
Definition linear_operator.h:80
double number
Definition types.h:124
the ug namespace
SmartPtr< T, FreePolicy > make_sp(T *inst)
returns a SmartPtr for the passed raw pointer
Definition smart_pointer.h:836