GammaLib  2.1.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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>
32 #include "GModelSpatialRadial.hpp"
33 #include "GModelPar.hpp"
34 
35 /* __ Forward declarations _______________________________________________ */
36 class GEnergy;
37 class GTime;
38 class GPhoton;
39 class GRan;
40 class GSkyDir;
41 class GSkyRegion;
42 class 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 
56 public:
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 
92 protected:
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  ***************************************************************************/
115 inline
116 std::string GModelSpatialRadialDisk::classname(void) const
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  ***************************************************************************/
129 inline
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  ***************************************************************************/
143 inline
144 void GModelSpatialRadialDisk::radius(const double& radius)
145 {
146  m_radius.value(radius);
147  return;
148 }
149 
150 #endif /* GMODELSPATIALRADIALDISK_HPP */
virtual GModelSpatialRadialDisk & operator=(const GModelSpatialRadialDisk &model)
Assignment operator.
virtual double theta_max(void) const
Return maximum model radius (in radians)
virtual void write(GXmlElement &xml) const
Write model into XML element.
void update(void) const
Update precomputation cache.
double radius(void) const
Return disk radius.
virtual void clear(void)
Clear radial disk model.
Abstract radial spatial model base class interface definition.
XML element node class.
Definition: GXmlElement.hpp:48
std::string coordsys(void) const
Return coordinate system.
Random number generator class.
Definition: GRan.hpp:44
Time class.
Definition: GTime.hpp:55
GModelPar m_radius
Disk radius (degrees)
virtual ~GModelSpatialRadialDisk(void)
Destructor.
Model parameter class interface definition.
Class that handles photons.
Definition: GPhoton.hpp:47
Model parameter class.
Definition: GModelPar.hpp:87
virtual double eval(const double &theta, const GEnergy &energy, const GTime &time, const bool &gradients=false) const
Evaluate function (in units of sr^-1)
Abstract interface for the sky region class.
Definition: GSkyRegion.hpp:57
const GSkyDir & dir(void) const
Return position of radial spatial model.
virtual void read(const GXmlElement &xml)
Read model from XML element.
virtual std::string classname(void) const
Return class name.
GModelSpatialRadialDisk(void)
Void constructor.
GChatter
Definition: GTypemaps.hpp:33
virtual GSkyDir mc(const GEnergy &energy, const GTime &time, GRan &ran) const
Return MC sky direction.
std::string type(void) const
Return model type.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print information.
virtual void set_region(void) const
Set boundary sky region.
virtual GModelSpatialRadialDisk * clone(void) const
Clone radial disk model.
double value(void) const
Return parameter value.
void free_members(void)
Delete class members.
Abstract radial spatial model base class.
double m_radius_rad
Radius in radians.
double m_last_radius
Last disk radius.
void copy_members(const GModelSpatialRadialDisk &model)
Copy class members.
void init_members(void)
Initialise class members.
Sky direction class.
Definition: GSkyDir.hpp:62
virtual bool contains(const GSkyDir &dir, const double &margin=0.0) const
Checks where model contains specified sky direction.
Class that handles energies in a unit independent way.
Definition: GEnergy.hpp:48