cmp.C

00001 /*
00002  *  Methods of class Cmp
00003  *
00004  *   (see file cmp.h for documentation)
00005  *
00006  */
00007 
00008 /*
00009  *   Copyright (c) 1999-2000 Jean-Alain Marck
00010  *   Copyright (c) 1999-2001 Eric Gourgoulhon
00011  *   Copyright (c) 1999-2001 Philippe Grandclement
00012  *
00013  *   This file is part of LORENE.
00014  *
00015  *   LORENE is free software; you can redistribute it and/or modify
00016  *   it under the terms of the GNU General Public License as published by
00017  *   the Free Software Foundation; either version 2 of the License, or
00018  *   (at your option) any later version.
00019  *
00020  *   LORENE is distributed in the hope that it will be useful,
00021  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00022  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023  *   GNU General Public License for more details.
00024  *
00025  *   You should have received a copy of the GNU General Public License
00026  *   along with LORENE; if not, write to the Free Software
00027  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00028  *
00029  */
00030 
00031 
00032 char cmp_C[] = "$Header: /cvsroot/Lorene/C++/Source/Cmp/cmp.C,v 1.8 2004/10/11 15:09:01 j_novak Exp $" ;
00033 
00034 
00035 /*
00036  * $Id: cmp.C,v 1.8 2004/10/11 15:09:01 j_novak Exp $
00037  * $Log: cmp.C,v $
00038  * Revision 1.8  2004/10/11 15:09:01  j_novak
00039  * The radial manipulation functions take Scalar as arguments, instead of Cmp.
00040  * Added a conversion operator from Scalar to Cmp.
00041  * The Cmp radial manipulation function make conversion to Scalar, call to the
00042  * Map_radial version with a Scalar argument and back.
00043  *
00044  * Revision 1.7  2003/10/16 21:39:02  e_gourgoulhon
00045  * Treated the case ETATUN in the constructor from Scalar.
00046  *
00047  * Revision 1.6  2003/10/01 15:49:33  e_gourgoulhon
00048  * Method Scalar::get_mp() now returns a reference onto a mapping.
00049  *
00050  * Revision 1.5  2003/09/24 20:54:24  e_gourgoulhon
00051  * Added constructor by conversion of a Scalar.
00052  *
00053  * Revision 1.4  2003/08/26 09:46:10  j_novak
00054  * Added the method multipole_spectrum
00055  *
00056  * Revision 1.3  2002/10/16 14:36:33  j_novak
00057  * Reorganization of #include instructions of standard C++, in order to
00058  * use experimental version 3 of gcc.
00059  *
00060  * Revision 1.2  2001/12/04 21:27:53  e_gourgoulhon
00061  *
00062  * All writing/reading to a binary file are now performed according to
00063  * the big endian convention, whatever the system is big endian or
00064  * small endian, thanks to the functions fwrite_be and fread_be
00065  *
00066  * Revision 1.1.1.1  2001/11/20 15:19:27  e_gourgoulhon
00067  * LORENE
00068  *
00069  * Revision 2.36  2000/09/13  12:11:56  eric
00070  * Ajout de la fonction allocate_all().
00071  *
00072  * Revision 2.35  2000/09/06  09:45:23  keisuke
00073  * Ajout de l'appel a del_deriv() dans set_etat_qcq() pour le cas
00074  *   ou etat est deja ETATQCQ.
00075  *
00076  * Revision 2.34  2000/08/16  10:43:30  eric
00077  * Suppression de Mtbl_cf::dzpuis.
00078  *
00079  * Revision 2.33  2000/08/16  10:30:41  eric
00080  * Suppression de Mtbl::dzpuis.
00081  *
00082  * Revision 2.32  2000/03/07  16:52:58  eric
00083  * Modif dz_nonzero() : cas etat=ETATQCQ et va.etat=ETATZERO.
00084  *
00085  * Revision 2.31  2000/01/28  16:09:21  eric
00086  * Ajout des fonctions dz_nonzero et check_dzpuis.
00087  *
00088  * Revision 2.30  1999/12/22  16:44:28  eric
00089  * set_etat_zero() : remplacement de l'appel a del_t() par
00090  *          1/ va.set_etat_zero() ;
00091  *          2/ del_deriv() ;
00092  *
00093  * Revision 2.29  1999/12/10  15:59:14  eric
00094  * Changement de la place de del_deriv() dans l'affectation
00095  *   (pour permettre l'affectation a des membres derives).
00096  * Annulation des membres derives.
00097  *  dans la fonction annule(int,int).
00098  *
00099  * Revision 2.28  1999/12/09  10:50:01  eric
00100  * Ajout du membre p_integ.
00101  *
00102  * Revision 2.27  1999/12/07  14:53:32  eric
00103  * Changement ordre des arguments (phi,theta,r) --> (r,theta,phi)
00104  *   dans la routine val_point.
00105  *
00106  * Revision 2.26  1999/12/06  16:47:11  eric
00107  * Ajout de la fonction val_point.
00108  *
00109  * Revision 2.25  1999/11/30  16:30:23  eric
00110  * *** empty log message ***
00111  *
00112  * Revision 2.24  1999/11/30  16:26:39  eric
00113  * Ajout (provisoire) de l'affectation des dzpuis des Mtbl et Mtbl_cf
00114  *  dans set_dzpuis.
00115  *
00116  * Revision 2.23  1999/11/29  15:14:48  phil
00117  * *** empty log message ***
00118  *
00119  * Revision 2.22  1999/11/29  12:56:49  eric
00120  * Introduction des membres p_lap, ind_lap.
00121  *
00122  * Revision 2.21  1999/11/26  14:23:17  eric
00123  * Ajout du membre dzpuis et des fonctions de manipulation associees.
00124  *
00125  * Revision 2.20  1999/11/25  16:27:45  eric
00126  * Reorganisation complete du calcul et stokage des derivees partielles.
00127  *
00128  * Revision 2.19  1999/11/23  16:21:02  eric
00129  * Suppression du membre statique Cmp_Zero.
00130  * Suppression du constructeur par defaut.
00131  *
00132  * Revision 2.18  1999/11/22  16:34:56  eric
00133  * Ajout du constructeur prive sans argument pour Cmp_Zero.
00134  *
00135  * Revision 2.17  1999/11/22  15:41:57  eric
00136  * Ajout de la fonction annule(int l).
00137  *
00138  * Revision 2.16  1999/10/29  08:14:59  eric
00139  * Ajout de assert( mpi.get_mg() == &mgi ) dans le constructeur
00140  * par lecture de fichier.
00141  *
00142  * Revision 2.15  1999/10/28  09:39:00  eric
00143  * Ajout de la fonction affiche_seuil.
00144  *
00145  * Revision 2.14  1999/10/28  09:01:56  eric
00146  * Constructeur par lecture de fichier.
00147  * Ajout de la fonction annule(int, int).
00148  *
00149  * Revision 2.13  1999/10/27  15:38:52  eric
00150  * Suppression du membre c.
00151  *
00152  * Revision 2.12  1999/10/27  09:51:46  eric
00153  * *** empty log message ***
00154  *
00155  * Revision 2.11  1999/10/27  08:45:31  eric
00156  * Introduction du membre Valeur va.
00157  * Le pointeur Valeur* c est desormais un membre prive constant qui pointe
00158  *
00159  * sur va.
00160  *
00161  * Revision 2.10  1999/10/22  08:14:32  eric
00162  * Depoussierage.
00163  *
00164  * Revision 2.9  1999/10/18  16:08:15  phil
00165  * Correction de set_etat_qcq
00166  * Evite les memory leak
00167  *
00168  * Revision 2.8  1999/10/18  15:07:58  eric
00169  * La fonction membre Valeur::annule() est rebaptisee Valeur::annule_hard().
00170  *
00171  * Revision 2.7  1999/04/09  13:38:58  phil
00172  * *** empty log message ***
00173  *
00174  * Revision 2.6  1999/04/09  13:10:09  phil
00175  * ajout de cmp = valeur
00176  *
00177  * Revision 2.5  1999/03/03  11:16:24  hyc
00178  * *** empty log message ***
00179  *
00180  *
00181  * $Header: /cvsroot/Lorene/C++/Source/Cmp/cmp.C,v 1.8 2004/10/11 15:09:01 j_novak Exp $
00182  *
00183  */
00184 
00185 // headers C
00186 #include <assert.h>
00187 #include <stdlib.h>
00188 #include <math.h>
00189 
00190 // headers Lorene
00191 #include "cmp.h"
00192 #include "type_parite.h"
00193 #include "utilitaires.h"
00194 #include "proto.h"
00195 
00196             //---------------//
00197             // Constructeurs //
00198             //---------------//
00199 
00200 
00201 Cmp::Cmp(const Map& mpi) : mp(&mpi), etat(ETATNONDEF), dzpuis(0), 
00202                va(mpi.get_mg()) {
00203 
00204     set_der_0x0() ;
00205 
00206 }
00207 
00208 Cmp::Cmp(const Map* mpi) : mp(mpi), etat(ETATNONDEF),  dzpuis(0),
00209                va(mpi->get_mg()) {
00210 
00211     set_der_0x0() ;
00212 
00213 }
00214 
00215 
00216 // Copy constructor
00217 // ----------------
00218 Cmp::Cmp(const Cmp& ci)  : mp(ci.mp), etat(ci.etat), dzpuis(ci.dzpuis), 
00219                va(ci.va) {
00220     
00221     set_der_0x0() ; // On ne recopie pas les derivees
00222 
00223 }
00224 
00225 // From file
00226 // ---------
00227 Cmp::Cmp(const Map& mpi, const Mg3d& mgi, FILE* fd) : mp(&mpi), va(mgi, fd) {
00228 
00229     assert( mpi.get_mg() == &mgi ) ; 
00230 
00231     fread_be(&etat, sizeof(int), 1, fd) ;           // L'etat
00232     fread_be(&dzpuis, sizeof(int), 1, fd) ;     // dzpuis
00233 
00234     set_der_0x0() ; // Les derivees sont initialisees a zero
00235 
00236 }
00237 
00238             //--------------//
00239             // Destructeur  //
00240             //--------------//
00241 
00242 // Destructeur
00243 Cmp::~Cmp() {
00244     del_t() ;
00245 }
00246 
00247             //-----------------------//
00248             // Gestion de la memoire //
00249             //-----------------------//
00250 
00251 // Destructeur logique
00252 void Cmp::del_t() {
00253     va.del_t() ;
00254     del_deriv() ;
00255     etat = ETATNONDEF ;
00256 }
00257 
00258 void Cmp::del_deriv() {
00259     delete p_dsdr ; p_dsdr = 0x0 ;
00260     delete p_srdsdt ; p_srdsdt = 0x0 ;
00261     delete p_srstdsdp ; p_srstdsdp = 0x0 ;
00262     delete p_dsdx ; p_dsdx = 0x0 ;
00263     delete p_dsdy ; p_dsdy = 0x0 ;
00264     delete p_dsdz ; p_dsdz = 0x0 ;
00265     delete p_lap ; p_lap = 0x0 ;
00266     delete p_integ ; p_integ = 0x0 ;
00267 }
00268 
00269 void Cmp::set_der_0x0() {
00270     p_dsdr = 0x0 ;
00271     p_srdsdt = 0x0 ;
00272     p_srstdsdp = 0x0 ;
00273     p_dsdx = 0x0 ;
00274     p_dsdy = 0x0 ;
00275     p_dsdz = 0x0 ;
00276     p_lap = 0x0 ; 
00277     ind_lap = - 1 ; 
00278     p_integ = 0x0 ; 
00279 }
00280 
00281 // ETATZERO
00282 void Cmp::set_etat_zero() {
00283     if (etat == ETATZERO) return ;
00284     del_deriv() ;
00285     va.set_etat_zero() ;
00286     etat = ETATZERO ;
00287 }
00288 
00289 // ETATNONDEF
00290 void Cmp::set_etat_nondef() {
00291     if (etat == ETATNONDEF) return ;
00292     del_t() ;
00293     etat = ETATNONDEF ;
00294 }
00295 
00296 // ETATQCQ
00297 void Cmp::set_etat_qcq() {
00298 
00299     if (etat == ETATQCQ) {
00300     del_deriv() ; 
00301     return ;
00302     }
00303     
00304     // Protection
00305     assert( (etat == ETATZERO) || (etat == ETATNONDEF) ) ; // sinon...
00306     
00307     del_t() ;
00308     
00309     // Termine
00310     etat = ETATQCQ ;
00311 }
00312 
00313 
00314 // Allocates everything
00315 // --------------------
00316 void Cmp::allocate_all() {
00317     
00318     set_etat_qcq() ; 
00319     va.set_etat_c_qcq() ;       // allocation in configuration space
00320     Mtbl* mt = va.c ; 
00321     mt->set_etat_qcq() ;
00322     for (int l=0; l<mt->get_nzone(); l++) {
00323         mt->t[l]->set_etat_qcq() ; 
00324     }
00325     
00326 } 
00327 
00328 
00329 
00330 // ZERO hard
00331 void Cmp::annule_hard() {
00332 
00333     va.annule_hard() ;
00334     del_deriv() ; 
00335     etat = ETATQCQ ;
00336 }
00337 
00338 // Sets the Cmp to zero in a given domain
00339 // --------------------------------------
00340 
00341 void Cmp::annule(int l) {
00342     
00343     annule(l, l) ;     
00344 }
00345 
00346 
00347 // Sets the Cmp to zero in several domains
00348 // ---------------------------------------
00349 
00350 void Cmp::annule(int l_min, int l_max) {
00351     
00352     // Cas particulier: annulation globale : 
00353     if ( (l_min == 0) && (l_max == va.mg->get_nzone()-1) ) {
00354     set_etat_zero() ;
00355     return ; 
00356     }
00357     
00358     assert( etat != ETATNONDEF ) ; 
00359     
00360     if ( etat == ETATZERO ) {
00361     return ;        // rien n'a faire si c'est deja zero
00362     }
00363     else {
00364     assert( etat == ETATQCQ ) ; // sinon...
00365 
00366     va.annule(l_min, l_max) ;   // Annule la Valeur
00367     
00368     // Annulation des membres derives
00369     if (p_dsdr != 0x0) p_dsdr->annule(l_min, l_max) ;
00370     if (p_srdsdt != 0x0) p_srdsdt->annule(l_min, l_max) ;
00371     if (p_srstdsdp != 0x0) p_srstdsdp->annule(l_min, l_max) ;
00372     if (p_dsdx != 0x0) p_dsdx->annule(l_min, l_max) ;
00373     if (p_dsdy != 0x0) p_dsdy->annule(l_min, l_max) ;
00374     if (p_dsdz != 0x0) p_dsdz->annule(l_min, l_max) ;
00375     if (p_lap != 0x0) p_lap->annule(l_min, l_max) ;
00376     if (p_integ != 0x0) delete p_integ ;
00377     }
00378     
00379 }
00380 
00381 
00382 
00383 
00384 
00385             //------------//
00386             // Assignment //
00387             //------------//
00388 
00389 // From Cmp
00390 // --------
00391 void Cmp::operator=(const Cmp& ci) {
00392     
00393     assert(&ci != this) ;    // pour eviter l'auto-affectation
00394 
00395     // Menage general de la Valeur, mais pas des quantites derivees !
00396     va.del_t() ;
00397     
00398     // Les elements fixes
00399     mp = ci.mp ;
00400     dzpuis = ci.dzpuis ; 
00401     
00402     // La valeur eventuelle
00403     switch(ci.etat) {
00404     case ETATNONDEF: {
00405         set_etat_nondef() ; 
00406         break ;         // valeur par defaut
00407     }
00408     
00409     case ETATZERO: {
00410         set_etat_zero() ;
00411         break ;
00412     }
00413     
00414     case ETATQCQ: {
00415         set_etat_qcq() ;
00416         va = ci.va ;
00417 
00418         // On detruit les quantites derivees (seulement lorsque tout est fini !)
00419         del_deriv() ; 
00420 
00421         break ;
00422     }
00423     
00424     default: {
00425         cout << "Unkwown state in Cmp::operator=(const Cmp&) !" 
00426          << endl ;
00427         abort() ;
00428         break ;
00429     }
00430     }
00431 
00432 }
00433     
00434 // From Valeur
00435 // -----------
00436 void Cmp::operator=(const Valeur& vi) {
00437 
00438     // Traitement de l'auto-affectation :
00439     if (&vi == &va) {
00440     return ; 
00441     }
00442 
00443     // Protection
00444     assert(vi.get_etat() != ETATNONDEF) ;
00445     
00446     // Menage general de la Valeur, mais pas des quantites derivees !
00447     va.del_t() ;
00448 
00449     
00450     // La valeure eventuelle
00451     switch(vi.get_etat()) {
00452 
00453     case ETATZERO: {
00454         set_etat_zero() ;
00455         break ;
00456     }
00457 
00458     case ETATQCQ: {
00459         set_etat_qcq() ;
00460         va = vi ;
00461         
00462         // On detruit les quantites derivees (seulement lorsque tout est fini !)
00463         del_deriv() ; 
00464 
00465         break ;
00466     }
00467     
00468     default: {
00469         cout << "Unkwown state in Cmp::operator=(const Valeur&) !" << endl ;
00470         abort() ;
00471         break ;
00472     }
00473     }
00474 
00475 }
00476 
00477 // From Mtbl
00478 // ---------
00479 void Cmp::operator=(const Mtbl& mi) {
00480     
00481     // Protection
00482     assert(mi.get_etat() != ETATNONDEF) ;
00483 
00484     assert(&mi != va.c) ;  // pour eviter l'auto-affectation
00485 
00486    
00487     // Menage general de la Valeur, mais pas des quantites derivees !
00488     va.del_t() ;
00489 
00490     // La valeure eventuelle
00491     switch(mi.get_etat()) {
00492     case ETATZERO: {
00493         set_etat_zero() ;
00494         break ;
00495     }
00496     
00497     case ETATQCQ: {
00498         set_etat_qcq() ;
00499         va = mi ;
00500 
00501         // On detruit les quantites derivees (seulement lorsque tout est fini !)
00502         del_deriv() ; 
00503 
00504         break ;
00505      }
00506     
00507     default: {
00508         cout << "Unkwown state in Cmp::operator=(const Mtbl&) !" << endl ;
00509         abort() ;
00510         break ;
00511     }
00512     }
00513 
00514 
00515 }
00516 
00517 // From double
00518 // -----------
00519 void Cmp::operator=(double x) {
00520     
00521     if (x == double(0)) {
00522     set_etat_zero() ;
00523     }
00524     else {
00525     set_etat_qcq() ;
00526     del_deriv() ;
00527     va = x ;
00528     }
00529 
00530     dzpuis = 0 ; 
00531 }
00532 
00533 // From int
00534 // --------
00535 void Cmp::operator=(int n) {
00536     
00537     if (n == 0) {
00538     set_etat_zero() ;
00539     }
00540     else {
00541     set_etat_qcq() ;
00542     del_deriv() ;
00543     va = n ;
00544     }
00545 
00546     dzpuis = 0 ; 
00547 
00548 }
00549 
00550             //------------//
00551             // Sauvegarde //
00552             //------------//
00553 
00554 void Cmp::sauve(FILE* fd) const {
00555 
00556     va.sauve(fd) ;      // la valeur (en premier pour la construction
00557                 //   lors de la lecture du fichier)
00558 
00559     fwrite_be(&etat, sizeof(int), 1, fd) ;          // l'etat
00560     fwrite_be(&dzpuis, sizeof(int), 1, fd) ;        // dzpuis
00561 
00562 }
00563     
00564             //------------//
00565             // Impression //
00566             //------------//
00567 
00568 // Operator <<
00569 // -----------
00570 ostream& operator<<(ostream& o, const Cmp& ci) {
00571 
00572     switch(ci.etat) {
00573     case ETATNONDEF: {
00574         o << "*** Cmp in UNDEFINED STATE" ;
00575         break ;
00576     }
00577     
00578     case ETATZERO: {
00579         o << "*** Cmp IDENTICALLY ZERO" ;
00580         break ; 
00581     }
00582     
00583     case ETATQCQ: {
00584         o << "*** Cmp : " << endl ; 
00585         o << "                        dzpuis = " << ci.get_dzpuis() << endl ; 
00586         o << ci.va << endl ; 
00587         break ;
00588     }
00589     
00590     default: {
00591         cout << "operator<<(ostream&, const Cmp&) : unknown state !" 
00592          << endl ;
00593         abort() ;
00594         break ; 
00595     }
00596     }
00597     
00598     // Termine
00599     return o ;
00600 }
00601 
00602 // affiche_seuil
00603 //---------------
00604 
00605 void Cmp::affiche_seuil(ostream& ost, int type, int precis, 
00606             double seuil) const {
00607     ost << "*** Cmp " << endl ;
00608 
00609     // Cas particuliers
00610     //-----------------
00611 
00612     if (etat == ETATNONDEF) {
00613     ost << "    state: UNDEFINED" << endl ;
00614     return ;
00615     }
00616 
00617     if (etat == ETATZERO) {
00618     ost << "    state: ZERO" << endl ;
00619     return ;
00620     }
00621 
00622     // Cas general : on affiche la Valeur
00623     //------------
00624        
00625     ost << "                        dzpuis = " << dzpuis << endl ; 
00626     va.affiche_seuil(ost, type, precis, seuil) ;
00627 
00628 }
00629 
00630 
00631 
00632     
00633             //------------------------------------//
00634             //  Spectral bases of the Valeur va   //
00635             //------------------------------------//
00636             
00637 void Cmp::std_base_scal() {
00638       
00639     va.std_base_scal() ;  
00640                    
00641 }    
00642 
00643             //--------------------------//
00644             //  dzpuis manipulations    //
00645             //--------------------------//
00646             
00647 void Cmp::set_dzpuis(int dzi) {
00648     
00649     dzpuis = dzi ;
00650     
00651 }
00652 
00653 bool Cmp::dz_nonzero() const {
00654     
00655     assert(etat != ETATNONDEF) ; 
00656     
00657     const Mg3d* mg = mp->get_mg() ;
00658     
00659     int nzm1 = mg->get_nzone() - 1; 
00660     if (mg->get_type_r(nzm1) != UNSURR) {
00661     return false ; 
00662     } 
00663     
00664     if (etat == ETATZERO) {
00665     return false ; 
00666     }
00667     
00668     assert(etat == ETATQCQ) ;
00669     
00670     if (va.etat == ETATZERO) {
00671     return false ; 
00672     }
00673 
00674     assert(va.etat == ETATQCQ) ; 
00675     
00676     if (va.c != 0x0) {
00677     if ( (va.c)->get_etat() == ETATZERO ) {
00678         return false ; 
00679     }
00680     
00681     assert( (va.c)->get_etat() == ETATQCQ ) ; 
00682     if ( (va.c)->t[nzm1]->get_etat() == ETATZERO ) {
00683         return false ; 
00684     }
00685     else {
00686         assert( (va.c)->t[nzm1]->get_etat() == ETATQCQ ) ; 
00687         return true ; 
00688     }
00689     }
00690     else{
00691     assert(va.c_cf != 0x0) ; 
00692     if ( (va.c_cf)->get_etat() == ETATZERO ) {
00693         return false ; 
00694     }
00695     assert( (va.c_cf)->get_etat() == ETATQCQ ) ; 
00696     if ( (va.c_cf)->t[nzm1]->get_etat() == ETATZERO ) {
00697         return false ; 
00698     }
00699     else {
00700         assert( (va.c_cf)->t[nzm1]->get_etat() == ETATQCQ ) ; 
00701         return true ; 
00702     }
00703     
00704     } 
00705     
00706 }
00707 
00708 bool Cmp::check_dzpuis(int dzi) const {
00709     
00710     if (dz_nonzero()) {     // the check must be done
00711     return (dzpuis == dzi) ; 
00712     }
00713     else{
00714     return true ; 
00715     }
00716     
00717 }
00718 
00719 
00720 
00721         //-----------------------------------------------//
00722         //      Value at an arbitrary point      //
00723         //-----------------------------------------------//
00724 
00725 double Cmp::val_point(double r, double theta, double phi) const {
00726 
00727     assert(etat != ETATNONDEF) ; 
00728     
00729     if (etat == ETATZERO) {
00730     return double(0) ; 
00731     }
00732     
00733     assert(etat == ETATQCQ) ; 
00734     
00735     // 1/ Search for the domain and the grid coordinates (xi,theta',phi')
00736     //    which corresponds to the point (r,theta,phi)
00737     
00738     int l ; 
00739     double xi ; 
00740     
00741     mp->val_lx(r, theta, phi, l,  xi) ;     // call of val_lx with default 
00742                         // accuracy parameters
00743     
00744     // 2/ Call to the Valeur version
00745     
00746     return va.val_point(l, xi, theta, phi) ; 
00747 
00748 }
00749  
00750 
00751         //-------------------------------------//
00752                 //      Multipolar spectrum        //
00753         //-------------------------------------//
00754 
00755 Tbl Cmp::multipole_spectrum() {
00756   assert (etat != ETATNONDEF) ;
00757 
00758   const Mg3d* mg = mp->get_mg() ;
00759   int nzone = mg->get_nzone() ;
00760   int lmax = 0 ;
00761   
00762   for (int lz=0; lz<nzone; lz++) 
00763     lmax = (lmax < 2*mg->get_nt(lz) - 1 ? 2*mg->get_nt(lz) - 1 : lmax) ;
00764 
00765   Tbl resu(nzone, lmax) ;
00766   if (etat == ETATZERO) {
00767     resu.set_etat_zero() ;
00768     return resu ;
00769   }
00770 
00771   assert(etat == ETATQCQ) ;
00772 
00773   va.coef() ;
00774   va.ylm() ;
00775   resu.annule_hard() ;
00776   const Base_val& base = va.c_cf->base ;
00777   int m_quant, l_quant, base_r ;
00778   for (int lz=0; lz<nzone; lz++) 
00779     for (int k=0 ; k<mg->get_np(lz) ; k++) 
00780       for (int j=0 ; j<mg->get_nt(lz) ; j++) {
00781     if (nullite_plm(j, mg->get_nt(lz), k, mg->get_np(lz), base) == 1) 
00782       {
00783         // quantic numbers and spectral bases
00784         donne_lm(nzone, lz, j, k, base, m_quant, l_quant, base_r) ;
00785         for (int i=0; i<mg->get_nr(lz); i++) resu.set(lz, l_quant) 
00786                      += fabs((*va.c_cf)(0, k, j, i)) ; 
00787       }
00788       }
00789 
00790   return resu ;
00791 }
00792 

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