Commit a2b35daff8ddf2cf620c76d5346fe98dc726fc35
1 parent
f32c9504
implement dummy flux() and dummy mc() methods
Showing
2 changed files
with
102 additions
and
4 deletions
src/model/GModelSpectralExpPlaw.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GModelSpectralExpPlaw.cpp - Exponential cut off power law model * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2010 by Jurgen Knodlseder * | |
| 4 | + * copyright (C) 2010-2011 by Jurgen Knodlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software; you can redistribute it and/or modify * |
| ... | ... | @@ -26,7 +26,8 @@ |
| 26 | 26 | #include "GModelSpectralExpPlaw.hpp" |
| 27 | 27 | |
| 28 | 28 | /* __ Method name definitions ____________________________________________ */ |
| 29 | -#define G_PAR "GModelSpectralExpPlaw::par(int)" | |
| 29 | +#define G_FLUX "GModelSpectralExpPlaw::flux(GEnergy&, GEnergy&)" | |
| 30 | +#define G_MC "GModelSpectralExpPlaw::mc(GEnergy&, GEnergy&, GRan&)" | |
| 30 | 31 | #define G_READ "GModelSpectralExpPlaw::read(GXmlElement&)" |
| 31 | 32 | #define G_WRITE "GModelSpectralExpPlaw::write(GXmlElement&)" |
| 32 | 33 | |
| ... | ... | @@ -289,6 +290,54 @@ double GModelSpectralExpPlaw::eval_gradients(const GEnergy& srcEng) |
| 289 | 290 | |
| 290 | 291 | |
| 291 | 292 | /***********************************************************************//** |
| 293 | + * @brief Returns model flux between [emin, emax] (units: ph/cm2/s) | |
| 294 | + * | |
| 295 | + * @param[in] emin Minimum photon energy. | |
| 296 | + * @param[in] emax Maximum photon energy. | |
| 297 | + * | |
| 298 | + * Computes | |
| 299 | + * \f[\int_{E_{\rm min}}^{E_{\rm max}} I(E) dE\f] | |
| 300 | + * where | |
| 301 | + * \f$E_{\rm min}\f$ and \f$E_{\rm max}\f$ are the minimum and maximum | |
| 302 | + * energy, respectively, and | |
| 303 | + * \f$I(E)\f$ is the spectral model (units: ph/cm2/s/MeV). | |
| 304 | + * | |
| 305 | + * @todo Implement method | |
| 306 | + ***************************************************************************/ | |
| 307 | +double GModelSpectralExpPlaw::flux(const GEnergy& emin, const GEnergy& emax) const | |
| 308 | +{ | |
| 309 | + // Dump warning that method is not yet implemented | |
| 310 | + throw GException::feature_not_implemented(G_FLUX); | |
| 311 | + | |
| 312 | + // Return | |
| 313 | + return 0.0; | |
| 314 | +} | |
| 315 | + | |
| 316 | + | |
| 317 | +/***********************************************************************//** | |
| 318 | + * @brief Returns MC energy between [emin, emax] | |
| 319 | + * | |
| 320 | + * @param[in] emin Minimum photon energy. | |
| 321 | + * @param[in] emax Maximum photon energy. | |
| 322 | + * @param[in] ran Random number generator. | |
| 323 | + * | |
| 324 | + * @todo To be implemented | |
| 325 | + ***************************************************************************/ | |
| 326 | +GEnergy GModelSpectralExpPlaw::mc(const GEnergy& emin, const GEnergy& emax, | |
| 327 | + GRan& ran) const | |
| 328 | +{ | |
| 329 | + // Allocate energy | |
| 330 | + GEnergy energy; | |
| 331 | + | |
| 332 | + // Dump warning that method is not yet implemented | |
| 333 | + throw GException::feature_not_implemented(G_MC); | |
| 334 | + | |
| 335 | + // Return energy | |
| 336 | + return energy; | |
| 337 | +} | |
| 338 | + | |
| 339 | + | |
| 340 | +/***********************************************************************//** | |
| 292 | 341 | * @brief Autoscale normalization |
| 293 | 342 | * |
| 294 | 343 | * Set the internal scaling of the normalization parameter so that the | ... | ... |
src/model/GModelSpectralFunc.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GModelSpectralFunc.cpp - Spectral function model class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2010 by Jurgen Knodlseder * | |
| 4 | + * copyright (C) 2010-2011 by Jurgen Knodlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software; you can redistribute it and/or modify * |
| ... | ... | @@ -27,7 +27,8 @@ |
| 27 | 27 | #include "GModelSpectralFunc.hpp" |
| 28 | 28 | |
| 29 | 29 | /* __ Method name definitions ____________________________________________ */ |
| 30 | -#define G_PAR "GModelSpectralFunc::par(int)" | |
| 30 | +#define G_FLUX "GModelSpectralFunc::flux(GEnergy&, GEnergy&)" | |
| 31 | +#define G_MC "GModelSpectralFunc::mc(GEnergy&, GEnergy&, GRan&)" | |
| 31 | 32 | #define G_READ "GModelSpectralFunc::read(GXmlElement&)" |
| 32 | 33 | #define G_WRITE "GModelSpectralFunc::write(GXmlElement&)" |
| 33 | 34 | #define G_LOAD_NODES "GModelSpectralFunc::load_nodes(std::string&)" |
| ... | ... | @@ -262,6 +263,54 @@ double GModelSpectralFunc::eval_gradients(const GEnergy& srcEng) |
| 262 | 263 | |
| 263 | 264 | |
| 264 | 265 | /***********************************************************************//** |
| 266 | + * @brief Returns model flux between [emin, emax] (units: ph/cm2/s) | |
| 267 | + * | |
| 268 | + * @param[in] emin Minimum photon energy. | |
| 269 | + * @param[in] emax Maximum photon energy. | |
| 270 | + * | |
| 271 | + * Computes | |
| 272 | + * \f[\int_{E_{\rm min}}^{E_{\rm max}} I(E) dE\f] | |
| 273 | + * where | |
| 274 | + * \f$E_{\rm min}\f$ and \f$E_{\rm max}\f$ are the minimum and maximum | |
| 275 | + * energy, respectively, and | |
| 276 | + * \f$I(E)\f$ is the spectral model (units: ph/cm2/s/MeV). | |
| 277 | + * | |
| 278 | + * @todo Implement method | |
| 279 | + ***************************************************************************/ | |
| 280 | +double GModelSpectralFunc::flux(const GEnergy& emin, const GEnergy& emax) const | |
| 281 | +{ | |
| 282 | + // Dump warning that method is not yet implemented | |
| 283 | + throw GException::feature_not_implemented(G_FLUX); | |
| 284 | + | |
| 285 | + // Return | |
| 286 | + return 0.0; | |
| 287 | +} | |
| 288 | + | |
| 289 | + | |
| 290 | +/***********************************************************************//** | |
| 291 | + * @brief Returns MC energy between [emin, emax] | |
| 292 | + * | |
| 293 | + * @param[in] emin Minimum photon energy. | |
| 294 | + * @param[in] emax Maximum photon energy. | |
| 295 | + * @param[in] ran Random number generator. | |
| 296 | + * | |
| 297 | + * @todo To be implemented | |
| 298 | + ***************************************************************************/ | |
| 299 | +GEnergy GModelSpectralFunc::mc(const GEnergy& emin, const GEnergy& emax, | |
| 300 | + GRan& ran) const | |
| 301 | +{ | |
| 302 | + // Allocate energy | |
| 303 | + GEnergy energy; | |
| 304 | + | |
| 305 | + // Dump warning that method is not yet implemented | |
| 306 | + throw GException::feature_not_implemented(G_MC); | |
| 307 | + | |
| 308 | + // Return energy | |
| 309 | + return energy; | |
| 310 | +} | |
| 311 | + | |
| 312 | + | |
| 313 | +/***********************************************************************//** | |
| 265 | 314 | * @brief Read model from XML element |
| 266 | 315 | * |
| 267 | 316 | * @param[in] xml XML element containing power law model information. | ... | ... |