diff options
author | jthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5> | 2002-04-22 10:36:03 +0000 |
---|---|---|
committer | jthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5> | 2002-04-22 10:36:03 +0000 |
commit | 6c55334df2f750463cee506dc69b4d6416756b56 (patch) | |
tree | f5d5867c2293c495c15ac2a47c0eb9cd464bba74 | |
parent | 284b3ee1474e95329b584032d8b2dd0c8dcca444 (diff) |
add functions to compute direction cosines of wrt local coords origin
git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinAnalysis/AHFinderDirect/trunk@561 f88db872-0e4f-0410-b76b-b9085cfa78c5
-rw-r--r-- | src/patch/coords.cc | 44 | ||||
-rw-r--r-- | src/patch/coords.hh | 12 | ||||
-rw-r--r-- | src/patch/patch.hh | 37 |
3 files changed, 92 insertions, 1 deletions
diff --git a/src/patch/coords.cc b/src/patch/coords.cc index f209abf..473e375 100644 --- a/src/patch/coords.cc +++ b/src/patch/coords.cc @@ -13,6 +13,7 @@ // // usual polar spherical (r,theta,phi) <--> (x,y,z) // ((mu,nu,phi)) <--> usual polar spherical (theta,phi) +// ((mu,nu,phi)) --> direction cosines (alpha,beta,gamma) // // local_coords::mu_nu_phi::name_of_coords_set // @@ -422,6 +423,49 @@ assert( fuzzy_EQ_ang(phi, ps_phi) ); } //****************************************************************************** + +// +// these functions convert ((mu,nu,phi)) to the direction cosines +// (alpha,beta,gamma) +// + +namespace local_coords + { +void alpha_beta_gamma_of_mu_nu (fp mu, fp nu , fp& alpha, fp& beta, fp& gamma) +{ +fp x, y, z; +xyz_of_r_mu_nu(1.0,mu,nu, x,y,z); +alpha = x; +beta = y; +gamma = z; +} + } + +namespace local_coords + { +void alpha_beta_gamma_of_mu_phi(fp mu, fp phi, fp& alpha, fp& beta, fp& gamma) +{ +fp x, y, z; +xyz_of_r_mu_phi(1.0,mu,phi, x,y,z); +alpha = x; +beta = y; +gamma = z; +} + } + +namespace local_coords + { +void alpha_beta_gamma_of_nu_phi(fp nu, fp phi, fp& alpha, fp& beta, fp& gamma) +{ +fp x, y, z; +xyz_of_r_nu_phi(1.0,nu,phi, x,y,z); +alpha = x; +beta = y; +gamma = z; +} + } + +//****************************************************************************** //****************************************************************************** //****************************************************************************** diff --git a/src/patch/coords.hh b/src/patch/coords.hh index 3f81bba..f101b1f 100644 --- a/src/patch/coords.hh +++ b/src/patch/coords.hh @@ -53,6 +53,13 @@ // // +// We also use direction cosines (alpha,beta,gamma): +// alpha = x/r = cos(angle between vector from origin to (x,y,z), and x axis) +// beta = y/r = cos(angle between vector from origin to (x,y,z), and y axis) +// gamma = z/r = cos(angle between vector from origin to (x,y,z), and z axis) +// + +// // We also use prefixes on coordinates, eg. // irho integer grid coordinate // rho floating point angular coordinate, measured in radians @@ -122,7 +129,6 @@ fp modulo_reduce_dang(fp dang, fp min_dang, fp max_dang); namespace local_coords { - // (r,(mu,nu,phi)) <--> (x,y,z) void xyz_of_r_mu_nu (fp r, fp mu, fp nu , fp& x, fp& y, fp& z); void xyz_of_r_mu_phi(fp r, fp mu, fp phi, fp& x, fp& y, fp& z); @@ -171,6 +177,10 @@ 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); +// ((mu,nu,phi)) --> direction cosines (alpha,beta,gamma) +void alpha_beta_gamma_of_mu_nu (fp mu, fp nu , fp& alpha, fp& beta, fp& gamma); +void alpha_beta_gamma_of_mu_phi(fp mu, fp phi, fp& alpha, fp& beta, fp& gamma); +void alpha_beta_gamma_of_nu_phi(fp nu, fp phi, fp& alpha, fp& beta, fp& gamma); }; // close namespace local_coords:: //***************************************************************************** diff --git a/src/patch/patch.hh b/src/patch/patch.hh index 5bae6cb..9364d4b 100644 --- a/src/patch/patch.hh +++ b/src/patch/patch.hh @@ -211,6 +211,13 @@ public: virtual fp rho_of_xyz(fp x, fp y, fp z) const = 0; virtual fp sigma_of_xyz(fp x, fp y, fp z) const = 0; + // convert (rho,sigma) --> direction cosines (alpha,beta,gamma) + // with respect to the local coordinate system + virtual void alpha_beta_gamma_of_rho_sigma + (fp rho, fp sigma, + fp& alpha, fp& beta, fp& gamma) + const = 0; + // partial (rho,sigma) / partial (x,y,z) virtual fp partial_rho_wrt_x(fp x, fp y, fp z) const = 0; virtual fp partial_rho_wrt_y(fp x, fp y, fp z) const = 0; @@ -573,6 +580,16 @@ public: fp sigma_of_xyz(fp x, fp y, fp z) const { return local_coords::nu_of_xz(x,z); } + // convert (rho,sigma) --> direction cosines (alpha,beta,gamma) + // with respect to the local coordinate system + void alpha_beta_gamma_of_rho_sigma(fp rho, fp sigma, + fp& alpha, fp& beta, fp& gamma) + const + { + local_coords::alpha_beta_gamma_of_mu_nu(rho,sigma, + alpha,beta,gamma); + } + // partial (rho,sigma) / partial (x,y,z) fp partial_rho_wrt_x(fp x, fp y, fp z) const { return 0.0; } fp partial_rho_wrt_y(fp x, fp y, fp z) const @@ -685,6 +702,16 @@ public: fp sigma_of_xyz(fp x, fp y, fp z) const { return local_coords::phi_of_xy(x, y); } + // convert (rho,sigma) --> direction cosines (alpha,beta,gamma) + // with respect to the local coordinate system + void alpha_beta_gamma_of_rho_sigma(fp rho, fp sigma, + fp& alpha, fp& beta, fp& gamma) + const + { + local_coords::alpha_beta_gamma_of_nu_phi(rho,sigma, + alpha,beta,gamma); + } + // partial (rho,sigma) / partial (x,y,z) fp partial_rho_wrt_x(fp x, fp y, fp z) const { return local_coords::partial_nu_wrt_x(x,z); } @@ -799,6 +826,16 @@ public: fp sigma_of_xyz(fp x, fp y, fp z) const { return local_coords::phi_of_xy(x, y); } + // convert (rho,sigma) --> direction cosines (alpha,beta,gamma) + // with respect to the local coordinate system + void alpha_beta_gamma_of_rho_sigma(fp rho, fp sigma, + fp& alpha, fp& beta, fp& gamma) + const + { + local_coords::alpha_beta_gamma_of_mu_phi(rho,sigma, + alpha,beta,gamma); + } + // partial (rho,sigma) / partial (x,y,z) fp partial_rho_wrt_x(fp x, fp y, fp z) const { return 0.0; } fp partial_rho_wrt_y(fp x, fp y, fp z) const |