GammaLib  2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GModelSpatialEllipticalDisk.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GModelSpatialEllipticalDisk.hpp - Elliptical disk source model class *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 2013-2022 by Michael Mayer *
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 GModelSpatialEllipticalDisk.hpp
23  * @brief Elliptical disk model class interface definition
24  * @author Michael Mayer
25  */
26 
27 #ifndef GMODELSPATIALELLIPTICALDISK_HPP
28 #define GMODELSPATIALELLIPTICALDISK_HPP
29 
30 /* __ Includes ___________________________________________________________ */
31 #include <string>
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 GModelSpatialEllipticalDisk
47  *
48  * @brief Elliptical disk source model class
49  *
50  * This class implements the spatial component of the factorised source
51  * model for an elliptical disk source, i.e. constant surface brightness
52  * within ellipse and no emission outside.
53  ***************************************************************************/
55 
56 public:
57  // Constructors and destructors
60  const double& semimajor,
61  const double& semiminor,
62  const double& posangle,
63  const std::string& coordsys = "CEL");
64  explicit GModelSpatialEllipticalDisk(const GXmlElement& xml);
66  virtual ~GModelSpatialEllipticalDisk(void);
67 
68  // Operators
70 
71  // Implemented pure virtual base class methods
72  virtual void clear(void);
73  virtual GModelSpatialEllipticalDisk* clone(void) const;
74  virtual std::string classname(void) const;
75  virtual double eval(const double& theta,
76  const double& posangle,
77  const GEnergy& energy,
78  const GTime& time,
79  const bool& gradients = false) const;
80  virtual GSkyDir mc(const GEnergy& energy,
81  const GTime& time,
82  GRan& ran) const;
83  virtual bool contains(const GSkyDir& dir,
84  const double& margin = 0.0) const;
85  virtual double theta_max(void) const;
86  virtual void read(const GXmlElement& xml);
87  virtual void write(GXmlElement& xml) const;
88  virtual std::string print(const GChatter& chatter = NORMAL) const;
89 
90 
91 protected:
92  // Protected methods
93  void init_members(void);
94  void copy_members(const GModelSpatialEllipticalDisk& model);
95  void free_members(void);
96  void update(void) const;
97  virtual void set_region(void) const;
98 
99  // Cached members used for pre-computations
100  mutable double m_last_semiminor; //!< Last semi-minor axis
101  mutable double m_last_semimajor; //!< Last semi-major axis
102  mutable double m_semiminor_rad; //!< Radius in radians
103  mutable double m_semimajor_rad; //!< Radius in radians
104  mutable double m_norm; //!< Normalization
105 };
106 
107 
108 /***********************************************************************//**
109  * @brief Return class name
110  *
111  * @return String containing the class name ("GModelSpatialEllipticalDisk").
112  ***************************************************************************/
113 inline
115 {
116  return ("GModelSpatialEllipticalDisk");
117 }
118 
119 #endif /* GMODELSPATIALELLIPTICALDISK_HPP */
void update(void) const
Update precomputation cache.
Abstract elliptical spatial model base class.
virtual void set_region(void) const
Set boundary sky region.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print information.
virtual double theta_max(void) const
Return maximum model radius (in radians)
void init_members(void)
Initialise class members.
virtual void write(GXmlElement &xml) const
Write model into XML element.
void copy_members(const GModelSpatialEllipticalDisk &model)
Copy class members.
virtual GSkyDir mc(const GEnergy &energy, const GTime &time, GRan &ran) const
Returns MC sky direction.
XML element node class.
Definition: GXmlElement.hpp:48
const GSkyDir & dir(void) const
Return position of elliptical spatial model.
Random number generator class.
Definition: GRan.hpp:44
Time class.
Definition: GTime.hpp:55
virtual void read(const GXmlElement &xml)
Read model from XML element.
virtual bool contains(const GSkyDir &dir, const double &margin=0.0) const
Checks where model contains specified sky direction.
double m_last_semiminor
Last semi-minor axis.
void free_members(void)
Delete class members.
Model parameter class interface definition.
Class that handles photons.
Definition: GPhoton.hpp:47
double semiminor(void) const
Return semi-minor axis of ellipse.
virtual std::string classname(void) const
Return class name.
virtual GModelSpatialEllipticalDisk * clone(void) const
Clone elliptical disk model.
Abstract interface for the sky region class.
Definition: GSkyRegion.hpp:57
virtual void clear(void)
Clear elliptical disk model.
double m_last_semimajor
Last semi-major axis.
GModelSpatialEllipticalDisk(void)
Void constructor.
GChatter
Definition: GTypemaps.hpp:33
std::string coordsys(void) const
Return coordinate system.
double m_semimajor_rad
Radius in radians.
Abstract elliptical spatial model base class interface definition.
double posangle(void) const
Return Position Angle of model.
virtual double eval(const double &theta, const double &posangle, const GEnergy &energy, const GTime &time, const bool &gradients=false) const
Evaluate function (in units of sr^-1)
virtual GModelSpatialEllipticalDisk & operator=(const GModelSpatialEllipticalDisk &model)
Assignment operator.
virtual ~GModelSpatialEllipticalDisk(void)
Destructor.
double m_semiminor_rad
Radius in radians.
Sky direction class.
Definition: GSkyDir.hpp:62
double semimajor(void) const
Return semi-major axis of ellipse.
Class that handles energies in a unit independent way.
Definition: GEnergy.hpp:48