aboutsummaryrefslogtreecommitdiff
path: root/src/patch/patch.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/patch/patch.cc')
-rw-r--r--src/patch/patch.cc127
1 files changed, 88 insertions, 39 deletions
diff --git a/src/patch/patch.cc b/src/patch/patch.cc
index 6f7b524..d575f70 100644
--- a/src/patch/patch.cc
+++ b/src/patch/patch.cc
@@ -8,12 +8,18 @@
// x_patch::x_patch
// y_patch::y_patch
//
+// patch::minmax_ang_ghost_zone
+// patch::ghost_zone_on_edge
+// patch::ghost_zone_ptr
+// patch::patch_frontier_ptr
// patch::setup_mirror_symmetry_ghost_zone
// patch::setup_periodic_symmetry_ghost_zone
// patch::setup_interpatch_ghost_zone
// patch::set_ghost_zone
-// patch::edge_adjacent_to_patch
+// 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
//
@@ -165,6 +171,80 @@ y_patch::y_patch(patch_system &my_patch_system_in, int patch_number_in,
//******************************************************************************
//
+// This function returns a reference to the specified ghost zone
+// of this patch.
+//
+ghost_zone& patch::minmax_ang_ghost_zone(bool want_min, bool want_rho)
+ const
+{
+return want_min ? (want_rho ? min_rho_ghost_zone()
+ : min_sigma_ghost_zone())
+ : (want_rho ? max_rho_ghost_zone()
+ : max_sigma_ghost_zone());
+}
+
+//******************************************************************************
+
+//
+// This function returns a reference to the specified ghost zone
+// of this patch.
+//
+ghost_zone& patch::ghost_zone_on_edge(const patch_edge &edge)
+const
+{
+assert(& edge.my_patch() == this);
+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.
+//
+patch_frontier*& patch::patch_frontier_ptr(const patch_edge& edge)
+{
+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;
+}
+
+//******************************************************************************
+
+//
// This function assert()s that a specified ghost zone of this patch
// hasn't already been set up, then sets it up as a mirror-symmetry
// ghost zone. It returns a reference to the newly-set-up symmetry
@@ -191,22 +271,21 @@ return *temp;
//
symmetry_ghost_zone& patch::setup_periodic_symmetry_ghost_zone
(const patch_edge& my_edge, const patch_edge& symmetry_edge,
- bool ipar_map_is_plus)
+ bool is_ipar_map_plus)
{
// make sure we belong to the right patch
assert(& my_edge.my_patch() == this);
int my_sample_ipar = my_edge.min_ipar_without_corners();
int symmetry_sample_ipar
- = ipar_map_is_plus ? symmetry_edge.min_ipar_without_corners()
+ = is_ipar_map_plus ? symmetry_edge.min_ipar_without_corners()
: symmetry_edge.max_ipar_without_corners();
symmetry_ghost_zone *temp
- = new symmetry_ghost_zone(my_edge, symmetry_edge,
- my_sample_ipar, symmetry_sample_ipar,
- ipar_map_is_plus);
-set_ghost_zone(temp, my_edge);
-
+ = new symmetry_ghost_zone(my_edge, symmetry_edge,
+ my_sample_ipar, symmetry_sample_ipar,
+ is_ipar_map_plus);
+ghost_zone_ptr(my_edge) = temp;
return *temp;
}
@@ -228,31 +307,13 @@ assert(& my_edge.my_patch() == this);
interpatch_ghost_zone *temp
= new interpatch_ghost_zone(my_edge, other_edge,
N_overlap_points);
-set_ghost_zone(temp, my_edge);
+ghost_zone_ptr(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 is NULL, then stores a
-// value in it.
-//
-void patch::set_ghost_zone(ghost_zone* gzp, const patch_edge& my_edge)
-{
-ghost_zone*& my_gzp
- = my_edge.is_min()
- ? (my_edge.is_rho() ? min_rho_ghost_zone_ : min_sigma_ghost_zone_)
- : (my_edge.is_rho() ? max_rho_ghost_zone_ : max_sigma_ghost_zone_);
-
-assert(my_gzp == NULL);
-my_gzp = gzp;
-}
-
-//******************************************************************************
-
-//
// 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
@@ -359,18 +420,6 @@ return p.minmax_ang_patch_edge(common_is_p_min_q_max, common_is_p_rho);
//******************************************************************************
//
-// This function returns a reference to the ghost zone on a specified
-// edge of this patch.
-//
-ghost_zone& patch::ghost_zone_on_edge(const patch_edge &e) const
-{
-assert(& e.my_patch() == this);
-return minmax_ang_ghost_zone(e.is_min(), e.is_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 .