cmp_asymptot.C

00001 /*
00002  *  Function Cmp::asymptot
00003  *
00004  */
00005 
00006 /*
00007  *   Copyright (c) 1999-2002 Eric Gourgoulhon
00008  *   Copyright (c) 1999-2001 Philippe Grandclement
00009  *
00010  *   This file is part of LORENE.
00011  *
00012  *   LORENE is free software; you can redistribute it and/or modify
00013  *   it under the terms of the GNU General Public License as published by
00014  *   the Free Software Foundation; either version 2 of the License, or
00015  *   (at your option) any later version.
00016  *
00017  *   LORENE is distributed in the hope that it will be useful,
00018  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  *   GNU General Public License for more details.
00021  *
00022  *   You should have received a copy of the GNU General Public License
00023  *   along with LORENE; if not, write to the Free Software
00024  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025  *
00026  */
00027 
00028 
00029 char cmp_asymptot_C[] = "$Header: /cvsroot/Lorene/C++/Source/Cmp/cmp_asymptot.C,v 1.3 2002/10/16 14:36:34 j_novak Exp $" ;
00030 
00031 /*
00032  * $Id: cmp_asymptot.C,v 1.3 2002/10/16 14:36:34 j_novak Exp $
00033  * $Log: cmp_asymptot.C,v $
00034  * Revision 1.3  2002/10/16 14:36:34  j_novak
00035  * Reorganization of #include instructions of standard C++, in order to
00036  * use experimental version 3 of gcc.
00037  *
00038  * Revision 1.2  2002/05/22 13:57:25  f_limousin
00039  * Corrected error in determination of min and max values on the sphere.
00040  *
00041  * Revision 1.1.1.1  2001/11/20 15:19:27  e_gourgoulhon
00042  * LORENE
00043  *
00044  * Revision 2.2  2000/11/15  13:24:43  phil
00045  * modification output
00046  *
00047  * Revision 2.1  2000/11/15  13:16:01  phil
00048  * ajout gestion affichage
00049  *
00050  * Revision 2.0  2000/03/25  12:53:03  eric
00051  * *** empty log message ***
00052  *
00053  *
00054  * $Header: /cvsroot/Lorene/C++/Source/Cmp/cmp_asymptot.C,v 1.3 2002/10/16 14:36:34 j_novak Exp $
00055  *
00056  */
00057 
00058 // Headers C
00059 #include <math.h>
00060 
00061 // Headers Lorene
00062 #include "cmp.h"
00063 
00064 Valeur** Cmp::asymptot(int n0, const int flag) const {
00065     
00066     assert(n0 >= 0) ; 
00067     const Mg3d& mg = *(mp->get_mg()) ; 
00068     int nz = mg.get_nzone() ; 
00069     int nzm1 = nz-1 ; 
00070     assert(mg.get_type_r(nzm1) == UNSURR) ; 
00071     int np = mg.get_np(nzm1) ; 
00072     int nt = mg.get_nt(nzm1) ; 
00073     int nr = mg.get_nr(nzm1) ; 
00074     int nrm1 = nr-1 ; 
00075         
00076     Valeur** vu = new Valeur*[n0+1] ;
00077     for (int h=0; h<=n0; h++) {
00078     vu[h] = new Valeur(mg.get_angu()) ; 
00079     }
00080 
00081     Cmp uu = *this ; 
00082 
00083     int precis = 2 ; 
00084 
00085     // The terms 1/r^h with h < dzpuis are null :
00086     // -----------------------------------------
00087     for (int h=0; h<dzpuis; h++) {
00088 
00089     vu[h]->set_etat_zero() ;    
00090                 
00091     }
00092 
00093     // Terms 1/r^h with h >= dzpuis :
00094     // -----------------------------
00095     for (int h=dzpuis; h<=n0; h++) {
00096     
00097     // Value on the sphere S^2 at infinity
00098     // -----------------------------------  
00099     vu[h]->set_etat_c_qcq() ; 
00100     vu[h]->c->set_etat_qcq() ; 
00101     for (int l=0; l<nzm1; l++) {
00102         vu[h]->c->t[l]->set_etat_zero() ; 
00103     }
00104     vu[h]->c->t[nzm1]->set_etat_qcq() ; 
00105 
00106     for (int k=0; k<np; k++) {
00107         for (int j=0; j<nt; j++) {
00108         vu[h]->set(nzm1, k, j, 0) = uu(nzm1, k, j, nrm1) ; 
00109         }
00110     }
00111     
00112     vu[h]->set_base( uu.va.base ) ; 
00113     
00114     // Printing
00115     // --------
00116     if (flag != 0) {
00117         cout << "Term in 1/r^" << h << endl ; 
00118         cout << "-------------" << endl ; 
00119 
00120         double ndec = 0 ; 
00121         double vmin = (*vu[h])(nzm1, 0, 0, 0) ; 
00122         double vmax = vmin ; 
00123 
00124         cout << "            Values at the point (phi_k, theta_j) : " << endl ; 
00125         cout.precision(precis) ;
00126         cout.setf(ios::showpoint) ;
00127         for (int k=0; k<np; k++) {
00128         cout <<  " k=" << k << " : "  ;
00129         for (int j=0; j<nt; j++) {
00130         double xx = (*vu[h])(nzm1, k, j, 0) ;
00131         cout <<  " " << setw(precis) << xx ;    
00132         ndec += fabs(xx) ;  
00133         vmin = ( xx < vmin ) ? xx : vmin ; 
00134         vmax = ( xx > vmax ) ? xx : vmax ; 
00135         }
00136         cout << endl;
00137     }
00138     ndec /= np*nt ; 
00139     cout << "Minimum value on S^2 : " << vmin << endl ; 
00140     cout << "Maximum value on S^2 : " << vmax << endl ; 
00141     cout << "L^1 norm on S^2     : " << ndec << endl ;  
00142     }       
00143     // The value at infinity is substracted
00144     // ------------------------------------
00145     for (int k=0; k<np; k++) {
00146         for (int j=0; j<nt; j++) {
00147         double v_inf = (*vu[h])(nzm1, k, j, 0) ; 
00148         for (int i=0; i<nr; i++) {
00149            uu.set(nzm1, k, j, i) -= v_inf ;  
00150         }
00151         }
00152     }
00153     
00154     // Mutliplication by r
00155     // -------------------
00156     
00157     uu.mult_r_zec() ; 
00158     
00159     } // End of loop on h  (development order)     
00160     
00161     return vu ; 
00162     
00163 }

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