aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetIOBasic
diff options
context:
space:
mode:
Diffstat (limited to 'Carpet/CarpetIOBasic')
-rw-r--r--Carpet/CarpetIOBasic/src/iobasic.cc43
1 files changed, 28 insertions, 15 deletions
diff --git a/Carpet/CarpetIOBasic/src/iobasic.cc b/Carpet/CarpetIOBasic/src/iobasic.cc
index 2c413e3c2..11c620604 100644
--- a/Carpet/CarpetIOBasic/src/iobasic.cc
+++ b/Carpet/CarpetIOBasic/src/iobasic.cc
@@ -65,7 +65,34 @@ namespace CarpetIOBasic {
void
ExamineVariable (int vindex, bool & isint, int & numcomps, bool & isscalar);
vector<string> ParseReductions (char const * credlist);
- template <typename T> bool UseScientificNotation (T const & x);
+
+
+
+ template <typename T>
+ bool
+ UseScientificNotation (T const & x)
+ {
+ return false; // default
+ }
+
+ template <>
+ bool
+ UseScientificNotation (CCTK_REAL const & x)
+ {
+ DECLARE_CCTK_PARAMETERS;
+
+ static_assert (abs(0.1) > 0, "Function abs has wrong signature");
+
+ CCTK_REAL const xa = abs (x);
+ return xa != 0 and (xa < real_min or xa >= real_max);
+ }
+
+ template <>
+ bool
+ UseScientificNotation (CCTK_COMPLEX const & x)
+ {
+ return UseScientificNotation(x.real()) or UseScientificNotation(x.imag());
+ }
@@ -730,18 +757,4 @@ namespace CarpetIOBasic {
}
}
-
-
- template <typename T>
- bool
- UseScientificNotation (T const & x)
- {
- DECLARE_CCTK_PARAMETERS;
-
- static_assert (good::abs(0.1) > 0, "Function abs has wrong signature");
-
- CCTK_REAL const xa = good::abs (x);
- return xa != 0 and (xa < real_min or xa >= real_max);
- }
-
} // namespace CarpetIOBasic