EqSolver Class Reference

The simplest concrete implementation of IEqSolver interface. More...

#include <src/Components/EqSolver.h>

Inheritance diagram for EqSolver:
Collaboration diagram for EqSolver:

Classes

class  EqSolverMisc
 

Public Types

typedef std::vector< Equations > Jacobi
 
- Public Types inherited from extends< GaudiTool, IEqSolver >
using base_class = extends
 Typedef to this class. More...
 
using extend_interfaces_base = extend_interfaces< Interfaces...>
 Typedef to the base of this class. More...
 
- Public Types inherited from AlgTool
typedef Gaudi::PluginService::Factory< IAlgTool *, const std::string &, const std::string &, const IInterface * > Factory
 
- Public Types inherited from CommonMessaging< implements< IAlgTool, IDataHandleHolder, IProperty, IStateful > >
using base_class = CommonMessaging
 
- Public Types inherited from extend_interfaces< Interfaces...>
using ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids...>::type
 take union of the ext_iids of all Interfaces... More...
 

Public Member Functions

StatusCode solver (const Equations &funcs, Arg &arg) const override
 Solving nonlinear system with N equations in N unknowns of the function "GenFunc". More...
 
StatusCode initialize () override
 Overriding initialize. More...
 
StatusCode finalize () override
 
 ~EqSolver () override
 Destructor. More...
 
 EqSolver (const std::string &type, const std::string &name, const IInterface *parent)
 Standard constructor. More...
 
- Public Member Functions inherited from extends< GaudiTool, IEqSolver >
void * i_cast (const InterfaceID &tid) const override
 Implementation of IInterface::i_cast. More...
 
StatusCode queryInterface (const InterfaceID &ti, void **pp) override
 Implementation of IInterface::queryInterface. More...
 
std::vector< std::stringgetInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames. More...
 
 ~extends () override=default
 Virtual destructor. More...
 
- Public Member Functions inherited from GaudiTool
StatusCode initialize () override
 standard initialization method More...
 
StatusCode finalize () override
 standard finalization method More...
 
INTupleSvcntupleSvc () const
 Access the standard N-Tuple. More...
 
INTupleSvcevtColSvc () const
 Access the standard event collection service. More...
 
IDataProviderSvcdetSvc () const
 accessor to detector service More...
 
IIncidentSvcincSvc () const
 accessor to Incident Service More...
 
IChronoStatSvcchronoSvc () const
 accessor to Chrono & Stat Service More...
 
IHistogramSvchistoSvc () const
 acessor to the histogram service More...
 
IAlgContextSvccontextSvc () const
 acessor to the Algorithm Context Service More...
 
DataObjectput (IDataProviderSvc *svc, DataObject *object, const std::string &address, const bool useRootInTES=true) const
 Register a data object or container into Gaudi Event Transient Store. More...
 
DataObjectput (DataObject *object, const std::string &address, const bool useRootInTES=true) const
 Register a data object or container into Gaudi Event Transient Store. More...
 
