aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5>2005-02-01 14:58:53 +0000
committerjthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5>2005-02-01 14:58:53 +0000
commitcb95431b072f5519a083a59e878255c5bcab64d1 (patch)
treed36d7e7ee32fc44b5d288f244ae16ad086071fb5 /src
parent0026d529a6a0ccd030d9510858726bcd3e1e0d24 (diff)
fix a C++ namespaces bug found by Erik:
error_exit() was declared extern "C" --> it wasn't namespace-mangled --> it could conflict with a similar error_exit() in another thorn although this fix touches a *lot* of files, it's conceptually simple: * error_exit() is not extern "C" any more * everything in src/jtutil/ (which used to be in the jtutil:: namespace) is now in the AHFinderDirect::jtutil:: namespace --> all C++ code in this thorn is now inside the AHFinderDirect:: namespace git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinAnalysis/AHFinderDirect/trunk@1395 f88db872-0e4f-0410-b76b-b9085cfa78c5
Diffstat (limited to 'src')
-rw-r--r--src/CODESTYLE10
-rw-r--r--src/README6
-rw-r--r--src/driver/BH_diagnostics.cc2
-rw-r--r--src/driver/Newton.cc2
-rw-r--r--src/driver/aliased_functions.cc2
-rw-r--r--src/driver/announce.cc2
-rw-r--r--src/driver/find_horizons.cc2
-rw-r--r--src/driver/initial_guess.cc2
-rw-r--r--src/driver/io.cc2
-rw-r--r--src/driver/mask.cc2
-rw-r--r--src/driver/misc-driver.cc2
-rw-r--r--src/driver/setup.cc2
-rw-r--r--src/driver/spherical_surface.cc2
-rw-r--r--src/driver/state.cc2
-rw-r--r--src/elliptic/Jacobian.cc2
-rw-r--r--src/elliptic/dense_Jacobian.cc2
-rw-r--r--src/elliptic/row_sparse_Jacobian.cc2
-rw-r--r--src/gr/Schwarzschild_EF.cc2
-rw-r--r--src/gr/expansion.cc6
-rw-r--r--src/gr/expansion_Jacobian.cc2
-rw-r--r--src/include/stdc.h15
-rw-r--r--src/jtutil/README6
-rw-r--r--src/jtutil/array.cc67
-rw-r--r--src/jtutil/array.hh21
-rw-r--r--src/jtutil/cpm_map.cc27
-rw-r--r--src/jtutil/cpm_map.hh12
-rw-r--r--src/jtutil/error_exit.cc15
-rw-r--r--src/jtutil/fuzzy.cc33
-rw-r--r--src/jtutil/linear_map.cc36
-rw-r--r--src/jtutil/linear_map.hh12
-rw-r--r--src/jtutil/miscfp.cc39
-rw-r--r--src/jtutil/norm.cc25
-rw-r--r--src/jtutil/round.cc26
-rw-r--r--src/jtutil/test_array.cc2
-rw-r--r--src/jtutil/test_array2.cc2
-rw-r--r--src/jtutil/test_cpm_map.cc3
-rw-r--r--src/jtutil/test_error_exit.cc2
-rw-r--r--src/jtutil/test_fuzzy.cc3
-rw-r--r--src/jtutil/test_linear_map.cc3
-rw-r--r--src/jtutil/test_modulo.cc3
-rw-r--r--src/jtutil/test_norm.cc3
-rw-r--r--src/jtutil/test_round.cc2
-rw-r--r--src/jtutil/util.hh6
-rw-r--r--src/patch/coords.cc10
-rw-r--r--src/patch/fd_grid.cc2
-rw-r--r--src/patch/ghost_zone.cc2
-rw-r--r--src/patch/patch.cc2
-rw-r--r--src/patch/patch_info.cc2
-rw-r--r--src/patch/patch_interp.cc2
-rw-r--r--src/patch/patch_system.cc2
-rw-r--r--src/patch/test_coords.cc6
-rw-r--r--src/patch/test_coords2.cc6
-rw-r--r--src/patch/test_patch_system.cc2
53 files changed, 247 insertions, 208 deletions
diff --git a/src/CODESTYLE b/src/CODESTYLE
index 9164011..d2784bb 100644
--- a/src/CODESTYLE
+++ b/src/CODESTYLE
@@ -1,6 +1,6 @@
AHFinderDirect Code Style
=========================
-$Header: /usr/local/svn/cvs-repositories/numrelcvs/AEIThorns/AHFinderDirect/src/CODESTYLE,v 1.7 2004-03-01 11:06:58 jthorn Exp $
+$Header: /usr/local/svn/cvs-repositories/numrelcvs/AEIThorns/AHFinderDirect/src/CODESTYLE,v 1.8 2005-02-01 14:58:52 jthorn Exp $
This file documents some general programming conventions used in this
thorn.
@@ -187,6 +187,14 @@ printf()-style printing, eg
}
+C++ Namespaces
+==============
+
+All this thorn's C++ code is in the AHFinderDirect:: C++ namespace.
+Alas, the C and Fortran code under ./sparse-matrix/*/ doesn't enjoy
+such protection. :(
+
+
Error Handling
==============
diff --git a/src/README b/src/README
index d491526..3830f6a 100644
--- a/src/README
+++ b/src/README
@@ -46,12 +46,12 @@ include/ contains common header files which don't live in any other
source directory; all compile-time options for this thorn
are configured here
-All the code in the directories
+All the C++ code in the directories
driver/
gr/
gr.cg/
elliptic/
patch/
-is in namespace AHFinderDirect. All the code in the directories
+is in namespace AHFinderDirect:: . All the code in the directories
jtutil/
-is in namespace jtutil.
+is in namespace AHFinderDirect::jtutil:: .
diff --git a/src/driver/BH_diagnostics.cc b/src/driver/BH_diagnostics.cc
index 8bd1954..d67d95a 100644
--- a/src/driver/BH_diagnostics.cc
+++ b/src/driver/BH_diagnostics.cc
@@ -30,7 +30,6 @@
#include "../jtutil/array.hh"
#include "../jtutil/cpm_map.hh"
#include "../jtutil/linear_map.hh"
-using jtutil::error_exit;
#include "../patch/coords.hh"
#include "../patch/grid.hh"
@@ -53,6 +52,7 @@ using jtutil::error_exit;
// all the code in this file is inside this namespace
namespace AHFinderDirect
{
+using jtutil::error_exit;
//******************************************************************************
//******************************************************************************
diff --git a/src/driver/Newton.cc b/src/driver/Newton.cc
index fdd5bcc..aaf918c 100644
--- a/src/driver/Newton.cc
+++ b/src/driver/Newton.cc
@@ -26,7 +26,6 @@
#include "../jtutil/array.hh"
#include "../jtutil/cpm_map.hh"
#include "../jtutil/linear_map.hh"
-using jtutil::error_exit;
#include "../patch/coords.hh"
#include "../patch/grid.hh"
@@ -49,6 +48,7 @@ using jtutil::error_exit;
// all the code in this file is inside this namespace
namespace AHFinderDirect
{
+using jtutil::error_exit;
//******************************************************************************
diff --git a/src/driver/aliased_functions.cc b/src/driver/aliased_functions.cc
index 986fa41..50da3dd 100644
--- a/src/driver/aliased_functions.cc
+++ b/src/driver/aliased_functions.cc
@@ -22,7 +22,6 @@
#include "../jtutil/array.hh"
#include "../jtutil/cpm_map.hh"
#include "../jtutil/linear_map.hh"
-using jtutil::error_exit;
#include "../patch/coords.hh"
#include "../patch/grid.hh"
@@ -45,6 +44,7 @@ using jtutil::error_exit;
// all the code in this file is inside this namespace
namespace AHFinderDirect
{
+using jtutil::error_exit;
//******************************************************************************
diff --git a/src/driver/announce.cc b/src/driver/announce.cc
index 8116c6a..54b8972 100644
--- a/src/driver/announce.cc
+++ b/src/driver/announce.cc
@@ -19,7 +19,6 @@
#include "../jtutil/array.hh"
#include "../jtutil/cpm_map.hh"
#include "../jtutil/linear_map.hh"
-using jtutil::error_exit;
#include "../patch/coords.hh"
#include "../patch/grid.hh"
@@ -42,6 +41,7 @@ using jtutil::error_exit;
// all the code in this file is inside this namespace
namespace AHFinderDirect
{
+using jtutil::error_exit;
//******************************************************************************
diff --git a/src/driver/find_horizons.cc b/src/driver/find_horizons.cc
index 24b5b7c..e252528 100644
--- a/src/driver/find_horizons.cc
+++ b/src/driver/find_horizons.cc
@@ -24,7 +24,6 @@
#include "../jtutil/array.hh"
#include "../jtutil/cpm_map.hh"
#include "../jtutil/linear_map.hh"
-using jtutil::error_exit;
#include "../patch/coords.hh"
#include "../patch/grid.hh"
@@ -47,6 +46,7 @@ using jtutil::error_exit;
// all the code in this file is inside this namespace
namespace AHFinderDirect
{
+using jtutil::error_exit;
//******************************************************************************
diff --git a/src/driver/initial_guess.cc b/src/driver/initial_guess.cc
index e6483f8..5f3fae4 100644
--- a/src/driver/initial_guess.cc
+++ b/src/driver/initial_guess.cc
@@ -24,7 +24,6 @@
#include "../jtutil/array.hh"
#include "../jtutil/cpm_map.hh"
#include "../jtutil/linear_map.hh"
-using jtutil::error_exit;
#include "../patch/coords.hh"
#include "../patch/grid.hh"
@@ -47,6 +46,7 @@ using jtutil::error_exit;
// all the code in this file is inside this namespace
namespace AHFinderDirect
{
+using jtutil::error_exit;
//******************************************************************************
diff --git a/src/driver/io.cc b/src/driver/io.cc
index c358fd9..e7ea3e7 100644
--- a/src/driver/io.cc
+++ b/src/driver/io.cc
@@ -28,7 +28,6 @@
#include "../jtutil/array.hh"
#include "../jtutil/cpm_map.hh"
#include "../jtutil/linear_map.hh"
-using jtutil::error_exit;
#include "../patch/coords.hh"
#include "../patch/grid.hh"
@@ -51,6 +50,7 @@ using jtutil::error_exit;
// all the code in this file is inside this namespace
namespace AHFinderDirect
{
+using jtutil::error_exit;
//******************************************************************************
//******************************************************************************
diff --git a/src/driver/mask.cc b/src/driver/mask.cc
index 34ebef0..af1b282 100644
--- a/src/driver/mask.cc
+++ b/src/driver/mask.cc
@@ -30,7 +30,6 @@
#include "../jtutil/array.hh"
#include "../jtutil/cpm_map.hh"
#include "../jtutil/linear_map.hh"
-using jtutil::error_exit;
#include "../patch/coords.hh"
#include "../patch/grid.hh"
@@ -56,6 +55,7 @@ using jtutil::error_exit;
// all the code in this file is inside this namespace
namespace AHFinderDirect
{
+using jtutil::error_exit;
//******************************************************************************
diff --git a/src/driver/misc-driver.cc b/src/driver/misc-driver.cc
index 55cc6f5..0297529 100644
--- a/src/driver/misc-driver.cc
+++ b/src/driver/misc-driver.cc
@@ -18,7 +18,6 @@
#include "../jtutil/array.hh"
#include "../jtutil/cpm_map.hh"
#include "../jtutil/linear_map.hh"
-using jtutil::error_exit;
#include "../patch/coords.hh"
#include "../patch/grid.hh"
@@ -41,6 +40,7 @@ using jtutil::error_exit;
// all the code in this file is inside this namespace
namespace AHFinderDirect
{
+using jtutil::error_exit;
//******************************************************************************
diff --git a/src/driver/setup.cc b/src/driver/setup.cc
index 9a76e9a..e2507a0 100644
--- a/src/driver/setup.cc
+++ b/src/driver/setup.cc
@@ -33,7 +33,6 @@
#include "../jtutil/array.hh"
#include "../jtutil/cpm_map.hh"
#include "../jtutil/linear_map.hh"
-using jtutil::error_exit;
#include "../patch/coords.hh"
#include "../patch/grid.hh"
@@ -56,6 +55,7 @@ using jtutil::error_exit;
// all the code in this file is inside this namespace
namespace AHFinderDirect
{
+using jtutil::error_exit;
//******************************************************************************
diff --git a/src/driver/spherical_surface.cc b/src/driver/spherical_surface.cc
index b51074c..b6c60ac 100644
--- a/src/driver/spherical_surface.cc
+++ b/src/driver/spherical_surface.cc
@@ -22,7 +22,6 @@
#include "../jtutil/array.hh"
#include "../jtutil/cpm_map.hh"
#include "../jtutil/linear_map.hh"
-using jtutil::error_exit;
#include "../patch/coords.hh"
#include "../patch/grid.hh"
@@ -45,6 +44,7 @@ using jtutil::error_exit;
// all the code in this file is inside this namespace
namespace AHFinderDirect
{
+using jtutil::error_exit;
//******************************************************************************
diff --git a/src/driver/state.cc b/src/driver/state.cc
index 2da734b..dde1e23 100644
--- a/src/driver/state.cc
+++ b/src/driver/state.cc
@@ -15,7 +15,6 @@
#include "../jtutil/array.hh"
#include "../jtutil/cpm_map.hh"
#include "../jtutil/linear_map.hh"
-using jtutil::error_exit;
#include "../patch/coords.hh"
#include "../patch/grid.hh"
@@ -38,6 +37,7 @@ using jtutil::error_exit;
// everything in this file is inside this namespace
namespace AHFinderDirect
{
+using jtutil::error_exit;
//******************************************************************************
diff --git a/src/elliptic/Jacobian.cc b/src/elliptic/Jacobian.cc
index 0f9d427..8a1cfa4 100644
--- a/src/elliptic/Jacobian.cc
+++ b/src/elliptic/Jacobian.cc
@@ -22,7 +22,6 @@
#include "../jtutil/array.hh"
#include "../jtutil/cpm_map.hh"
#include "../jtutil/linear_map.hh"
-using jtutil::error_exit;
#include "../patch/coords.hh"
#include "../patch/grid.hh"
@@ -40,6 +39,7 @@ using jtutil::error_exit;
// all the code in this file is inside this namespace
namespace AHFinderDirect
{
+using jtutil::error_exit;
//******************************************************************************
//******************************************************************************
diff --git a/src/elliptic/dense_Jacobian.cc b/src/elliptic/dense_Jacobian.cc
index d78b484..61e3a8e 100644
--- a/src/elliptic/dense_Jacobian.cc
+++ b/src/elliptic/dense_Jacobian.cc
@@ -30,7 +30,6 @@
#include "../jtutil/array.hh"
#include "../jtutil/cpm_map.hh"
#include "../jtutil/linear_map.hh"
-using jtutil::error_exit;
#include "../patch/coords.hh"
#include "../patch/grid.hh"
@@ -47,6 +46,7 @@ using jtutil::error_exit;
// all the code in this file is inside this namespace
namespace AHFinderDirect
{
+using jtutil::error_exit;
//******************************************************************************
//******************************************************************************
diff --git a/src/elliptic/row_sparse_Jacobian.cc b/src/elliptic/row_sparse_Jacobian.cc
index 4a198a6..6b1152f 100644
--- a/src/elliptic/row_sparse_Jacobian.cc
+++ b/src/elliptic/row_sparse_Jacobian.cc
@@ -86,7 +86,6 @@ extern "C"
#include "../jtutil/array.hh"
#include "../jtutil/cpm_map.hh"
#include "../jtutil/linear_map.hh"
-using jtutil::error_exit;
#include "../patch/coords.hh"
#include "../patch/grid.hh"
@@ -103,6 +102,7 @@ using jtutil::error_exit;
// all the code in this file is inside this namespace
namespace AHFinderDirect
{
+using jtutil::error_exit;
//******************************************************************************
//******************************************************************************
diff --git a/src/gr/Schwarzschild_EF.cc b/src/gr/Schwarzschild_EF.cc
index 4a63bb5..b27d5a4 100644
--- a/src/gr/Schwarzschild_EF.cc
+++ b/src/gr/Schwarzschild_EF.cc
@@ -23,7 +23,6 @@
#include "../jtutil/array.hh"
#include "../jtutil/cpm_map.hh"
#include "../jtutil/linear_map.hh"
-using jtutil::error_exit;
#include "../patch/coords.hh"
#include "../patch/grid.hh"
@@ -42,6 +41,7 @@ using jtutil::error_exit;
// all the code in this file is inside this namespace
namespace AHFinderDirect
{
+using jtutil::error_exit;
//******************************************************************************
diff --git a/src/gr/expansion.cc b/src/gr/expansion.cc
index 4d7ae34..5a03783 100644
--- a/src/gr/expansion.cc
+++ b/src/gr/expansion.cc
@@ -47,9 +47,6 @@
#include "../jtutil/array.hh"
#include "../jtutil/cpm_map.hh"
#include "../jtutil/linear_map.hh"
-using jtutil::error_exit;
-using jtutil::pow2;
-using jtutil::pow4;
#include "../patch/coords.hh"
#include "../patch/grid.hh"
@@ -68,6 +65,9 @@ using jtutil::pow4;
// all the code in this file is inside this namespace
namespace AHFinderDirect
{
+using jtutil::error_exit;
+using jtutil::pow2;
+using jtutil::pow4;
//******************************************************************************
//******************************************************************************
diff --git a/src/gr/expansion_Jacobian.cc b/src/gr/expansion_Jacobian.cc
index 8c4e9e2..372d114 100644
--- a/src/gr/expansion_Jacobian.cc
+++ b/src/gr/expansion_Jacobian.cc
@@ -24,7 +24,6 @@
#include "../jtutil/array.hh"
#include "../jtutil/cpm_map.hh"
#include "../jtutil/linear_map.hh"
-using jtutil::error_exit;
#include "../patch/coords.hh"
#include "../patch/grid.hh"
@@ -43,6 +42,7 @@ using jtutil::error_exit;
// all the code in this file is inside this namespace
namespace AHFinderDirect
{
+using jtutil::error_exit;
//******************************************************************************
diff --git a/src/include/stdc.h b/src/include/stdc.h
index 7a3ad4d..c8a5228 100644
--- a/src/include/stdc.h
+++ b/src/include/stdc.h
@@ -53,20 +53,20 @@
/******************************************************************************/
#ifdef __cplusplus
+namespace AHFinderDirect
+ {
namespace jtutil
{
#endif
/*
- * Low-level code in this thorn is done with error_exit() . In this
- * this thorn it's a wrapper around CCTK_VWarn(msg_level, ...) . It's
- * declared to return int so it may be easily used in conditional
- * expressions like
+ * Low-level code in this thorn does error handling with error_exit() .
+ * In this this thorn this function is a wrapper around
+ * CCTK_VWarn(msg_level, ...)
+ * This function is declared to return int so it may be easily used in
+ * conditional expressions like
* foo = bar_ok ? baz(bar) : error_exit(...);
*/
-#ifdef __cplusplus
- extern "C"
-#endif
int error_exit(int msg_level, const char *format, ...)
#ifdef __GNUC__
__attribute__ ((noreturn))
@@ -88,6 +88,7 @@ int error_exit(int msg_level, const char *format, ...)
#ifdef __cplusplus
} /* namespace jtutil */
+ } /* namespace AHFinderDirect */
#endif
/******************************************************************************/
diff --git a/src/jtutil/README b/src/jtutil/README
index 1b6ea5e..31ac7aa 100644
--- a/src/jtutil/README
+++ b/src/jtutil/README
@@ -1,6 +1,8 @@
This directory holds low-level utility code in the C++ namespace jtutil::.
-This code is not specific to this project -- it's things like min/max
-templates, multidimensional array classes, fuzzy arithmetic routines, etc.
+Apart from this namespace being inside this thorn's global AHFinderDirect::
+namespace, this code isn't specific to this project -- it's things like
+min/max templates, multidimensional array classes, fuzzy arithmetic
+routines, etc.
array<fp>
is a template class (templated on the integer or floating-point
diff --git a/src/jtutil/array.cc b/src/jtutil/array.cc
index b6fbc99..c8e5c47 100644
--- a/src/jtutil/array.cc
+++ b/src/jtutil/array.cc
@@ -33,6 +33,12 @@
#include "util.hh"
#include "array.hh"
+// everything in this file is inside these namespaces
+namespace AHFinderDirect
+ {
+namespace jtutil
+ {
+
//******************************************************************************
//******************************************************************************
//******************************************************************************
@@ -40,8 +46,6 @@
//
// This function constructs an array1d object.
//
-namespace jtutil
- {
template <typename T>
array1d<T>::array1d(int min_i_in, int max_i_in,
T *array_in /* = NULL */,
@@ -73,22 +77,18 @@ if (we_own_array_)
operator()(i) = T(0);
}
}
- } // namespace jtutil::
//******************************************************************************
//
// This function destroys an array1d object.
//
-namespace jtutil
- {
template <typename T>
array1d<T>::~array1d()
{
if (we_own_array_)
then delete[] array_;
}
- } // namespace jtutil::
//******************************************************************************
//******************************************************************************
@@ -97,8 +97,6 @@ if (we_own_array_)
//
// This function constructs an array2d object.
//
-namespace jtutil
- {
template <typename T>
array2d<T>::array2d(int min_i_in, int max_i_in,
int min_j_in, int max_j_in,
@@ -137,22 +135,18 @@ if (we_own_array_)
}
}
}
- } // namespace jtutil::
//******************************************************************************
//
// This function destroys an array2d object.
//
-namespace jtutil
- {
template <typename T>
array2d<T>::~array2d()
{
if (we_own_array_)
then delete[] array_;
}
- } // namespace jtutil::
//******************************************************************************
//******************************************************************************
@@ -161,8 +155,6 @@ if (we_own_array_)
//
// This function constructs an array3d object.
//
-namespace jtutil
- {
template <typename T>
array3d<T>::array3d(int min_i_in, int max_i_in,
int min_j_in, int max_j_in,
@@ -210,22 +202,18 @@ if (we_own_array_)
}
}
}
- } // namespace jtutil::
//******************************************************************************
//
// This function destroys an array3d object.
//
-namespace jtutil
- {
template <typename T>
array3d<T>::~array3d()
{
if (we_own_array_)
then delete[] array_;
}
- } // namespace jtutil::
//******************************************************************************
//******************************************************************************
@@ -235,8 +223,6 @@ if (we_own_array_)
//
// This function constructs an array4d object.
//
-namespace jtutil
- {
template <typename T>
array4d<T>::array4d(int min_i_in, int max_i_in,
int min_j_in, int max_j_in,
@@ -292,7 +278,6 @@ if (we_own_array_)
}
}
}
- } // namespace jtutil::
#endif /* NOT_USED */
//******************************************************************************
@@ -301,15 +286,12 @@ if (we_own_array_)
//
// This function destroys an array4d object.
//
-namespace jtutil
- {
template <typename T>
array4d<T>::~array4d()
{
if (we_own_array_)
then delete[] array_;
}
- } // namespace jtutil::
#endif /* NOT_USED */
//******************************************************************************
@@ -320,33 +302,40 @@ if (we_own_array_)
// ***** template instantiations *****
//
-template class jtutil::array1d<int>;
+template class array1d<int>;
// FIXME: we shouldn't have to instantiate these both, the const one
// is actually trivially derivable from the non-const one. :(
-template class jtutil::array1d< void *>;
-template class jtutil::array1d<const void *>;
+template class array1d< void *>;
+template class array1d<const void *>;
#ifdef STANDALONE_TEST
- template class jtutil::array1d<float>;
- template class jtutil::array2d<float>;
- template class jtutil::array3d<float>;
+ template class array1d<float>;
+ template class array2d<float>;
+ template class array3d<float>;
#ifdef NOT_USED
- template class jtutil::array4d<float>;
+ template class array4d<float>;
#endif
- template class jtutil::array1d<double>;
- template class jtutil::array2d<double>;
- template class jtutil::array3d<double>;
+ template class array1d<double>;
+ template class array2d<double>;
+ template class array3d<double>;
#ifdef NOT_USED
- template class jtutil::array4d<double>;
+ template class array4d<double>;
#endif
#else
// full-fledged Cactus thorn
- template class jtutil::array1d<CCTK_REAL>;
+ template class array1d<CCTK_REAL>;
- template class jtutil::array2d<CCTK_INT>;
- template class jtutil::array2d<CCTK_REAL>;
+ template class array2d<CCTK_INT>;
+ template class array2d<CCTK_REAL>;
- template class jtutil::array3d<CCTK_REAL>;
+ template class array3d<CCTK_REAL>;
#endif
+
+//******************************************************************************
+//******************************************************************************
+//******************************************************************************
+
+ } // namespace jtutil
+ } // namespace AHFinderDirect
diff --git a/src/jtutil/array.hh b/src/jtutil/array.hh
index bf70628..96bb87a 100644
--- a/src/jtutil/array.hh
+++ b/src/jtutil/array.hh
@@ -62,10 +62,14 @@
//
#endif
-//******************************************************************************
-
+// everything in this file is inside these namespaces
+namespace AHFinderDirect
+ {
namespace jtutil
{
+
+//******************************************************************************
+
template <typename T>
class array1d
{
@@ -146,12 +150,9 @@ private:
bool we_own_array_; // true ==> array_ --> new[] array which we own
// false ==> array_ --> client-owned storage
};
- } // namespace jtutil::
//******************************************************************************
-namespace jtutil
- {
template <typename T>
class array2d
{
@@ -243,12 +244,9 @@ private:
bool we_own_array_; // true ==> array_ --> new[] array which we own
// false ==> array_ --> client-owned storage
};
- } // namespace jtutil::
//******************************************************************************
-namespace jtutil
- {
template <typename T>
class array3d
{
@@ -348,13 +346,10 @@ private:
bool we_own_array_; // true ==> array_ --> new[] array which we own
// false ==> array_ --> client-owned storage
};
- } // namespace jtutil::
//******************************************************************************
#ifdef NOT_USED
-namespace jtutil
- {
template <typename T>
class array4d
{
@@ -469,9 +464,11 @@ private:
bool we_own_array_; // true ==> array_ --> new[] array which we own
// false ==> array_ --> client-owned storage
};
- } // namespace jtutil::
#endif /* NOT_USED */
//******************************************************************************
+ }; // namespace jtutil
+ }; // namespace AHFinderDirect
+
#endif /* AHFINDERDIRECT__ARRAY_HH */
diff --git a/src/jtutil/cpm_map.cc b/src/jtutil/cpm_map.cc
index 09ab35a..1a44b20 100644
--- a/src/jtutil/cpm_map.cc
+++ b/src/jtutil/cpm_map.cc
@@ -14,7 +14,12 @@
#include "stdc.h"
#include "util.hh"
#include "cpm_map.hh"
-using jtutil::error_exit;
+
+// everything in this file is inside these namespaces
+namespace AHFinderDirect
+ {
+namespace jtutil
+ {
//******************************************************************************
//******************************************************************************
@@ -25,8 +30,6 @@ using jtutil::error_exit;
// specified fixed point (must be integer or half-integer) and domain.
// The sample point need not be in the map's domain/range.
//
-namespace jtutil
- {
template <typename fp_t>
cpm_map<fp_t>::cpm_map(int min_i_in, int max_i_in,
fp_t fixed_point)
@@ -50,7 +53,6 @@ assert(
fuzzy<fp_t>::ceiling(fixed_point)
);
}
- } // namespace jtutil::
//******************************************************************************
@@ -59,8 +61,6 @@ assert(
// specified by a sample point sample_i --> sample_j and by sign.
// The sample point need not be in the map's domain/range.
//
-namespace jtutil
- {
template <typename fp_t>
cpm_map<fp_t>::cpm_map(int min_i_in, int max_i_in,
int sample_i, int sample_j,
@@ -73,7 +73,6 @@ cpm_map<fp_t>::cpm_map(int min_i_in, int max_i_in,
// verify that we have setup correct
assert( map_unchecked(sample_i) == sample_j );
}
- } // namespace jtutil::
//******************************************************************************
@@ -85,8 +84,6 @@ assert( map_unchecked(sample_i) == sample_j );
// is never ok) and by sign. The sample point need not be in the map's
// domain/range.
//
-namespace jtutil
- {
template <typename fp_t>
cpm_map<fp_t>::cpm_map(int min_i_in, int max_i_in,
fp_t sample_i, fp_t sample_j,
@@ -115,7 +112,6 @@ assert(
(map_is_plus_in ? fuzzy<fp_t>::floor (sample_j)
: fuzzy<fp_t>::ceiling(sample_j)) );
}
- } // namespace jtutil::
//******************************************************************************
//******************************************************************************
@@ -125,5 +121,12 @@ assert(
// ***** template instantiations *****
//
-template class jtutil::cpm_map<float>;
-template class jtutil::cpm_map<double>;
+template class cpm_map<float>;
+template class cpm_map<double>;
+
+//******************************************************************************
+//******************************************************************************
+//******************************************************************************
+
+ } // namespace jtutil
+ } // namespace AHFinderDirect
diff --git a/src/jtutil/cpm_map.hh b/src/jtutil/cpm_map.hh
index 6b14ab3..4672b4e 100644
--- a/src/jtutil/cpm_map.hh
+++ b/src/jtutil/cpm_map.hh
@@ -25,10 +25,14 @@
//
#endif
-//******************************************************************************
-
+// everything in this file is inside these namespaces
+namespace AHFinderDirect
+ {
namespace jtutil
{
+
+//******************************************************************************
+
template <typename fp_t>
class cpm_map
{
@@ -132,8 +136,10 @@ private:
int offset_;
bool map_is_plus_;
};
- } // namespace jtutil::
//******************************************************************************
+ }; // namespace jtutil
+ }; // namespace AHFinderDirect
+
#endif /* AHFINDERDIRECT__CPM_MAP_HH */
diff --git a/src/jtutil/error_exit.cc b/src/jtutil/error_exit.cc
index 956ae08..ffffa1e 100644
--- a/src/jtutil/error_exit.cc
+++ b/src/jtutil/error_exit.cc
@@ -18,6 +18,12 @@
#include "config.h"
#include "stdc.h"
+// everything in this file is inside these namespaces
+namespace AHFinderDirect
+ {
+namespace jtutil
+ {
+
//******************************************************************************
//
@@ -48,9 +54,6 @@
// args... = (in) Any additional arguments are (presumably) used in formatting
// the error message string.
//
-namespace jtutil
- {
-extern "C"
/*VARARGS*/
int error_exit(int msg_level, const char *format, ...)
{
@@ -81,4 +84,8 @@ if ((len > 0) && (buffer[len-1] == '\n'))
// if we got here, evidently msg_level wasn't drastic enough
abort(); /*NOTREACHED*/
}
- } // namespace jtutil::
+
+//******************************************************************************
+
+ } // namespace jtutil
+ } // namespace AHFinderDirect
diff --git a/src/jtutil/fuzzy.cc b/src/jtutil/fuzzy.cc
index d3e4314..e444c30 100644
--- a/src/jtutil/fuzzy.cc
+++ b/src/jtutil/fuzzy.cc
@@ -11,40 +11,39 @@
//
#include <stdlib.h>
+#include <stdio.h>
#include "stdc.h"
#include "util.hh"
-//******************************************************************************
-
+// everything in this file is inside these namespaces
+namespace AHFinderDirect
+ {
namespace jtutil
{
+
+//******************************************************************************
+
template <typename fp_t>
bool fuzzy<fp_t>::EQ(fp_t x, fp_t y)
{
-fp_t max_abs = jtutil::max(jtutil::abs(x), jtutil::abs(y));
-fp_t epsilon = jtutil::max(tolerance_, tolerance_*max_abs);
+fp_t max_abs = max(jtutil::abs(x), jtutil::abs(y));
+fp_t epsilon = max(tolerance_, tolerance_*max_abs);
return jtutil::abs(x-y) <= epsilon;
}
- } // namespace jtutil::
//******************************************************************************
-namespace jtutil
- {
template <typename fp_t>
bool fuzzy<fp_t>::is_integer(fp_t x)
{
int i = round<fp_t>::to_integer(x);
return EQ(x, fp_t(i));
}
- } // namespace jtutil::
//******************************************************************************
-namespace jtutil
- {
template <typename fp_t>
int fuzzy<fp_t>::floor(fp_t x)
{
@@ -52,12 +51,9 @@ return fuzzy<fp_t>::is_integer(x)
? round<fp_t>::to_integer(x)
: round<fp_t>::floor(x);
}
- } // namespace jtutil::
//******************************************************************************
-namespace jtutil
- {
template <typename fp_t>
int fuzzy<fp_t>::ceiling(fp_t x)
{
@@ -65,7 +61,6 @@ return fuzzy<fp_t>::is_integer(x)
? round<fp_t>::to_integer(x)
: round<fp_t>::ceiling(x);
}
- } // namespace jtutil::
//******************************************************************************
//******************************************************************************
@@ -80,8 +75,6 @@ return fuzzy<fp_t>::is_integer(x)
// me figure out the correct syntax here!
//
-namespace jtutil
- {
// initializations of fuzzy::tolerance for each instantation we're going to make
template <>
float fuzzy<float>::tolerance_ = 1.0e-5; // about 100 * FLT_EPSILON
@@ -92,4 +85,10 @@ template <>
// template instantiations
template class fuzzy<float>;
template class fuzzy<double>;
- } // namespace jtutil::
+
+//******************************************************************************
+//******************************************************************************
+//******************************************************************************
+
+ } // namespace jtutil
+ } // namespace AHFinderDirect
diff --git a/src/jtutil/linear_map.cc b/src/jtutil/linear_map.cc
index 636675e..b44b466 100644
--- a/src/jtutil/linear_map.cc
+++ b/src/jtutil/linear_map.cc
@@ -16,7 +16,12 @@
#include "stdc.h"
#include "util.hh"
#include "linear_map.hh"
-using jtutil::error_exit;
+
+// everything in this file is inside these namespaces
+namespace AHFinderDirect
+ {
+namespace jtutil
+ {
//******************************************************************************
//******************************************************************************
@@ -27,8 +32,6 @@ using jtutil::error_exit;
//
// This function constructs a linear_map<fp_t> object.
//
-namespace jtutil
- {
template <typename fp_t>
linear_map<fp_t>::linear_map(int min_int_in, int max_int_in,
fp_t min_fp_in, fp_t delta_fp_in, fp_t max_fp_in)
@@ -37,7 +40,6 @@ linear_map<fp_t>::linear_map(int min_int_in, int max_int_in,
{
constructor_common(min_fp_in, max_fp_in);
}
- } // namespace jtutil::
//******************************************************************************
@@ -45,8 +47,6 @@ constructor_common(min_fp_in, max_fp_in);
// This function constructs a linear_map<fp_t> object with a subrange
// of an existing one.
//
-namespace jtutil
- {
template <typename fp_t>
linear_map<fp_t>::linear_map(const linear_map<fp_t> &lm_in,
int min_int_in, int max_int_in) // subrange
@@ -65,7 +65,6 @@ if (! (is_in_range(min_int_in) && is_in_range(max_int_in)) )
constructor_common(lm_in.fp_of_int_unchecked(min_int_in),
lm_in.fp_of_int_unchecked(max_int_in));
}
- } // namespace jtutil::
//******************************************************************************
@@ -73,8 +72,6 @@ constructor_common(lm_in.fp_of_int_unchecked(min_int_in),
// This function does the common argument validation and setup for
// all the constructors of class linear_map<fp_t>:: .
//
-namespace jtutil
- {
template <typename fp_t>
void linear_map<fp_t>::constructor_common(fp_t min_fp_in, fp_t max_fp_in)
// assumes
@@ -101,7 +98,6 @@ if (fuzzy<fp_t>::NE(fp_of_int_unchecked(max_int()), max_fp_in))
double(min_fp_in), double(delta_fp()), double(max_fp_in));
/*NOTREACHED*/
}
- } // namespace jtutil::
//******************************************************************************
@@ -109,8 +105,6 @@ if (fuzzy<fp_t>::NE(fp_of_int_unchecked(max_int()), max_fp_in))
// This function converts fp --> int coordinate, returning the result
// as an fp (which need not be fuzzily integral).
//
-namespace jtutil
- {
template <typename fp_t>
fp_t linear_map<fp_t>::fp_int_of_fp(fp_t x)
const
@@ -127,7 +121,6 @@ if (! is_in_range(x))
return inverse_delta_ * (x - origin_);
}
- } // namespace jtutil::
//******************************************************************************
@@ -140,8 +133,6 @@ return inverse_delta_ * (x - origin_);
// Having to explicitly specify the namespace for jtutil::round<fp_t>::
// is ++ugly. :(
//
-namespace jtutil
- {
template <typename fp_t>
int linear_map<fp_t>::int_of_fp(fp_t x, noninteger_action nia /* = nia_error */)
const
@@ -196,7 +187,6 @@ default:
return 0; // dummy return to quiet gcc
// (which doesn't grok that error_exit() never returns)
}
- } // namespace jtutil::
//******************************************************************************
@@ -210,8 +200,6 @@ return 0; // dummy return to quiet gcc
// Having to explicitly specify the namespace for jtutil::round<fp_t>::
// is ++ugly. :(
//
-namespace jtutil
- {
template <typename fp_t>
int linear_map<fp_t>::delta_int_of_delta_fp
(fp_t delta_x, noninteger_action nia /* = nia_error */)
@@ -271,7 +259,6 @@ default:
return 0; // dummy return to quiet gcc
// (which doesn't grok that error_exit() never returns)
}
- } // namespace jtutil::
//******************************************************************************
//******************************************************************************
@@ -281,5 +268,12 @@ return 0; // dummy return to quiet gcc
// ***** template instantiation *****
//
-template class jtutil::linear_map<float>;
-template class jtutil::linear_map<double>;
+template class linear_map<float>;
+template class linear_map<double>;
+
+//******************************************************************************
+//******************************************************************************
+//******************************************************************************
+
+ } // namespace jtutil
+ } // namespace AHFinderDirect
diff --git a/src/jtutil/linear_map.hh b/src/jtutil/linear_map.hh
index 48c0f2d..2417176 100644
--- a/src/jtutil/linear_map.hh
+++ b/src/jtutil/linear_map.hh
@@ -26,10 +26,14 @@
//
#endif
-//*****************************************************************************
-
+// everything in this file is inside these namespaces
+namespace AHFinderDirect
+ {
namespace jtutil
{
+
+//*****************************************************************************
+
template <typename fp_t>
class linear_map
{
@@ -139,8 +143,10 @@ private:
// bounds (inclusive)
const int min_int_, max_int_;
};
- } // namespace jtutil::
//******************************************************************************
+ }; // namespace jtutil
+ }; // namespace AHFinderDirect
+
#endif /* AHFINDERDIRECT__LINEAR_MAP_HH */
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
diff --git a/src/jtutil/norm.cc b/src/jtutil/norm.cc
index 283beb3..5c9b699 100644
--- a/src/jtutil/norm.cc
+++ b/src/jtutil/norm.cc
@@ -16,6 +16,12 @@
#include "util.hh"
+// everything in this file is inside these namespaces
+namespace AHFinderDirect
+ {
+namespace jtutil
+ {
+
//*****************************************************************************
//*****************************************************************************
//*****************************************************************************
@@ -23,8 +29,6 @@
//
// This function constructs a norm object.
//
-namespace jtutil
- {
template <typename fp_t>
norm<fp_t>::norm()
: N_(0L),
@@ -32,15 +36,12 @@ template <typename fp_t>
max_abs_value_(0.0), min_abs_value_(0.0),
max_value_(0.0), min_value_(0.0)
{ }
- }
//*****************************************************************************
//
// This function resets a norm object to its initial state
//
-namespace jtutil
- {
template <typename fp_t>
void norm<fp_t>::reset()
{
@@ -52,15 +53,12 @@ min_abs_value_ = 0.0;
max_value_ = 0.0;
min_value_ = 0.0;
}
- }
//*****************************************************************************
//
// This function updates the norms with a new data point x .
//
-namespace jtutil
- {
template <typename fp_t>
void norm<fp_t>::data(fp_t x)
{
@@ -76,15 +74,12 @@ max_value_ = (N_ == 0) ? x : jtutil::max(max_value_, x);
++N_;
}
- } // namespace jtutil::
//******************************************************************************
//
// these functions compute the corresponding norms
//
-namespace jtutil
- {
template<typename fp_t>
fp_t norm<fp_t>::mean() const { return sum_/fp_t(N_); }
template<typename fp_t>
@@ -92,7 +87,6 @@ template<typename fp_t>
template<typename fp_t>
fp_t norm<fp_t>::rms_norm() const
{ assert(is_nonempty()); return sqrt(sum2_/fp_t(N_)); }
- } // namespace jtutil::
//******************************************************************************
//******************************************************************************
@@ -104,3 +98,10 @@ template<typename fp_t>
template class jtutil::norm<float>;
template class jtutil::norm<double>;
+
+//******************************************************************************
+//******************************************************************************
+//******************************************************************************
+
+ } // namespace jtutil
+ } // namespace AHFinderDirect
diff --git a/src/jtutil/round.cc b/src/jtutil/round.cc
index 6559944..3c2d7e6 100644
--- a/src/jtutil/round.cc
+++ b/src/jtutil/round.cc
@@ -14,6 +14,12 @@
#include "stdc.h"
#include "util.hh"
+// everything in this file is inside these namespaces
+namespace AHFinderDirect
+ {
+namespace jtutil
+ {
+
//******************************************************************************
//******************************************************************************
//******************************************************************************
@@ -29,8 +35,6 @@
//******************************************************************************
// round to nearest integer, up for exact tie
-namespace jtutil
- {
template <typename fp_t>
int round<fp_t>::to_integer(fp_t x)
{
@@ -38,12 +42,9 @@ return (x >= 0.0)
? int(x + 0.5) // eg 3.6 --> int(4.1) = 4
: - int( (-x) + 0.5 ); // eg -3.6 --> - int(4.1) = -4
}
- } // namespace jtutil::
//******************************************************************************
-namespace jtutil
- {
template <typename fp_t>
int round<fp_t>::floor(fp_t x)
{
@@ -51,12 +52,9 @@ return (x >= 0.0)
? int(x)
: - ceiling(-x);
}
- } // namespace jtutil::
//******************************************************************************
-namespace jtutil
- {
template <typename fp_t>
int round<fp_t>::ceiling(fp_t x)
{
@@ -64,7 +62,6 @@ return (x >= 0.0)
? int(x) + (x != fp_t(int(x)))
: - floor(-x);
}
- } // namespace jtutil::
//******************************************************************************
//******************************************************************************
@@ -74,5 +71,12 @@ return (x >= 0.0)
// ***** template instantiations *****
//
-template class jtutil::round<float>;
-template class jtutil::round<double>;
+template class round<float>;
+template class round<double>;
+
+//******************************************************************************
+//******************************************************************************
+//******************************************************************************
+
+ } // namespace jtutil
+ } // namespace AHFinderDirect
diff --git a/src/jtutil/test_array.cc b/src/jtutil/test_array.cc
index 56c2a0c..2b413c4 100644
--- a/src/jtutil/test_array.cc
+++ b/src/jtutil/test_array.cc
@@ -9,6 +9,8 @@
#include "util.hh"
#include "array.hh"
+using namespace AHFinderDirect;
+
using jtutil::fuzzy;
using jtutil::array1d;
using jtutil::array2d;
diff --git a/src/jtutil/test_array2.cc b/src/jtutil/test_array2.cc
index 9015cbd..c89e209 100644
--- a/src/jtutil/test_array2.cc
+++ b/src/jtutil/test_array2.cc
@@ -9,6 +9,8 @@
#include "util.hh"
#include "array.hh"
+using namespace AHFinderDirect;
+
void print( jtutil::array2d<double>& Aref);
void cprint(const jtutil::array2d<double>& Aref);
diff --git a/src/jtutil/test_cpm_map.cc b/src/jtutil/test_cpm_map.cc
index 070321a..cdb5c7c 100644
--- a/src/jtutil/test_cpm_map.cc
+++ b/src/jtutil/test_cpm_map.cc
@@ -7,6 +7,9 @@
#include "stdc.h"
#include "util.hh"
#include "cpm_map.hh"
+
+using namespace AHFinderDirect;
+
using jtutil::cpm_map;
//******************************************************************************
diff --git a/src/jtutil/test_error_exit.cc b/src/jtutil/test_error_exit.cc
index a1b568e..fd4e170 100644
--- a/src/jtutil/test_error_exit.cc
+++ b/src/jtutil/test_error_exit.cc
@@ -4,6 +4,8 @@
#include <stdio.h>
#include "stdc.h"
+
+using namespace AHFinderDirect;
using jtutil::error_exit;
int main()
diff --git a/src/jtutil/test_fuzzy.cc b/src/jtutil/test_fuzzy.cc
index 437df36..3566f61 100644
--- a/src/jtutil/test_fuzzy.cc
+++ b/src/jtutil/test_fuzzy.cc
@@ -12,6 +12,9 @@
#include "stdc.h"
#include "util.hh"
+
+using namespace AHFinderDirect;
+
using jtutil::error_exit;
using jtutil::fuzzy;
diff --git a/src/jtutil/test_linear_map.cc b/src/jtutil/test_linear_map.cc
index f38d362..29b8974 100644
--- a/src/jtutil/test_linear_map.cc
+++ b/src/jtutil/test_linear_map.cc
@@ -7,6 +7,9 @@
#include "stdc.h"
#include "util.hh"
#include "linear_map.hh"
+
+using namespace AHFinderDirect;
+
using jtutil::fuzzy;
using jtutil::linear_map;
diff --git a/src/jtutil/test_modulo.cc b/src/jtutil/test_modulo.cc
index c587ea6..a32ba2b 100644
--- a/src/jtutil/test_modulo.cc
+++ b/src/jtutil/test_modulo.cc
@@ -6,6 +6,9 @@
#include "stdc.h"
#include "util.hh"
+
+using namespace AHFinderDirect;
+
using jtutil::error_exit;
using jtutil::fuzzy;
diff --git a/src/jtutil/test_norm.cc b/src/jtutil/test_norm.cc
index f9c8d47..6eec312 100644
--- a/src/jtutil/test_norm.cc
+++ b/src/jtutil/test_norm.cc
@@ -7,6 +7,9 @@
#include "stdc.h"
#include "util.hh"
+
+using namespace AHFinderDirect;
+
using jtutil::norm;
using jtutil::fuzzy;
diff --git a/src/jtutil/test_round.cc b/src/jtutil/test_round.cc
index 5e3354a..dc90584 100644
--- a/src/jtutil/test_round.cc
+++ b/src/jtutil/test_round.cc
@@ -6,6 +6,8 @@
#include "stdc.h"
#include "util.hh"
+
+using namespace AHFinderDirect;
using jtutil::round;
//
diff --git a/src/jtutil/util.hh b/src/jtutil/util.hh
index 35f1fcc..14b0ce5 100644
--- a/src/jtutil/util.hh
+++ b/src/jtutil/util.hh
@@ -9,6 +9,9 @@
// "stdc.h"
//
+// everything in this file is inside these namespaces
+namespace AHFinderDirect
+ {
namespace jtutil
{
@@ -207,6 +210,7 @@ public:
//******************************************************************************
- } // namespace jtutil
+ }; // namespace jtutil
+ }; // namespace AHFinderDirect
#endif /* AHFINDERDIRECT__UTIL_HH */
diff --git a/src/patch/coords.cc b/src/patch/coords.cc
index 970cb57..828553a 100644
--- a/src/patch/coords.cc
+++ b/src/patch/coords.cc
@@ -33,11 +33,6 @@
#include "config.h"
#include "stdc.h"
#include "../jtutil/util.hh"
-using jtutil::error_exit;
-using jtutil::arctan_xy;
-using jtutil::signum;
-using jtutil::pow2;
-using jtutil::hypot3;
#include "coords.hh"
@@ -49,6 +44,11 @@ using jtutil::hypot3;
// all the code in this file is inside this namespace
namespace AHFinderDirect
{
+using jtutil::error_exit;
+using jtutil::arctan_xy;
+using jtutil::signum;
+using jtutil::pow2;
+using jtutil::hypot3;
//******************************************************************************
//******************************************************************************
diff --git a/src/patch/fd_grid.cc b/src/patch/fd_grid.cc
index 48e490e..80d1e1b 100644
--- a/src/patch/fd_grid.cc
+++ b/src/patch/fd_grid.cc
@@ -20,7 +20,6 @@
#include "../jtutil/util.hh"
#include "../jtutil/array.hh"
#include "../jtutil/linear_map.hh"
-using jtutil::error_exit;
#include "coords.hh"
#include "grid.hh"
@@ -29,6 +28,7 @@ using jtutil::error_exit;
// all the code in this file is inside this namespace
namespace AHFinderDirect
{
+using jtutil::error_exit;
//*****************************************************************************
diff --git a/src/patch/ghost_zone.cc b/src/patch/ghost_zone.cc
index 985c1ca..32c073f 100644
--- a/src/patch/ghost_zone.cc
+++ b/src/patch/ghost_zone.cc
@@ -34,7 +34,6 @@
#include "../jtutil/array.hh"
#include "../jtutil/cpm_map.hh"
#include "../jtutil/linear_map.hh"
-using jtutil::error_exit;
#include "coords.hh"
#include "grid.hh"
@@ -47,6 +46,7 @@ using jtutil::error_exit;
// all the code in this file is inside this namespace
namespace AHFinderDirect
{
+using jtutil::error_exit;
//******************************************************************************
//******************************************************************************
diff --git a/src/patch/patch.cc b/src/patch/patch.cc
index 37b61b2..f4305f6 100644
--- a/src/patch/patch.cc
+++ b/src/patch/patch.cc
@@ -43,7 +43,6 @@
#include "../jtutil/array.hh"
#include "../jtutil/cpm_map.hh"
#include "../jtutil/linear_map.hh"
-using jtutil::error_exit;
#include "coords.hh"
#include "grid.hh"
@@ -56,6 +55,7 @@ using jtutil::error_exit;
// all the code in this file is inside this namespace
namespace AHFinderDirect
{
+using jtutil::error_exit;
//******************************************************************************
//******************************************************************************
diff --git a/src/patch/patch_info.cc b/src/patch/patch_info.cc
index c293cf6..002b63b 100644
--- a/src/patch/patch_info.cc
+++ b/src/patch/patch_info.cc
@@ -19,7 +19,6 @@
#include "../jtutil/array.hh"
#include "../jtutil/cpm_map.hh"
#include "../jtutil/linear_map.hh"
-using jtutil::error_exit;
#include "coords.hh"
#include "grid.hh"
@@ -28,6 +27,7 @@ using jtutil::error_exit;
// all the code in this file is inside this namespace
namespace AHFinderDirect
{
+using jtutil::error_exit;
//******************************************************************************
//******************************************************************************
diff --git a/src/patch/patch_interp.cc b/src/patch/patch_interp.cc
index fcc90a7..580ad3f 100644
--- a/src/patch/patch_interp.cc
+++ b/src/patch/patch_interp.cc
@@ -26,7 +26,6 @@
#include "../jtutil/array.hh"
#include "../jtutil/cpm_map.hh"
#include "../jtutil/linear_map.hh"
-using jtutil::error_exit;
#include "coords.hh"
#include "grid.hh"
@@ -39,6 +38,7 @@ using jtutil::error_exit;
// all the code in this file is inside this namespace
namespace AHFinderDirect
{
+using jtutil::error_exit;
//*****************************************************************************
//*****************************************************************************
diff --git a/src/patch/patch_system.cc b/src/patch/patch_system.cc
index 8396911..98974e6 100644
--- a/src/patch/patch_system.cc
+++ b/src/patch/patch_system.cc
@@ -65,7 +65,6 @@
#include "../jtutil/array.hh"
#include "../jtutil/cpm_map.hh"
#include "../jtutil/linear_map.hh"
-using jtutil::error_exit;
#include "coords.hh"
#include "grid.hh"
@@ -81,6 +80,7 @@ using jtutil::error_exit;
// all the code in this file is inside this namespace
namespace AHFinderDirect
{
+using jtutil::error_exit;
//******************************************************************************
//******************************************************************************
diff --git a/src/patch/test_coords.cc b/src/patch/test_coords.cc
index 0abe7d8..bf40c74 100644
--- a/src/patch/test_coords.cc
+++ b/src/patch/test_coords.cc
@@ -15,14 +15,14 @@
#include "config.h"
#include "stdc.h"
#include "../jtutil/util.hh"
-using jtutil::error_exit;
-using jtutil::radians_of_degrees;
-using jtutil::degrees_of_radians;
#include "coords.hh"
using namespace AHFinderDirect;
using namespace local_coords;
+using jtutil::error_exit;
+using jtutil::radians_of_degrees;
+using jtutil::degrees_of_radians;
//******************************************************************************
diff --git a/src/patch/test_coords2.cc b/src/patch/test_coords2.cc
index bc53633..cbf7a0a 100644
--- a/src/patch/test_coords2.cc
+++ b/src/patch/test_coords2.cc
@@ -18,14 +18,14 @@
#include "coords.hh"
+using namespace AHFinderDirect;
+using namespace local_coords;
+
using jtutil::fuzzy;
using jtutil::error_exit;
using jtutil::radians_of_degrees;
using jtutil::degrees_of_radians;
-using namespace AHFinderDirect;
-using namespace local_coords;
-
// prototypes
namespace {
void test_r_mu_nu_phi(fp x, fp y, fp z);
diff --git a/src/patch/test_patch_system.cc b/src/patch/test_patch_system.cc
index 64ff79e..cad9711 100644
--- a/src/patch/test_patch_system.cc
+++ b/src/patch/test_patch_system.cc
@@ -41,7 +41,6 @@
#include "../jtutil/array.hh"
#include "../jtutil/cpm_map.hh"
#include "../jtutil/linear_map.hh"
-using jtutil::error_exit;
#include "coords.hh"
#include "grid.hh"
@@ -53,6 +52,7 @@ using jtutil::error_exit;
#include "patch_system.hh"
using namespace AHFinderDirect;
+using jtutil::error_exit;
//******************************************************************************