@@ -173,7 +173,7 @@ subroutine channels_add(channels, combinations, pdg_id_combinations, factors) &
173173
174174 type (c_ptr) function channels_new(convolutions) bind(c, name = ' pineappl_channels_new' )
175175 use iso_c_binding
176- integer (c_int32_t ), value :: convolutions
176+ integer (c_size_t ), value :: convolutions
177177 end function
178178
179179 integer (c_size_t) function grid_bin_count(grid) bind(c, name = ' pineappl_grid_bin_count' )
@@ -271,6 +271,13 @@ function grid_key_value(grid, key) bind(c, name = 'pineappl_grid_key_value')
271271 type (c_ptr) :: grid_key_value
272272 end function
273273
274+ function grid_metadata (grid , key ) bind(c, name = ' pineappl_grid_metadata' )
275+ use iso_c_binding
276+ type (c_ptr), value :: grid
277+ character (c_char) :: key(* )
278+ type (c_ptr) :: grid_metadata
279+ end function
280+
274281 function grid_channels (grid ) bind(c, name = ' pineappl_grid_channels' )
275282 use iso_c_binding
276283 type (c_ptr), value :: grid
@@ -358,6 +365,12 @@ subroutine grid_set_key_value(grid, key, valju) bind(c, name = 'pineappl_grid_se
358365 character (c_char) :: key(* ), valju(* )
359366 end subroutine
360367
368+ subroutine grid_set_metadata (grid , key , valju ) bind(c, name = ' pineappl_grid_set_metadata' )
369+ use iso_c_binding
370+ type (c_ptr), value :: grid
371+ character (c_char) :: key(* ), valju(* )
372+ end subroutine
373+
361374 subroutine grid_set_remapper (grid , dimensions , normalizations , limits ) bind(c, name = ' pineappl_grid_set_remapper' )
362375 use iso_c_binding
363376 type (c_ptr), value :: grid
@@ -434,9 +447,9 @@ function c_f_string(c_str) result(f_str)
434447 type (pineappl_channels) function pineappl_channels_new(convolutions)
435448 implicit none
436449
437- integer (c_int32_t), value :: convolutions
450+ integer , intent ( in ) :: convolutions
438451
439- pineappl_channels_new = pineappl_channels(channels_new(convolutions))
452+ pineappl_channels_new = pineappl_channels(channels_new(int ( convolutions, c_size_t) ))
440453 end function
441454
442455 integer function pineappl_grid_bin_count (grid )
@@ -538,7 +551,7 @@ function pineappl_grid_convolve(grid, xfx, alphas, pdfs_state, alphas_state, ord
538551 alphas_state, &
539552 [(logical (order_mask(i), c_bool), i = 1 , size (order_mask))], &
540553 [(logical (channel_mask(i), c_bool), i = 1 , size (channel_mask))], &
541- [(int (bin_indices, c_size_t), i = 1 , size (bin_indices))], &
554+ [(int (bin_indices(i) , c_size_t), i = 1 , size (bin_indices))], &
542555 int (nb_scales, c_size_t), &
543556 mu_scales, &
544557 res &
@@ -605,6 +618,18 @@ function pineappl_grid_key_value(grid, key) result(res)
605618 res = c_f_string(grid_key_value(grid% ptr, key // c_null_char))
606619 end function
607620
621+ function pineappl_grid_metadata (grid , key ) result(res)
622+ use iso_c_binding
623+
624+ implicit none
625+
626+ type (pineappl_grid), intent (in ) :: grid
627+ character (* ), intent (in ) :: key
628+ character (:), allocatable :: res
629+
630+ res = c_f_string(grid_metadata(grid% ptr, key // c_null_char))
631+ end function
632+
608633 type (pineappl_channels) function pineappl_grid_channels(grid)
609634 implicit none
610635
@@ -752,6 +777,17 @@ subroutine pineappl_grid_set_key_value(grid, key, valju)
752777 call grid_set_key_value(grid% ptr, key // c_null_char, valju // c_null_char)
753778 end subroutine
754779
780+ subroutine pineappl_grid_set_metadata (grid , key , valju )
781+ use iso_c_binding
782+
783+ implicit none
784+
785+ type (pineappl_grid), intent (in ) :: grid
786+ character (* ), intent (in ) :: key, valju
787+
788+ call grid_set_metadata(grid% ptr, key // c_null_char, valju // c_null_char)
789+ end subroutine
790+
755791 subroutine pineappl_grid_set_remapper (grid , dimensions , normalizations , limits )
756792 use iso_c_binding
757793
@@ -788,10 +824,10 @@ subroutine pineappl_channels_add(channels, combinations, pdg_id_combinations, fa
788824
789825 implicit none
790826
791- type (pineappl_channels), intent (in ) :: channels
792- integer , intent (in ) :: combinations
793- integer , dimension (2 * combinations ), intent (in ) :: pdg_id_combinations
794- real (dp), dimension (combinations), intent (in ) :: factors
827+ type (pineappl_channels), intent (in ) :: channels
828+ integer , intent (in ) :: combinations
829+ integer , dimension (* ), intent (in ) :: pdg_id_combinations
830+ real (dp), dimension (combinations), intent (in ) :: factors
795831
796832 call channels_add(channels% ptr, int (combinations, c_size_t), pdg_id_combinations, factors)
797833 end subroutine
0 commit comments