diff options
author | jthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5> | 2001-07-14 15:57:47 +0000 |
---|---|---|
committer | jthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5> | 2001-07-14 15:57:47 +0000 |
commit | bac07656089bc20098cef83b7890e303be5ed056 (patch) | |
tree | 474ec937a595fe0a1cdf31e2ec4e303a0b1f420d /src/patch/patch_system.hh | |
parent | 4358d2ea359da035cff9a9d3250f6d3bec20d3b4 (diff) |
reorganize static what-sort-of-patches-make-up-each-type-of-patch-system
data tables --> now in namespace patch_system_info
git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinAnalysis/AHFinderDirect/trunk@147 f88db872-0e4f-0410-b76b-b9085cfa78c5
Diffstat (limited to 'src/patch/patch_system.hh')
-rw-r--r-- | src/patch/patch_system.hh | 308 |
1 files changed, 141 insertions, 167 deletions
diff --git a/src/patch/patch_system.hh b/src/patch/patch_system.hh index cea07da..6e76576 100644 --- a/src/patch/patch_system.hh +++ b/src/patch/patch_system.hh @@ -22,6 +22,121 @@ // patch_frontier.hh // +//****************************************************************************** + +// +// ***** patch numbers, bounds, etc (static data) ***** +// +namespace patch_system_info +{ + +// +// alas, the set of patches for a quarter patch system isn't +// a subset of the set of patches for a half patch system, +// so we can't assign the same patch numbers to a given patch +// type in each type of patch system, and still keep each +// patch system having a contiguous range of patch numbers :( +// +struct patch_info + { + int patch_number; + fp min_drho, max_drho; + fp min_dsigma, max_dsigma; + }; + +// +// full-grid patch system +// +namespace full_patch_system + { +static const int N_patches = 6; + +// +z patch: (90 x 90 degrees) dmu [ -45, 45], dnu [ -45, 45] +static const struct patch_info plus_z = {0, -45.0, 45.0, -45.0, 45.0}; + +// +x patch: (90 x 90 degrees) dnu [ 45, 135], dphi [ -45, 45] +static const struct patch_info plus_x = {1, 45.0, 135.0, -45.0, 45.0}; + +// +y patch: (90 x 90 degrees) dmu [ 45, 135], dphi [ 45, 135] +static const struct patch_info plus_y = {2, 45.0, 135.0, 45.0, 135.0}; + +// -x patch: (90 x 90 degrees) dnu [-135, -45], dphi [ 135, 225] +static const struct patch_info minus_x = {3, -135.0, -45.0, 135.0, 225.0}; + +// -y patch: (90 x 90 degrees) dmu [-135, -45], dphi [-135, -45] +static const struct patch_info minus_y = {4, -135.0, -45.0, -135.0, -45.0}; + +// -z patch: (90 x 90 degrees) dmu [ 135, 225], dnu [ 135, 225] +static const struct patch_info minus_z = {5, 135.0, 225.0, 135.0, 225.0}; + }; + +// +// half-grid patch system +// (mirror symmetry across z=0 plane) +// +namespace half_patch_system + { +static const int N_patches = 5; + +// +z patch: (90 x 90 degrees) dmu [ -45, 45], dnu [ -45, 45] +static const struct patch_info plus_z = {0, -45.0, 45.0, -45.0, 45.0}; + +// +x patch: (45 x 90 degrees) dnu [ 45, 90], dphi [ -45, 45] +static const struct patch_info plus_x = {1, 45.0, 90.0, -45.0, 45.0}; + +// +y patch: (45 x 90 degrees) dmu [ 45, 90], dphi [ 45, 135] +static const struct patch_info plus_y = {2, 45.0, 90.0, 45.0, 135.0}; + +// -x patch: (45 x 90 degrees) dnu [ -90, -45], dphi [ 135, 225] +static const struct patch_info minus_x = {3, -90.0, -45.0, 135.0, 225.0}; + +// -y patch: (45 x 90 degrees) dmu [ -90, -45], dphi [-135, -45] +static const struct patch_info minus_y = {4, -90.0, -45.0, -135.0, -45.0}; + }; + +// +// quarter-grid patch system +// (90 degree periodic rotation symmetry about z axis) +// +namespace quarter_patch_system + { +static const int N_patches = 4; + +// +z patch: (45 x 45 degrees) dmu [ 0, 45], dnu [ 0, 45] +static const struct patch_info plus_z = {0, 0.0, 45.0, 0.0, 45.0}; + +// +x patch: (90 x 45 degrees) dnu [ 45, 135], dphi [ 0, 45] +static const struct patch_info plus_x = {1, 45.0, 135.0, 0.0, 45.0}; + +// +y patch: (90 x 45 degrees) dmu [ 45, 135], dphi [ 45, 90] +static const struct patch_info plus_y = {2, 45.0, 135.0, 45.0, 90.0}; + +// -z patch: (45 x 45 degrees) dmu [ 135, 180], dnu [ 135, 180] +static const struct patch_info minus_z = {3, 135.0, 180.0, 135.0, 180.0}; + }; + +// +// octant (eighth)-grid patch system +// (90 degree periodic rotation symmetry about z axis +// *and* mirror symmetry across z=0 plane) +// +namespace octant_patch_system + { +static const int N_patches = 3; + +// +z patch: (45 x 45 degrees) dmu [ 0, 45], dnu [ 0, 45] +static const struct patch_info plus_z = {0, 0.0, 45.0, 0.0, 45.0}; + +// +x patch: (45 x 45 degrees) dnu [ 45, 90], dphi [ 0, 45] +static const struct patch_info plus_x = {1, 45.0, 90.0, 0.0, 45.0}; + +// +y patch: (45 x 45 degrees) dmu [ 45, 90], dphi [ 45, 90] +static const struct patch_info plus_y = {2, 45.0, 90.0, 45.0, 90.0}; + }; + +// close namespace patch_system_info:: +}; + //***************************************************************************** // @@ -54,94 +169,6 @@ public: // largest number of patches for any patch system type static const int max_N_patches = 6; - // - // patch numbers (static data) - // - // alas, the set of patches for a quarter patch system isn't - // a subset of the set of patches for a half patch system, - // so we can't assign the same patch numbers to a given patch - // type in each type of patch system, and still keep each - // patch system having a contiguous range of patch numbers :( - // - class patch_numbers - { - // - // patch numbers for full-grid patch system - // +z patch: dmu in [ -45, 45], dnu in [ -45, 45] (90 x 90) - // +x patch: dnu in [ 45, 135], dphi in [ -45, 45] (90 x 90) - // +y patch: dmu in [ 45, 135], dphi in [ 45, 135] (90 x 90) - // -x patch: dnu in [-135, -45], dphi in [ 135, 225] (90 x 90) - // -y patch: dmu in [-135, -45], dphi in [-135, -45] (90 x 90) - // -z patch: dmu in [ 135, 225], dnu in [ 135, 225] (90 x 90) - // - class full_patch_system - { - public: - static const int N_patches = 6; - static const int plus_z = 0; - static const int plus_x = 1; - static const int plus_y = 2; - static const int minus_x = 3; - static const int minus_y = 4; - static const int minus_z = 5; - }; - - // - // patch numbers for half-grid patch system - // (mirror symmetry across z=0 plane) - // +z patch: dmu in [ -45, 45], dnu in [ -45, 45] (90 x 90) - // +x patch: dnu in [ 45, 90], dphi in [ -45, 45] (45 x 90) - // +y patch: dmu in [ 45, 90], dphi in [ 45, 135] (45 x 90) - // -x patch: dnu in [ -90, -45], dphi in [ 135, 225] (45 x 90) - // -y patch: dmu in [ -90, -45], dphi in [-135, -45] (45 x 90) - // - class half_patch_system - { - public: - static const int N_patches = 5; - static const int plus_z = 0; - static const int plus_x = 1; - static const int plus_y = 2; - static const int minus_x = 3; - static const int minus_y = 4; - }; - - // - // patch numbers for quarter-grid patch system - // (90 degree periodic rotation symmetry about z axis) - // +z patch: dmu in [ 0, 45], dnu in [ 0, 45] (45 x 45) - // +x patch: dnu in [ 45, 135], dphi in [ 0, 45] (90 x 45) - // +y patch: dmu in [ 45, 135], dphi in [ 45, 90] (90 x 45) - // -z patch: dmu in [ 135, 180], dnu in [ 135, 180] (45 x 45) - // - class quarter_patch_system - { - public: - static const int N_patches = 4; - static const int plus_z = 0; - static const int plus_x = 1; - static const int plus_y = 2; - static const int minus_z = 3; - }; - - // - // patch numbers for octant patch system - // (90 degree periodic rotation symmetry about z axis - // *and* mirror symmetry across z=0 plane) - // +z patch: dmu in [ 0, 45], dnu in [ 0, 45] (45 x 45) - // +x patch: dnu in [ 45, 90], dphi in [ 0, 45] (45 x 45) - // +y patch: dmu in [ 45, 90], dphi in [ 45, 90] (45 x 45) - // - class octant_patch_system - { - public: - static const int N_patches = 3; - static const int plus_z = 0; - static const int plus_x = 1; - static const int plus_y = 2; - }; - }; - public: // // ***** meta-info on/about the entire patch system ***** @@ -153,10 +180,7 @@ public: // total number of patches int N_patches() const { return N_patches_; } - // each patch has a 0-origin small-integer "patch number" - // (usually denoted "pn"); patch numbers are assigned in - // sequential order as patches are constructed and added - // to the patch system + // get patches by patch number patch &ith_patch(int pn) const { assert(pn >= 0); @@ -167,88 +191,41 @@ public: // find a patch by name, return patch number; error_exit() if not found int patch_number_of_name(const char *name) const; - // overall number of grid points summed over all patches - int N_grid_points() const - { return N_grid_points_; } - int bordered_N_grid_points() const - { return bordered_N_grid_points_; } - int N_grid_points(enum gridfn_bordered_type bordered_type) const - { - return grid::is_bordered(bordered_type) - ? bordered_N_grid_points() - : N_grid_points(); - } - // // ***** meta-info about gridfns ***** // - int N_gridfns() const { return ith_patch(0).N_gridfns_; } - + int min_gfn() const { return ith_patch(0).min_gfn(); } + int max_gfn() const { return ith_patch(0).max_gfn(); } + int N_gridfns() const { return ith_patch(0).N_gridfns(); } +public: // - // ***** constructors, destructor ***** + // ***** constructor, destructor ***** // -public: - // standard constructor: all parameters supplied explicitly - // ... interpolator_pars_in.method may be set to - // patch::interpolator__none if interpolation isn't - // going to be done, i.e. if border_extend_gridfn_vector() - // isn't going to be called - patch_system(enum patch_system_type patch_system_type_in, - const wr_coord::pars &wr_coord_pars_in, - const grid::radial_array_pars &radial_array_pars_in, - const grid::radial_grid_pars &radial_grid_pars_in, - const grid::angular_array_pars angular_array_pars_in[], - const grid::angular_grid_pars angular_grid_pars_in[], - patch::interpolator_pars &interpolator_pars_in, - int N_gridfns_in, const gfn_ranges &gfn_ranges_in, - const char *const gridfn_names_in[], - const enum gridfn_precision gridfn_precisions_in[], - const enum gridfn_domain_type gridfn_domain_types_in[], - const enum gridfn_bordered_type gridfn_bordered_types_in[], - const enum gridfn_storage_type gridfn_storage_types_in[], - bool print_msg_flag = true); - - // alternate "named constructor": - // read all parameters from external I/O file, - // set up a single-gridfn patch system, - // set up I/O to read values of that gridfn - // ... returned result is reference to new-allocated patch_system - // object; caller is responsible for eventually destroying this - static - patch_system &new_patch_system_from_IO - (const class status &status, - const char *gridfn_name, - const char *extra_name_string = "", - bool print_msg_flag = true); - + patch_system(enum patch_system_type type_in, + int N_ghost_zones, fp delta_drho_dsigma, + int min_gfn_in, int max_gfn_in, + int interpolator_order_in); ~patch_system(); - // worker functions for above private: - // set up an octant patch system - void setup_octant_patch_system - (const wr_coord::pars &wr_coord_pars_in, - const grid::radial_array_pars &radial_array_pars_in, - const grid::radial_grid_pars &radial_grid_pars_in, - const grid::angular_array_pars - angular_array_pars_in[patch_numbers::octant::N_patches], - const grid::angular_grid_pars - angular_grid_pars_in[patch_numbers::octant::N_patches], - patch::interpolator_pars &interpolator_pars_in, - const gfn_ranges &gfn_ranges_in, - bool print_msg_flag = true); - - // set up the single relevang substructure in a - // struct gfn_ranges for a single-gridfn patch system - static - void setup_nonempty_gfn_ranges_for_1gfps - (enum gridfn_precision gridfn_precision, - enum gridfn_domain_type gridfn_domain_type, - enum gridfn_bordered_type gridfn_bordered_type, - struct gfn_ranges &gfn_ranges); + // + // ***** helper functions for constructor ***** + // + void setup_full_patch_system(int N_ghost_zones, fp delta_drho_dsigma, + int min_gfn_in, int max_gfn_in, + int interpolator_order_in); + void setup_half_patch_system(int N_ghost_zones, fp delta_drho_dsigma, + int min_gfn_in, int max_gfn_in, + int interpolator_order_in); + void setup_quarter_patch_system(int N_ghost_zones, fp delta_drho_dsigma, + int min_gfn_in, int max_gfn_in, + int interpolator_order_in); + void setup_octant_patch_system(int N_ghost_zones, fp delta_drho_dsigma, + int min_gfn_in, int max_gfn_in, + int interpolator_order_in); private: // we forbid copying and passing by value @@ -262,9 +239,6 @@ private: enum patch_system_type type_; int N_patches_; - // array [0...N_patches_) of pointers to individual patches + // --> array [0...N_patches_) of --> to individual patches patch* all_patches_; // [pn] -> patch - - // meta-info about gridfns (all vectors are [gfn]) - int N_grid_points_; }; |