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