#ifndef ROOT_Math_IntegratorOptions
#define ROOT_Math_IntegratorOptions
#ifndef ROOT_Math_AllIntegrationTypes
#include "Math/AllIntegrationTypes.h"
#endif
#include <string>
#include <iostream>
namespace ROOT {
namespace Math {
class IOptions;
class BaseIntegratorOptions {
protected:
BaseIntegratorOptions();
public:
BaseIntegratorOptions(const BaseIntegratorOptions & opt);
BaseIntegratorOptions & operator=(const BaseIntegratorOptions & opt);
virtual ~BaseIntegratorOptions() { ClearExtra(); }
virtual std::string Integrator() const = 0;
double AbsTolerance() const { return fAbsTolerance; }
double RelTolerance() const { return fRelTolerance; }
unsigned int WKSize() const { return fWKSize; }
IOptions * ExtraOptions() const { return fExtraOptions; }
void SetAbsTolerance(double tol) { fAbsTolerance = tol; }
void SetRelTolerance(double tol) { fRelTolerance = tol; }
void SetWKSize(unsigned int size) { fWKSize = size; }
void SetExtraOptions(const IOptions & opt);
protected:
void ClearExtra();
int fIntegType;
unsigned int fWKSize;
unsigned int fNCalls;
double fAbsTolerance;
double fRelTolerance;
ROOT::Math::IOptions * fExtraOptions;
};
class IntegratorOneDimOptions : public BaseIntegratorOptions {
public:
IntegratorOneDimOptions(IOptions * extraOpts = 0);
virtual ~IntegratorOneDimOptions() {}
IntegratorOneDimOptions(const IntegratorOneDimOptions & rhs) :
BaseIntegratorOptions(rhs)
{}
IntegratorOneDimOptions & operator=(const IntegratorOneDimOptions & rhs) {
if (this == &rhs) return *this;
static_cast<BaseIntegratorOptions &>(*this) = rhs;
return *this;
}
void SetNPoints(unsigned int n) { fNCalls = n; }
unsigned int NPoints() const { return fNCalls; }
std::string Integrator() const;
IntegrationOneDim::Type IntegratorType() const { return (IntegrationOneDim::Type) fIntegType; }
void SetIntegrator(const char * name);
void Print(std::ostream & os = std::cout) const;
static void SetDefaultIntegrator(const char * name);
static void SetDefaultAbsTolerance(double tol);
static void SetDefaultRelTolerance(double tol);
static void SetDefaultWKSize(unsigned int size);
static void SetDefaultNPoints(unsigned int n);
static std::string DefaultIntegrator();
static IntegrationOneDim::Type DefaultIntegratorType();
static double DefaultAbsTolerance();
static double DefaultRelTolerance();
static unsigned int DefaultWKSize();
static unsigned int DefaultNPoints();
static ROOT::Math::IOptions & Default(const char * name);
static ROOT::Math::IOptions * FindDefault(const char * name);
static void PrintDefault(const char * name = 0, std::ostream & os = std::cout);
private:
};
class IntegratorMultiDimOptions : public BaseIntegratorOptions {
public:
IntegratorMultiDimOptions(IOptions * extraOpts = 0);
virtual ~IntegratorMultiDimOptions() {}
IntegratorMultiDimOptions(const IntegratorMultiDimOptions & rhs) :
BaseIntegratorOptions(rhs)
{}
IntegratorMultiDimOptions & operator=(const IntegratorMultiDimOptions & rhs) {
if (this == &rhs) return *this;
static_cast<BaseIntegratorOptions &>(*this) = rhs;
return *this;
}
void SetNCalls(unsigned int calls) { fNCalls = calls; }
unsigned int NCalls() const { return fNCalls; }
std::string Integrator() const;
IntegrationMultiDim::Type IntegratorType() const { return (IntegrationMultiDim::Type) fIntegType; }
void SetIntegrator(const char * name);
void Print(std::ostream & os = std::cout) const;
static void SetDefaultIntegrator(const char * name);
static void SetDefaultAbsTolerance(double tol);
static void SetDefaultRelTolerance(double tol);
static void SetDefaultWKSize(unsigned int size);
static void SetDefaultNCalls(unsigned int ncall);
static std::string DefaultIntegrator();
static IntegrationMultiDim::Type DefaultIntegratorType();
static double DefaultAbsTolerance();
static double DefaultRelTolerance();
static unsigned int DefaultWKSize();
static unsigned int DefaultNCalls();
static ROOT::Math::IOptions & Default(const char * name);
static ROOT::Math::IOptions * FindDefault(const char * name);
static void PrintDefault(const char * name = 0, std::ostream & os = std::cout);
private:
};
}
}
#endif