27#ifndef GMODELSPECTRALFUNC_HPP
28#define GMODELSPECTRALFUNC_HPP
76 virtual void clear(
void);
78 virtual std::string
classname(
void)
const;
79 virtual std::string
type(
void)
const;
82 const bool& gradients =
false)
const;
96 int nodes(
void)
const;
100 void remove(
const int& index);
105 double intensity(
const int& index)
const;
109 double norm(
void)
const;
112 const bool& clobber =
false)
const;
156 return (
"GModelSpectralFunc");
170 return "FileFunction";
Energy value class definition.
Filename class interface definition.
Model parameter class interface definition.
Abstract spectral model base class interface definition.
Node array class interface definition.
double norm(const GVector &vector)
Computes vector norm.
Class that handles energies in a unit independent way.
Spectral function model class.
GModelPar m_norm
Normalization factor.
virtual void clear(void)
Clear file function.
GNodeArray m_log_nodes
log10(Energy) nodes of function
virtual double flux(const GEnergy &emin, const GEnergy &emax) const
Returns model photon flux between [emin, emax] (units: ph/cm2/s)
std::vector< double > m_flux
Photon fluxes.
int nodes(void) const
Return number of nodes in file function.
void init_members(void)
Initialise class members.
void save(const GFilename &filename, const bool &clobber=false) const
Save file function in ASCII file.
GEnergy energy(const int &index) const
Return energy of node.
virtual std::string type(void) const
Return model type.
virtual void read(const GXmlElement &xml)
Read model from XML element.
std::vector< double > m_eflux
Energy fluxes.
void set_cache(void) const
Set pre-computation cache.
void copy_members(const GModelSpectralFunc &model)
Copy class members.
void insert(const GEnergy &energy, const double &intensity)
Insert node into file function.
double intensity(const int &index) const
Return intensity of node.
std::vector< double > m_prefactor
Power-law normalisations.
virtual ~GModelSpectralFunc(void)
Destructor.
std::vector< double > m_mc_max
Upper boundary for MC.
virtual GModelSpectralFunc * clone(void) const
Clone file function.
virtual std::string classname(void) const
Return class name.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print file function information.
std::vector< double > m_lin_values
Function values at nodes.
virtual double eflux(const GEnergy &emin, const GEnergy &emax) const
Returns model energy flux between [emin, emax] (units: erg/cm2/s)
std::vector< double > m_mc_min
Lower boundary for MC.
void remove(const int &index)
Remove node from file function.
const GFilename & filename(void) const
Return file name.
void extend(const GModelSpectralFunc &filefct)
Append file function.
void load_nodes(const GFilename &filename)
Load nodes from file.
virtual double eval(const GEnergy &srcEng, const GTime &srcTime=GTime(), const bool &gradients=false) const
Evaluate function.
double norm(void) const
Return normalization factor.
std::vector< double > m_epivot
Power-law pivot energies.
void reserve(const int &num)
Reserves space for nodes in file function.
GEnergy m_mc_emax
Maximum energy.
std::vector< double > m_mc_cum
Cumulative distribution.
void mc_update(const GEnergy &emin, const GEnergy &emax) const
Set MC pre-computation cache.
std::vector< double > m_log_values
log10(Function) values at nodes
void append(const GEnergy &energy, const double &intensity)
Append node to file function.
virtual GEnergy mc(const GEnergy &emin, const GEnergy &emax, const GTime &time, GRan &ran) const
Returns MC energy between [emin, emax].
std::vector< double > m_gamma
Power-law indices.
GFilename m_filename
Name of file function.
GNodeArray m_lin_nodes
Energy nodes of function.
virtual GModelSpectralFunc & operator=(const GModelSpectralFunc &model)
Assignment operator.
std::vector< double > m_mc_exp
Exponent for MC.
virtual void write(GXmlElement &xml) const
Write model into XML element.
bool is_empty(void) const
Signals if there are nodes in file function.
void free_members(void)
Delete class members.
GEnergy m_mc_emin
Minimum energy.
GModelSpectralFunc(void)
Void constructor.
Abstract spectral model base class.
bool is_empty(void) const
Signals if there are no nodes in node array.
void reserve(const int &num)
Reserves space for nodes in node array.
int size(void) const
Return number of nodes in node array.
double value(void) const
Return parameter value.
Random number generator class.