aboutsummaryrefslogtreecommitdiff
path: root/src/local_reductions.h
diff options
context:
space:
mode:
authoryye00 <yye00@7daa882c-dc44-4453-834e-278d26b18e6a>2004-10-26 23:36:09 +0000
committeryye00 <yye00@7daa882c-dc44-4453-834e-278d26b18e6a>2004-10-26 23:36:09 +0000
commit0580b166b649e4f697247b90fb2b92ae7e291610 (patch)
tree1549f683ac3898e55c57d459ce545897d5716b90 /src/local_reductions.h
parent8d180b856c65d7c40c6e8867687779f3be7350c3 (diff)
new implementation of LocalReduction that does not cause compilers to crash, changed the cascaded switch statements to function calls
git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/LocalReduce/trunk@48 7daa882c-dc44-4453-834e-278d26b18e6a
Diffstat (limited to 'src/local_reductions.h')
-rw-r--r--src/local_reductions.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/local_reductions.h b/src/local_reductions.h
index 6f073b2..3e3eba8 100644
--- a/src/local_reductions.h
+++ b/src/local_reductions.h
@@ -48,7 +48,7 @@ extern "C" {
} \
sum_indices += actual_indices[k]*product; \
} \
- inval = (out_type) typed_vdata[sum_indices]; \
+ REDUCTION_PREOP_CAST(inval, typed_vdata,sum_indices, out_type); \
REDUCTION_OPERATION(*outval,inval); \
num_points++; \
iter++; \
@@ -103,7 +103,7 @@ extern "C" {
CCTK_WARN(1,"offsets and strides access unallocated memory"); \
return -1; \
} \
- inval = (out_type) typed_vdata[sum_indices]; \
+ REDUCTION_PREOP_CAST(inval, typed_vdata,sum_indices, out_type); \
REDUCTION_OPERATION(*outval,inval); \
num_points++; \
iter++; \
@@ -145,18 +145,20 @@ extern "C" {
} \
EXTRA_STEP(*outval, (out_type)num_points) \
}
-
+
int LocalReduce_Mean (REDUCTION_LOCAL_ARRAY_OPERATOR_REGISTER_ARGLIST);
-int LocalReduce_Count (REDUCTION_LOCAL_ARRAY_OPERATOR_REGISTER_ARGLIST);
int LocalReduce_Max (REDUCTION_LOCAL_ARRAY_OPERATOR_REGISTER_ARGLIST);
int LocalReduce_Min (REDUCTION_LOCAL_ARRAY_OPERATOR_REGISTER_ARGLIST);
+int LocalReduce_Count (REDUCTION_LOCAL_ARRAY_OPERATOR_REGISTER_ARGLIST);
+int LocalReduce_Sum (REDUCTION_LOCAL_ARRAY_OPERATOR_REGISTER_ARGLIST);
+
int LocalReduce_L1 (REDUCTION_LOCAL_ARRAY_OPERATOR_REGISTER_ARGLIST);
int LocalReduce_L2 (REDUCTION_LOCAL_ARRAY_OPERATOR_REGISTER_ARGLIST);
int LocalReduce_L3 (REDUCTION_LOCAL_ARRAY_OPERATOR_REGISTER_ARGLIST);
int LocalReduce_L4 (REDUCTION_LOCAL_ARRAY_OPERATOR_REGISTER_ARGLIST);
int LocalReduce_LInf (REDUCTION_LOCAL_ARRAY_OPERATOR_REGISTER_ARGLIST);
-int LocalReduce_Sum (REDUCTION_LOCAL_ARRAY_OPERATOR_REGISTER_ARGLIST);
+
typedef int (*reduction_fn_t) (int N_dims, int operator_handle,
int param_table_handle, int N_input_arrays,
@@ -176,9 +178,13 @@ int LocalReduce_Reduce (int N_dims, int operator_handle,
const CCTK_INT output_number_type_codes[],
void * const output_numbers[],reduction_fn_t reduction_fn);
+
+
#ifdef __cplusplus
}
#endif
+
+
#endif