template<class TYPE >
Gaudi::Utils::GetData< TYPE >::return_type get (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const
 Templated access to the data in Gaudi Transient Store. More...
 
template<class TYPE >
Gaudi::Utils::GetData< TYPE >::return_type getIfExists (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const
 Templated access to the data in Gaudi Transient Store. More...
 
template<class TYPE >
Gaudi::Utils::GetData< TYPE >::return_type get (const std::string &location, const bool useRootInTES=true) const
 Templated access to the data from Gaudi Event Transient Store. More...
 
template<class TYPE >
Gaudi::Utils::GetData< TYPE >::return_type getIfExists (const std::string &location, const bool useRootInTES=true) const
 Templated access to the data in Gaudi Transient Store. More...
 
template<class TYPE >
TYPE * getDet (IDataProviderSvc *svc, const std::string &location) const
 Templated access to the detector data from the Gaudi Detector Transient Store. More...
 
template<class TYPE >
Gaudi::Utils::GetData< TYPE >::return_type getDetIfExists (IDataProviderSvc *svc, const std::string &location) const
 Templated access to the detector data from the Gaudi Detector Transient Store. More...
 
template<class TYPE >
TYPE * getDet (const std::string &location) const
 Templated access to the detector data from the Gaudi Detector Transient Store. More...
 
template<class TYPE >
Gaudi::Utils::GetData< TYPE >::return_type getDetIfExists (const std::string &location) const
 Templated access to the detector data from the Gaudi Detector Transient Store. More...
 
template<class TYPE >
bool exist (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const
 Check the existence of a data object or container in the Gaudi Transient Event Store. More...
 
template<class TYPE >
bool exist (const std::string &location, const bool useRootInTES=true) const
 Check the existence of a data object or container in the Gaudi Transient Event Store. More...
 
template<class TYPE >
bool existDet (IDataProviderSvc *svc, const std::string &location) const
 Check the existence of detector objects in the Gaudi Transient Detector Store. More...
 
template<class TYPE >
bool existDet (const std::string &location) const
 Check the existence of detector objects in the Gaudi Transient Detector Store. More...
 
template<class TYPE , class TYPE2 >
Gaudi::Utils::GetData< TYPE >::return_type getOrCreate (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const
 Get the existing data object from Gaudi Event Transient store. More...
 
template<class TYPE , class TYPE2 >
Gaudi::Utils::GetData< TYPE >::return_type getOrCreate (const std::string &location, const bool useRootInTES=true) const
 Get the existing data object from Gaudi Event Transient store. More...
 
StatusCode Error (const std::string &msg, const StatusCode st=StatusCode::FAILURE, const size_t mx=10) const
 Print the error message and return with the given StatusCode. More...
 
StatusCode Warning (const std::string &msg, const StatusCode st=StatusCode::FAILURE, const size_t mx=10) const
 Print the warning message and return with the given StatusCode. More...
 
StatusCode Info (const std::string &msg, const StatusCode st=StatusCode::SUCCESS, const size_t mx=10) const
 Print the info message and return with the given StatusCode. More...
 
template<class T >
PropertydeclareProperty (const std::string &name, DataObjectHandle< T > &hndl, const std::string &doc="none") const
 
- Public Member Functions inherited from GaudiCommon< AlgTool >
Gaudi::Utils::GetData< TYPE >::return_type get (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const
 Templated access to the data in Gaudi Transient Store. More...
 
Gaudi::Utils::GetData< TYPE >::return_type getIfExists (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const
 Quicker version of the get function which bypasses the check on the retrieved data. More...
 
bool exist (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const
 Check the existence of a data object or container in the Gaudi Transient Event Store. More...
 
Gaudi::Utils::GetData< TYPE >::return_type getOrCreate (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const
 Get the existing data object from Gaudi Event Transient store. More...
 
DataObjectput (IDataProviderSvc *svc, DataObject *object, const std::string &location, const bool useRootInTES=true) const
 Register a data object or container into Gaudi Event Transient Store. More...
 
TOOL * tool (const std::string &type, const std::string &name, const IInterface *parent=0, bool create=true) const
 Useful method for the easy location of tools. More...
 
TOOL * tool (const std::string &type, const IInterface *parent=0, bool create=true) const
 A useful method for the easy location of tools. More...
 
SmartIF< SERVICE > svc (const std::string &name, const bool create=true) const
 A useful method for the easy location of services. More...
 
IUpdateManagerSvcupdMgrSvc () const
 Short-cut to locate the Update Manager Service. More...
 
StatusCode Error (const std::string &msg, const StatusCode st=StatusCode::FAILURE, const size_t mx=10) const
 Print the error message and return with the given StatusCode. More...
 
StatusCode Warning (const std::string &msg, const StatusCode st=StatusCode::FAILURE, const size_t mx=10) const
 Print the warning message and return with the given StatusCode. More...
 
StatusCode Info (const std::string &msg, const StatusCode st=StatusCode::SUCCESS, const size_t mx=10) const
 Print the info message and return with the given StatusCode. More...
 
StatusCode Print (const std::string &msg, const StatusCode st=StatusCode::SUCCESS, const MSG::Level lev=MSG::INFO) const
 Print the message and return with the given StatusCode. More...
 
void Assert (const bool ok, const std::string &message="", const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const
 Assertion - throw exception if the given condition is not fulfilled. More...
 
void Assert (const bool ok, const char *message, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const
 Assertion - throw exception if the given condition is not fulfilled. More...
 
void Exception (const std::string &msg, const GaudiException &exc, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const
 Create and (re)-throw a given GaudiException. More...
 
void Exception (const std::string &msg, const std::exception &exc, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const
 Create and (re)-throw a given exception. More...
 
void Exception (const std::string &msg="no message", const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const
 Create and throw an exception with the given message. More...
 
const Statisticscounters () const
 accessor to all counters More...
 
StatEntitycounter (const std::string &tag) const
 accessor to certain counter by name More...
 
bool typePrint () const
 Insert the actual C++ type of the algorithm/tool in the messages ? More...
 
bool propsPrint () const
 Print properties at initialization ? More...
 
bool statPrint () const
 Print statistical counters at finalization ? More...
 
bool errorsPrint () const
 Print error counters at finalization ? More...
 
long printStat (const MSG::Level level=MSG::ALWAYS) const
 perform the actual printout of statistical counters More...
 
long printErrors (const MSG::Level level=MSG::ALWAYS) const
 perform the actual printout of error counters More...
 
long printProps (const MSG::Level level=MSG::ALWAYS) const
 perform the actual printout of properties More...
 
void registerCondition (const std::string &condition, StatusCode(CallerClass::*mf)()=nullptr)
 register the current instance to the UpdateManagerSvc as a consumer for a condition. More...
 
void registerCondition (const std::string &condition, CondType *&condPtrDest, StatusCode(CallerClass::*mf)()=NULL)
 register the current instance to the UpdateManagerSvc as a consumer for a condition. More...
 
void registerCondition (char *condition, StatusCode(CallerClass::*mf)()=NULL)
 just to avoid conflicts with the version using a pointer to a template class. More...
 
void registerCondition (TargetClass *condition, StatusCode(CallerClass::*mf)()=NULL)
 register the current instance to the UpdateManagerSvc as a consumer for a condition. More...
 
StatusCode runUpdate ()
 asks the UpdateManagerSvc to perform an update of the instance (if needed) without waiting the next BeginEvent incident. More...
 
 GaudiCommon (const std::string &name, ISvcLocator *pSvcLocator)
 Algorithm constructor. More...
 
 GaudiCommon (const std::string &type, const std::string &name, const IInterface *parent)
 Tool constructor. More...
 
StatusCode initialize () override
 standard initialization method More...
 
StatusCode finalize () override
 standard finalization method More...
 
StatusCode release (const IInterface *interface) const
 Manual forced (and 'safe') release of the active tool or service. More...
 
const Servicesservices () const
 get the list of aquired services More...
 
const std::stringcontext () const
 Returns the "context" string. Used to identify different processing states. More...
 
const std::stringrootInTES () const
 Returns the "rootInTES" string. More...
 
const std::string fullTESLocation (const std::string &location, const bool useRootInTES) const
 Returns the full correct event location given the rootInTes settings. More...
 
- Public Member Functions inherited from AlgTool
StatusCode queryInterface (const InterfaceID &riid, void **ppvUnknown) override
 Query for a given interface. More...
 
const std::stringname () const override
 Retrieve full identifying name of the concrete tool object. More...
 
const std::stringtype () const override
 Retrieve type (concrete class) of the sub-algtool. More...
 
const IInterfaceparent () const override
 Retrieve parent of the sub-algtool. More...
 
StatusCode configure () override
 
StatusCode initialize () override
 
StatusCode start () override
 
StatusCode stop () override
 
StatusCode finalize () override
 
StatusCode terminate () override
 
StatusCode reinitialize () override
 
StatusCode restart () override
 
Gaudi::StateMachine::State FSMState () const override
 
Gaudi::StateMachine::State targetFSMState () const override
 
StatusCode sysInitialize () override
 Initialize AlgTool. More...
 
StatusCode sysStart () override
 Start AlgTool. More...
 
StatusCode sysStop () override
 Stop AlgTool. More...
 
StatusCode sysFinalize () override
 Finalize AlgTool. More...
 
StatusCode sysReinitialize () override
 Initialize AlgTool. More...
 
StatusCode sysRestart () override
 Start AlgTool. More...
 
StatusCode setProperty (const Property &p) override
 Default implementations for IProperty interface. More...
 
StatusCode setProperty (const std::string &s) override
 
StatusCode setProperty (const std::string &n, const std::string &v) override
 
StatusCode getProperty (Property *p) const override
 
const PropertygetProperty (const std::string &name) const override
 
StatusCode getProperty (const std::string &n, std::string &v) const override
 
const std::vector< Property * > & getProperties () const override
 
bool hasProperty (const std::string &name) const override
 
PropertyMgrgetPropertyMgr () const
 
template<class TYPE >
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value More...
 
 AlgTool (const std::string &type, const std::string &name, const IInterface *parent)
 Standard Constructor. More...
 
SmartIF< ISvcLocator > & serviceLocator () const override
 Retrieve pointer to service locator. More...
 
ISvcLocatorsvcLoc () const
 shortcut for the method service locator More...
 
IDataProviderSvcevtSvc () const
 accessor to event service service More...
 
IToolSvctoolSvc () const
 The standard ToolSvc service, Return a pointer to the service if present. More...
 
StatusCode setProperties ()
 Method for setting declared properties to the values specified in the jobOptions via the job option service. More...
 
template<class T >
StatusCode service (const std::string &name, T *&svc, bool createIf=true) const
 Access a service by name, creating it if it doesn't already exist. More...
 
template<class T >
StatusCode service (const std::string &type, const std::string &name, T *&svc) const
 Access a service by name, type creating it if it doesn't already exist. More...
 
SmartIF< IServiceservice (const std::string &name, const bool createIf=true, const bool quiet=false) const
 Return a pointer to the service identified by name (or "type/name") More...
 
template<typename T >
SmartIF< T > service (const std::string &name, const bool createIf=true, const bool quiet=false) const
 
template<class T >
PropertydeclareProperty (const std::string &name, T &property, const std::string &doc="none") const
 Declare the named property. More...
 
PropertydeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
 Declare remote named properties. More...
 
template<class T >
PropertydeclareProperty (const std::string &name, ToolHandle< T > &hndl, const std::string &doc="none") const
 
template<class T >
StatusCode declareTool (ToolHandle< T > &handle, std::string toolTypeAndName="", bool createIf=true)
 
template<class T >
PropertydeclareProperty (const std::string &name, ToolHandleArray< T > &hndlArr, const std::string &doc="none") const
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 
virtual const DataObjIDCollextraInputDeps () const override
 
virtual const DataObjIDCollextraOutputDeps () const override
 
virtual void acceptDHVisitor (IDataHandleVisitor *) const override
 
DataObjIDColl inputDataObjs () const
 
DataObjIDColl outputDataObjs () const
 
void commitHandles () override
 
void registerTool (IAlgTool *tool) const
 
void deregisterTool (IAlgTool *tool) const
 
template<class T >
StatusCode declarePublicTool (ToolHandle< T > &handle, std::string toolTypeAndName="", bool createIf=true)
 Declare used public tool. More...
 
template<class T >
StatusCode declarePrivateTool (ToolHandle< T > &handle, std::string toolTypeAndName="", bool createIf=true)
 Declare used private tool. More...
 
const std::vector< IAlgTool * > & tools () const
 
IAuditorSvcauditorSvc () const
 Access the auditor service. More...
 
IMonitorSvcmonitorSvc () const
 Access the monitor service. More...
 
template<class T >
void declareInfo (const std::string &name, const T &var, const std::string &desc) const
 Declare monitoring information. More...
 
void declareInfo (const std::string &name, const std::string &format, const void *var, int size, const std::string &desc) const
 Declare monitoring information (special case) More...
 
 ~AlgTool () override
 
- Public Member Functions inherited from CommonMessagingBase
virtual ~CommonMessagingBase ()=default
 Virtual destructor. More...
 
SmartIF< IMessageSvc > & msgSvc () const
 The standard message service. More...
 
MsgStreammsgStream () const
 Return an uninitialized MsgStream. More...
 
MsgStreammsgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts. More...
 
MsgStreamalways () const
 shortcut for the method msgStream(MSG::ALWAYS) More...
 
MsgStreamfatal () const
 shortcut for the method msgStream(MSG::FATAL) More...
 
MsgStreamerr () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamerror () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamwarning () const
 shortcut for the method msgStream(MSG::WARNING) More...
 
MsgStreaminfo () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MsgStreamdebug () const
 shortcut for the method msgStream(MSG::DEBUG) More...
 
MsgStreamverbose () const
 shortcut for the method msgStream(MSG::VERBOSE) More...
 
MsgStreammsg () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MSG::Level msgLevel () const
 get the output level from the embedded MsgStream More...
 
MSG::Level outputLevel () const __attribute__((deprecated))
 Backward compatibility function for getting the output level. More...
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream More...
 
- Public Member Functions inherited from extend_interfaces< Interfaces...>
 ~extend_interfaces () override=default
 Virtual destructor. More...
 

Private Member Functions

 EqSolver ()
 default constructor is private More...
 
 EqSolver (const EqSolver &)
 copy constructor is private More...
 
EqSolveroperator= (const EqSolver &)
 assignment operator is More...
 

Private Attributes

std::string m_algType
 
double m_max_iter
 
double m_norm_residual
 
const gsl_multiroot_fdfsolver_type * m_type
 

Additional Inherited Members

- Static Public Member Functions inherited from GaudiTool
static bool enableSummary (bool)
 enable/disable summary More...
 
static bool summaryEnabled ()
 is summary enabled? More...
 
- Protected Types inherited from GaudiCommon< AlgTool >
using base_class = AlgTool
 
typedef std::map< std::string, StatEntityStatistics
 the actual type of general counters More...
 
typedef std::map< std::string, unsigned int > Counter
 the actual type error/warning counter More...
 
typedef std::vector< IAlgTool * > AlgTools
 storage for active tools More...
 
typedef std::vector< SmartIF< IService > > Services
 storage for active services More...
 
- Protected Member Functions inherited from GaudiTool
 GaudiTool (const std::string &type, const std::string &name, const IInterface *parent)
 Standard constructor. More...
 
 ~GaudiTool () override
 destructor, virtual and protected More...
 
- Protected Member Functions inherited from GaudiCommon< AlgTool >
 ~GaudiCommon () override=default
 Destructor. More...
 
StatusCode releaseTool (const IAlgTool *tool) const
 manual forced (and 'safe') release of the tool More...
 
StatusCode releaseSvc (const IInterface *svc) const
 manual forced (and 'safe') release of the service More...
 
- Protected Member Functions inherited from AlgTool
template<typename I >
void declareInterface (I *i)
 
virtual void declareInput (Gaudi::DataHandle *im) override
 
virtual void declareOutput (Gaudi::DataHandle *im) override
 
std::vector< IAlgTool * > & tools ()
 
- Protected Member Functions inherited from CommonMessaging< implements< IAlgTool, IDataHandleHolder, IProperty, IStateful > >
void updateMsgStreamOutputLevel (int level)
 Update the output level of the cached MsgStream. More...
 
- Protected Attributes inherited from GaudiCommon< AlgTool >
SmartIF< ICounterSummarySvcm_counterSummarySvc
 a pointer to the CounterSummarySvc More...
 
std::vector< std::stringm_counterList
 list of counters to declare. Set by property CounterList. This can be a regular expression. More...
 
std::vector< std::stringm_statEntityList
 
- Protected Attributes inherited from AlgTool
std::unique_ptr< IDataHandleVisitorm_updateDataHandles
 Hook for for derived classes to provide a custom visitor for data handles. More...
 
SmartIF< PropertyMgrm_propertyMgr
 Property Manager. More...
 
- Static Protected Attributes inherited from GaudiCommon< AlgTool >
static const bool IgnoreRootInTES
 Simple definition to be used with the new useRootInTES argument get<TYPE> and put methods. More...
 
static const bool UseRootInTES
 Simple definition to be used with the new useRootInTES argument get<TYPE> and put methods. More...
 

Detailed Description

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.

Member Typedef Documentation

typedef std::vector<Equations> EqSolver::Jacobi

Definition at line 26 of file EqSolver.h.

Constructor & Destructor Documentation

EqSolver::~EqSolver ( )
override

Destructor.

Definition at line 338 of file EqSolver.cpp.

339 {}
EqSolver::EqSolver ( const std::string type,
const std::string name,
const IInterface parent 
)

Standard constructor.

See also
GaudiTool
Parameters
typetool type
nametool name
parentparent 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.

75  : base_class ( type, name , parent )
76  , m_algType ( "fdfsolver_hybridsj" )
77  , m_max_iter ( 1000 )
78  , m_norm_residual ( 1.0e-7 )
79  , m_type ( nullptr )
80 
81 {
83  declareProperty ( "Algorithm", m_algType );
85  declareProperty ( "Iteration", m_max_iter );
87  declareProperty ( "Residual" , m_norm_residual );
88 }
extends base_class
Typedef to this class.
Definition: extends.h:14
std::string m_algType
Definition: EqSolver.h:93
double m_norm_residual
Definition: EqSolver.h:95
Property * declareProperty(const std::string &name, DataObjectHandle< T > &hndl, const std::string &doc="none") const
Definition: GaudiTool.h:834
double m_max_iter
Definition: EqSolver.h:94
const gsl_multiroot_fdfsolver_type * m_type
Definition: EqSolver.h:96
EqSolver::EqSolver ( )
private

default constructor is private

EqSolver::EqSolver ( const EqSolver )
private

copy constructor is private

Member Function Documentation

StatusCode EqSolver::finalize ( )
override

Definition at line 325 of file EqSolver.cpp.

326 {
328 
329  MsgStream log( msgSvc() , name() ) ;
330 
331  if ( sc.isFailure() )
332  {
333  return Error("Could not finaliaze base class GaudiTool", sc);
334  }
335  return StatusCode::SUCCESS;
336 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode Error(const std::string &msg, const StatusCode st=StatusCode::FAILURE, const size_t mx=10) const
Print the error message and return with the given StatusCode.
Definition: GaudiTool.h:689
StatusCode finalize() override
standard finalization method
Definition: GaudiTool.cpp:179
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
const std::string & name() const override
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:65
StatusCode EqSolver::initialize ( )
override

Overriding initialize.

Definition at line 270 of file EqSolver.cpp.

272 {
274 
275  MsgStream log( msgSvc() , name() ) ;
276 
277  if( sc.isFailure() )
278  {
279  return Error ("Could not initiliaze base class GaudiTool", sc);
280  }
281  /* The algorithm for multiional root-finding
282  (solving nonlinear systems with n equations in n unknowns)*/
283 
284  if( "fdfsolver_hybridsj" == m_algType )
285  {
286  m_type = gsl_multiroot_fdfsolver_hybridsj ;
287  log << MSG::DEBUG
288  << "Root findind algoritms to be used: "
289  << "'gsl_multiroot_fdfsolver_hybridsj'"
290  << endmsg;
291  }
292  else if ( "fdfsolver_hybridj" == m_algType )
293  {
294  m_type = gsl_multiroot_fdfsolver_hybridj ;
295  log << MSG::DEBUG
296  << "Root findind algoritms to be used: "
297  << "'gsl_multiroot_fdfsolver_hybridj'"
298  << endmsg;
299  }
300  else if ( "fdfsolver_newton" == m_algType )
301  {
302  m_type = gsl_multiroot_fdfsolver_newton ;
303  log << MSG::DEBUG
304  << "Root findind algoritms to be used: "
305  << "'gsl_multiroot_fdfsolver_newton'"
306  << endmsg;
307  }
308  else if ( "fdfsolver_gnewton" == m_algType )
309  {
310  m_type = gsl_multiroot_fdfsolver_gnewton ;
311  log << MSG::DEBUG
312  << "Root findind algoritms to be used: "
313  << "'gsl_multiroot_fdfsolver_gnewton'"
314  << endmsg;
315  }
316  else
317  {
318  return Error(" Unknown algorith type '"
319  + std::string(m_algType) + "'");
320  }
321 
322  return StatusCode::SUCCESS;
323 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
STL class.
std::string m_algType
Definition: EqSolver.h:93
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode Error(const std::string &msg, const StatusCode st=StatusCode::FAILURE, const size_t mx=10) const
Print the error message and return with the given StatusCode.
Definition: GaudiTool.h:689
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
const gsl_multiroot_fdfsolver_type * m_type
Definition: EqSolver.h:96
const std::string & name() const override
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:65
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode initialize() override
standard initialization method
Definition: GaudiTool.cpp:161
EqSolver& EqSolver::operator= ( const EqSolver )
private

assignment operator is

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.

191 {
192  using namespace Genfun;
193 
194  gsl_vector_view vect = gsl_vector_view_array ( &arg[0] ,
195  arg.dimension() );
196  MsgStream log( msgSvc(), name() );
197 
198  EqSolverMisc local (funcs, arg);
199 
200  const gsl_multiroot_fdfsolver_type *T = m_type;
201  gsl_multiroot_fdfsolver *s;
202  int status = 0 ;
203  size_t iter = 0 ;
204 
205  gsl_multiroot_function_fdf function;
206 
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;
212 
213  s = gsl_multiroot_fdfsolver_alloc(T, vect.vector.size);
214  gsl_multiroot_fdfsolver_set (s, &function, &vect.vector);
215 
216  for (iter = 0; iter < m_max_iter; ++iter)
217  {
218  status = gsl_multiroot_fdfsolver_iterate (s);
219  if (status)
220  {
221  return Error
222  ("Error from gsl_gsl_multiroot_fdfsolver_iterate '"
223  + std::string(gsl_strerror(status)) + "'") ;
224  }
225 
226  status = gsl_multiroot_test_residual (s->f,
228 
229  if ( status != GSL_CONTINUE ) { break; }
230  }
231 
232  for (unsigned int i = 0; i < vect.vector.size; ++i)
233  {
234  gsl_vector_set (&vect.vector, i, gsl_vector_get (s->x, i));
235  }
236 
237  if (status == GSL_SUCCESS)
238  {
239  log << MSG::DEBUG
240  << "We stopped in the method on the " << iter
241  << " iteration (we have maximum " << m_max_iter
242  << " iterations)" << endmsg;
243  }
244  else if (status == GSL_CONTINUE && iter <= m_max_iter )
245  {
246  return Error ( "Method finished with '"
247  + std::string(gsl_strerror(status))
248  + "' error" );
249  }
250  else
251  {
252  return Error ( "Method finished with '" +
253  std::string(gsl_strerror(status))
254  + "' error" );
255  }
256 
257  gsl_multiroot_fdfsolver_free (s);
258 
259  if (status)
260  {
261  return Error ( "Method finished with '"
262  + std::string(gsl_strerror(status))
263  + "' error" );
264  }
265 
266  return GSL_SUCCESS;
267 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
STL class.
double m_norm_residual
Definition: EqSolver.h:95
double m_max_iter
Definition: EqSolver.h:94
StatusCode Error(const std::string &msg, const StatusCode st=StatusCode::FAILURE, const size_t mx=10) const
Print the error message and return with the given StatusCode.
Definition: GaudiTool.h:689
string s
Definition: gaudirun.py:245
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
const gsl_multiroot_fdfsolver_type * m_type
Definition: EqSolver.h:96
CLHEP.
Definition: IEqSolver.h:13
list i
Definition: ana.py:128
const std::string & name() const override
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:65
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

Member Data Documentation

std::string EqSolver::m_algType
private

Definition at line 93 of file EqSolver.h.

double EqSolver::m_max_iter
private

Definition at line 94 of file EqSolver.h.

double EqSolver::m_norm_residual
private

Definition at line 95 of file EqSolver.h.

const gsl_multiroot_fdfsolver_type* EqSolver::m_type
private

Definition at line 96 of file EqSolver.h.


The documentation for this class was generated from the following files: