aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5>2001-07-15 14:48:46 +0000
committerjthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5>2001-07-15 14:48:46 +0000
commitd42423a91ff6c8839793be7fdf2490475b15f820 (patch)
tree9380063fcd6626655cd20850ad6d0e86d23fa83e
parent37110df5932dd646c591b758b5a57e3a4abada0d (diff)
add patch::edge_adjacent_to_patch()
git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinAnalysis/AHFinderDirect/trunk@156 f88db872-0e4f-0410-b76b-b9085cfa78c5
-rw-r--r--src/patch/patch.cc69
-rw-r--r--src/patch/patch.hh5
2 files changed, 74 insertions, 0 deletions
diff --git a/src/patch/patch.cc b/src/patch/patch.cc
index 5f20b10..aee20f6 100644
--- a/src/patch/patch.cc
+++ b/src/patch/patch.cc
@@ -7,6 +7,7 @@
// z_patch::z_patch
// x_patch::x_patch
// y_patch::y_patch
+// patch::edge_adjacent_to_patch
//
// patch::setup_mirror_symmetry_ghost_zone
// patch::setup_periodic_symmetry_ghost_zone
@@ -146,6 +147,74 @@ y_patch::y_patch(patch_system &my_patch_system_in, int patch_number_in,
grid_array_pars_in, pars_in, N_gridfns_in)
//*****************************************************************************
+
+//
+// This function finds which patch edge is adjacent to a neighboring
+// patch q, or do an error_exit() if q isn't actually a neighboring patch.
+// The computation is done using only (rho,sigma) coordinate sets and
+// min/max dang bounds ==> it's ok to use this function in setting up
+// interpatch ghost zones.
+//
+const patch_edge& patch::edge_adjacent_to_patch(const patch &q) const
+{
+const patch &p = *this;
+
+// which (rho,sigma) coordinate do the patches have in common?
+local_coords::coords_set common_coord_set
+ = p.coords_set_rho_sigma() & q.coords_set_rho_sigma()
+
+// is this coordinate rho or sigma in each patch?
+bool common_is_p_rho = common_coord_set == p.coords_set_rho ();
+bool common_is_p_sigma = common_coord_set == p.coords_set_sigma();
+if ((common_is_p_rho ^ common_is_p_sigma) != 0x1)
+ then error_exit(ERROR_EXIT,
+"***** patch::edge_adjacent_to_patch():\n"
+" common coordinate isn't exactly one of p.{rho,sigma}!\n",
+" p.name()=\"%s\" q.name()=\"%s\"\n"
+" common_coord_set=%s\n"
+" common_is_p_rho=%d common_is_p_sigma=%d\n"
+,
+ p.name(), q.name(),
+ local_coords::name_of_coords_set(common_coord_set),
+ int(common_is_p_rho), int(common_is_p_sigma));
+ /*NOTREACHED*/
+bool common_is_q_rho = common_coord_set == q.coords_set_rho ();
+bool common_is_q_sigma = common_coord_set == q.coords_set_sigma();
+if ((common_is_q_rho ^ common_is_q_sigma) != 0x1)
+ then error_exit(ERROR_EXIT,
+"***** patch::edge_adjacent_to_patch():\n"
+" common coordinate isn't exactly one of q.{rho,sigma}!\n",
+" p.name()=\"%s\" q.name()=\"%s\"\n"
+" common_coord_set=%s\n"
+" common_is_q_rho=%d common_is_q_sigma=%d\n"
+,
+ p.name(), q.name(),
+ local_coords::name_of_coords_set(common_coord_set),
+ int(common_is_q_rho), int(common_is_q_sigma));
+ /*NOTREACHED*/
+
+// is the common boundary min/max in each patch?
+bool common_is_p_min_q_max
+ = fuzzy_EQ(p.min_dang(common_is_p_rho), q.max_dang(common_is_q_rho));
+bool common_is_p_max_q_min
+ = fuzzy_EQ(p.max_dang(common_is_p_rho), q.min_dang(common_is_q_rho));
+if ((common_is_p_min_q_max ^ common_is_p_max_q_min) != 0x1)
+ then error_exit(ERROR_EXIT,
+"***** patch::edge_adjacent_to_patch():\n"
+" common coordinate isn't exactly one of {pmax/qmin, pmin/qmax}!\n"
+" p.name()=\"%s\" q.name()=\"%s\"\n"
+" common_coord_set=%s\n"
+" common_is_p_min_q_max=%d common_is_p_max_q_min=%d\n"
+,
+ p.name(), q.name(),
+ local_coords::name_of_coords_set(common_coord_set),
+ int(common_is_p_min_q_max), int(common_is_p_max_q_min));
+ /*NOTREACHED*/
+
+return p.minmax_ang_patch_edge(common_is_p_min_q_max, common_is_p_rho);
+}
+
+//*****************************************************************************
//*****************************************************************************
//*****************************************************************************
diff --git a/src/patch/patch.hh b/src/patch/patch.hh
index 5e8a9c8..97b56da 100644
--- a/src/patch/patch.hh
+++ b/src/patch/patch.hh
@@ -250,6 +250,11 @@ public:
: max_sigma_patch_edge());
}
+ // find which patch edge is adjacent to neighboring patch,
+ // or error_exit() if it's not actually a neighboring patch
+ // ... computation done using only (rho,sigma) coordinate sets
+ // and min/max dang bounds ==> ok to use in setting up ghost zones
+ const patch_edge& edge_adjacent_to_patch(const patch& q) const;
//
// ***** ghost zones *****