33 #ifndef __H__UG__LIB_DISC__OPERATOR__LINEAR_OPERATOR__JACOBI__
34 #define __H__UG__LIB_DISC__OPERATOR__LINEAR_OPERATOR__JACOBI__
89 template <
typename TAlgebra>
152 virtual const char*
name()
const {
return "Jacobi";}
162 size_t size = mat.num_rows();
163 if(size != mat.num_cols())
165 UG_LOG(
"Square Matrix needed for Jacobi Iteration.\n");
180 for(
size_t i = 0; i < diag.size(); ++i){
198 if(
damping()->constant_damping())
203 for(
size_t i = 0; i < mat.num_rows(); ++i)
228 for(
size_t i = 0; i <
m_diagInv.size(); ++i)
242 UG_LOG(
"ERROR in 'JacobiPreconditioner::apply': "
243 "Cannot change parallel status of correction to consistent.\n");
262 UG_LOG(
"ERROR in '"<<
name()<<
"::apply': Iterator not initialized.\n");
270 "storage format. Defect must be additive.");
279 UG_LOG(
"ERROR in '"<<
name()<<
"::apply': Step Routine failed.\n");
284 if(!
damping()->constant_damping()){
295 "parallel storage type of correction to consistent.");
Definition: smart_pointer.h:108
virtual void set_debug(SmartPtr< IDebugWriter< algebra_type > > spDebugWriter)
set debug writer
Definition: debug_writer.h:384
void write_debug(const matrix_type &mat, const char *filename)
write debug output for a matrix (if debug writer set)
Definition: debug_writer.h:399
TAlgebra::vector_type vector_type
type of vector
Definition: debug_writer.h:360
SmartPtr< IDebugWriter< algebra_type > > debug_writer()
returns the debug writer
Definition: debug_writer.h:391
TAlgebra::matrix_type matrix_type
type of matrix
Definition: debug_writer.h:363
void set_damp(SmartPtr< IDamping< TAlgebra::vector_type, TAlgebra::vector_type > > spScaling)
sets a scaling for the correction
Definition: linear_iterator.h:163
SmartPtr< IDamping< TAlgebra::vector_type, TAlgebra::vector_type > > damping()
returns the scaling
Definition: linear_iterator.h:173
describes a linear iterator that is based on a matrix operator
Definition: preconditioner.h:103
bool m_bInit
init flag indicating if init has been called
Definition: preconditioner.h:385
SmartPtr< MatrixOperator< matrix_type, vector_type > > approx_operator()
underlying matrix based operator used for the preconditioner
Definition: preconditioner.h:372
Jacobi-Iteration.
Definition: jacobi.h:91
bool m_bBlock
Definition: jacobi.h:308
virtual bool postprocess()
Postprocess routine.
Definition: jacobi.h:252
TAlgebra::matrix_type matrix_type
Matrix type.
Definition: jacobi.h:100
virtual bool preprocess(SmartPtr< MatrixOperator< matrix_type, vector_type > > pOp)
Preprocess routine.
Definition: jacobi.h:155
virtual bool step(SmartPtr< MatrixOperator< matrix_type, vector_type > > pOp, vector_type &c, const vector_type &d)
computes a new correction c = B*d
Definition: jacobi.h:222
TAlgebra::vector_type vector_type
Vector type.
Definition: jacobi.h:97
virtual bool apply(vector_type &c, const vector_type &d)
compute new correction c = B*d
Definition: jacobi.h:256
virtual const char * name() const
Name of preconditioner.
Definition: jacobi.h:152
IPreconditioner< TAlgebra > base_type
Base type.
Definition: jacobi.h:106
SmartPtr< MatrixOperator< matrix_type, vector_type > > approx_operator()
underlying matrix based operator used for the preconditioner
Definition: preconditioner.h:372
Jacobi(number damp)
constructor setting the damping parameter
Definition: jacobi.h:120
std::vector< inverse_type > m_diagInv
storage of the inverse diagonal in parallel
Definition: jacobi.h:307
virtual bool supports_parallel() const
returns if parallel solving is supported
Definition: jacobi.h:137
IPreconditioner< TAlgebra >::matrix_operator_type matrix_operator_type
Matrix Operator type.
Definition: jacobi.h:103
block_traits< typename matrix_type::value_type >::inverse_type inverse_type
type of block-inverse
Definition: jacobi.h:304
Jacobi(const Jacobi< TAlgebra > &parent)
clone constructor
Definition: jacobi.h:123
TAlgebra algebra_type
Algebra type.
Definition: jacobi.h:94
virtual ~Jacobi()
Destructor.
Definition: jacobi.h:141
Jacobi()
default constructor
Definition: jacobi.h:117
void set_block(bool b)
sets if blocked jacobi is used (inverting block-diagonal), or plain (scalar) diagonal if false
Definition: jacobi.h:145
virtual SmartPtr< ILinearIterator< vector_type > > clone()
Clone.
Definition: jacobi.h:130
Definition: matrix_operator.h:49
Definition: parallel_vector.h:60
bool change_storage_type(ParallelStorageType type)
changes to the requested storage type if possible
Definition: parallel_vector_impl.h:118
void set_storage_type(uint type)
sets the storage type
Definition: parallel_vector.h:104
void set_layouts(ConstSmartPtr< AlgebraLayouts > layouts)
sets the algebra layouts
Definition: parallel_vector.h:100
@ PST_CONSISTENT
Definition: parallel_storage_type.h:68
@ PST_ADDITIVE
Definition: parallel_storage_type.h:69
bool CheckVectorInvertible(const TVector &v)
Definition: sparsematrix_util.h:1116
#define THROW_IF_NOT_EQUAL_4(s1, s2, s3, s4)
Definition: error.h:183
#define UG_THROW(msg)
Definition: error.h:57
#define UG_LOG(msg)
Definition: log.h:367
double number
Definition: types.h:124
bool GetInverse(block_traits< T >::inverse_type &inv, const T &m)
void GetDiag(double &a, double b)
Definition: additional_math.h:144
bool MatMult(vector_t &dest, const number &beta1, const matrix_t &A1, const vector_t &w1)
calculates dest = beta1 * A1;
Definition: operations_mat.h:59
#define PROFILE_BEGIN_GROUP(name, groups)
Definition: profiler.h:255
SmartPtr< T, FreePolicy > make_sp(T *inst)
returns a SmartPtr for the passed raw pointer
Definition: smart_pointer.h:836
T value_type
Definition: sparsematrix_interface.h:2
size_t num_rows() const
Definition: sparsematrix_interface.h:38
size_t num_cols() const
Definition: sparsematrix_interface.h:39
Definition: communication_policies.h:58