Commit 15ad6159b477191efab8571b42c3b46b06709eaa

Authored by Jürgen Knödlseder
1 parent 89743eed

Remove implicit conversion warnings (#3324)

ChangeLog
1   -2020-11-09
  1 +2020-11-17
2 2  
3 3 * Version 2.0.0 released
4 4 ========================
... ... @@ -12,6 +12,7 @@
12 12 Integrate analytical gradients for energy dispersion computation (#3333)
13 13 Add GFunctions abstract base class (#3328)
14 14 Add GIntegrals class (#3328)
  15 + Remove implicit conversion warnings (#3324)
15 16 Implement vectorised response computation (#3203)
16 17 Implement analytical gradients for the radial Gaussian model in a
17 18 stacked analysis (#3203)
... ...
1 1 New Features and Important Changes in GammaLib 2.0.0
2 2  
3   -9 November 2020
  3 +17 November 2020
4 4  
5 5  
6 6 1. Introduction
... ...
README.md
1 1 GammaLib information
2 2 ====================
3   -* Version: 2.0.0.dev (9 November 2020)
  3 +* Version: 2.0.0.dev (17 November 2020)
4 4  
5 5 [![Build Status](https://cta-jenkins.irap.omp.eu/buildStatus/icon?job=gammalib-integrate-os)](https://cta-jenkins.irap.omp.eu/job/gammalib-integrate-os/)
6 6  
... ...
doc/source/admin/release_history/2.0.rst
1 1 .. _2.0:
2 2  
3   -GammaLib 2.0 release (9 November 2020)
4   -======================================
  3 +GammaLib 2.0 release (17 November 2020)
  4 +=======================================
5 5  
6 6 Overview
7 7 --------
... ... @@ -26,6 +26,8 @@ Improvements
26 26  
27 27 * [`3333 <https://cta-redmine.irap.omp.eu/issues/3333>`_] -
28 28 Integrate analytical gradients for energy dispersion computation
  29 +* [`3324 <https://cta-redmine.irap.omp.eu/issues/3324>`_] -
  30 + Remove implicit conversion warnings
29 31 * Implement ``GMatrixSparse::row()`` and ``GMatrixSparse::add_to_row()`` methods
30 32 * [`3203 <https://cta-redmine.irap.omp.eu/issues/3203>`_] -
31 33 Implement vectorised response computation and analytical gradients for
... ...
inst/cta/include/GCTAModelSpatialMultiplicative.hpp
1 1 /***************************************************************************
2 2 * GCTAModelSpatialMultiplicative.hpp - Multiplicative spatial model class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2018 by Juergen Knoedlseder *
  4 + * copyright (C) 2018-2020 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -132,7 +132,7 @@ std::string GCTAModelSpatialMultiplicative::type(void) const
132 132 inline
133 133 int GCTAModelSpatialMultiplicative::components(void) const
134 134 {
135   - return (m_spatial.size());
  135 + return ((int)m_spatial.size());
136 136 }
137 137  
138 138 #endif /* GCTAMODELSPATIALMULTIPLICATIVE_HPP */
... ...
pyext/GFunctions.i
... ... @@ -40,7 +40,7 @@ public:
40 40 // Constructors and destructors
41 41 GFunctions(void);
42 42 GFunctions(const GFunctions& functions);
43   - virtual ~GFunction(void);
  43 + virtual ~GFunctions(void);
44 44  
45 45 // Methods
46 46 virtual int size(void) const = 0;
... ...
pyext/GMatrix.i
... ... @@ -31,7 +31,6 @@
31 31 %}
32 32  
33 33 /* __ Includes ___________________________________________________________ */
34   -%include "GTypemaps.i"
35 34  
36 35  
37 36 /***********************************************************************//**
... ...
pyext/GMatrixSparse.i
... ... @@ -30,7 +30,6 @@
30 30 %}
31 31  
32 32 /* __ Includes ___________________________________________________________ */
33   -%include "GTypemaps.i"
34 33  
35 34  
36 35 /***********************************************************************//**
... ...
pyext/GMatrixSymmetric.i
... ... @@ -30,7 +30,6 @@
30 30 %}
31 31  
32 32 /* __ Includes ___________________________________________________________ */
33   -%include "GTypemaps.i"
34 33  
35 34  
36 35 /***********************************************************************//**
... ...
pyext/GRmf.i
1 1 /***************************************************************************
2 2 * GRmf.i - XSPEC Redistribution Matrix File class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2013-2018 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 *
... ... @@ -29,7 +29,6 @@
29 29 %}
30 30  
31 31 /* __ Includes ___________________________________________________________ */
32   -%include "GTypemaps.i"
33 32  
34 33 /* __ Constants __________________________________________________________ */
35 34 namespace gammalib {
... ...
pyext/gammalib/app.i
1 1 /***************************************************************************
2 2 * app.i - Application module *
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 *
... ... @@ -45,6 +45,7 @@ namespace std {
45 45 };
46 46  
47 47 /* __ Include GammaLib typemaps __________________________________________ */
  48 +%include typemap_GChatter.i
48 49 %include typemap_GFilename.i
49 50 %include typemap_slices.i
50 51  
... ...
pyext/gammalib/base.i
1 1 /***************************************************************************
2 2 * base.i - Base module *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2012-2016 by Juergen Knoedlseder *
  4 + * copyright (C) 2012-2020 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -40,6 +40,7 @@
40 40 %include stl.i
41 41  
42 42 /* __ Include GammaLib typemaps __________________________________________ */
  43 +%include typemap_GChatter.i
43 44 %include typemap_GFilename.i
44 45  
45 46 /* __ Base module ________________________________________________________ */
... ...
pyext/gammalib/fits.i
1 1 /***************************************************************************
2 2 * fits.i - FITS module *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2011-2017 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 *
... ... @@ -45,6 +45,7 @@ namespace std {
45 45 };
46 46  
47 47 /* __ Include GammaLib typemaps __________________________________________ */
  48 +%include typemap_GChatter.i
48 49 %include typemap_GFilename.i
49 50 %include typemap_slices.i
50 51  
... ...
pyext/gammalib/linalg.i
1 1 /***************************************************************************
2 2 * linalg.i - Linear algebra module *
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 *
... ... @@ -40,7 +40,9 @@
40 40 %include stl.i
41 41  
42 42 /* __ Include GammaLib typemaps __________________________________________ */
  43 +%include typemap_GChatter.i
43 44 %include typemap_GFilename.i
  45 +%include typemap_GTuple.i
44 46  
45 47 /* __ Include interface classes __________________________________________ */
46 48 %import(module="gammalib.base") "GBase.i";
... ...
pyext/gammalib/model.i
... ... @@ -43,6 +43,7 @@
43 43 %include stl.i
44 44  
45 45 /* __ Include GammaLib typemaps __________________________________________ */
  46 +%include typemap_GChatter.i
46 47 %include typemap_GFilename.i
47 48 %include typemap_slices.i
48 49  
... ...
pyext/gammalib/numerics.i
... ... @@ -44,7 +44,8 @@
44 44 %template(vectorc) std::vector<std::complex<double> >;
45 45  
46 46 /* __ Include GammaLib typemaps __________________________________________ */
47   -%include GTypemaps.i
  47 +%include typemap_GChatter.i
  48 +%include typemap_GTuple.i
48 49 %include typemap_GFilename.i
49 50  
50 51 /* __ Include interface classes __________________________________________ */
... ...
pyext/gammalib/obs.i
... ... @@ -60,6 +60,7 @@
60 60 %include stl.i
61 61  
62 62 /* __ Include GammaLib typemaps __________________________________________ */
  63 +%include typemap_GChatter.i
63 64 %include typemap_GFilename.i
64 65 %include typemap_slices.i
65 66  
... ...
pyext/gammalib/opt.i
1 1 /***************************************************************************
2 2 * opt.i - Optimization module *
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 *
... ... @@ -40,6 +40,7 @@
40 40 %include stl.i
41 41  
42 42 /* __ Include GammaLib typemaps __________________________________________ */
  43 +%include typemap_GChatter.i
43 44 %include typemap_GFilename.i
44 45 %include typemap_slices.i
45 46  
... ...
pyext/gammalib/sky.i
1 1 /***************************************************************************
2 2 * sky.i - Sky module *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2011-2018 by Jurgen Knodlseder *
  4 + * copyright (C) 2011-2020 by Jurgen Knodlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -47,6 +47,7 @@ namespace std {
47 47 };
48 48  
49 49 /* __ Include GammaLib typemaps __________________________________________ */
  50 +%include typemap_GChatter.i
50 51 %include typemap_GFilename.i
51 52 %include typemap_slices.i
52 53  
... ...
pyext/gammalib/support.i
1 1 /***************************************************************************
2 2 * support.i - Support module *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2011-2017 by Jurgen Knodlseder *
  4 + * copyright (C) 2011-2020 by Jurgen Knodlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -44,6 +44,7 @@
44 44 %template(vectors) std::vector<std::string>;
45 45  
46 46 /* __ Include GammaLib typemaps __________________________________________ */
  47 +%include typemap_GChatter.i
47 48 %include typemap_GFilename.i
48 49 %include typemap_slices.i
49 50  
... ...
pyext/gammalib/test.i
1 1 /***************************************************************************
2 2 * test.i - Test module *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2012-2017 by Jean-Baptiste Cayrou *
  4 + * copyright (C) 2012-2020 by Jean-Baptiste Cayrou *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -40,6 +40,7 @@
40 40 %include stl.i
41 41  
42 42 /* __ Include GammaLib typemaps __________________________________________ */
  43 +%include typemap_GChatter.i
43 44 %include typemap_GFilename.i
44 45 %include typemap_slices.i
45 46  
... ...
pyext/gammalib/vo.i
1 1 /***************************************************************************
2 2 * vo.i - Virtual Observatory module *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2014-2016 by Juergen Knoedlseder *
  4 + * copyright (C) 2014-2020 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -40,6 +40,7 @@
40 40 %include stl.i
41 41  
42 42 /* __ Include GammaLib typemaps __________________________________________ */
  43 +%include typemap_GChatter.i
43 44 %include typemap_GFilename.i
44 45  
45 46 /* __ Include interface classes __________________________________________ */
... ...
pyext/gammalib/xml.i
1 1 /***************************************************************************
2 2 * xml.i - XML module *
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 *
... ... @@ -40,6 +40,7 @@
40 40 %include stl.i
41 41  
42 42 /* __ Include GammaLib typemaps __________________________________________ */
  43 +%include typemap_GChatter.i
43 44 %include typemap_GFilename.i
44 45 %include typemap_slices.i
45 46  
... ...
pyext/gammalib/xspec.i
... ... @@ -44,7 +44,9 @@ namespace std {
44 44 };
45 45  
46 46 /* __ Include GammaLib typemaps __________________________________________ */
  47 +%include typemap_GChatter.i
47 48 %include typemap_GFilename.i
  49 +%include typemap_GTuple.i
48 50  
49 51 /* __ Include interface classes __________________________________________ */
50 52 %import(module="gammalib.base") "GBase.i";
... ...
pyext/typemap_GChatter.i 0 → 100644
  1 +/***************************************************************************
  2 + * typemap_GChatter.i - Chatter typemap *
  3 + * ----------------------------------------------------------------------- *
  4 + * copyright (C) 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 typemap_GChatter.i
  23 + * @brief Provides GChatter typemap for GammaLib
  24 + * @author Juergen Knoedlseder
  25 + */
  26 +%{
  27 +/* Put headers and other declarations here that are needed for compilation */
  28 +%}
  29 +
  30 +/* __ Enumerations _______________________________________________________ */
  31 +typedef enum {
  32 + SILENT = 0,
  33 + TERSE = 1,
  34 + NORMAL = 2,
  35 + EXPLICIT = 3,
  36 + VERBOSE = 4
  37 +} GChatter;
... ...
pyext/GTypemaps.i renamed to pyext/typemap_GTuple.i
1 1 /***************************************************************************
2   - * GTypemaps.i - Typemaps for GammaLib Python interface *
  2 + * typemap_GTuple.i - Tuple typemap *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2012 by Juergen Knoedlseder *
  4 + * copyright (C) 2020 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -19,8 +19,8 @@
19 19 * *
20 20 ***************************************************************************/
21 21 /**
22   - * @file GTypemaps.i
23   - * @brief Provides typemaps for GammaLib
  22 + * @file typemap_GTuple.i
  23 + * @brief Provides GTuple typemap for GammaLib
24 24 * @author Juergen Knoedlseder
25 25 */
26 26 %{
... ... @@ -84,44 +84,36 @@
84 84 * an integer array. This allows index access via tuples, such as in
85 85 * a[3,5,10] = 10.0 or c = a[2,9].
86 86 ***************************************************************************/
87   -%{
88   -static int var_tuple_to_index(PyObject *input, int *ptr, int dim) {
89   - if (PySequence_Check(input)) {
90   - int size = PyObject_Length(input);
91   - if (size > dim) {
  87 +%typemap(in) int GTuple[ANY] (int temp[11]) {
  88 + if (PySequence_Check($input)) {
  89 + int size = PyObject_Length($input);
  90 + if (size > 10) {
92 91 PyErr_SetString(PyExc_ValueError,"Too many arguments in tuple");
93   - return 0;
  92 + return NULL;
94 93 }
95   - ptr[0] = size;
  94 + temp[0] = size;
96 95 for (int i = 0; i < size; i++) {
97   - PyObject *o = PySequence_GetItem(input,i);
  96 + PyObject *o = PySequence_GetItem($input,i);
98 97 if (!PyInt_Check(o)) {
99 98 Py_XDECREF(o);
100 99 PyErr_SetString(PyExc_ValueError,"Expecting a tuple of integers");
101   - return 0;
  100 + return NULL;
102 101 }
103   - ptr[i+1] = (int)PyInt_AsLong(o);
  102 + temp[i+1] = (int)PyInt_AsLong(o);
104 103 Py_DECREF(o);
105 104 }
106   - return 1;
  105 + $1 = &temp[0];
107 106 }
108 107 else {
109   - ptr[0] = 1;
110   - if (!PyInt_Check(input)) {
  108 + temp[0] = 1;
  109 + if (!PyInt_Check($input)) {
111 110 PyErr_SetString(PyExc_ValueError,"Expecting an integer");
112   - return 0;
  111 + return NULL;
113 112 }
114   - ptr[1] = (int)PyInt_AsLong(input);
115   - return 1;
  113 + temp[1] = (int)PyInt_AsLong($input);
  114 + $1 = &temp[0];
116 115 }
117 116 }
118   -%}
119   -%typemap(in) int GTuple[ANY] (int temp[11]) {
120   - if (!var_tuple_to_index($input,temp,10)) {
121   - return NULL;
122   - }
123   - $1 = &temp[0];
124   -}
125 117 %typemap(typecheck) int GTuple[ANY] {
126 118 $1 = 1;
127 119 if (PySequence_Check($input)) {
... ... @@ -140,13 +132,3 @@ static int var_tuple_to_index(PyObject *input, int *ptr, int dim) {
140 132 }
141 133 }
142 134 }
143   -
144   -/* __ Enumerations _______________________________________________________ */
145   -typedef enum {
146   - SILENT = 0,
147   - TERSE = 1,
148   - NORMAL = 2,
149   - EXPLICIT = 3,
150   - VERBOSE = 4
151   -} GChatter;
152   -
... ...