diff options
Diffstat (limited to 'src/ReductionNorm3.c')
-rw-r--r-- | src/ReductionNorm3.c | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/src/ReductionNorm3.c b/src/ReductionNorm3.c index 261b04c..d27b674 100644 --- a/src/ReductionNorm3.c +++ b/src/ReductionNorm3.c @@ -1266,6 +1266,8 @@ static int ReductionL3 (int N_dims, int operator_handle, } } + num_points--; + /* store the number of points in the paramater table */ if ( Util_TableQueryNKeys(param_table_handle) != 0) { @@ -1273,6 +1275,82 @@ static int ReductionL3 (int N_dims, int operator_handle, ierr = Util_TableSetInt(param_table_handle, 3,"mpi_operation"); ierr = Util_TableSetInt(param_table_handle, 0,"perform_division"); } + else + { + for (i = 0; i< M_output_numbers; i++) + { + switch (output_number_type_codes[i]) + { + /* out values type switches*/ + case CCTK_VARIABLE_CHAR: + *( (CCTK_CHAR *) output_numbers[i]) = *( (CCTK_CHAR *) output_numbers[i]) / num_points; + break; + case CCTK_VARIABLE_INT: + *( (CCTK_INT *) output_numbers[i]) = *( (CCTK_INT *) output_numbers[i]) / num_points; + break; + #ifdef CCTK_INT1 + case CCTK_VARIABLE_INT1: + *( (CCTK_INT1 *) output_numbers[i]) = *( (CCTK_INT1 *) output_numbers[i]) / num_points; + break; + #endif + #ifdef CCTK_INT2 + case CCTK_VARIABLE_INT2: + *( (CCTK_INT2 *) output_numbers[i]) = *( (CCTK_INT2 *) output_numbers[i]) / num_points; + break; + #endif + #ifdef CCTK_INT4 + case CCTK_VARIABLE_INT4: + *( (CCTK_INT4 *) output_numbers[i]) = *( (CCTK_INT4 *) output_numbers[i]) / num_points; + break; + #endif + #ifdef CCTK_INT8 + case CCTK_VARIABLE_INT8: + *( (CCTK_INT8 *) output_numbers[i]) = *( (CCTK_INT8 *) output_numbers[i]) / num_points; + break; + #endif + case CCTK_VARIABLE_REAL: + *( (CCTK_REAL *) output_numbers[i]) = *( (CCTK_REAL *) output_numbers[i]) / num_points; + break; + #ifdef CCTK_REAL4 + case CCTK_VARIABLE_REAL4: + *( (CCTK_REAL4 *) output_numbers[i]) = *( (CCTK_REAL4 *) output_numbers[i]) / num_points; + break; + #endif + #ifdef CCTK_REAL8 + case CCTK_VARIABLE_REAL8: + *( (CCTK_REAL8 *) output_numbers[i]) = *( (CCTK_REAL8 *) output_numbers[i]) / num_points; + break; + #endif + #ifdef CCTK_REAL16 + case CCTK_VARIABLE_REAL6: + *( (CCTK_REAL16 *) output_numbers[i]) = *( (CCTK_REAL16 *) output_numbers[i]) / num_points; + break; + #endif + case CCTK_VARIABLE_COMPLEX: + (*( (CCTK_COMPLEX *) output_numbers[i])).Re = (*( (CCTK_COMPLEX *) output_numbers[i])).Re / num_points; + (*( (CCTK_COMPLEX *) output_numbers[i])).Im = (*( (CCTK_COMPLEX *) output_numbers[i])).Im / num_points; + break; + #ifdef CCTK_COMPLEX8 + case CCTK_VARIABLE_COMPLEX8: + (*( (CCTK_COMPLEX8 *) output_numbers[i])).Re = (*( (CCTK_COMPLEX8 *) output_numbers[i])).Re / num_points; + (*( (CCTK_COMPLEX8 *) output_numbers[i])).Im = (*( (CCTK_COMPLEX8 *) output_numbers[i])).Im / num_points; + break; + #endif + #ifdef CCTK_COMPLEX16 + case CCTK_VARIABLE_COMPLEX16: + (*( (CCTK_COMPLEX16 *) output_numbers[i])).Re = (*( (CCTK_COMPLEX16 *) output_numbers[i])).Re / num_points; + (*( (CCTK_COMPLEX16 *) output_numbers[i])).Im = (*( (CCTK_COMPLEX16 *) output_numbers[i])).Im / num_points; + break; + #endif + #ifdef CCTK_COMPLEX32 + case CCTK_VARIABLE_COMPLEX32: + (*( (CCTK_COMPLEX32 *) output_numbers[i])).Re = (*( (CCTK_COMPLEX32 *) output_numbers[i])).Re / num_points; + (*( (CCTK_COMPLEX32 *) output_numbers[i])).Im = (*( (CCTK_COMPLEX32 *) output_numbers[i])).Im / num_points; + break; + #endif + } + } + } /* free memory */ free (iters_per_dim); |