diff options
author | jthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5> | 2002-04-02 17:11:34 +0000 |
---|---|---|
committer | jthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5> | 2002-04-02 17:11:34 +0000 |
commit | f9b9b1e0d2a91d1628bc599e0c31bd710cb815a5 (patch) | |
tree | fb7f4dd76b01f65968c2de7955caaba22ef95786 /src | |
parent | d56cb86b3116873675ff49bf493521be6cb91a1a (diff) |
switch back to explicit set_ghost_zone() and set_patch_frontier()
fns in patch::
git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinAnalysis/AHFinderDirect/trunk@421 f88db872-0e4f-0410-b76b-b9085cfa78c5
Diffstat (limited to 'src')
-rw-r--r-- | src/patch/ghost_zone.cc | 7 | ||||
-rw-r--r-- | src/patch/patch.cc | 115 | ||||
-rw-r--r-- | src/patch/patch.hh | 68 |
3 files changed, 92 insertions, 98 deletions
diff --git a/src/patch/ghost_zone.cc b/src/patch/ghost_zone.cc index 2a5f6c5..71427c1 100644 --- a/src/patch/ghost_zone.cc +++ b/src/patch/ghost_zone.cc @@ -436,8 +436,8 @@ return max_par_adjacent_ghost_zone().is_symmetry() // // We use our ipar as the patch_frontier's parindex. // -void interpatch_ghost_zone::setup_other_frontier(int interp_handle_in, - int interp_par_table_handle_in) +void interpatch_ghost_zone::setup_other_patch_frontier + (int interp_handle_in, int interp_par_table_handle_in) { const other_frontier_ = new patch_frontier(other_edge(), @@ -446,7 +446,8 @@ const other_frontier_ *min_ipar_used_, *max_ipar_used_, *other_par_, interp_handle_in, interp_par_table_handle_in); -other_patch().frontier_ptr_on_edge(other_edge()) = other_frontier_; + +other_patch().set_patch_frontier(other_edge(), other_frontier_); } diff --git a/src/patch/patch.cc b/src/patch/patch.cc index d575f70..62b76b3 100644 --- a/src/patch/patch.cc +++ b/src/patch/patch.cc @@ -10,17 +10,12 @@ // // patch::minmax_ang_ghost_zone // patch::ghost_zone_on_edge -// patch::ghost_zone_ptr -// patch::patch_frontier_ptr +// patch::interpatch_ghost_zone_on_edge // patch::setup_mirror_symmetry_ghost_zone // patch::setup_periodic_symmetry_ghost_zone // patch::setup_interpatch_ghost_zone // patch::set_ghost_zone -// patch::minmax_ang_ghost_zone -// patch::ghost_zone_on_edge -// patch::frontier_ptr_on_edge // patch::edge_adjacent_to_patch -// patch::interpatch_ghost_zone_on_edge // patch::assert_all_ghost_zones_fully_setup // // patch::print_gridfn @@ -199,47 +194,17 @@ return minmax_ang_ghost_zone(edge.is_min(), edge.is_rho()); //****************************************************************************** // -// This function returns a reference to the specified ghost zone -// pointer data member of this patch, asserting that the current -// value of this pointer is NULL. This is used (only) by -// patch::setup_*_ghost_zone() -// to set the ghost zone pointers; the assert() ensures that it can't -// be used to overwrite a non-NULL pointer. -// -ghost_zone*& patch::ghost_zone_ptr(const patch_edge& edge) -{ -assert(& edge.my_patch() == this); - -ghost_zone*& gzp = edge.is_min() ? (edge.is_rho() ? min_rho_ghost_zone_ - : min_sigma_ghost_zone_) - : (edge.is_rho() ? max_rho_ghost_zone_ - : max_sigma_ghost_zone_); -assert(gzp == NULL); -return gzp; -} - -//****************************************************************************** - -// -// This function returns a reference to the specified patch frontier -// pointer data member of this patch, asserting that the current -// value of this pointer is NULL. This is used (only) by the other -// patch's -// interpatch_ghost_zone::setup_other_frontier() -// to set this patch's patch frontier pointers; the assert() ensures that -// it can't be used to overwrite a non-NULL pointer. +// This function verifies that the ghost zone on a specified edge +// is indeed interpatch, and returns a reference to it as an +// interpatch_ghost_zone . // -patch_frontier*& patch::patch_frontier_ptr(const patch_edge& edge) +interpatch_ghost_zone& patch::interpatch_ghost_zone_on_edge + (const patch_edge &e) + const { -assert(& edge.my_patch() == this); - -patch_frontier*& pfp - = edge.is_min() ? (edge.is_rho() ? min_rho_patch_frontier_ - : min_sigma_patch_frontier_) - : (edge.is_rho() ? max_rho_patch_frontier_ - : max_sigma_patch_frontier_); -assert(pfp == NULL); -return pfp; +ghost_zone &g = ghost_zone_on_edge(e); +assert(g.is_interpatch()); +return static_cast<interpatch_ghost_zone &>(g); } //****************************************************************************** @@ -257,7 +222,7 @@ symmetry_ghost_zone& patch::setup_mirror_symmetry_ghost_zone assert(& my_edge.my_patch() == this); symmetry_ghost_zone *temp = new symmetry_ghost_zone(my_edge); -set_ghost_zone(temp, my_edge); +set_ghost_zone(my_edge, temp); return *temp; } @@ -285,7 +250,7 @@ symmetry_ghost_zone *temp = new symmetry_ghost_zone(my_edge, symmetry_edge, my_sample_ipar, symmetry_sample_ipar, is_ipar_map_plus); -ghost_zone_ptr(my_edge) = temp; +set_ghost_zone(my_edge, temp); return *temp; } @@ -307,13 +272,51 @@ assert(& my_edge.my_patch() == this); interpatch_ghost_zone *temp = new interpatch_ghost_zone(my_edge, other_edge, N_overlap_points); -ghost_zone_ptr(my_edge) = temp; +set_ghost_zone(my_edge, temp); return *temp; } //****************************************************************************** // +// This is a helper function for setup_*_ghost_zone(). This function +// assert()s that one of the ghost zone pointers (which one is selected +// by edge ) is NULL, then stores a value in it. +// +void patch::set_ghost_zone(const patch_edge& edge, ghost_zone* gzp) +{ +ghost_zone*& gzp + = edge.is_min() + ? (edge.is_rho() ? min_rho_ghost_zone_ : min_sigma_ghost_zone_) + : (edge.is_rho() ? max_rho_ghost_zone_ : max_sigma_ghost_zone_); + +assert(gzp == NULL); +gzp = gzp; +} + +//****************************************************************************** + +// +// This is a helper function for (our friend) +// interpatch_ghost_zone::setup_other_patch_frontier(). +// This function assert()s that one of the patch frontier pointers +// (which one is selected by edge ) is NULL, then stores a value in it. +// +void patch::set_patch_frontier(const patch_edge& edge, patch_frontier* pfp) +{ +patch_frontier*& pfp = edge.is_min() + ? (edge.is_rho() ? min_rho_patch_frontier_ + : min_sigma_patch_frontier_) + : (edge.is_rho() ? max_rho_patch_frontier_ + : max_sigma_patch_frontier_); + +assert(pfp == NULL); +pfp = pfp; +} + +//****************************************************************************** + +// // This function finds which patch edge is adjacent to a neighboring // patch q, or does an error_exit() if q isn't actually a neighboring patch. // The computation is done using only (rho,sigma) coordinate sets and @@ -420,22 +423,6 @@ return p.minmax_ang_patch_edge(common_is_p_min_q_max, common_is_p_rho); //****************************************************************************** // -// This function verifies that the ghost zone on a specified edge -// is indeed interpatch, and returns a reference to it as an -// interpatch_ghost_zone . -// -interpatch_ghost_zone& patch::interpatch_ghost_zone_on_edge - (const patch_edge &e) - const -{ -ghost_zone &g = ghost_zone_on_edge(e); -assert(g.is_interpatch()); -return static_cast<interpatch_ghost_zone &>(g); -} - -//****************************************************************************** - -// // This function verifies (via assert()) that all ghost zones of this // patch, and all frontiers to which they should point, have been fully // set up. diff --git a/src/patch/patch.hh b/src/patch/patch.hh index 338acf7..a04bb99 100644 --- a/src/patch/patch.hh +++ b/src/patch/patch.hh @@ -296,35 +296,14 @@ public: ghost_zone& minmax_ang_ghost_zone(bool want_min, bool want_rho) const; ghost_zone& ghost_zone_on_edge(const patch_edge &edge) const; - - // - // ***** access to ghost zone/frontier pointers ***** - // -private: - // these are used by members/friends only for setup - // they return references to our ghost zone/frontier pointers - // ... used only from patch::setup_*_ghost_zone() - const ghost_zone*& ghost_zone_ptr (const patch_edge& edge) const; - // ... used only from (friend) - // interpatch_ghost_zone::setup_other_frontier() - const patch_frontier*& patch_frontier_ptr(const patch_edge& edge) const; - friend interpatch_ghost_zone::setup_other_frontier - (int interp_handle_in, int interp_par_table_handle_in); - -private: - // helper function for setup_*_ghost_zone(): - // assert() that ghost zone pointer on specified edge is NULL - // (i.e. that we haven't already setup this ghost zone), - // then assign new value to it - void set_ghost_zone(ghost_zone* gzp, const patch_edge& edge); - -public: - // get *interpatch* ghost zone on specified edge - // ... verifies that ghost zone is indeed interpatch + // get ghost zone on specified edge, verify that it is indeed + // interpatch, static_cast<> to interpatch_ghost_zone ptr interpatch_ghost_zone& interpatch_ghost_zone_on_edge (const patch_edge &e) const; + + // // ***** set up ghost zone and frontier subobjects // @@ -356,6 +335,23 @@ public: // are fully setup void assert_all_ghost_zones_fully_setup() const; + // + // ***** access to ghost zone/frontier pointers ***** + // + +private: + // helper function for setup_*_ghost_zone(): + // assert() that ghost zone pointer on specified edge is NULL + // (i.e. that we haven't already setup this ghost zone), + // then assign new value to it + void set_ghost_zone(const patch_edge& edge, ghost_zone* gzp); + + // helper function for (friend) + // interpatch_ghost_zone::setup_other_patch_frontier(): + // assert() that patch frontier pointer on specified edge is NULL + // (i.e. that we haven't already setup this patch frontier), + // then assign new value to it + void set_patch_frontier(const patch_edge& edge, patch_frontier *pfp); // // ***** constructor, destructor, et al ***** @@ -378,6 +374,12 @@ public: virtual ~patch(); + // + // ***** friends ***** + // + friend interpatch_ghost_zone::setup_other_patch_frontier + (int interp_handle_in, int interp_par_table_handle_in); + private: // we forbid copying and passing by value // by declaring the copy constructor and assignment operator @@ -408,18 +410,22 @@ private: const patch_edge& max_sigma_patch_edge_; // ghost zones - // ... pointers are initialized by - // setup_mirror_symmetry_ghost_zone() - // setup_periodic_symmetry_ghost_zone() - // setup_interpatch_ghost_zone() + // ... pointers are set to NULL by ctor, + // reset to non-NULL by set_ghost_zone(), which is called by + // setup_mirror_symmetry_ghost_zone() + // setup_periodic_symmetry_ghost_zone() + // setup_interpatch_ghost_zone() ghost_zone* min_rho_ghost_zone_; ghost_zone* max_rho_ghost_zone_, ghost_zone* min_sigma_ghost_zone_, ghost_zone* max_sigma_ghost_zone_; // frontiers (NULL pointers if no frontier for this ghost zone) - // ... pointers are by other patch's - // interpatch_ghost_zone::setup_other_frontier() + // ... pointers are set to NULL by ctor, + // reset for those cases where there *is* a frontier by + // set_patch_frontier(), which is called by the *other* patch's + // interpatch_ghost_zone::setup_other_patch_frontier() + // const patch_frontier* min_rho_patch_frontier_, const patch_frontier* max_rho_patch_frontier_, const patch_frontier* min_sigma_patch_frontier_, |