mtbl_cf_display.C

00001 /*
00002  *  Method Mtbl_cf::display
00003  *
00004  *    (see file mtbl_cf.h for documentation).
00005  *
00006  */
00007 
00008 /*
00009  *   Copyright (c) 2003  Eric Gourgoulhon
00010  *
00011  *   This file is part of LORENE.
00012  *
00013  *   LORENE is free software; you can redistribute it and/or modify
00014  *   it under the terms of the GNU General Public License version 2
00015  *   as published by the Free Software Foundation.
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 char mtbl_cf_display_C[] = "$Header: /cvsroot/Lorene/C++/Source/Mtbl_cf/mtbl_cf_display.C,v 1.1 2003/10/19 19:51:58 e_gourgoulhon Exp $" ;
00029 
00030 /*
00031  * $Id: mtbl_cf_display.C,v 1.1 2003/10/19 19:51:58 e_gourgoulhon Exp $
00032  * $Log: mtbl_cf_display.C,v $
00033  * Revision 1.1  2003/10/19 19:51:58  e_gourgoulhon
00034  * First version
00035  *
00036  *
00037  *
00038  * $Header: /cvsroot/Lorene/C++/Source/Mtbl_cf/mtbl_cf_display.C,v 1.1 2003/10/19 19:51:58 e_gourgoulhon Exp $
00039  *
00040  */
00041 
00042 // C headers
00043 #include <stdlib.h>
00044 #include <math.h>
00045 
00046 // Lorene headers
00047 #include "mtbl_cf.h"
00048 
00049 void Mtbl_cf::display(double thres, int precis, ostream& ost) const {
00050 
00051     ost << "Spectral expansion (Mtbl_cf, threshold for display = " 
00052         << thres << ")" << endl ; 
00053     ost << base << endl ; 
00054 
00055     if (etat == ETATNONDEF) {
00056         ost << "    state: UNDEFINED" << endl ;
00057         return ;
00058     }
00059 
00060     if (etat == ETATZERO) {
00061         ost << "    state: ZERO" << endl ;
00062         return ;
00063     }
00064     
00065     ost.precision(precis);
00066     ost.setf(ios::showpoint);
00067     assert(etat == ETATQCQ) ; 
00068     char namep[12] ; 
00069     char namet[12] ; 
00070     char namer[12] ; 
00071     
00072     for (int l=0; l<nzone; l++) {
00073 
00074         int nr = mg->get_nr(l) ; 
00075         int nt = mg->get_nt(l) ; 
00076         int np = mg->get_np(l) ;
00077 
00078         ost << " --------- Domain no. " << l << " ------- nr x nt x np = "
00079             << nr << " x " << nt << " x " << np << " ------" << endl ; 
00080         const Tbl& tcf = *(t[l]) ; 
00081         if (tcf.get_etat() == ETATZERO) {
00082             ost << "*** identically ZERO ***" << endl << endl ; 
00083             continue ; 
00084         }
00085         if (tcf.get_etat() == ETATNONDEF) {
00086             ost << "*** UNDEFINED ***" << endl << endl ; 
00087             continue ; 
00088         }
00089         assert( tcf.get_etat() == ETATQCQ ) ; 
00090 
00091         for (int k=0; k<=np; k++) {
00092             base.name_phi(l, k, namep) ; 
00093             if (namep[0] == 'u') continue ; // unused phi coefficient
00094 
00095             for (int j=0; j<nt; j++) {
00096                 
00097                 bool test_display = false ; 
00098                 for (int i=0; i<nr; i++) {
00099                     if (fabs( tcf(k, j, i) ) >= thres) test_display = true ; 
00100                 }
00101                 
00102                 base.name_theta(l, k, j, namet) ;
00103                 
00104                 test_display = test_display && ( namet[0] != 'u' ) ;
00105                 
00106                 if (test_display) {
00107                     ost << "# " << namep << " " << namet << " :" ;
00108                     for (int i=0; i<nr; i++) {
00109                         double cx = tcf(k, j, i) ;
00110                         if (fabs( cx ) >= thres) {
00111                             base.name_r(l, k, j, i, namer) ;
00112                             if (namer[0] == 'u') continue ; // unused r coefficient
00113                             if ( (i>0) && (cx >= 0.) ) {
00114                                 ost <<  " +" << setw(precis) << cx 
00115                                 << " " << namer ; 
00116                             }
00117                             else {
00118                                 ost <<  " " << setw(precis) << cx 
00119                                 << " " << namer ; 
00120                             }
00121                         }
00122                     }
00123                     ost << endl ;   
00124                 }
00125 
00126             } // end of theta loop (index j)
00127             
00128         } // end of phi loop (index k)
00129         
00130         ost << endl ; 
00131         
00132     } // end of loop on the domains (index l)
00133 
00134 }
00135 
00136 
00137 
00138 
00139 
00140 
00141 
00142 
00143 
00144 
00145 
00146 
00147 
00148 

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