diff options
author | svnadmin <svnadmin@f88db872-0e4f-0410-b76b-b9085cfa78c5> | 2008-06-26 13:51:26 +0000 |
---|---|---|
committer | svnadmin <svnadmin@f88db872-0e4f-0410-b76b-b9085cfa78c5> | 2008-06-26 13:51:26 +0000 |
commit | 9716af1598ddfd2ab8ee7198b35cca1df312c4fd (patch) | |
tree | 5f903e795434362f0360ee2e3e65a27e6c6601c3 /src/jtutil/miscfp.cc | |
parent | 8cb0df53b3d5d615624b9bffdcc11cf13905cfc0 (diff) |
Make "Erik" branch the default trunk for AHFinderDirect.
git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinAnalysis/AHFinderDirect/trunk@1526 f88db872-0e4f-0410-b76b-b9085cfa78c5
Diffstat (limited to 'src/jtutil/miscfp.cc')
-rw-r--r-- | src/jtutil/miscfp.cc | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/src/jtutil/miscfp.cc b/src/jtutil/miscfp.cc index 519f7e0..87a0272 100644 --- a/src/jtutil/miscfp.cc +++ b/src/jtutil/miscfp.cc @@ -23,12 +23,6 @@ #include "stdc.h" #include "util.hh" -// everything in this file is inside these namespaces -namespace AHFinderDirect - { -namespace jtutil - { - //****************************************************************************** //****************************************************************************** //****************************************************************************** @@ -37,12 +31,15 @@ namespace jtutil // This function computes the floating point "signum" function (as in APL), // signum(x) = -1.0, 0.0, or +1.0, according to the sign of x. // +namespace jtutil + { double signum(double x) { if (x == 0.0) then return 0.0; else return (x > 0.0) ? 1.0 : -1.0; } + } // namespace jtutil:: //****************************************************************************** @@ -61,10 +58,13 @@ if (x == 0.0) // unwarranted IEEE exceptions if any of |x|, |y|, or |z| is close to // the overflow and/or underflow threshold. // +namespace jtutil + { double hypot3(double x, double y, double z) { return sqrt(x*x + y*y + z*z); } + } // namespace jtutil:: //****************************************************************************** @@ -81,11 +81,14 @@ return sqrt(x*x + y*y + z*z); // some real $R$, i.e. it returns the angle between the positive $x$ axis and // the line joining the origin and the point $(x,y)$. // +namespace jtutil + { double arctan_xy(double x, double y) { // note reversed argument order (y,x) in std::atan2() function return ((x == 0.0) && (y == 0.0)) ? 0.0 : atan2(y,x); } + } // namespace jtutil:: //****************************************************************************** @@ -93,6 +96,8 @@ return ((x == 0.0) && (y == 0.0)) ? 0.0 : atan2(y,x); // This function reduces x modulo xmod to be (fuzzily) in the range // [xmin, xmax] , or does an error_exit() if no such value exists. // +namespace jtutil + { double modulo_reduce(double x, double xmod, double xmin, double xmax) { double xx = x; @@ -108,24 +113,27 @@ double xx = x; } if (! (fuzzy<double>::GE(xx, xmin) && fuzzy<double>::LE(xx, xmax)) ) - then error_exit(ERROR_EXIT, + then jtutil::error_exit(ERROR_EXIT, "***** modulo_reduce(): no modulo value is fuzzily within specified range!\n" " x = %g xmod = %g\n" " [xmin,xmax] = [%g,%g]\n" " ==> xx = %g\n" , - x, xmod, - xmin, xmax, - xx); /*NOTREACHED*/ + x, xmod, + xmin, xmax, + xx); /*NOTREACHED*/ return xx; } + } // namespace jtutil:: //****************************************************************************** // // This function sets a C-style array to all zeros. // +namespace jtutil + { template <typename fp_t> void zero_C_array(int N, fp_t array[]) { @@ -134,6 +142,7 @@ template <typename fp_t> array[i] = 0; } } + } // namespace jtutil:: //****************************************************************************** //****************************************************************************** @@ -143,11 +152,7 @@ template <typename fp_t> // ***** template instantiations ***** // +namespace jtutil + { template void zero_C_array<CCTK_REAL>(int, CCTK_REAL[]); - -//****************************************************************************** -//****************************************************************************** -//****************************************************************************** - - } // namespace jtutil - } // namespace AHFinderDirect + } // namespace jtutil:: |