Commit 38f252504abed2cb564086e711d0bda41538ab37
1 parent
bf39a08a
Restructure GModelSpatial class.
Put the type() and region() methods in the GModelSpatial base class to avoid code duplication. The region is now set by the derived classes using the pure virtual set_region() method.
Showing
51 changed files
with
328 additions
and
706 deletions
include/GModelSpatial.hpp
| ... | ... | @@ -91,7 +91,6 @@ public: |
| 91 | 91 | virtual void clear(void) = 0; |
| 92 | 92 | virtual GModelSpatial* clone(void) const = 0; |
| 93 | 93 | virtual std::string classname(void) const = 0; |
| 94 | - virtual std::string type(void) const = 0; | |
| 95 | 94 | virtual GClassCode code(void) const = 0; |
| 96 | 95 | virtual double eval(const GPhoton& photon, |
| 97 | 96 | const bool& gradients = false) const = 0; |
| ... | ... | @@ -103,25 +102,28 @@ public: |
| 103 | 102 | const double& margin = 0.0) const = 0; |
| 104 | 103 | virtual void read(const GXmlElement& xml) = 0; |
| 105 | 104 | virtual void write(GXmlElement& xml) const = 0; |
| 106 | - virtual GSkyRegion* region(void) const = 0; | |
| 107 | 105 | virtual std::string print(const GChatter& chatter = NORMAL) const = 0; |
| 108 | 106 | |
| 109 | 107 | // Methods |
| 110 | - GModelPar& at(const int& index); | |
| 111 | - const GModelPar& at(const int& index) const; | |
| 112 | - bool has_par(const std::string& name) const; | |
| 113 | - bool has_free_pars(void) const; | |
| 114 | - int size(void) const; | |
| 115 | - void autoscale(void); | |
| 116 | - double flux(const GSkyRegion* reg, | |
| 117 | - const GEnergy& srcEng = GEnergy(), | |
| 118 | - const GTime& srcTime = GTime()) const; | |
| 108 | + std::string type(void) const; | |
| 109 | + void type(const std::string& type); | |
| 110 | + GModelPar& at(const int& index); | |
| 111 | + const GModelPar& at(const int& index) const; | |
| 112 | + bool has_par(const std::string& name) const; | |
| 113 | + bool has_free_pars(void) const; | |
| 114 | + int size(void) const; | |
| 115 | + void autoscale(void); | |
| 116 | + double flux(const GSkyRegion* reg, | |
| 117 | + const GEnergy& srcEng = GEnergy(), | |
| 118 | + const GTime& srcTime = GTime()) const; | |
| 119 | + const GSkyRegion* region(void) const; | |
| 119 | 120 | |
| 120 | 121 | protected: |
| 121 | 122 | // Protected methods |
| 122 | - void init_members(void); | |
| 123 | - void copy_members(const GModelSpatial& model); | |
| 124 | - void free_members(void); | |
| 123 | + void init_members(void); | |
| 124 | + void copy_members(const GModelSpatial& model); | |
| 125 | + void free_members(void); | |
| 126 | + virtual void set_region(void) const = 0; | |
| 125 | 127 | |
| 126 | 128 | // Kernel for circular sky region radial integration |
| 127 | 129 | class circle_int_kern_rho : public GFunction { |
| ... | ... | @@ -180,11 +182,42 @@ protected: |
| 180 | 182 | }; |
| 181 | 183 | |
| 182 | 184 | // Proteced members |
| 185 | + std::string m_type; //!< Spatial model type | |
| 186 | + GSkyRegionCircle m_region; //!< Bounding circle | |
| 183 | 187 | std::vector<GModelPar*> m_pars; //!< Parameter pointers |
| 184 | 188 | }; |
| 185 | 189 | |
| 186 | 190 | |
| 187 | 191 | /***********************************************************************//** |
| 192 | + * @brief Return model type | |
| 193 | + * | |
| 194 | + * @return Model type. | |
| 195 | + * | |
| 196 | + * Returns the type of the spatial model. | |
| 197 | + ***************************************************************************/ | |
| 198 | +inline | |
| 199 | +std::string GModelSpatial::type(void) const | |
| 200 | +{ | |
| 201 | + return (m_type); | |
| 202 | +} | |
| 203 | + | |
| 204 | + | |
| 205 | +/***********************************************************************//** | |
| 206 | + * @brief Set model type | |
| 207 | + * | |
| 208 | + * @param[in] type Model type. | |
| 209 | + * | |
| 210 | + * Set the type of the spatial model. | |
| 211 | + ***************************************************************************/ | |
| 212 | +inline | |
| 213 | +void GModelSpatial::type(const std::string& type) | |
| 214 | +{ | |
| 215 | + m_type = type; | |
| 216 | + return; | |
| 217 | +} | |
| 218 | + | |
| 219 | + | |
| 220 | +/***********************************************************************//** | |
| 188 | 221 | * @brief Returns model parameter |
| 189 | 222 | * |
| 190 | 223 | * @param[in] index Parameter index [0,...,size()-1]. |
| ... | ... | @@ -227,4 +260,19 @@ int GModelSpatial::size(void) const |
| 227 | 260 | return (int)m_pars.size(); |
| 228 | 261 | } |
| 229 | 262 | |
| 263 | + | |
| 264 | +/***********************************************************************//** | |
| 265 | + * @brief Return boundary sky region | |
| 266 | + * | |
| 267 | + * @return Boundary sky region. | |
| 268 | + * | |
| 269 | + * Returns a sky region that fully encloses the spatial model component. | |
| 270 | + ***************************************************************************/ | |
| 271 | +inline | |
| 272 | +const GSkyRegion* GModelSpatial::region(void) const | |
| 273 | +{ | |
| 274 | + const_cast<GModelSpatial*>(this)->set_region(); | |
| 275 | + return (&m_region); | |
| 276 | +} | |
| 277 | + | |
| 230 | 278 | #endif /* GMODELSPATIAL_HPP */ | ... | ... |
include/GModelSpatialComposite.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GModelSpatialComposite.hpp - Spatial composite model class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2016-2018 by Domenico Tiziani * | |
| 4 | + * copyright (C) 2016-2020 by Domenico Tiziani * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -61,7 +61,6 @@ public: |
| 61 | 61 | virtual void clear(void); |
| 62 | 62 | virtual GModelSpatialComposite* clone(void) const; |
| 63 | 63 | virtual std::string classname(void) const; |
| 64 | - virtual std::string type(void) const; | |
| 65 | 64 | virtual GClassCode code(void) const; |
| 66 | 65 | virtual double eval(const GPhoton& photon, |
| 67 | 66 | const bool& gradients = false) const; |
| ... | ... | @@ -72,13 +71,11 @@ public: |
| 72 | 71 | const double& radius) const; |
| 73 | 72 | virtual bool contains(const GSkyDir& dir, |
| 74 | 73 | const double& margin = 0.0) const; |
| 75 | - virtual GSkyRegion* region(void) const; | |
| 76 | 74 | virtual void read(const GXmlElement& xml); |
| 77 | 75 | virtual void write(GXmlElement& xml) const; |
| 78 | 76 | virtual std::string print(const GChatter& chatter = NORMAL) const; |
| 79 | 77 | |
| 80 | 78 | // Other methods |
| 81 | - void type(const std::string& type); | |
| 82 | 79 | int components(void) const; |
| 83 | 80 | void append(const GModelSpatial& component, |
| 84 | 81 | const std::string& name = "", |
| ... | ... | @@ -91,17 +88,15 @@ public: |
| 91 | 88 | |
| 92 | 89 | protected: |
| 93 | 90 | // Protected methods |
| 94 | - void init_members(void); | |
| 95 | - void copy_members(const GModelSpatialComposite& model); | |
| 96 | - void free_members(void); | |
| 97 | - void set_region(void) const; | |
| 91 | + void init_members(void); | |
| 92 | + void copy_members(const GModelSpatialComposite& model); | |
| 93 | + void free_members(void); | |
| 94 | + virtual void set_region(void) const; | |
| 98 | 95 | |
| 99 | 96 | // Protected members |
| 100 | - std::string m_type; //!< Model type | |
| 101 | 97 | std::vector<GModelSpatial*> m_components; //!< Components |
| 102 | 98 | std::vector<std::string> m_names; //!< Component names |
| 103 | 99 | std::vector<GModelPar*> m_scales; //!< Component scales |
| 104 | - mutable GSkyRegionCircle m_region; //!< Bounding circle | |
| 105 | 100 | }; |
| 106 | 101 | |
| 107 | 102 | |
| ... | ... | @@ -118,35 +113,6 @@ std::string GModelSpatialComposite::classname(void) const |
| 118 | 113 | |
| 119 | 114 | |
| 120 | 115 | /***********************************************************************//** |
| 121 | - * @brief Return model type | |
| 122 | - * | |
| 123 | - * @return Model type. | |
| 124 | - * | |
| 125 | - * Returns the type of the spatial model. | |
| 126 | - ***************************************************************************/ | |
| 127 | -inline | |
| 128 | -std::string GModelSpatialComposite::type(void) const | |
| 129 | -{ | |
| 130 | - return (m_type); | |
| 131 | -} | |
| 132 | - | |
| 133 | - | |
| 134 | -/***********************************************************************//** | |
| 135 | - * @brief Set model type | |
| 136 | - * | |
| 137 | - * @param[in] type Model type. | |
| 138 | - * | |
| 139 | - * Set the type of the spatial model. | |
| 140 | - ***************************************************************************/ | |
| 141 | -inline | |
| 142 | -void GModelSpatialComposite::type(const std::string& type) | |
| 143 | -{ | |
| 144 | - m_type = type; | |
| 145 | - return; | |
| 146 | -} | |
| 147 | - | |
| 148 | - | |
| 149 | -/***********************************************************************//** | |
| 150 | 116 | * @brief Return class code |
| 151 | 117 | * |
| 152 | 118 | * @return GModelSpatialComposite. |
| ... | ... | @@ -189,19 +155,4 @@ int GModelSpatialComposite::components(void) const |
| 189 | 155 | return ((int)m_components.size()); |
| 190 | 156 | } |
| 191 | 157 | |
| 192 | - | |
| 193 | -/***********************************************************************//** | |
| 194 | - * @brief Return boundary sky region | |
| 195 | - * | |
| 196 | - * @return Boundary sky region. | |
| 197 | - * | |
| 198 | - * Returns a sky region that fully encloses the point source. | |
| 199 | - ***************************************************************************/ | |
| 200 | -inline | |
| 201 | -GSkyRegion* GModelSpatialComposite::region(void) const | |
| 202 | -{ | |
| 203 | - set_region(); | |
| 204 | - return (&m_region); | |
| 205 | -} | |
| 206 | - | |
| 207 | 158 | #endif /* GMODELSPATIALCOMPOSITE_HPP */ | ... | ... |
include/GModelSpatialDiffuse.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GModelSpatialDiffuse.hpp - Abstract diffuse spatial model base class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2013-2016 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2013-2020 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -64,7 +64,6 @@ public: |
| 64 | 64 | virtual void clear(void) = 0; |
| 65 | 65 | virtual GModelSpatialDiffuse* clone(void) const = 0; |
| 66 | 66 | virtual std::string classname(void) const = 0; |
| 67 | - virtual std::string type(void) const = 0; | |
| 68 | 67 | virtual double eval(const GPhoton& photon, |
| 69 | 68 | const bool& gradients = false) const = 0; |
| 70 | 69 | virtual GSkyDir mc(const GEnergy& energy, const GTime& time, |
| ... | ... | @@ -73,7 +72,6 @@ public: |
| 73 | 72 | const double& radius) const = 0; |
| 74 | 73 | virtual bool contains(const GSkyDir& dir, |
| 75 | 74 | const double& margin = 0.0) const = 0; |
| 76 | - virtual GSkyRegion* region(void) const = 0; | |
| 77 | 75 | virtual void read(const GXmlElement& xml) = 0; |
| 78 | 76 | virtual void write(GXmlElement& xml) const = 0; |
| 79 | 77 | virtual std::string print(const GChatter& chatter = NORMAL) const = 0; |
| ... | ... | @@ -83,9 +81,10 @@ public: |
| 83 | 81 | |
| 84 | 82 | protected: |
| 85 | 83 | // Protected methods |
| 86 | - void init_members(void); | |
| 87 | - void copy_members(const GModelSpatialDiffuse& model); | |
| 88 | - void free_members(void); | |
| 84 | + void init_members(void); | |
| 85 | + void copy_members(const GModelSpatialDiffuse& model); | |
| 86 | + void free_members(void); | |
| 87 | + virtual void set_region(void) const = 0; | |
| 89 | 88 | }; |
| 90 | 89 | |
| 91 | 90 | ... | ... |
include/GModelSpatialDiffuseConst.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GModelSpatialDiffuseConst.hpp - Spatial isotropic model class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2010-2016 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2010-2020 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -63,7 +63,6 @@ public: |
| 63 | 63 | virtual void clear(void); |
| 64 | 64 | virtual GModelSpatialDiffuseConst* clone(void) const; |
| 65 | 65 | virtual std::string classname(void) const; |
| 66 | - virtual std::string type(void) const; | |
| 67 | 66 | virtual double eval(const GPhoton& photon, |
| 68 | 67 | const bool& gradients = false) const; |
| 69 | 68 | virtual GSkyDir mc(const GEnergy& energy, |
| ... | ... | @@ -73,7 +72,6 @@ public: |
| 73 | 72 | const double& radius) const; |
| 74 | 73 | virtual bool contains(const GSkyDir& dir, |
| 75 | 74 | const double& margin = 0.0) const; |
| 76 | - virtual GSkyRegion* region(void) const; | |
| 77 | 75 | virtual void read(const GXmlElement& xml); |
| 78 | 76 | virtual void write(GXmlElement& xml) const; |
| 79 | 77 | virtual std::string print(const GChatter& chatter = NORMAL) const; |
| ... | ... | @@ -84,17 +82,15 @@ public: |
| 84 | 82 | |
| 85 | 83 | protected: |
| 86 | 84 | // Protected methods |
| 87 | - void init_members(void); | |
| 88 | - void copy_members(const GModelSpatialDiffuseConst& model); | |
| 89 | - void free_members(void); | |
| 90 | - void set_region(void) const; | |
| 85 | + void init_members(void); | |
| 86 | + void copy_members(const GModelSpatialDiffuseConst& model); | |
| 87 | + void free_members(void); | |
| 88 | + virtual void set_region(void) const; | |
| 91 | 89 | |
| 92 | 90 | // Protected members |
| 93 | - std::string m_type; //!< Model type | |
| 94 | - GModelPar m_value; //!< Value | |
| 95 | - mutable GSkyRegionCircle m_region; //!< Bounding circle | |
| 96 | - mutable GSkyDir m_mc_centre; //!< Simulation cone centre | |
| 97 | - mutable double m_mc_cos_radius; //!< Cosine of sim. cone radius | |
| 91 | + GModelPar m_value; //!< Value | |
| 92 | + mutable GSkyDir m_mc_centre; //!< Simulation cone centre | |
| 93 | + mutable double m_mc_cos_radius; //!< Cosine of sim. cone radius | |
| 98 | 94 | }; |
| 99 | 95 | |
| 100 | 96 | |
| ... | ... | @@ -111,20 +107,6 @@ std::string GModelSpatialDiffuseConst::classname(void) const |
| 111 | 107 | |
| 112 | 108 | |
| 113 | 109 | /***********************************************************************//** |
| 114 | - * @brief Return spatial model type | |
| 115 | - * | |
| 116 | - * @return Model type. | |
| 117 | - * | |
| 118 | - * Returns the type of the isotropic spatial model. | |
| 119 | - ***************************************************************************/ | |
| 120 | -inline | |
| 121 | -std::string GModelSpatialDiffuseConst::type(void) const | |
| 122 | -{ | |
| 123 | - return (m_type); | |
| 124 | -} | |
| 125 | - | |
| 126 | - | |
| 127 | -/***********************************************************************//** | |
| 128 | 110 | * @brief Get model value |
| 129 | 111 | * |
| 130 | 112 | * @return Model value. |
| ... | ... | @@ -171,19 +153,4 @@ bool GModelSpatialDiffuseConst::contains(const GSkyDir& dir, |
| 171 | 153 | return (true); |
| 172 | 154 | } |
| 173 | 155 | |
| 174 | - | |
| 175 | -/***********************************************************************//** | |
| 176 | - * @brief Return boundary sky region | |
| 177 | - * | |
| 178 | - * @return Boundary sky region. | |
| 179 | - * | |
| 180 | - * Returns a sky region that fully encloses the point source. | |
| 181 | - ***************************************************************************/ | |
| 182 | -inline | |
| 183 | -GSkyRegion* GModelSpatialDiffuseConst::region(void) const | |
| 184 | -{ | |
| 185 | - set_region(); | |
| 186 | - return (&m_region); | |
| 187 | -} | |
| 188 | - | |
| 189 | 156 | #endif /* GMODELSPATIALDIFFUSECONST_HPP */ | ... | ... |
include/GModelSpatialElliptical.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GModelSpatialElliptical.hpp - Abstract elliptical spatial model class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2013-2016 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2013-2020 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -65,7 +65,6 @@ public: |
| 65 | 65 | virtual void clear(void) = 0; |
| 66 | 66 | virtual GModelSpatialElliptical* clone(void) const = 0; |
| 67 | 67 | virtual std::string classname(void) const = 0; |
| 68 | - virtual std::string type(void) const = 0; | |
| 69 | 68 | virtual double eval(const double& theta, |
| 70 | 69 | const double& posangle, |
| 71 | 70 | const GEnergy& energy, |
| ... | ... | @@ -77,7 +76,6 @@ public: |
| 77 | 76 | virtual bool contains(const GSkyDir& dir, |
| 78 | 77 | const double& margin = 0.0) const = 0; |
| 79 | 78 | virtual double theta_max(void) const = 0; |
| 80 | - virtual GSkyRegion* region(void) const = 0; | |
| 81 | 79 | virtual std::string print(const GChatter& chatter = NORMAL) const = 0; |
| 82 | 80 | |
| 83 | 81 | // Implemented virtual base class methods |
| ... | ... | @@ -104,9 +102,10 @@ public: |
| 104 | 102 | |
| 105 | 103 | protected: |
| 106 | 104 | // Protected methods |
| 107 | - void init_members(void); | |
| 108 | - void copy_members(const GModelSpatialElliptical& model); | |
| 109 | - void free_members(void); | |
| 105 | + void init_members(void); | |
| 106 | + void copy_members(const GModelSpatialElliptical& model); | |
| 107 | + void free_members(void); | |
| 108 | + virtual void set_region(void) const = 0; | |
| 110 | 109 | |
| 111 | 110 | // Protected members |
| 112 | 111 | GModelPar m_ra; //!< Right Ascension (deg) | ... | ... |
include/GModelSpatialEllipticalDisk.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GModelSpatialEllipticalDisk.hpp - Elliptical disk source model class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2013-2016 by Michael Mayer * | |
| 4 | + * copyright (C) 2013-2020 by Michael Mayer * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -65,7 +65,6 @@ public: |
| 65 | 65 | virtual void clear(void); |
| 66 | 66 | virtual GModelSpatialEllipticalDisk* clone(void) const; |
| 67 | 67 | virtual std::string classname(void) const; |
| 68 | - virtual std::string type(void) const; | |
| 69 | 68 | virtual double eval(const double& theta, |
| 70 | 69 | const double& posangle, |
| 71 | 70 | const GEnergy& energy, |
| ... | ... | @@ -77,7 +76,6 @@ public: |
| 77 | 76 | virtual bool contains(const GSkyDir& dir, |
| 78 | 77 | const double& margin = 0.0) const; |
| 79 | 78 | virtual double theta_max(void) const; |
| 80 | - virtual GSkyRegion* region(void) const; | |
| 81 | 79 | virtual void read(const GXmlElement& xml); |
| 82 | 80 | virtual void write(GXmlElement& xml) const; |
| 83 | 81 | virtual std::string print(const GChatter& chatter = NORMAL) const; |
| ... | ... | @@ -85,14 +83,11 @@ public: |
| 85 | 83 | |
| 86 | 84 | protected: |
| 87 | 85 | // Protected methods |
| 88 | - void init_members(void); | |
| 89 | - void copy_members(const GModelSpatialEllipticalDisk& model); | |
| 90 | - void free_members(void); | |
| 91 | - void update(void) const; | |
| 92 | - void set_region(void) const; | |
| 93 | - | |
| 94 | - // Protected members | |
| 95 | - mutable GSkyRegionCircle m_region; //!< Bounding circle | |
| 86 | + void init_members(void); | |
| 87 | + void copy_members(const GModelSpatialEllipticalDisk& model); | |
| 88 | + void free_members(void); | |
| 89 | + void update(void) const; | |
| 90 | + virtual void set_region(void) const; | |
| 96 | 91 | |
| 97 | 92 | // Cached members used for pre-computations |
| 98 | 93 | mutable double m_last_semiminor; //!< Last semi-minor axis |
| ... | ... | @@ -114,33 +109,4 @@ std::string GModelSpatialEllipticalDisk::classname(void) const |
| 114 | 109 | return ("GModelSpatialEllipticalDisk"); |
| 115 | 110 | } |
| 116 | 111 | |
| 117 | - | |
| 118 | -/***********************************************************************//** | |
| 119 | - * @brief Return model type | |
| 120 | - * | |
| 121 | - * @return "EllipticalDisk". | |
| 122 | - * | |
| 123 | - * Returns the type of the elliptical disk model. | |
| 124 | - ***************************************************************************/ | |
| 125 | -inline | |
| 126 | -std::string GModelSpatialEllipticalDisk::type(void) const | |
| 127 | -{ | |
| 128 | - return "EllipticalDisk"; | |
| 129 | -} | |
| 130 | - | |
| 131 | - | |
| 132 | -/***********************************************************************//** | |
| 133 | - * @brief Return boundary sky region | |
| 134 | - * | |
| 135 | - * @return Boundary sky region. | |
| 136 | - * | |
| 137 | - * Returns a sky region that fully encloses the spatial model component. | |
| 138 | - ***************************************************************************/ | |
| 139 | -inline | |
| 140 | -GSkyRegion* GModelSpatialEllipticalDisk::region(void) const | |
| 141 | -{ | |
| 142 | - set_region(); | |
| 143 | - return (&m_region); | |
| 144 | -} | |
| 145 | - | |
| 146 | 112 | #endif /* GMODELSPATIALELLIPTICALDISK_HPP */ | ... | ... |
include/GModelSpatialEllipticalGauss.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GModelSpatialEllipticalGauss.hpp - Elliptical gauss source model class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2015-2016 by Michael Mayer * | |
| 4 | + * copyright (C) 2015-2020 by Michael Mayer * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -66,7 +66,6 @@ public: |
| 66 | 66 | virtual void clear(void); |
| 67 | 67 | virtual GModelSpatialEllipticalGauss* clone(void) const; |
| 68 | 68 | virtual std::string classname(void) const; |
| 69 | - virtual std::string type(void) const; | |
| 70 | 69 | virtual double eval(const double& theta, |
| 71 | 70 | const double& posangle, |
| 72 | 71 | const GEnergy& energy, |
| ... | ... | @@ -78,7 +77,6 @@ public: |
| 78 | 77 | virtual bool contains(const GSkyDir& dir, |
| 79 | 78 | const double& margin = 0.0) const; |
| 80 | 79 | virtual double theta_max(void) const; |
| 81 | - virtual GSkyRegion* region(void) const; | |
| 82 | 80 | virtual void read(const GXmlElement& xml); |
| 83 | 81 | virtual void write(GXmlElement& xml) const; |
| 84 | 82 | virtual std::string print(const GChatter& chatter = NORMAL) const; |
| ... | ... | @@ -86,15 +84,13 @@ public: |
| 86 | 84 | |
| 87 | 85 | protected: |
| 88 | 86 | // Protected methods |
| 89 | - void init_members(void); | |
| 90 | - void copy_members(const GModelSpatialEllipticalGauss& model); | |
| 91 | - void free_members(void); | |
| 92 | - void update(void) const; | |
| 93 | - void set_region(void) const; | |
| 87 | + void init_members(void); | |
| 88 | + void copy_members(const GModelSpatialEllipticalGauss& model); | |
| 89 | + void free_members(void); | |
| 90 | + void update(void) const; | |
| 91 | + virtual void set_region(void) const; | |
| 94 | 92 | |
| 95 | 93 | // Protected members |
| 96 | - std::string m_type; //!< Model type | |
| 97 | - mutable GSkyRegionCircle m_region; //!< Bounding circle | |
| 98 | 94 | |
| 99 | 95 | // Cached members used for pre-computations |
| 100 | 96 | mutable double m_last_minor; //!< Last semi-minor axis |
| ... | ... | @@ -126,33 +122,4 @@ std::string GModelSpatialEllipticalGauss::classname(void) const |
| 126 | 122 | return ("GModelSpatialEllipticalGauss"); |
| 127 | 123 | } |
| 128 | 124 | |
| 129 | - | |
| 130 | -/***********************************************************************//** | |
| 131 | - * @brief Return model type | |
| 132 | - * | |
| 133 | - * @return Model type. | |
| 134 | - * | |
| 135 | - * Returns the type of the elliptical gauss model. | |
| 136 | - ***************************************************************************/ | |
| 137 | -inline | |
| 138 | -std::string GModelSpatialEllipticalGauss::type(void) const | |
| 139 | -{ | |
| 140 | - return (m_type); | |
| 141 | -} | |
| 142 | - | |
| 143 | - | |
| 144 | -/***********************************************************************//** | |
| 145 | - * @brief Return boundary sky region | |
| 146 | - * | |
| 147 | - * @return Boundary sky region. | |
| 148 | - * | |
| 149 | - * Returns a sky region that fully encloses the spatial model component. | |
| 150 | - ***************************************************************************/ | |
| 151 | -inline | |
| 152 | -GSkyRegion* GModelSpatialEllipticalGauss::region(void) const | |
| 153 | -{ | |
| 154 | - set_region(); | |
| 155 | - return (&m_region); | |
| 156 | -} | |
| 157 | - | |
| 158 | 125 | #endif /* GMODELSPATIALELLIPTICALGAUSS_HPP */ | ... | ... |
include/GModelSpatialPointSource.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GModelSpatialPointSource.hpp - Spatial point source model class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2009-2016 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2009-2020 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -64,7 +64,6 @@ public: |
| 64 | 64 | virtual void clear(void); |
| 65 | 65 | virtual GModelSpatialPointSource* clone(void) const; |
| 66 | 66 | virtual std::string classname(void) const; |
| 67 | - virtual std::string type(void) const; | |
| 68 | 67 | virtual GClassCode code(void) const; |
| 69 | 68 | virtual double eval(const GPhoton& photon, |
| 70 | 69 | const bool& gradients = false) const; |
| ... | ... | @@ -75,13 +74,11 @@ public: |
| 75 | 74 | const double& radius) const; |
| 76 | 75 | virtual bool contains(const GSkyDir& dir, |
| 77 | 76 | const double& margin = 0.0) const; |
| 78 | - virtual GSkyRegion* region(void) const; | |
| 79 | 77 | virtual void read(const GXmlElement& xml); |
| 80 | 78 | virtual void write(GXmlElement& xml) const; |
| 81 | 79 | virtual std::string print(const GChatter& chatter = NORMAL) const; |
| 82 | 80 | |
| 83 | 81 | // Other methods |
| 84 | - void type(const std::string& type); | |
| 85 | 82 | double ra(void) const; |
| 86 | 83 | double dec(void) const; |
| 87 | 84 | void ra(const double& ra); |
| ... | ... | @@ -91,16 +88,14 @@ public: |
| 91 | 88 | |
| 92 | 89 | protected: |
| 93 | 90 | // Protected methods |
| 94 | - void init_members(void); | |
| 95 | - void copy_members(const GModelSpatialPointSource& model); | |
| 96 | - void free_members(void); | |
| 97 | - void set_region(void) const; | |
| 91 | + void init_members(void); | |
| 92 | + void copy_members(const GModelSpatialPointSource& model); | |
| 93 | + void free_members(void); | |
| 94 | + virtual void set_region(void) const; | |
| 98 | 95 | |
| 99 | 96 | // Protected members |
| 100 | - std::string m_type; //!< Model type | |
| 101 | - GModelPar m_ra; //!< Right Ascension (deg) | |
| 102 | - GModelPar m_dec; //!< Declination (deg) | |
| 103 | - mutable GSkyRegionCircle m_region; //!< Bounding circle | |
| 97 | + GModelPar m_ra; //!< Right Ascension (deg) | |
| 98 | + GModelPar m_dec; //!< Declination (deg) | |
| 104 | 99 | }; |
| 105 | 100 | |
| 106 | 101 | |
| ... | ... | @@ -117,35 +112,6 @@ std::string GModelSpatialPointSource::classname(void) const |
| 117 | 112 | |
| 118 | 113 | |
| 119 | 114 | /***********************************************************************//** |
| 120 | - * @brief Return model type | |
| 121 | - * | |
| 122 | - * @return Model type. | |
| 123 | - * | |
| 124 | - * Returns the type of the spatial point source model. | |
| 125 | - ***************************************************************************/ | |
| 126 | -inline | |
| 127 | -std::string GModelSpatialPointSource::type(void) const | |
| 128 | -{ | |
| 129 | - return (m_type); | |
| 130 | -} | |
| 131 | - | |
| 132 | - | |
| 133 | -/***********************************************************************//** | |
| 134 | - * @brief Set model type | |
| 135 | - * | |
| 136 | - * @param[in] type Model type. | |
| 137 | - * | |
| 138 | - * Set the type of the spatial point source model. | |
| 139 | - ***************************************************************************/ | |
| 140 | -inline | |
| 141 | -void GModelSpatialPointSource::type(const std::string& type) | |
| 142 | -{ | |
| 143 | - m_type = type; | |
| 144 | - return; | |
| 145 | -} | |
| 146 | - | |
| 147 | - | |
| 148 | -/***********************************************************************//** | |
| 149 | 115 | * @brief Return class code |
| 150 | 116 | * |
| 151 | 117 | * @return GModelSpatialPointSource. |
| ... | ... | @@ -236,19 +202,4 @@ double GModelSpatialPointSource::mc_norm(const GSkyDir& dir, |
| 236 | 202 | return (norm); |
| 237 | 203 | } |
| 238 | 204 | |
| 239 | - | |
| 240 | -/***********************************************************************//** | |
| 241 | - * @brief Return boundary sky region | |
| 242 | - * | |
| 243 | - * @return Boundary sky region. | |
| 244 | - * | |
| 245 | - * Returns a sky region that fully encloses the point source. | |
| 246 | - ***************************************************************************/ | |
| 247 | -inline | |
| 248 | -GSkyRegion* GModelSpatialPointSource::region(void) const | |
| 249 | -{ | |
| 250 | - set_region(); | |
| 251 | - return (&m_region); | |
| 252 | -} | |
| 253 | - | |
| 254 | 205 | #endif /* GMODELSPATIALPOINTSOURCE_HPP */ | ... | ... |
include/GModelSpatialRadial.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GModelSpatialRadial.hpp - Abstract radial spatial model base class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2011-2016 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2011-2020 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -65,7 +65,6 @@ public: |
| 65 | 65 | virtual void clear(void) = 0; |
| 66 | 66 | virtual GModelSpatialRadial* clone(void) const = 0; |
| 67 | 67 | virtual std::string classname(void) const = 0; |
| 68 | - virtual std::string type(void) const = 0; | |
| 69 | 68 | virtual double eval(const double& theta, |
| 70 | 69 | const GEnergy& energy, |
| 71 | 70 | const GTime& time, |
| ... | ... | @@ -76,7 +75,6 @@ public: |
| 76 | 75 | virtual bool contains(const GSkyDir& dir, |
| 77 | 76 | const double& margin = 0.0) const = 0; |
| 78 | 77 | virtual double theta_max(void) const = 0; |
| 79 | - virtual GSkyRegion* region(void) const = 0; | |
| 80 | 78 | virtual std::string print(const GChatter& chatter = NORMAL) const = 0; |
| 81 | 79 | |
| 82 | 80 | // Implemented pure virtual base class methods |
| ... | ... | @@ -97,9 +95,10 @@ public: |
| 97 | 95 | |
| 98 | 96 | protected: |
| 99 | 97 | // Protected methods |
| 100 | - void init_members(void); | |
| 101 | - void copy_members(const GModelSpatialRadial& model); | |
| 102 | - void free_members(void); | |
| 98 | + void init_members(void); | |
| 99 | + void copy_members(const GModelSpatialRadial& model); | |
| 100 | + void free_members(void); | |
| 101 | + virtual void set_region(void) const = 0; | |
| 103 | 102 | |
| 104 | 103 | // Proteced members |
| 105 | 104 | GModelPar m_ra; //!< Right Ascension (deg) | ... | ... |
include/GModelSpatialRadialDisk.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GModelSpatialRadialDisk.hpp - Radial disk source model class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2011-2016 by Christoph Deil * | |
| 4 | + * copyright (C) 2011-2020 by Christoph Deil * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -63,7 +63,6 @@ public: |
| 63 | 63 | virtual void clear(void); |
| 64 | 64 | virtual GModelSpatialRadialDisk* clone(void) const; |
| 65 | 65 | virtual std::string classname(void) const; |
| 66 | - virtual std::string type(void) const; | |
| 67 | 66 | virtual double eval(const double& theta, |
| 68 | 67 | const GEnergy& energy, |
| 69 | 68 | const GTime& time, |
| ... | ... | @@ -74,7 +73,6 @@ public: |
| 74 | 73 | virtual bool contains(const GSkyDir& dir, |
| 75 | 74 | const double& margin = 0.0) const; |
| 76 | 75 | virtual double theta_max(void) const; |
| 77 | - virtual GSkyRegion* region(void) const; | |
| 78 | 76 | virtual void read(const GXmlElement& xml); |
| 79 | 77 | virtual void write(GXmlElement& xml) const; |
| 80 | 78 | virtual std::string print(const GChatter& chatter = NORMAL) const; |
| ... | ... | @@ -85,16 +83,14 @@ public: |
| 85 | 83 | |
| 86 | 84 | protected: |
| 87 | 85 | // Protected methods |
| 88 | - void init_members(void); | |
| 89 | - void copy_members(const GModelSpatialRadialDisk& model); | |
| 90 | - void free_members(void); | |
| 91 | - void update(void) const; | |
| 92 | - void set_region(void) const; | |
| 86 | + void init_members(void); | |
| 87 | + void copy_members(const GModelSpatialRadialDisk& model); | |
| 88 | + void free_members(void); | |
| 89 | + void update(void) const; | |
| 90 | + virtual void set_region(void) const; | |
| 93 | 91 | |
| 94 | 92 | // Protected members |
| 95 | - std::string m_type; //!< Model type | |
| 96 | - GModelPar m_radius; //!< Disk radius (degrees) | |
| 97 | - mutable GSkyRegionCircle m_region; //!< Bounding circle | |
| 93 | + GModelPar m_radius; //!< Disk radius (degrees) | |
| 98 | 94 | |
| 99 | 95 | // Cached members used for pre-computations |
| 100 | 96 | mutable double m_last_radius; //!< Last disk radius |
| ... | ... | @@ -116,20 +112,6 @@ std::string GModelSpatialRadialDisk::classname(void) const |
| 116 | 112 | |
| 117 | 113 | |
| 118 | 114 | /***********************************************************************//** |
| 119 | - * @brief Return model type | |
| 120 | - * | |
| 121 | - * @return Model type. | |
| 122 | - * | |
| 123 | - * Returns the type of the radial disk model. | |
| 124 | - ***************************************************************************/ | |
| 125 | -inline | |
| 126 | -std::string GModelSpatialRadialDisk::type(void) const | |
| 127 | -{ | |
| 128 | - return (m_type); | |
| 129 | -} | |
| 130 | - | |
| 131 | - | |
| 132 | -/***********************************************************************//** | |
| 133 | 115 | * @brief Return disk radius |
| 134 | 116 | * |
| 135 | 117 | * @return Disk radius (degrees). |
| ... | ... | @@ -157,19 +139,4 @@ void GModelSpatialRadialDisk::radius(const double& radius) |
| 157 | 139 | return; |
| 158 | 140 | } |
| 159 | 141 | |
| 160 | - | |
| 161 | -/***********************************************************************//** | |
| 162 | - * @brief Return boundary sky region | |
| 163 | - * | |
| 164 | - * @return Boundary sky region. | |
| 165 | - * | |
| 166 | - * Returns a sky region that fully encloses the spatial model component. | |
| 167 | - ***************************************************************************/ | |
| 168 | -inline | |
| 169 | -GSkyRegion* GModelSpatialRadialDisk::region(void) const | |
| 170 | -{ | |
| 171 | - set_region(); | |
| 172 | - return (&m_region); | |
| 173 | -} | |
| 174 | - | |
| 175 | 142 | #endif /* GMODELSPATIALRADIALDISK_HPP */ | ... | ... |
include/GModelSpatialRadialGauss.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GModelSpatialRadialGauss.hpp - Radial Gaussian source model class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2011-2016 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2011-2020 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -64,7 +64,6 @@ public: |
| 64 | 64 | virtual void clear(void); |
| 65 | 65 | virtual GModelSpatialRadialGauss* clone(void) const; |
| 66 | 66 | virtual std::string classname(void) const; |
| 67 | - virtual std::string type(void) const; | |
| 68 | 67 | virtual double eval(const double& theta, |
| 69 | 68 | const GEnergy& energy, |
| 70 | 69 | const GTime& time, |
| ... | ... | @@ -75,7 +74,6 @@ public: |
| 75 | 74 | virtual bool contains(const GSkyDir& dir, |
| 76 | 75 | const double& margin = 0.0) const; |
| 77 | 76 | virtual double theta_max(void) const; |
| 78 | - virtual GSkyRegion* region(void) const; | |
| 79 | 77 | virtual void read(const GXmlElement& xml); |
| 80 | 78 | virtual void write(GXmlElement& xml) const; |
| 81 | 79 | virtual std::string print(const GChatter& chatter = NORMAL) const; |
| ... | ... | @@ -86,15 +84,13 @@ public: |
| 86 | 84 | |
| 87 | 85 | protected: |
| 88 | 86 | // Protected methods |
| 89 | - void init_members(void); | |
| 90 | - void copy_members(const GModelSpatialRadialGauss& model); | |
| 91 | - void free_members(void); | |
| 92 | - void set_region(void) const; | |
| 87 | + void init_members(void); | |
| 88 | + void copy_members(const GModelSpatialRadialGauss& model); | |
| 89 | + void free_members(void); | |
| 90 | + virtual void set_region(void) const; | |
| 93 | 91 | |
| 94 | 92 | // Protected members |
| 95 | - std::string m_type; //!< Model type | |
| 96 | - GModelPar m_sigma; //!< Gaussian width (deg) | |
| 97 | - mutable GSkyRegionCircle m_region; //!< Bounding circle | |
| 93 | + GModelPar m_sigma; //!< Gaussian width (deg) | |
| 98 | 94 | }; |
| 99 | 95 | |
| 100 | 96 | |
| ... | ... | @@ -111,20 +107,6 @@ std::string GModelSpatialRadialGauss::classname(void) const |
| 111 | 107 | |
| 112 | 108 | |
| 113 | 109 | /***********************************************************************//** |
| 114 | - * @brief Return model type | |
| 115 | - * | |
| 116 | - * @return Model type. | |
| 117 | - * | |
| 118 | - * Returns the type of the radial Gauss model. | |
| 119 | - ***************************************************************************/ | |
| 120 | -inline | |
| 121 | -std::string GModelSpatialRadialGauss::type(void) const | |
| 122 | -{ | |
| 123 | - return (m_type); | |
| 124 | -} | |
| 125 | - | |
| 126 | - | |
| 127 | -/***********************************************************************//** | |
| 128 | 110 | * @brief Return Gaussian sigma |
| 129 | 111 | * |
| 130 | 112 | * @return Gaussian sigma (degrees). |
| ... | ... | @@ -152,19 +134,4 @@ void GModelSpatialRadialGauss::sigma(const double& sigma) |
| 152 | 134 | return; |
| 153 | 135 | } |
| 154 | 136 | |
| 155 | - | |
| 156 | -/***********************************************************************//** | |
| 157 | - * @brief Return boundary sky region | |
| 158 | - * | |
| 159 | - * @return Boundary sky region. | |
| 160 | - * | |
| 161 | - * Returns a sky region that fully encloses the spatial model component. | |
| 162 | - ***************************************************************************/ | |
| 163 | -inline | |
| 164 | -GSkyRegion* GModelSpatialRadialGauss::region(void) const | |
| 165 | -{ | |
| 166 | - set_region(); | |
| 167 | - return (&m_region); | |
| 168 | -} | |
| 169 | - | |
| 170 | 137 | #endif /* GMODELSPATIALRADIALGAUSS_HPP */ | ... | ... |
include/GModelSpatialRadialProfile.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GModelSpatialRadialProfile.hpp - Radial profile source model class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2016 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2016-2020 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -62,7 +62,6 @@ public: |
| 62 | 62 | virtual void clear(void) = 0; |
| 63 | 63 | virtual GModelSpatialRadialProfile* clone(void) const = 0; |
| 64 | 64 | virtual std::string classname(void) const = 0; |
| 65 | - virtual std::string type(void) const = 0; | |
| 66 | 65 | virtual double theta_min(void) const = 0; |
| 67 | 66 | virtual double theta_max(void) const = 0; |
| 68 | 67 | virtual std::string print(const GChatter& chatter = NORMAL) const = 0; |
| ... | ... | @@ -77,7 +76,6 @@ public: |
| 77 | 76 | GRan& ran) const; |
| 78 | 77 | virtual bool contains(const GSkyDir& dir, |
| 79 | 78 | const double& margin = 0.0) const; |
| 80 | - virtual GSkyRegion* region(void) const; | |
| 81 | 79 | |
| 82 | 80 | // Implement other methods |
| 83 | 81 | int num_nodes(void) const; |
| ... | ... | @@ -90,13 +88,11 @@ protected: |
| 90 | 88 | void free_members(void); |
| 91 | 89 | int cache_index(void) const; |
| 92 | 90 | virtual double profile_value(const double& theta) const = 0; |
| 93 | - void set_region(void) const; | |
| 91 | + virtual void set_region(void) const; | |
| 94 | 92 | |
| 95 | 93 | // Protected members |
| 96 | - bool m_coord_indep; //!< True if model independent | |
| 97 | - //!< of sky coordinates | |
| 98 | - int m_num_nodes; //!< Number of profile nodes | |
| 99 | - mutable GSkyRegionCircle m_region; //!< Bounding circle | |
| 94 | + bool m_coord_indep; //!< True if model independent of sky coordinates | |
| 95 | + int m_num_nodes; //!< Number of profile nodes | |
| 100 | 96 | |
| 101 | 97 | // Pre-computed radial profile |
| 102 | 98 | struct profile { |
| ... | ... | @@ -140,19 +136,4 @@ void GModelSpatialRadialProfile::num_nodes(const int& number) |
| 140 | 136 | return; |
| 141 | 137 | } |
| 142 | 138 | |
| 143 | - | |
| 144 | -/***********************************************************************//** | |
| 145 | - * @brief Return boundary sky region | |
| 146 | - * | |
| 147 | - * @return Boundary sky region. | |
| 148 | - * | |
| 149 | - * Returns a sky region that fully encloses the spatial model component. | |
| 150 | - ***************************************************************************/ | |
| 151 | -inline | |
| 152 | -GSkyRegion* GModelSpatialRadialProfile::region(void) const | |
| 153 | -{ | |
| 154 | - set_region(); | |
| 155 | - return (&m_region); | |
| 156 | -} | |
| 157 | - | |
| 158 | 139 | #endif /* GMODELSPATIALRADIALPROFILE_HPP */ | ... | ... |
include/GModelSpatialRadialProfileDMBurkert.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GModelSpatialRadialProfileDMBurkert.hpp - DM Burkert profile class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2016-2017 by Nathan Kelley-Hoskins * | |
| 4 | + * copyright (C) 2016-2020 by Nathan Kelley-Hoskins * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -62,13 +62,12 @@ public: |
| 62 | 62 | virtual void clear(void); |
| 63 | 63 | virtual GModelSpatialRadialProfileDMBurkert* clone(void) const; |
| 64 | 64 | virtual std::string classname(void) const; |
| 65 | - virtual std::string type(void) const; | |
| 66 | 65 | virtual double theta_min(void) const; |
| 67 | 66 | virtual double theta_max(void) const; |
| 68 | 67 | virtual void read(const GXmlElement& xml); |
| 69 | 68 | virtual void write(GXmlElement& xml) const; |
| 70 | 69 | virtual std::string print(const GChatter& chatter = NORMAL) const; |
| 71 | - | |
| 70 | + | |
| 72 | 71 | // Other methods |
| 73 | 72 | double scale_radius(void) const; |
| 74 | 73 | void scale_radius(const double& scale_radius); |
| ... | ... | @@ -135,74 +134,65 @@ std::string GModelSpatialRadialProfileDMBurkert::classname(void) const |
| 135 | 134 | |
| 136 | 135 | |
| 137 | 136 | /***********************************************************************//** |
| 138 | - * @brief Return model type | |
| 137 | + * @brief Return scale radius | |
| 139 | 138 | * |
| 140 | - * @return "DMBurkertProfile". | |
| 139 | + * @return Scale radius (kpc). | |
| 141 | 140 | * |
| 142 | - * Returns the type of the radial profile model. | |
| 141 | + * Returns the scale radius of the halo profile in kpc. | |
| 143 | 142 | ***************************************************************************/ |
| 144 | 143 | inline |
| 145 | -std::string GModelSpatialRadialProfileDMBurkert::type(void) const | |
| 144 | +double GModelSpatialRadialProfileDMBurkert::scale_radius(void) const | |
| 146 | 145 | { |
| 147 | - return "DMBurkertProfile"; | |
| 146 | + return (m_scale_radius.value()); | |
| 148 | 147 | } |
| 149 | 148 | |
| 150 | -/***********************************************************************//** | |
| 151 | - * @brief Return scale radius | |
| 152 | - * | |
| 153 | - * @return Scale radius (kpc). | |
| 154 | - * | |
| 155 | - * Returns the scale radius of the halo profile in kpc. | |
| 156 | - ***************************************************************************/ | |
| 157 | -inline | |
| 158 | -double GModelSpatialRadialProfileDMBurkert::scale_radius(void) const | |
| 159 | -{ | |
| 160 | - return (m_scale_radius.value()); | |
| 161 | -} | |
| 162 | - | |
| 149 | + | |
| 163 | 150 | /***********************************************************************//** |
| 164 | 151 | * @brief Set scale radius |
| 165 | - * | |
| 152 | + * | |
| 166 | 153 | * @param[in] radius Scale radius (kpc). |
| 167 | - * | |
| 154 | + * | |
| 168 | 155 | * Sets the scale radius of the halo profile in kpc. |
| 169 | 156 | ***************************************************************************/ |
| 170 | 157 | inline |
| 171 | 158 | void GModelSpatialRadialProfileDMBurkert::scale_radius(const double& radius) |
| 172 | -{ | |
| 159 | +{ | |
| 173 | 160 | m_scale_radius.value(radius); |
| 174 | 161 | return; |
| 175 | 162 | } |
| 176 | 163 | |
| 164 | + | |
| 177 | 165 | /***********************************************************************//** |
| 178 | 166 | * @brief Return scale density |
| 179 | - * | |
| 167 | + * | |
| 180 | 168 | * @return Scale density (GeV/cm^3). |
| 181 | - * | |
| 169 | + * | |
| 182 | 170 | * Returns the scale density (mass/volume density at the scale radius) of |
| 183 | 171 | * the halo profile in GeV/cm^3. |
| 184 | 172 | ***************************************************************************/ |
| 185 | -inline | |
| 173 | +inline | |
| 186 | 174 | double GModelSpatialRadialProfileDMBurkert::scale_density(void) const |
| 187 | -{ | |
| 175 | +{ | |
| 188 | 176 | return (m_scale_density.value()); |
| 189 | -} | |
| 190 | - | |
| 177 | +} | |
| 178 | + | |
| 179 | + | |
| 191 | 180 | /***********************************************************************//** |
| 192 | 181 | * @brief Set scale density |
| 193 | - * | |
| 182 | + * | |
| 194 | 183 | * @param[in] density Scale density (GeV/cm^3). |
| 195 | - * | |
| 184 | + * | |
| 196 | 185 | * Sets the scale density ( mass/volume density at the scale radius) of the |
| 197 | 186 | * halo profile in GeV/cm^3. |
| 198 | 187 | ***************************************************************************/ |
| 199 | 188 | inline |
| 200 | 189 | void GModelSpatialRadialProfileDMBurkert::scale_density(const double& density) |
| 201 | -{ | |
| 190 | +{ | |
| 202 | 191 | m_scale_density.value(density); |
| 203 | 192 | return; |
| 204 | 193 | } |
| 205 | 194 | |
| 195 | + | |
| 206 | 196 | /***********************************************************************//** |
| 207 | 197 | * @brief Return halo distance |
| 208 | 198 | * |
| ... | ... | @@ -216,9 +206,10 @@ double GModelSpatialRadialProfileDMBurkert::halo_distance(void) const |
| 216 | 206 | return (m_halo_distance.value()); |
| 217 | 207 | } |
| 218 | 208 | |
| 209 | + | |
| 219 | 210 | /***********************************************************************//** |
| 220 | 211 | * @brief Set halo distance |
| 221 | - * | |
| 212 | + * | |
| 222 | 213 | * @param[in] distance Halo distance (kpc). |
| 223 | 214 | * |
| 224 | 215 | * Sets the distance between the observer and the halo center in kpc. | ... | ... |
include/GModelSpatialRadialProfileDMEinasto.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GModelSpatialRadialProfileDMEinasto.hpp - DM Einasto profile class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2016-2017 by Nathan Kelley-Hoskins * | |
| 4 | + * copyright (C) 2016-2020 by Nathan Kelley-Hoskins * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -62,13 +62,12 @@ public: |
| 62 | 62 | virtual void clear(void); |
| 63 | 63 | virtual GModelSpatialRadialProfileDMEinasto* clone(void) const; |
| 64 | 64 | virtual std::string classname(void) const; |
| 65 | - virtual std::string type(void) const; | |
| 66 | 65 | virtual double theta_min(void) const; |
| 67 | 66 | virtual double theta_max(void) const; |
| 68 | 67 | virtual void read(const GXmlElement& xml); |
| 69 | 68 | virtual void write(GXmlElement& xml) const; |
| 70 | 69 | virtual std::string print(const GChatter& chatter = NORMAL) const; |
| 71 | - | |
| 70 | + | |
| 72 | 71 | // Other methods |
| 73 | 72 | double scale_radius(void) const; |
| 74 | 73 | void scale_radius(const double& scale_radius); |
| ... | ... | @@ -119,7 +118,7 @@ protected: |
| 119 | 118 | GModelPar m_halo_distance; //!< Distance from earth to halo center |
| 120 | 119 | GModelPar m_alpha; //!< Einasto spatial power index |
| 121 | 120 | GModelPar m_core_radius; //!< Core radius |
| 122 | - | |
| 121 | + | |
| 123 | 122 | // Cached members used for pre-computation |
| 124 | 123 | mutable double m_last_scale_radius; |
| 125 | 124 | mutable double m_last_scale_density; |
| ... | ... | @@ -141,19 +140,6 @@ std::string GModelSpatialRadialProfileDMEinasto::classname(void) const |
| 141 | 140 | |
| 142 | 141 | |
| 143 | 142 | /***********************************************************************//** |
| 144 | - * @brief Return model type | |
| 145 | - * | |
| 146 | - * @return "DMEinastoProfile". | |
| 147 | - * | |
| 148 | - * Returns the type of the radial profile model. | |
| 149 | - ***************************************************************************/ | |
| 150 | -inline | |
| 151 | -std::string GModelSpatialRadialProfileDMEinasto::type(void) const | |
| 152 | -{ | |
| 153 | - return "DMEinastoProfile"; | |
| 154 | -} | |
| 155 | - | |
| 156 | -/***********************************************************************//** | |
| 157 | 143 | * @brief Return scale radius |
| 158 | 144 | * |
| 159 | 145 | * @return scale radius (kpc). |
| ... | ... | @@ -166,9 +152,10 @@ double GModelSpatialRadialProfileDMEinasto::scale_radius(void) const |
| 166 | 152 | return (m_scale_radius.value()); |
| 167 | 153 | } |
| 168 | 154 | |
| 155 | + | |
| 169 | 156 | /***********************************************************************//** |
| 170 | 157 | * @brief Set scale radius |
| 171 | - * | |
| 158 | + * | |
| 172 | 159 | * @param[in] radius Scale radius (kpc). |
| 173 | 160 | * |
| 174 | 161 | * Sets the scale radius of the halo profile in kpc. |
| ... | ... | @@ -180,6 +167,7 @@ void GModelSpatialRadialProfileDMEinasto::scale_radius(const double& radius) |
| 180 | 167 | return; |
| 181 | 168 | } |
| 182 | 169 | |
| 170 | + | |
| 183 | 171 | /***********************************************************************//** |
| 184 | 172 | * @brief Return scale density |
| 185 | 173 | * |
| ... | ... | @@ -193,9 +181,10 @@ double GModelSpatialRadialProfileDMEinasto::scale_density(void) const |
| 193 | 181 | return (m_scale_density.value()); |
| 194 | 182 | } |
| 195 | 183 | |
| 184 | + | |
| 196 | 185 | /***********************************************************************//** |
| 197 | 186 | * @brief Set scale density |
| 198 | - * | |
| 187 | + * | |
| 199 | 188 | * @param[in] density Scale density (GeV/cm^3). |
| 200 | 189 | * |
| 201 | 190 | * Sets the scale density (mass/volume density at the scale radius) of |
| ... | ... | @@ -208,6 +197,7 @@ void GModelSpatialRadialProfileDMEinasto::scale_density(const double& density) |
| 208 | 197 | return; |
| 209 | 198 | } |
| 210 | 199 | |
| 200 | + | |
| 211 | 201 | /***********************************************************************//** |
| 212 | 202 | * @brief Return halo distance |
| 213 | 203 | * |
| ... | ... | @@ -221,9 +211,10 @@ double GModelSpatialRadialProfileDMEinasto::halo_distance(void) const |
| 221 | 211 | return (m_halo_distance.value()); |
| 222 | 212 | } |
| 223 | 213 | |
| 214 | + | |
| 224 | 215 | /***********************************************************************//** |
| 225 | 216 | * @brief Set halo distance |
| 226 | - * | |
| 217 | + * | |
| 227 | 218 | * @param[in] distance Halo distance (kpc). |
| 228 | 219 | * |
| 229 | 220 | * Sets the distance between the observer and the halo center in kpc. |
| ... | ... | @@ -235,6 +226,7 @@ void GModelSpatialRadialProfileDMEinasto::halo_distance(const double& distance) |
| 235 | 226 | return; |
| 236 | 227 | } |
| 237 | 228 | |
| 229 | + | |
| 238 | 230 | /***********************************************************************//** |
| 239 | 231 | * @brief Return Einasto alpha power index |
| 240 | 232 | * |
| ... | ... | @@ -248,9 +240,10 @@ double GModelSpatialRadialProfileDMEinasto::alpha(void) const |
| 248 | 240 | return (m_alpha.value()); |
| 249 | 241 | } |
| 250 | 242 | |
| 243 | + | |
| 251 | 244 | /***********************************************************************//** |
| 252 | 245 | * @brief Set Einasto profile power index |
| 253 | - * | |
| 246 | + * | |
| 254 | 247 | * @param[in] alpha Einasto profile power index (unitless). |
| 255 | 248 | * |
| 256 | 249 | * Sets the Einasto profile power index, should be positive. | ... | ... |
include/GModelSpatialRadialProfileDMZhao.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GModelSpatialRadialProfileDMZhao.hpp - DM Zhao profile class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2016-2017 by Nathan Kelley-Hoskins * | |
| 4 | + * copyright (C) 2016-2020 by Nathan Kelley-Hoskins * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -62,7 +62,6 @@ public: |
| 62 | 62 | virtual void clear(void); |
| 63 | 63 | virtual GModelSpatialRadialProfileDMZhao* clone(void) const; |
| 64 | 64 | virtual std::string classname(void) const; |
| 65 | - virtual std::string type(void) const; | |
| 66 | 65 | virtual double theta_min(void) const; |
| 67 | 66 | virtual double theta_max(void) const; |
| 68 | 67 | virtual void read(const GXmlElement& xml); |
| ... | ... | @@ -153,19 +152,6 @@ std::string GModelSpatialRadialProfileDMZhao::classname(void) const |
| 153 | 152 | |
| 154 | 153 | |
| 155 | 154 | /***********************************************************************//** |
| 156 | - * @brief Return model type | |
| 157 | - * | |
| 158 | - * @return "DMZhaoProfile". | |
| 159 | - * | |
| 160 | - * Returns the type of the radial profile model. | |
| 161 | - ***************************************************************************/ | |
| 162 | -inline | |
| 163 | -std::string GModelSpatialRadialProfileDMZhao::type(void) const | |
| 164 | -{ | |
| 165 | - return "DMZhaoProfile"; | |
| 166 | -} | |
| 167 | - | |
| 168 | -/***********************************************************************//** | |
| 169 | 155 | * @brief Return scale radius |
| 170 | 156 | * |
| 171 | 157 | * @return Scale radius (kpc). |
| ... | ... | @@ -178,6 +164,7 @@ double GModelSpatialRadialProfileDMZhao::scale_radius(void) const |
| 178 | 164 | return (m_scale_radius.value()); |
| 179 | 165 | } |
| 180 | 166 | |
| 167 | + | |
| 181 | 168 | /***********************************************************************//** |
| 182 | 169 | * @brief Set scale radius |
| 183 | 170 | * |
| ... | ... | @@ -192,6 +179,7 @@ void GModelSpatialRadialProfileDMZhao::scale_radius(const double& radius) |
| 192 | 179 | return; |
| 193 | 180 | } |
| 194 | 181 | |
| 182 | + | |
| 195 | 183 | /***********************************************************************//** |
| 196 | 184 | * @brief Return scale density |
| 197 | 185 | * |
| ... | ... | @@ -206,6 +194,7 @@ double GModelSpatialRadialProfileDMZhao::scale_density(void) const |
| 206 | 194 | return (m_scale_density.value()); |
| 207 | 195 | } |
| 208 | 196 | |
| 197 | + | |
| 209 | 198 | /***********************************************************************//** |
| 210 | 199 | * @brief Set scale density |
| 211 | 200 | * |
| ... | ... | @@ -221,6 +210,7 @@ void GModelSpatialRadialProfileDMZhao::scale_density(const double& density) |
| 221 | 210 | return; |
| 222 | 211 | } |
| 223 | 212 | |
| 213 | + | |
| 224 | 214 | /***********************************************************************//** |
| 225 | 215 | * @brief Return halo distance |
| 226 | 216 | * |
| ... | ... | @@ -234,9 +224,10 @@ double GModelSpatialRadialProfileDMZhao::halo_distance(void) const |
| 234 | 224 | return (m_halo_distance.value()); |
| 235 | 225 | } |
| 236 | 226 | |
| 227 | + | |
| 237 | 228 | /***********************************************************************//** |
| 238 | 229 | * @brief Set halo distance |
| 239 | - * | |
| 230 | + * | |
| 240 | 231 | * @param[in] distance Halo distance (kpc). |
| 241 | 232 | * |
| 242 | 233 | * Sets the distance between the observer and the halo center in kpc. |
| ... | ... | @@ -248,6 +239,7 @@ void GModelSpatialRadialProfileDMZhao::halo_distance(const double& distance) |
| 248 | 239 | return; |
| 249 | 240 | } |
| 250 | 241 | |
| 242 | + | |
| 251 | 243 | /***********************************************************************//** |
| 252 | 244 | * @brief Return Zhao alpha power index |
| 253 | 245 | * |
| ... | ... | @@ -261,9 +253,10 @@ double GModelSpatialRadialProfileDMZhao::alpha(void) const |
| 261 | 253 | return (m_alpha.value()); |
| 262 | 254 | } |
| 263 | 255 | |
| 256 | + | |
| 264 | 257 | /***********************************************************************//** |
| 265 | 258 | * @brief Set Zhao alpha power index |
| 266 | - * | |
| 259 | + * | |
| 267 | 260 | * @param[in] alpha (unitless). |
| 268 | 261 | * |
| 269 | 262 | * Sets the Zhao profile alpha power index. |
| ... | ... | @@ -275,6 +268,7 @@ void GModelSpatialRadialProfileDMZhao::alpha(const double& alpha) |
| 275 | 268 | return; |
| 276 | 269 | } |
| 277 | 270 | |
| 271 | + | |
| 278 | 272 | /***********************************************************************//** |
| 279 | 273 | * @brief Return Zhao beta power index |
| 280 | 274 | * |
| ... | ... | @@ -288,6 +282,7 @@ double GModelSpatialRadialProfileDMZhao::beta(void) const |
| 288 | 282 | return (m_beta.value()); |
| 289 | 283 | } |
| 290 | 284 | |
| 285 | + | |
| 291 | 286 | /***********************************************************************//** |
| 292 | 287 | * @brief Set Zhao beta power index |
| 293 | 288 | * |
| ... | ... | @@ -302,6 +297,7 @@ void GModelSpatialRadialProfileDMZhao::beta(const double& beta) |
| 302 | 297 | return; |
| 303 | 298 | } |
| 304 | 299 | |
| 300 | + | |
| 305 | 301 | /***********************************************************************//** |
| 306 | 302 | * @brief Return Zhao gamma power index |
| 307 | 303 | * |
| ... | ... | @@ -315,6 +311,7 @@ double GModelSpatialRadialProfileDMZhao::gamma(void) const |
| 315 | 311 | return (m_gamma.value()); |
| 316 | 312 | } |
| 317 | 313 | |
| 314 | + | |
| 318 | 315 | /***********************************************************************//** |
| 319 | 316 | * @brief Set Zhao gamma power index |
| 320 | 317 | * | ... | ... |
include/GModelSpatialRadialProfileGauss.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GModelSpatialRadialProfileGauss.hpp - Gaussian radial profile class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2016-2018 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2016-2020 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -61,7 +61,6 @@ public: |
| 61 | 61 | virtual void clear(void); |
| 62 | 62 | virtual GModelSpatialRadialProfileGauss* clone(void) const; |
| 63 | 63 | virtual std::string classname(void) const; |
| 64 | - virtual std::string type(void) const; | |
| 65 | 64 | virtual double theta_min(void) const; |
| 66 | 65 | virtual double theta_max(void) const; |
| 67 | 66 | virtual void read(const GXmlElement& xml); |
| ... | ... | @@ -97,20 +96,6 @@ std::string GModelSpatialRadialProfileGauss::classname(void) const |
| 97 | 96 | |
| 98 | 97 | |
| 99 | 98 | /***********************************************************************//** |
| 100 | - * @brief Return model type | |
| 101 | - * | |
| 102 | - * @return "GaussianProfile". | |
| 103 | - * | |
| 104 | - * Returns the type of the radial profile model. | |
| 105 | - ***************************************************************************/ | |
| 106 | -inline | |
| 107 | -std::string GModelSpatialRadialProfileGauss::type(void) const | |
| 108 | -{ | |
| 109 | - return "GaussianProfile"; | |
| 110 | -} | |
| 111 | - | |
| 112 | - | |
| 113 | -/***********************************************************************//** | |
| 114 | 99 | * @brief Return Gaussian sigma |
| 115 | 100 | * |
| 116 | 101 | * @return Gaussian sigma (degrees). | ... | ... |
include/GModelSpatialRadialRing.hpp
| ... | ... | @@ -62,7 +62,6 @@ public: |
| 62 | 62 | virtual void clear(void); |
| 63 | 63 | virtual GModelSpatialRadialRing* clone(void) const; |
| 64 | 64 | virtual std::string classname(void) const; |
| 65 | - virtual std::string type(void) const; | |
| 66 | 65 | virtual double eval(const double& theta, |
| 67 | 66 | const GEnergy& energy, |
| 68 | 67 | const GTime& time, |
| ... | ... | @@ -74,7 +73,6 @@ public: |
| 74 | 73 | const double& margin = 0.0) const; |
| 75 | 74 | virtual double theta_min(void) const; |
| 76 | 75 | virtual double theta_max(void) const; |
| 77 | - virtual GSkyRegion* region(void) const; | |
| 78 | 76 | virtual void read(const GXmlElement& xml); |
| 79 | 77 | virtual void write(GXmlElement& xml) const; |
| 80 | 78 | virtual std::string print(const GChatter& chatter = NORMAL) const; |
| ... | ... | @@ -87,17 +85,15 @@ public: |
| 87 | 85 | |
| 88 | 86 | protected: |
| 89 | 87 | // Protected methods |
| 90 | - void init_members(void); | |
| 91 | - void copy_members(const GModelSpatialRadialRing& model); | |
| 92 | - void free_members(void); | |
| 93 | - void update(void) const; | |
| 94 | - void set_region(void) const; | |
| 88 | + void init_members(void); | |
| 89 | + void copy_members(const GModelSpatialRadialRing& model); | |
| 90 | + void free_members(void); | |
| 91 | + void update(void) const; | |
| 92 | + virtual void set_region(void) const; | |
| 95 | 93 | |
| 96 | 94 | // Protected members |
| 97 | - std::string m_type; //!< Model type | |
| 98 | - GModelPar m_radius; //!< Ring inner radius (degrees) | |
| 99 | - GModelPar m_width; //!< Ring width (degrees) | |
| 100 | - mutable GSkyRegionCircle m_region; //!< Bounding circle | |
| 95 | + GModelPar m_radius; //!< Ring inner radius (degrees) | |
| 96 | + GModelPar m_width; //!< Ring width (degrees) | |
| 101 | 97 | |
| 102 | 98 | // Cached members used for pre-computations |
| 103 | 99 | mutable double m_last_radius; //!< Last ring radius |
| ... | ... | @@ -123,20 +119,6 @@ std::string GModelSpatialRadialRing::classname(void) const |
| 123 | 119 | |
| 124 | 120 | |
| 125 | 121 | /***********************************************************************//** |
| 126 | - * @brief Return model type | |
| 127 | - * | |
| 128 | - * @return Model type. | |
| 129 | - * | |
| 130 | - * Returns the type of the radial ring model. | |
| 131 | - ***************************************************************************/ | |
| 132 | -inline | |
| 133 | -std::string GModelSpatialRadialRing::type(void) const | |
| 134 | -{ | |
| 135 | - return (m_type); | |
| 136 | -} | |
| 137 | - | |
| 138 | - | |
| 139 | -/***********************************************************************//** | |
| 140 | 122 | * @brief Return ring inner radius |
| 141 | 123 | * |
| 142 | 124 | * @return Ring inner radius (degrees). |
| ... | ... | @@ -193,18 +175,4 @@ void GModelSpatialRadialRing::width(const double& width) |
| 193 | 175 | return; |
| 194 | 176 | } |
| 195 | 177 | |
| 196 | -/***********************************************************************//** | |
| 197 | - * @brief Return boundary sky region | |
| 198 | - * | |
| 199 | - * @return Boundary sky region. | |
| 200 | - * | |
| 201 | - * Returns a sky region that fully encloses the spatial model component. | |
| 202 | - ***************************************************************************/ | |
| 203 | -inline | |
| 204 | -GSkyRegion* GModelSpatialRadialRing::region(void) const | |
| 205 | -{ | |
| 206 | - set_region(); | |
| 207 | - return (&m_region); | |
| 208 | -} | |
| 209 | - | |
| 210 | 178 | #endif /* GMODELSPATIALRADIALRING_HPP */ | ... | ... |
include/GModelSpatialRadialShell.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GModelSpatialRadialShell.hpp - Radial shell source model class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2011-2016 by Christoph Deil * | |
| 4 | + * copyright (C) 2011-2020 by Christoph Deil * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -75,7 +75,6 @@ public: |
| 75 | 75 | virtual void clear(void); |
| 76 | 76 | virtual GModelSpatialRadialShell* clone(void) const; |
| 77 | 77 | virtual std::string classname(void) const; |
| 78 | - virtual std::string type(void) const; | |
| 79 | 78 | virtual double eval(const double& theta, |
| 80 | 79 | const GEnergy& energy, |
| 81 | 80 | const GTime& time, |
| ... | ... | @@ -86,7 +85,6 @@ public: |
| 86 | 85 | virtual bool contains(const GSkyDir& dir, |
| 87 | 86 | const double& margin = 0.0) const; |
| 88 | 87 | virtual double theta_max(void) const; |
| 89 | - virtual GSkyRegion* region(void) const; | |
| 90 | 88 | virtual void read(const GXmlElement& xml); |
| 91 | 89 | virtual void write(GXmlElement& xml) const; |
| 92 | 90 | virtual std::string print(const GChatter& chatter = NORMAL) const; |
| ... | ... | @@ -105,13 +103,11 @@ protected: |
| 105 | 103 | void update(void) const; |
| 106 | 104 | static double f1(double x); |
| 107 | 105 | static double f2(double x); |
| 108 | - void set_region(void) const; | |
| 106 | + virtual void set_region(void) const; | |
| 109 | 107 | |
| 110 | 108 | // Protected members |
| 111 | - std::string m_type; //!< Model type | |
| 112 | - GModelPar m_radius; //!< Inner shell radius (deg) | |
| 113 | - GModelPar m_width; //!< Shell thickness (deg) | |
| 114 | - mutable GSkyRegionCircle m_region; //!< Bounding circle | |
| 109 | + GModelPar m_radius; //!< Inner shell radius (deg) | |
| 110 | + GModelPar m_width; //!< Shell thickness (deg) | |
| 115 | 111 | |
| 116 | 112 | // Cached members used for pre-computations |
| 117 | 113 | mutable double m_last_radius; //!< Last shell radius (deg) |
| ... | ... | @@ -137,20 +133,6 @@ std::string GModelSpatialRadialShell::classname(void) const |
| 137 | 133 | |
| 138 | 134 | |
| 139 | 135 | /***********************************************************************//** |
| 140 | - * @brief Return model type | |
| 141 | - * | |
| 142 | - * @return Model type. | |
| 143 | - * | |
| 144 | - * Returns the type of the radial shell model. | |
| 145 | - ***************************************************************************/ | |
| 146 | -inline | |
| 147 | -std::string GModelSpatialRadialShell::type(void) const | |
| 148 | -{ | |
| 149 | - return (m_type); | |
| 150 | -} | |
| 151 | - | |
| 152 | - | |
| 153 | -/***********************************************************************//** | |
| 154 | 136 | * @brief Return shell radius |
| 155 | 137 | * |
| 156 | 138 | * @return Shell radius (degrees). |
| ... | ... | @@ -207,19 +189,4 @@ void GModelSpatialRadialShell::width(const double& width) |
| 207 | 189 | return; |
| 208 | 190 | } |
| 209 | 191 | |
| 210 | - | |
| 211 | -/***********************************************************************//** | |
| 212 | - * @brief Return boundary sky region | |
| 213 | - * | |
| 214 | - * @return Boundary sky region. | |
| 215 | - * | |
| 216 | - * Returns a sky region that fully encloses the spatial model component. | |
| 217 | - ***************************************************************************/ | |
| 218 | -inline | |
| 219 | -GSkyRegion* GModelSpatialRadialShell::region(void) const | |
| 220 | -{ | |
| 221 | - set_region(); | |
| 222 | - return (&m_region); | |
| 223 | -} | |
| 224 | - | |
| 225 | 192 | #endif /* GMODELSPATIALRADIALSHELL_HPP */ | ... | ... |
pyext/GModelSpatial.i
| ... | ... | @@ -46,7 +46,6 @@ public: |
| 46 | 46 | virtual void clear(void) = 0; |
| 47 | 47 | virtual GModelSpatial* clone(void) const = 0; |
| 48 | 48 | virtual std::string classname(void) const = 0; |
| 49 | - virtual std::string type(void) const = 0; | |
| 50 | 49 | virtual double eval(const GPhoton& photon, |
| 51 | 50 | const bool& gradients = false) const = 0; |
| 52 | 51 | virtual GSkyDir mc(const GEnergy& energy, const GTime& time, |
| ... | ... | @@ -57,16 +56,20 @@ public: |
| 57 | 56 | const double& margin = 0.0) const = 0; |
| 58 | 57 | virtual void read(const GXmlElement& xml) = 0; |
| 59 | 58 | virtual void write(GXmlElement& xml) const = 0; |
| 60 | - virtual GSkyRegion* region(void) const = 0; | |
| 61 | 59 | |
| 62 | 60 | // Methods |
| 63 | - bool has_par(const std::string& name) const; | |
| 64 | - bool has_free_pars(void) const; | |
| 65 | - int size(void) const; | |
| 66 | - void autoscale(void); | |
| 67 | - double flux(const GSkyRegion* reg, | |
| 68 | - const GEnergy& srcEng = GEnergy(), | |
| 69 | - const GTime& srcTime = GTime()) const; | |
| 61 | + std::string type(void) const; | |
| 62 | + void type(const std::string& type); | |
| 63 | + GModelPar& at(const int& index); | |
| 64 | + const GModelPar& at(const int& index) const; | |
| 65 | + bool has_par(const std::string& name) const; | |
| 66 | + bool has_free_pars(void) const; | |
| 67 | + int size(void) const; | |
| 68 | + void autoscale(void); | |
| 69 | + double flux(const GSkyRegion* reg, | |
| 70 | + const GEnergy& srcEng = GEnergy(), | |
| 71 | + const GTime& srcTime = GTime()) const; | |
| 72 | + const GSkyRegion* region(void) const; | |
| 70 | 73 | }; |
| 71 | 74 | |
| 72 | 75 | ... | ... |
pyext/GModelSpatialComposite.i
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GModelSpatialComposite.i - Spatial point source model class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2016-2017 by Domenico Tiziani * | |
| 4 | + * copyright (C) 2016-2020 by Domenico Tiziani * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -47,7 +47,6 @@ public: |
| 47 | 47 | virtual void clear(void); |
| 48 | 48 | virtual GModelSpatialComposite* clone(void) const; |
| 49 | 49 | virtual std::string classname(void) const; |
| 50 | - virtual std::string type(void) const; | |
| 51 | 50 | virtual double eval(const GPhoton& photon, |
| 52 | 51 | const bool& gradients = false) const; |
| 53 | 52 | virtual GSkyDir mc(const GEnergy& energy, |
| ... | ... | @@ -57,12 +56,10 @@ public: |
| 57 | 56 | const double& radius) const; |
| 58 | 57 | virtual bool contains(const GSkyDir& dir, |
| 59 | 58 | const double& margin = 0.0) const; |
| 60 | - virtual GSkyRegion* region(void) const; | |
| 61 | 59 | virtual void read(const GXmlElement& xml); |
| 62 | 60 | virtual void write(GXmlElement& xml) const; |
| 63 | 61 | |
| 64 | 62 | // Other methods |
| 65 | - void type(const std::string& type); | |
| 66 | 63 | int components(void) const; |
| 67 | 64 | void append(const GModelSpatial& component, |
| 68 | 65 | const std::string& name = "", | ... | ... |
pyext/GModelSpatialDiffuse.i
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GModelSpatialDiffuse.i - Abstract diffuse spatial model base class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2013-2016 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2013-2020 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -45,7 +45,6 @@ public: |
| 45 | 45 | virtual void clear(void) = 0; |
| 46 | 46 | virtual GModelSpatialDiffuse* clone(void) const = 0; |
| 47 | 47 | virtual std::string classname(void) const = 0; |
| 48 | - virtual std::string type(void) const = 0; | |
| 49 | 48 | virtual double eval(const GPhoton& photon, |
| 50 | 49 | const bool& gradients = false) const = 0; |
| 51 | 50 | virtual GSkyDir mc(const GEnergy& energy, const GTime& time, |
| ... | ... | @@ -54,7 +53,6 @@ public: |
| 54 | 53 | const double& radius) const = 0; |
| 55 | 54 | virtual bool contains(const GSkyDir& dir, |
| 56 | 55 | const double& margin = 0.0) const = 0; |
| 57 | - virtual GSkyRegion* region(void) const = 0; | |
| 58 | 56 | virtual void read(const GXmlElement& xml) = 0; |
| 59 | 57 | virtual void write(GXmlElement& xml) const = 0; |
| 60 | 58 | }; | ... | ... |
pyext/GModelSpatialDiffuseConst.i
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GModelSpatialDiffuseConst.i - Spatial isotropic model class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2011-2018 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2011-2020 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -47,7 +47,6 @@ public: |
| 47 | 47 | virtual void clear(void); |
| 48 | 48 | virtual GModelSpatialDiffuseConst* clone(void) const; |
| 49 | 49 | virtual std::string classname(void) const; |
| 50 | - virtual std::string type(void) const; | |
| 51 | 50 | virtual double eval(const GPhoton& photon, |
| 52 | 51 | const bool& gradients = false) const; |
| 53 | 52 | virtual GSkyDir mc(const GEnergy& energy, |
| ... | ... | @@ -57,7 +56,6 @@ public: |
| 57 | 56 | const double& radius) const; |
| 58 | 57 | virtual bool contains(const GSkyDir& dir, |
| 59 | 58 | const double& margin = 0.0) const; |
| 60 | - virtual GSkyRegion* region(void) const; | |
| 61 | 59 | virtual void read(const GXmlElement& xml); |
| 62 | 60 | virtual void write(GXmlElement& xml) const; |
| 63 | 61 | ... | ... |
pyext/GModelSpatialElliptical.i
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GModelSpatialElliptical.i - Abstract elliptical spatial model class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2013-2016 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2013-2020 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -46,7 +46,6 @@ public: |
| 46 | 46 | virtual void clear(void) = 0; |
| 47 | 47 | virtual GModelSpatialElliptical* clone(void) const = 0; |
| 48 | 48 | virtual std::string classname(void) const = 0; |
| 49 | - virtual std::string type(void) const = 0; | |
| 50 | 49 | virtual double eval(const double& theta, |
| 51 | 50 | const double& posangle, |
| 52 | 51 | const GEnergy& energy, |
| ... | ... | @@ -58,7 +57,6 @@ public: |
| 58 | 57 | const GTime& time, |
| 59 | 58 | GRan& ran) const = 0; |
| 60 | 59 | virtual double theta_max(void) const = 0; |
| 61 | - virtual GSkyRegion* region(void) const = 0; | |
| 62 | 60 | |
| 63 | 61 | // Implemented virtual methods |
| 64 | 62 | virtual double eval(const GPhoton& photon, | ... | ... |
pyext/GModelSpatialEllipticalDisk.i
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GModelSpatialEllipticalDisk.i - Elliptical disk source model class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2013-2018 by Michael Mayer * | |
| 4 | + * copyright (C) 2013-2020 by Michael Mayer * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -51,7 +51,6 @@ public: |
| 51 | 51 | virtual void clear(void); |
| 52 | 52 | virtual GModelSpatialEllipticalDisk* clone(void) const; |
| 53 | 53 | virtual std::string classname(void) const; |
| 54 | - virtual std::string type(void) const; | |
| 55 | 54 | virtual double eval(const double& theta, |
| 56 | 55 | const double& posangle, |
| 57 | 56 | const GEnergy& energy, |
| ... | ... | @@ -63,7 +62,6 @@ public: |
| 63 | 62 | virtual bool contains(const GSkyDir& dir, |
| 64 | 63 | const double& margin = 0.0) const; |
| 65 | 64 | virtual double theta_max(void) const; |
| 66 | - virtual GSkyRegion* region(void) const; | |
| 67 | 65 | virtual void read(const GXmlElement& xml); |
| 68 | 66 | virtual void write(GXmlElement& xml) const; |
| 69 | 67 | }; | ... | ... |
pyext/GModelSpatialEllipticalGauss.i
| ... | ... | @@ -51,7 +51,6 @@ public: |
| 51 | 51 | virtual void clear(void); |
| 52 | 52 | virtual GModelSpatialEllipticalGauss* clone(void) const; |
| 53 | 53 | virtual std::string classname(void) const; |
| 54 | - virtual std::string type(void) const; | |
| 55 | 54 | virtual double eval(const double& theta, |
| 56 | 55 | const double& posangle, |
| 57 | 56 | const GEnergy& energy, |
| ... | ... | @@ -63,7 +62,6 @@ public: |
| 63 | 62 | virtual bool contains(const GSkyDir& dir, |
| 64 | 63 | const double& margin = 0.0) const; |
| 65 | 64 | virtual double theta_max(void) const; |
| 66 | - virtual GSkyRegion* region(void) const; | |
| 67 | 65 | virtual void read(const GXmlElement& xml); |
| 68 | 66 | virtual void write(GXmlElement& xml) const; |
| 69 | 67 | }; | ... | ... |
pyext/GModelSpatialPointSource.i
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GModelSpatialPointSource.i - Spatial point source model class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2009-2018 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2009-2020 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -49,7 +49,6 @@ public: |
| 49 | 49 | virtual void clear(void); |
| 50 | 50 | virtual GModelSpatialPointSource* clone(void) const; |
| 51 | 51 | virtual std::string classname(void) const; |
| 52 | - virtual std::string type(void) const; | |
| 53 | 52 | virtual double eval(const GPhoton& photon, |
| 54 | 53 | const bool& gradients = false) const; |
| 55 | 54 | virtual GSkyDir mc(const GEnergy& energy, |
| ... | ... | @@ -61,10 +60,8 @@ public: |
| 61 | 60 | const double& margin = 0.0) const; |
| 62 | 61 | virtual void read(const GXmlElement& xml); |
| 63 | 62 | virtual void write(GXmlElement& xml) const; |
| 64 | - virtual GSkyRegion* region(void) const; | |
| 65 | 63 | |
| 66 | 64 | // Other methods |
| 67 | - void type(const std::string& type); | |
| 68 | 65 | double ra(void) const; |
| 69 | 66 | double dec(void) const; |
| 70 | 67 | void ra(const double& ra); | ... | ... |
pyext/GModelSpatialRadial.i
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GModelSpatialRadial.i - Abstract radial spatial model base class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2011-2016 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2011-2020 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -47,7 +47,6 @@ public: |
| 47 | 47 | virtual void clear(void) = 0; |
| 48 | 48 | virtual GModelSpatialRadial* clone(void) const = 0; |
| 49 | 49 | virtual std::string classname(void) const = 0; |
| 50 | - virtual std::string type(void) const = 0; | |
| 51 | 50 | virtual double eval(const double& theta, |
| 52 | 51 | const GEnergy& energy, |
| 53 | 52 | const GTime& time, |
| ... | ... | @@ -58,7 +57,6 @@ public: |
| 58 | 57 | virtual bool contains(const GSkyDir& dir, |
| 59 | 58 | const double& margin = 0.0) const = 0; |
| 60 | 59 | virtual double theta_max(void) const = 0; |
| 61 | - virtual GSkyRegion* region(void) const = 0; | |
| 62 | 60 | |
| 63 | 61 | // Implemented virtual base class methods |
| 64 | 62 | virtual double eval(const GPhoton& photon, | ... | ... |
pyext/GModelSpatialRadialDisk.i
| ... | ... | @@ -51,7 +51,6 @@ public: |
| 51 | 51 | virtual void clear(void); |
| 52 | 52 | virtual GModelSpatialRadialDisk* clone(void) const; |
| 53 | 53 | virtual std::string classname(void) const; |
| 54 | - virtual std::string type(void) const; | |
| 55 | 54 | virtual double eval(const double& theta, |
| 56 | 55 | const GEnergy& energy, |
| 57 | 56 | const GTime& time, |
| ... | ... | @@ -62,7 +61,6 @@ public: |
| 62 | 61 | virtual bool contains(const GSkyDir& dir, |
| 63 | 62 | const double& margin = 0.0) const; |
| 64 | 63 | virtual double theta_max(void) const; |
| 65 | - virtual GSkyRegion* region(void) const; | |
| 66 | 64 | virtual void read(const GXmlElement& xml); |
| 67 | 65 | virtual void write(GXmlElement& xml) const; |
| 68 | 66 | ... | ... |
pyext/GModelSpatialRadialGauss.i
| ... | ... | @@ -48,7 +48,6 @@ public: |
| 48 | 48 | virtual void clear(void); |
| 49 | 49 | virtual GModelSpatialRadialGauss* clone(void) const; |
| 50 | 50 | virtual std::string classname(void) const; |
| 51 | - virtual std::string type(void) const; | |
| 52 | 51 | virtual double eval(const double& theta, |
| 53 | 52 | const GEnergy& energy, |
| 54 | 53 | const GTime& time, |
| ... | ... | @@ -59,7 +58,6 @@ public: |
| 59 | 58 | virtual bool contains(const GSkyDir& dir, |
| 60 | 59 | const double& margin = 0.0) const; |
| 61 | 60 | virtual double theta_max(void) const; |
| 62 | - virtual GSkyRegion* region(void) const; | |
| 63 | 61 | virtual void read(const GXmlElement& xml); |
| 64 | 62 | virtual void write(GXmlElement& xml) const; |
| 65 | 63 | ... | ... |
pyext/GModelSpatialRadialProfile.i
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GModelSpatialRadialProfile.i - Radial profile source model class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2016-2002 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2016-2020 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -50,7 +50,6 @@ public: |
| 50 | 50 | virtual void clear(void) = 0; |
| 51 | 51 | virtual GModelSpatialRadialProfile* clone(void) const = 0; |
| 52 | 52 | virtual std::string classname(void) const = 0; |
| 53 | - virtual std::string type(void) const = 0; | |
| 54 | 53 | virtual double theta_min(void) const = 0; |
| 55 | 54 | virtual double theta_max(void) const = 0; |
| 56 | 55 | |
| ... | ... | @@ -64,7 +63,6 @@ public: |
| 64 | 63 | GRan& ran) const; |
| 65 | 64 | virtual bool contains(const GSkyDir& dir, |
| 66 | 65 | const double& margin = 0.0) const; |
| 67 | - virtual GSkyRegion* region(void) const; | |
| 68 | 66 | |
| 69 | 67 | // Implement other methods |
| 70 | 68 | int num_nodes(void) const; | ... | ... |
pyext/GModelSpatialRadialProfileDMBurkert.i
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GModelSpatialRadialProfileDMBurkert.i - Burkert radial profile class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2016-2018 by Nathan Kelley-Hoskins * | |
| 4 | + * copyright (C) 2016-2020 by Nathan Kelley-Hoskins * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -50,7 +50,6 @@ public: |
| 50 | 50 | virtual void clear(void); |
| 51 | 51 | virtual GModelSpatialRadialProfileDMBurkert* clone(void) const; |
| 52 | 52 | virtual std::string classname(void) const; |
| 53 | - virtual std::string type(void) const; | |
| 54 | 53 | virtual double theta_min(void) const; |
| 55 | 54 | virtual double theta_max(void) const; |
| 56 | 55 | virtual void read(const GXmlElement& xml); | ... | ... |
pyext/GModelSpatialRadialProfileDMEinasto.i
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GModelSpatialRadialProfileDMEinasto.i - Einasto radial profile class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2016-2018 by Nathan Kelley-Hoskins * | |
| 4 | + * copyright (C) 2016-2020 by Nathan Kelley-Hoskins * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -50,12 +50,11 @@ public: |
| 50 | 50 | virtual void clear(void); |
| 51 | 51 | virtual GModelSpatialRadialProfileDMEinasto* clone(void) const; |
| 52 | 52 | virtual std::string classname(void) const; |
| 53 | - virtual std::string type(void) const; | |
| 54 | 53 | virtual double theta_min(void) const; |
| 55 | 54 | virtual double theta_max(void) const; |
| 56 | 55 | virtual void read(const GXmlElement& xml); |
| 57 | 56 | virtual void write(GXmlElement& xml) const; |
| 58 | - | |
| 57 | + | |
| 59 | 58 | // Other methods |
| 60 | 59 | double scale_radius(void) const; |
| 61 | 60 | void scale_radius(const double& scale_radius); | ... | ... |
pyext/GModelSpatialRadialProfileDMZhao.i
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GModelSpatialRadialProfileDMZhao.i - Zhao radial profile class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2016-2018 by Nathan Kelley-Hoskins * | |
| 4 | + * copyright (C) 2016-2020 by Nathan Kelley-Hoskins * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -50,7 +50,6 @@ public: |
| 50 | 50 | virtual void clear(void); |
| 51 | 51 | virtual GModelSpatialRadialProfileDMZhao* clone(void) const; |
| 52 | 52 | virtual std::string classname(void) const; |
| 53 | - virtual std::string type(void) const; | |
| 54 | 53 | virtual double theta_min(void) const; |
| 55 | 54 | virtual double theta_max(void) const; |
| 56 | 55 | virtual void read(const GXmlElement& xml); | ... | ... |
pyext/GModelSpatialRadialProfileGauss.i
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GModelSpatialRadialProfileGauss.i - Gaussian radial profile class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2016-2018 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2016-2020 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -51,7 +51,6 @@ public: |
| 51 | 51 | virtual void clear(void); |
| 52 | 52 | virtual GModelSpatialRadialProfileGauss* clone(void) const; |
| 53 | 53 | virtual std::string classname(void) const; |
| 54 | - virtual std::string type(void) const; | |
| 55 | 54 | virtual double theta_min(void) const; |
| 56 | 55 | virtual double theta_max(void) const; |
| 57 | 56 | virtual void read(const GXmlElement& xml); | ... | ... |
pyext/GModelSpatialRadialRing.i
| ... | ... | @@ -51,7 +51,6 @@ public: |
| 51 | 51 | virtual void clear(void); |
| 52 | 52 | virtual GModelSpatialRadialRing* clone(void) const; |
| 53 | 53 | virtual std::string classname(void) const; |
| 54 | - virtual std::string type(void) const; | |
| 55 | 54 | virtual double eval(const double& theta, |
| 56 | 55 | const GEnergy& energy, |
| 57 | 56 | const GTime& time, |
| ... | ... | @@ -63,7 +62,6 @@ public: |
| 63 | 62 | const double& margin = 0.0) const; |
| 64 | 63 | virtual double theta_min(void) const; |
| 65 | 64 | virtual double theta_max(void) const; |
| 66 | - virtual GSkyRegion* region(void) const; | |
| 67 | 65 | virtual void read(const GXmlElement& xml); |
| 68 | 66 | virtual void write(GXmlElement& xml) const; |
| 69 | 67 | ... | ... |
pyext/GModelSpatialRadialShell.i
| ... | ... | @@ -49,7 +49,6 @@ public: |
| 49 | 49 | virtual void clear(void); |
| 50 | 50 | virtual GModelSpatialRadialShell* clone(void) const; |
| 51 | 51 | virtual std::string classname(void) const; |
| 52 | - virtual std::string type(void) const; | |
| 53 | 52 | virtual double eval(const double& theta, |
| 54 | 53 | const GEnergy& energy, |
| 55 | 54 | const GTime& time, |
| ... | ... | @@ -60,7 +59,6 @@ public: |
| 60 | 59 | virtual bool contains(const GSkyDir& dir, |
| 61 | 60 | const double& margin = 0.0) const; |
| 62 | 61 | virtual double theta_max(void) const; |
| 63 | - virtual GSkyRegion* region(void) const; | |
| 64 | 62 | virtual void read(const GXmlElement& xml); |
| 65 | 63 | virtual void write(GXmlElement& xml) const; |
| 66 | 64 | ... | ... |
src/model/GModelSpatial.cpp
| ... | ... | @@ -440,6 +440,8 @@ double GModelSpatial::flux(const GSkyRegion* reg, |
| 440 | 440 | void GModelSpatial::init_members(void) |
| 441 | 441 | { |
| 442 | 442 | // Initialise members |
| 443 | + m_type.clear(); | |
| 444 | + m_region.clear(); | |
| 443 | 445 | m_pars.clear(); |
| 444 | 446 | |
| 445 | 447 | // Return |
| ... | ... | @@ -455,7 +457,9 @@ void GModelSpatial::init_members(void) |
| 455 | 457 | void GModelSpatial::copy_members(const GModelSpatial& model) |
| 456 | 458 | { |
| 457 | 459 | // Copy members |
| 458 | - m_pars = model.m_pars; | |
| 460 | + m_type = model.m_type; | |
| 461 | + m_region = model.m_region; | |
| 462 | + m_pars = model.m_pars; | |
| 459 | 463 | |
| 460 | 464 | // Return |
| 461 | 465 | return; | ... | ... |
src/model/GModelSpatialComposite.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GModelSpatialComposite.cpp - Spatial composite model class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2016-2017 by Domenico Tiziani * | |
| 4 | + * copyright (C) 2016-2020 by Domenico Tiziani * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -764,7 +764,6 @@ void GModelSpatialComposite::init_members(void) |
| 764 | 764 | // Initialise other members |
| 765 | 765 | m_components.clear(); |
| 766 | 766 | m_names.clear(); |
| 767 | - m_region.clear(); | |
| 768 | 767 | m_pars.clear(); |
| 769 | 768 | m_scales.clear(); |
| 770 | 769 | |
| ... | ... | @@ -781,9 +780,8 @@ void GModelSpatialComposite::init_members(void) |
| 781 | 780 | void GModelSpatialComposite::copy_members(const GModelSpatialComposite& model) |
| 782 | 781 | { |
| 783 | 782 | // Copy members |
| 784 | - m_type = model.m_type; | |
| 785 | - m_names = model.m_names; | |
| 786 | - m_region = model.m_region; | |
| 783 | + m_type = model.m_type; // To copy model type | |
| 784 | + m_names = model.m_names; | |
| 787 | 785 | |
| 788 | 786 | // Initialise components and scales |
| 789 | 787 | m_components.clear(); |
| ... | ... | @@ -869,11 +867,11 @@ void GModelSpatialComposite::free_members(void) |
| 869 | 867 | ***************************************************************************/ |
| 870 | 868 | void GModelSpatialComposite::set_region(void) const |
| 871 | 869 | { |
| 872 | - // Set sky region centre to (0,0) | |
| 873 | - m_region.centre(0.0, 0.0); | |
| 870 | + // Set sky region circle (all sky) | |
| 871 | + GSkyRegionCircle region(0.0, 0.0, 180.0); | |
| 874 | 872 | |
| 875 | - // Set sky region radius to 180 degrees (all points included) | |
| 876 | - m_region.radius(180.0); | |
| 873 | + // Set region (circumvent const correctness) | |
| 874 | + const_cast<GModelSpatialComposite*>(this)->m_region = region; | |
| 877 | 875 | |
| 878 | 876 | // Return |
| 879 | 877 | return; | ... | ... |
src/model/GModelSpatialDiffuseConst.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GModelSpatialDiffuseConst.cpp - Spatial isotropic model class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2010-2018 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2010-2020 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -535,9 +535,6 @@ void GModelSpatialDiffuseConst::init_members(void) |
| 535 | 535 | m_pars.clear(); |
| 536 | 536 | m_pars.push_back(&m_value); |
| 537 | 537 | |
| 538 | - // Initialise other members | |
| 539 | - m_region.clear(); | |
| 540 | - | |
| 541 | 538 | // Return |
| 542 | 539 | return; |
| 543 | 540 | } |
| ... | ... | @@ -551,9 +548,8 @@ void GModelSpatialDiffuseConst::init_members(void) |
| 551 | 548 | void GModelSpatialDiffuseConst::copy_members(const GModelSpatialDiffuseConst& model) |
| 552 | 549 | { |
| 553 | 550 | // Copy members |
| 554 | - m_type = model.m_type; | |
| 551 | + m_type = model.m_type; // Needed to conserve model type | |
| 555 | 552 | m_value = model.m_value; |
| 556 | - m_region = model.m_region; | |
| 557 | 553 | m_mc_centre = model.m_mc_centre; |
| 558 | 554 | m_mc_cos_radius = model.m_mc_cos_radius; |
| 559 | 555 | |
| ... | ... | @@ -581,11 +577,11 @@ void GModelSpatialDiffuseConst::free_members(void) |
| 581 | 577 | ***************************************************************************/ |
| 582 | 578 | void GModelSpatialDiffuseConst::set_region(void) const |
| 583 | 579 | { |
| 584 | - // Set sky region centre to (0,0) | |
| 585 | - m_region.centre(0.0, 0.0); | |
| 580 | + // Set sky region circle (all sky) | |
| 581 | + GSkyRegionCircle region(0.0, 0.0, 180.0); | |
| 586 | 582 | |
| 587 | - // Set sky region radius to 180 degrees (all points included) | |
| 588 | - m_region.radius(180.0); | |
| 583 | + // Set region (circumvent const correctness) | |
| 584 | + const_cast<GModelSpatialDiffuseConst*>(this)->m_region = region; | |
| 589 | 585 | |
| 590 | 586 | // Return |
| 591 | 587 | return; | ... | ... |
src/model/GModelSpatialEllipticalDisk.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GModelSpatialEllipticalDisk.cpp - Elliptical disk source model class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2013-2018 by Michael Mayer * | |
| 4 | + * copyright (C) 2013-2020 by Michael Mayer * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -566,6 +566,9 @@ std::string GModelSpatialEllipticalDisk::print(const GChatter& chatter) const |
| 566 | 566 | ***************************************************************************/ |
| 567 | 567 | void GModelSpatialEllipticalDisk::init_members(void) |
| 568 | 568 | { |
| 569 | + // Initialise model type | |
| 570 | + m_type = "EllipticalDisk"; | |
| 571 | + | |
| 569 | 572 | // Initialise precomputation cache. Note that zero values flag |
| 570 | 573 | // uninitialised as a zero radius is not meaningful |
| 571 | 574 | m_last_semiminor = 0.0; |
| ... | ... | @@ -574,9 +577,6 @@ void GModelSpatialEllipticalDisk::init_members(void) |
| 574 | 577 | m_semimajor_rad = 0.0; |
| 575 | 578 | m_norm = 0.0; |
| 576 | 579 | |
| 577 | - // Initialise other members | |
| 578 | - m_region.clear(); | |
| 579 | - | |
| 580 | 580 | // Return |
| 581 | 581 | return; |
| 582 | 582 | } |
| ... | ... | @@ -594,7 +594,7 @@ void GModelSpatialEllipticalDisk::init_members(void) |
| 594 | 594 | void GModelSpatialEllipticalDisk::copy_members(const GModelSpatialEllipticalDisk& model) |
| 595 | 595 | { |
| 596 | 596 | // Copy members |
| 597 | - m_region = model.m_region; | |
| 597 | + m_type = model.m_type; // Needed to conserve model type | |
| 598 | 598 | |
| 599 | 599 | // Copy precomputation cache |
| 600 | 600 | m_last_semiminor = model.m_last_semiminor; |
| ... | ... | @@ -659,14 +659,14 @@ void GModelSpatialEllipticalDisk::update() const |
| 659 | 659 | ***************************************************************************/ |
| 660 | 660 | void GModelSpatialEllipticalDisk::set_region(void) const |
| 661 | 661 | { |
| 662 | - // Set sky region centre to disk centre | |
| 663 | - m_region.centre(m_ra.value(), m_dec.value()); | |
| 664 | - | |
| 665 | 662 | // Set maximum model radius |
| 666 | 663 | double max_radius = (semimajor() > semiminor()) ? semimajor() : semiminor(); |
| 667 | 664 | |
| 668 | - // Set sky region radius to maximum disk radius | |
| 669 | - m_region.radius(max_radius); | |
| 665 | + // Set sky region circle | |
| 666 | + GSkyRegionCircle region(m_ra.value(), m_dec.value(), max_radius); | |
| 667 | + | |
| 668 | + // Set region (circumvent const correctness) | |
| 669 | + const_cast<GModelSpatialEllipticalDisk*>(this)->m_region = region; | |
| 670 | 670 | |
| 671 | 671 | // Return |
| 672 | 672 | return; | ... | ... |
src/model/GModelSpatialEllipticalGauss.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GModelSpatialEllipticalGauss.cpp - Elliptical gauss source model class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2015-2018 by Michael Mayer * | |
| 4 | + * copyright (C) 2015-2020 by Michael Mayer * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -656,9 +656,6 @@ void GModelSpatialEllipticalGauss::init_members(void) |
| 656 | 656 | m_term2 = 0.0; |
| 657 | 657 | m_term3 = 0.0; |
| 658 | 658 | |
| 659 | - // Initialise other members | |
| 660 | - m_region.clear(); | |
| 661 | - | |
| 662 | 659 | // Return |
| 663 | 660 | return; |
| 664 | 661 | } |
| ... | ... | @@ -672,24 +669,23 @@ void GModelSpatialEllipticalGauss::init_members(void) |
| 672 | 669 | void GModelSpatialEllipticalGauss::copy_members(const GModelSpatialEllipticalGauss& model) |
| 673 | 670 | { |
| 674 | 671 | // Copy members |
| 675 | - m_type = model.m_type; | |
| 676 | - m_region = model.m_region; | |
| 672 | + m_type = model.m_type; // Needed to conserve model type | |
| 677 | 673 | |
| 678 | 674 | // Copy precomputation cache |
| 679 | - m_last_minor = model.m_last_minor; | |
| 680 | - m_last_major = model.m_last_major; | |
| 681 | - m_minor_rad = model.m_minor_rad; | |
| 682 | - m_major_rad = model.m_major_rad; | |
| 683 | - m_norm = model.m_norm; | |
| 684 | - m_last_posangle = model.m_last_posangle; | |
| 685 | - m_sin2pos = model.m_sin2pos; | |
| 686 | - m_cospos2 = model.m_cospos2; | |
| 687 | - m_sinpos2 = model.m_sinpos2; | |
| 688 | - m_minor2 = model.m_minor2; | |
| 689 | - m_major2 = model.m_major2; | |
| 690 | - m_term1 = model.m_term1; | |
| 691 | - m_term2 = model.m_term2; | |
| 692 | - m_term3 = model.m_term3; | |
| 675 | + m_last_minor = model.m_last_minor; | |
| 676 | + m_last_major = model.m_last_major; | |
| 677 | + m_minor_rad = model.m_minor_rad; | |
| 678 | + m_major_rad = model.m_major_rad; | |
| 679 | + m_norm = model.m_norm; | |
| 680 | + m_last_posangle = model.m_last_posangle; | |
| 681 | + m_sin2pos = model.m_sin2pos; | |
| 682 | + m_cospos2 = model.m_cospos2; | |
| 683 | + m_sinpos2 = model.m_sinpos2; | |
| 684 | + m_minor2 = model.m_minor2; | |
| 685 | + m_major2 = model.m_major2; | |
| 686 | + m_term1 = model.m_term1; | |
| 687 | + m_term2 = model.m_term2; | |
| 688 | + m_term3 = model.m_term3; | |
| 693 | 689 | |
| 694 | 690 | // Return |
| 695 | 691 | return; |
| ... | ... | @@ -797,15 +793,15 @@ void GModelSpatialEllipticalGauss::update() const |
| 797 | 793 | ***************************************************************************/ |
| 798 | 794 | void GModelSpatialEllipticalGauss::set_region(void) const |
| 799 | 795 | { |
| 800 | - // Set sky region centre to Gaussian centre | |
| 801 | - m_region.centre(m_ra.value(), m_dec.value()); | |
| 802 | - | |
| 803 | 796 | // Set maximum model radius |
| 804 | 797 | double max_radius = (semimajor() > semiminor()) ? semimajor() : semiminor(); |
| 805 | 798 | |
| 806 | - // Set sky region radius to maximum Gaussian sigma times a scaling | |
| 807 | - // factor (actually 3) | |
| 808 | - m_region.radius(max_radius * c_theta_max); | |
| 799 | + // Set sky region circle (maximum Gaussian sigma times a scaling | |
| 800 | + // factor (actually 3)) | |
| 801 | + GSkyRegionCircle region(m_ra.value(), m_dec.value(), max_radius * c_theta_max); | |
| 802 | + | |
| 803 | + // Set region (circumvent const correctness) | |
| 804 | + const_cast<GModelSpatialEllipticalGauss*>(this)->m_region = region; | |
| 809 | 805 | |
| 810 | 806 | // Return |
| 811 | 807 | return; | ... | ... |
src/model/GModelSpatialPointSource.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GModelSpatialPointSource.cpp - Spatial point source model class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2009-2018 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2009-2020 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -565,9 +565,6 @@ void GModelSpatialPointSource::init_members(void) |
| 565 | 565 | m_pars.push_back(&m_ra); |
| 566 | 566 | m_pars.push_back(&m_dec); |
| 567 | 567 | |
| 568 | - // Initialise other members | |
| 569 | - m_region.clear(); | |
| 570 | - | |
| 571 | 568 | // Return |
| 572 | 569 | return; |
| 573 | 570 | } |
| ... | ... | @@ -581,10 +578,9 @@ void GModelSpatialPointSource::init_members(void) |
| 581 | 578 | void GModelSpatialPointSource::copy_members(const GModelSpatialPointSource& model) |
| 582 | 579 | { |
| 583 | 580 | // Copy members |
| 584 | - m_type = model.m_type; | |
| 585 | - m_ra = model.m_ra; | |
| 586 | - m_dec = model.m_dec; | |
| 587 | - m_region = model.m_region; | |
| 581 | + m_type = model.m_type; // Needed to conserve model type | |
| 582 | + m_ra = model.m_ra; | |
| 583 | + m_dec = model.m_dec; | |
| 588 | 584 | |
| 589 | 585 | // Set parameter pointer(s) |
| 590 | 586 | m_pars.clear(); |
| ... | ... | @@ -611,11 +607,11 @@ void GModelSpatialPointSource::free_members(void) |
| 611 | 607 | ***************************************************************************/ |
| 612 | 608 | void GModelSpatialPointSource::set_region(void) const |
| 613 | 609 | { |
| 614 | - // Set sky region centre | |
| 615 | - m_region.centre(m_ra.value(), m_dec.value()); | |
| 610 | + // Set sky region circle | |
| 611 | + GSkyRegionCircle region(m_ra.value(), m_dec.value(), 0.0); | |
| 616 | 612 | |
| 617 | - // Set sky region radius to zero | |
| 618 | - m_region.radius(0.0); | |
| 613 | + // Set region (circumvent const correctness) | |
| 614 | + const_cast<GModelSpatialPointSource*>(this)->m_region = region; | |
| 619 | 615 | |
| 620 | 616 | // Return |
| 621 | 617 | return; | ... | ... |
src/model/GModelSpatialRadialDisk.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GModelSpatialRadialDisk.cpp - Radial disk source model class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2011-2018 by Christoph Deil * | |
| 4 | + * copyright (C) 2011-2020 by Christoph Deil * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -471,7 +471,7 @@ void GModelSpatialRadialDisk::write(GXmlElement& xml) const |
| 471 | 471 | /***********************************************************************//** |
| 472 | 472 | * @brief Print information |
| 473 | 473 | * |
| 474 | - * @param[in] chatter Chattiness (defaults to NORMAL). | |
| 474 | + * @param[in] chatter Chattiness. | |
| 475 | 475 | * @return String containing model information. |
| 476 | 476 | ***************************************************************************/ |
| 477 | 477 | std::string GModelSpatialRadialDisk::print(const GChatter& chatter) const |
| ... | ... | @@ -533,9 +533,6 @@ void GModelSpatialRadialDisk::init_members(void) |
| 533 | 533 | m_radius_rad = 0.0; |
| 534 | 534 | m_norm = 0.0; |
| 535 | 535 | |
| 536 | - // Initialise other members | |
| 537 | - m_region.clear(); | |
| 538 | - | |
| 539 | 536 | // Return |
| 540 | 537 | return; |
| 541 | 538 | } |
| ... | ... | @@ -553,9 +550,8 @@ void GModelSpatialRadialDisk::init_members(void) |
| 553 | 550 | void GModelSpatialRadialDisk::copy_members(const GModelSpatialRadialDisk& model) |
| 554 | 551 | { |
| 555 | 552 | // Copy members |
| 556 | - m_type = model.m_type; | |
| 553 | + m_type = model.m_type; // Needed to conserve model type | |
| 557 | 554 | m_radius = model.m_radius; |
| 558 | - m_region = model.m_region; | |
| 559 | 555 | |
| 560 | 556 | // Copy precomputation cache |
| 561 | 557 | m_last_radius = model.m_last_radius; |
| ... | ... | @@ -617,11 +613,11 @@ void GModelSpatialRadialDisk::update() const |
| 617 | 613 | ***************************************************************************/ |
| 618 | 614 | void GModelSpatialRadialDisk::set_region(void) const |
| 619 | 615 | { |
| 620 | - // Set sky region centre to disk centre | |
| 621 | - m_region.centre(m_ra.value(), m_dec.value()); | |
| 616 | + // Set sky region circle | |
| 617 | + GSkyRegionCircle region(m_ra.value(), m_dec.value(), m_radius.value()); | |
| 622 | 618 | |
| 623 | - // Set sky region radius to disk radius | |
| 624 | - m_region.radius(m_radius.value()); | |
| 619 | + // Set region (circumvent const correctness) | |
| 620 | + const_cast<GModelSpatialRadialDisk*>(this)->m_region = region; | |
| 625 | 621 | |
| 626 | 622 | // Return |
| 627 | 623 | return; | ... | ... |
src/model/GModelSpatialRadialGauss.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GModelSpatialRadialGauss.cpp - Radial Gaussian source model class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2011-2018 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2011-2020 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -529,9 +529,6 @@ void GModelSpatialRadialGauss::init_members(void) |
| 529 | 529 | // Set parameter pointer(s) |
| 530 | 530 | m_pars.push_back(&m_sigma); |
| 531 | 531 | |
| 532 | - // Initialise other members | |
| 533 | - m_region.clear(); | |
| 534 | - | |
| 535 | 532 | // Return |
| 536 | 533 | return; |
| 537 | 534 | } |
| ... | ... | @@ -549,9 +546,8 @@ void GModelSpatialRadialGauss::init_members(void) |
| 549 | 546 | void GModelSpatialRadialGauss::copy_members(const GModelSpatialRadialGauss& model) |
| 550 | 547 | { |
| 551 | 548 | // Copy members |
| 552 | - m_type = model.m_type; | |
| 553 | - m_sigma = model.m_sigma; | |
| 554 | - m_region = model.m_region; | |
| 549 | + m_type = model.m_type; // Needed to conserve model type | |
| 550 | + m_sigma = model.m_sigma; | |
| 555 | 551 | |
| 556 | 552 | // Return |
| 557 | 553 | return; |
| ... | ... | @@ -573,11 +569,11 @@ void GModelSpatialRadialGauss::free_members(void) |
| 573 | 569 | ***************************************************************************/ |
| 574 | 570 | void GModelSpatialRadialGauss::set_region(void) const |
| 575 | 571 | { |
| 576 | - // Set sky region centre to Gaussian centre | |
| 577 | - m_region.centre(m_ra.value(), m_dec.value()); | |
| 572 | + // Set sky region circle (5 times Gaussian sigma) | |
| 573 | + GSkyRegionCircle region(m_ra.value(), m_dec.value(), m_sigma.value() * 5.0); | |
| 578 | 574 | |
| 579 | - // Set sky region radius to 5 times the Gaussian sigma | |
| 580 | - m_region.radius(m_sigma.value() * 5.0); | |
| 575 | + // Set region (circumvent const correctness) | |
| 576 | + const_cast<GModelSpatialRadialGauss*>(this)->m_region = region; | |
| 581 | 577 | |
| 582 | 578 | // Return |
| 583 | 579 | return; | ... | ... |
src/model/GModelSpatialRadialProfile.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GModelSpatialRadialProfile.cpp - Radial profile source model class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2016-2018 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2016-2020 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -294,7 +294,6 @@ void GModelSpatialRadialProfile::init_members(void) |
| 294 | 294 | // Initialise members |
| 295 | 295 | m_coord_indep = false; |
| 296 | 296 | m_num_nodes = 100; |
| 297 | - m_region.clear(); | |
| 298 | 297 | |
| 299 | 298 | // Initialise pre-computation cache |
| 300 | 299 | m_profile.clear(); |
| ... | ... | @@ -315,7 +314,6 @@ void GModelSpatialRadialProfile::copy_members(const GModelSpatialRadialProfile& |
| 315 | 314 | m_coord_indep = model.m_coord_indep; |
| 316 | 315 | m_num_nodes = model.m_num_nodes; |
| 317 | 316 | m_profile = model.m_profile; |
| 318 | - m_region = model.m_region; | |
| 319 | 317 | |
| 320 | 318 | // Return |
| 321 | 319 | return; |
| ... | ... | @@ -442,11 +440,12 @@ int GModelSpatialRadialProfile::cache_index(void) const |
| 442 | 440 | ***************************************************************************/ |
| 443 | 441 | void GModelSpatialRadialProfile::set_region(void) const |
| 444 | 442 | { |
| 445 | - // Set sky region centre to disk centre | |
| 446 | - m_region.centre(m_ra.value(), m_dec.value()); | |
| 443 | + // Set sky region circle | |
| 444 | + GSkyRegionCircle region(m_ra.value(), m_dec.value(), theta_max()*gammalib::rad2deg); | |
| 445 | + | |
| 446 | + // Set region (circumvent const correctness) | |
| 447 | + const_cast<GModelSpatialRadialProfile*>(this)->m_region = region; | |
| 447 | 448 | |
| 448 | - // Set sky region radius to maximum theta angle | |
| 449 | - m_region.radius(theta_max()*gammalib::rad2deg); | |
| 450 | 449 | |
| 451 | 450 | // Return |
| 452 | 451 | return; | ... | ... |
src/model/GModelSpatialRadialProfileDMBurkert.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GModelSpatialRadialProfileDMBurkert.cpp - Burkert radial profile class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2016-2018 by Nathan Kelley-Hoskins * | |
| 4 | + * copyright (C) 2016-2020 by Nathan Kelley-Hoskins * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -409,6 +409,8 @@ std::string GModelSpatialRadialProfileDMBurkert::print(const GChatter& chatter) |
| 409 | 409 | ***************************************************************************/ |
| 410 | 410 | void GModelSpatialRadialProfileDMBurkert::init_members(void) |
| 411 | 411 | { |
| 412 | + // Initialise model type | |
| 413 | + m_type = "DMBurkertProfile"; | |
| 412 | 414 | |
| 413 | 415 | // Initialise scale radius |
| 414 | 416 | m_scale_radius.clear(); |
| ... | ... | @@ -507,6 +509,7 @@ void GModelSpatialRadialProfileDMBurkert::copy_members(const GModelSpatialRadial |
| 507 | 509 | // Copy members. We do not have to push back the members on the parameter |
| 508 | 510 | // stack as this should have been done by init_members() that was called |
| 509 | 511 | // before. Otherwise we would have sigma twice on the stack. |
| 512 | + m_type = model.m_type; // Needed to conserve model type | |
| 510 | 513 | m_scale_radius = model.m_scale_radius; |
| 511 | 514 | m_scale_density = model.m_scale_density; |
| 512 | 515 | m_halo_distance = model.m_halo_distance; | ... | ... |
src/model/GModelSpatialRadialProfileDMEinasto.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GModelSpatialRadialProfileDMEinasto.cpp - Einasto radial profile class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2016-2018 by Nathan Kelley-Hoskins * | |
| 4 | + * copyright (C) 2016-2020 by Nathan Kelley-Hoskins * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -427,6 +427,8 @@ std::string GModelSpatialRadialProfileDMEinasto::print(const GChatter& chatter) |
| 427 | 427 | ***************************************************************************/ |
| 428 | 428 | void GModelSpatialRadialProfileDMEinasto::init_members(void) |
| 429 | 429 | { |
| 430 | + // Initialise model type | |
| 431 | + m_type = "DMEinastoProfile"; | |
| 430 | 432 | |
| 431 | 433 | // Initialise scale radius |
| 432 | 434 | m_scale_radius.clear(); |
| ... | ... | @@ -539,6 +541,7 @@ void GModelSpatialRadialProfileDMEinasto::copy_members(const GModelSpatialRadial |
| 539 | 541 | // Copy members. We do not have to push back the members on the parameter |
| 540 | 542 | // stack as this should have been done by init_members() that was called |
| 541 | 543 | // before. |
| 544 | + m_type = model.m_type; // Needed to conserve model type | |
| 542 | 545 | m_scale_radius = model.m_scale_radius; |
| 543 | 546 | m_scale_density = model.m_scale_density; |
| 544 | 547 | m_halo_distance = model.m_halo_distance; | ... | ... |
src/model/GModelSpatialRadialProfileDMZhao.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GModelSpatialRadialProfileDMZhao.cpp - Zhao radial profile class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2016-2017 by Nathan Kelley-Hoskins * | |
| 4 | + * copyright (C) 2016-2020 by Nathan Kelley-Hoskins * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -445,6 +445,8 @@ std::string GModelSpatialRadialProfileDMZhao::print(const GChatter& chatter) con |
| 445 | 445 | ***************************************************************************/ |
| 446 | 446 | void GModelSpatialRadialProfileDMZhao::init_members(void) |
| 447 | 447 | { |
| 448 | + // Initialise model type | |
| 449 | + m_type = "DMZhaoProfile"; | |
| 448 | 450 | |
| 449 | 451 | // Initialise scale radius |
| 450 | 452 | m_scale_radius.clear(); |
| ... | ... | @@ -456,7 +458,7 @@ void GModelSpatialRadialProfileDMZhao::init_members(void) |
| 456 | 458 | m_scale_radius.scale(1.0); |
| 457 | 459 | m_scale_radius.gradient(0.0); |
| 458 | 460 | m_scale_radius.has_grad(false); // Radial components never have gradients |
| 459 | - | |
| 461 | + | |
| 460 | 462 | // Initialise scale density |
| 461 | 463 | m_scale_density.clear(); |
| 462 | 464 | m_scale_density.name("ScaleDensity"); |
| ... | ... | @@ -582,6 +584,7 @@ void GModelSpatialRadialProfileDMZhao::copy_members(const GModelSpatialRadialPro |
| 582 | 584 | // Copy members. We do not have to push back the members on the parameter |
| 583 | 585 | // stack as this should have been done by init_members() that was called |
| 584 | 586 | // before. |
| 587 | + m_type = model.m_type; // Needed to conserve model type | |
| 585 | 588 | m_scale_radius = model.m_scale_radius; |
| 586 | 589 | m_scale_density = model.m_scale_density; |
| 587 | 590 | m_halo_distance = model.m_halo_distance; |
| ... | ... | @@ -596,8 +599,8 @@ void GModelSpatialRadialProfileDMZhao::copy_members(const GModelSpatialRadialPro |
| 596 | 599 | m_last_scale_radius = model.m_last_scale_radius; |
| 597 | 600 | m_last_scale_density = model.m_last_scale_density; |
| 598 | 601 | m_mass_radius = model.m_mass_radius; |
| 599 | - m_scale_density_squared = model.m_scale_density_squared ; | |
| 600 | - | |
| 602 | + m_scale_density_squared = model.m_scale_density_squared; | |
| 603 | + | |
| 601 | 604 | // Return |
| 602 | 605 | return; |
| 603 | 606 | } | ... | ... |
src/model/GModelSpatialRadialProfileGauss.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GModelSpatialRadialProfileGauss.cpp - Gaussian radial profile class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2016-2018 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2016-2020 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -368,6 +368,9 @@ std::string GModelSpatialRadialProfileGauss::print(const GChatter& chatter) cons |
| 368 | 368 | ***************************************************************************/ |
| 369 | 369 | void GModelSpatialRadialProfileGauss::init_members(void) |
| 370 | 370 | { |
| 371 | + // Initialise model type | |
| 372 | + m_type = "GaussianProfile"; | |
| 373 | + | |
| 371 | 374 | // Initialise Gaussian sigma |
| 372 | 375 | m_sigma.clear(); |
| 373 | 376 | m_sigma.name("Sigma"); |
| ... | ... | @@ -402,6 +405,7 @@ void GModelSpatialRadialProfileGauss::copy_members(const GModelSpatialRadialProf |
| 402 | 405 | // Copy members. We do not have to push back the members on the parameter |
| 403 | 406 | // stack as this should have been done by init_members() that was called |
| 404 | 407 | // before. Otherwise we would have sigma twice on the stack. |
| 408 | + m_type = model.m_type; // Needed to conserve model type | |
| 405 | 409 | m_sigma = model.m_sigma; |
| 406 | 410 | |
| 407 | 411 | // Return | ... | ... |
src/model/GModelSpatialRadialRing.cpp
| ... | ... | @@ -561,9 +561,6 @@ void GModelSpatialRadialRing::init_members(void) |
| 561 | 561 | m_cos_outer_radius_rad = 0.0; |
| 562 | 562 | m_norm = 0.0; |
| 563 | 563 | |
| 564 | - // Initialise other members | |
| 565 | - m_region.clear(); | |
| 566 | - | |
| 567 | 564 | // Return |
| 568 | 565 | return; |
| 569 | 566 | } |
| ... | ... | @@ -581,10 +578,9 @@ void GModelSpatialRadialRing::init_members(void) |
| 581 | 578 | void GModelSpatialRadialRing::copy_members(const GModelSpatialRadialRing& model) |
| 582 | 579 | { |
| 583 | 580 | // Copy members |
| 584 | - m_type = model.m_type; | |
| 581 | + m_type = model.m_type; // Needed to conserve model type | |
| 585 | 582 | m_radius = model.m_radius; |
| 586 | 583 | m_width = model.m_width; |
| 587 | - m_region = model.m_region; | |
| 588 | 584 | |
| 589 | 585 | // Copy precomputation cache |
| 590 | 586 | m_last_radius = model.m_last_radius; |
| ... | ... | @@ -652,11 +648,12 @@ void GModelSpatialRadialRing::update() const |
| 652 | 648 | ***************************************************************************/ |
| 653 | 649 | void GModelSpatialRadialRing::set_region(void) const |
| 654 | 650 | { |
| 655 | - // Set sky region centre to ring centre | |
| 656 | - m_region.centre(m_ra.value(), m_dec.value()); | |
| 651 | + // Set sky region circle (maximum Gaussian sigma times a scaling | |
| 652 | + // factor (actually 3)) | |
| 653 | + GSkyRegionCircle region(m_ra.value(), m_dec.value(), radius()+width()); | |
| 657 | 654 | |
| 658 | - // Set sky region radius to ring radius | |
| 659 | - m_region.radius(radius()+width()); | |
| 655 | + // Set region (circumvent const correctness) | |
| 656 | + const_cast<GModelSpatialRadialRing*>(this)->m_region = region; | |
| 660 | 657 | |
| 661 | 658 | // Return |
| 662 | 659 | return; | ... | ... |
src/model/GModelSpatialRadialShell.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GModelSpatialRadialShell.cpp - Radial shell source model class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2011-2018 by Christoph Deil * | |
| 4 | + * copyright (C) 2011-2020 by Christoph Deil * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -534,7 +534,7 @@ void GModelSpatialRadialShell::write(GXmlElement& xml) const |
| 534 | 534 | /***********************************************************************//** |
| 535 | 535 | * @brief Print information |
| 536 | 536 | * |
| 537 | - * @param[in] chatter Chattiness (defaults to NORMAL). | |
| 537 | + * @param[in] chatter Chattiness. | |
| 538 | 538 | * @return String containing model information. |
| 539 | 539 | ***************************************************************************/ |
| 540 | 540 | std::string GModelSpatialRadialShell::print(const GChatter& chatter) const |
| ... | ... | @@ -602,9 +602,6 @@ void GModelSpatialRadialShell::init_members(void) |
| 602 | 602 | m_pars.push_back(&m_radius); |
| 603 | 603 | m_pars.push_back(&m_width); |
| 604 | 604 | |
| 605 | - // Initialise other members | |
| 606 | - m_region.clear(); | |
| 607 | - | |
| 608 | 605 | // Initialise precomputation cache. Note that zero values flag |
| 609 | 606 | // uninitialised as a zero radius and width shell is not meaningful |
| 610 | 607 | m_last_radius = 0.0; |
| ... | ... | @@ -632,10 +629,9 @@ void GModelSpatialRadialShell::init_members(void) |
| 632 | 629 | void GModelSpatialRadialShell::copy_members(const GModelSpatialRadialShell& model) |
| 633 | 630 | { |
| 634 | 631 | // Copy members |
| 635 | - m_type = model.m_type; | |
| 632 | + m_type = model.m_type; // Needed to conserve model type | |
| 636 | 633 | m_radius = model.m_radius; |
| 637 | 634 | m_width = model.m_width; |
| 638 | - m_region = model.m_region; | |
| 639 | 635 | |
| 640 | 636 | // Copy precomputation cache |
| 641 | 637 | m_last_radius = model.m_last_radius; |
| ... | ... | @@ -775,11 +771,12 @@ double GModelSpatialRadialShell::f2(double x) |
| 775 | 771 | ***************************************************************************/ |
| 776 | 772 | void GModelSpatialRadialShell::set_region(void) const |
| 777 | 773 | { |
| 778 | - // Set sky region centre to Gaussian centre | |
| 779 | - m_region.centre(m_ra.value(), m_dec.value()); | |
| 774 | + // Set sky region circle (maximum Gaussian sigma times a scaling | |
| 775 | + // factor (actually 3)) | |
| 776 | + GSkyRegionCircle region(m_ra.value(), m_dec.value(), m_radius.value() + m_width.value()); | |
| 780 | 777 | |
| 781 | - // Set sky region radius to sum of shell radius and width | |
| 782 | - m_region.radius(m_radius.value() + m_width.value()); | |
| 778 | + // Set region (circumvent const correctness) | |
| 779 | + const_cast<GModelSpatialRadialShell*>(this)->m_region = region; | |
| 783 | 780 | |
| 784 | 781 | // Return |
| 785 | 782 | return; | ... | ... |