10 #include "RTOp_parallel_helpers.h"
12 #define MY_MIN(a,b) ( (a) < (b) ? (a) : (b) )
13 #define MY_MAX(a,b) ( (a) > (b) ? (a) : (b) )
15 void RTOp_parallel_calc_overlap(
16 Teuchos_Ordinal global_dim_in, Teuchos_Ordinal local_sub_dim_in, Teuchos_Ordinal local_off_in
17 ,
const Teuchos_Ordinal first_ele_off_in,
const Teuchos_Ordinal sub_dim_in,
const Teuchos_Ordinal global_off_in
18 ,Teuchos_Ordinal* overlap_first_local_ele_off, Teuchos_Ordinal* overalap_local_sub_dim
19 ,Teuchos_Ordinal* overlap_global_off
22 Teuchos_Ordinal global_sub_dim = 0;
24 assert( overlap_first_local_ele_off );
25 assert( overalap_local_sub_dim );
26 assert( overlap_global_off );
30 global_sub_dim = sub_dim_in >= 0 ? sub_dim_in : global_dim_in - first_ele_off_in;
36 local_off_in + local_sub_dim_in < first_ele_off_in + 1
38 first_ele_off_in + global_sub_dim < local_off_in + 1
47 *overlap_first_local_ele_off = first_ele_off_in <= local_off_in ? 0 : first_ele_off_in - local_off_in;
52 *overalap_local_sub_dim = (
53 MY_MIN(first_ele_off_in+global_sub_dim,local_off_in+local_sub_dim_in)
55 MY_MAX(first_ele_off_in,local_off_in)
67 *overlap_global_off = (
68 ( first_ele_off_in > local_off_in
70 : local_off_in - first_ele_off_in
76 *overlap_first_local_ele_off = -1;