map_log_deriv.C

00001 /*
00002  * Computations of Scalar partial derivatives for a Map_log mapping
00003  */
00004 
00005 /*
00006  *   Copyright (c) 2004 Philippe Grandclement
00007  *
00008  *   This file is part of LORENE.
00009  *
00010  *   LORENE is free software; you can redistribute it and/or modify
00011  *   it under the terms of the GNU General Public License as published by
00012  *   the Free Software Foundation; either version 2 of the License, or
00013  *   (at your option) any later version.
00014  *
00015  *   LORENE is distributed in the hope that it will be useful,
00016  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  *   GNU General Public License for more details.
00019  *
00020  *   You should have received a copy of the GNU General Public License
00021  *   along with LORENE; if not, write to the Free Software
00022  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00023  *
00024  */
00025 
00026 
00027 char map_log_deriv_C[] = "$Header: /cvsroot/Lorene/C++/Source/Map/map_log_deriv.C,v 1.2 2012/01/17 10:33:43 j_penner Exp $" ;
00028 
00029 /*
00030  * $Id: map_log_deriv.C,v 1.2 2012/01/17 10:33:43 j_penner Exp $
00031  * $Log: map_log_deriv.C,v $
00032  * Revision 1.2  2012/01/17 10:33:43  j_penner
00033  * added a derivative with respect to the computational coordinate xi
00034  *
00035  * Revision 1.1  2004/06/22 08:49:58  p_grandclement
00036  * Addition of everything needed for using the logarithmic mapping
00037  *
00038  * 
00039  * $Header: /cvsroot/Lorene/C++/Source/Map/map_log_deriv.C,v 1.2 2012/01/17 10:33:43 j_penner Exp $
00040  *
00041  */
00042  
00043 // Header Lorene
00044 #include "map.h"
00045 #include "tensor.h"
00046 
00047                     //---------------------------------------------------
00048                    // d/d\xi
00049                   //---------------------------------------------------
00050 void Map_log::dsdxi(const Scalar& uu, Scalar& resu) const {
00051 
00052   assert (uu.get_etat() != ETATNONDEF) ; 
00053   assert (uu.get_mp().get_mg() == mg) ; 
00054 
00055     
00056   if (uu.get_etat() == ETATZERO) {
00057     resu.set_etat_zero() ; 
00058   }
00059   else {   
00060     assert( uu.get_etat() == ETATQCQ ) ; 
00061 
00062     const Valeur& uuva = uu.get_spectral_va() ; 
00063 
00064     uuva.coef() ;    // (uu.va).c_cf is up to date
00065     
00066     int nz = mg->get_nzone() ; 
00067     int nzm1 = nz - 1 ;
00068 
00069     if ( uu.get_dzpuis() == 0 ) {
00070       resu = uuva.dsdx() ;     //  dsdx == d/d\xi
00071     
00072       if (mg->get_type_r(nzm1) == UNSURR) {
00073     resu.set_dzpuis(2) ;    // r^2 d/dr has been computed in the
00074                             // external domain
00075       } 
00076     }
00077     else {
00078       assert(mg->get_type_r(nzm1) == UNSURR) ;
00079 
00080       int dzp = uu.get_dzpuis() ;
00081       
00082       resu = uuva.dsdx() ;
00083       resu.annule_domain(nzm1) ;  // zero in the CED
00084       
00085       // Special treatment in the CED
00086       Valeur tmp_ced = - uuva.dsdx() ; 
00087       tmp_ced.annule(0, nz-2) ; // only non zero in the CED
00088       tmp_ced.mult_xm1_zec() ; 
00089       tmp_ced.set(nzm1) -= dzp * uuva(nzm1) ; 
00090       
00091       // Recombination shells + CED : 
00092       resu.set_spectral_va() += tmp_ced ;
00093       
00094       resu.set_dzpuis(dzp+1) ;         
00095     
00096     }
00097     resu.set_spectral_base( uuva.dsdx().get_base() ) ; // same basis as d/dxi
00098   }   
00099 }    
00100 
00101                     //---------------------------------------------------
00102                    // Derivee standard par rapport au "vrai" rayon .....
00103                   //---------------------------------------------------
00104 void Map_log::dsdr(const Scalar& uu, Scalar& resu) const {
00105 
00106   assert (uu.get_etat() != ETATNONDEF) ; 
00107   assert (uu.get_mp().get_mg() == mg) ; 
00108 
00109     
00110   if (uu.get_etat() == ETATZERO) {
00111     resu.set_etat_zero() ; 
00112   }
00113   else {   
00114     assert( uu.get_etat() == ETATQCQ ) ; 
00115 
00116     const Valeur& uuva = uu.get_spectral_va() ; 
00117 
00118     uuva.coef() ;    // (uu.va).c_cf is up to date
00119     
00120     int nz = mg->get_nzone() ; 
00121     int nzm1 = nz - 1 ;
00122 
00123     if ( uu.get_dzpuis() == 0 ) {
00124       resu = uuva.dsdx() * dxdr ;     //  dxdr = dxi/dR, - dxi/dU (ZEC)
00125     
00126       if (mg->get_type_r(nzm1) == UNSURR) {
00127     resu.set_dzpuis(2) ;    // r^2 d/dr has been computed in the
00128                             // external domain
00129       } 
00130     }
00131     else {
00132       assert(mg->get_type_r(nzm1) == UNSURR) ;
00133 
00134       int dzp = uu.get_dzpuis() ;
00135       
00136       resu = uuva.dsdx() * dxdr ;
00137       resu.annule_domain(nzm1) ;  // zero in the CED
00138       
00139       // Special treatment in the CED
00140       Valeur tmp_ced = - uuva.dsdx() ; 
00141       tmp_ced.annule(0, nz-2) ; // only non zero in the CED
00142       tmp_ced.mult_xm1_zec() ; 
00143       tmp_ced.set(nzm1) -= dzp * uuva(nzm1) ; 
00144       
00145       // Recombination shells + CED : 
00146       resu.set_spectral_va() += tmp_ced ;
00147       
00148       resu.set_dzpuis(dzp+1) ;         
00149     
00150     }
00151     resu.set_spectral_base( uuva.dsdx().get_base() ) ; // same basis as d/dxi
00152   }   
00153 }    
00154 
00155                     //---------------------------------------------------
00156                    // Derivee par rapport au rayon numerique (r ou lnr)
00157                   //---------------------------------------------------
00158 void Map_log::dsdradial (const Scalar& uu, Scalar& resu) const {
00159 
00160   assert (uu.get_etat() != ETATNONDEF) ; 
00161   assert (uu.get_mp().get_mg() == mg) ; 
00162 
00163     
00164   if (uu.get_etat() == ETATZERO) {
00165     resu.set_etat_zero() ; 
00166   }
00167   else {   
00168     assert( uu.get_etat() == ETATQCQ ) ; 
00169 
00170     const Valeur& uuva = uu.get_spectral_va() ; 
00171 
00172     uuva.coef() ;    // (uu.va).c_cf is up to date
00173     
00174     int nz = mg->get_nzone() ; 
00175     int nzm1 = nz - 1 ;
00176 
00177     if ( uu.get_dzpuis() == 0 ) {
00178       resu = uuva.dsdx() * dxdlnr ;     //  dxdr = dxi/dR, - dxi/dU (ZEC)
00179     
00180       if (mg->get_type_r(nzm1) == UNSURR) {
00181     resu.set_dzpuis(2) ;    // r^2 d/dr has been computed in the
00182                             // external domain
00183       } 
00184     }
00185     else {
00186       assert(mg->get_type_r(nzm1) == UNSURR) ;
00187 
00188       int dzp = uu.get_dzpuis() ;
00189       
00190       resu = uuva.dsdx() * dxdlnr ;
00191       resu.annule_domain(nzm1) ;  // zero in the CED
00192       
00193       // Special treatment in the CED
00194       Valeur tmp_ced = - uuva.dsdx() ; 
00195       tmp_ced.annule(0, nz-2) ; // only non zero in the CED
00196       tmp_ced.mult_xm1_zec() ; 
00197       tmp_ced.set(nzm1) -= dzp * uuva(nzm1) ; 
00198       
00199       // Recombination shells + CED : 
00200       resu.set_spectral_va() += tmp_ced ;
00201       
00202       resu.set_dzpuis(dzp+1) ;         
00203     
00204     }
00205     resu.set_spectral_base( uuva.dsdx().get_base() ) ; // same basis as d/dxi
00206   }   
00207 }

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