diff options
-rw-r--r-- | src/patch/ghost_zone.cc | 47 | ||||
-rw-r--r-- | src/patch/ghost_zone.hh | 73 |
2 files changed, 64 insertions, 56 deletions
diff --git a/src/patch/ghost_zone.cc b/src/patch/ghost_zone.cc index 561ab15..8aeb16d 100644 --- a/src/patch/ghost_zone.cc +++ b/src/patch/ghost_zone.cc @@ -5,12 +5,12 @@ // symmetry_ghost_zone::symmetry_ghost_zone (mirror symmetry) // symmetry_ghost_zone::symmetry_ghost_zone (periodic BC) // symmetry_ghost_zone::~symmetry_ghost_zone -// symmetry_ghost_zone::extend_scalar_gridfn_to_ghost_zone +// symmetry_ghost_zone::synchronize // // interpatch_ghost_zone::interpatch_ghost_zone // interpatch_ghost_zone::~interpatch_ghost_zone // interpatch_ghost_zone::assert_fully_setup -// interpatch_ghost_zone::extend_scalar_gridfn_to_ghost_zone +// interpatch_ghost_zone::synchronize // #include <stdio.h> @@ -108,21 +108,19 @@ delete iperp_map_; //****************************************************************************** // -// This function symmetry-maps a scalar gridfn in a specified part -// of the ghost zone. +// This function "synchronizes" a ghost zone, i.e. it updates the +// ghost-zone values of the specified gridfns via the appropriate +// symmetry operations.The flags specify which part(s) of the ghost zone +// we want. // -// N.b. "scalar" here refers solely to the symmetry properties of the -// gridfn under the ghost zone's "const +/-" coordinate transformations; -// it need not be an actual scalar under more general coordinate -// transformations. -// -void symmetry_ghost_zone::extend_scalar_gridfn_to_ghost_zone - (int gfn, - bool want_min_par_corner, - bool want_non_corner, - bool want_max_par_corner) +void symmetry_ghost_zone::synchronize(int ghosted_min_gfn, int ghosted_max_gfn, + bool want_min_par_corner, + bool want_non_corner, + bool want_max_par_corner) const { + for (int gfn = ghosted_min_gfn ; gfn <= ghosted_max_gfn ; ++gfn) + { for (int iperp = min_iperp() ; iperp <= max_iperp() ; ++iperp) { for (int ipar = min_ipar() ; ipar <= max_ipar() ; ++ipar) @@ -147,6 +145,7 @@ void symmetry_ghost_zone::extend_scalar_gridfn_to_ghost_zone my_patch().gridfn(gfn, irho,isigma) = sym_gridfn; } } + } } //****************************************************************************** @@ -312,7 +311,7 @@ other_iperp_ = new jtutil::cpm_map<fp>(min_iperp(), max_iperp(), // (since that depends on the type of our patch's adjacent ghost zones) // ==> we include the corners on the chance we may want them later, // and use the appropriate parts of them in -// extend_scalar_gridfn_to_ghost_zone() +// synchronize() // below const int ghost_zone_min_ipar = my_edge().min_ipar_with_corners(); const int ghost_zone_max_ipar = my_edge().max_ipar_with_corners(); @@ -379,23 +378,19 @@ assert(& oigz.other_patch() == & my_patch()); //****************************************************************************** // -// This function extends a scalar gridfn defined on the other patch's -// nominal grid, to a specified part of this ghost zone, by interpatch -// interpolating it from the neighboring patch's frontier. +// This function "synchronizes" a ghost zone, i.e. it updates the +// ghost-zone values of the specified gridfns via the appropriate +// interpatch interpolations. The flags specify which part(s) of the +// ghost zone we want. // -// N.b. "scalar" here refers solely to the symmetry properties of the -// gridfn under the interpatch coordinate transformations; it need not -// be an actual scalar under more general coordinate transformations. -// -void interpatch_ghost_zone::extend_scalar_gridfn_to_ghost_zone - (int gfn, +void interpatch_ghost_zone::synchronize + (int ghosted_min_gfn, int ghosted_max_gfn, bool want_min_par_corner, bool want_non_corner, bool want_max_par_corner) const { -other_frontier_->setup_interpolation_for_gridfn(gfn); - +// for (int iperp = min_iperp() ; iperp <= max_iperp() ; ++iperp) { for (int ipar = min_ipar(iperp) ; ipar <= max_ipar(iperp) ; ++ipar) diff --git a/src/patch/ghost_zone.hh b/src/patch/ghost_zone.hh index 978921a..ee0eb4e 100644 --- a/src/patch/ghost_zone.hh +++ b/src/patch/ghost_zone.hh @@ -98,10 +98,10 @@ // given point is a member of both adjacent corners), or split down its // diagonal (so any given point is a member of only one corner). This // 3-phase algorithm is actually implemented by -// patch_system::extend_scalar_gridfn_to_all_ghost_zones() +// patch_system::synchronize_ghost_zones() // which in turn calls -// symmetry_ghost_zone::extend_scalar_gridfn_to_ghost_zone() -// interpatch_ghost_zone::extend_scalar_gridfn_to_ghost_zone() +// symmetry_ghost_zone::synchronize() +// interpatch_ghost_zone::synchronize() // // @@ -226,14 +226,16 @@ class ghost_zone { public: // - // main client interface: set up gridfn data in a ghost zone + // main client interface: "synchronize" a ghost zone, + // i.e. update the ghost-zone values of the specified gridfns + // via the appropriate sequence of symmetry operations + // and interpatch interpolations // (flags specify which part(s) of the ghost zone we want) // - virtual void extend_scalar_gridfn_to_ghost_zone - (int gfn, - bool want_min_par_corner, - bool want_noncorner, - bool want_max_par_corner) + virtual void synchronize(int ghosted_min_gfn, int ghosted_max_gfn, + bool want_min_par_corner, + bool want_noncorner, + bool want_max_par_corner) const = 0; @@ -376,15 +378,18 @@ class symmetry_ghost_zone : public ghost_zone { public: - // high-level client interface: - // set up gridfn data in a ghost zone by symmetry mapping + // + // main client interface: "synchronize" a ghost zone, + // i.e. update the ghost-zone values of the specified gridfns + // via the appropriate symmetry operations // (flags specify which part(s) of the ghost zone we want) - void extend_scalar_gridfn_to_ghost_zone - (int gfn, - bool want_min_par_corner, - bool want_noncorner, - bool want_max_par_corner) - const; + // + void synchronize(int ghosted_min_gfn, int ghosted_max_gfn, + bool want_min_par_corner, + bool want_noncorner, + bool want_max_par_corner) + const + = 0; // low-level client interface: symmetry-map coordinates const patch& symmetry_patch() const { return symmetry_patch_; } @@ -440,7 +445,7 @@ private: // derived class for interpatch ghost zone of a patch // // Note const qualifiers refer to the data stored by -// extend_scalar_gridfn_to_ghost_zone() +// synchronize() // Since there are no nonconst member functions, once an interpatch_ghost_zone // object is contructed, it's effectively always taken as const . // @@ -460,15 +465,18 @@ class interpatch_ghost_zone : public ghost_zone { public: - // high-level client interface: - // set up gridfn data in a ghost zone by symmetry mapping + // + // main client interface: "synchronize" a ghost zone, + // i.e. update the ghost-zone values of the specified gridfns + // via the appropriate interpatch interpolations // (flags specify which part(s) of the ghost zone we want) - void extend_scalar_gridfn_to_ghost_zone - (int gfn, - bool want_min_par_corner, - bool want_noncorner, - bool want_max_par_corner) - const; + // + void synchronize(int ghosted_min_gfn, int ghosted_max_gfn, + bool want_min_par_corner, + bool want_noncorner, + bool want_max_par_corner) + const + = 0; // basic connectivity info const patch& other_patch() const @@ -558,10 +566,6 @@ private: patch& other_patch_; const patch_edge& other_edge_; - // initialized to NULL in constructor, - // set to proper value by set_other_frontier() - patch_frontier *other_frontier_; - // other patch's iperp coordinates of our ghost zone points // ... allocated and initialized in constructor (const thereafter) // ... maps my_iperp --> other_iperp @@ -571,4 +575,13 @@ private: // ... allocated and initialized in constructor (const thereafter) // ... subscripts are (my_iperp, my_ipar) jtutil::array2d<fp> *other_par_; + + // initialized to NULL in constructor, + // set to proper value by set_other_frontier() + patch_frontier *other_frontier_; + + // buffer into which the other patch's patch_frontier object + // will store the interpolated gridfn values + // ... subscripts are (gfn, my_iperp,my_ipar) + jtutil::array3d<fp> }; |