aboutsummaryrefslogtreecommitdiff
path: root/src/patch/ghost_zone.cc
diff options
context:
space:
mode:
authorjthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5>2002-04-08 14:48:47 +0000
committerjthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5>2002-04-08 14:48:47 +0000
commit4337542a085f69ad013654b44d707142a043ddd5 (patch)
tree581e08744e4f59fea535aeacd25a6e4d365de9e1 /src/patch/ghost_zone.cc
parent9fcd9cbadfc7aca474f98c358b4dba85a9740456 (diff)
move a bunch of logic out of interpatch_ghost_zone::interpatch_ghost_zone()
down into interpatch_ghost_zone::finish_setup() since it needs to look at types of adjacent-side ghost zones, also rename a bunch of other patch-system-setup logic git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinAnalysis/AHFinderDirect/trunk@466 f88db872-0e4f-0410-b76b-b9085cfa78c5
Diffstat (limited to 'src/patch/ghost_zone.cc')
-rw-r--r--src/patch/ghost_zone.cc164
1 files changed, 84 insertions, 80 deletions
diff --git a/src/patch/ghost_zone.cc b/src/patch/ghost_zone.cc
index ec58f18..3c54f18 100644
--- a/src/patch/ghost_zone.cc
+++ b/src/patch/ghost_zone.cc
@@ -10,7 +10,7 @@
// interpatch_ghost_zone::interpatch_ghost_zone
// interpatch_ghost_zone::~interpatch_ghost_zone
// interpatch_ghost_zone::[min,max]_ipar
-// interpatch_ghost_zone::setup_other_patch_frontier
+// interpatch_ghost_zone::finish_setup
// interpatch_ghost_zone::assert_fully_setup
// interpatch_ghost_zone::synchronize
//
@@ -20,6 +20,7 @@
#include <stdlib.h>
#include <limits.h>
#include <math.h>
+#include <algorithm>
#include "cctk.h"
@@ -165,10 +166,9 @@ interpatch_ghost_zone::interpatch_ghost_zone(const patch_edge& my_edge_in,
: ghost_zone(my_edge_in, ghost_zone_is_interpatch),
other_patch_(other_edge_in.my_patch()),
other_edge_(other_edge_in),
- other_frontier_(NULL), // set by setup_other_patch_frontier()
- // remaining subobjects are all set properly in ctor body
+ // remaining pointers are all set up properly by finish_setup()
+ other_frontier_(NULL),
other_iperp_(NULL),
- other_min_iperp_(0), other_max_iperp_(0),
min_ipar_used_(NULL), max_ipar_used_(NULL),
other_par_(NULL),
interp_result_buffer_(NULL)
@@ -316,72 +316,6 @@ const bool is_iperp_map_plus = (iperp_map_sign_pm1 > 0.0);
other_iperp_ = new jtutil::cpm_map<fp>(min_iperp(), max_iperp(),
sample_iperp, other_sample_iperp,
is_iperp_map_plus);
-other_min_iperp_ = jtutil::min(other_iperp(min_iperp()),
- other_iperp(max_iperp()));
-other_max_iperp_ = jtutil::max(other_iperp(min_iperp()),
- other_iperp(max_iperp()));
-
-
-//
-// set up arrays giving [min,max] ipar that we'll use at each other_iperp
-// ... we will pass these arrays by reference to the other patch's
-// patch_frontier object, with ipar being parindex there
-//
-min_ipar_used_ = new jtutil::array1d<int>(other_min_iperp_, other_max_iperp_);
-max_ipar_used_ = new jtutil::array1d<int>(other_min_iperp_, other_max_iperp_);
- for (int iperp = min_iperp() ; iperp <= max_iperp() ; ++iperp)
- {
- (*min_ipar_used_)(other_iperp(iperp)) = min_ipar(iperp);
- (*max_ipar_used_)(other_iperp(iperp)) = max_ipar(iperp);
- }
-
-
-//
-// set up array giving other patch's par coordinate for interpolation
-//
-
-// ... note that we can't yet count on any other ghost zone existing,
-// so we don't yet know whether or not we'll want our corners
-// (since that depends on the type of our patch's adjacent ghost zones)
-// ==> we include the corners on the chance we may want them later,
-// and use the appropriate parts of them in synchronize() below
-other_par_ = new jtutil::array2d<fp>
- (other_min_iperp_, other_max_iperp_,
- ghost_zone_min_ipar(), ghost_zone_max_ipar());
-
- for (int iperp = min_iperp() ; iperp <= max_iperp() ; ++iperp)
- {
- for (int ipar = ghost_zone_min_ipar() ;
- ipar <= ghost_zone_max_ipar() ;
- ++ipar)
- {
- // compute the other_par corresponding to (iperp,ipar)
- // ... here we use the fact (which we verified above) that
- // other edge's parallel coordinate == our tau coordinate
- // (at least modulo 2*pi radians = 360 degrees)
- const fp perp = my_edge().perp_of_iperp(iperp);
- const fp par = my_edge().par_of_ipar(ipar);
-
- const fp rho = my_edge(). rho_of_perp_par(perp, par);
- const fp sigma = my_edge().sigma_of_perp_par(perp, par);
-
- const fp tau = my_patch().tau_of_rho_sigma(rho, sigma);
- const fp other_par = other_patch()
- .modulo_reduce_ang(other_edge().par_is_rho(), tau);
-
- (*other_par_)(other_iperp(iperp),ipar) = other_par;
- }
- }
-
-
-//
-// set up interpolation result buffer
-//
-interp_result_buffer_
- = new jtutil::array3d<fp>
- (my_patch().ghosted_min_gfn(), my_patch().ghosted_max_gfn(),
- other_min_iperp_, other_max_iperp_,
- ghost_zone_min_ipar(), ghost_zone_max_ipar());
}
//******************************************************************************
@@ -439,21 +373,91 @@ return max_par_adjacent_ghost_zone().is_symmetry()
//******************************************************************************
//
-// This function constructs the *other* patch's patch_frontier:: object,
-// and interlinks it with this ghost zone and the other patch.
+// This function finishes the construction/setup of an interpatch_ghost_zone
+// object. It
+// - sets up the par coordinate mapping information
+// - sets up the interpolator data pointer and result arrays
+// - constructs the *other* patch's patch_frontier:: object
+// and sets our patch frontier pointer to point to it
//
// We use our ipar as the patch_frontier's parindex.
//
-void interpatch_ghost_zone::setup_other_patch_frontier
- (int interp_handle, int interp_par_table_handle)
+void interpatch_ghost_zone::finish_setup(int interp_handle,
+ int interp_par_table_handle)
{
-other_frontier_
- = new patch_frontier(other_edge(),
- other_min_iperp_, other_max_iperp_,
- *min_ipar_used_, *max_ipar_used_,
- *other_par_,
- interp_handle, interp_par_table_handle);
+const int other_min_iperp = std::min(other_iperp(min_iperp()),
+ other_iperp(max_iperp()));
+const int other_max_iperp = std::max(other_iperp(min_iperp()),
+ other_iperp(max_iperp()));
+//
+// set up arrays giving [min,max] ipar that we'll use at each other_iperp
+// ... we will pass these arrays by reference to the other patch's
+// patch_frontier object, with ipar being parindex there
+//
+min_ipar_used_ = new jtutil::array1d<int>(other_min_iperp, other_max_iperp);
+max_ipar_used_ = new jtutil::array1d<int>(other_min_iperp, other_max_iperp);
+ for (int iperp = min_iperp() ; iperp <= max_iperp() ; ++iperp)
+ {
+ (*min_ipar_used_)(other_iperp(iperp)) = min_ipar(iperp);
+ (*max_ipar_used_)(other_iperp(iperp)) = max_ipar(iperp);
+ }
+
+
+//
+// set up array giving other patch's par coordinate for interpolation
+//
+
+// ... note that we can't yet count on any other ghost zone existing,
+// so we don't yet know whether or not we'll want our corners
+// (since that depends on the type of our patch's adjacent ghost zones)
+// ==> we include the corners on the chance we may want them later,
+// and use the appropriate parts of them in synchronize() below
+other_par_ = new jtutil::array2d<fp>
+ (other_min_iperp, other_max_iperp,
+ ghost_zone_min_ipar(), ghost_zone_max_ipar());
+
+ for (int iperp = min_iperp() ; iperp <= max_iperp() ; ++iperp)
+ {
+ for (int ipar = ghost_zone_min_ipar() ;
+ ipar <= ghost_zone_max_ipar() ;
+ ++ipar)
+ {
+ // compute the other_par corresponding to (iperp,ipar)
+ // ... here we use the fact (which we verified above) that
+ // other edge's parallel coordinate == our tau coordinate
+ // (at least modulo 2*pi radians = 360 degrees)
+ const fp perp = my_edge().perp_of_iperp(iperp);
+ const fp par = my_edge().par_of_ipar(ipar);
+ const fp rho = my_edge(). rho_of_perp_par(perp, par);
+ const fp sigma = my_edge().sigma_of_perp_par(perp, par);
+
+ const fp tau = my_patch().tau_of_rho_sigma(rho, sigma);
+ const fp other_par = other_patch()
+ .modulo_reduce_ang(other_edge().par_is_rho(), tau);
+
+ (*other_par_)(other_iperp(iperp),ipar) = other_par;
+ }
+ }
+
+
+//
+// set up interpolation result buffer
+//
+interp_result_buffer_
+ = new jtutil::array3d<fp>
+ (my_patch().ghosted_min_gfn(), my_patch().ghosted_max_gfn(),
+ other_min_iperp, other_max_iperp,
+ ghost_zone_min_ipar(), ghost_zone_max_ipar());
+
+//
+// construct and link to the *other* patch's frontier
+//
+other_frontier_ = new patch_frontier(other_edge(),
+ other_min_iperp, other_max_iperp,
+ *min_ipar_used_, *max_ipar_used_,
+ *other_par_,
+ interp_handle, interp_par_table_handle);
other_patch().set_patch_frontier(other_edge(), other_frontier_);
}