aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetIOBasic
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@gmail.com>2012-10-22 14:25:10 -0400
committerErik Schnetter <schnetter@gmail.com>2012-10-22 14:25:10 -0400
commit40b821811176d69f15942fc1a35bbd00cf6940a1 (patch)
treef8e30ae80a318f19d7b50ba9ff5fce724f1feaea /Carpet/CarpetIOBasic
parent2d5752398c5844a24f3146792b2e93510552c19e (diff)
Remove Carpet's mechanisms to deal with how to call isnan
Remove Carpet's mechanisms to deal with how to call isnan. Instead, expect isnan in std::, and rely on Cactus to correct things if this is not the case.
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