diff options
-rw-r--r-- | Carpet/Carpet/src/Storage.cc | 92 | ||||
-rw-r--r-- | Carpet/CarpetLib/src/data.cc | 9 |
2 files changed, 93 insertions, 8 deletions
diff --git a/Carpet/Carpet/src/Storage.cc b/Carpet/Carpet/src/Storage.cc index bbe5bbaee..8fcecab63 100644 --- a/Carpet/Carpet/src/Storage.cc +++ b/Carpet/Carpet/src/Storage.cc @@ -10,7 +10,7 @@ #include "carpet.hh" extern "C" { - static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/Storage.cc,v 1.11 2002/10/24 10:39:39 schnetter Exp $"; + static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/Storage.cc,v 1.12 2003/01/03 13:19:58 schnetter Exp $"; CCTK_FILEVERSION(Carpet_Carpet_Storage_cc); } @@ -22,6 +22,93 @@ namespace Carpet { + static void CheckVariableType (cGH* cgh, const int group) + { + // Find out which types correspond to the default types +#if CCTK_INTEGER_PRECISION_1 +# define CCTK_DEFAULT_INTEGER_TYPE CCTK_VARIABLE_INT1 +#elif CCTK_INTEGER_PRECISION_2 +# define CCTK_DEFAULT_INTEGER_TYPE CCTK_VARIABLE_INT2 +#elif CCTK_INTEGER_PRECISION_4 +# define CCTK_DEFAULT_INTEGER_TYPE CCTK_VARIABLE_INT4 +#elif CCTK_INTEGER_PRECISION_8 +# define CCTK_DEFAULT_INTEGER_TYPE CCTK_VARIABLE_INT8 +#else "Unsupported default integer type" +# error +#endif + +#if CCTK_REAL_PRECISION_4 +# define CCTK_DEFAULT_REAL_TYPE CCTK_VARIABLE_REAL4 +# define CCTK_DEFAULT_COMPLEX_TYPE CCTK_VARIABLE_COMPLEX8 +#elif CCTK_REAL_PRECISION_8 +# define CCTK_DEFAULT_REAL_TYPE CCTK_VARIABLE_REAL8 +# define CCTK_DEFAULT_COMPLEX_TYPE CCTK_VARIABLE_COMPLEX16 +#elif CCTK_REAL_PRECISION_16 +# define CCTK_DEFAULT_REAL_TYPE CCTK_VARIABLE_REAL16 +# define CCTK_DEFAULT_COMPLEX_TYPE CCTK_VARIABLE_COMPLEX32 +#else +# error "Unsupported default real type" +#endif + + const int var0 = CCTK_FirstVarIndexI(group); + const int type0 = CCTK_VarTypeI(var0); + int type1; + switch (type0) { + case CCTK_VARIABLE_INT: + type1 = CCTK_DEFAULT_INTEGER_TYPE; + break; + case CCTK_VARIABLE_REAL: + type1 = CCTK_DEFAULT_REAL_TYPE; + break; + case CCTK_VARIABLE_COMPLEX: + type1 = CCTK_DEFAULT_COMPLEX_TYPE; + break; + default: + type1 = type0; + } + switch (type1) { + + case CCTK_VARIABLE_REAL8: + // This type is supported. Do nothing. + break; + + case CCTK_VARIABLE_REAL4: + case CCTK_VARIABLE_REAL16: + case CCTK_VARIABLE_COMPLEX8: + case CCTK_VARIABLE_COMPLEX16: + case CCTK_VARIABLE_COMPLEX32: + // This type is not supported, but could be. Complain. + { + char * groupname = CCTK_GroupName(group); + CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, + "There are no transfer operators available for the Cactus variable type %s, which is used by the Cactus group \"%s\". This group will not be prolongated nor be restricted.", + CCTK_VarTypeName(type0), groupname); + free (groupname); + break; + } + + case CCTK_VARIABLE_BYTE: + case CCTK_VARIABLE_INT1: + case CCTK_VARIABLE_INT2: + case CCTK_VARIABLE_INT4: + case CCTK_VARIABLE_INT8: + // This type is not supported, and cannot be. Complain. + { + char * groupname = CCTK_GroupName(group); + CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, + "It does not make sense to automatically transfer the Cactus variable type %s, which is used by the Cactus group \"%s\". This group will not be prolongated nor be restricted.", + CCTK_VarTypeName(type0), groupname); + free (groupname); + break; + } + + default: + assert (0); + } + } + + + int EnableGroupStorage (cGH* cgh, const char* groupname) { DECLARE_CCTK_PARAMETERS; @@ -44,6 +131,9 @@ namespace Carpet { return 1; } + // Check whether this group's variable type has transfer operators + CheckVariableType (cgh, group); + // There is a difference between the Cactus time levels and the // Carpet time levels. If there are n time levels, then the // Cactus time levels are numbered 0 ... n-1, with the current diff --git a/Carpet/CarpetLib/src/data.cc b/Carpet/CarpetLib/src/data.cc index 5d84d8a55..9f086fcb7 100644 --- a/Carpet/CarpetLib/src/data.cc +++ b/Carpet/CarpetLib/src/data.cc @@ -5,7 +5,7 @@ copyright : (C) 2000 by Erik Schnetter email : schnetter@astro.psu.edu - $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/data.cc,v 1.22 2002/12/31 13:29:07 schnetter Exp $ + $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/data.cc,v 1.23 2003/01/03 13:19:58 schnetter Exp $ ***************************************************************************/ @@ -225,13 +225,8 @@ void data<T,D> T Tdummy; CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, - "There is no interpolator available for variable type %s, dimension %d, spatial interpolation order %d, temporal interpolation order %d. The result will be set to -1 instead.", + "There is no interpolator available for variable type %s, dimension %d, spatial interpolation order %d, temporal interpolation order %d. The interpolation will not be done.", typestring(Tdummy), D, order_space, order_time); - - for (typename ibbox::iterator posi=box.begin(); posi!=box.end(); ++posi) { - const ivect& pos = *posi; - (*this)[pos] = -1; - } } |