scalar_raccord.C

00001 /*
00002  *   Copyright (c) 2003 Eric Gourgoulhon & Jerome Novak
00003  *
00004  *   Copyright (c) 2000-2001 Philippe Grandclement (for preceding Cmp version)
00005  *
00006  *   This file is part of LORENE.
00007  *
00008  *   LORENE is free software; you can redistribute it and/or modify
00009  *   it under the terms of the GNU General Public License as published by
00010  *   the Free Software Foundation; either version 2 of the License, or
00011  *   (at your option) any later version.
00012  *
00013  *   LORENE is distributed in the hope that it will be useful,
00014  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  *   GNU General Public License for more details.
00017  *
00018  *   You should have received a copy of the GNU General Public License
00019  *   along with LORENE; if not, write to the Free Software
00020  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021  *
00022  */
00023 
00024 
00025 char scalar_raccord_C[] = "$Header: /cvsroot/Lorene/C++/Source/Tensor/Scalar/scalar_raccord.C,v 1.2 2003/10/01 13:04:44 e_gourgoulhon Exp $" ;
00026 
00027 /*
00028  * $Id: scalar_raccord.C,v 1.2 2003/10/01 13:04:44 e_gourgoulhon Exp $
00029  * $Log: scalar_raccord.C,v $
00030  * Revision 1.2  2003/10/01 13:04:44  e_gourgoulhon
00031  * The method Tensor::get_mp() returns now a reference (and not
00032  * a pointer) onto a mapping.
00033  *
00034  * Revision 1.1  2003/09/25 08:58:10  e_gourgoulhon
00035  * First version.
00036  *
00037  *
00038  * $Header: /cvsroot/Lorene/C++/Source/Tensor/Scalar/scalar_raccord.C,v 1.2 2003/10/01 13:04:44 e_gourgoulhon Exp $
00039  *
00040  */
00041 
00042 //standard
00043 #include <stdlib.h>
00044 
00045 // LORENE
00046 #include "tensor.h"
00047 #include "proto.h"
00048 #include "matrice.h"
00049 
00050 Matrice matrice_raccord_pair (int cont, double alpha_kernel) ;
00051 Matrice matrice_raccord_impair (int cont, double alpha_kernel) ;
00052 Tbl sec_membre_raccord (Tbl coef, int cont, double alpha_shell) ;
00053 Tbl regularise (Tbl coef, int nr, int base_r) ;
00054 
00055 void Scalar::raccord (int aux) {
00056 
00057     assert (etat != ETATNONDEF) ;
00058     
00059     assert (aux >=0) ;
00060     int cont = aux+1 ;
00061     
00062     const Map_af* mapping = dynamic_cast<const Map_af*>( mp ) ; 
00063 
00064     if (mapping == 0x0) {
00065     cout << 
00066     "Scalar::raccord : The mapping does not belong to the class Map_af !"
00067         << endl ; 
00068     abort() ;
00069     }
00070     
00071     assert (mapping->get_mg()->get_type_r(1) == FIN) ;
00072     assert (mapping->get_mg()->get_type_r(0) == RARE) ;
00073     
00074     // On passe en Ylm et vire tout dans la zone interne...
00075     va.coef() ;
00076     va.ylm() ;
00077     va.set_etat_cf_qcq() ;
00078     va.c_cf->t[0]->annule_hard() ;
00079     
00080     // Confort :
00081     int nz = mapping->get_mg()->get_nzone() ;
00082     int nbrer_kernel = mapping->get_mg()->get_nr(0) ;
00083     int nbrer_shell  = mapping->get_mg()->get_nr(1) ;
00084     
00085     int nbret_kernel = mapping->get_mg()->get_nt(0) ;
00086     int nbret_shell  = mapping->get_mg()->get_nt(1) ;
00087     
00088     int nbrep_kernel = mapping->get_mg()->get_np(0) ;
00089     int nbrep_shell  = mapping->get_mg()->get_np(1) ;
00090     
00091     double alpha_kernel = mapping->get_alpha()[0] ;
00092     double alpha_shell  = mapping->get_alpha()[1] ;
00093     
00094     int base_r, m_quant, l_quant ;
00095     
00096     for (int k=0 ; k<nbrep_kernel+1 ; k++)
00097     for (int j=0 ; j<nbret_kernel ; j++)
00098         if (nullite_plm(j, nbret_kernel, k,nbrep_kernel, va.base) == 1)
00099          if (nullite_plm(j, nbret_shell, k, nbrep_shell, va.base) == 1)
00100     {
00101         // calcul des nombres quantiques :
00102         donne_lm(nz, 0, j, k, va.base, m_quant, l_quant, base_r) ;
00103         assert ((base_r == R_CHEBP) || (base_r == R_CHEBI)) ;
00104         
00105         Matrice systeme(cont, cont) ;
00106         
00107         Tbl facteur (nbrer_kernel) ;
00108         facteur.annule_hard() ;
00109         for (int i=0 ; i<nbrer_shell ; i++)
00110         if (i<nbrer_kernel)
00111             facteur.set(i) = (*va.c_cf)(1, k, j, i) ;
00112         
00113         Tbl sec_membre (sec_membre_raccord (facteur, cont, alpha_shell)) ;
00114        
00115         if (base_r == R_CHEBP)
00116         systeme = matrice_raccord_pair (cont, alpha_kernel) ;       
00117         else
00118         systeme = matrice_raccord_impair (cont, alpha_kernel) ;
00119         
00120         Tbl soluce (systeme.inverse(sec_membre)) ;
00121         Tbl regulier (nbrer_kernel) ;
00122         
00123         if (l_quant == 0)
00124         for (int i=0 ; i<cont ; i++)
00125             va.c_cf->set(0, k, j, i) = soluce(i) ;
00126         else {
00127         if (l_quant %2 == 0)
00128             regulier = regularise (soluce, nbrer_kernel, R_CHEBP) ;
00129         else
00130             regulier = regularise (soluce, nbrer_kernel, R_CHEBI) ;
00131         
00132         for (int i=0 ; i<nbrer_kernel ; i++)
00133             va.c_cf->set(0, k, j, i) = regulier(i) ;
00134         }
00135         }
00136     va.ylm_i() ;
00137 }

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