diff options
author | Erik Schnetter <schnetter@gmail.com> | 2013-03-25 16:53:48 -0400 |
---|---|---|
committer | Erik Schnetter <schnetter@gmail.com> | 2013-03-25 16:53:48 -0400 |
commit | afd93dce86328a3489608b729894bb34add6cb90 (patch) | |
tree | 36af56311ce273fcb01cbbb82768a3a6d3708adb /Carpet/CarpetIOBasic | |
parent | b2e07dd1f4a8a7ee0f82fc0453548cb6fa3eb1ac (diff) |
CarpetIO*: Output complex numbers as pair of real numbers
Don't use the (real,imag) notation that C++ would use by default.
Diffstat (limited to 'Carpet/CarpetIOBasic')
-rw-r--r-- | Carpet/CarpetIOBasic/src/iobasic.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Carpet/CarpetIOBasic/src/iobasic.cc b/Carpet/CarpetIOBasic/src/iobasic.cc index f8366a811..5dd668091 100644 --- a/Carpet/CarpetIOBasic/src/iobasic.cc +++ b/Carpet/CarpetIOBasic/src/iobasic.cc @@ -450,6 +450,7 @@ namespace CarpetIOBasic { assert (vardataptr); switch (specific_cactus_type(vartype)) { +#define CARPET_NO_COMPLEX #define TYPECASE(N,T) \ case N: \ { \ @@ -466,6 +467,25 @@ namespace CarpetIOBasic { break; #include "typecase.hh" #undef TYPECASE +#undef CARPET_NO_COMPLEX +#define CARPET_COMPLEX +#define TYPECASE(N,T) \ + case N: \ + { \ + T const val = * static_cast <T const *> (vardataptr); \ + if (not isint) { \ + if (UseScientificNotation (val)) { \ + cout << scientific << setprecision(real_prec_sci); \ + } else { \ + cout << fixed << setprecision(real_prec); \ + } \ + } \ + cout << real(val) << " " << imag(val); \ + } \ + break; +#include "typecase.hh" +#undef TYPECASE +#undef CARPET_COMPLEX default: UnsupportedVarType (n); } |