aboutsummaryrefslogtreecommitdiff
path: root/src/patch
diff options
context:
space:
mode:
authorjthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5>2002-07-31 13:11:58 +0000
committerjthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5>2002-07-31 13:11:58 +0000
commita0ba9bc968a79217530f1ff025fff3e6cb9c91ad (patch)
tree9d54275ca6cfe5e595e64cc0458c36689f5e2022 /src/patch
parent139929ef530c0e38eb51e8984f65a170f8041933 (diff)
since we always use the want_{min,max}_par_corner flags with the same
values in patch_system::synchronize() --> ghost_zone::synchronize(), merge them together --> ghost_zone::synchronize() now takes just want_corners() and want_non_corner() flags also slightly tidy the logic in interpatch_ghost_zone::synchronize() and interpatch_ghost_zone::synchronize_Jacobian(), since we only have to check 2 flags instead of 3 git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinAnalysis/AHFinderDirect/trunk@675 f88db872-0e4f-0410-b76b-b9085cfa78c5
Diffstat (limited to 'src/patch')
-rw-r--r--src/patch/ghost_zone.cc77
-rw-r--r--src/patch/ghost_zone.hh40
-rw-r--r--src/patch/patch_edge.hh30
-rw-r--r--src/patch/patch_system.cc10
-rw-r--r--src/patch/patch_system.hh5
5 files changed, 63 insertions, 99 deletions
diff --git a/src/patch/ghost_zone.cc b/src/patch/ghost_zone.cc
index 939d345..1b4ba11 100644
--- a/src/patch/ghost_zone.cc
+++ b/src/patch/ghost_zone.cc
@@ -12,7 +12,6 @@
// interpatch_ghost_zone::[min,max]_ipar
// interpatch_ghost_zone::finish_setup
// interpatch_ghost_zone::assert_fully_setup
-// interpatch_ghost_zone::verify_caller_wants_all_of_ghost_zone
// interpatch_ghost_zone::synchronize
// interpatch_ghost_zone::compute_Jacobian
//
@@ -122,9 +121,8 @@ delete iperp_map_;
// we want.
//
void symmetry_ghost_zone::synchronize(int ghosted_min_gfn, int ghosted_max_gfn,
- bool want_min_par_corner = true,
- bool want_non_corner = true,
- bool want_max_par_corner = true)
+ bool want_corners = true,
+ bool want_non_corner = true)
{
for (int gfn = ghosted_min_gfn ; gfn <= ghosted_max_gfn ; ++gfn)
{
@@ -133,10 +131,8 @@ void symmetry_ghost_zone::synchronize(int ghosted_min_gfn, int ghosted_max_gfn,
for (int ipar = min_ipar(iperp) ; ipar <= max_ipar(iperp) ; ++ipar)
{
// do we want to do this point?
- if (! my_edge().ipar_is_in_selected_corner(want_min_par_corner,
- want_non_corner,
- want_max_par_corner,
- ipar) )
+ if (! my_edge().ipar_is_in_selected_part(want_corners, want_non_corner,
+ ipar) )
then continue; // *** LOOP CONTROL ***
const int sym_iperp = iperp_map_of_iperp(iperp);
@@ -498,35 +494,6 @@ assert( my_patch() == other_patch()
//******************************************************************************
//
-// This function verifies (no-op if ok, error_exit() if not) that the
-// caller wants to operate on the entire ghost zone, since our implementations
-// of synchronize() and compute_Jacobian() only support this case.
-//
-void interpatch_ghost_zone::verify_caller_wants_all_of_ghost_zone
- (bool want_min_par_corner,
- bool want_non_corner,
- bool want_max_par_corner)
- const
-{
-// make sure the caller wants the entire ghost zone
-if (! (want_min_par_corner && want_non_corner && want_max_par_corner))
- then error_exit(ERROR_EXIT,
-"***** interpatch_ghost_zone::verify_caller_wants_all_of_ghost_zone():\n"
-" our implementations of synchronize() and compute_Jacobian()\n"
-" only support operating on the *entire* ghost zone,\n"
-" but we were passed flags specifying a proper subset!\n"
-" want_min_par_corner=(int)%d\n"
-" want_non_corner=(int)%d\n"
-" want_max_par_corner=(int)%d\n"
-,
- want_min_par_corner,
- want_non_corner,
- want_max_par_corner); /*NOTREACHED*/
-}
-
-//******************************************************************************
-
-//
// This function "synchronizes" a ghost zone, i.e. it updates the
// ghost-zone values of the specified gridfns via the appropriate
// interpatch interpolations.
@@ -537,13 +504,18 @@ if (! (want_min_par_corner && want_non_corner && want_max_par_corner))
//
void interpatch_ghost_zone::synchronize
(int ghosted_min_gfn, int ghosted_max_gfn,
- bool want_min_par_corner = true,
- bool want_non_corner = true,
- bool want_max_par_corner = true)
+ bool want_corners = true,
+ bool want_non_corner = true)
{
-verify_caller_wants_all_of_ghost_zone(want_min_par_corner,
- want_non_corner,
- want_max_par_corner);
+// make sure the caller wants the entire ghost zone
+if (! (want_corners && want_non_corner))
+ then error_exit(ERROR_EXIT,
+"***** interpatch_ghost_zone::synchronize():\n"
+" we only support operating on the *entire* ghost zone,\n"
+" but we were passed flags specifying a proper subset!\n"
+" want_corners=(int)%d want_non_corner=(int)%d\n"
+,
+ want_corners, want_non_corner); /*NOTREACHED*/
// do the interpolation into our result buffer
other_patch_interp_->interpolate(ghosted_min_gfn, ghosted_max_gfn,
@@ -582,16 +554,21 @@ other_patch_interp_->interpolate(ghosted_min_gfn, ghosted_max_gfn,
//
void interpatch_ghost_zone::compute_Jacobian
(int ghosted_min_gfn, int ghosted_max_gfn,
- bool want_min_par_corner = true,
- bool want_non_corner = true,
- bool want_max_par_corner = true)
+ bool want_corners = true,
+ bool want_non_corner = true)
const
{
-verify_caller_wants_all_of_ghost_zone(want_min_par_corner,
- want_non_corner,
- want_max_par_corner);
-assert(other_patch_interp_ != NULL);
+// make sure the caller wants the entire ghost zone
+if (! (want_corners && want_non_corner))
+ then error_exit(ERROR_EXIT,
+"***** interpatch_ghost_zone::compute_Jacobian():\n"
+" we only support operating on the *entire* ghost zone,\n"
+" but we were passed flags specifying a proper subset!\n"
+" want_corners=(int)%d want_non_corner=(int)%d\n"
+,
+ want_corners, want_non_corner); /*NOTREACHED*/
+assert(other_patch_interp_ != NULL);
other_patch_interp_->verify_Jacobian_sparsity_pattern_ok();
other_patch_interp_->molecule_minmax_ipar_m(Jacobian_min_y_ipar_m_,
diff --git a/src/patch/ghost_zone.hh b/src/patch/ghost_zone.hh
index 5db2c52..4496d55 100644
--- a/src/patch/ghost_zone.hh
+++ b/src/patch/ghost_zone.hh
@@ -234,9 +234,8 @@ public:
// (flags specify which part(s) of the ghost zone we want)
//
virtual void synchronize(int ghosted_min_gfn, int ghosted_max_gfn,
- bool want_min_par_corner = true,
- bool want_noncorner = true,
- bool want_max_par_corner = true)
+ bool want_corners = true,
+ bool want_noncorner = true)
= 0;
@@ -263,9 +262,8 @@ public:
// partial gridfn at y
//
virtual void compute_Jacobian(int ghosted_min_gfn, int ghosted_max_gfn,
- bool want_min_par_corner = true,
- bool want_noncorner = true,
- bool want_max_par_corner = true)
+ bool want_corners = true,
+ bool want_noncorner = true)
const
= 0;
@@ -486,9 +484,8 @@ public:
// (flags specify which part(s) of the ghost zone we want)
//
void synchronize(int ghosted_min_gfn, int ghosted_max_gfn,
- bool want_min_par_corner = true,
- bool want_noncorner = true,
- bool want_max_par_corner = true);
+ bool want_corners = true,
+ bool want_noncorner = true);
//
// ***** Jacobian of synchronize() *****
@@ -502,9 +499,8 @@ public:
// allocate internal buffers, compute Jacobian
// ... this function is a no-op in this class
void compute_Jacobian(int ghosted_min_gfn, int ghosted_max_gfn,
- bool want_min_par_corner = true,
- bool want_noncorner = true,
- bool want_max_par_corner = true)
+ bool want_corners = true,
+ bool want_noncorner = true)
const
{ }
@@ -634,9 +630,8 @@ public:
// all of the flags are set
//
void synchronize(int ghosted_min_gfn, int ghosted_max_gfn,
- bool want_min_par_corner = true,
- bool want_noncorner = true,
- bool want_max_par_corner = true);
+ bool want_corners = true,
+ bool want_noncorner = true);
//
// ***** Jacobian of synchronize() *****
@@ -653,9 +648,8 @@ public:
// all of the flags are set
//
void compute_Jacobian(int ghosted_min_gfn, int ghosted_max_gfn,
- bool want_min_par_corner = true,
- bool want_noncorner = true,
- bool want_max_par_corner = true)
+ bool want_corners = true,
+ bool want_noncorner = true)
const;
// to which patch/edge do the y points in this Jacobian row belong?
@@ -695,16 +689,6 @@ public:
return (*Jacobian_buffer_)(y_iperp, x_ipar, y_ipar_m);
}
-private:
- // helper function for synchronize() and compute_Jacobian():
- // verify (no-op if ok, error_exit() if not) that caller wants
- // to operate on the entire ghost zone, since our implementations
- // of synchronize() and compute_Jacobian() only support this case
- void verify_caller_wants_all_of_ghost_zone(bool want_min_par_corner,
- bool want_non_corner,
- bool want_max_par_corner)
- const;
-
//
// ***** low-level client interface *****
diff --git a/src/patch/patch_edge.hh b/src/patch/patch_edge.hh
index 6140172..4538fda 100644
--- a/src/patch/patch_edge.hh
+++ b/src/patch/patch_edge.hh
@@ -207,11 +207,6 @@ public:
{ return max_ipar_with_corners(); }
// membership predicates for ipar corners, non-corners
- bool ipar_is_in_non_corner(int ipar) const
- {
- return (ipar >= min_ipar_without_corners())
- && (ipar <= max_ipar_without_corners());
- }
bool ipar_is_in_min_ipar_corner(int ipar) const
{
return (ipar >= min_ipar_corner__min_ipar())
@@ -222,19 +217,26 @@ public:
return (ipar >= max_ipar_corner__min_ipar())
&& (ipar <= max_ipar_corner__max_ipar());
}
+ bool ipar_is_in_corner(int ipar) const
+ {
+ return ipar_is_in_min_ipar_corner(ipar)
+ || ipar_is_in_max_ipar_corner(ipar);
+ }
+ bool ipar_is_in_non_corner(int ipar) const
+ {
+ return (ipar >= min_ipar_without_corners())
+ && (ipar <= max_ipar_without_corners());
+ }
- // convenience function selecting amongst the above three
+ // convenience function selecting amongst the above
// membership predicates
- bool ipar_is_in_selected_corner(bool want_min_par_corner,
- bool want_non_corner,
- bool want_max_par_corner,
- int ipar)
+ bool ipar_is_in_selected_part(bool want_corners,
+ bool want_non_corner,
+ int ipar)
const
{
- return
- (want_min_par_corner && ipar_is_in_min_ipar_corner(ipar))
- || (want_non_corner && ipar_is_in_non_corner (ipar))
- || (want_max_par_corner && ipar_is_in_max_ipar_corner(ipar));
+ return (want_corners && ipar_is_in_corner (ipar))
+ || (want_non_corner && ipar_is_in_non_corner(ipar));
}
// outer (farthest from patch center) iperp of nominal grid
diff --git a/src/patch/patch_system.cc b/src/patch/patch_system.cc
index a824e4a..473bcaa 100644
--- a/src/patch/patch_system.cc
+++ b/src/patch/patch_system.cc
@@ -1138,9 +1138,8 @@ void patch_system::synchronize(int ghosted_min_gfn_to_sync,
if (gz.is_symmetry())
then gz.synchronize(ghosted_min_gfn_to_sync,
ghosted_max_gfn_to_sync,
- false, // want min-par corner?
- true, // want non-corner?
- false); // want max-par corner?
+ false, // want corners?
+ true); // want non-corner?
}
}
}
@@ -1186,9 +1185,8 @@ void patch_system::synchronize(int ghosted_min_gfn_to_sync,
if (gz.is_symmetry())
then gz.synchronize(ghosted_min_gfn_to_sync,
ghosted_max_gfn_to_sync,
- true, // want min-par corner?
- false, // want non-corner?
- true); // want max-par corner?
+ true, // want corners?
+ false); // want non-corner?
}
}
}
diff --git a/src/patch/patch_system.hh b/src/patch/patch_system.hh
index bc1cdbb..6c07fb3 100644
--- a/src/patch/patch_system.hh
+++ b/src/patch/patch_system.hh
@@ -260,7 +260,10 @@ public:
// ... do this for all ghosted gridfns
void synchronize()
- { synchronize(ghosted_min_gfn(), ghosted_max_gfn()); }
+ {
+ synchronize(ghosted_min_gfn(),
+ ghosted_max_gfn());
+ }
//