diff options
Diffstat (limited to 'src/patch/ghost_zone.hh')
-rw-r--r-- | src/patch/ghost_zone.hh | 125 |
1 files changed, 75 insertions, 50 deletions
diff --git a/src/patch/ghost_zone.hh b/src/patch/ghost_zone.hh index 408c162..5db2c52 100644 --- a/src/patch/ghost_zone.hh +++ b/src/patch/ghost_zone.hh @@ -213,10 +213,8 @@ // // -// N.b. const qualifiers on member functions of ghost_zone and its derived -// classes refer to the union of the class functions and the underlying -// gridfn data. That is, anything which changes the gridfn data is taken -// to be non-const. +// N.b. const qualifiers in ghost_zone and its derived classes refer to +// the underlying gridfn data. // // forward declarations @@ -268,6 +266,7 @@ public: bool want_min_par_corner = true, bool want_noncorner = true, bool want_max_par_corner = true) + const = 0; // @@ -331,18 +330,6 @@ public: bool is_min() const { return my_edge().is_min(); } bool is_rho() const { return my_edge().is_rho(); } - // adjacent ghost zones to our min/max corners - const ghost_zone& min_par_adjacent_ghost_zone() const - { - return my_patch() - .ghost_zone_on_edge( my_edge().min_par_adjacent_edge() ); - } - const ghost_zone& max_par_adjacent_ghost_zone() const - { - return my_patch() - .ghost_zone_on_edge( my_edge().max_par_adjacent_edge() ); - } - // min/max iperp of the ghost zone int min_iperp() const { @@ -373,14 +360,31 @@ public: virtual int min_ipar(int iperp) const = 0; virtual int max_ipar(int iperp) const = 0; - // assert() that ghost zone is fully setup: - // defined here ==> no-op - // symmetry ghost zone ==> unchanged ==> no-op - // interpatch ghost zone ==> check consistency of this and the - // other patch's ghost zones and - // patch_interp objects - virtual void assert_fully_setup() const { } + // point membership predicate + bool is_in_ghost_zone(int iperp, int ipar) + const + { + // n.b. don't test ipar until we're sure iperp is in range! + return (iperp >= min_iperp()) && (iperp <= max_iperp()) + && (ipar >= min_ipar(iperp)) + && (ipar <= max_ipar(iperp)); + } + // adjacent ghost zones to our min/max corners + const ghost_zone& min_par_adjacent_ghost_zone() const + { + return my_patch() + .ghost_zone_on_edge( my_edge().min_par_adjacent_edge() ); + } + const ghost_zone& max_par_adjacent_ghost_zone() const + { + return my_patch() + .ghost_zone_on_edge( my_edge().max_par_adjacent_edge() ); + } + + // + // ***** constructor, finish setup, destructor ***** + // protected: // ... values for is_interpatch_in constructor argument static const bool ghost_zone_is_symmetry = false; @@ -396,6 +400,14 @@ protected: is_interpatch_(is_interpatch_in) { } public: + // assert() that ghost zone is fully setup: + // defined here ==> no-op + // symmetry ghost zone ==> unchanged ==> no-op + // interpatch ghost zone ==> check consistency of this and the + // other patch's ghost zones and + // patch_interp objects + virtual void assert_fully_setup() const { } + // destructor must be virtual to allow destruction // of derived classes via ptr/ref to this class virtual ~ghost_zone() { } @@ -493,6 +505,7 @@ public: bool want_min_par_corner = true, bool want_noncorner = true, bool want_max_par_corner = true) + const { } // to which patch/edge do the y points in this Jacobian row belong? @@ -544,6 +557,11 @@ public: int min_ipar(int iperp) const { return extreme_min_ipar(); } int max_ipar(int iperp) const { return extreme_max_ipar(); } + // + // ***** constructors, destructor ***** + // +public: + // constructor for mirror-symmetry ghost zone symmetry_ghost_zone(const patch_edge& my_edge_in); @@ -637,7 +655,8 @@ public: void compute_Jacobian(int ghosted_min_gfn, int ghosted_max_gfn, bool want_min_par_corner = true, bool want_noncorner = true, - bool want_max_par_corner = true); + bool want_max_par_corner = true) + const; // to which patch/edge do the y points in this Jacobian row belong? patch& Jacobian_y_patch() const { return other_patch_; } @@ -676,10 +695,22 @@ public: return (*Jacobian_buffer_)(y_iperp, x_ipar, y_ipar_m); } +private: + // helper function for synchronize() and compute_Jacobian(): + // verify (no-op if ok, error_exit() if not) that caller wants + // to operate on the entire ghost zone, since our implementations + // of synchronize() and compute_Jacobian() only support this case + void verify_caller_wants_all_of_ghost_zone(bool want_min_par_corner, + bool want_non_corner, + bool want_max_par_corner) + const; + + // // ***** low-level client interface ***** // +public: // basic connectivity info patch& other_patch() const { return other_patch_; } const patch_edge& other_edge() const { return other_edge_; } @@ -688,29 +719,6 @@ public: // and patch_interp objects void assert_fully_setup() const; - // - // constructor, finish setup, destructor - // - interpatch_ghost_zone(const patch_edge& my_edge_in, - const patch_edge& other_edge_in, - int N_overlap_points); - // finish setup (requires adjacent-side ghost_zone objects - // to exist, though not to have finish_setup() called): - // - setup par coordinate mapping information - // - setup interpolator data pointers & result buffer - // - create patch_interp object to interpolate from *other* patch - void finish_setup(int interp_handle, int interp_par_table_handle); - ~interpatch_ghost_zone(); - -private: - // verify (no-op if ok, error_exit() if not) that caller wants - // to operate on the entire ghost zone, since our implementations - // of synchronize() and compute_Jacobian() only support this case - void verify_caller_wants_all_of_ghost_zone(bool want_min_par_corner, - bool want_non_corner, - bool want_max_par_corner) - const; - // min/max ipar of the ghost zone for specified iperp // with possibly "triangular" corners depending on the type // (symmetry vs interpatch) of the adjacent ghost zones @@ -725,6 +733,23 @@ private: return other_iperp_->map(iperp); } + // + // ***** constructor, finish setup, destructor ***** + // +public: + interpatch_ghost_zone(const patch_edge& my_edge_in, + const patch_edge& other_edge_in, + int N_overlap_points); + + // finish setup (requires adjacent-side ghost_zone objects + // to exist, though not to have finish_setup() called): + // - setup par coordinate mapping information + // - setup interpolator data pointers & result buffer + // - create patch_interp object to interpolate from *other* patch + void finish_setup(int interp_handle, int interp_par_table_handle); + + ~interpatch_ghost_zone(); + private: // we forbid copying and passing by value // by declaring the copy constructor and assignment operator @@ -786,13 +811,13 @@ private: // ------------------- // partial gridfn at y // - int Jacobian_min_y_ipar_m_, Jacobian_max_y_ipar_m_; + mutable int Jacobian_min_y_ipar_m_, Jacobian_max_y_ipar_m_; // other patch's y ipar posn for a Jacobian row // ... subscripts are (oiperp, ipar) - jtutil::array2d<CCTK_INT>* Jacobian_y_ipar_posn_; + mutable jtutil::array2d<CCTK_INT>* Jacobian_y_ipar_posn_; // Jacobian values // ... subscripts are (y_iperp, x_ipar, y_ipar_m) - jtutil::array3d<fp>* Jacobian_buffer_; + mutable jtutil::array3d<fp>* Jacobian_buffer_; }; |