49 #define MY_MIN(a,b) a < b ? a : b
67 assert( num_indexes );
97 assert( num_values == 0 );
98 assert( num_indexes == 2 );
99 assert( num_chars == 0 );
101 index_data[0] = rng->
l;
102 index_data[1] = rng->
u;
120 assert( num_values == 0 );
121 assert( num_indexes == 2 );
122 assert( num_chars == 0 );
123 if(*obj_data == NULL)
126 rng->
l = index_data[0];
127 rng->
u = index_data[1];
145 ,
const void* obj_data
153 assert( num_values );
154 assert( num_indexes );
157 *num_values = rng->
u - rng->
l + 1;
174 sub_dim = rng->
u - rng->
l + 1;
176 *targ_obj = malloc(mem_size);
186 vtbl->
obj_reinit( vtbl, obj_data, *targ_obj );
202 sub_dim = rng->
u - rng->
l + 1;
205 assert( sub_dim == sub_vec_targ->
sub_dim );
206 assert( sub_vec_targ->
values );
209 for( k = 0; k < sub_dim; ++k )
224 sub_dim = rng->
u - rng->
l + 1;
227 assert( sub_dim == sub_vec_targ->
sub_dim );
228 assert( sub_vec_targ->
values );
230 if( (
void*)sub_vec_targ->
values )
231 free( (
void*)sub_vec_targ->
values );
232 free( (
void*)sub_vec_targ );
239 ,
const void * obj_data
256 sub_dim = rng->
u - rng->
l + 1;
260 assert( sub_dim == sub_vec_targ->
sub_dim );
261 assert( sub_vec_targ->
values );
263 assert( num_values == sub_dim );
264 assert( num_indexes == 2 );
265 assert( num_chars == 0 );
267 value_data[k] = sub_vec_targ->
values[k];
268 index_data[0] = rng->
l;
269 index_data[1] = rng->
u;
275 ,
const void* obj_data
293 sub_dim = rng->
u - rng->
l + 1;
297 assert( sub_dim == sub_vec_targ->
sub_dim );
298 assert( sub_vec_targ->
values );
300 assert( num_values == sub_dim );
301 assert( num_indexes == 2 );
302 assert( num_chars == 0 );
306 for( k = 0; k < sub_dim; ++k )
307 *values++ = value_data[k];
348 if( num_targ_vecs != 0 )
381 if( rng->
u < global_offset + 1 || global_offset + sub_dim < rng->l )
384 i_l = ( rng->
l <= ( global_offset + 1 ) ? 1 : rng->
l - global_offset );
385 i_u = ( rng->
u >= ( global_offset +
sub_dim ) ? sub_dim : rng->
u - global_offset );
387 for( i = i_l; i <= i_u; ++i )
400 *in_sub_vec_targ = NULL,
401 *inout_sub_vec_targ = NULL;
408 sub_dim = rng->
u - rng->
l + 1;
410 assert( in_reduct_obj );
412 assert( sub_dim == in_sub_vec_targ->
sub_dim );
413 assert( in_sub_vec_targ->
values );
415 assert( inout_reduct_obj );
417 assert( sub_dim == inout_sub_vec_targ->sub_dim );
418 assert( inout_sub_vec_targ->values );
421 for( k = 0; k < sub_dim; ++k )
422 *inout_values++ += in_sub_vec_targ->
values[k];
429 int num_values_off, num_indexes_off, num_chars_off
430 , values_off, l_off, u_off;
431 int num_values, num_indexes, num_chars;
440 num_values = *(
RTOp_value_type*)((
char*)in_targ_array + num_values_off);
441 num_indexes = *(
RTOp_value_type*)((
char*)in_targ_array + num_indexes_off);
444 assert( num_values > 0 );
445 assert( num_indexes == 2 );
446 assert( num_chars == 0 );
447 assert( num_values == *(
RTOp_value_type*)((
char*)inout_targ_array + num_values_off) );
448 assert( num_indexes == *(
RTOp_value_type*)((
char*)inout_targ_array + num_indexes_off) );
449 assert( num_chars == *(
RTOp_value_type*)((
char*)inout_targ_array + num_chars_off) );
462 in_values = (
const RTOp_value_type*)((
char*)in_targ_array + values_off);
463 inout_values = (
RTOp_value_type*)((
char*)inout_targ_array + values_off);
464 for( k = 0; k < num_values; ++k )
465 *inout_values++ += *in_values++;
470 , RTOp_reduct_op_func_ptr_t* reduct_op_func_ptr )
482 ,
"RTOp_ROp_get_sub_vector"
static int RTOp_ROp_get_sub_vector_apply_op(const struct RTOp_RTOp_vtbl_t *vtbl, const void *obj_data, const int num_vecs, const struct RTOp_SubVector vecs[], const int num_targ_vecs, const struct RTOp_MutableSubVector targ_vecs[], RTOp_ReductTarget targ_obj)
static int targ_load_state(const struct RTOp_obj_type_vtbl_t *vtbl, const void *obj_data, int num_values, const RTOp_value_type value_data[], int num_indexes, const RTOp_index_type index_data[], int num_chars, const RTOp_char_type char_data[], void **targ_obj)
RTOp_index_type global_offset
int(* obj_create)(const struct RTOp_obj_type_vtbl_t *vtbl, const void *instance_data, void **obj)
const struct RTOp_obj_type_vtbl_t * obj_data_vtbl
static void CALL_API external_reduct_op(void *in_targ_array, void *inout_targ_array, int *len, RTOp_Datatype *datatype)
static int targ_extract_state(const struct RTOp_obj_type_vtbl_t *vtbl, const void *obj_data, void *targ_obj, int num_values, RTOp_value_type value_data[], int num_indexes, RTOp_index_type index_data[], int num_chars, RTOp_char_type char_data[])
void RTOp_sub_vector(RTOp_index_type global_offset, RTOp_index_type sub_dim, const RTOp_value_type values[], ptrdiff_t values_stride, struct RTOp_SubVector *sub_vec)
int RTOp_ROp_get_sub_vector_construct(RTOp_index_type l, RTOp_index_type u, struct RTOp_RTOp *op)
const RTOp_value_type * values
static int load_op_state(const struct RTOp_obj_type_vtbl_t *vtbl, const void *dummy, int num_values, const RTOp_value_type value_data[], int num_indexes, const RTOp_index_type index_data[], int num_chars, const RTOp_char_type char_data[], void **obj_data)
static int get_targ_type_num_entries(const struct RTOp_obj_type_vtbl_t *vtbl, const void *obj_data, int *num_values, int *num_indexes, int *num_chars)
const struct RTOp_RTOp_vtbl_t RTOp_ROp_get_sub_vector_vtbl
static int extract_op_state(const struct RTOp_obj_type_vtbl_t *vtbl, const void *dummy, void *obj_data, int num_values, RTOp_value_type value_data[], int num_indexes, RTOp_index_type index_data[], int num_chars, RTOp_char_type char_data[])
static int get_reduct_op(const struct RTOp_RTOp_vtbl_t *vtbl, const void *obj_data, RTOp_reduct_op_func_ptr_t *reduct_op_func_ptr)
static int targ_obj_free(const struct RTOp_obj_type_vtbl_t *vtbl, const void *obj_data, RTOp_ReductTarget *targ_obj)
static struct RTOp_obj_type_vtbl_t targ_obj_vtbl
#define RTOp_ERR_INVALID_NUM_VECS
static int get_op_type_num_entries(const struct RTOp_obj_type_vtbl_t *vtbl, const void *obj_data, int *num_values, int *num_indexes, int *num_chars)
int(* obj_free)(const struct RTOp_obj_type_vtbl_t *vtbl, const void *instance_data, void **obj)
static struct RTOp_obj_type_vtbl_t instance_obj_vtbl
static int targ_obj_reinit(const struct RTOp_obj_type_vtbl_t *vtbl, const void *obj_data, RTOp_ReductTarget targ_obj)
MPI_Datatype RTOp_Datatype
static int targ_obj_create(const struct RTOp_obj_type_vtbl_t *vtbl, const void *obj_data, RTOp_ReductTarget *targ_obj)
struct RTOp_SubVector RTOp_ROp_get_sub_vector_val(RTOp_ReductTarget targ_obj)
int RTOp_ROp_get_sub_vector_set_range(RTOp_index_type l, RTOp_index_type u, struct RTOp_RTOp *op)
static int reduce_reduct_objs(const struct RTOp_RTOp_vtbl_t *vtbl, const void *obj_data, RTOp_ReductTarget in_reduct_obj, RTOp_ReductTarget inout_reduct_obj)
int(* obj_reinit)(const struct RTOp_obj_type_vtbl_t *vtbl, const void *instance_data, void *obj)
const struct RTOp_RTOp_vtbl_t * vtbl
static int obj_create(const struct RTOp_obj_type_vtbl_t *vtbl, const void *instance_data, RTOp_ReductTarget *obj)
int RTOp_ROp_get_sub_vector_destroy(struct RTOp_RTOp *op)
int RTOp_obj_free_free(const struct RTOp_obj_type_vtbl_t *vtbl, const void *instance_data, void **obj)
const f_int f_dbl_prec const f_int f_int const f_int f_int const f_dbl_prec & u
#define RTOp_ERR_INVALID_NUM_TARG_VECS
Teuchos_Ordinal RTOp_index_type
#define RTOp_REDUCT_OBJ_NULL