diff options
author | Erik Schnetter <schnetter@gmail.com> | 2013-03-08 15:33:39 -0500 |
---|---|---|
committer | Erik Schnetter <schnetter@gmail.com> | 2013-03-08 15:33:39 -0500 |
commit | 235533f662769910df4d6cc32605cc317a3306a1 (patch) | |
tree | abda0de249832f6f872568412639c7171a5ce5e8 /Carpet/CarpetIOScalar | |
parent | 45077d797fb6e86e2b172156c899ee3be6f97424 (diff) |
Replace Cactus complex number type with C/C++ complex numbers
Map CCTK_COMPLEX to "double complex" in C, and "complex<double>" in
C++. (It is already mapped to "double complex" in Fortran.)
Update type definitions.
Re-implement Cactus complex number math functions by calling the
respective C functions.
Update thorn that access real and imaginary parts of complex numbers
to use standard-conforming methods instead.
Diffstat (limited to 'Carpet/CarpetIOScalar')
-rw-r--r-- | Carpet/CarpetIOScalar/src/ioscalar.cc | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/Carpet/CarpetIOScalar/src/ioscalar.cc b/Carpet/CarpetIOScalar/src/ioscalar.cc index 6dbb9eaae..1cd0ee102 100644 --- a/Carpet/CarpetIOScalar/src/ioscalar.cc +++ b/Carpet/CarpetIOScalar/src/ioscalar.cc @@ -447,11 +447,7 @@ namespace CarpetIOScalar { int const handle = ireduction->handle; - union { -#define TYPECASE(N,T) T var_##T; -#include "typecase.hh" -#undef TYPECASE - } result; + char result[100]; // assuming no type is larger int const firstvar = one_file_per_group ? CCTK_FirstVarIndexI(group) : n; @@ -461,14 +457,14 @@ namespace CarpetIOScalar { for (int n=firstvar; n<firstvar+numvars; ++n) { int const ierr - = CCTK_Reduce (cctkGH, 0, handle, 1, vartype, &result, 1, n); + = CCTK_Reduce (cctkGH, 0, handle, 1, vartype, result, 1, n); if (ierr) { char * const fullname = CCTK_FullName (n); CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, "Error during reduction for variable \"%s\"", fullname); free (fullname); - memset (&result, 0, sizeof result); + memset (result, 0, sizeof result); } if (CCTK_MyProc(cctkGH)==0) { @@ -477,7 +473,7 @@ namespace CarpetIOScalar { switch (specific_cactus_type(vartype)) { #define TYPECASE(N,T) \ case N: \ - file << result.var_##T; \ + file << *(T const*)result; \ break; #include "typecase.hh" #undef TYPECASE |