map_radial_comp_xyz.C

00001 /*
00002  * Methods Map_radial::comp_x_from_spherical
00003  *     Map_radial::comp_y_from_spherical
00004  *     Map_radial::comp_z_from_spherical
00005  *
00006  */
00007 
00008 /*
00009  *   Copyright (c) 2000-2001 Eric Gourgoulhon
00010  *
00011  *   This file is part of LORENE.
00012  *
00013  *   LORENE is free software; you can redistribute it and/or modify
00014  *   it under the terms of the GNU General Public License as published by
00015  *   the Free Software Foundation; either version 2 of the License, or
00016  *   (at your option) any later version.
00017  *
00018  *   LORENE is distributed in the hope that it will be useful,
00019  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021  *   GNU General Public License for more details.
00022  *
00023  *   You should have received a copy of the GNU General Public License
00024  *   along with LORENE; if not, write to the Free Software
00025  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00026  *
00027  */
00028 
00029 
00030 char map_radial_comp_xyz_C[] = "$Header: /cvsroot/Lorene/C++/Source/Map/map_radial_comp_xyz.C,v 1.2 2005/09/15 15:51:25 j_novak Exp $" ;
00031 
00032 /*
00033  * $Id: map_radial_comp_xyz.C,v 1.2 2005/09/15 15:51:25 j_novak Exp $
00034  * $Log: map_radial_comp_xyz.C,v $
00035  * Revision 1.2  2005/09/15 15:51:25  j_novak
00036  * The "rotation" (change of triad) methods take now Scalars as default
00037  * arguments.
00038  *
00039  * Revision 1.1.1.1  2001/11/20 15:19:27  e_gourgoulhon
00040  * LORENE
00041  *
00042  * Revision 2.0  2000/09/11  15:56:22  eric
00043  * *** empty log message ***
00044  *
00045  *
00046  * $Header: /cvsroot/Lorene/C++/Source/Map/map_radial_comp_xyz.C,v 1.2 2005/09/15 15:51:25 j_novak Exp $
00047  *
00048  */
00049 
00050 // Headers C
00051 #include <assert.h>
00052 
00053 // Headers Lorene
00054 #include "tensor.h"
00055 #include "cmp.h"
00056 
00057 
00058             //------------------------------------//
00059             //      X  component          //
00060             //------------------------------------//
00061 void Map_radial::comp_x_from_spherical(const Cmp& v_r, const Cmp& v_theta, 
00062                        const Cmp& v_phi, Cmp& v_x) const {
00063     Scalar resu(v_x) ;
00064     comp_x_from_spherical(Scalar(v_r), Scalar(v_theta), Scalar(v_phi), 
00065               resu ) ;
00066     v_x = resu ;
00067 }
00068 
00069 void Map_radial::comp_x_from_spherical(const Scalar& v_r, const Scalar& v_theta, 
00070                        const Scalar& v_phi, Scalar& v_x) const {
00071                        
00072 
00073     // Protections
00074     // -----------
00075     assert(v_r.get_etat() != ETATNONDEF) ; 
00076     assert(v_theta.get_etat() != ETATNONDEF) ; 
00077     assert(v_phi.get_etat() != ETATNONDEF) ; 
00078 
00079     assert(v_r.get_mp() == *this) ; 
00080     assert(v_theta.get_mp() == *this) ; 
00081     assert(v_phi.get_mp() == *this) ; 
00082     
00083     int dzp ;
00084     if ( v_r.dz_nonzero() ) {
00085     dzp = v_r.get_dzpuis() ; 
00086     }
00087     else{
00088     if ( v_theta.dz_nonzero() ) {
00089         dzp = v_theta.get_dzpuis() ; 
00090     }
00091     else{
00092         dzp = v_phi.get_dzpuis() ; 
00093     }
00094     }
00095      
00096     assert( v_r.check_dzpuis(dzp) ) ; 
00097     assert( v_theta.check_dzpuis(dzp) ) ; 
00098     assert( v_phi.check_dzpuis(dzp) ) ; 
00099     
00100     // Computation
00101     // -----------
00102     const Valeur& w_r = v_r.get_spectral_va() ; 
00103     const Valeur& w_t = v_theta.get_spectral_va() ; 
00104     const Valeur& w_p = v_phi.get_spectral_va() ; 
00105     
00106     Valeur tmp = w_r.mult_st() + w_t.mult_ct() ;
00107 
00108     v_x = tmp.mult_cp() - w_p.mult_sp() ; 
00109     
00110     v_x.set_dzpuis(dzp) ; 
00111       
00112 }
00113             
00114 
00115             //------------------------------------//
00116             //      Y  component          //
00117             //------------------------------------//
00118 
00119 void Map_radial::comp_y_from_spherical(const Cmp& v_r, const Cmp& v_theta, 
00120                        const Cmp& v_phi, Cmp& v_y) const {
00121 
00122     Scalar resu(v_y) ;
00123     comp_y_from_spherical(Scalar(v_r), Scalar(v_theta), Scalar(v_phi), 
00124               resu ) ;
00125     v_y = resu ;
00126 }
00127 
00128 void Map_radial::comp_y_from_spherical(const Scalar& v_r, const Scalar& v_theta, 
00129                        const Scalar& v_phi, Scalar& v_y) const {
00130                        
00131 
00132     // Protections
00133     // -----------
00134     assert(v_r.get_etat() != ETATNONDEF) ; 
00135     assert(v_theta.get_etat() != ETATNONDEF) ; 
00136     assert(v_phi.get_etat() != ETATNONDEF) ; 
00137 
00138     assert(v_r.get_mp() == *this) ; 
00139     assert(v_theta.get_mp() == *this) ; 
00140     assert(v_phi.get_mp() == *this) ; 
00141     
00142     int dzp ;
00143     if ( v_r.dz_nonzero() ) {
00144     dzp = v_r.get_dzpuis() ; 
00145     }
00146     else{
00147     if ( v_theta.dz_nonzero() ) {
00148         dzp = v_theta.get_dzpuis() ; 
00149     }
00150     else{
00151         dzp = v_phi.get_dzpuis() ; 
00152     }
00153     }
00154      
00155     assert( v_r.check_dzpuis(dzp) ) ; 
00156     assert( v_theta.check_dzpuis(dzp) ) ; 
00157     assert( v_phi.check_dzpuis(dzp) ) ; 
00158     
00159     // Computation
00160     // -----------
00161     const Valeur& w_r = v_r.get_spectral_va() ; 
00162     const Valeur& w_t = v_theta.get_spectral_va() ; 
00163     const Valeur& w_p = v_phi.get_spectral_va() ; 
00164     
00165     Valeur tmp = w_r.mult_st() + w_t.mult_ct() ;
00166 
00167     v_y = tmp.mult_sp() + w_p.mult_cp() ; 
00168     
00169     v_y.set_dzpuis(dzp) ; 
00170       
00171 }
00172             
00173             //------------------------------------//
00174             //      Z  component          //
00175             //------------------------------------//
00176 
00177 void Map_radial::comp_z_from_spherical(const Cmp& v_r, const Cmp& v_theta, 
00178                        Cmp& v_z) const {
00179     Scalar resu = v_z ;
00180     comp_z_from_spherical(Scalar(v_r), Scalar(v_theta), resu) ;
00181     v_z = resu ;
00182 
00183 }
00184 
00185 void Map_radial::comp_z_from_spherical(const Scalar& v_r, const Scalar& v_theta, 
00186                        Scalar& v_z) const {
00187                        
00188 
00189     // Protections
00190     // -----------
00191     assert(v_r.get_etat() != ETATNONDEF) ; 
00192     assert(v_theta.get_etat() != ETATNONDEF) ; 
00193 
00194     assert(v_r.get_mp() == *this) ; 
00195     assert(v_theta.get_mp() == *this) ; 
00196     
00197     int dzp ;
00198     if ( v_r.dz_nonzero() ) {
00199     dzp = v_r.get_dzpuis() ; 
00200     }
00201     else{
00202     dzp = v_theta.get_dzpuis() ; 
00203     }
00204      
00205     assert( v_r.check_dzpuis(dzp) ) ; 
00206     assert( v_theta.check_dzpuis(dzp) ) ; 
00207     
00208     // Computation
00209     // -----------
00210     const Valeur& w_r = v_r.get_spectral_va() ; 
00211     const Valeur& w_t = v_theta.get_spectral_va() ; 
00212     
00213     v_z = w_r.mult_ct() - w_t.mult_st() ; 
00214     
00215     v_z.set_dzpuis(dzp) ; 
00216       
00217 }
00218             
00219             

Generated on Tue Feb 7 01:35:18 2012 for LORENE by  doxygen 1.4.6