GammaLib 2.0.0
Loading...
Searching...
No Matches
GModelSpectralTablePar.hpp
Go to the documentation of this file.
1/***************************************************************************
2 * GModelSpectralTablePar.hpp - Spectral table model parameter class *
3 * ----------------------------------------------------------------------- *
4 * copyright (C) 2019-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 GModelSpectralTablePar.hpp
23 * @brief Spectral table model parameter class definition
24 * @author Juergen Knoedlseder
25 */
26
27#ifndef GMODELSPECTRALTABLEPAR_HPP
28#define GMODELSPECTRALTABLEPAR_HPP
29
30/* __ Includes ___________________________________________________________ */
31#include <string>
32#include "GBase.hpp"
33#include "GModelPar.hpp"
34#include "GNodeArray.hpp"
35
36/* __ Forward declarations _______________________________________________ */
37
38
39/***********************************************************************//**
40 * @class GModelSpectralTablePar
41 *
42 * @brief Spectral table model parameter class
43 ***************************************************************************/
45
46public:
47 // Constructors and destructors
50 const std::vector<double>& values);
52 virtual ~GModelSpectralTablePar(void);
53
54 // Operators
56
57 // Methods
58 void clear(void);
59 GModelSpectralTablePar* clone(void) const;
60 std::string classname(void) const;
61 int size(void) const;
62 bool is_empty(void) const;
63 GModelPar& par(void);
64 const GModelPar& par(void) const;
65 const GNodeArray& values(void) const;
66 const int& method(void) const;
67 void method(const int& method);
68 std::string print(const GChatter& chatter = NORMAL) const;
69
70protected:
71 // Protected methods
72 void init_members(void);
74 void free_members(void);
75
76 // Protected members
77 GModelPar m_par; //!< Model parameter
78 GNodeArray m_values; //!< Parameter values
79 int m_method; //!< Interpolation method (0: linear, 1: logarithmic)
80};
81
82
83/***********************************************************************//**
84 * @brief Return class name
85 *
86 * @return String containing the class name ("GModelSpectralTablePar").
87 ***************************************************************************/
88inline
89std::string GModelSpectralTablePar::classname(void) const
90{
91 return ("GModelSpectralTablePar");
92}
93
94
95/***********************************************************************//**
96 * @brief Return number of table model parameter values
97 *
98 * @return Number of table model parameter values.
99 *
100 * Returns the number of table model parameter values.
101 ***************************************************************************/
102inline
104{
105 return (m_values.size());
106}
107
108
109/***********************************************************************//**
110 * @brief Signals if there are no table model parameter values
111 *
112 * @return True if there are no table model parameter values, false otherwise.
113 *
114 * Signals if there are no table model parameter values.
115 ***************************************************************************/
116inline
118{
119 return (m_values.is_empty());
120}
121
122
123/***********************************************************************//**
124 * @brief Return reference to table model parameter
125 *
126 * @return Reference to table model parameter.
127 ***************************************************************************/
128inline
130{
131 return m_par;
132}
133
134
135/***********************************************************************//**
136 * @brief Return reference to table model parameter (const version)
137 *
138 * @return Reference to table model parameter.
139 ***************************************************************************/
140inline
142{
143 return m_par;
144}
145
146
147/***********************************************************************//**
148 * @brief Return reference to table model parameter values as node array
149 *
150 * @return Reference to table model parameter values as node array.
151 ***************************************************************************/
152inline
154{
155 return m_values;
156}
157
158
159/***********************************************************************//**
160 * @brief Return reference to table model parameter interpolation method
161 *
162 * @return Interpolation method (0: linear, 1: logarithmic).
163 ***************************************************************************/
164inline
165const int& GModelSpectralTablePar::method(void) const
166{
167 return m_method;
168}
169
170
171/***********************************************************************//**
172 * @brief Set table model parameter interpolation method
173 *
174 * @param[in] method Interpolation method (0: linear, 1: logarithmic).
175 ***************************************************************************/
176inline
177void GModelSpectralTablePar::method(const int& method)
178{
180 return;
181}
182
183#endif /* GMODELSPECTRALTABLEPAR_HPP */
Definition of interface for all GammaLib classes.
Model parameter class interface definition.
Node array class interface definition.
GChatter
Definition GTypemaps.hpp:33
@ NORMAL
Definition GTypemaps.hpp:36
Interface class for all GammaLib classes.
Definition GBase.hpp:52
Model parameter class.
Definition GModelPar.hpp:87
Spectral table model parameter class.
void clear(void)
Clear table model parameter.
void free_members(void)
Delete class members.
bool is_empty(void) const
Signals if there are no table model parameter values.
int size(void) const
Return number of table model parameter values.
std::string classname(void) const
Return class name.
GNodeArray m_values
Parameter values.
int m_method
Interpolation method (0: linear, 1: logarithmic)
GModelSpectralTablePar * clone(void) const
Clone table model parameter.
const GNodeArray & values(void) const
Return reference to table model parameter values as node array.
virtual ~GModelSpectralTablePar(void)
Destructor.
GModelSpectralTablePar(void)
Void constructor.
GModelSpectralTablePar & operator=(const GModelSpectralTablePar &par)
Assignment operator.
GModelPar & par(void)
Return reference to table model parameter.
GModelPar m_par
Model parameter.
void init_members(void)
Initialise class members.
std::string print(const GChatter &chatter=NORMAL) const
Print table model parameter.
void copy_members(const GModelSpectralTablePar &par)
Copy class members.
const int & method(void) const
Return reference to table model parameter interpolation method.
Node array class.
bool is_empty(void) const
Signals if there are no nodes in node array.
int size(void) const
Return number of nodes in node array.