From cb95431b072f5519a083a59e878255c5bcab64d1 Mon Sep 17 00:00:00 2001 From: jthorn Date: Tue, 1 Feb 2005 14:58:53 +0000 Subject: 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 --- src/CODESTYLE | 10 +++++- src/README | 6 ++-- src/driver/BH_diagnostics.cc | 2 +- src/driver/Newton.cc | 2 +- src/driver/aliased_functions.cc | 2 +- src/driver/announce.cc | 2 +- src/driver/find_horizons.cc | 2 +- src/driver/initial_guess.cc | 2 +- src/driver/io.cc | 2 +- src/driver/mask.cc | 2 +- src/driver/misc-driver.cc | 2 +- src/driver/setup.cc | 2 +- src/driver/spherical_surface.cc | 2 +- src/driver/state.cc | 2 +- src/elliptic/Jacobian.cc | 2 +- src/elliptic/dense_Jacobian.cc | 2 +- src/elliptic/row_sparse_Jacobian.cc | 2 +- src/gr/Schwarzschild_EF.cc | 2 +- src/gr/expansion.cc | 6 ++-- src/gr/expansion_Jacobian.cc | 2 +- src/include/stdc.h | 15 +++++---- src/jtutil/README | 6 ++-- src/jtutil/array.cc | 67 ++++++++++++++++--------------------- src/jtutil/array.hh | 21 +++++------- src/jtutil/cpm_map.cc | 27 ++++++++------- src/jtutil/cpm_map.hh | 12 +++++-- src/jtutil/error_exit.cc | 15 ++++++--- src/jtutil/fuzzy.cc | 33 +++++++++--------- src/jtutil/linear_map.cc | 36 +++++++++----------- src/jtutil/linear_map.hh | 12 +++++-- src/jtutil/miscfp.cc | 39 ++++++++++----------- src/jtutil/norm.cc | 25 +++++++------- src/jtutil/round.cc | 26 ++++++++------ src/jtutil/test_array.cc | 2 ++ src/jtutil/test_array2.cc | 2 ++ src/jtutil/test_cpm_map.cc | 3 ++ src/jtutil/test_error_exit.cc | 2 ++ src/jtutil/test_fuzzy.cc | 3 ++ src/jtutil/test_linear_map.cc | 3 ++ src/jtutil/test_modulo.cc | 3 ++ src/jtutil/test_norm.cc | 3 ++ src/jtutil/test_round.cc | 2 ++ src/jtutil/util.hh | 6 +++- src/patch/coords.cc | 10 +++--- src/patch/fd_grid.cc | 2 +- src/patch/ghost_zone.cc | 2 +- src/patch/patch.cc | 2 +- src/patch/patch_info.cc | 2 +- src/patch/patch_interp.cc | 2 +- src/patch/patch_system.cc | 2 +- src/patch/test_coords.cc | 6 ++-- src/patch/test_coords2.cc | 6 ++-- src/patch/test_patch_system.cc | 2 +- 53 files changed, 247 insertions(+), 208 deletions(-) (limited to 'src') 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 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 array1d::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 array1d::~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 array2d::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 array2d::~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 array3d::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 array3d::~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 array4d::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 array4d::~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; +template class array1d; // 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; +template class array1d< void *>; +template class array1d; #ifdef STANDALONE_TEST - template class jtutil::array1d; - template class jtutil::array2d; - template class jtutil::array3d; + template class array1d; + template class array2d; + template class array3d; #ifdef NOT_USED - template class jtutil::array4d; + template class array4d; #endif - template class jtutil::array1d; - template class jtutil::array2d; - template class jtutil::array3d; + template class array1d; + template class array2d; + template class array3d; #ifdef NOT_USED - template class jtutil::array4d; + template class array4d; #endif #else // full-fledged Cactus thorn - template class jtutil::array1d; + template class array1d; - template class jtutil::array2d; - template class jtutil::array2d; + template class array2d; + template class array2d; - template class jtutil::array3d; + template class array3d; #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 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 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 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 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 cpm_map::cpm_map(int min_i_in, int max_i_in, fp_t fixed_point) @@ -50,7 +53,6 @@ assert( fuzzy::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 cpm_map::cpm_map(int min_i_in, int max_i_in, int sample_i, int sample_j, @@ -73,7 +73,6 @@ cpm_map::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 cpm_map::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::floor (sample_j) : fuzzy::ceiling(sample_j)) ); } - } // namespace jtutil:: //****************************************************************************** //****************************************************************************** @@ -125,5 +121,12 @@ assert( // ***** template instantiations ***** // -template class jtutil::cpm_map; -template class jtutil::cpm_map; +template class cpm_map; +template class cpm_map; + +//****************************************************************************** +//****************************************************************************** +//****************************************************************************** + + } // 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 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 +#include #include "stdc.h" #include "util.hh" -//****************************************************************************** - +// everything in this file is inside these namespaces +namespace AHFinderDirect + { namespace jtutil { + +//****************************************************************************** + template bool fuzzy::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 bool fuzzy::is_integer(fp_t x) { int i = round::to_integer(x); return EQ(x, fp_t(i)); } - } // namespace jtutil:: //****************************************************************************** -namespace jtutil - { template int fuzzy::floor(fp_t x) { @@ -52,12 +51,9 @@ return fuzzy::is_integer(x) ? round::to_integer(x) : round::floor(x); } - } // namespace jtutil:: //****************************************************************************** -namespace jtutil - { template int fuzzy::ceiling(fp_t x) { @@ -65,7 +61,6 @@ return fuzzy::is_integer(x) ? round::to_integer(x) : round::ceiling(x); } - } // namespace jtutil:: //****************************************************************************** //****************************************************************************** @@ -80,8 +75,6 @@ return fuzzy::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::tolerance_ = 1.0e-5; // about 100 * FLT_EPSILON @@ -92,4 +85,10 @@ template <> // template instantiations template class fuzzy; template class fuzzy; - } // 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 object. // -namespace jtutil - { template linear_map::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::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 object with a subrange // of an existing one. // -namespace jtutil - { template linear_map::linear_map(const linear_map &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:: . // -namespace jtutil - { template void linear_map::constructor_common(fp_t min_fp_in, fp_t max_fp_in) // assumes @@ -101,7 +98,6 @@ if (fuzzy::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::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 fp_t linear_map::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:: // is ++ugly. :( // -namespace jtutil - { template int linear_map::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:: // is ++ugly. :( // -namespace jtutil - { template int linear_map::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; -template class jtutil::linear_map; +template class linear_map; +template class linear_map; + +//****************************************************************************** +//****************************************************************************** +//****************************************************************************** + + } // 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 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::GE(xx, xmin) && fuzzy::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 void zero_C_array(int N, fp_t array[]) { @@ -142,7 +134,6 @@ template array[i] = 0; } } - } // namespace jtutil:: //****************************************************************************** //****************************************************************************** @@ -152,7 +143,11 @@ template // ***** template instantiations ***** // -namespace jtutil - { template void zero_C_array(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 norm::norm() : N_(0L), @@ -32,15 +36,12 @@ template 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 void norm::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 void norm::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 fp_t norm::mean() const { return sum_/fp_t(N_); } template @@ -92,7 +87,6 @@ template template fp_t norm::rms_norm() const { assert(is_nonempty()); return sqrt(sum2_/fp_t(N_)); } - } // namespace jtutil:: //****************************************************************************** //****************************************************************************** @@ -104,3 +98,10 @@ template template class jtutil::norm; template class jtutil::norm; + +//****************************************************************************** +//****************************************************************************** +//****************************************************************************** + + } // 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 int round::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 int round::floor(fp_t x) { @@ -51,12 +52,9 @@ return (x >= 0.0) ? int(x) : - ceiling(-x); } - } // namespace jtutil:: //****************************************************************************** -namespace jtutil - { template int round::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; -template class jtutil::round; +template class round; +template class round; + +//****************************************************************************** +//****************************************************************************** +//****************************************************************************** + + } // 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& Aref); void cprint(const jtutil::array2d& 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 #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; //****************************************************************************** -- cgit v1.2.3