Commit 087deb3fc80c24426455f4f6a5878875603bbda6
1 parent
4167ace0
Put back the eval() and eval_grandients() methods in the extension.
The extension is needed to force swig to build the method variants using the GSkydir argument. These methods are implemented in the GModelSpatialRadial class, and are not automatically built by swig.
Showing
3 changed files
with
36 additions
and
0 deletions
pyext/GModelSpatialRadialDisk.i
| ... | ... | @@ -66,9 +66,21 @@ public: |
| 66 | 66 | |
| 67 | 67 | /***********************************************************************//** |
| 68 | 68 | * @brief GModelSpatialRadialDisk class extension |
| 69 | + * | |
| 70 | + * The eval(GSkyDir&) and eval_gradients(GSkyDir&) need to be defined in the | |
| 71 | + * extension to force swig to build also the interface for these methods that | |
| 72 | + * are implemented in the base class only. It's not clear to me why these | |
| 73 | + * methods are not inherited automatically. Maybe this could also be handled | |
| 74 | + * by a %typemap(typecheck) construct. | |
| 69 | 75 | ***************************************************************************/ |
| 70 | 76 | %extend GModelSpatialRadialDisk { |
| 71 | 77 | GModelSpatialRadialDisk copy() { |
| 72 | 78 | return (*self); |
| 73 | 79 | } |
| 80 | + double eval(const GSkyDir& srcDir) const { | |
| 81 | + return self->GModelSpatialRadial::eval(srcDir); | |
| 82 | + } | |
| 83 | + double eval_gradients(const GSkyDir& srcDir) const { | |
| 84 | + return self->GModelSpatialRadial::eval_gradients(srcDir); | |
| 85 | + } | |
| 74 | 86 | }; | ... | ... |
pyext/GModelSpatialRadialGauss.i
| ... | ... | @@ -63,9 +63,21 @@ public: |
| 63 | 63 | |
| 64 | 64 | /***********************************************************************//** |
| 65 | 65 | * @brief GModelSpatialRadialGauss class extension |
| 66 | + * | |
| 67 | + * The eval(GSkyDir&) and eval_gradients(GSkyDir&) need to be defined in the | |
| 68 | + * extension to force swig to build also the interface for these methods that | |
| 69 | + * are implemented in the base class only. It's not clear to me why these | |
| 70 | + * methods are not inherited automatically. Maybe this could also be handled | |
| 71 | + * by a %typemap(typecheck) construct. | |
| 66 | 72 | ***************************************************************************/ |
| 67 | 73 | %extend GModelSpatialRadialGauss { |
| 68 | 74 | GModelSpatialRadialGauss copy() { |
| 69 | 75 | return (*self); |
| 70 | 76 | } |
| 77 | + double eval(const GSkyDir& srcDir) const { | |
| 78 | + return self->GModelSpatialRadial::eval(srcDir); | |
| 79 | + } | |
| 80 | + double eval_gradients(const GSkyDir& srcDir) const { | |
| 81 | + return self->GModelSpatialRadial::eval_gradients(srcDir); | |
| 82 | + } | |
| 71 | 83 | }; | ... | ... |
pyext/GModelSpatialRadialShell.i
| ... | ... | @@ -68,9 +68,21 @@ public: |
| 68 | 68 | |
| 69 | 69 | /***********************************************************************//** |
| 70 | 70 | * @brief GModelSpatialRadialShell class extension |
| 71 | + * | |
| 72 | + * The eval(GSkyDir&) and eval_gradients(GSkyDir&) need to be defined in the | |
| 73 | + * extension to force swig to build also the interface for these methods that | |
| 74 | + * are implemented in the base class only. It's not clear to me why these | |
| 75 | + * methods are not inherited automatically. Maybe this could also be handled | |
| 76 | + * by a %typemap(typecheck) construct. | |
| 71 | 77 | ***************************************************************************/ |
| 72 | 78 | %extend GModelSpatialRadialShell { |
| 73 | 79 | GModelSpatialRadialShell copy() { |
| 74 | 80 | return (*self); |
| 75 | 81 | } |
| 82 | + double eval(const GSkyDir& srcDir) const { | |
| 83 | + return self->GModelSpatialRadial::eval(srcDir); | |
| 84 | + } | |
| 85 | + double eval_gradients(const GSkyDir& srcDir) const { | |
| 86 | + return self->GModelSpatialRadial::eval_gradients(srcDir); | |
| 87 | + } | |
| 76 | 88 | }; | ... | ... |