vector_etamu.C

00001 /*
00002  *  Methods of class Vector related to eta and mu
00003  *
00004  *   (see file vector.h for documentation)
00005  *
00006  */
00007 
00008 /*
00009  *   Copyright (c) 2005 Eric Gourgoulhon & Jerome Novak
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 vector_etamu_C[] = "$Header: /cvsroot/Lorene/C++/Source/Tensor/vector_etamu.C,v 1.2 2008/08/27 08:52:23 jl_cornou Exp $" ;
00031 
00032 /*
00033  * $Id: vector_etamu.C,v 1.2 2008/08/27 08:52:23 jl_cornou Exp $
00034  * $Log: vector_etamu.C,v $
00035  * Revision 1.2  2008/08/27 08:52:23  jl_cornou
00036  * Added fonctions for angular potential A
00037  *
00038  * Revision 1.1  2005/02/14 13:01:50  j_novak
00039  * p_eta and p_mu are members of the class Vector. Most of associated functions
00040  * have been moved from the class Vector_divfree to the class Vector.
00041  *
00042  *
00043  * $Header: /cvsroot/Lorene/C++/Source/Tensor/vector_etamu.C,v 1.2 2008/08/27 08:52:23 jl_cornou Exp $
00044  *
00045  */
00046 
00047 // Headers C
00048 #include <stdlib.h>
00049 #include <assert.h>
00050 
00051 // Headers Lorene
00052 #include "tensor.h"
00053 
00054             //--------------//
00055             //     eta      //
00056             //--------------//
00057             
00058             
00059 const Scalar& Vector::eta() const {
00060 
00061 
00062     if (p_eta == 0x0) {   // a new computation is necessary
00063     
00064     // All this has a meaning only for spherical components:
00065 #ifndef NDEBUG 
00066     const Base_vect_spher* bvs = dynamic_cast<const Base_vect_spher*>(triad) ;
00067     assert(bvs != 0x0) ; 
00068 #endif
00069     
00070     // eta is computed from its definition:
00071     Scalar sou_eta = *cmp[1] ;  //V^th
00072     sou_eta.div_tant() ;
00073     sou_eta += cmp[1]->dsdt() + cmp[2]->stdsdp();
00074         
00075     // Resolution of the angular Poisson equation for eta
00076     // --------------------------------------------------
00077     p_eta = new Scalar( sou_eta.poisson_angu() ) ; 
00078     
00079     }
00080 
00081     return *p_eta ; 
00082 
00083 }
00084 
00085 
00086             //--------------//
00087             //     mu       //
00088             //--------------//
00089             
00090             
00091 const Scalar& Vector::mu() const {
00092 
00093 
00094     if (p_mu == 0x0) {   // a new computation is necessary
00095     
00096     // All this has a meaning only for spherical components:
00097 #ifndef NDEBUG 
00098     const Base_vect_spher* bvs = dynamic_cast<const Base_vect_spher*>(triad) ;
00099     assert(bvs != 0x0) ; 
00100 #endif
00101     
00102     Scalar tmp = *cmp[2] ;  // V^ph
00103     tmp.div_tant() ;        // V^ph / tan(th)
00104     
00105     // dV^ph/dth + V^ph/tan(th) - 1/sin(th) dV^th/dphi 
00106     tmp += cmp[2]->dsdt() - cmp[1]->stdsdp() ; 
00107     
00108     // Resolution of the angular Poisson equation for mu
00109     // --------------------------------------------------
00110     p_mu = new Scalar( tmp.poisson_angu() ) ;  
00111     
00112     }
00113     
00114     return *p_mu ; 
00115 
00116 }
00117 
00118             //-----------//
00119             //    A      //
00120             //-----------//
00121 
00122 const Scalar& Vector::A() const {
00123     
00124     
00125     if (p_A == 0x0) {   // A new computation is necessary
00126     
00127         // All this has a meaning only for spherical components :
00128 #ifndef NDEBUG 
00129     const Base_vect_spher* bvs = dynamic_cast<const Base_vect_spher*>(triad) ;
00130     assert(bvs != 0x0) ; 
00131 #endif
00132     
00133     // p_eta doit ĂȘtre calculĂ©
00134     if (p_eta == 0x0) { Scalar etatmp = this->eta(); }
00135 
00136     Scalar tmp = -*cmp[0] ;   // -V^r
00137     tmp.div_r_dzpuis(2);         // -V^r/r
00138 
00139     Scalar eta_tilde = *p_eta ;
00140     Scalar etad = eta_tilde.dsdr() ; 
00141     eta_tilde.div_r_dzpuis(2);
00142     etad.set_dzpuis(2);
00143     tmp += etad + eta_tilde ; // d eta / dr + eta/r
00144 
00145     p_A = new Scalar (tmp) ;
00146     }
00147     
00148     return *p_A ;
00149 }
00150     
00151 
00152 
00153 
00154 
00155             //----------------//
00156             //  update_vtvp   //
00157             //----------------//
00158             
00159 
00160 void Vector::update_vtvp() {
00161 
00162     assert( (p_eta != 0x0) && (p_mu != 0x0) ) ; 
00163 
00164     // V^theta :
00165     *cmp[1] = p_eta->dsdt() - p_mu->stdsdp() ; 
00166 
00167     // V^phi : 
00168     *cmp[2] = p_eta->stdsdp() + p_mu->dsdt() ; 
00169     
00170     Scalar* p_eta_tmp = p_eta ;  //## in order not to delete p_eta and p_mu
00171     p_eta = 0x0 ;
00172     Scalar* p_mu_tmp = p_mu ;
00173     p_mu = 0x0 ;    
00174     Vector::del_deriv() ;
00175     
00176     p_eta = p_eta_tmp ;
00177     p_mu = p_mu_tmp ;
00178     
00179 }           
00180 
00181 
00182 void Vector::set_vr_eta_mu(const Scalar& vr_i, const Scalar& eta_i,
00183                const Scalar& mu_i) {
00184     
00185     // All this has a meaning only for spherical components:
00186     assert( dynamic_cast<const Base_vect_spher*>(triad) != 0x0 ) ; 
00187     assert(&vr_i.get_mp() == &eta_i.get_mp()) ; 
00188 
00189     del_deriv() ; 
00190     
00191     // V^r
00192     *cmp[0] = vr_i ; 
00193 
00194     p_eta = new Scalar( eta_i ) ;   // eta
00195     
00196     p_mu = new Scalar( mu_i ) ;     // mu 
00197         
00198     update_vtvp() ;
00199 
00200     return ;
00201 }
00202 
00203 
00204 
00205 
00206 

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