GammaLib 2.0.0
Loading...
Searching...
No Matches
GModelSpatialRadialDisk.hpp
Go to the documentation of this file.
1/***************************************************************************
2 * GModelSpatialRadialDisk.hpp - Radial disk source model class *
3 * ----------------------------------------------------------------------- *
4 * copyright (C) 2011-2022 by Christoph Deil *
5 * ----------------------------------------------------------------------- *
6 * *
7 * This program is free software: you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation, either version 3 of the License, or *
10 * (at your option) any later version. *
11 * *
12 * This program is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU General Public License *
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
19 * *
20 ***************************************************************************/
21/**
22 * @file GModelSpatialRadialDisk.hpp
23 * @brief Radial disk model class interface definition
24 * @author Christoph Deil
25 */
26
27#ifndef GMODELSPATIALRADIALDISK_HPP
28#define GMODELSPATIALRADIALDISK_HPP
29
30/* __ Includes ___________________________________________________________ */
31#include <string>
33#include "GModelPar.hpp"
34
35/* __ Forward declarations _______________________________________________ */
36class GEnergy;
37class GTime;
38class GPhoton;
39class GRan;
40class GSkyDir;
41class GSkyRegion;
42class GXmlElement;
43
44
45/**************************************************************************
46 * @class GModelSpatialRadialDisk
47 *
48 * @brief Disk source model class
49 *
50 * This class implements the spatial component of the factorised source
51 * model for a disk source, i.e. constant surface brightness within some
52 * radius and no emission outside.
53 ***************************************************************************/
55
56public:
57 // Constructors and destructors
59 GModelSpatialRadialDisk(const bool& dummy, const std::string& type);
61 const double& radius,
62 const std::string& coordsys = "CEL");
63 explicit GModelSpatialRadialDisk(const GXmlElement& xml);
65 virtual ~GModelSpatialRadialDisk(void);
66
67 // Operators
69
70 // Implemented pure virtual base class methods
71 virtual void clear(void);
72 virtual GModelSpatialRadialDisk* clone(void) const;
73 virtual std::string classname(void) const;
74 virtual double eval(const double& theta,
75 const GEnergy& energy,
76 const GTime& time,
77 const bool& gradients = false) const;
78 virtual GSkyDir mc(const GEnergy& energy,
79 const GTime& time,
80 GRan& ran) const;
81 virtual bool contains(const GSkyDir& dir,
82 const double& margin = 0.0) const;
83 virtual double theta_max(void) const;
84 virtual void read(const GXmlElement& xml);
85 virtual void write(GXmlElement& xml) const;
86 virtual std::string print(const GChatter& chatter = NORMAL) const;
87
88 // Other methods
89 double radius(void) const;
90 void radius(const double& radius);
91
92protected:
93 // Protected methods
94 void init_members(void);
95 void copy_members(const GModelSpatialRadialDisk& model);
96 void free_members(void);
97 void update(void) const;
98 virtual void set_region(void) const;
99
100 // Protected members
101 GModelPar m_radius; //!< Disk radius (degrees)
102
103 // Cached members used for pre-computations
104 mutable double m_last_radius; //!< Last disk radius
105 mutable double m_radius_rad; //!< Radius in radians
106 mutable double m_norm; //!< Normalization
107};
108
109
110/***********************************************************************//**
111 * @brief Return class name
112 *
113 * @return String containing the class name ("GModelSpatialRadialDisk").
114 ***************************************************************************/
115inline
117{
118 return ("GModelSpatialRadialDisk");
119}
120
121
122/***********************************************************************//**
123 * @brief Return disk radius
124 *
125 * @return Disk radius (degrees).
126 *
127 * Returns the radius of the disk in degrees.
128 ***************************************************************************/
129inline
131{
132 return (m_radius.value());
133}
134
135
136/***********************************************************************//**
137 * @brief Set disk radius
138 *
139 * @param[in] radius Disk radius (degrees).
140 *
141 * Sets the radius of the disk in degrees.
142 ***************************************************************************/
143inline
144void GModelSpatialRadialDisk::radius(const double& radius)
145{
147 return;
148}
149
150#endif /* GMODELSPATIALRADIALDISK_HPP */
Model parameter class interface definition.
Abstract radial spatial model base class interface definition.
GChatter
Definition GTypemaps.hpp:33
@ NORMAL
Definition GTypemaps.hpp:36
Class that handles energies in a unit independent way.
Definition GEnergy.hpp:48
Model parameter class.
Definition GModelPar.hpp:87
double radius(void) const
Return disk radius.
void copy_members(const GModelSpatialRadialDisk &model)
Copy class members.
virtual ~GModelSpatialRadialDisk(void)
Destructor.
GModelPar m_radius
Disk radius (degrees)
void update(void) const
Update precomputation cache.
virtual void write(GXmlElement &xml) const
Write model into XML element.
virtual GSkyDir mc(const GEnergy &energy, const GTime &time, GRan &ran) const
Return MC sky direction.
void free_members(void)
Delete class members.
virtual void clear(void)
Clear radial disk model.
virtual double eval(const double &theta, const GEnergy &energy, const GTime &time, const bool &gradients=false) const
Evaluate function (in units of sr^-1)
virtual std::string print(const GChatter &chatter=NORMAL) const
Print information.
double m_last_radius
Last disk radius.
virtual GModelSpatialRadialDisk & operator=(const GModelSpatialRadialDisk &model)
Assignment operator.
virtual void set_region(void) const
Set boundary sky region.
virtual bool contains(const GSkyDir &dir, const double &margin=0.0) const
Checks where model contains specified sky direction.
double m_radius_rad
Radius in radians.
virtual GModelSpatialRadialDisk * clone(void) const
Clone radial disk model.
virtual std::string classname(void) const
Return class name.
virtual double theta_max(void) const
Return maximum model radius (in radians)
virtual void read(const GXmlElement &xml)
Read model from XML element.
GModelSpatialRadialDisk(void)
Void constructor.
void init_members(void)
Initialise class members.
Abstract radial spatial model base class.
std::string coordsys(void) const
Return coordinate system.
const GSkyDir & dir(void) const
Return position of radial spatial model.
std::string type(void) const
Return model type.
double value(void) const
Return parameter value.
Class that handles photons.
Definition GPhoton.hpp:47
Random number generator class.
Definition GRan.hpp:44
Sky direction class.
Definition GSkyDir.hpp:62
Abstract interface for the sky region class.
Time class.
Definition GTime.hpp:55
XML element node class.