diff options
author | jthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5> | 2003-01-16 17:07:08 +0000 |
---|---|---|
committer | jthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5> | 2003-01-16 17:07:08 +0000 |
commit | 70dfc183be3fff193d86eefef8c68b3ea1ad5438 (patch) | |
tree | 653adf59bbeac0da1cf1e7806d96b8e17bacbaf8 /src | |
parent | ccd050da1496ca00845174ffcd4f4eaf22a9b792 (diff) |
* change to not use STL vector class any more
(it caused portability problems on platinum)
==> move stl_vector.hh from src/include/ to archive/ directory
* convert patch_system_type and initial_guess_method
parameters to be array parameters, i.e. they're now set individually
for each AH we want to find
git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinAnalysis/AHFinderDirect/trunk@920 f88db872-0e4f-0410-b76b-b9085cfa78c5
Diffstat (limited to 'src')
-rw-r--r-- | src/driver/Newton.cc | 2 | ||||
-rw-r--r-- | src/driver/driver.hh | 7 | ||||
-rw-r--r-- | src/driver/find_horizons.cc | 4 | ||||
-rw-r--r-- | src/driver/initial_guess.cc | 3 | ||||
-rw-r--r-- | src/driver/io.cc | 3 | ||||
-rw-r--r-- | src/driver/setup.cc | 82 | ||||
-rw-r--r-- | src/driver/state.cc | 2 | ||||
-rw-r--r-- | src/elliptic/Jacobian.cc | 3 | ||||
-rw-r--r-- | src/gr/Schwarzschild_EF.cc | 2 | ||||
-rw-r--r-- | src/gr/expansion.cc | 2 | ||||
-rw-r--r-- | src/gr/expansion_Jacobian.cc | 2 | ||||
-rw-r--r-- | src/gr/misc.cc | 3 | ||||
-rw-r--r-- | src/include/stl_vector.hh | 22 | ||||
-rw-r--r-- | src/patch/patch_system.cc | 17 | ||||
-rw-r--r-- | src/patch/patch_system.hh | 10 | ||||
-rw-r--r-- | src/patch/test_patch_system.cc | 2 |
16 files changed, 62 insertions, 104 deletions
diff --git a/src/driver/Newton.cc b/src/driver/Newton.cc index f13a40e..1127c25 100644 --- a/src/driver/Newton.cc +++ b/src/driver/Newton.cc @@ -12,8 +12,6 @@ #include "cctk.h" #include "cctk_Arguments.h" -#include "stl_vector.hh" - #include "config.h" #include "stdc.h" #include "../jtutil/util.hh" diff --git a/src/driver/driver.hh b/src/driver/driver.hh index 9cd0d1f..149fa0d 100644 --- a/src/driver/driver.hh +++ b/src/driver/driver.hh @@ -211,10 +211,9 @@ struct state int N_horizons; - // this vector is of size N_horizons+1, - // and is indexed with a "horizon number" hn - // which is (hopefully) always in the range 1 <= hn <= N_horizons - vector<AH_info *> AH_info_ptrs; + // --> array of size N_horizons+1, + // indexed with "horizon number" hn (should be in range [1,N_horizons] + AH_info* AH_info_array; }; //****************************************************************************** diff --git a/src/driver/find_horizons.cc b/src/driver/find_horizons.cc index c8afd32..b5db69d 100644 --- a/src/driver/find_horizons.cc +++ b/src/driver/find_horizons.cc @@ -26,8 +26,6 @@ #include "cctk_Arguments.h" #include "cctk_Parameters.h" -#include "stl_vector.hh" - #include "config.h" #include "stdc.h" #include "../jtutil/util.hh" @@ -157,7 +155,7 @@ if (state.gi.geometry_method == geometry__local_interp_from_Cactus_grid) for (int hn = 1 ; hn <= state.N_horizons ; ++hn) { - struct AH_info& AH_info = * state.AH_info_ptrs[hn]; + struct AH_info& AH_info = state.AH_info_array[hn]; patch_system& ps = *AH_info.ps_ptr; // diff --git a/src/driver/initial_guess.cc b/src/driver/initial_guess.cc index eafadaf..a58617b 100644 --- a/src/driver/initial_guess.cc +++ b/src/driver/initial_guess.cc @@ -12,14 +12,13 @@ #include <stdio.h> #include <assert.h> #include <math.h> +#include <string.h> #include "util_Table.h" #include "cctk.h" #include "cctk_Arguments.h" #include "cctk_Parameters.h" -#include "stl_vector.hh" - #include "config.h" #include "stdc.h" #include "../jtutil/util.hh" diff --git a/src/driver/io.cc b/src/driver/io.cc index a557257..cc6be75 100644 --- a/src/driver/io.cc +++ b/src/driver/io.cc @@ -16,14 +16,13 @@ #include <stdio.h> #include <assert.h> #include <math.h> +#include <string.h> #include "util_Table.h" #include "cctk.h" #include "cctk_Arguments.h" #include "cctk_Parameters.h" -#include "stl_vector.hh" - #include "config.h" #include "stdc.h" #include "../jtutil/util.hh" diff --git a/src/driver/setup.cc b/src/driver/setup.cc index 9a923ff..aabc9ae 100644 --- a/src/driver/setup.cc +++ b/src/driver/setup.cc @@ -16,14 +16,13 @@ #include <stdio.h> #include <assert.h> #include <math.h> +#include <string.h> #include "util_Table.h" #include "cctk.h" #include "cctk_Arguments.h" #include "cctk_Parameters.h" -#include "stl_vector.hh" - #include "config.h" #include "stdc.h" #include "../jtutil/util.hh" @@ -273,24 +272,21 @@ if (interp_param_table_handle < 0) "AHFinderDirect_setup(): bad interpatch-interpolator parameter(s) \"%s\"!", interpatch_interpolator_pars); /*NOTREACHED*/ -const bool ps_type_from_Cactus_grid_sym - = STRING_EQUAL(patch_system_type, "match Cactus grid symmetry"); - -// we don't use the [0] array element -state.AH_info_ptrs.push_back(NULL); +// horizon numbers run from 1 to N_horizons; we don't use horizon number hn=0 +state.AH_info_array = new AH_info[N_horizons+1]; for (int hn = 1 ; hn <= N_horizons ; ++hn) { + struct AH_info& AH_info = state.AH_info_array[hn]; + if (verbose_info.print_algorithm_highlights) then CCTK_VInfo(CCTK_THORNSTRING, " setting up data structures for horizon %d/%d", hn, int(N_horizons)); - struct AH_info* AH_ptr = new AH_info; - // decide what type of patch system this one should be const enum patch_system::patch_system_type ps_type - = ps_type_from_Cactus_grid_sym + = STRING_EQUAL(patch_system_type[hn], "match Cactus grid symmetry") ? // choose a patch system type based on grid:: parameters // ... we inherit from grid, and we ask for some of its // parameters in our param.ccl file; these appear as @@ -303,7 +299,7 @@ state.AH_info_ptrs.push_back(NULL); origin_x[hn], origin_y[hn], origin_z[hn]) - : patch_system::type_of_name(patch_system_type); + : patch_system::type_of_name(patch_system_type[hn]); // create the patch system patch_system& ps @@ -316,14 +312,14 @@ state.AH_info_ptrs.push_back(NULL); gfns::ghosted_min_gfn, gfns::ghosted_max_gfn, interp_handle, interp_param_table_handle, true, verbose_info.print_algorithm_details); - AH_ptr->ps_ptr = &ps; + AH_info.ps_ptr = &ps; ps.set_gridfn_to_constant(1.0, gfns::gfn__one); // create the Jacobian matrix if (verbose_info.print_algorithm_details) then CCTK_VInfo(CCTK_THORNSTRING, " constructing Jacobian matrix"); - AH_ptr->Jac_ptr = (state.method == method__evaluate_expansion) + AH_info.Jac_ptr = (state.method == method__evaluate_expansion) ? NULL // no Jacobian used for this case : &new_Jacobian(ps, Jac_info.Jacobian_storage_method); @@ -332,69 +328,67 @@ state.AH_info_ptrs.push_back(NULL); " setting initial guess parameters etc"); // store the initial guess parameters - AH_ptr->initial_guess_info.method - = decode_initial_guess_method(initial_guess_method); + AH_info.initial_guess_info.method + = decode_initial_guess_method(initial_guess_method[hn]); // ... Kerr/Kerr - AH_ptr->initial_guess_info.Kerr_Kerr_info.x_posn + AH_info.initial_guess_info.Kerr_Kerr_info.x_posn = initial_guess__Kerr_Kerr__x_posn[hn]; - AH_ptr->initial_guess_info.Kerr_Kerr_info.y_posn + AH_info.initial_guess_info.Kerr_Kerr_info.y_posn = initial_guess__Kerr_Kerr__y_posn[hn]; - AH_ptr->initial_guess_info.Kerr_Kerr_info.z_posn + AH_info.initial_guess_info.Kerr_Kerr_info.z_posn = initial_guess__Kerr_Kerr__z_posn[hn]; - AH_ptr->initial_guess_info.Kerr_Kerr_info.mass + AH_info.initial_guess_info.Kerr_Kerr_info.mass = initial_guess__Kerr_Kerr__mass[hn]; - AH_ptr->initial_guess_info.Kerr_Kerr_info.spin + AH_info.initial_guess_info.Kerr_Kerr_info.spin = initial_guess__Kerr_Kerr__spin[hn]; // ... Kerr/Kerr-Schild - AH_ptr->initial_guess_info.Kerr_KerrSchild_info.x_posn + AH_info.initial_guess_info.Kerr_KerrSchild_info.x_posn = initial_guess__Kerr_KerrSchild__x_posn[hn]; - AH_ptr->initial_guess_info.Kerr_KerrSchild_info.y_posn + AH_info.initial_guess_info.Kerr_KerrSchild_info.y_posn = initial_guess__Kerr_KerrSchild__y_posn[hn]; - AH_ptr->initial_guess_info.Kerr_KerrSchild_info.z_posn + AH_info.initial_guess_info.Kerr_KerrSchild_info.z_posn = initial_guess__Kerr_KerrSchild__z_posn[hn]; - AH_ptr->initial_guess_info.Kerr_KerrSchild_info.mass + AH_info.initial_guess_info.Kerr_KerrSchild_info.mass = initial_guess__Kerr_KerrSchild__mass[hn]; - AH_ptr->initial_guess_info.Kerr_KerrSchild_info.spin + AH_info.initial_guess_info.Kerr_KerrSchild_info.spin = initial_guess__Kerr_KerrSchild__spin[hn]; // ... coordinate sphere - AH_ptr->initial_guess_info.coord_sphere_info.x_center + AH_info.initial_guess_info.coord_sphere_info.x_center = initial_guess__coord_sphere__x_center[hn]; - AH_ptr->initial_guess_info.coord_sphere_info.y_center + AH_info.initial_guess_info.coord_sphere_info.y_center = initial_guess__coord_sphere__y_center[hn]; - AH_ptr->initial_guess_info.coord_sphere_info.z_center + AH_info.initial_guess_info.coord_sphere_info.z_center = initial_guess__coord_sphere__z_center[hn]; - AH_ptr->initial_guess_info.coord_sphere_info.radius + AH_info.initial_guess_info.coord_sphere_info.radius = initial_guess__coord_sphere__radius[hn]; // ... coordinate ellipsoid - AH_ptr->initial_guess_info.coord_ellipsoid_info.x_center + AH_info.initial_guess_info.coord_ellipsoid_info.x_center = initial_guess__coord_ellipsoid__x_center[hn]; - AH_ptr->initial_guess_info.coord_ellipsoid_info.y_center + AH_info.initial_guess_info.coord_ellipsoid_info.y_center = initial_guess__coord_ellipsoid__y_center[hn]; - AH_ptr->initial_guess_info.coord_ellipsoid_info.z_center + AH_info.initial_guess_info.coord_ellipsoid_info.z_center = initial_guess__coord_ellipsoid__z_center[hn]; - AH_ptr->initial_guess_info.coord_ellipsoid_info.x_radius + AH_info.initial_guess_info.coord_ellipsoid_info.x_radius = initial_guess__coord_ellipsoid__x_radius[hn]; - AH_ptr->initial_guess_info.coord_ellipsoid_info.y_radius + AH_info.initial_guess_info.coord_ellipsoid_info.y_radius = initial_guess__coord_ellipsoid__y_radius[hn]; - AH_ptr->initial_guess_info.coord_ellipsoid_info.z_radius + AH_info.initial_guess_info.coord_ellipsoid_info.z_radius = initial_guess__coord_ellipsoid__z_radius[hn]; // initialize the BH diagnostics - AH_ptr->AH_found = false; - AH_ptr->BH_diagnostics.centroid_x = 0.0; - AH_ptr->BH_diagnostics.centroid_y = 0.0; - AH_ptr->BH_diagnostics.centroid_z = 0.0; - AH_ptr->BH_diagnostics.area = 0.0; - AH_ptr->BH_diagnostics.m_irreducible = 0.0; + AH_info.AH_found = false; + AH_info.BH_diagnostics.centroid_x = 0.0; + AH_info.BH_diagnostics.centroid_y = 0.0; + AH_info.BH_diagnostics.centroid_z = 0.0; + AH_info.BH_diagnostics.area = 0.0; + AH_info.BH_diagnostics.m_irreducible = 0.0; // set up the BH-diagnostics output files? - AH_ptr->BH_diagnostics_fileptr + AH_info.BH_diagnostics_fileptr = ( output_BH_diagnostics && (state.method == method__find_horizon) ) ? setup_BH_diagnostics_output_file(IO_info, hn, N_horizons) : NULL; - - state.AH_info_ptrs.push_back(AH_ptr); } } diff --git a/src/driver/state.cc b/src/driver/state.cc index 20b5e0c..77dc1f2 100644 --- a/src/driver/state.cc +++ b/src/driver/state.cc @@ -10,8 +10,6 @@ #include "cctk_Arguments.h" #include "cctk_Parameters.h" -#include "stl_vector.hh" - #include "config.h" #include "stdc.h" #include "../jtutil/util.hh" diff --git a/src/elliptic/Jacobian.cc b/src/elliptic/Jacobian.cc index 83b0a0e..4ac18c3 100644 --- a/src/elliptic/Jacobian.cc +++ b/src/elliptic/Jacobian.cc @@ -21,13 +21,12 @@ #include <stdio.h> #include <assert.h> #include <math.h> +#include <string.h> #include "util_Table.h" #include "cctk.h" #include "cctk_Arguments.h" -#include "stl_vector.hh" - #include "config.h" #include "stdc.h" #include "../jtutil/util.hh" diff --git a/src/gr/Schwarzschild_EF.cc b/src/gr/Schwarzschild_EF.cc index 72fad0b..80869a4 100644 --- a/src/gr/Schwarzschild_EF.cc +++ b/src/gr/Schwarzschild_EF.cc @@ -18,8 +18,6 @@ #include "cctk.h" #include "cctk_Arguments.h" -#include "stl_vector.hh" - #include "config.h" #include "stdc.h" #include "../jtutil/util.hh" diff --git a/src/gr/expansion.cc b/src/gr/expansion.cc index f2b5961..5e3e42b 100644 --- a/src/gr/expansion.cc +++ b/src/gr/expansion.cc @@ -22,8 +22,6 @@ #include "cctk.h" #include "cctk_Arguments.h" -#include "stl_vector.hh" - #include "config.h" #include "stdc.h" #include "../jtutil/util.hh" diff --git a/src/gr/expansion_Jacobian.cc b/src/gr/expansion_Jacobian.cc index 40103ef..a843e4e 100644 --- a/src/gr/expansion_Jacobian.cc +++ b/src/gr/expansion_Jacobian.cc @@ -19,8 +19,6 @@ #include "cctk.h" #include "cctk_Arguments.h" -#include "stl_vector.hh" - #include "config.h" #include "stdc.h" #include "../jtutil/util.hh" diff --git a/src/gr/misc.cc b/src/gr/misc.cc index 58ab640..28cdfbd 100644 --- a/src/gr/misc.cc +++ b/src/gr/misc.cc @@ -9,13 +9,12 @@ #include <stdio.h> #include <assert.h> #include <math.h> +#include <string.h> #include "util_Table.h" #include "cctk.h" #include "cctk_Arguments.h" -#include "stl_vector.hh" - #include "config.h" #include "stdc.h" #include "../jtutil/util.hh" diff --git a/src/include/stl_vector.hh b/src/include/stl_vector.hh deleted file mode 100644 index 9e4d817..0000000 --- a/src/include/stl_vector.hh +++ /dev/null @@ -1,22 +0,0 @@ -// stl_vector.hh -- define STL vector class in global namespace. -// $Header$ - -// -// prerequisites: -// "cctk.h" -// - -// -// This header file defines the STL vector class in the global namespace. -// It makes use of Cactus's configuration-time probing of what header -// files are available. -// - -#if defined(HAVE_VECTOR) - #include <vector> - using std::vector; -#elif defined(HAVE_VECTOR_H) - #include <vector.h> -#else - #error "Cactus couldn't find the STL vector class!" -#endif diff --git a/src/patch/patch_system.cc b/src/patch/patch_system.cc index 1b3ee83..e6d729f 100644 --- a/src/patch/patch_system.cc +++ b/src/patch/patch_system.cc @@ -60,8 +60,6 @@ #include "cctk.h" -#include "stl_vector.hh" - #include "config.h" #include "stdc.h" #include "../jtutil/util.hh" @@ -130,9 +128,9 @@ patch_system::patch_system(fp origin_x_in, fp origin_y_in, fp origin_z_in, : global_coords_(origin_x_in, origin_y_in, origin_z_in), type_(type_in), N_patches_(N_patches_of_type(type_in)), - all_patches_(N_patches_), - starting_gpn_(N_patches_+1), - ghosted_starting_gpn_(N_patches_+1), + all_patches_(new patch*[N_patches_]), + starting_gpn_(new int[N_patches_+1]), + ghosted_starting_gpn_(new int[N_patches_+1]), gridfn_storage_(NULL), // set in setup_gridfn_storage() ghosted_gridfn_storage_(NULL) // set in setup_gridfn_storage() { @@ -141,7 +139,7 @@ if (! jtutil::is_odd(patch_overlap_width)) "***** patch_system::patch_system(): implementation restriction:\n" " patch_overlap_width=%d, but we only support odd values!\n" , - patch_overlap_width); /*NOTREACHED*/ + patch_overlap_width); /*NOTREACHED*/ const int patch_extend_width = patch_overlap_width >> 1; if (ghost_zone_width < fd_grid::molecule_radius()) @@ -280,8 +278,11 @@ default: // patch_system::~patch_system() { -delete ghosted_gridfn_storage_; -delete gridfn_storage_; +delete[] ghosted_gridfn_storage_; +delete[] gridfn_storage_; +delete[] ghosted_starting_gpn_; +delete[] starting_gpn_; +delete[] all_patches_; for (int pn = N_patches()-1 ; pn >= 0 ; --pn) { diff --git a/src/patch/patch_system.hh b/src/patch/patch_system.hh index 24e61de..99bead8 100644 --- a/src/patch/patch_system.hh +++ b/src/patch/patch_system.hh @@ -559,13 +559,17 @@ private: int N_grid_points_, ghosted_N_grid_points_; // [pn] = --> individual patches - vector<patch *> all_patches_; + // *** constructor initialization list ordering: + // *** this must be declared after N_patches_ + patch** all_patches_; // [pn] = starting grid point number of individual patches // ... arrays are actually of size N_patches_+1, the [N_patches_] // entries are == N_grid_points_ and ghosted_N_grid_points_ - vector<int> starting_gpn_; - vector<int> ghosted_starting_gpn_; + // *** constructor initialization list ordering: + // *** these must be declared after N_patches_ + int* starting_gpn_; + int* ghosted_starting_gpn_; // pointers to storage blocks for all gridfns // ... patches point into these, but we own the storage blocks diff --git a/src/patch/test_patch_system.cc b/src/patch/test_patch_system.cc index 1aa0917..2f65378 100644 --- a/src/patch/test_patch_system.cc +++ b/src/patch/test_patch_system.cc @@ -35,8 +35,6 @@ #include "cctk_Arguments.h" #include "cctk_Parameters.h" -#include "stl_vector.hh" - #include "config.h" #include "stdc.h" #include "../jtutil/util.hh" |