diff options
author | jthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5> | 2002-03-27 16:15:46 +0000 |
---|---|---|
committer | jthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5> | 2002-03-27 16:15:46 +0000 |
commit | c91732d31d2ed066f68fe1c86586d524a88fb8ce (patch) | |
tree | 74169bacf7c21bf0da70aeb7b05db14361dad183 /src/patch/patch_system.hh | |
parent | 49e114ce77fb61470f098954b13b7f8e05f92f9e (diff) |
bring misc old changes into cvs
git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinAnalysis/AHFinderDirect/trunk@370 f88db872-0e4f-0410-b76b-b9085cfa78c5
Diffstat (limited to 'src/patch/patch_system.hh')
-rw-r--r-- | src/patch/patch_system.hh | 240 |
1 files changed, 62 insertions, 178 deletions
diff --git a/src/patch/patch_system.hh b/src/patch/patch_system.hh index f28aa57..d1ccd1a 100644 --- a/src/patch/patch_system.hh +++ b/src/patch/patch_system.hh @@ -3,8 +3,6 @@ // // patch_system - describes a system of interlinked patches // -// patch_system_info - static data on patch numbers/bounds/etc for patch system -// // // prerequisites: @@ -17,7 +15,6 @@ // fp.hh // coords.hh // grid.hh -// fd_grid.hh // patch.hh // patch_edge.hh // ghost_zone.hh @@ -25,8 +22,6 @@ // //****************************************************************************** -//****************************************************************************** -//****************************************************************************** // // a patch_system object describes a system of interlinked patches. @@ -48,6 +43,9 @@ public: octant_patch_system }; + // maximum number of patches in any patch-system type + static const int max_N_patches = 6; + // decode patch system type into N_patches static int N_patches_of_type(enum patch_system_type type_in); @@ -56,7 +54,7 @@ public: static const char *name_of_type(enum patch_system_type type_in); - + // // ***** coordinates ***** // @@ -100,6 +98,10 @@ public: // find a patch by name, return patch number; error_exit() if not found int patch_number_of_name(const char *name) const; + // total number of grid points + int N_grid_points() const { return N_grid_points_; } + int ghosted_N_grid_points() const { return ghosted_N_grid_points_; } + // // ***** meta-info about gridfns ***** @@ -108,6 +110,11 @@ public: int max_gfn() const { return ith_patch(0).max_gfn(); } int N_gridfns() const { return ith_patch(0).N_gridfns(); } + // + // ***** gridfns ***** + // + // nominal-grid + // // ***** misc stuff ***** @@ -148,10 +155,41 @@ public: int interpolator_order); ~patch_system(); -private: + // // ***** helper functions for constructor ***** // +private: + + // + // this (POD, and hence static-initializable) struct gives a + // minimal set of information which varies from one patch to + // another + // + struct patch_info + { + const char *name, + fp min_drho, max_drho; + fp min_dsigma, max_dsigma; + + // compute and return reference to + // struct grid_arrays::grid_array_pars + // from the info in this struct + // ... result refers to internal static buffer; + // the usual caveats about lifetimes/overwriting apply + const grid_arrays::grid_array_pars& grid_array_pars + (int N_ghost_points, int N_extend_points, + fp delta_drho_dsigma) + const; + + // compute and return reference to struct grid::grid_pars + // from the info in this struct + // ... result refers to internal static buffer; + // the usual caveats about lifetimes/overwriting apply + const grid::grid_pars& grid_pars + (int N_extend_points, fp delta_drho_dsigma) + const; + }; // create/interlink patches, ghost zones, and frontiers void setup_full_sphere_patch_system @@ -180,6 +218,14 @@ private: int min_gfn_in, int max_gfn_in, int interpolator_order); + // create patches, set pointers in all_patches_[] + void create_patches(int N_patches, + const struct patch_size all_patch_sizes[], + int N_ghost_points, int N_extend_points, + int N_overlap_points, fp delta_drho_dsigma, + int min_gfn_in, int max_gfn_in, + int interpolator_order); + // create/interlink a pair of periodic-symmetry ghost zones static void setup_periodic_symmetry_ghost_zones @@ -211,182 +257,20 @@ private: patch_system& operator=(const patch_system &rhs); private: + // actual storage arrays for grid functions + // ... array subscripts are [gfn][1d_grid_point_index] + // ... FIXME: should be boost::multi_array<> when I get this working + array2d<fp>* nominal_gridfns_; + array2d<fp>* ghosted_gridfns_; + // local <--> global coordinate mapping global_coords global_coords_; // meta-info about patch system enum patch_system_type type_; int N_patches_; + int N_grid_points_, ghosted_N_grid_points_; - // --> array(pn) of pointers to individual patches - array1d<patch *> *all_patches_; + // pointers to individual patches + std::vector<patch *> all_patches_; }; - -//****************************************************************************** -//****************************************************************************** -//****************************************************************************** - -// -// ***** patch numbers, bounds, etc (static data) ***** -// -namespace patch_system_info -{ -// largest number of patches for any patch system type -static const int max_N_patches = 6; - -// -// Alas, 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. (For example, the set of patches -// for a quadrant patch system isn't a subset of the set of patches for -// a half patch system.) -// - -// -// this (POD, and hence static-initializable) struct holds the constructor -// arguments which in practice vary from patch to patch -// -struct patch_info - { - int patch_number; - fp min_drho, max_drho; - fp min_dsigma, max_dsigma; - - // compute and return reference to struct grid_arrays::grid_array_pars - // from the info in this struct - // ... result refers to internal static buffer; - // the usual caveats about lifetimes/overwriting apply - const grid_arrays::grid_array_pars& grid_array_pars - (int N_ghost_points, int N_extend_points, fp delta_drho_dsigma) - const; - - // compute and return reference to struct grid::grid_pars - // from the info in this struct - // ... result refers to internal static buffer; - // the usual caveats about lifetimes/overwriting apply - const grid::grid_pars& grid_pars - (int N_extend_points, fp delta_drho_dsigma) - const; - }; - -// -// N.b. At present we only implement a few of the possible types -// of patch systems; it's easy to add additional types as needed -// (search for enum patch_system_type ). -// - -// -// full-sphere patch system -// ... covers all 4pi steradians -// -namespace full_sphere_patch_system_info - { -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}; - }; - -// -// +z hemisphere (half) patch system -// ... mirror symmetry across z=0 plane -// -namespace plus_z_hemisphere_patch_system_info - { -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}; - }; - -// -// +[xy] "vertical" quarter-grid (quadrant) patch system -// ... 90 degree periodic rotation symmetry about z axis -// -namespace plus_xy_quadrant_patch_system_info - { -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}; - }; - -// -// +[xz] "horizontal" quarter-grid (quadrant) patch system -// ... mirror symmetry across z=0 plane, -// 180 degree periodic rotation symmetry about z axis -// -namespace plus_xz_quadrant_patch_system_info - { -static const int N_patches = 4; - -// +z patch: (90 x 45 degrees) dmu [ -45, 45], dnu [ 0, 45] -static const struct patch_info plus_z = {0, -45.0, 45.0, 0.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 45 degrees) dmu [ 45, 90], dphi [ 45, 90] -static const struct patch_info plus_y = {2, 45.0, 90.0, 45.0, 90.0}; - -// -y patch: (45 x 45 degrees) dmu [ -90, -45], dphi [ -90, -45] -static const struct patch_info minus_y = {3, -90.0, -45.0, -90.0, -45.0}; - }; - -// -// +[xyz] (octant) patch system -// ... mirror symmetry across z=0 plane, -// 90 degree periodic rotation symmetry about z axis -// -namespace octant_patch_system_info - { -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:: -}; |