GammaLib  2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GModelSpatialDiffuse.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GModelSpatialDiffuse.hpp - Abstract diffuse spatial model base class *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 2013-2020 by Juergen Knoedlseder *
5  * ----------------------------------------------------------------------- *
6  * *
7  * This program is free software: you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation, either version 3 of the License, or *
10  * (at your option) any later version. *
11  * *
12  * This program is distributed in the hope that it will be useful, *
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15  * GNU General Public License for more details. *
16  * *
17  * You should have received a copy of the GNU General Public License *
18  * along with this program. If not, see <http://www.gnu.org/licenses/>. *
19  * *
20  ***************************************************************************/
21 /**
22  * @file GModelSpatialDiffuse.hpp
23  * @brief Abstract diffuse spatial model base class interface definition
24  * @author Juergen Knoedlseder
25  */
26 
27 #ifndef GMODELSPATIALDIFFUSE_HPP
28 #define GMODELSPATIALDIFFUSE_HPP
29 
30 /* __ Includes ___________________________________________________________ */
31 #include <string>
32 #include "GModelSpatial.hpp"
33 #include "GPhoton.hpp"
34 #include "GSkyDir.hpp"
35 #include "GEnergy.hpp"
36 #include "GTime.hpp"
37 #include "GXmlElement.hpp"
38 #include "GRan.hpp"
39 
40 /* __ Forward declarations _______________________________________________ */
41 class GSkyRegion;
42 
43 
44 /***********************************************************************//**
45  * @class GModelSpatialDiffuse
46  *
47  * @brief Abstract diffuse spatial model base class
48  *
49  * This class defines the interface for a diffuse model as spatial component
50  * of the factorized source model.
51  ***************************************************************************/
53 
54 public:
55  // Constructors and destructors
58  virtual ~GModelSpatialDiffuse(void);
59 
60  // Operators
62 
63  // Pure virtual methods
64  virtual void clear(void) = 0;
65  virtual GModelSpatialDiffuse* clone(void) const = 0;
66  virtual std::string classname(void) const = 0;
67  virtual double eval(const GPhoton& photon,
68  const bool& gradients = false) const = 0;
69  virtual GSkyDir mc(const GEnergy& energy, const GTime& time,
70  GRan& ran) const = 0;
71  virtual double mc_norm(const GSkyDir& dir,
72  const double& radius) const = 0;
73  virtual bool contains(const GSkyDir& dir,
74  const double& margin = 0.0) const = 0;
75  virtual void read(const GXmlElement& xml) = 0;
76  virtual void write(GXmlElement& xml) const = 0;
77  virtual std::string print(const GChatter& chatter = NORMAL) const = 0;
78 
79  // Implemented virtual base class methods
80  virtual GClassCode code(void) const;
81 
82 protected:
83  // Protected methods
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;
88 };
89 
90 
91 /***********************************************************************//**
92  * @brief Return class code
93  *
94  * @return GModelSpatialDiffuse.
95  *
96  * Returns the code GModelSpatialDiffuse of the class.
97  ***************************************************************************/
98 inline
100 {
101  return GMODEL_SPATIAL_DIFFUSE;
102 }
103 
104 #endif /* GMODELSPATIALDIFFUSE_HPP */
GModelSpatialDiffuse(void)
Void constructor.
virtual void clear(void)=0
Clear object.
Energy value class definition.
Random number generator class definition.
XML element node class interface definition.
Sky direction class interface definition.
XML element node class.
Definition: GXmlElement.hpp:48
Abstract spatial model base class interface definition.
Random number generator class.
Definition: GRan.hpp:44
virtual void set_region(void) const =0
Time class.
Definition: GTime.hpp:55
virtual GSkyDir mc(const GEnergy &energy, const GTime &time, GRan &ran) const =0
Class that handles photons.
Definition: GPhoton.hpp:47
void copy_members(const GModelSpatialDiffuse &model)
Copy class members.
virtual double eval(const GPhoton &photon, const bool &gradients=false) const =0
void init_members(void)
Initialise class members.
Abstract interface for the sky region class.
Definition: GSkyRegion.hpp:57
virtual void write(GXmlElement &xml) const =0
virtual std::string print(const GChatter &chatter=NORMAL) const =0
Print content of object.
virtual std::string classname(void) const =0
Return class name.
virtual double mc_norm(const GSkyDir &dir, const double &radius) const =0
GChatter
Definition: GTypemaps.hpp:33
virtual GModelSpatialDiffuse & operator=(const GModelSpatialDiffuse &model)
Assignment operator.
virtual bool contains(const GSkyDir &dir, const double &margin=0.0) const =0
Photon class definition.
void free_members(void)
Delete class members.
virtual GClassCode code(void) const
Return class code.
GClassCode
Definition: GTypemaps.hpp:42
Abstract spatial model base class.
Abstract diffuse spatial model base class.
virtual GModelSpatialDiffuse * clone(void) const =0
Clones object.
Sky direction class.
Definition: GSkyDir.hpp:62
virtual void read(const GXmlElement &xml)=0
Time class interface definition.
Class that handles energies in a unit independent way.
Definition: GEnergy.hpp:48
virtual ~GModelSpatialDiffuse(void)
Destructor.