aboutsummaryrefslogtreecommitdiff
path: root/src/patch/ghost_zone.cc
diff options
context:
space:
mode:
authorjthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5>2002-04-01 18:29:08 +0000
committerjthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5>2002-04-01 18:29:08 +0000
commitfead8c64ea8bd003fdc583e22ca42d7cfadd6b22 (patch)
tree40fa61d756eb1d872f175b332278d697dd375da2 /src/patch/ghost_zone.cc
parent4427ccc1784b4cac4113eae09db1bd70d24f218a (diff)
finish construction/setup code
--> should all be ready for test compiles now git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinAnalysis/AHFinderDirect/trunk@418 f88db872-0e4f-0410-b76b-b9085cfa78c5
Diffstat (limited to 'src/patch/ghost_zone.cc')
-rw-r--r--src/patch/ghost_zone.cc97
1 files changed, 60 insertions, 37 deletions
diff --git a/src/patch/ghost_zone.cc b/src/patch/ghost_zone.cc
index 3af6bdc..2a5f6c5 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_frontie
+// interpatch_ghost_zone::setup_other_patch_frontier
// interpatch_ghost_zone::synchronize
//
@@ -80,12 +80,12 @@ const fp fp_symmetry_period_plane_iperp = symmetry_edge().fp_grid_outer_iperp();
// i.e. if both edges have iperp as the same min/max "direction",
// then the mapping is iperp increasing --> iperp decreasing
// (i.e. the map's sign is -1)
-const bool iperp_map_is_plus
+const bool is_iperp_map_plus
= ! (my_edge().is_min() == symmetry_edge().is_min());
iperp_map_ = new jtutil::cpm_map<fp>(min_iperp(), max_iperp(),
fp_my_period_plane_iperp,
fp_symmetry_period_plane_iperp,
- iperp_map_is_plus);
+ is_iperp_map_plus);
//
// parallel map
@@ -164,15 +164,12 @@ interpatch_ghost_zone::interpatch_ghost_zone(const patch_edge& my_edge_in,
other_patch_(other_edge_in.my_patch()),
other_edge_(other_edge_in),
other_frontier_(NULL), // set by setup_other_frontier()
- other_iperp_(NULL), // set in ctor body
- min_ipar_used_(min_iperp(), max_iperp()),
- max_ipar_used_(min_iperp(), max_iperp()),
- other_par_(min_iperp(), max_iperp(),
- min_possible_ipar(), max_possible_ipar()),
- interp_result_buffer_
- (my_patch().ghosted_min_gfn(), my_patch().ghosted_max_gfn(),
- min_iperp(), max_iperp(),
- min_possible_ipar(), max_possible_ipar())
+ // remaining subobjects are all set properly in ctor body
+ 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)
{
//
// verify that we have the expected relationships between
@@ -300,26 +297,35 @@ const int other_sample_iperp
// the overall +/- sign is just the product of the signs of the two individual
// iperp <--> perp mappings.
//
-// ... here we encode signs as (floating-point) +/- 1.0
+// ... signs encoded as (floating-point) +/- 1.0
const double iperp_map_sign_pm1
- = jtutil::signum( my_edge().perp_map().delta_fp() )
+ = jtutil::signum( my_edge().perp_map().delta_fp() )
* jtutil::signum( other_edge().perp_map().delta_fp() );
-// ... here as standard bool
-const bool iperp_map_is_plus = (iperp_map_sign_pm1 > 0.0);
+// ... signs encoded as is_plus bool flag
+const bool is_iperp_map_plus = (iperp_map_sign_pm1 > 0.0);
-// now we finally know enough to set up the iperp interpatch coordinate mapping
+// now we finally know enough to set up the other_iperp(iperp)
+// coordinate mapping
other_iperp_ = new jtutil::cpm_map<fp>(min_iperp(), max_iperp(),
sample_iperp, other_sample_iperp,
- iperp_map_is_plus);
+ 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 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 array1d<int>(other_min_iperp_, other_max_iperp_);
+max_ipar_used_ = new array1d<int>(other_min_iperp_, other_max_iperp_);
for (int iperp = min_iperp() ; iperp <= max_iperp() ; ++iperp)
{
- min_ipar_used_(iperp) = min_ipar(iperp);
- max_ipar_used_(iperp) = max_ipar(iperp);
+ min_ipar_used_(other_iperp(iperp)) = min_ipar(iperp);
+ max_ipar_used_(other_iperp(iperp)) = max_ipar(iperp);
}
@@ -332,11 +338,13 @@ other_iperp_ = new jtutil::cpm_map<fp>(min_iperp(), max_iperp(),
// (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 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 = min_possible_ipar() ;
- ipar <= max_possible_ipar() ;
+ for (int ipar = ghost_zone_min_ipar() ;
+ ipar <= ghost_zone_max_ipar() ;
++ipar)
{
// compute the other_par corresponding to (iperp,ipar)
@@ -353,9 +361,19 @@ other_iperp_ = new jtutil::cpm_map<fp>(min_iperp(), max_iperp(),
const fp other_par = other_patch()
.modulo_reduce_ang(other_edge().par_is_rho(), tau);
- other_par_(iperp,ipar) = other_par;
+ other_par_(other_iperp(iperp),ipar) = other_par;
}
}
+
+
+//
+// set up interpolation result buffer
+//
+interp_result_buffer_
+ = new array3d<fp>
+ (my_patch().min_ghosted_gfn(), my_patch().max_ghosted_gfn(),
+ other_min_iperp_, other_max_iperp_,
+ ghost_zone_min_ipar(), ghost_zone_max_ipar());
}
//******************************************************************************
@@ -365,6 +383,10 @@ other_iperp_ = new jtutil::cpm_map<fp>(min_iperp(), max_iperp(),
//
interpatch_ghost_zone::~interpatch_ghost_zone()
{
+delete interp_result_buffer_;
+deleete other_par_;
+delete max_ipar_used_;
+delete min_ipar_used_;
delete other_iperp_;
}
@@ -409,21 +431,22 @@ return max_par_adjacent_ghost_zone().is_symmetry()
//******************************************************************************
//
-// This function constructs and sets up the other patch's patch_frontier::
-// object to handle interpolation from us.
+// This function constructs the *other* patch's patch_frontier:: object,
+// and interlinks it with this ghost zone and the other patch.
+//
+// We use our ipar as the patch_frontier's parindex.
//
-void interpatch_ghost_zone::setup_other_frontier
- (int ghosted_min_gfn_in, int ghosted_max_gfn_in,
- int interp_handle_in, int interp_par_table_handle_in)
+void interpatch_ghost_zone::setup_other_frontier(int interp_handle_in,
+ int interp_par_table_handle_in)
{
-// set up the interpolator results buffer
-interp_buffer_ = new jtutil::array3d<fp>(ghosted_min_gfn_in, ghosted_max_gfn_in,
- min_iperp(), max_iperp(),
- min_ipar_used_, max_ipar_used_);
-
-patch_frontier *of
+const other_frontier_
= new patch_frontier(other_edge(),
- other_min_iperp(), other_max_iperp(),
+ other_min_iperp_, other_max_iperp_,
+ ghost_zone_min_ipar(), ghost_zone_max_ipar(),
+ *min_ipar_used_, *max_ipar_used_,
+ *other_par_,
+ interp_handle_in, interp_par_table_handle_in);
+other_patch().frontier_ptr_on_edge(other_edge()) = other_frontier_;
}
@@ -464,7 +487,7 @@ if (! (want_min_par_corner && want_non_corner && want_max_par_corner))
other_frontier_->interpolate(ghosted_min_gfn, ghosted_max_gfn,
interp_result_buffer_);
-// store the results
+// store the results back into our gridfns
for (int gfn = ghosted_min_gfn, gfn <= ghosted_max_gfn ; ++gfn)
{
for (int iperp = min_iperp() ; iperp <= max_iperp() ; ++iperp)