diff options
author | jthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5> | 2002-08-06 11:46:37 +0000 |
---|---|---|
committer | jthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5> | 2002-08-06 11:46:37 +0000 |
commit | 5244f2ba770c2523741944855754f873fac31c17 (patch) | |
tree | db128b4db5d269dcd17c5b151d4769985d7637b2 | |
parent | 72c67069fa28cfe9b27cc37b94efbbfcd6700eca (diff) |
switch to new do-everything-in-one-call synchronize Jacobian interface
in patch_system::
git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinAnalysis/AHFinderDirect/trunk@687 f88db872-0e4f-0410-b76b-b9085cfa78c5
-rw-r--r-- | src/gr/horizon_Jacobian.cc | 39 | ||||
-rw-r--r-- | src/patch/patch_system.cc | 147 | ||||
-rw-r--r-- | src/patch/patch_system.hh | 62 |
3 files changed, 77 insertions, 171 deletions
diff --git a/src/gr/horizon_Jacobian.cc b/src/gr/horizon_Jacobian.cc index 0dd7a31..24a59a7 100644 --- a/src/gr/horizon_Jacobian.cc +++ b/src/gr/horizon_Jacobian.cc @@ -394,32 +394,29 @@ const int xm_ipar = xme. ipar_of_irho_isigma(xm_irho, xm_isigma); // FIXME: this won't change from one call to another // ==> it would be more efficient to reuse the same buffer // across multiple calls on this function -int global_min_m, global_max_m; -ps.synchronize_Jacobian_global_minmax_y_ipar_m(global_min_m, global_max_m); -jtutil::array1d<fp> Jacobian_buffer(global_min_m, global_max_m); +int global_min_ym, global_max_ym; +ps.synchronize_Jacobian_global_minmax_ym(global_min_ym, global_max_ym); +jtutil::array1d<fp> Jacobian_buffer(global_min_ym, global_max_ym); -// on what other points ym does this molecule point xm depend +// on what other points y does this molecule point xm depend // via the patch_system::synchronize() operation? -const patch& ymp = ps.synchronize_Jacobian_y_patch(xmgz, xm_iperp,xm_ipar); -const patch_edge& yme = ps.synchronize_Jacobian_y_edge (xmgz, xm_iperp,xm_ipar); -const int ym_iperp = ps.synchronize_Jacobian_y_iperp(xmgz, xm_iperp,xm_ipar); -const int ym_ipar_posn - = ps.synchronize_Jacobian_y_ipar_posn(xmgz, xm_iperp,xm_ipar); -int min_ym_ipar_m, max_ym_ipar_m; -ps.synchronize_Jacobian_minmax_y_ipar_m(xmgz, xm_iperp, xm_ipar, - min_ym_ipar_m, max_ym_ipar_m); -ps.synchronize_Jacobian(xmgz, xm_iperp, xm_ipar, Jacobian_buffer); +int y_iperp; +int y_posn, min_ym, max_ym; +const patch_edge& ye = ps.synchronize_Jacobian(xmgz, + xm_iperp, xm_ipar, + y_iperp, + y_posn, min_ym, max_ym, + Jacobian_buffer); +const patch& yp = ye.my_patch(); // add the Jacobian contributions from the ym points - for (int ym_ipar_m = min_ym_ipar_m ; - ym_ipar_m <= max_ym_ipar_m ; - ++ym_ipar_m) + for (int ym = min_ym ; ym <= max_ym ; ++ym) { - const int ym_ipar = ym_ipar_posn + ym_ipar_m; - const int ym_irho = yme. irho_of_iperp_ipar(ym_iperp,ym_ipar); - const int ym_isigma = yme.isigma_of_iperp_ipar(ym_iperp,ym_ipar); - const int JJ = ps.gpn_of_patch_irho_isigma(ymp, ym_irho, ym_isigma); - Jac(x_II,JJ) += mol*Jacobian_buffer(ym_ipar_m); + const int y_ipar = y_posn + ym; + const int y_irho = ye. irho_of_iperp_ipar(y_iperp,y_ipar); + const int y_isigma = ye.isigma_of_iperp_ipar(y_iperp,y_ipar); + const int JJ = ps.gpn_of_patch_irho_isigma(yp, y_irho, y_isigma); + Jac(x_II,JJ) += mol*Jacobian_buffer(ym); } } } diff --git a/src/patch/patch_system.cc b/src/patch/patch_system.cc index 142ad97..698bea6 100644 --- a/src/patch/patch_system.cc +++ b/src/patch/patch_system.cc @@ -1431,7 +1431,7 @@ void patch_system::synchronize(int ghosted_min_gfn_to_sync, // ==> "fold" the interpatch ghost zone's Jacobian // to reflect the phase 1 symmetry operation // -// It also properly sets global_{min,max}_m_ . +// It also properly sets global_{min,max}_ym_ . // // FIXME FIXME: at the moment we ignore the 3-phase algorithm and just // pass all the Jacobian operations down to the ghost zones @@ -1440,8 +1440,8 @@ void patch_system::compute_synchronize_Jacobian(int ghosted_min_gfn_to_sync, int ghosted_max_gfn_to_sync) const { -global_min_m_ = +INT_MAX; -global_max_m_ = -INT_MAX; +global_min_ym_ = +INT_MAX; +global_max_ym_ = -INT_MAX; for (int pn = 0 ; pn < N_patches() ; ++pn) { patch& p = ith_patch(pn); @@ -1455,10 +1455,10 @@ global_max_m_ = -INT_MAX; gz.compute_Jacobian(ghosted_min_gfn_to_sync, ghosted_max_gfn_to_sync); - global_min_m_ = jtutil::min(global_min_m_, - gz.Jacobian_min_y_ipar_m()); - global_max_m_ = jtutil::max(global_max_m_, - gz.Jacobian_max_y_ipar_m()); + global_min_ym_ = jtutil::min(global_min_ym_, + gz.Jacobian_min_y_ipar_m()); + global_max_ym_ = jtutil::max(global_max_ym_, + gz.Jacobian_max_y_ipar_m()); } } } @@ -1471,125 +1471,52 @@ global_max_m_ = -INT_MAX; // function computes the global min/max m over all ghost zone points. // This is useful for sizing the buffer for synchronize_Jacobian(). // -void patch_system::synchronize_Jacobian_global_minmax_y_ipar_m - (int& min_m, int& max_m) +void patch_system::synchronize_Jacobian_global_minmax_ym + (int& min_ym, int& max_ym) const { -min_m = global_min_m_; -max_m = global_max_m_; +min_ym = global_min_ym_; +max_ym = global_max_ym_; } //****************************************************************************** // // Given that compute_synchronize_Jacobian() has been called, this -// function computes the patch containing the y points in a Jacobian row. -// -// FIXME FIXME: at the moment we ignore the 3-phase algorithm and just -// pass the operation down to the ghost zone -// -patch& patch_system::synchronize_Jacobian_y_patch(const ghost_zone& xgz, - int x_iperp, int x_ipar) - const -{ -return xgz.Jacobian_y_patch(); -} - -//****************************************************************************** - -// -// Given that compute_synchronize_Jacobian() has been called, this -// function computes the patch_edge containing the y points in a -// Jacobian row. -// -// FIXME FIXME: at the moment we ignore the 3-phase algorithm and just -// pass the operation down to the ghost zone -// -const patch_edge& patch_system::synchronize_Jacobian_y_edge - (const ghost_zone& xgz, - int x_iperp, int x_ipar) - const -{ -return xgz.Jacobian_y_edge(); -} - -//****************************************************************************** - -// -// Given that compute_synchronize_Jacobian() has been called, this -// function computes the iperp value of the y points in a Jacobian row. -// -// FIXME FIXME: at the moment we ignore the 3-phase algorithm and just -// pass the operation down to the ghost zones -// -int patch_system::synchronize_Jacobian_y_iperp(const ghost_zone& xgz, - int x_iperp, int x_ipar) - const -{ -return xgz.Jacobian_y_iperp(x_iperp); -} - -//****************************************************************************** - -// -// Given that compute_synchronize_Jacobian() has been called, this -// function computes the posn value of the y points in a Jacobian row. -// -// FIXME FIXME: at the moment we ignore the 3-phase algorithm and just -// pass all the operation down to the ghost zones -// -int patch_system::synchronize_Jacobian_y_ipar_posn(const ghost_zone& xgz, - int x_iperp, int x_ipar) - const -{ -return xgz.Jacobian_y_ipar_posn(x_iperp, x_ipar); -} - -//****************************************************************************** - -// -// Given that compute_synchronize_Jacobian() has been called, this -// function computes the min/max m values of the y points in a Jacobian row. -// -// FIXME FIXME: at the moment we ignore the 3-phase algorithm and just -// pass all the operation down to the ghost zones -// -void patch_system::synchronize_Jacobian_minmax_y_ipar_m(const ghost_zone& xgz, - int x_iperp, int x_ipar, - int& min_m, int& max_m) - const -{ -min_m = xgz.Jacobian_min_y_ipar_m(); -max_m = xgz.Jacobian_max_y_ipar_m(); -} - -//****************************************************************************** - -// -// Given that compute_synchronize_Jacobian() has been called, this -// function stores the Jacobian +// function computes a single row of the Jacobian: +// - It returns the edge to which the y point belongs (the caller can get +// the patch from this edge). +// - It stores y_iperp and y_posn and min/max ym in the named arguments. +// - It stores the Jacobian elements // partial synchronize() gridfn(ghosted_gfn, px, x_iperp, x_ipar) // ------------------------------------------------------------- -// partial gridfn(ghosted_gfn, py, y_iperp, y_posn+y_ipar_m) -// (taking into account synchronize()'s full 3-phase algorithm) -// in the caller-supplied buffer -// Jacobian_buffer(m) -// for each m , where -// y_iperp = Jacobian_y_iperp(x_iperp) -// y_posn = Jacobian_y_ipar_posn(x_iperp, x_ipar) +// partial gridfn(ghosted_gfn, py, y_iperp, y_posn+ym) +// (taking into account synchronize()'s full 3-phase algorithm) +// in the caller-supplied buffer +// Jacobian_buffer(ym) +// for each ym in the min/max ym range // // FIXME FIXME: at the moment we ignore the 3-phase algorithm and just // pass all the operation down to the ghost zones // -void patch_system::synchronize_Jacobian(const ghost_zone& xgz, - int x_iperp, int x_ipar, - jtutil::array1d<fp>& Jacobian_buffer) +const patch_edge& + patch_system::synchronize_Jacobian(const ghost_zone& xgz, + int x_iperp, int x_ipar, + int& y_iperp, + int& y_posn, int& min_ym, int& max_ym, + jtutil::array1d<fp>& Jacobian_buffer) const { -const int min_m = xgz.Jacobian_min_y_ipar_m(); -const int max_m = xgz.Jacobian_max_y_ipar_m(); - for (int m = min_m ; m <= max_m ; ++m) +y_iperp = xgz.Jacobian_y_iperp(x_iperp); + +y_posn = xgz.Jacobian_y_ipar_posn(x_iperp, x_ipar); +min_ym = xgz.Jacobian_min_y_ipar_m(); +max_ym = xgz.Jacobian_max_y_ipar_m(); + + for (int ym = min_ym ; ym <= max_ym ; ++ym) { - Jacobian_buffer(m) = xgz.Jacobian(x_iperp, x_ipar, m); + Jacobian_buffer(ym) = xgz.Jacobian(x_iperp, x_ipar, ym); } + +return xgz.Jacobian_y_edge(); } diff --git a/src/patch/patch_system.hh b/src/patch/patch_system.hh index 44f8304..6c42fa8 100644 --- a/src/patch/patch_system.hh +++ b/src/patch/patch_system.hh @@ -146,8 +146,9 @@ public: // - // compute Jacobian of synchronize() into internal buffers, - // taking into account synchronize()'s full 3-phase algorithm + // do any precomputation necessary to compute Jacobian of + // synchronize() , taking into account synchronize()'s + // full 3-phase algorithm // void compute_synchronize_Jacobian(int ghosted_min_gfn_to_sync, int ghosted_max_gfn_to_sync) @@ -182,53 +183,34 @@ public: // what are the global min/max m over all ghost zone points? // (this is useful for sizing the buffer for synchronize_Jacobian()) - void synchronize_Jacobian_global_minmax_y_ipar_m - (int& min_m, int& max_m) + void synchronize_Jacobian_global_minmax_ym(int& min_ym, int& max_ym) const; - // to which patch/edge do the y points in a Jacobian row belong? - patch& synchronize_Jacobian_y_patch(const ghost_zone& xgz, - int x_iperp, int x_ipar) - const; - const patch_edge& synchronize_Jacobian_y_edge(const ghost_zone& xgz, - int x_iperp, int x_ipar) - const; - - // what is the iperp of the Jacobian y points in their (y) patch? - int synchronize_Jacobian_y_iperp(const ghost_zone& xgz, - int x_iperp, int x_ipar) - const; - - // what are the posn and min/max m for a given x point? - int synchronize_Jacobian_y_ipar_posn(const ghost_zone& xgz, - int x_iperp, int x_ipar) - const; - void synchronize_Jacobian_minmax_y_ipar_m(const ghost_zone& xgz, - int x_iperp, int x_ipar, - int& min_m, int& max_m) - const; - -public: - // store the Jacobian + // compute a single row of the Jacobian: + // - return value is edge to which y point belongs + // (caller can get patch from this edge) + // - store y_iperp and y_posn and min/max ym in named arguments + // - stores the Jacobian elements // partial synchronize() gridfn(ghosted_gfn, px, x_iperp, x_ipar) // ------------------------------------------------------------- - // partial gridfn(ghosted_gfn, py, y_iperp, y_posn+y_ipar_m) - // (taking into account synchronize()'s full 3-phase algorithm) - // in the caller-supplied buffer - // Jacobian_buffer(m) - // for each m , where - // y_iperp = Jacobian_y_iperp(x_iperp) - // y_posn = Jacobian_y_ipar_posn(x_iperp, x_ipar) - void synchronize_Jacobian(const ghost_zone& xgz, - int x_iperp, int x_ipar, - jtutil::array1d<fp>& Jacobian_buffer) + // partial gridfn(ghosted_gfn, py, y_iperp, y_posn+ym) + // (taking into account synchronize()'s full 3-phase algorithm) + // in the caller-supplied buffer + // Jacobian_buffer(ym) + // for each ym in the min/max ym range + const patch_edge& + synchronize_Jacobian(const ghost_zone& xgz, + int x_iperp, int x_ipar, + int& y_iperp, + int& y_posn, int& min_ym, int& max_ym, + jtutil::array1d<fp>& Jacobian_buffer) const; // // ***** gridfn operations ***** // - +public: // dst = src void gridfn_copy(int src_gfn, int dst_gfn); @@ -464,5 +446,5 @@ private: fp* ghosted_gridfn_storage_; // min/max m over all ghost zone points - mutable int global_min_m_, global_max_m_; + mutable int global_min_ym_, global_max_ym_; }; |