aboutsummaryrefslogtreecommitdiff
path: root/src/patch
diff options
context:
space:
mode:
authorjthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5>2002-10-28 16:09:33 +0000
committerjthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5>2002-10-28 16:09:33 +0000
commit173443467ee6bd59f78e1c8e413e9ffe2aaac55d (patch)
treeb2bc76bd9753f0ba4bbf5c280c01322c61eaa4d7 /src/patch
parent9fdede2787190b0401f938c62f543931d2ec413a (diff)
* change implementation of operator==()
to check addresses rather than just patch numbers ==> will now work properly even on patches from different patch systems * rename ghost_zone_containing_point() to ghost_zone_containing_noncorner_point() and add explicit check that point isn't in corner git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinAnalysis/AHFinderDirect/trunk@865 f88db872-0e4f-0410-b76b-b9085cfa78c5
Diffstat (limited to 'src/patch')
-rw-r--r--src/patch/patch.cc41
-rw-r--r--src/patch/patch.hh6
2 files changed, 28 insertions, 19 deletions
diff --git a/src/patch/patch.cc b/src/patch/patch.cc
index e843d03..7693826 100644
--- a/src/patch/patch.cc
+++ b/src/patch/patch.cc
@@ -16,7 +16,7 @@
//
// patch::ghost_zone_on_edge
// patch::corner_ghost_zone_containing_point
-// patch::ghost_zone_containing_point
+// patch::ghost_zone_containing_noncorner_point
// patch::create_mirror_symmetry_ghost_zone
// patch::create_periodic_symmetry_ghost_zone
// patch::create_interpatch_ghost_zone
@@ -416,7 +416,7 @@ default:
ghost_zone& patch::ghost_zone_on_edge(const patch_edge& e)
const
{
-assert(& e.my_patch() == this);
+assert(e.my_patch() == *this);
return minmax_ang_ghost_zone(e.is_min(), e.is_rho());
}
@@ -425,7 +425,8 @@ return minmax_ang_ghost_zone(e.is_min(), e.is_rho());
//
// This function determines which of the two adjacent ghost zones meeting
// at a specified corner, contains a specified point. If the point isn't
-// in either ghost zone, an abort(0) is done.
+// in either ghost zone, an error_exit() is done. If the point is in both
+// ghost zones, it's arbitrary which one will be chosen.
//
// Arguments:
// {rho,sigma}_is_min = Specify the corner (and implicitly the ghost zones).
@@ -454,8 +455,16 @@ const bool is_in_rho_ghost_zone
const bool is_in_sigma_ghost_zone
= sigma_gz.is_in_ghost_zone(sigma_iperp, sigma_ipar);
-// check that point is in exactly one ghost zone
-assert(is_in_rho_ghost_zone ^ is_in_sigma_ghost_zone);
+// check that point is in at least one ghost zone
+if (!is_in_rho_ghost_zone && !is_in_sigma_ghost_zone)
+ then error_exit(ERROR_EXIT,
+"***** patch::corner_ghost_zone_containing_point():\n"
+" neither ghost zone contains point (this should never happen)!\n"
+" patch=%s rho_is_min=(int)%d sigma_is_min=(int)%d\n"
+" irho=%d isigma=%d\n"
+,
+ name(), int(rho_is_min), int(sigma_is_min),
+ irho, isigma); /*NOTREACHED*/
return is_in_rho_ghost_zone ? rho_gz : sigma_gz;
}
@@ -463,19 +472,18 @@ return is_in_rho_ghost_zone ? rho_gz : sigma_gz;
//******************************************************************************
//
-// This function determines which ghost zone contains a specified point.
-// For a corner point between two symmetry ghost zones, it's unspecified
-// which ghost zone will be chosen.
+// This function determines which ghost zone contains a specified
+// noncorner point.
//
-// If the point isn't in any ghost zone of this patch, an error_exit()
-// is done.
+// If the point isn't in any ghost zone of this patch, or if the point
+// is in the corner of a ghost zone, an error_exit() is done.
//
// Arguments:
// irho,isigma = Specify the point.
//
// Results:
// This function returns (a reference to) the desired ghost zone.
-ghost_zone& patch::ghost_zone_containing_point(int irho, int isigma)
+ghost_zone& patch::ghost_zone_containing_noncorner_point(int irho, int isigma)
const
{
// n.b. these loops must use _int_ variables for the loop
@@ -489,13 +497,14 @@ ghost_zone& patch::ghost_zone_containing_point(int irho, int isigma)
const int ipar = e.ipar_of_irho_isigma (irho, isigma);
ghost_zone& gz = minmax_ang_ghost_zone(want_min, want_rho);
- if (gz.is_in_ghost_zone(iperp, ipar))
+ if ( gz.is_in_ghost_zone(iperp, ipar)
+ && gz.my_edge().ipar_is_in_noncorner(ipar) )
then return gz;
}
}
error_exit(ERROR_EXIT,
-"***** patch::ghost_zone_containing_point():\n"
+"***** patch::ghost_zone_containing_noncorner_point():\n"
" no ghost zone contains point (this should never happen)!\n"
" patch=%s irho=%d isigma=%d\n"
,
@@ -512,7 +521,7 @@ error_exit(ERROR_EXIT,
void patch::create_mirror_symmetry_ghost_zone(const patch_edge& my_edge)
{
// make sure we belong to the right patch
-assert(& my_edge.my_patch() == this);
+assert(my_edge.my_patch() == *this);
symmetry_ghost_zone *temp = new symmetry_ghost_zone(my_edge);
set_ghost_zone(my_edge, temp);
@@ -530,7 +539,7 @@ void patch::create_periodic_symmetry_ghost_zone
bool is_ipar_map_plus)
{
// make sure we belong to the right patch
-assert(& my_edge.my_patch() == this);
+assert(my_edge.my_patch() == *this);
int my_sample_ipar = my_edge.min_ipar_without_corners();
int other_sample_ipar = is_ipar_map_plus
@@ -557,7 +566,7 @@ void patch::create_interpatch_ghost_zone
int N_overlap_points)
{
// make sure we belong to the right patch
-assert(& my_edge.my_patch() == this);
+assert(my_edge.my_patch() == *this);
interpatch_ghost_zone *temp
= new interpatch_ghost_zone(my_edge, other_edge,
diff --git a/src/patch/patch.hh b/src/patch/patch.hh
index aa64e0d..56300a9 100644
--- a/src/patch/patch.hh
+++ b/src/patch/patch.hh
@@ -162,7 +162,7 @@ public:
// are two patches really the same patch?
// n.b. this does *not* compare any of the gridfn data!
bool operator==(const patch& other_patch) const
- { return patch_number() == other_patch.patch_number(); }
+ { return this == &other_patch; }
bool operator!=(const patch& other_patch) const
{ return ! operator==(other_patch); }
@@ -475,8 +475,8 @@ public:
int irho, int isigma) // specifies point
const;
- // which ghost zone contains a specified point?
- ghost_zone& ghost_zone_containing_point(int irho, int isigma)
+ // which ghost zone contains a specified noncorner point?
+ ghost_zone& ghost_zone_containing_noncorner_point(int irho, int isigma)
const;