aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetIOBasic
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@gmail.com>2013-03-08 15:33:39 -0500
committerErik Schnetter <schnetter@gmail.com>2013-03-08 15:33:39 -0500
commit235533f662769910df4d6cc32605cc317a3306a1 (patch)
treeabda0de249832f6f872568412639c7171a5ce5e8 /Carpet/CarpetIOBasic
parent45077d797fb6e86e2b172156c899ee3be6f97424 (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/CarpetIOBasic')
-rw-r--r--Carpet/CarpetIOBasic/src/iobasic.cc10
1 files changed, 3 insertions, 7 deletions
diff --git a/Carpet/CarpetIOBasic/src/iobasic.cc b/Carpet/CarpetIOBasic/src/iobasic.cc
index 28abd6454..f8366a811 100644
--- a/Carpet/CarpetIOBasic/src/iobasic.cc
+++ b/Carpet/CarpetIOBasic/src/iobasic.cc
@@ -482,14 +482,10 @@ namespace CarpetIOBasic {
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 than this
int const ierr
- = CCTK_Reduce (cctkGH, 0, handle, 1, vartype, &result, 1, n);
+ = CCTK_Reduce (cctkGH, 0, handle, 1, vartype, result, 1, n);
assert (not ierr);
if (CCTK_MyProc(cctkGH) == 0) {
@@ -500,7 +496,7 @@ namespace CarpetIOBasic {
#define TYPECASE(N,T) \
case N: \
{ \
- T const val = result.var_##T; \
+ T const& val = *(T const*)result; \
if (not isint) { \
if (UseScientificNotation (val)) { \
cout << scientific << setprecision(real_prec_sci); \