tenseur_pde_ylm.C

00001 /*
00002  *  Methods of the class tenseur for solving vectorial Poisson equations
00003  *   with a multipole falloff condition at the outer boundary
00004  *
00005  *    (see file tenseur.h for documentation).
00006  *
00007  */
00008 
00009 /*
00010  *   Copyright (c) 2004 Joshua A. Faber
00011  *
00012  *   This file is part of LORENE.
00013  *
00014  *   LORENE is free software; you can redistribute it and/or modify
00015  *   it under the terms of the GNU General Public License version 2
00016  *   as published by the Free Software Foundation.
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 char tenseur_pde_ylm_C[] = "$Header: /cvsroot/Lorene/C++/Source/Tenseur/tenseur_pde_ylm.C,v 1.1 2004/12/29 16:32:33 k_taniguchi Exp $" ;
00030 
00031 /*
00032  * $Id: tenseur_pde_ylm.C,v 1.1 2004/12/29 16:32:33 k_taniguchi Exp $
00033  * $Log: tenseur_pde_ylm.C,v $
00034  * Revision 1.1  2004/12/29 16:32:33  k_taniguchi
00035  * *** empty log message ***
00036  *
00037  *
00038  * $Header: /cvsroot/Lorene/C++/Source/Tenseur/tenseur_pde_ylm.C,v 1.1 2004/12/29 16:32:33 k_taniguchi Exp $
00039  *
00040  */
00041 
00042 // Lorene headers
00043 #include "map.h"
00044 #include "cmp.h"
00045 #include "param.h"
00046 #include "tenseur.h"
00047 
00048             //-----------------------------------//
00049             //      Vectorial Poisson equation   //
00050             //-----------------------------------//
00051 
00052 // Version avec parametres
00053 // -----------------------
00054 void Tenseur::poisson_vect_ylm(double lambda, Param& para, Tenseur& shift,
00055                    Tenseur& vecteur, Tenseur& scalaire, int nylm,
00056                    double* intvec) const {
00057   assert (lambda != -1) ;
00058   
00059   // Verifications d'usage ...
00060   assert (valence == 1) ;
00061   assert (shift.get_valence() == 1) ;
00062   assert (shift.get_type_indice(0) == type_indice(0)) ;
00063   assert (vecteur.get_valence() == 1) ;
00064   assert (vecteur.get_type_indice(0) == type_indice(0)) ;
00065   assert (scalaire.get_valence() == 0) ;
00066   assert (etat != ETATNONDEF) ;
00067 
00068   Map_af mapping (*mp);
00069   
00070   // Nothing to do if the source is zero
00071   if (etat == ETATZERO) {
00072     
00073     shift.set_etat_zero() ; 
00074     
00075     vecteur.set_etat_qcq() ;
00076     for (int i=0; i<3; i++) {
00077       vecteur.set(i) = 0 ; 
00078     }
00079     
00080     scalaire.set_etat_qcq() ;
00081     scalaire.set() = 0 ;  
00082     
00083     return ; 
00084   }
00085   
00086   // On construit le tableau contenant le terme P_i ...
00087   for (int i=0 ; i<3 ; i++) {
00088     Param* par = mp->donne_para_poisson_vect(para, i) ; 
00089     
00090     double* intvec2=new double [nylm];
00091     for (int j=0; j<nylm; j++) {
00092       intvec2[j]=intvec[i*nylm+j];
00093     }
00094     
00095     (*this)(i).poisson_ylm(*par, vecteur.set(i),nylm,intvec2) ;
00096 
00097     delete [] intvec2;
00098     
00099     if (par != 0x0)
00100       delete par ; 
00101   }
00102   vecteur.set_triad( *triad ) ; 
00103   
00104   // Equation de Poisson scalaire :
00105   Tenseur source_scal (-skxk(*this)) ;
00106   
00107   Param* par = mp->donne_para_poisson_vect(para, 3) ; 
00108   
00109   double* intvec2=new double[nylm];
00110   for (int j=0; j<nylm; j++) {
00111     intvec2[j]=intvec[3*nylm+j];
00112   }
00113  
00114   source_scal().poisson_ylm(*par, scalaire.set(), nylm, intvec2) ;
00115   
00116   delete [] intvec2;
00117   if (par !=0x0)
00118     delete par ; 
00119   
00120   // On construit le tableau contenant le terme d xsi / d x_i ...
00121   Tenseur auxiliaire(scalaire) ;
00122   Tenseur dxsi (auxiliaire.gradient()) ;
00123   
00124   // On construit le tableau contenant le terme x_k d P_k / d x_i
00125   Tenseur dp (skxk(vecteur.gradient())) ;
00126   
00127   // Il ne reste plus qu'a tout ranger dans P :
00128   // The final computation is done component by component because
00129   // d_khi and x_d_w are covariant comp. whereas w_shift is
00130   // contravariant
00131   
00132   shift.set_etat_qcq() ; 
00133   
00134   for (int i=0 ; i<3 ; i++)
00135     shift.set(i) = (lambda+2)/2/(lambda+1) * vecteur(i) 
00136       - (lambda/2/(lambda+1)) * (dxsi(i) + dp(i)) ;   
00137   
00138   shift.set_triad( *(vecteur.triad) ) ; 
00139   
00140 }
00141 
00142 
00143 // Version sans parametres
00144 // -----------------------
00145 Tenseur Tenseur::poisson_vect_ylm(double lambda, Tenseur& vecteur, 
00146                   Tenseur& scalaire, int nylm, double* intvec) const {
00147       
00148     Param bidon ;
00149     Tenseur resu(*mp, valence, type_indice, triad, metric, poids) ;
00150     resu.set_etat_qcq() ;
00151     poisson_vect_ylm(lambda, bidon, resu, vecteur, scalaire, nylm, intvec) ;
00152     return resu ;
00153 }
00154 

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