aboutsummaryrefslogtreecommitdiff
path: root/src/patch/patch_system.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/patch/patch_system.cc')
-rw-r--r--src/patch/patch_system.cc123
1 files changed, 114 insertions, 9 deletions
diff --git a/src/patch/patch_system.cc b/src/patch/patch_system.cc
index e03e8bd..4f409f0 100644
--- a/src/patch/patch_system.cc
+++ b/src/patch/patch_system.cc
@@ -30,7 +30,12 @@
//
// patch_system::synchronize
// patch_system::compute_synchronize_Jacobian
+// patch_system::synchronize_Jacobian_global_minmax_y_ipar_m
+// patch_system::synchronize_Jacobian_y_patch
+// patch_system::synchronize_Jacobian_y_edge
+// patch_system::synchronize_Jacobian_y_iperp
// patch_system::synchronize_Jacobian_y_ipar_posn
+// patch_system::synchronize_Jacobian_minmax_y_ipar_m
// patch_system::synchronize_Jacobian
//
@@ -39,6 +44,7 @@
#include <cstring>
#include <vector>
#include <assert.h>
+#include <limits.h>
using std::printf;
using std::strcmp;
@@ -1405,6 +1411,8 @@ void patch_system::synchronize(int ghosted_min_gfn_to_sync,
// This function computes the Jacobian of synchronize() into internal
// buffers, taking into account synchronize()'s full 3-phase algorithm.
//
+// It also properly sets global_{min,max}_m_ .
+//
// FIXME FIXME: at the moment we ignore the 3-phase algorithm and just
// pass all the Jacobian operations down to the ghost zones
//
@@ -1412,6 +1420,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;
for (int pn = 0 ; pn < N_patches() ; ++pn)
{
patch& p = ith_patch(pn);
@@ -1424,6 +1434,11 @@ void patch_system::compute_synchronize_Jacobian(int ghosted_min_gfn_to_sync,
ghost_zone& gz = p.minmax_ang_ghost_zone(want_min, want_rho);
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());
}
}
}
@@ -1433,6 +1448,71 @@ void patch_system::compute_synchronize_Jacobian(int ghosted_min_gfn_to_sync,
//
// Given that compute_synchronize_Jacobian() has been called, this
+// 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)
+ const
+{
+min_m = global_min_m_;
+max_m = global_max_m_;
+}
+
+//******************************************************************************
+
+//
+// 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
@@ -1449,22 +1529,47 @@ return xgz.Jacobian_y_ipar_posn(x_iperp, x_ipar);
//
// Given that compute_synchronize_Jacobian() has been called, this
-// function computes the Jacobian
+// 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
// partial synchronize() gridfn(ghosted_gfn, px, x_iperp, x_ipar)
// -------------------------------------------------------------
// partial gridfn(ghosted_gfn, py, y_iperp, y_posn+y_ipar_m)
-// where
-// y_iperp = synchronize_Jacobian_y_iperp(xgz, x_iperp)
-// y_posn = synchronize_Jacobian_y_ipar_posn(xgz, x_iperp, x_ipar)
-// taking into account synchronize()'s full 3-phase algorithm
+// (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)
//
// FIXME FIXME: at the moment we ignore the 3-phase algorithm and just
// pass all the operation down to the ghost zones
//
-fp patch_system::synchronize_Jacobian
- (const ghost_zone& xgz, int x_iperp, int x_ipar,
- int y_ipar_m)
+void patch_system::synchronize_Jacobian(const ghost_zone& xgz,
+ int x_iperp, int x_ipar,
+ jtutil::array1d<fp>& Jacobian_buffer)
const
{
-return xgz.Jacobian(x_iperp, x_ipar, y_ipar_m);
+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)
+ {
+ Jacobian_buffer(m) = xgz.Jacobian(x_iperp, x_ipar, m);
+ }
}