diff options
author | jthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5> | 2001-06-19 12:58:42 +0000 |
---|---|---|
committer | jthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5> | 2001-06-19 12:58:42 +0000 |
commit | 74fa6073ca348d2d538e0cbb062794616674e9c0 (patch) | |
tree | ae7f995e8b6fde479c155d3dfbaef3ee6ff3daac /src | |
parent | abba8da4dce23981e72d6e800bef51dd5dd642e7 (diff) |
add coords-bit-vector fns (copied from JT cvs ~/mpe/util/coords.cc)
git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinAnalysis/AHFinderDirect/trunk@67 f88db872-0e4f-0410-b76b-b9085cfa78c5
Diffstat (limited to 'src')
-rw-r--r-- | src/patch/coords.cc | 55 |
1 files changed, 47 insertions, 8 deletions
diff --git a/src/patch/coords.cc b/src/patch/coords.cc index 510a3f6..ff8b5d8 100644 --- a/src/patch/coords.cc +++ b/src/patch/coords.cc @@ -2,12 +2,14 @@ // $Id$ // -// local_{mu,nu,phi}_of_((mu,nu,phi)) -// local_xyz_of_((mu,nu,phi)) -// local_xyz_of_r_((mu,nu,phi)) -// local_((mu,nu,phi))_of_xyz -// local_r_((mu,nu,phi))_of_xyz -// local_theta_phi_of_((mu,nu,phi)) +// local_coords::{mu,nu,phi}_of_((mu,nu,phi)) +// local_coords::xyz_of_((mu,nu,phi)) +// local_coords::xyz_of_r_((mu,nu,phi)) +// local_coords::((mu,nu,phi))_of_xyz +// local_coords::r_((mu,nu,phi))_of_xyz +// local_coords::theta_phi_of_((mu,nu,phi)) +// +// local_coords::mu_nu_phi::name_of_coords_set // #include <math.h> @@ -21,6 +23,7 @@ #include "fp.hh" #include "coords.hh" +using jtutil::error_exit; using jtutil::arctan_xy; using jtutil::pow2; using jtutil::hypot3; @@ -88,8 +91,6 @@ return arctan_xy(z_over_x, y_over_x); } //****************************************************************************** -//****************************************************************************** -//****************************************************************************** // // these functions convert ((mu,nu,phi)) <--> (x,y,z) on the (local) @@ -432,3 +433,41 @@ xyz_of_theta_phi(ps_theta, ps_phi, x, y, z); nu_phi_of_xyz(x, y, z, nu, phi); } } + +//****************************************************************************** +//****************************************************************************** +//****************************************************************************** + +// +// This function computes a human-readable name from a (mu,nu,phi) +// coordinates set. +// +const char *local_coords::name_of_coords_set(coords_set S) +{ +// +// we have to use an if-else chain because the coords::set_* constants +// aren't compile-time constants and hence aren't eligible to be switch +// case labels +// +if (S == set_empty) + then return "{}"; +else if (S == set_mu) + then return "mu"; +else if (S == set_nu) + then return "nu"; +else if (S == set_phi) + then return "phi"; +else if (S == set_mu|set_nu) + then return "{mu,nu}"; +else if (S == set_mu|set_phi) + then return "{mu,phi}"; +else if (S == set_nu|set_phi) + then return "{nu,phi}"; +else if (S == set_mu|set_nu|set_phi) + then return "{mu,nu,phi}"; +else error_exit(PANIC_EXIT, +"***** coords::mu_nu_phi::name_of_coords_set:\n" +" S=0x%x isn't a valid coords_set bit vector!\n" +, + int(S)); /*NOTREACHED*/ +} |