SWIG: no types defined

I have a C ++ class that I am trying to wrap for Python using SWIG. I am having trouble trying to wrap one of the functions that take an array as input.

Here is the header file

class dyndiff_data_t
    {
    private:    

        double H[3];
        double GAMMA;
        double k;
        double P;
    public:
        dyndiff_data_t(double H_[3],
                        const double GAMMA_,
                        const double k_,
                        const double P_);

        void test();
    };

and here is the swig interface file,

%module twowave
%{
  #define SWIG_FILE_WITH_INIT
  #include <twowave.h>
%}

%include "numpy.i"
%init %{
import_array();
%}

%apply (double IN_ARRAY1[3]) {(double H_[3])};

%include <twowave.h>

The problem is that to enter the array, SWIG complains that there is no typical card. I do not understand why. The numpy.i file was taken from here and the map map you describe is described here

Any help would be appreciated.

+5
source share
1 answer

, typemap numpy.i , . , int len1 double * vec1 :

%apply (int DIM1, double* IN_ARRAY1) {(int len, double* H_)}

, , carrays.i.

, . , :

%typemap(in) double TUPLE[ANY]
{
   ...
}

, .

%apply double TUPLE[3] {double H_[3]}

, , , - SWIG -tmsearch. , , .

+3

All Articles