scalar_asymptot.C

00001 /*
00002  *  Function Scalar::asymptot
00003  *
00004  */
00005 
00006 /*
00007  *   Copyright (c) 2003 Eric Gourgoulhon & Jerome Novak
00008  *
00009  *   Copyright (c) 1999-2002 Eric Gourgoulhon (for previous class Cmp)
00010  *   Copyright (c) 1999-2001 Philippe Grandclement (for previous class Cmp)
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 char scalar_asymptot_C[] = "$Header: /cvsroot/Lorene/C++/Source/Tensor/Scalar/scalar_asymptot.C,v 1.3 2004/02/21 17:05:14 e_gourgoulhon Exp $" ;
00032 
00033 /*
00034  * $Id: scalar_asymptot.C,v 1.3 2004/02/21 17:05:14 e_gourgoulhon Exp $
00035  * $Log: scalar_asymptot.C,v $
00036  * Revision 1.3  2004/02/21 17:05:14  e_gourgoulhon
00037  * Method Scalar::point renamed Scalar::val_grid_point.
00038  * Method Scalar::set_point renamed Scalar::set_grid_point.
00039  *
00040  * Revision 1.2  2003/10/08 14:24:09  j_novak
00041  * replaced mult_r_zec with mult_r_ced
00042  *
00043  * Revision 1.1  2003/09/25 07:18:00  j_novak
00044  * Method asymptot implemented.
00045  *
00046  * $Header: /cvsroot/Lorene/C++/Source/Tensor/Scalar/scalar_asymptot.C,v 1.3 2004/02/21 17:05:14 e_gourgoulhon Exp $
00047  *
00048  */
00049 
00050 // Headers C
00051 #include <math.h>
00052 
00053 // Headers Lorene
00054 #include "tensor.h"
00055 
00056 Valeur** Scalar::asymptot(int n0, const int flag) const {
00057     
00058     assert(n0 >= 0) ; 
00059     const Mg3d& mg = *(mp->get_mg()) ; 
00060     int nz = mg.get_nzone() ; 
00061     int nzm1 = nz-1 ; 
00062     assert(mg.get_type_r(nzm1) == UNSURR) ; 
00063     int np = mg.get_np(nzm1) ; 
00064     int nt = mg.get_nt(nzm1) ; 
00065     int nr = mg.get_nr(nzm1) ; 
00066     int nrm1 = nr-1 ; 
00067         
00068     Valeur** vu = new Valeur*[n0+1] ;
00069     for (int h=0; h<=n0; h++) {
00070     vu[h] = new Valeur(mg.get_angu()) ; 
00071     }
00072 
00073     Scalar uu = *this ; 
00074 
00075     int precis = 2 ; 
00076 
00077     // The terms 1/r^h with h < dzpuis are null :
00078     // -----------------------------------------
00079     for (int h=0; h<dzpuis; h++) {
00080 
00081     vu[h]->set_etat_zero() ;    
00082                 
00083     }
00084 
00085     // Terms 1/r^h with h >= dzpuis :
00086     // -----------------------------
00087     for (int h=dzpuis; h<=n0; h++) {
00088     
00089     // Value on the sphere S^2 at infinity
00090     // -----------------------------------  
00091     vu[h]->set_etat_c_qcq() ; 
00092     vu[h]->c->set_etat_qcq() ; 
00093     for (int l=0; l<nzm1; l++) {
00094         vu[h]->c->t[l]->set_etat_zero() ; 
00095     }
00096     vu[h]->c->t[nzm1]->set_etat_qcq() ; 
00097 
00098     for (int k=0; k<np; k++) {
00099         for (int j=0; j<nt; j++) {
00100         vu[h]->set(nzm1, k, j, 0) = uu.val_grid_point(nzm1, k, j, nrm1) ; 
00101         }
00102     }
00103     
00104     vu[h]->set_base( uu.va.base ) ; 
00105     
00106     // Printing
00107     // --------
00108     if (flag != 0) {
00109         cout << "Term in 1/r^" << h << endl ; 
00110         cout << "-------------" << endl ; 
00111 
00112         double ndec = 0 ; 
00113         double vmin = (*vu[h])(nzm1, 0, 0, 0) ; 
00114         double vmax = vmin ; 
00115 
00116         cout << "            Values at the point (phi_k, theta_j) : " << endl ; 
00117         cout.precision(precis) ;
00118         cout.setf(ios::showpoint) ;
00119         for (int k=0; k<np; k++) {
00120         cout <<  " k=" << k << " : "  ;
00121         for (int j=0; j<nt; j++) {
00122         double xx = (*vu[h])(nzm1, k, j, 0) ;
00123         cout <<  " " << setw(precis) << xx ;    
00124         ndec += fabs(xx) ;  
00125         vmin = ( xx < vmin ) ? xx : vmin ; 
00126         vmax = ( xx > vmax ) ? xx : vmax ; 
00127         }
00128         cout << endl;
00129     }
00130     ndec /= np*nt ; 
00131     cout << "Minimum value on S^2 : " << vmin << endl ; 
00132     cout << "Maximum value on S^2 : " << vmax << endl ; 
00133     cout << "L^1 norm on S^2     : " << ndec << endl ;  
00134     }       
00135     // The value at infinity is substracted
00136     // ------------------------------------
00137     for (int k=0; k<np; k++) {
00138         for (int j=0; j<nt; j++) {
00139         double v_inf = (*vu[h])(nzm1, k, j, 0) ; 
00140         for (int i=0; i<nr; i++) {
00141            uu.set_grid_point(nzm1, k, j, i) -= v_inf ;  
00142         }
00143         }
00144     }
00145     
00146     // Mutliplication by r
00147     // -------------------
00148     
00149     uu.mult_r_ced() ; 
00150     
00151     } // End of loop on h  (development order)     
00152     
00153     return vu ; 
00154     
00155 }

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