diff options
author | jthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5> | 2001-06-19 12:53:20 +0000 |
---|---|---|
committer | jthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5> | 2001-06-19 12:53:20 +0000 |
commit | abba8da4dce23981e72d6e800bef51dd5dd642e7 (patch) | |
tree | 84cbf1d50c7e67a9a9ae686b000a59585a148c9b /src/patch/coords.hh | |
parent | 5b4f6cd6cdbaaedf606af3951b72462877de1088 (diff) |
coords.hh
add coords_set bit masks
test_fd_grid
minor tweaks
git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinAnalysis/AHFinderDirect/trunk@66 f88db872-0e4f-0410-b76b-b9085cfa78c5
Diffstat (limited to 'src/patch/coords.hh')
-rw-r--r-- | src/patch/coords.hh | 66 |
1 files changed, 52 insertions, 14 deletions
diff --git a/src/patch/coords.hh b/src/patch/coords.hh index b34b257..f01c482 100644 --- a/src/patch/coords.hh +++ b/src/patch/coords.hh @@ -1,7 +1,9 @@ // coords.hh -- coordinate systems and conversions // $Id$ // -// local_coords - conversions between various local coordinate systems +// ***** coordinate systems ***** +// ***** conversions between different local coordinate systems ***** +// ***** bit masks for coordinates **** // global_coords - conversions between global and local coordinates // @@ -14,6 +16,10 @@ //****************************************************************************** // +// ***** coordinate systems ***** +// + +// // We use the following terminology for coordinates: // {a,b,c} == any one of (a,b,c) == a | b | c // ((a,b,c)) == any two of (a,b,c) == (a,b) | (a,c) | (b,c) @@ -46,19 +52,19 @@ //***************************************************************************** // -// The various local_coords functions provide conversions between -// different local coordinate systems. -namespace local_coords - { +// ***** conversions between different local coordinate systems ***** // // Bugs: -// These coordinate-conversion functions aren't optimally efficient: -// they do lots of could-be-optimized away arithmetic and trig calls. -// But in practice this doesn't matter, since we don't call these -// functions inside inner loops. (We cache their values at grid -// points.) +// These functions aren't optimally efficient: they do lots +// of could-be-optimized away arithmetic and trig calls. But +// In practice this doesn't matter, since we don't call these +// functions inside inner loops (instead, we cache their values +// at grid points). // +namespace local_coords + { + // ((mu,nu,phi)) --> the 3rd fp phi_of_mu_nu(fp mu, fp nu ); fp nu_of_mu_phi(fp mu, fp phi); @@ -96,7 +102,42 @@ void theta_phi_of_nu_phi(fp nu, fp phi, fp &ps_theta, fp &ps_phi); void mu_nu_of_theta_phi(fp ps_theta, fp ps_phi, fp &mu, fp &nu ); void mu_phi_of_theta_phi(fp ps_theta, fp ps_phi, fp &mu, fp &phi); void nu_phi_of_theta_phi(fp ps_theta, fp ps_phi, fp &nu, fp &phi); - }; + + }; // close namespace local_coords:: + +//***************************************************************************** + +// +// ***** bit masks for coordinates **** +// + +// +// We need to manipulate coordinates to do calculations like "which +// coordinate do these two patches have in common". We do these by +// Boolean operations on integers using the following bit masks: +// + +namespace local_coords + { + +typedef int coords_set; + +static const int set_mu = 0x1; +static const int set_nu = 0x2; +static const int set_phi = 0x4; + +static const int set_empty = 0x0; +static const int set_all = set_mu | set_nu | set_phi; + +// human-readable coordinate names for debugging etc +const char *name_of_coords_set(coords_set S); + +// set complement of coordinates +inline + coords_set coords_set_not(coords_set S) + { return set_all & ~S; } + + }; // close namespace local_coords:: //****************************************************************************** @@ -128,7 +169,6 @@ public: fp origin_y() const { return origin_y_; } fp origin_z() const { return origin_z_; } - // ***** constructor, destructor ***** // constructor: specify global (x,y,z) coordinates of local origin point global_coords(fp origin_x_in, fp origin_y_in, fp origin_z_in) : origin_x_(origin_x_in), @@ -137,7 +177,6 @@ public: { } // destructor: compiler-generated no-op is ok - // ***** copy constructor, assignment operator ***** private: // we forbid copying and passing by value // by declaring the copy constructor and assignment operator @@ -145,7 +184,6 @@ private: global_coords(const global_coords &rhs); global_coords& operator=(const global_coords &rhs); - // ***** member variables ***** private: // global (x,y,z) coordinates of local origin point fp origin_x_, origin_y_, origin_z_; |