1
0
mirror of https://github.com/TREX-CoE/trexio.git synced 2024-12-23 04:43:57 +01:00

Teach SWIG to process bitfield_t pointers

This commit is contained in:
q-posev 2022-04-22 13:39:28 +02:00
parent 109f3ea41f
commit 30c940e592
2 changed files with 6 additions and 8 deletions

View File

@ -49,10 +49,6 @@
/* Return number of sparse data points read from the file as part of the output tuple */ /* Return number of sparse data points read from the file as part of the output tuple */
%apply int *INOUT { int64_t* const buffer_size_read}; %apply int *INOUT { int64_t* const buffer_size_read};
/*
%apply int { bitfield_t };
*/
/* Does not work for arrays (SIGSEGV) */ /* Does not work for arrays (SIGSEGV) */
/* This enables access to trexio_[...]_read_dset_str_low set of functions /* This enables access to trexio_[...]_read_dset_str_low set of functions
@ -83,6 +79,7 @@ import_array();
%numpy_typemaps(float, NPY_FLOAT, int64_t) %numpy_typemaps(float, NPY_FLOAT, int64_t)
%numpy_typemaps(int32_t, NPY_INT32, int64_t) %numpy_typemaps(int32_t, NPY_INT32, int64_t)
%numpy_typemaps(int64_t, NPY_INT64, int64_t) %numpy_typemaps(int64_t, NPY_INT64, int64_t)
%numpy_typemaps(bitfield_t, NPY_INT64, int64_t)
/* Enable write|read_safe functions to convert numpy arrays from/to double arrays */ /* Enable write|read_safe functions to convert numpy arrays from/to double arrays */
%apply (double* ARGOUT_ARRAY1, int64_t DIM1) {(double* const dset_out, const int64_t dim_out)}; %apply (double* ARGOUT_ARRAY1, int64_t DIM1) {(double* const dset_out, const int64_t dim_out)};
%apply (double* IN_ARRAY1, int64_t DIM1) {(const double* dset_in, const int64_t dim_in)}; %apply (double* IN_ARRAY1, int64_t DIM1) {(const double* dset_in, const int64_t dim_in)};
@ -106,6 +103,7 @@ import_array();
%apply (int32_t* ARGOUT_ARRAY1, int64_t DIM1) {(int32_t* const dset_dn_out, const int64_t dim_dn_out)}; %apply (int32_t* ARGOUT_ARRAY1, int64_t DIM1) {(int32_t* const dset_dn_out, const int64_t dim_dn_out)};
%apply (int64_t* ARGOUT_ARRAY1, int64_t DIM1) {(int64_t* const dset_up_out, const int64_t dim_up_out)}; %apply (int64_t* ARGOUT_ARRAY1, int64_t DIM1) {(int64_t* const dset_up_out, const int64_t dim_up_out)};
%apply (int64_t* ARGOUT_ARRAY1, int64_t DIM1) {(int64_t* const dset_dn_out, const int64_t dim_dn_out)}; %apply (int64_t* ARGOUT_ARRAY1, int64_t DIM1) {(int64_t* const dset_dn_out, const int64_t dim_dn_out)};
%apply (bitfield_t* IN_ARRAY1, int64_t DIM1) {(const bitfield_t* dset_in, const int64_t dim_in)};
/* This tells SWIG to treat char ** dset_in pattern as a special case /* This tells SWIG to treat char ** dset_in pattern as a special case
Enables access to trexio_[...]_write_dset_str set of functions directly, i.e. Enables access to trexio_[...]_write_dset_str set of functions directly, i.e.

View File

@ -5225,8 +5225,8 @@ typedef int64_t bitfield_t;
trexio_exit_code trexio_to_orbital_list (const int32_t N_int, const bitfield_t* d1, int32_t* const list, int32_t* const occupied_num); trexio_exit_code trexio_to_orbital_list (const int32_t N_int, const bitfield_t* d1, int32_t* const list, int32_t* const occupied_num);
trexio_exit_code trexio_to_orbital_list_up_dn (const int32_t N_int, const bitfield_t* d1, int32_t* const list_up, int32_t* const list_dn, int32_t* const occ_num_up, int32_t* const occ_num_dn); trexio_exit_code trexio_to_orbital_list_up_dn (const int32_t N_int, const bitfield_t* d1, int32_t* const list_up, int32_t* const list_dn, int32_t* const occ_num_up, int32_t* const occ_num_dn);
trexio_exit_code trexio_safe_to_orbital_list (const int32_t N_int, const int64_t* dset_in, const int64_t dim_in, int32_t* const dset_out, const int64_t dim_out, int32_t* const num); trexio_exit_code trexio_safe_to_orbital_list (const int32_t N_int, const bitfield_t* dset_in, const int64_t dim_in, int32_t* const dset_out, const int64_t dim_out, int32_t* const num);
trexio_exit_code trexio_safe_to_orbital_list_up_dn (const int32_t N_int, const int64_t* dset_in, const int64_t dim_in, int32_t* const dset_up_out, const int64_t dim_up_out, int32_t* const dset_dn_out, const int64_t dim_dn_out, int32_t* const num_up, int32_t* const num_dn); trexio_exit_code trexio_safe_to_orbital_list_up_dn (const int32_t N_int, const bitfield_t* dset_in, const int64_t dim_in, int32_t* const dset_up_out, const int64_t dim_up_out, int32_t* const dset_dn_out, const int64_t dim_dn_out, int32_t* const num_up, int32_t* const num_dn);
#+end_src #+end_src
#+begin_src c :tangle prefix_front.c #+begin_src c :tangle prefix_front.c
@ -5301,7 +5301,7 @@ trexio_exit_code trexio_to_orbital_list_up_dn(const int32_t N_int,
#+begin_src c :tangle prefix_front.c #+begin_src c :tangle prefix_front.c
trexio_exit_code trexio_exit_code
trexio_safe_to_orbital_list (const int32_t N_int, trexio_safe_to_orbital_list (const int32_t N_int,
const int64_t* dset_in, const bitfield_t* dset_in,
const int64_t dim_in, const int64_t dim_in,
int32_t* const dset_out, int32_t* const dset_out,
const int64_t dim_out, const int64_t dim_out,
@ -5312,7 +5312,7 @@ trexio_safe_to_orbital_list (const int32_t N_int,
trexio_exit_code trexio_exit_code
trexio_safe_to_orbital_list_up_dn (const int32_t N_int, trexio_safe_to_orbital_list_up_dn (const int32_t N_int,
const int64_t* dset_in, const bitfield_t* dset_in,
const int64_t dim_in, const int64_t dim_in,
int32_t* const dset_up_out, int32_t* const dset_up_out,
const int64_t dim_up_out, const int64_t dim_up_out,