mtbl_cf.h

00001 /*
00002  *  Definition of Lorene class Mtbl_cf
00003  *
00004  */
00005 
00006 /*
00007  *   Copyright (c) 1999-2000 Jean-Alain Marck
00008  *   Copyright (c) 1999-2005 Eric Gourgoulhon
00009  *   Copyright (c) 1999-2001 Philippe Grandclement
00010  *   Copyright (c) 1999-2001 Jerome Novak
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 as published by
00016  *   the Free Software Foundation; either version 2 of the License, or
00017  *   (at your option) any later version.
00018  *
00019  *   LORENE is distributed in the hope that it will be useful,
00020  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00021  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00022  *   GNU General Public License for more details.
00023  *
00024  *   You should have received a copy of the GNU General Public License
00025  *   along with LORENE; if not, write to the Free Software
00026  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00027  *
00028  */
00029 
00030 
00031 #ifndef __MTBL_CF_H_
00032 #define __MTBL_CF_H_
00033 
00034 /*
00035  * $Id: mtbl_cf.h,v 1.9 2006/06/06 14:56:59 j_novak Exp $
00036  * $Log: mtbl_cf.h,v $
00037  * Revision 1.9  2006/06/06 14:56:59  j_novak
00038  * Summation functions for angular coefficients at xi=+/-1.
00039  *
00040  * Revision 1.8  2005/04/04 21:30:42  e_gourgoulhon
00041  *  Added argument lambda to method poisson_angu
00042  *  to treat the generalized angular Poisson equation:
00043  *     Lap_ang u + lambda u = source.
00044  *
00045  * Revision 1.7  2004/03/22 13:12:42  j_novak
00046  * Modification of comments to use doxygen instead of doc++
00047  *
00048  * Revision 1.6  2003/11/06 14:43:37  e_gourgoulhon
00049  * Gave a name to const arguments in certain method prototypes (e.g.
00050  * constructors) to correct a bug of DOC++.
00051  *
00052  * Revision 1.5  2003/10/19 19:44:41  e_gourgoulhon
00053  * Introduced new method display (to replace the old affiche_seuil).
00054  *
00055  * Revision 1.4  2003/10/15 21:09:22  e_gourgoulhon
00056  * Added method poisson_regu.
00057  *
00058  * Revision 1.3  2002/09/13 09:17:33  j_novak
00059  * Modif. commentaires
00060  *
00061  * Revision 1.2  2002/06/17 14:05:17  j_novak
00062  * friend functions are now also declared outside the class definition
00063  *
00064  * Revision 1.1.1.1  2001/11/20 15:19:27  e_gourgoulhon
00065  * LORENE
00066  *
00067  * Revision 2.28  2000/09/11  13:52:21  eric
00068  * Ajout des methodes mult_cp() et mult_sp().
00069  *
00070  * Revision 2.27  2000/08/16  10:42:54  eric
00071  * Suppression du membre dzpuis.
00072  *
00073  * Revision 2.26  2000/08/04  11:41:52  eric
00074  * Ajout de l'operateur (int l) et de la fonction set(int l) pour l'acces
00075  * individuel aux Tbl.
00076  *
00077  * Revision 2.25  2000/03/06  10:26:24  eric
00078  * Ajout des fonctions val_point_symy, val_point_asymy.
00079  *
00080  * Revision 2.24  2000/02/25  13:53:44  eric
00081  * Suppression de la fonction nettoie().
00082  *
00083  * Revision 2.23  1999/12/29  13:11:34  eric
00084  * Ajout de la fonction val_point_jk.
00085  *
00086  * Revision 2.22  1999/12/07  14:51:52  eric
00087  * Changement ordre des arguments (phi,theta,xi) --> (xi,theta,phi)
00088  *  dans la routine val_point.
00089  *
00090  * Revision 2.21  1999/12/06  16:45:48  eric
00091  * Ajout de la fonction val_point.
00092  *
00093  * Revision 2.20  1999/11/23  14:30:12  novak
00094  * Ajout des membres mult_ct et mult_st
00095  *
00096  * Revision 2.19  1999/11/16  13:06:22  novak
00097  * Ajout de mult_x et scost
00098  *
00099  * Revision 2.18  1999/10/29  15:07:10  eric
00100  * Suppression des fonctions membres min() et max():
00101  * elles deviennent des fonctions externes.
00102  * Ajout de fonctions mathematiques (abs, norme, etc...).
00103  *
00104  * Revision 2.17  1999/10/21  13:42:00  eric
00105  * *** empty log message ***
00106  *
00107  * Revision 2.16  1999/10/21  12:49:13  eric
00108  * Ajout de la fonction membre nettoie().
00109  *
00110  * Revision 2.15  1999/10/18  15:06:50  eric
00111  * La fonction membre annule() est rebaptisee annule_hard().
00112  * Introduction de la fonction membre annule(int, int).
00113  *
00114  * Revision 2.14  1999/10/18  13:39:13  eric
00115  * Suppression de l'argument base dans les routines de derivation.
00116  *
00117  * Revision 2.13  1999/10/13  15:49:22  eric
00118  * Ajout du membre base.
00119  * Modification des constructeurs (la base doit etre passee en argument).
00120  *
00121  * Revision 2.12  1999/10/01  14:49:19  eric
00122  * Depoussierage.
00123  * Documentation.
00124  *
00125  * Revision 2.11  1999/09/07  14:33:43  phil
00126  * ajout de la fonction ssint(int*)
00127  *
00128  * Revision 2.10  1999/04/26  17:02:40  phil
00129  * ajout de sx2(int*)
00130  *
00131  * Revision 2.9  1999/04/26  16:24:02  phil
00132  * ajout de mult2_xm1_zec(int*)
00133  *
00134  * Revision 2.8  1999/04/26  16:12:27  phil
00135  * ajout de mult_xm1_zec(int *)
00136  *
00137  * Revision 2.7  1999/04/26  15:48:43  phil
00138  * ajout de sxm1_zec(int*)
00139  *
00140  * Revision 2.6  1999/04/26  14:50:30  phil
00141  * ajout de sx(int*)
00142  *
00143  * Revision 2.5  1999/04/26  12:19:38  phil
00144  * ajout lapang
00145  *
00146  * Revision 2.4  1999/03/03  10:32:44  hyc
00147  * *** empty log message ***
00148  *
00149  * Revision 2.3  1999/03/02  18:55:00  eric
00150  * Ajout de la fonction affiche_seuil.
00151  *
00152  *
00153  * $Header: /cvsroot/Lorene/C++/Include/mtbl_cf.h,v 1.9 2006/06/06 14:56:59 j_novak Exp $
00154  *
00155  */
00156 
00157 // Headers Lorene 
00158 #include "tbl.h"
00159 #include "base_val.h"
00160 #include "grilles.h"
00161 
00162 class Mg3d ;
00163 
00182 class Mtbl_cf {
00183 
00184     // Data : 
00185     // -----
00186     private:
00188     const Mg3d* mg ;  
00190     int nzone ; 
00192     int etat ;  
00193 
00194     public:
00196     Base_val base ;
00197     
00201     Tbl** t ;   
00202 
00203     // Constructors - Destructor
00204     // -------------------------
00205     
00206     public:
00208     Mtbl_cf(const Mg3d& mgrid, const Base_val& basis) ; 
00210     Mtbl_cf(const Mg3d* p_mgrid, const Base_val& basis) ; 
00211 
00213     Mtbl_cf(const Mg3d&, FILE* ) ;          
00214 
00216     Mtbl_cf(const Mtbl_cf& ) ;      
00218     ~Mtbl_cf() ;                
00219 
00220     // Assignement
00221     // -----------
00223     void operator=(const Mtbl_cf& ) ;   
00225     void operator=(double ) ;       
00227     void operator=(int ) ;          
00228 
00229     // Memory management
00230     // -----------------
00231     private:
00235     void del_t() ;  
00236             
00237     public:
00238 
00243     void set_etat_nondef() ;
00244     
00249     void set_etat_zero() ;          
00250 
00257     void set_etat_qcq() ;           
00258 
00267     void annule_hard() ;    
00268     
00279     void annule(int l_min, int l_max) ; 
00280 
00281     // Access to individual elements
00282     // -----------------------------
00283     public:
00284 
00290     Tbl& set(int l) {
00291         assert(l < nzone) ;
00292         assert(etat == ETATQCQ) ;
00293         return *(t[l]) ;
00294     };
00295     
00296     
00302     const Tbl& operator()(int l) const {
00303         assert(l < nzone) ;
00304         assert(etat == ETATQCQ) ;
00305         return *(t[l]) ;
00306     };
00307 
00308 
00315     double& set(int l, int k, int j, int i) {
00316         assert(l < nzone) ;
00317         assert(etat == ETATQCQ) ;
00318         return (t[l])->set(k, j, i) ;
00319     };
00320     
00321     
00328     double operator()(int l, int k, int j, int i) const {
00329         assert(etat != ETATNONDEF) ;
00330         assert(l < nzone) ;
00331         if (etat == ETATZERO) {
00332         double zero = 0. ;
00333         return zero ; 
00334         }
00335         else return (*t[l])(k, j, i) ;
00336     };
00337 
00348     double val_point(int l, double x, double theta, double phi) const ; 
00349 
00361     double val_point_symy(int l, double x, double theta, double phi) const ; 
00362 
00374     double val_point_asymy(int l, double x, double theta, double phi) const ; 
00375 
00388     double val_point_jk(int l, double x, int j, int k) const ; 
00389 
00403     double val_point_jk_symy(int l, double x, int j, int k) const ; 
00404 
00418     double val_point_jk_asymy(int l, double x, int j, int k) const ; 
00419 
00429     double val_out_bound_jk(int l, int j, int k) const ; 
00430 
00441     double val_in_bound_jk(int l, int j, int k) const ; 
00442 
00443 
00444 
00445     // Extraction of information
00446     // -------------------------
00447     public:
00449     const Mg3d* get_mg() const { return mg ; }; 
00450 
00452     int get_etat() const { return etat ; };   
00453     
00455     int get_nzone() const { return nzone ; } ; 
00456     
00457         
00458     // Outputs
00459     // -------
00460     public:
00461 
00463     void sauve(FILE *) const ;      
00464 
00472     void display(double threshold = 1.e-7, int precision = 4, 
00473                ostream& ostr = cout) const ;
00474 
00481     void affiche_seuil(ostream& ostr, int precision = 4, 
00482                double threshold = 1.e-7) const ;
00484     friend ostream& operator<<(ostream& , const Mtbl_cf& ) ;   
00485 
00486     // Member arithmetics
00487     // ------------------
00488     public:
00490     void operator+=(const Mtbl_cf & ) ; 
00492     void operator-=(const Mtbl_cf & ) ; 
00494     void operator*=(double ) ;      
00496     void operator/=(double ) ;      
00497 
00498     // Linear operators
00499     // ----------------
00500     public:
00502     void dsdx() ;           
00503 
00505     void d2sdx2() ;         
00506 
00511     void sx() ;         
00512 
00517     void sx2() ;            
00518     
00523     void mult_x() ;         
00524     
00528     void sxm1_zec() ;           
00529 
00533     void mult_xm1_zec() ;       
00534 
00538     void mult2_xm1_zec() ;      
00539 
00541     void dsdt() ;          
00542 
00544     void d2sdt2() ;         
00545 
00547     void ssint() ;          
00548         
00550     void scost() ;          
00551 
00553     void mult_ct() ;            
00554 
00556     void mult_st() ;            
00557 
00559     void dsdp() ;           
00560 
00562     void d2sdp2() ;         
00563 
00565     void mult_cp() ;            
00566 
00568     void mult_sp() ;            
00569 
00571     void lapang() ;
00572     
00573     // PDE resolution
00574     //---------------
00575     public: 
00591     void poisson_angu(double lambda = 0) ; 
00592     
00593 } ;
00594 ostream& operator<<(ostream& , const Mtbl_cf& ) ;   
00595 
00602 
00603 Mtbl_cf operator+(const Mtbl_cf& ) ;            
00605 Mtbl_cf operator-(const Mtbl_cf& ) ;            
00607 Mtbl_cf operator+(const Mtbl_cf&, const Mtbl_cf& ) ;    
00609 Mtbl_cf operator-(const Mtbl_cf&, const Mtbl_cf& ) ;    
00611 Mtbl_cf operator*(const Mtbl_cf&, double ) ;        
00613 Mtbl_cf operator*(double, const Mtbl_cf& ) ;        
00615 Mtbl_cf operator*(const Mtbl_cf&, int ) ;       
00617 Mtbl_cf operator*(int, const Mtbl_cf& ) ;       
00619 Mtbl_cf operator/(const Mtbl_cf&, double ) ;        
00621 Mtbl_cf operator/(const Mtbl_cf&, int ) ;       
00622 
00624 Mtbl_cf abs(const Mtbl_cf& ) ;      
00625 
00631 Tbl max(const Mtbl_cf& ) ;   
00632 
00638 Tbl min(const Mtbl_cf& ) ;   
00639 
00645 Tbl norme(const Mtbl_cf& ) ;   
00646 
00655 Tbl diffrel(const Mtbl_cf& a, const Mtbl_cf& b) ; 
00656 
00665 Tbl diffrelmax(const Mtbl_cf& a, const Mtbl_cf& b) ; 
00666 
00669 #endif

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