00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
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
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 #include <stdlib.h>
00044 #include <math.h>
00045
00046
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 ;
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 ;
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 }
00127
00128 }
00129
00130 ost << endl ;
00131
00132 }
00133
00134 }
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148