Skip to content

Commit

Permalink
Additional attempt NanoComp#1 at typemaps in SWIG
Browse files Browse the repository at this point in the history
  • Loading branch information
danielwboyce committed Mar 12, 2020
1 parent 8212547 commit bee4c0b
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions python/meep.i
Original file line number Diff line number Diff line change
Expand Up @@ -966,6 +966,24 @@ meep::volume_list *make_volume_list(const meep::volume &v, int c,
// typemaps needed for add_dft_fields
//--------------------------------------------------

%typecheck(SWIG_TYPECHECK_POINTER, fragment="NumPy_Fragments") double* freqs {
$1 = is_array($input);
}

%typemap(in, fragment="NumPy_Macros") double* freqs {
$1 = (double *)array_data($input);
}

/*
%typecheck(SWIG_TYPECHECK_POINTER, fragment="NumPy_Fragments") double* fs {
$1 = is_array($input);
}
%typemap(in, fragment="NumPy_Macros") double* fs {
$1 = (double *)array_data($input);
}
*/

%typecheck(SWIG_TYPECHECK_POINTER) const volume where {
int py_material = PyObject_IsInstance($input, py_volume_object());
$1 = py_material;
Expand Down

0 comments on commit bee4c0b

Please sign in to comment.