aboutsummaryrefslogtreecommitdiff
path: root/src/jtutil/miscfp.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/jtutil/miscfp.cc')
-rw-r--r--src/jtutil/miscfp.cc39
1 files changed, 17 insertions, 22 deletions
diff --git a/src/jtutil/miscfp.cc b/src/jtutil/miscfp.cc
index 87a0272..519f7e0 100644
--- a/src/jtutil/miscfp.cc
+++ b/src/jtutil/miscfp.cc
@@ -23,6 +23,12 @@
#include "stdc.h"
#include "util.hh"
+// everything in this file is inside these namespaces
+namespace AHFinderDirect
+ {
+namespace jtutil
+ {
+
//******************************************************************************
//******************************************************************************
//******************************************************************************
@@ -31,15 +37,12 @@
// 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::
//******************************************************************************
@@ -58,13 +61,10 @@ 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,14 +81,11 @@ 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::
//******************************************************************************
@@ -96,8 +93,6 @@ 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;
@@ -113,27 +108,24 @@ double xx = x;
}
if (! (fuzzy<double>::GE(xx, xmin) && fuzzy<double>::LE(xx, xmax)) )
- then jtutil::error_exit(ERROR_EXIT,
+ then 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[])
{
@@ -142,7 +134,6 @@ template <typename fp_t>
array[i] = 0;
}
}
- } // namespace jtutil::
//******************************************************************************
//******************************************************************************
@@ -152,7 +143,11 @@ template <typename fp_t>
// ***** template instantiations *****
//
-namespace jtutil
- {
template void zero_C_array<CCTK_REAL>(int, CCTK_REAL[]);
- } // namespace jtutil::
+
+//******************************************************************************
+//******************************************************************************
+//******************************************************************************
+
+ } // namespace jtutil
+ } // namespace AHFinderDirect