aboutsummaryrefslogtreecommitdiff
path: root/src/patch/grid.hh
diff options
context:
space:
mode:
authorjthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5>2002-03-27 16:55:50 +0000
committerjthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5>2002-03-27 16:55:50 +0000
commit1fdaeca7da8a7a91337e5964fc0916c4027796be (patch)
tree0116ad04b77c4355838559009fbdeb085cf2f28d /src/patch/grid.hh
parent00d6bbfc887f4f85c03c57c059f1da5d3641bc10 (diff)
store both nominal and ghosted gridfns
git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinAnalysis/AHFinderDirect/trunk@374 f88db872-0e4f-0410-b76b-b9085cfa78c5
Diffstat (limited to 'src/patch/grid.hh')
-rw-r--r--src/patch/grid.hh76
1 files changed, 48 insertions, 28 deletions
diff --git a/src/patch/grid.hh b/src/patch/grid.hh
index 7bcb3d3..1e65cda 100644
--- a/src/patch/grid.hh
+++ b/src/patch/grid.hh
@@ -34,10 +34,7 @@
// related to those subscripts.
//
// The grid has a nominal extent, surrounded by "ghost zones" on each
-// side for finite differencing purposes. For simplicity, all grid
-// functions (gridfns) are stored on the full "ghosted" grid (nominal
-// + ghost zones), even though we actually only need this for finite
-// differencing targets.
+// side for finite differencing purposes.
//
// We identify a gridfn by a small-integer "grid function number",
// a.k.a. "gfn". Each gridfn is stored contiguously.
@@ -94,25 +91,6 @@ public:
//
- // ***** gfn-checking and gridfn access functions *****
- //
-
- int min_gfn() const { return min_gfn_; }
- int max_gfn() const { return max_gfn_; }
- int N_gridfns() const
- { return jtutil::how_many_in_range(min_gfn(), max_gfn()); }
-
- // access to gridfn data
- // ... rvalue (may be slightly faster since it's a const function
- // and it returns by value rather than reference
- fp gridfn(int gfn, int irho, int isigma) const
- { return gridfn_data_(gfn, irho, isigma); }
- // ... lvalue (must return a reference)
- fp& gridfn(int gfn, int irho, int isigma)
- { return gridfn_data_(gfn, irho, isigma); }
-
-
- //
// ***** array info *****
//
@@ -136,7 +114,7 @@ public:
int N_grid_points() const
{ return N_irho() * N_isigma(); }
- // full-grid min/max (don't need sizes)
+ // ghosted-grid min/max/sizes
int ghosted_min_irho() const { return ghosted_min_irho_; }
int ghosted_max_irho() const { return ghosted_max_irho_; }
int ghosted_min_isigma() const
@@ -158,6 +136,18 @@ public:
return want_min ? ghosted_min_iang(want_rho)
: ghosted_max_iang(want_rho);
}
+ int ghosted_N_irho() const
+ {
+ return jtutil::how_many_in_range(ghosted_min_irho(),
+ ghosted_max_irho());
+ }
+ int ghosted_N_isigma() const
+ {
+ return jtutil::how_many_in_range(ghosted_min_isigma(),
+ ghosted_max_isigma());
+ }
+ int ghosted_N_grid_points() const
+ { return ghosted_N_irho() * ghosted_N_isigma(); }
// "effective" grid min/max
// (= dynamic select between nominal and full grids)
@@ -281,6 +271,34 @@ public:
//
+ // ***** gfn-checking and gridfn access functions *****
+ //
+
+ int min_gfn() const { return min_gfn_; }
+ int max_gfn() const { return max_gfn_; }
+ int N_gridfns() const
+ { return jtutil::how_many_in_range(min_gfn(), max_gfn()); }
+
+ // access to nominal-grid gridfn data
+ // ... rvalue (may be slightly faster since it's a const function
+ // and it returns by value rather than reference
+ fp gridfn(int gfn, int irho, int isigma) const
+ { return gridfn_data_(gfn, irho, isigma); }
+ // ... lvalue (must return a reference)
+ fp& gridfn(int gfn, int irho, int isigma)
+ { return gridfn_data_(gfn, irho, isigma); }
+
+ // access to ghosted-grid gridfn data
+ // ... rvalue (may be slightly faster since it's a const function
+ // and it returns by value rather than reference
+ fp ghosted_gridfn(int gfn, int irho, int isigma) const
+ { return ghosted_gridfn_data_(gfn, irho, isigma); }
+ // ... lvalue (must return a reference)
+ fp& ghosted_gridfn(int gfn, int irho, int isigma)
+ { return ghosted_gridfn_data_(gfn, irho, isigma); }
+
+
+ //
// ***** argument structure for constructor *****
//
@@ -288,9 +306,9 @@ public:
// have 20+ (!) separate arguments to our top-level constructors
struct grid_array_pars
{
- int min_irho, max_irho;
+ int min_irho, max_irho;
int min_isigma, max_isigma;
- int min_rho_N_ghost_points, max_rho_N_ghost_points;
+ int min_rho_N_ghost_points, max_rho_N_ghost_points;
int min_sigma_N_ghost_points, max_sigma_N_ghost_points;
};
@@ -313,9 +331,11 @@ private:
//
// ***** the actual gridfn storage arrays *****
//
- // n.b. this array is *first* data member in this class
+ // n.b. these arrays are *first* data member in this class
// ==> possibly slightly faster access (0 offset from pointer)
- array3d<fp> gridfn_data_; // indices are (gfn, irho, isigma)
+ // ... indices are (gfn, irho, isigma)
+ array3d<fp> gridfn_data_;
+ array3d<fp> ghosted_gridfn_data_;
// gfn bounds
const int min_gfn_, max_gfn_;