GammaLib 2.0.0
Loading...
Searching...
No Matches
GModelData.hpp
Go to the documentation of this file.
1/***************************************************************************
2 * GModelData.hpp - Abstract virtual data model class *
3 * ----------------------------------------------------------------------- *
4 * copyright (C) 2011-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 GModelData.hpp
23 * @brief Abstract data model base class interface definition
24 * @author Juergen Knoedlseder
25 */
26
27#ifndef GMODELDATA_HPP
28#define GMODELDATA_HPP
29
30/* __ Includes ___________________________________________________________ */
31#include <vector>
32#include <string>
33#include "GModel.hpp"
34
35/* __ Forward declarations _______________________________________________ */
36class GEnergy;
37class GTime;
38class GEvent;
39class GEvents;
40class GObservation;
41class GRan;
42class GXmlElement;
43class GVector;
44class GMatrixSparse;
45
46
47/***********************************************************************//**
48 * @class GModelData
49 *
50 * @brief Abstract data model class
51 *
52 * This abstract base class implements a model of the event distribution in
53 * the instrument's data space.
54 ***************************************************************************/
55class GModelData : public GModel {
56
57public:
58 // Constructors and destructors
59 GModelData(void);
60 explicit GModelData(const GXmlElement& xml);
61 GModelData(const GModelData& model);
62 virtual ~GModelData(void);
63
64 // Operators
65 virtual GModelData& operator=(const GModelData& model);
66
67 // Pure virtual methods
68 virtual void clear(void) = 0;
69 virtual GModelData* clone(void) const = 0;
70 virtual std::string classname(void) const = 0;
71 virtual std::string type(void) const = 0;
72 virtual bool is_constant(void) const = 0;
73 virtual double eval(const GEvent& event,
74 const GObservation& obs,
75 const bool& gradients = false) const = 0;
76 virtual double npred(const GEnergy& obsEng, const GTime& obsTime,
77 const GObservation& obs) const = 0;
78 virtual GEvents* mc(const GObservation& obs, GRan& ran) const = 0;
79 virtual void read(const GXmlElement& xml) = 0;
80 virtual void write(GXmlElement& xml) const = 0;
81 virtual std::string print(const GChatter& chatter = NORMAL) const = 0;
82
83 // Implemented pure virtual base class methods
84 virtual GVector eval(const GObservation& obs,
85 GMatrixSparse* gradients = NULL) const;
86
87protected:
88 // Protected methods
89 void init_members(void);
90 void copy_members(const GModelData& model);
91 void free_members(void);
92};
93
94#endif /* GMODELDATA_HPP */
Abstract model base class interface definition.
GChatter
Definition GTypemaps.hpp:33
@ NORMAL
Definition GTypemaps.hpp:36
Class that handles energies in a unit independent way.
Definition GEnergy.hpp:48
Abstract interface for the event classes.
Definition GEvent.hpp:71
Abstract event container class.
Definition GEvents.hpp:66
Sparse matrix class interface definition.
Abstract data model class.
virtual ~GModelData(void)
Destructor.
virtual GModelData * clone(void) const =0
Clones object.
void init_members(void)
Initialise class members.
virtual std::string type(void) const =0
virtual double eval(const GEvent &event, const GObservation &obs, const bool &gradients=false) const =0
GModelData(void)
Void constructor.
virtual void clear(void)=0
Clear object.
virtual void write(GXmlElement &xml) const =0
void copy_members(const GModelData &model)
Copy class members.
void free_members(void)
Delete class members.
virtual double npred(const GEnergy &obsEng, const GTime &obsTime, const GObservation &obs) const =0
virtual bool is_constant(void) const =0
virtual std::string classname(void) const =0
Return class name.
virtual GModelData & operator=(const GModelData &model)
Assignment operator.
virtual void read(const GXmlElement &xml)=0
virtual GEvents * mc(const GObservation &obs, GRan &ran) const =0
virtual std::string print(const GChatter &chatter=NORMAL) const =0
Print content of object.
Abstract model class.
Definition GModel.hpp:100
Abstract observation base class.
Random number generator class.
Definition GRan.hpp:44
Time class.
Definition GTime.hpp:55
Vector class.
Definition GVector.hpp:46
XML element node class.