ug4
Loading...
Searching...
No Matches
nl_jacobi.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/*
34 * (main parts are based on the structure of
35 * newton.h by Andreas Vogel)
36 */
37
38#ifndef __H__UG__LIB_DISC__OPERATOR__NON_LINEAR_OPERATOR__NL_JACOBI__NL_JACOBIL_H_
39#define __H__UG__LIB_DISC__OPERATOR__NON_LINEAR_OPERATOR__NL_JACOBI__NL_JACOBIL_H_
40
42
43// modul intern headers
47
48namespace ug {
49
51
76template <typename TAlgebra>
78 : public IOperatorInverse<typename TAlgebra::vector_type>,
79 public DebugWritingObject<TAlgebra>
80{
81 public:
83 typedef TAlgebra algebra_type;
84
86 typedef typename TAlgebra::vector_type vector_type;
87
89 typedef typename TAlgebra::matrix_type matrix_type;
90
91 protected:
93
94 public:
97
100
102
103 void set_damp(number damp) {m_damp = damp;}
104
106 virtual std::string config_string() const
107 {
108 std::stringstream ss;
109 ss << "NonlinearJacobiSolver( damp = " << m_damp << ")\n";
110 ss << " ConvergenceCheck: ";
111 if(m_spConvCheck.valid()) ss << ConfigShift(m_spConvCheck->config_string()) << "\n";
112 else ss << " NOT SET!\n";
113
114 return ss.str();
115
116 }
117
119 // OperatorInverse interface methods
121
123 virtual bool init(SmartPtr<IOperator<vector_type> > op);
124
126 virtual bool prepare(vector_type& u);
127
129 virtual bool apply(vector_type& u);
130
131 private:
134 void write_debug(const vector_type& vec, const char* filename);
135 void write_debug(const matrix_type& mat, const char* filename);
137
138 private:
140
143
147
150};
151
152}
153
154#include "nl_jacobi_impl.h"
155
156#endif /* __H__UG__LIB_DISC__OPERATOR__NON_LINEAR_OPERATOR__NL_JACOBI__NL_JACOBIL_H_ */
Definition smart_pointer.h:108
Definition debug_writer.h:354
Definition convergence_check.h:72
describes a mapping X->Y
Definition operator.h:86
describes an inverse mapping X->Y
Definition operator_inverse.h:79
Nonlinear Jacobi-method.
Definition nl_jacobi.h:80
DebugWritingObject< TAlgebra > base_writer_type
Definition nl_jacobi.h:92
int m_dgbCall
call counter
Definition nl_jacobi.h:149
virtual bool apply(vector_type &u)
apply Operator, i.e. op^{-1}(0) = u
Definition nl_jacobi_impl.h:112
virtual std::string config_string() const
returns information about configuration parameters
Definition nl_jacobi.h:106
NLJacobiSolver()
default constructor
Definition nl_jacobi_impl.h:71
SmartPtr< IConvergenceCheck< vector_type > > m_spConvCheck
Definition nl_jacobi.h:139
TAlgebra::matrix_type matrix_type
Matrix type.
Definition nl_jacobi.h:89
SmartPtr< AssembledLinearOperator< algebra_type > > m_spJ
Definition nl_jacobi.h:145
number m_damp
damping factor
Definition nl_jacobi.h:142
SmartPtr< IAssemble< TAlgebra > > m_spAss
Definition nl_jacobi.h:146
TAlgebra algebra_type
Algebra type.
Definition nl_jacobi.h:83
SmartPtr< AssembledOperator< algebra_type > > m_spAssOp
Definition nl_jacobi.h:144
TAlgebra::vector_type vector_type
Vector type.
Definition nl_jacobi.h:86
void write_debug(const vector_type &vec, const char *filename)
Definition nl_jacobi_impl.h:212
void set_convergence_check(SmartPtr< IConvergenceCheck< vector_type > > spConvCheck)
Definition nl_jacobi_impl.h:79
void set_damp(number damp)
Definition nl_jacobi.h:103
virtual bool prepare(vector_type &u)
prepare Operator
Definition nl_jacobi_impl.h:105
virtual void init()
double number
Definition types.h:124
the ug namespace
string ConfigShift(string s)
Definition string_util.cpp:457