@@ -2037,7 +2037,8 @@ pub unsafe extern "C" fn pineappl_grid_subgrid_array(
20372037///
20382038/// # Safety
20392039///
2040- /// TODO
2040+ /// If `grid` does not point to a valid `Grid` object, for example when `grid` is the null pointer,
2041+ /// this function is not safe to call.
20412042#[ no_mangle]
20422043pub unsafe extern "C" fn pineappl_grid_evolve_info_shape (
20432044 grid : * const Grid ,
@@ -2066,7 +2067,8 @@ pub unsafe extern "C" fn pineappl_grid_evolve_info_shape(
20662067///
20672068/// # Safety
20682069///
2069- /// TODO
2070+ /// If `grid` does not point to a valid `Grid` object, for example when `grid` is the null pointer,
2071+ /// this function is not safe to call.
20702072#[ no_mangle]
20712073pub unsafe extern "C" fn pineappl_grid_evolve_info (
20722074 grid : * const Grid ,
@@ -2096,40 +2098,62 @@ pub unsafe extern "C" fn pineappl_grid_evolve_info(
20962098 ren1. copy_from_slice ( & grid. evolve_info ( & order_mask) . ren1 ) ;
20972099}
20982100
2099- /// Evolve a grid and dump the resulting FK table.
2101+ /// Evolve a grid with an evolution operator and dump the resulting FK table.
2102+ ///
2103+ /// # Arguments
2104+ ///
2105+ /// * `grid` - A `Grid` object
2106+ /// * `op_info` - An array of `OperatorInfo` objects containing the information about the evolution.
2107+ /// Its length must be `(N_{conv} * N_{Q2_slices})`.
2108+ /// * `orders` - The maximum QCD and EW orders `(αs, α)`
2109+ /// * `operators` - An array of evolution operators. Each operator is a flattend version of a rank-4
2110+ /// tensor whose shape is defined by: `pids_out`, `x_out`, `pids_in`, `x_in`, in that
2111+ /// order. The size of `operators` must be `(N_{conv} * N_{Q2_slices} * len_flat_op)`.
2112+ /// * `x_in` - The x-grid that defines the Grid
2113+ /// * `x_out` - The x-grid that will define the evolved Grid
2114+ /// * `pids_in` - The list of PID values that defines the Grid
2115+ /// * `pids_out` - The list of PID values that will define the evolved Grid
2116+ /// * `eko_shape` - The shape of the evolution operator
2117+ /// * `xi` - The values that defines that scale variations
2118+ /// * `ren` - An array containing the values of the renormalization scale variation
2119+ /// * `alphas` - An array containing the values of `αs`. It must have the same size as `ren1`.
21002120///
21012121/// # Safety
21022122///
2103- /// TODO
2123+ /// This function is not safe to call if: (a) the `grid` does not point to a valid `Grid` object or
2124+ /// is a null pointer; (b) the `op_info` and `operators` objects do not have the expected lengths,
2125+ /// (c) the shape of `eko_shape` is different from the actual size of `pids_out`, `x_out`, `pids_in`,
2126+ /// `x_in`.
21042127///
21052128/// # Panics
21062129///
2107- /// TODO
2130+ /// This function might panic if the either the `op_info` and/or `operators` are/is incompatible
2131+ /// with the `Grid`.
21082132#[ no_mangle]
21092133pub unsafe extern "C" fn pineappl_grid_evolve (
21102134 grid : * mut Grid ,
21112135 op_info : * mut OperatorInfo ,
2112- orders : * const u8 ,
2136+ max_orders : * const u8 ,
21132137 operators : * mut f64 ,
2114- x_grid : * mut f64 ,
2115- x_fktable : * mut f64 ,
2116- pids_grid : * mut i32 ,
2117- pids_fktable : * mut i32 ,
2138+ x_in : * mut f64 ,
2139+ x_out : * mut f64 ,
2140+ pids_in : * mut i32 ,
2141+ pids_out : * mut i32 ,
21182142 eko_shape : * mut usize ,
21192143 xi : * mut f64 ,
21202144 ren1 : * mut f64 ,
21212145 alphas : * mut f64 ,
21222146) -> Box < FkTable > {
21232147 let grid = unsafe { & mut * grid } ;
21242148
2125- let orders = unsafe { slice:: from_raw_parts ( orders , 2 ) } ;
2149+ let max_orders = unsafe { slice:: from_raw_parts ( max_orders , 2 ) } ;
21262150 let eko_shape = unsafe { slice:: from_raw_parts ( eko_shape, 4 ) } ;
2127- let pids_fktable = unsafe { slice:: from_raw_parts ( pids_fktable , eko_shape[ 0 ] ) } ;
2128- let x_fktable = unsafe { slice:: from_raw_parts ( x_fktable , eko_shape[ 1 ] ) } ;
2129- let pids_grid = unsafe { slice:: from_raw_parts ( pids_grid , eko_shape[ 2 ] ) } ;
2130- let x_grid = unsafe { slice:: from_raw_parts ( x_grid , eko_shape[ 3 ] ) } ;
2151+ let pids_out = unsafe { slice:: from_raw_parts ( pids_out , eko_shape[ 0 ] ) } ;
2152+ let x_out = unsafe { slice:: from_raw_parts ( x_out , eko_shape[ 1 ] ) } ;
2153+ let pids_in = unsafe { slice:: from_raw_parts ( pids_in , eko_shape[ 2 ] ) } ;
2154+ let x_in = unsafe { slice:: from_raw_parts ( x_in , eko_shape[ 3 ] ) } ;
21312155
2132- let order_mask = Order :: create_mask ( grid. orders ( ) , orders [ 0 ] , orders [ 1 ] , true ) ;
2156+ let order_mask = Order :: create_mask ( grid. orders ( ) , max_orders [ 0 ] , max_orders [ 1 ] , true ) ;
21332157 let evolve_info = grid. evolve_info ( & order_mask) ;
21342158
21352159 let ren1_len = evolve_info. ren1 . len ( ) ;
@@ -2167,11 +2191,11 @@ pub unsafe extern "C" fn pineappl_grid_evolve(
21672191 let operator_slice_info = OperatorSliceInfo {
21682192 pid_basis : op_info. pid_basis ,
21692193 fac0 : op_info. fac0 ,
2170- pids0 : pids_fktable . to_vec ( ) ,
2171- x0 : x_fktable . to_vec ( ) ,
2194+ pids0 : pids_out . to_vec ( ) ,
2195+ x0 : x_out . to_vec ( ) ,
21722196 fac1 : op_info. fac1 ,
2173- pids1 : pids_grid . to_vec ( ) ,
2174- x1 : x_grid . to_vec ( ) ,
2197+ pids1 : pids_in . to_vec ( ) ,
2198+ x1 : x_in . to_vec ( ) ,
21752199 conv_type : op_info. conv_type ,
21762200 } ;
21772201
0 commit comments