diff options
Diffstat (limited to 'src/patch/patch_system.hh')
-rw-r--r-- | src/patch/patch_system.hh | 81 |
1 files changed, 53 insertions, 28 deletions
diff --git a/src/patch/patch_system.hh b/src/patch/patch_system.hh index d7b39bd..44f8304 100644 --- a/src/patch/patch_system.hh +++ b/src/patch/patch_system.hh @@ -28,7 +28,12 @@ // // A patch_system object describes a system of interlinked patches. -// Its const qualifiers refer to the gridfn data. +// +// Its const qualifiers refer (only) to the gridfn data. Notably, this +// means that synchronize() is a non-const function (it modifies gridfn +// data), while synchronize_Jacobian() et al are const functions (they +// don't modify gridfn data) even though they may update other internal +// state in the patch_system object and its subobjects. // class patch_system @@ -158,48 +163,65 @@ public: // // The following functions access the Jacobian computed by - // compute_synchronize_Jacobian() . Note this API has the - // same implicit assumptions on the Jacobian structure documented - // in the comments in "ghost_zone.hh" immediately following - // ghost_zone::compute_Jacobian() . + // compute_synchronize_Jacobian() . Note this API is rather + // different than that of ghost_zone::comute_Jacobian() et al: + // here we must take into account synchronize()'s full 3-phase + // algorithm, and this may lead to a more general Jacobian + // structure. + // + // This API still implicitly assumes that the Jacobian is + // independent of ghosted_gfn , and that the set of y points + // (with nonzero Jacobian values) in a single row of the Jacobian + // matrix (i.e. the set of points on which a single ghost-zone + // point depends), + // - lies entirely within a single y patch + // - has a single yiperp value + // - have a contiguous interval of yipar; we parameterize this + // interval as yipar = posn+m // - // to which patch/edge do the y points in a Jacobian row belong? - patch& synchronize_Jacobian_y_patch(const ghost_zone& xgz) - const - { return xgz.Jacobian_y_patch(); } - const patch_edge& synchronize_Jacobian_y_edge (const ghost_zone& xgz) - const - { return xgz.Jacobian_y_edge(); } + // 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) + const; - // what is the [min,max] range of m for a Jacobian row? - int synchronize_Jacobian_min_y_ipar_m(const ghost_zone& xgz) - const - { return xgz.Jacobian_min_y_ipar_m(); } - int synchronize_Jacobian_max_y_ipar_m(const ghost_zone& xgz) - const - { return xgz.Jacobian_max_y_ipar_m(); } + // 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) - const - { return xgz.Jacobian_y_iperp(x_iperp); } + int synchronize_Jacobian_y_iperp(const ghost_zone& xgz, + int x_iperp, int x_ipar) + const; - // what is the posn value of the y points in this Jacobian row? + // 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; - // what is the Jacobian +public: + // store 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 + // (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) - // taking into account synchronize()'s full 3-phase algorithm - fp synchronize_Jacobian(const ghost_zone& xgz, int x_iperp, int x_ipar, - int y_ipar_m) + void synchronize_Jacobian(const ghost_zone& xgz, + int x_iperp, int x_ipar, + jtutil::array1d<fp>& Jacobian_buffer) const; @@ -440,4 +462,7 @@ private: // ... patches point into these, but we own the storage blocks fp* gridfn_storage_; fp* ghosted_gridfn_storage_; + + // min/max m over all ghost zone points + mutable int global_min_m_, global_max_m_; }; |