valeur.C

00001 /*
00002  *  Methods of class Valeur
00003  *
00004  *   (see file valeur.h for documentation)
00005  *
00006  */
00007 
00008 /*
00009  *   Copyright (c) 1999-2000 Jean-Alain Marck
00010  *   Copyright (c) 1999-2003 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 valeur_C[] = "$Header: /cvsroot/Lorene/C++/Source/Valeur/valeur.C,v 1.6 2005/10/25 08:56:40 p_grandclement Exp $" ;
00033 
00034 /*
00035  * $Id: valeur.C,v 1.6 2005/10/25 08:56:40 p_grandclement Exp $
00036  * $Log: valeur.C,v $
00037  * Revision 1.6  2005/10/25 08:56:40  p_grandclement
00038  * addition of std_spectral_base in the case of odd functions near the origin
00039  *
00040  * Revision 1.5  2004/11/23 12:45:00  f_limousin
00041  * Add function filtre_tp(int nn, int nz1, int nz2).
00042  *
00043  * Revision 1.4  2003/10/19 19:52:56  e_gourgoulhon
00044  * Added new method display_coef.
00045  *
00046  * Revision 1.3  2002/10/16 14:37:15  j_novak
00047  * Reorganization of #include instructions of standard C++, in order to
00048  * use experimental version 3 of gcc.
00049  *
00050  * Revision 1.2  2001/12/04 21:27:54  e_gourgoulhon
00051  *
00052  * All writing/reading to a binary file are now performed according to
00053  * the big endian convention, whatever the system is big endian or
00054  * small endian, thanks to the functions fwrite_be and fread_be
00055  *
00056  * Revision 1.1.1.1  2001/11/20 15:19:27  e_gourgoulhon
00057  * LORENE
00058  *
00059  * Revision 2.37  2000/09/11  13:53:07  eric
00060  * Ajout des membres p_mult_cp et p_mult_sp.
00061  *
00062  * Revision 2.36  2000/09/08  10:07:13  eric
00063  * Ajout des methodes set_base_r, etc...
00064  *
00065  * Revision 2.35  1999/12/29  13:11:23  eric
00066  * Ajout de la fonction val_point_jk.
00067  *
00068  * Revision 2.34  1999/12/20  16:35:23  eric
00069  * Ajout de la fonction set_base.
00070  *
00071  * Revision 2.33  1999/12/10  16:09:47  eric
00072  * Annulation des membres derives dans la fonction annule(int,int).
00073  *
00074  * Revision 2.32  1999/12/07  14:53:00  eric
00075  * Changement ordre des arguments (phi,theta,xi) --> (xi,theta,phi)
00076  *  dans la routine val_point.
00077  *
00078  * Revision 2.31  1999/12/06  16:47:48  eric
00079  * Ajout de la fonction val_point.
00080  *
00081  * Revision 2.30  1999/11/30  12:41:53  eric
00082  * Le membre base est desormais un objet de type Base_val et non plus
00083  *  un pointeur vers une Base_val.
00084  *
00085  * Revision 2.29  1999/11/23  16:19:33  eric
00086  * Suppression du constructeur par defaut.
00087  *
00088  * Revision 2.28  1999/11/23  14:32:16  novak
00089  * Ajout des membres mult_ct et mult_st
00090  *
00091  * Revision 2.27  1999/11/22  15:41:33  eric
00092  * Ajout de la fonction annule(int l).
00093  *
00094  * Revision 2.26  1999/11/19  11:51:01  eric
00095  * Ajout du membre p_stdsdp.
00096  *
00097  * Revision 2.25  1999/11/19  10:53:17  eric
00098  * *** empty log message ***
00099  *
00100  * Revision 2.24  1999/11/19  10:34:52  eric
00101  * Corrections de diverses erreurs dans l'affectation (operator=):
00102  *  1/ l'auto-affectation est desormais interdite
00103  *  2/ l'affectation a des elements derives est desormais possible
00104  *
00105  * Revision 2.23  1999/11/19  09:32:15  eric
00106  * Ajout du membre p_lapang.
00107  *
00108  * Revision 2.22  1999/11/16  13:28:32  novak
00109  * Ajout de la gestion des pointeurs sur mult_x et scost
00110  *
00111  * Revision 2.21  1999/10/29  15:14:59  eric
00112  * *** empty log message ***
00113  *
00114  * Revision 2.20  1999/10/28  13:24:15  phil
00115  * copie passe avec ETATNONDEF
00116  *
00117  * Revision 2.19  1999/10/27  09:54:34  eric
00118  * *** empty log message ***
00119  *
00120  * Revision 2.18  1999/10/22  08:42:53  eric
00121  * *** empty log message ***
00122  *
00123  * Revision 2.17  1999/10/22  08:32:55  eric
00124  * Anglicisation de operator<<
00125  *
00126  * Revision 2.16  1999/10/21  14:33:05  eric
00127  * *** empty log message ***
00128  *
00129  * Revision 2.15  1999/10/21  14:21:23  eric
00130  * Constructeur par lecture de fichier.
00131  * Fonction sauve().
00132  *
00133  * Revision 2.14  1999/10/20  15:32:20  eric
00134  * Ajout de la routine Valeur::std_base_scal().
00135  * Ajout de operator=(const Mtbl_cf&).
00136  *
00137  * Revision 2.13  1999/10/19  15:30:33  eric
00138  * Ajout de la fonction affiche_seuil.
00139  *
00140  * Revision 2.12  1999/10/18  15:16:17  eric
00141  * *** empty log message ***
00142  *
00143  * Revision 2.11  1999/10/18  15:09:01  eric
00144  * La fonction membre annule() est rebaptisee annule_hard().
00145  * Introduction de la fonction membre annule(int, int).
00146  *
00147  * Revision 2.10  1999/10/18  13:43:29  eric
00148  * Suppression de sxdsdx() et p_sxdsdx (car non-implementes).
00149  *
00150  * Revision 2.9  1999/10/13  15:52:35  eric
00151  * Depoussierage.
00152  *
00153  * Revision 2.8  1999/04/12  13:05:40  phil
00154  * *** empty log message ***
00155  *
00156  * Revision 2.7  1999/04/12  12:47:56  phil
00157  * Correction du constructeur par recopie.
00158  *
00159  * Revision 2.6  1999/04/12  12:13:26  phil
00160  * Correction de l'operateur Valeur = Valeur
00161  *
00162  * Revision 2.5  1999/03/01  15:10:42  eric
00163  * *** empty log message ***
00164  *
00165  * Revision 2.4  1999/02/26  11:43:07  hyc
00166  * *** empty log message ***
00167  *
00168  * Revision 2.3  1999/02/24  15:26:31  hyc
00169  * *** empty log message ***
00170  *
00171  * Revision 2.2  1999/02/23  11:46:40  hyc
00172  * *** empty log message ***
00173  *
00174  * $Header: /cvsroot/Lorene/C++/Source/Valeur/valeur.C,v 1.6 2005/10/25 08:56:40 p_grandclement Exp $
00175  *
00176  */
00177 
00178 // headers C
00179 #include <assert.h>
00180 #include <stdlib.h>
00181 
00182 // headers Lorene
00183 #include "valeur.h"
00184 #include "utilitaires.h"
00185 #include "proto.h"
00186 
00187 
00188 
00189             //---------------//
00190             // Constructeurs //
00191             //---------------//
00192 
00193 Valeur::Valeur(const Mg3d& mgi) : mg(&mgi), base(mgi.get_nzone()) {
00194     
00195     // C'est nouveau
00196     nouveau() ;
00197 }
00198 
00199 Valeur::Valeur(const Mg3d* mgi) : mg(mgi), base(mgi->get_nzone()) {
00200     
00201     // C'est nouveau
00202     nouveau() ;
00203 }
00204 
00205 // Copie
00206 Valeur::Valeur(const Valeur& vc) : base(vc.base) {
00207      
00208     // Tout par default
00209     mg = vc.get_mg() ;
00210     nouveau() ;
00211     
00212     // Que faire ?
00213     switch(vc.get_etat()) {
00214         case ETATZERO:
00215     set_etat_zero() ;
00216     break ;
00217     
00218     case ETATNONDEF:
00219     set_etat_nondef() ;
00220     break ;
00221     
00222     case ETATQCQ:
00223     assert((vc.c != 0x0) || (vc.c_cf != 0x0) ) ;
00224     del_deriv() ;
00225     
00226     if (vc.c != 0x0) {
00227         if (c == 0x0) {
00228         c = new Mtbl( *(vc.c) ) ;
00229         }
00230         else{
00231         *c = *(vc.c) ;
00232         }
00233     }
00234     
00235     if (vc.c_cf != 0x0) {
00236         if (c_cf == 0x0) {
00237         c_cf = new Mtbl_cf( *(vc.c_cf) ) ;
00238         }
00239         else{
00240         *c_cf = *(vc.c_cf) ;
00241         }
00242     }
00243     
00244     etat = ETATQCQ ;
00245     break ;
00246     
00247     default:
00248     cout << "Etat pas possible" << endl ;
00249     abort() ;
00250     break ;
00251     }
00252 }
00253     
00254 // Constructeur a partir d'une grille et d'un fichier
00255 // --------------------------------------------------
00256 Valeur::Valeur(const Mg3d& g, FILE* fd) : mg(&g), base(fd) {
00257 
00258     // La multi-grille
00259     Mg3d* mg_tmp = new Mg3d(fd) ;   // la multi-grille d'origine
00260     if (*mg != *mg_tmp) {
00261     cout << 
00262      "Valeur::Valeur(const Mg3d& g, FILE* fd): grid not consistent !" 
00263      << endl ;
00264     abort() ;
00265     }
00266     delete mg_tmp ;
00267 
00268     fread_be(&etat, sizeof(int), 1, fd) ;       // L'etat
00269 
00270     if (etat == ETATQCQ) {
00271     c = new Mtbl(g, fd) ;           // Les valeurs ds l'espace des conf.
00272     
00273     // Tous les autres pointeurs sont mis a zero : 
00274     c_cf = 0x0 ; 
00275     set_der_0x0() ;     
00276     }    
00277     else {
00278     c = 0x0 ; 
00279     c_cf = 0x0 ; 
00280     set_der_0x0() ;     
00281     }
00282 
00283 }
00284 
00285             //--------------//
00286             // Destructeurs //
00287             //--------------//
00288 
00289 // Destructeur
00290 Valeur::~Valeur() {
00291     del_t() ;
00292 }
00293 
00294             //-------------//
00295             // Affectation //
00296             //-------------//
00297 
00298 // From double
00299 // ----------- 
00300 void Valeur::operator=(double x) {
00301 
00302     // Cas x = 0
00303     if (x == 0) {
00304     set_etat_zero() ;
00305     return ;
00306     }
00307 
00308     // Cas general
00309     // les dependances
00310     set_etat_c_qcq() ;
00311 
00312     // Les bases
00313     base.set_base_nondef() ;
00314     
00315     *c = x ;
00316 }
00317     
00318 // From Valeur
00319 // ----------- 
00320 void Valeur::operator=(const Valeur& v) {
00321 
00322     // Protections:
00323     // ----------- 
00324     assert(&v != this) ;    // pour eviter l'auto-affectation
00325     assert(mg == v.mg) ;    // meme grille
00326     
00327     // Copie de v : 
00328     // ------------
00329     etat = v.etat ;  // l'etat      
00330 
00331     base = v.base ;     // Les bases
00332 
00333     delete c ; 
00334     c = 0x0 ;           // eventuellement provisoire...
00335     
00336     delete c_cf ; 
00337     c_cf = 0x0 ;        // eventuellement provisoire...
00338 
00339     // La valeur eventuelle
00340     switch(v.etat) {
00341     case ETATNONDEF: {
00342         set_etat_nondef() ; 
00343         break ;         // valeur par defaut
00344     }
00345     
00346     case ETATZERO: {
00347         set_etat_zero() ;
00348         break ;
00349     }
00350         
00351     case ETATQCQ: {
00352         if (v.c != 0x0) {
00353         c = new Mtbl( *(v.c) ) ;
00354         }
00355     
00356         if (v.c_cf != 0x0) {
00357         c_cf = new Mtbl_cf( *(v.c_cf) ) ;
00358         }
00359     
00360         etat = ETATQCQ ;
00361 
00362         // On detruit les dependances (seulement lorsque tout est fini !)
00363         del_deriv() ;
00364 
00365         break ;
00366     }
00367     
00368     default: {
00369         cout << "Unkwon state in Valeur::operator=(const Valeur&) !" 
00370          << endl ;
00371         abort() ;
00372         break ;
00373     }
00374     }
00375     
00376 }
00377     
00378 // From Mtbl 
00379 // --------- 
00380 void Valeur::operator=(const Mtbl& mt) {
00381     
00382     // Protections
00383     // -----------
00384     assert(mt.get_etat() != ETATNONDEF) ;
00385     assert(mg == mt.get_mg()) ;     // meme grille
00386     assert(&mt != c) ;          // pour eviter l'autoaffectation 
00387     
00388     // Les bases
00389     base.set_base_nondef() ;
00390         
00391     delete c_cf ; 
00392     c_cf = 0x0 ;        
00393 
00394     // Suivant le cas...
00395     switch(mt.get_etat()) {
00396         case ETATZERO: {
00397         set_etat_zero() ;
00398         break ; 
00399     }
00400     
00401     case ETATQCQ: {
00402         delete c ; 
00403         c = new Mtbl(mt) ;
00404 
00405         del_deriv() ;   // On detruit les dependances...
00406 
00407         etat = ETATQCQ ; 
00408         break ;
00409     }
00410 
00411     default: {
00412         cout << "Unkwon state in Valeur::operator=(const Mtbl&) !" 
00413          << endl ;
00414         abort() ;
00415         break ;
00416     }
00417     }
00418 
00419 }
00420 
00421 // From Mtbl_cf 
00422 // ------------
00423 void Valeur::operator=(const Mtbl_cf& mt) {
00424 
00425     // Protections
00426     // -----------
00427     assert(mt.get_etat() != ETATNONDEF) ;
00428     assert(mg == mt.get_mg()) ;     // meme grille
00429     assert(&mt != c_cf) ;           // pour eviter l'autoaffectation 
00430     
00431     // Les bases
00432     base = mt.base ;  
00433         
00434     delete c ; 
00435     c = 0x0 ;       
00436 
00437     // Suivant le cas...
00438     switch(mt.get_etat()) {
00439         case ETATZERO: {
00440         set_etat_zero() ;
00441         break ; 
00442     }
00443     
00444     case ETATQCQ: {
00445         delete c_cf ; 
00446         c_cf = new Mtbl_cf(mt) ;
00447 
00448         del_deriv() ;   // On detruit les dependances...
00449 
00450         etat = ETATQCQ ; 
00451         break ;
00452     }
00453 
00454     default: {
00455         cout << "Unkwon state in Valeur::operator=(const Mtbl_cf&) !" 
00456          << endl ;
00457         abort() ;
00458         break ;
00459     }
00460     }
00461 
00462 }
00463 
00464             //------------//
00465             // Sauvegarde //
00466             //------------//
00467 
00468 void Valeur::sauve(FILE* fd) const {
00469 
00470     base.sauve(fd) ;                // la base 
00471     mg->sauve(fd) ;             // la multi-grille
00472     fwrite_be(&etat, sizeof(int), 1, fd) ;      // l'etat
00473 
00474     if (etat == ETATQCQ) {  
00475     if (c == 0x0) {     // La sauvegarde s'effectue dans l'espace
00476         coef_i() ;      // des configurations
00477     } 
00478     c->sauve(fd) ;    
00479     }
00480 
00481 }
00482     
00483             //------------//
00484             // Impression //
00485             //------------//
00486 
00487 // Operator <<
00488 // -----------
00489 ostream& operator<<(ostream& o, const Valeur & vi) {
00490     
00491     switch(vi.etat) {
00492     case ETATNONDEF: {
00493         o << "*** Valeur in UNDEFINED STATE" ;
00494         break ;
00495     }
00496     
00497     case ETATZERO: {
00498         o << "*** Valeur IDENTICALLY ZERO" ;
00499         break ; 
00500     }
00501     
00502     case ETATQCQ: {
00503         if (vi.c != 0x0) {
00504         o << "*** Valeur (configuration space) :" << endl ;
00505         o << *(vi.c) << endl ;
00506         }
00507         if (vi.c_cf != 0x0) {
00508         o << "*** Valeur (coefficients) :" << endl ;
00509         o << *(vi.c_cf) << endl ;
00510         }
00511         break ;
00512     }
00513     
00514     default: {
00515         cout << "operator<<(ostream&, const Valeur&) : unknown state !" 
00516          << endl ;
00517         abort() ;
00518         break ; 
00519     }
00520 
00521     }
00522     
00523     // Termine
00524     return o ;
00525 }
00526 
00527 // display_coef
00528 // ------------
00529 void Valeur::display_coef(double thres, int precis, ostream& ost) const {
00530 
00531     if (etat == ETATNONDEF) {
00532         ost << "    state: UNDEFINED" << endl ;
00533         return ;
00534     }
00535 
00536     if (etat == ETATZERO) {
00537         ost << "    state: ZERO" << endl ;
00538         return ;
00539     }
00540 
00541     coef() ;    // the coefficients are required
00542     
00543     c_cf->display(thres, precis, ost) ; 
00544         
00545 }
00546 
00547 
00548 // affiche_seuil
00549 //---------------
00550 
00551 void Valeur::affiche_seuil(ostream& ost, int type, int precis,  
00552                double seuil) const {
00553     ost << "*** Valeur " << endl ;
00554 
00555 
00556     // Cas particuliers
00557     //-----------------
00558 
00559     if (etat == ETATNONDEF) {
00560     ost << "    state: UNDEFINED" << endl ;
00561     return ;
00562     }
00563 
00564     if (etat == ETATZERO) {
00565     ost << "    state: ZERO" << endl ;
00566     return ;
00567     }
00568 
00569     switch(type) {
00570     case 0 : {
00571         coef() ;       // Mise a jour eventuelle des coefficients
00572         ost << " Coefficients of the Valeur : " << endl ; 
00573         c_cf->affiche_seuil(ost, precis, seuil) ;
00574         break ; 
00575     }
00576     
00577     case 1 : {
00578         coef_i() ;     // Mise a jour eventuelle dans l'espace des conf.
00579         ost << " Values of the Valeur at the collocation points: " << endl ; 
00580         c->affiche_seuil(ost, precis, seuil) ;
00581         break ; 
00582     }
00583     
00584     case 2 : {
00585         coef() ;       // Mise a jour eventuelle des coefficients
00586         coef_i() ;     // Mise a jour eventuelle dans l'espace des conf.
00587         ost << " Coefficients of the Valeur : " << endl ; 
00588         c_cf->affiche_seuil(ost, precis, seuil) ;
00589         ost << " Values of the Valeur at the collocation points: " << endl ; 
00590         c->affiche_seuil(ost, precis, seuil) ;
00591         break ; 
00592     }
00593     
00594     default : {
00595         cout << "Unknown type in Valeur::affiche_seuil !" << endl ; 
00596         abort() ;
00597         break ; 
00598     }
00599     }
00600  
00601 
00602 }
00603 
00604 
00605     
00606             //-----------------------//
00607             // Gestion de la memoire //
00608             //-----------------------//
00609 
00610 void Valeur::nouveau() {
00611     // Les donnees
00612     c = 0x0 ;
00613     c_cf = 0x0 ;
00614     set_der_0x0() ;
00615     // L'etat
00616     etat = ETATNONDEF ;
00617 }
00618 
00619 void Valeur::del_t() {
00620 
00621     delete c ; 
00622     c = 0x0 ;
00623     
00624     delete c_cf ; 
00625     c_cf = 0x0 ;
00626 
00627     del_deriv() ;
00628 
00629 }
00630 
00631 void Valeur::del_deriv() {
00632     // Destruction
00633     delete p_dsdx ;
00634     delete p_d2sdx2 ;
00635     delete p_sx ;
00636     delete p_sx2 ;
00637     delete p_mult_x ;
00638 
00639     delete p_dsdt ;
00640     delete p_d2sdt2 ;
00641     delete p_ssint ;
00642     delete p_scost ;
00643     delete p_mult_ct ;
00644     delete p_mult_st ;
00645 
00646     delete p_dsdp ;
00647     delete p_stdsdp ;
00648     delete p_d2sdp2 ;
00649     delete p_mult_cp ;
00650     delete p_mult_sp ;
00651     
00652     delete p_lapang ;
00653 
00654     // Pointeurs a 0x0
00655     set_der_0x0() ;
00656 }
00657 
00658 void Valeur::set_der_0x0() {
00659     p_dsdx = 0x0 ;
00660     p_d2sdx2 = 0x0 ;
00661     p_sx = 0x0 ;
00662     p_sx2 = 0x0 ;
00663     p_mult_x = 0x0 ;
00664 
00665     p_dsdt = 0x0 ;
00666     p_d2sdt2 = 0x0 ;
00667     p_ssint = 0x0 ;
00668     p_scost = 0x0 ;
00669     p_mult_ct = 0x0 ;
00670     p_mult_st = 0x0 ;
00671 
00672     p_dsdp = 0x0 ;
00673     p_stdsdp = 0x0 ;
00674     p_d2sdp2 = 0x0 ;
00675     p_mult_cp = 0x0 ;
00676     p_mult_sp = 0x0 ;
00677 
00678     p_lapang = 0x0 ;
00679 }
00680 
00681 // ETATZERO
00682 void Valeur::set_etat_zero() {
00683     if (etat == ETATZERO) return ;
00684     del_t() ;
00685     etat = ETATZERO ;
00686 }
00687 // ETATNONDEF
00688 void Valeur::set_etat_nondef() {
00689     if (etat == ETATNONDEF) return ;
00690     del_t() ;
00691     etat = ETATNONDEF ;
00692 }
00693 // ETATQCQ physique
00694 void Valeur::set_etat_c_qcq() {
00695     // Detruit les dependances
00696     del_deriv() ;
00697     delete c_cf ; c_cf = 0x0 ;
00698         
00699     if (c == 0x0) {
00700     c = new Mtbl(mg) ;
00701     }
00702     etat = ETATQCQ ;
00703 }
00704 // ETATQCQ coefficients
00705 void Valeur::set_etat_cf_qcq() {
00706     // Detruit les dependances
00707     del_deriv() ;
00708     delete c ; c = 0x0 ;
00709         
00710     if (c_cf == 0x0) {
00711     c_cf = new Mtbl_cf(mg, base) ;
00712     }
00713     etat = ETATQCQ ;
00714 }
00715 // ZERO hard
00716 void Valeur::annule_hard() {
00717     // Detruit les dependances
00718     del_deriv() ;
00719     
00720     if (c == 0x0) {
00721     c = new Mtbl(mg) ;
00722     }
00723     if (c_cf == 0x0) {
00724     c_cf = new Mtbl_cf(mg, base) ;
00725     }
00726     
00727     c->annule_hard() ;
00728     c_cf->annule_hard() ;
00729     
00730     etat = ETATQCQ ;
00731 }
00732 
00733 
00734 // Sets the Valeur to zero in a given domain
00735 // -----------------------------------------
00736 
00737 void Valeur::annule(int l) {
00738     
00739     annule(l, l) ;     
00740 }
00741 
00742 
00743 
00744 // Sets the Valeur to zero in several domains
00745 // ------------------------------------------
00746 
00747 void Valeur::annule(int l_min, int l_max) {
00748     
00749     // Cas particulier: annulation globale : 
00750     if ( (l_min == 0) && (l_max == mg->get_nzone()-1) ) {
00751     set_etat_zero() ;
00752     return ; 
00753     }
00754     
00755     assert( etat != ETATNONDEF ) ; 
00756     
00757     if ( etat == ETATZERO ) {
00758     return ;        // rien n'a faire si c'est deja zero
00759     }
00760     else {
00761     assert( etat == ETATQCQ ) ; // sinon...
00762 
00763     if (c != 0x0) {
00764         c->annule(l_min, l_max) ;       // Annule le Mtbl
00765     }
00766 
00767     if (c_cf != 0x0) {
00768         c_cf->annule(l_min, l_max) ;    // Annule le Mtbl_cf
00769     }
00770 
00771     // Annulation des membres derives
00772 
00773     if (p_dsdx != 0x0) p_dsdx->annule(l_min, l_max) ;
00774     if (p_d2sdx2 != 0x0) p_d2sdx2->annule(l_min, l_max) ;
00775     if (p_sx != 0x0) p_sx->annule(l_min, l_max) ;
00776     if (p_sx2 != 0x0) p_sx2->annule(l_min, l_max) ;
00777     if (p_mult_x != 0x0) p_mult_x->annule(l_min, l_max) ;
00778 
00779     if (p_dsdt != 0x0) p_dsdt->annule(l_min, l_max) ;
00780     if (p_d2sdt2 != 0x0) p_d2sdt2->annule(l_min, l_max) ;
00781     if (p_ssint != 0x0) p_ssint->annule(l_min, l_max) ;
00782     if (p_scost != 0x0) p_scost->annule(l_min, l_max) ;
00783     if (p_mult_ct != 0x0) p_mult_ct->annule(l_min, l_max) ;
00784     if (p_mult_st != 0x0) p_mult_st->annule(l_min, l_max) ;
00785 
00786     if (p_dsdp != 0x0) p_dsdp->annule(l_min, l_max) ;
00787     if (p_stdsdp != 0x0) p_stdsdp->annule(l_min, l_max) ;
00788     if (p_d2sdp2 != 0x0) p_d2sdp2->annule(l_min, l_max) ;
00789     if (p_mult_cp != 0x0) p_mult_cp->annule(l_min, l_max) ;
00790     if (p_mult_sp != 0x0) p_mult_sp->annule(l_min, l_max) ;
00791 
00792     if (p_lapang != 0x0) p_lapang->annule(l_min, l_max) ;   
00793      
00794     }
00795     
00796 }
00797 
00798 
00799             //--------------------------------------//
00800             //   Spectral bases manipulation        //
00801             //--------------------------------------//
00802             
00803 void Valeur::set_base(const Base_val& base_i) {
00804 
00805     base = base_i ; 
00806     
00807     if (c_cf != 0x0) {
00808     if ( !(c_cf->base == base_i) ) {
00809         delete c_cf ; 
00810         c_cf = 0x0 ; 
00811     }
00812     }
00813     
00814 }
00815 
00816 
00817 void Valeur::std_base_scal() {
00818       
00819     set_base( mg->std_base_scal() ) ;  
00820                    
00821 }    
00822 
00823 void Valeur::std_base_scal_odd() {
00824       
00825     set_base( mg->std_base_scal_odd() ) ;  
00826                    
00827 }    
00828 
00829 void Valeur::set_base_r(int l, int base_r) {
00830     
00831     base.set_base_r(l, base_r) ; 
00832     
00833     if (c_cf != 0x0) {
00834     if ( !(c_cf->base == base) ) {
00835         delete c_cf ; 
00836         c_cf = 0x0 ; 
00837     }
00838     }
00839         
00840 }
00841 
00842 void Valeur::set_base_t(int base_t) {
00843     
00844     base.set_base_t(base_t) ; 
00845     
00846     if (c_cf != 0x0) {
00847     if ( !(c_cf->base == base) ) {
00848         delete c_cf ; 
00849         c_cf = 0x0 ; 
00850     }
00851     }
00852         
00853 }
00854 
00855 void Valeur::set_base_p(int base_p) {
00856     
00857     base.set_base_p(base_p) ; 
00858     
00859     if (c_cf != 0x0) {
00860     if ( !(c_cf->base == base) ) {
00861         delete c_cf ; 
00862         c_cf = 0x0 ; 
00863     }
00864     }
00865         
00866 }
00867 
00868 
00869 
00870 
00871         //-----------------------------------------------//
00872         //      Value at an arbitrary point      //
00873         //-----------------------------------------------//
00874 
00875 double Valeur::val_point(int l, double x, double theta, double phi) const {
00876 
00877     assert(etat != ETATNONDEF) ; 
00878     
00879     double resu ; 
00880     
00881     if (etat == ETATZERO) {
00882     resu = 0 ; 
00883     }
00884     else{
00885     assert(etat == ETATQCQ) ; 
00886     coef() ;                // The coefficients are required 
00887     resu = c_cf->val_point(l, x, theta, phi) ;  // Call to the Mtbl_cf version
00888     }
00889 
00890     return resu ; 
00891 }
00892 
00893 double Valeur::val_point_jk(int l, double x, int j, int k) const {
00894 
00895     assert(etat != ETATNONDEF) ; 
00896     
00897     double resu ; 
00898     
00899     if (etat == ETATZERO) {
00900     resu = 0 ; 
00901     }
00902     else{
00903     assert(etat == ETATQCQ) ; 
00904     coef() ;                // The coefficients are required 
00905     resu = c_cf->val_point_jk(l, x, j, k) ;  // Call to the Mtbl_cf version
00906     }
00907 
00908     return resu ; 
00909 }
00910 
00911 
00912         //-----------------------------------------------//
00913         //                Filtres                    //
00914         //-----------------------------------------------//
00915 
00916 
00917 void Valeur::filtre_tp(int nn, int nz1, int nz2) {
00918 
00919     int nz = mg->get_nzone() ;
00920     int nr = mg->get_nr(0) ;
00921     int nt = mg->get_nt(0) ;
00922     int np = mg->get_np(0) ;
00923 
00924      if (etat != ETATZERO) {
00925     assert (etat == ETATQCQ) ;
00926     ylm() ;
00927     for (int lz=nz1; lz<=nz2; lz++) {
00928         if (c_cf->operator()(lz).get_etat() != ETATZERO)
00929         for (int k=0; k<np+1; k++)
00930             for (int j=0; j<nt; j++) {
00931                 int l_q, m_q, base_r ;
00932                 if (nullite_plm(j, nt, k, np, base) == 1) {
00933                 donne_lm(nz, lz, j, k, base, m_q, l_q,base_r) ;
00934                 if (l_q > nn)
00935                     for (int i=0; i<nr; i++)
00936                     c_cf->set(lz, k, j, i) = 0. ;
00937                 }
00938             }
00939     }
00940     if (c != 0x0) {
00941         delete c ;
00942         c = 0x0 ;
00943     }
00944     }
00945 
00946 }

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