The simplest concrete implementation of IEqSolver interface.
More...
#include <src/Components/EqSolver.h>
The simplest concrete implementation of IEqSolver interface.
- See also
- GaudiGSL/IEqSolver.h
- Author
- Kirill Miklyaev kiril.nosp@m.lm@i.nosp@m.ris1..nosp@m.itep.nosp@m..ru
- Date
- 2003-07-07
Definition at line 23 of file EqSolver.h.
EqSolver::EqSolver |
( |
const std::string & |
type, |
|
|
const std::string & |
name, |
|
|
const IInterface * |
parent |
|
) |
| |
Standard constructor.
- See also
- GaudiTool
- Parameters
-
type | tool type |
name | tool name |
parent | parent of the tool |
declare type of the algorithm for root finding
declare maximum of iteration
declare the absolute error bound for the residual value
Definition at line 72 of file EqSolver.cpp.
83 declareProperty (
"Algorithm",
m_algType );
extends base_class
Typedef to this class.
const gsl_multiroot_fdfsolver_type * m_type
default constructor is private
copy constructor is private
Definition at line 325 of file EqSolver.cpp.
333 return Error(
"Could not finaliaze base class GaudiTool", sc);
Definition of the MsgStream class used to transmit messages.
bool isFailure() const
Test for a status code of FAILURE.
This class is used for returning status codes from appropriate routines.
Overriding initialize.
Definition at line 270 of file EqSolver.cpp.
279 return Error (
"Could not initiliaze base class GaudiTool", sc);
286 m_type = gsl_multiroot_fdfsolver_hybridsj ;
288 <<
"Root findind algoritms to be used: "
289 <<
"'gsl_multiroot_fdfsolver_hybridsj'"
292 else if (
"fdfsolver_hybridj" ==
m_algType )
294 m_type = gsl_multiroot_fdfsolver_hybridj ;
296 <<
"Root findind algoritms to be used: "
297 <<
"'gsl_multiroot_fdfsolver_hybridj'"
300 else if (
"fdfsolver_newton" ==
m_algType )
302 m_type = gsl_multiroot_fdfsolver_newton ;
304 <<
"Root findind algoritms to be used: "
305 <<
"'gsl_multiroot_fdfsolver_newton'"
308 else if (
"fdfsolver_gnewton" ==
m_algType )
310 m_type = gsl_multiroot_fdfsolver_gnewton ;
312 <<
"Root findind algoritms to be used: "
313 <<
"'gsl_multiroot_fdfsolver_gnewton'"
318 return Error(
" Unknown algorith type '"
Definition of the MsgStream class used to transmit messages.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
bool isFailure() const
Test for a status code of FAILURE.
This class is used for returning status codes from appropriate routines.
const gsl_multiroot_fdfsolver_type * m_type
StatusCode EqSolver::solver |
( |
const Equations & |
funcs, |
|
|
Arg & |
arg |
|
) |
| const |
|
override |
Solving nonlinear system with N equations in N unknowns of the function "GenFunc".
Solving nonlinear system of the function "GenFunc".
- See also
- IEqSolver.h
- Returns
- StatusCode
Definition at line 188 of file EqSolver.cpp.
194 gsl_vector_view vect = gsl_vector_view_array ( &arg[0] ,
198 EqSolverMisc local (funcs, arg);
200 const gsl_multiroot_fdfsolver_type *T =
m_type;
201 gsl_multiroot_fdfsolver *
s;
205 gsl_multiroot_function_fdf
function;
207 function.f = &fun_gsl;
208 function.df = &dfun_gsl;
209 function.fdf = &fdfun_gsl;
210 function.n = vect.vector.size;
211 function.params = (
void*) &local;
213 s = gsl_multiroot_fdfsolver_alloc(T, vect.vector.size);
214 gsl_multiroot_fdfsolver_set (s, &
function, &vect.vector);
218 status = gsl_multiroot_fdfsolver_iterate (s);
222 (
"Error from gsl_gsl_multiroot_fdfsolver_iterate '"
223 + std::string(gsl_strerror(status)) +
"'") ;
226 status = gsl_multiroot_test_residual (s->f,
229 if ( status != GSL_CONTINUE ) {
break; }
232 for (
unsigned int i = 0;
i < vect.vector.size; ++
i)
234 gsl_vector_set (&vect.vector,
i, gsl_vector_get (s->x,
i));
237 if (status == GSL_SUCCESS)
240 <<
"We stopped in the method on the " << iter
241 <<
" iteration (we have maximum " << m_max_iter
242 <<
" iterations)" <<
endmsg;
244 else if (status == GSL_CONTINUE && iter <= m_max_iter )
246 return Error (
"Method finished with '"
247 + std::string(gsl_strerror(status))
252 return Error (
"Method finished with '" +
253 std::string(gsl_strerror(status))
257 gsl_multiroot_fdfsolver_free (s);
261 return Error (
"Method finished with '"
262 + std::string(gsl_strerror(status))
Definition of the MsgStream class used to transmit messages.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
const gsl_multiroot_fdfsolver_type * m_type
std::string EqSolver::m_algType |
|
private |
double EqSolver::m_max_iter |
|
private |
double EqSolver::m_norm_residual |
|
private |
const gsl_multiroot_fdfsolver_type* EqSolver::m_type |
|
private |
The documentation for this class was generated from the following files: