diff options
author | jthorn <jthorn@df1f8a13-aa1d-4dd4-9681-27ded5b42416> | 2002-06-02 19:12:52 +0000 |
---|---|---|
committer | jthorn <jthorn@df1f8a13-aa1d-4dd4-9681-27ded5b42416> | 2002-06-02 19:12:52 +0000 |
commit | 93e12888279211256c81586fd9392686b49668e2 (patch) | |
tree | be6d4741c7fb5cbec89edd7e30cfdaf9d41a2861 /src | |
parent | 45bae10912dddd6637783e4f4e9777f0865723c6 (diff) |
three changes in this checkin:
* change wording in error messages to refer to CCTK_InterpLocalUniform(),
not InterpLocalUniform()
* fix a couple of bugs where we tried to pass a CCTK_INT to a %d format
in CCTK_VWarn -- CCTK_INT may be a short/long rather than an int, so
this checkin changes the code to explicitly cast to int
* NULL pointers in input_arrays[] used to cause a core dump;
this checkin changes the code so they now cause that interpolation
to be skipped (this is a useful feature IMHO)
git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/LocalInterp/trunk@60 df1f8a13-aa1d-4dd4-9681-27ded5b42416
Diffstat (limited to 'src')
-rw-r--r-- | src/GeneralizedPolynomial-Uniform/template.c | 131 |
1 files changed, 82 insertions, 49 deletions
diff --git a/src/GeneralizedPolynomial-Uniform/template.c b/src/GeneralizedPolynomial-Uniform/template.c index ff25149..c95f117 100644 --- a/src/GeneralizedPolynomial-Uniform/template.c +++ b/src/GeneralizedPolynomial-Uniform/template.c @@ -327,6 +327,9 @@ int FUNCTION_NAME(/***** coordinate system *****/ * compute coefficients for all derivatives which are wanted * for each output array * { + * if ( (input_arrays[in] == NULL) + * || (output_arrays[out] == NULL) ) + * then continue; // skip this interpolation? * ***decode*** the input/output array datatypes * to determine whether they're real or complex * (they must both be the same in this regard), @@ -551,9 +554,14 @@ int out; case 33: want_dzz = true; break; #endif default: -CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, - "Generalized interpolation operation_code %d not supported!", - operation_codes[out]); /*NOTREACHED*/ + CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, +"\n" +" CCTK_InterpLocalUniform(): generalized interpolation operation_code %d\n" +" is not supported!\n" +" (0-origin) output #out=%d" + , + (int) operation_codes[out], + out); /*NOTREACHED*/ return UTIL_ERROR_BAD_INPUT; /*** ERROR RETURN ***/ } } @@ -694,7 +702,10 @@ int pt; default: CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, - "interp-coords datatype %d not supported!", +"\n" +" CCTK_InterpLocalUniform(): interpolation coordinates datatype %d\n" +" is not supported!" + , interp_coords_type_code); /*NOTREACHED*/ return UTIL_ERROR_BAD_INPUT; /*** ERROR RETURN ***/ @@ -901,8 +912,11 @@ int pt; for (out = 0 ; out < N_output_arrays ; ++out) { const int in = operand_indices[out]; - const int input_offset = input_array_offsets[in]; - const int sub_temp = input_offset + center_sub; + if ((input_arrays[in] == NULL) || (output_arrays[out] == NULL)) + then continue; /* skip this interpolation? */ + { + const int input_center_sub = input_array_offsets[in] + + center_sub; /* * ***decode*** the input/output array datatypes @@ -918,11 +932,11 @@ int pt; if (N_input_parts != N_output_parts) then { CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, - "\n" - " can't do real input --> complex output\n" - " or complex input --> real output interpolation!\n" - " (0-origin) input #in=%d datatype = %d\n" - " (0-origin) output #out=%d datatype = %d\n" +"\n" +" CCTK_InterpLocalUniform(): can't do real input --> complex output or\n" +" complex input --> real output interpolation!\n" +" (0-origin) input #in=%d datatype = %d\n" +" (0-origin) output #out=%d datatype = %d\n" , in, (int) input_array_type_codes[in], out, (int) output_array_type_codes[out]); /*NOTREACHED*/ @@ -951,11 +965,14 @@ case CCTK_VARIABLE_REAL: = (const CCTK_REAL *) input_array_ptr; #undef DATA #if (N_DIMS == 1) - #define DATA(mi) input_array_ptr_real[sub_temp + SUB1(mi)] + #define DATA(mi) \ + input_array_ptr_real[input_center_sub + SUB1(mi)] #elif (N_DIMS == 2) - #define DATA(mi,mj) input_array_ptr_real[sub_temp + SUB2(mi,mj)] + #define DATA(mi,mj) \ + input_array_ptr_real[input_center_sub + SUB2(mi,mj)] #elif (N_DIMS == 3) - #define DATA(mi,mj,mk) input_array_ptr_real[sub_temp + SUB3(mi,mj,mk)] + #define DATA(mi,mj,mk) \ + input_array_ptr_real[input_center_sub + SUB3(mi,mj,mk)] #else #error "N_DIMS must be 1, 2, or 3!" #endif @@ -970,11 +987,14 @@ case CCTK_VARIABLE_REAL4: = (const CCTK_REAL4 *) input_array_ptr; #undef DATA #if (N_DIMS == 1) - #define DATA(mi) input_array_ptr_real4[sub_temp + SUB1(mi)] + #define DATA(mi) \ + input_array_ptr_real4[input_center_sub + SUB1(mi)] #elif (N_DIMS == 2) - #define DATA(mi,mj) input_array_ptr_real4[sub_temp + SUB2(mi,mj)] + #define DATA(mi,mj) \ + input_array_ptr_real4[input_center_sub + SUB2(mi,mj)] #elif (N_DIMS == 3) - #define DATA(mi,mj,mk) input_array_ptr_real4[sub_temp + SUB3(mi,mj,mk)] + #define DATA(mi,mj,mk) \ + input_array_ptr_real4[input_center_sub + SUB3(mi,mj,mk)] #else #error "N_DIMS must be 1, 2, or 3!" #endif @@ -990,11 +1010,14 @@ case CCTK_VARIABLE_REAL8: = (const CCTK_REAL8 *) input_array_ptr; #undef DATA #if (N_DIMS == 1) - #define DATA(mi) input_array_ptr_real8[sub_temp + SUB1(mi)] + #define DATA(mi) \ + input_array_ptr_real8[input_center_sub + SUB1(mi)] #elif (N_DIMS == 2) - #define DATA(mi,mj) input_array_ptr_real8[sub_temp + SUB2(mi,mj)] + #define DATA(mi,mj) \ + input_array_ptr_real8[input_center_sub + SUB2(mi,mj)] #elif (N_DIMS == 3) - #define DATA(mi,mj,mk) input_array_ptr_real8[sub_temp + SUB3(mi,mj,mk)] + #define DATA(mi,mj,mk) \ + input_array_ptr_real8[input_center_sub + SUB3(mi,mj,mk)] #else #error "N_DIMS must be 1, 2, or 3!" #endif @@ -1012,11 +1035,14 @@ case CCTK_VARIABLE_REAL16: = (const CCTK_REAL16 *) input_array_ptr; #undef DATA #if (N_DIMS == 1) - #define DATA(mi) input_array_ptr_real16[sub_temp + SUB1(mi)] + #define DATA(mi) \ + input_array_ptr_real16[input_center_sub + SUB1(mi)] #elif (N_DIMS == 2) - #define DATA(mi,mj) input_array_ptr_real16[sub_temp + SUB2(mi,mj)] + #define DATA(mi,mj) \ + input_array_ptr_real16[input_center_sub + SUB2(mi,mj)] #elif (N_DIMS == 3) - #define DATA(mi,mj,mk) input_array_ptr_real16[sub_temp + SUB3(mi,mj,mk)] + #define DATA(mi,mj,mk) \ + input_array_ptr_real16[input_center_sub + SUB3(mi,mj,mk)] #else #error "N_DIMS must be 1, 2, or 3!" #endif @@ -1032,13 +1058,13 @@ case CCTK_VARIABLE_COMPLEX: #undef DATA #if (N_DIMS == 1) #define DATA(mi) \ - input_array_ptr_complex[sub_temp + SUB1(mi)][part] + input_array_ptr_complex[input_center_sub + SUB1(mi)][part] #elif (N_DIMS == 2) #define DATA(mi,mj) \ - input_array_ptr_complex[sub_temp + SUB2(mi,mj)][part] + input_array_ptr_complex[input_center_sub + SUB2(mi,mj)][part] #elif (N_DIMS == 3) #define DATA(mi,mj,mk) \ - input_array_ptr_complex[sub_temp + SUB3(mi,mj,mk)][part] + input_array_ptr_complex[input_center_sub + SUB3(mi,mj,mk)][part] #else #error "N_DIMS must be 1, 2, or 3!" #endif @@ -1054,13 +1080,13 @@ case CCTK_VARIABLE_COMPLEX8: #undef DATA #if (N_DIMS == 1) #define DATA(mi) \ - input_array_ptr_complex8[sub_temp + SUB1(mi)][part] + input_array_ptr_complex8[input_center_sub + SUB1(mi)][part] #elif (N_DIMS == 2) #define DATA(mi,mj) \ - input_array_ptr_complex8[sub_temp + SUB2(mi,mj)][part] + input_array_ptr_complex8[input_center_sub + SUB2(mi,mj)][part] #elif (N_DIMS == 3) #define DATA(mi,mj,mk) \ - input_array_ptr_complex8[sub_temp + SUB3(mi,mj,mk)][part] + input_array_ptr_complex8[input_center_sub + SUB3(mi,mj,mk)][part] #else #error "N_DIMS must be 1, 2, or 3!" #endif @@ -1077,13 +1103,13 @@ case CCTK_VARIABLE_COMPLEX16: #undef DATA #if (N_DIMS == 1) #define DATA(mi) \ - input_array_ptr_complex16[sub_temp + SUB1(mi)][part] + input_array_ptr_complex16[input_center_sub + SUB1(mi)][part] #elif (N_DIMS == 2) #define DATA(mi,mj) \ - input_array_ptr_complex16[sub_temp + SUB2(mi,mj)][part] + input_array_ptr_complex16[input_center_sub + SUB2(mi,mj)][part] #elif (N_DIMS == 3) #define DATA(mi,mj,mk) \ - input_array_ptr_complex16[sub_temp + SUB3(mi,mj,mk)][part] + input_array_ptr_complex16[input_center_sub + SUB3(mi,mj,mk)][part] #else #error "N_DIMS must be 1, 2, or 3!" #endif @@ -1100,13 +1126,13 @@ case CCTK_VARIABLE_COMPLEX32: #undef DATA #if (N_DIMS == 1) #define DATA(mi) \ - input_array_ptr_complex32[sub_temp + SUB1(mi)][part] + input_array_ptr_complex32[input_center_sub + SUB1(mi)][part] #elif (N_DIMS == 2) #define DATA(mi,mj) \ - input_array_ptr_complex32[sub_temp + SUB2(mi,mj)][part] + input_array_ptr_complex32[input_center_sub + SUB2(mi,mj)][part] #elif (N_DIMS == 3) #define DATA(mi,mj,mk) \ - input_array_ptr_complex32[sub_temp + SUB3(mi,mj,mk)][part] + input_array_ptr_complex32[input_center_sub + SUB3(mi,mj,mk)][part] #else #error "N_DIMS must be 1, 2, or 3!" #endif @@ -1117,11 +1143,11 @@ case CCTK_VARIABLE_COMPLEX32: default: CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, - "\n" - " input datatype %d not supported!\n", - " (0-origin) input #in=%d" +"\n" +" CCTK_InterpLocalUniform(): input datatype %d not supported!\n" +" (0-origin) input #in=%d" , - input_array_type_codes[in], + (int) input_array_type_codes[in], in); /*NOTREACHED*/ return UTIL_ERROR_BAD_INPUT; /*** ERROR RETURN ***/ /* end of switch */ @@ -1203,11 +1229,12 @@ if (output_arrays[out] != NULL) #endif default: CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, - "\n" - " Generalized interpolation operation_code %d not supported!\n" - " (0-origin) output #out=%d" +"\n" +" CCTK_InterpLocalUniform(): generalized interpolation operation_code %d\n" +" is not supported!\n" +" (0-origin) output #out=%d" , - operation_codes[out], + (int) operation_codes[out], out); /*NOTREACHED*/ return UTIL_ERROR_BAD_INPUT; /*** ERROR RETURN ***/ /* end of switch (operation_codes[out]) */ @@ -1298,11 +1325,11 @@ CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, default: CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, - "\n" - " output datatype %d not supported!\n" - " (0-origin) output #out=%d" +"\n" +" CCTK_InterpLocalUniform(): output datatype %d not supported!\n" +" (0-origin) output #out=%d" , - output_array_type_codes[out], + (int) output_array_type_codes[out], out); /*NOTREACHED*/ return UTIL_ERROR_BAD_INPUT; /*** ERROR RETURN ***/ /* end of switch (output type code) */ @@ -1417,8 +1444,13 @@ if ((Jacobian_info != NULL) && (Jacobian_info->Jacobian_pointer[out] != NULL)) #endif default: CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, - "Generalized interpolation operation_code %d not supported!", - operation_codes[out]); /*NOTREACHED*/ +"\n" +" CCTK_InterpLocalUniform(): generalized interpolation operation_code %d\n" +" is not supported!\n" +" (0-origin) output #out=%d" + , + (int) operation_codes[out], + out); /*NOTREACHED*/ return UTIL_ERROR_BAD_INPUT; /*** ERROR RETURN ***/ /* end of switch(operation_codes[out])*/ } @@ -1428,6 +1460,7 @@ if ((Jacobian_info != NULL) && (Jacobian_info->Jacobian_pointer[out] != NULL)) /* end of for (part = ...) loop */ } } + } /* end of for (out = ...) loop */ } } |