diff options
author | jthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5> | 2001-06-21 13:20:06 +0000 |
---|---|---|
committer | jthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5> | 2001-06-21 13:20:06 +0000 |
commit | 7ea6e71fd8cce9e431f6f161b8dfa2296d940a2b (patch) | |
tree | 202e4ccb1d182029f78ed48b4adc9aac1f07e756 /src/patch/ghost_zone.cc | |
parent | 6783c6c5e71e46e0a3b104fdb172dc7c4adff628 (diff) |
various mods -- not done reworking yet
git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinAnalysis/AHFinderDirect/trunk@102 f88db872-0e4f-0410-b76b-b9085cfa78c5
Diffstat (limited to 'src/patch/ghost_zone.cc')
-rw-r--r-- | src/patch/ghost_zone.cc | 179 |
1 files changed, 89 insertions, 90 deletions
diff --git a/src/patch/ghost_zone.cc b/src/patch/ghost_zone.cc index 1c7ff7c..c966b4d 100644 --- a/src/patch/ghost_zone.cc +++ b/src/patch/ghost_zone.cc @@ -1,4 +1,4 @@ -// patch_bndry.cc -- angular edge/frontier/border of a patch +// ghost_zone.cc -- fill in gridfn data in patch ghost zones // $Id$ // @@ -16,99 +16,94 @@ #include <stdio.h> #include <assert.h> -#include <limits.h> #include <math.h> -#include <float.h> -#include <vector.h> +#include "jt/stdc.h" +#include "jt/util.hh" -#include <jt/stdc.h> -#include <jt/util.h> -#include <jt/util.hh> -#include <jt/misc++.hh> - -#include "policy.hh" #include "fp.hh" -#include "misc.hh" #include "coords.hh" -#include "gfa.hh" -#include "gridfn.hh" #include "grid.hh" #include "fd_grid.hh" #include "patch.hh" -#include "patch_bndry.hh" +#include "patch_edge.hh" +#include "ghost_zone.hh" -//***************************************************************************** -//***************************************************************************** -// symmetry_ghost_zone - mirror-symmetry angular border of a patch -//***************************************************************************** -//***************************************************************************** +//****************************************************************************** +//****************************************************************************** +//****************************************************************************** // // This function constructs an symmetry_ghost_zone object // representing a mirror symmetry. // -symmetry_ghost_zone::symmetry_ghost_zone(const patch_edge& this_edge_in) - : ghost_zone(this_edge_in), - symmetry_patch_(this_edge_in.this_patch()), - symmetry_edge_(this_edge_in) +symmetry_ghost_zone::symmetry_ghost_zone(const patch_edge& my_edge_in) + : ghost_zone(my_edge_in, ghost_zone_is_symmetry), + symmetry_patch_(my_edge_in.my_patch()), + symmetry_edge_(my_edge_in) { symmetry_iperp_ = new cpm_map(min_iperp(), max_iperp(), - this_edge().fp_grid_outer_iperp()); + my_edge().fp_grid_outer_iperp()); // identity map -symmetry_ipar_ = new cpm_map(this_edge().min_ipar_with_corners(), - this_edge().max_ipar_with_corners()); +symmetry_ipar_ = new cpm_map(my_edge().min_ipar_with_corners(), + my_edge().max_ipar_with_corners()); } -//***************************************************************************** +//****************************************************************************** // // This function constructs an symmetry_ghost_zone object // representing a periodic-BC symmetry. // symmetry_ghost_zone::symmetry_ghost_zone - (const patch_edge& this_edge_in, const patch_edge& symmetry_edge_in, - int this_edge_sample_ipar, int symmetry_edge_sample_ipar, + (const patch_edge& my_edge_in, const patch_edge& symmetry_edge_in, + int my_edge_sample_ipar, int symmetry_edge_sample_ipar, bool ipar_map_sign) - : ghost_zone(this_edge_in), - symmetry_patch_(symmetry_edge_in.this_patch()), + : ghost_zone(my_edge_in, ghost_zone_is_interpatch), + symmetry_patch_(symmetry_edge_in.my_patch()), symmetry_edge_(symmetry_edge_in) { -fp fp_this_period_plane_iperp = this_edge().fp_grid_outer_iperp(); +// +// perpendicular map +// +fp fp_my_period_plane_iperp = my_edge().fp_grid_outer_iperp(); fp fp_symmetry_period_plane_iperp = symmetry_edge().fp_grid_outer_iperp(); fp fp_iperp_shift_amount - = fp_symmetry_period_plane_iperp - fp_this_period_plane_iperp; + = fp_symmetry_period_plane_iperp - fp_my_period_plane_iperp; if (! fuzzy<fp>::is_integer(fp_iperp_shift_amount)) then error_exit(ERROR_EXIT, "***** symmetry_ghost_zone::symmetry_ghost_zone (periodic BC border):\n" -" fp_symmetry_period_plane_iperp=%g - fp_this_period_plane_iperp=%g\n" +" fp_symmetry_period_plane_iperp=%g - fp_my_period_plane_iperp=%g\n" " isn't fuzzily integral!\n" " ==> periodic-BC periodicity is incommensurate with grid!\n" , double(fp_symmetry_period_plane_iperp), - double(fp_this_period_plane_iperp)); /*NOTREACHED*/ + double(fp_my_period_plane_iperp)); /*NOTREACHED*/ int iperp_shift_amount = round<fp>::to_integer(fp_iperp_shift_amount); // iperp mapping is outside --> inside // i.e. if both edges have (say) iperp increasing to the outside, // then the mapping is iperp increasing --> iperp decreasing -bool iperp_map_sign = this_edge().edge_is_min() == symmetry_edge().edge_is_min() +bool iperp_map_sign = my_edge().is_min() == symmetry_edge().is_min() ? cpm_map::minus_map : cpm_map::plus_map; -symmetry_iperp_ = new cpm_map(min_iperp(), max_iperp(), - fp_this_period_plane_iperp, - fp_symmetry_period_plane_iperp, - iperp_map_sign); +symmetry_iperp_ + = new cpm_map(min_iperp(), max_iperp(), + fp_my_period_plane_iperp, fp_symmetry_period_plane_iperp, + iperp_map_sign); -symmetry_ipar_ = new cpm_map(this_edge().min_ipar_with_corners(), - this_edge().max_ipar_with_corners(), - this_edge_sample_ipar, symmetry_edge_sample_ipar, +// +// parallel map +// +symmetry_ipar_ = new cpm_map(my_edge().min_ipar_with_corners(), + my_edge().max_ipar_with_corners(), + my_edge_sample_ipar, symmetry_edge_sample_ipar, ipar_map_sign); } -//***************************************************************************** +//****************************************************************************** // // This function destroys a symmetry_ghost_zone object. @@ -119,21 +114,27 @@ delete symmetry_ipar_; delete symmetry_iperp_; } -//***************************************************************************** +//****************************************************************************** // -// This function symmetry-maps a scalar ("T tensor") at a specified -// grid point. "Scalar" here refers solely to the symmetry properties -// of the gridfn under coordinate reflections, it need not be an actual -// scalar under more general coordinate transformations. However, it -// must be fp, grid3d, bordered, and interleaved. +// This function symmetry-maps a scalar gridfn in a specified part of +// the ghost zone. at a specified grid point. ("Scalar" here refers +// solely to the symmetry properties of the gridfn under coordinate +// reflections, it need not be an actual scalar under more general +// coordinate transformations.) // -void symmetry_ghost_zone::symmetry_map_T_gfa(patch& p, - int T_gfn, - int iwr, - int iperp, int ipar) +void symmetry_ghost_zone::setup_scalar_gridfn_in_ghost_zone + (int gfn, + bool want_min_par_corner, + bool want_non_corner, + bool want_max_par_corner) const { + for (int iperp = min_iperp() ; iperp <= max_iperp() ; ++iperp) + { + for (int ipar = min_ipar(iperp) ; ipar <= max_ipar(iperp) ; ++ipar) + { +FIXME FIXME // where is the symmetry-image of this point? const int sym_iperp = symmetry_iperp_of_iperp(iperp); const int sym_ipar = symmetry_ipar_of_ipar (ipar ); @@ -147,26 +148,24 @@ const fp sym_T = sym_p.gridfn__fp_grid3d_bordered_interleaved iwr, sym_irho, sym_isigma); // store T here -const int this_irho = this_edge(). irho_of_iperp_ipar(iperp,ipar); -const int this_isigma = this_edge().isigma_of_iperp_ipar(iperp,ipar); +const int my_irho = my_edge(). irho_of_iperp_ipar(iperp,ipar); +const int my_isigma = my_edge().isigma_of_iperp_ipar(iperp,ipar); p.gridfn__fp_grid3d_bordered_interleaved(T_gfn, - iwr, this_irho, this_isigma) + iwr, my_irho, my_isigma) = sym_T; } -//***************************************************************************** -//***************************************************************************** -// interpatch_ghost_zone - other-patch angular border of a patch -//***************************************************************************** -//***************************************************************************** +//****************************************************************************** +//****************************************************************************** +//****************************************************************************** // // This function constructs an interpatch_ghost_zone object. // -interpatch_ghost_zone::interpatch_ghost_zone(const patch_edge& this_edge_in, +interpatch_ghost_zone::interpatch_ghost_zone(const patch_edge& my_edge_in, const patch_edge& other_edge_in) - : ghost_zone(this_edge_in), - other_patch_(other_edge_in.this_patch()), + : ghost_zone(my_edge_in), + other_patch_(other_edge_in.my_patch()), other_edge_(other_edge_in), other_frontier_ptr_(NULL) // other frontier object may not // exist yet @@ -177,38 +176,38 @@ interpatch_ghost_zone::interpatch_ghost_zone(const patch_edge& this_edge_in, // // border/frontier is min in one patch, max in the other -if (! (border_is_min() ^ other_edge().edge_is_min()) ) +if (! (border_is_min() ^ other_edge().is_min()) ) then error_exit(ERROR_EXIT, "***** interpatch_ghost_zone::interpatch_ghost_zone:\n" -" this_patch().name()=\"%s\" this_edge().type()=%s\n" +" my_patch().name()=\"%s\" my_edge().type()=%s\n" " other_patch().name()=\"%s\" other_edge().type()=%s\n" " border/frontier must be min in one patch, max in the other!\n" , - this_patch().name(), this_edge().name(), + my_patch().name(), my_edge().name(), other_patch().name(), other_edge().name()); /*NOTREACHED*/ // coord in common between the two patches == perp coord in both patches // and this patch's tau coordinate == other frontier's parallel coordinate -coords::mu_nu_phi::coords_set this_mnp_coords_set - = this_patch().mnp_coord_set_rho() - | this_patch().mnp_coord_set_sigma(); +coords::mu_nu_phi::coords_set my_mnp_coords_set + = my_patch().mnp_coord_set_rho() + | my_patch().mnp_coord_set_sigma(); coords::mu_nu_phi::coords_set other_mnp_coords_set = other_patch().mnp_coord_set_rho() | other_patch().mnp_coord_set_sigma(); coords::mu_nu_phi::coords_set common_mnp_coords_set = coords::mu_nu_phi - ::coords_set_not(this_mnp_coords_set ^ other_mnp_coords_set); -if (! ( (common_mnp_coords_set == this_edge().mnp_coord_set_perp()) + ::coords_set_not(my_mnp_coords_set ^ other_mnp_coords_set); +if (! ( (common_mnp_coords_set == my_edge().mnp_coord_set_perp()) && (common_mnp_coords_set == other_edge().mnp_coord_set_perp()) - && (this_patch().mnp_index_tau() == other_edge().mnp_index_par()) ) ) + && (my_patch().mnp_index_tau() == other_edge().mnp_index_par()) ) ) then error_exit(PANIC_EXIT, "***** interpatch_ghost_zone::interpatch_ghost_zone:\n" " (rho,sigma,tau) coordinates don't match up properly\n" " between this patch/border and the other one!\n" -" this_patch().name()=\"%s\" this_edge().type()=%s\n" +" my_patch().name()=\"%s\" my_edge().type()=%s\n" " other_patch().name()=\"%s\" other_edge().type()=%s\n" , - this_patch().name(), this_edge().name(), + my_patch().name(), my_edge().name(), other_patch().name(), other_edge().name()); /*NOTREACHED*/ @@ -220,8 +219,8 @@ if (! ( (common_mnp_coords_set == this_edge().mnp_coord_set_perp()) // (since that depends on the type of our patch's adjacent borders) // ==> we include the corners on the chance we may want them later // -int border_min_ipar = this_edge().min_ipar_with_corners(); -int border_max_ipar = this_edge().max_ipar_with_corners(); +int border_min_ipar = my_edge().min_ipar_with_corners(); +int border_max_ipar = my_edge().max_ipar_with_corners(); // @@ -235,20 +234,20 @@ other_par_ = new array2d<fp>(min_iperp(), max_iperp(), { // compute the other_iperp corresponding to iperp // using the fact that perp is the same coordinate in both cases - const fp perp = this_edge().perp_of_iperp(iperp); + const fp perp = my_edge().perp_of_iperp(iperp); const fp fp_other_iperp = other_edge().fp_iperp_of_perp(perp); // check that other_iperp is fuzzily a grid point if (! fuzzy<fp>::is_integer(fp_other_iperp)) then error_exit(ERROR_EXIT, "***** interpatch_ghost_zone::interpatch_ghost_zone:\n" -" this_patch().name()=\"%s\" this_edge().type()=%s\n" +" my_patch().name()=\"%s\" my_edge().type()=%s\n" " other_patch().name()=\"%s\" other_edge().type()=%s\n" " iperp=%d perp=%g\n" " ==> fp_other_iperp=%g isn't fuzzily an integer\n" " ==> patches aren't commensurate in the perpendicular coordinate!\n" , - this_patch().name(), this_edge().name(), + my_patch().name(), my_edge().name(), other_patch().name(), other_edge().name(), iperp, double(perp), double(fp_other_iperp)); /*NOTREACHED*/ @@ -262,19 +261,19 @@ other_par_ = new array2d<fp>(min_iperp(), max_iperp(), // compute the other_par corresponding to (iperp,ipar) // ... by the last of the coordinate properties verified above, // we need "only" compute this patch's tau coordinate - const fp par = this_edge().par_of_ipar(ipar); + const fp par = my_edge().par_of_ipar(ipar); - const fp rho = this_edge(). rho_of_perp_par(perp, par); - const fp sigma = this_edge().sigma_of_perp_par(perp, par); + 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 = this_patch().tau_of_rho_sigma(rho, sigma); + const fp tau = my_patch().tau_of_rho_sigma(rho, sigma); (*other_par_)(iperp,ipar) = tau; } } } -//***************************************************************************** +//****************************************************************************** // // this function destroys an interpatch_ghost_zone object. @@ -285,7 +284,7 @@ delete other_par_; delete other_iperp_; } -//***************************************************************************** +//****************************************************************************** // // This function interpolates a specified gridfn on a specified @@ -296,7 +295,7 @@ void interpatch_ghost_zone::interpolate_gridfn_row(int bordered_gfn, int iwr, int iperp) const { -patch& p = nonconst_this_patch(); +patch& p = nonconst_my_patch(); const patch_frontier& of = other_frontier(); int other_iperp = other_iperp_coord(iperp); @@ -306,8 +305,8 @@ of.setup_parallel_row(bordered_gfn, iwr, other_iperp); ipar <= max_ipar(iperp) ; ++ipar) { - int irho = this_edge(). irho_of_iperp_ipar(iperp, ipar); - int isigma = this_edge().isigma_of_iperp_ipar(iperp, ipar); + int irho = my_edge(). irho_of_iperp_ipar(iperp, ipar); + int isigma = my_edge().isigma_of_iperp_ipar(iperp, ipar); fp other_par = other_par_coord(iperp, ipar); p.gridfn__fp_grid3d_bordered_interleaved(bordered_gfn, iwr,irho,isigma) |