des_coef_valeur.C

00001 /*
00002  * Plots the spectral coefficients of a Valeur.
00003  *
00004  * (see file graphique.h for the documentation).
00005  *
00006  */
00007 
00008 /*
00009  *   Copyright (c) 1999-2001 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 as published by
00015  *   the Free Software Foundation; either version 2 of the License, or
00016  *   (at your option) any later version.
00017  *
00018  *   LORENE is distributed in the hope that it will be useful,
00019  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021  *   GNU General Public License for more details.
00022  *
00023  *   You should have received a copy of the GNU General Public License
00024  *   along with LORENE; if not, write to the Free Software
00025  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00026  *
00027  */
00028 
00029 
00030 char des_coef_valeur_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Graphics/des_coef_valeur.C,v 1.2 2008/08/19 06:42:00 j_novak Exp $" ;
00031 
00032 
00033 
00034 /*
00035  * $Id: des_coef_valeur.C,v 1.2 2008/08/19 06:42:00 j_novak Exp $
00036  * $Log: des_coef_valeur.C,v $
00037  * Revision 1.2  2008/08/19 06:42:00  j_novak
00038  * Minor modifications to avoid warnings with gcc 4.3. Most of them concern
00039  * cast-type operations, and constant strings that must be defined as const char*
00040  *
00041  * Revision 1.1.1.1  2001/11/20 15:19:29  e_gourgoulhon
00042  * LORENE
00043  *
00044  * Revision 1.5  2000/02/25  10:28:02  eric
00045  * Suppression des appels a Mtbl_cf::nettoie().
00046  *
00047  * Revision 1.4  1999/12/20  14:27:21  eric
00048  * Amelioration des legendes.
00049  *
00050  * Revision 1.3  1999/12/20  10:57:33  eric
00051  * Ajout des arguments device, newgraph, nxpage et nypage.
00052  *
00053  * Revision 1.2  1999/12/10  12:30:44  eric
00054  * *** empty log message ***
00055  *
00056  * Revision 1.1  1999/12/10  12:14:28  eric
00057  * Initial revision
00058  *
00059  *
00060  * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/Graphics/des_coef_valeur.C,v 1.2 2008/08/19 06:42:00 j_novak Exp $
00061  *
00062  */
00063 
00064 // Header C
00065 #include <stdlib.h>
00066 #include <string.h>
00067 
00068 // Header Lorene
00069 #include "valeur.h"
00070 #include "graphique.h"
00071 
00072             //-------------------------//
00073             //  xi coefficients    //
00074             //-------------------------//
00075 
00076 void des_coef_xi(const Valeur& uu, int l, int k, int j, double pzero, 
00077          const char* nomy, const char* title, const char* device, 
00078              int newgraph, int nxpage, int nypage) {
00079 
00080     assert(uu.get_etat() != ETATNONDEF) ;   
00081     uu.coef() ; 
00082     
00083     int nr = uu.get_mg()->get_nr(l) ; 
00084     
00085     double* cf = new double[nr] ; 
00086     
00087     // Are all the coefficients zero ?
00088     // -------------------------------
00089     if (uu.get_etat() == ETATZERO) {
00090     for (int i=0; i<nr; i++) {
00091         cf[i] = 0 ; 
00092     }
00093     }
00094     else{
00095     assert(uu.get_etat() == ETATQCQ) ;
00096     for (int i=0; i<nr; i++) {
00097         cf[i] = (*(uu.c_cf))(l, k, j, i) ; 
00098     }
00099     }
00100 
00101     const char* nomx = "i" ; 
00102 
00103     char title1[80] ;
00104     char nomy1[80] ;
00105     char bslash[2] = {92,  '\0'} ;  // 92 is the ASCII code for the backslash 
00106                     // character
00107     char nom_l[3] ; 
00108     sprintf(nom_l, "%d", l) ; 
00109     char nom_k[4] ; 
00110     sprintf(nom_k, "%d", k) ; 
00111     char nom_j[4] ; 
00112     sprintf(nom_j, "%d", j) ; 
00113 
00114     if (title == 0x0) {
00115     strcpy(title1, bslash ) ; 
00116     strcat(title1, "gc coef. for k=" ) ; 
00117     strcat(title1, nom_k) ; 
00118     strcat(title1, ", j=" ) ; 
00119     strcat(title1, nom_j) ; 
00120     strcat(title1, " (domain " ) ;
00121     strcat(title1, nom_l) ; 
00122     strcat(title1, ")" ) ;  
00123     }
00124     else{
00125     strncpy(title1, title, 80) ; 
00126     }
00127 
00128     if (nomy == 0x0) {
00129     strcpy(nomy1, "log| c" ) ;
00130     strcat(nomy1, bslash ) ; 
00131     strcat(nomy1, "d" ) ;
00132     strcat(nomy1, nom_k ) ;
00133     strcat(nomy1, "," ) ;
00134     strcat(nomy1, nom_j ) ;
00135     strcat(nomy1, "," ) ;
00136     strcat(nomy1, "i" ) ;
00137     strcat(nomy1, bslash ) ; 
00138     strcat(nomy1, "u |" ) ; 
00139     }
00140     else{
00141     strncpy(nomy1, nomy, 80) ;  
00142     }
00143     
00144     des_coef(cf, nr, pzero, nomx, nomy1, title1, device, newgraph, 
00145          nxpage, nypage) ;    
00146     
00147     delete [] cf ; 
00148     
00149 } 
00150 
00151             //------------------------------//
00152             //  theta coefficients  //
00153             //------------------------------//
00154 
00155 void des_coef_theta(const Valeur& uu, int l, int k, int i, double pzero, 
00156          const char* nomy, const char* title, const char* device, 
00157              int newgraph, int nxpage, int nypage) {
00158 
00159     assert(uu.get_etat() != ETATNONDEF) ;   
00160     uu.coef() ; 
00161     
00162     int nt = uu.get_mg()->get_nt(l) ; 
00163     
00164     double* cf = new double[nt] ; 
00165     
00166     // Are all the coefficients zero ?
00167     // -------------------------------
00168     if (uu.get_etat() == ETATZERO) {
00169     for (int j=0; j<nt; j++) {
00170         cf[j] = 0 ; 
00171     }
00172     }
00173     else{
00174     assert(uu.get_etat() == ETATQCQ) ;
00175     for (int j=0; j<nt; j++) {
00176         cf[j] = (*(uu.c_cf))(l, k, j, i) ; 
00177     }
00178     }
00179 
00180     const char* nomx = "j" ; 
00181 
00182     char title1[80] ;
00183     char nomy1[80] ;
00184     char bslash[2] = {92,  '\0'} ;  // 92 is the ASCII code for the backslash 
00185                     // character
00186     char nom_l[3] ; 
00187     sprintf(nom_l, "%d", l) ; 
00188     char nom_k[4] ; 
00189     sprintf(nom_k, "%d", k) ; 
00190     char nom_i[4] ; 
00191     sprintf(nom_i, "%d", i) ; 
00192 
00193     if (title == 0x0) {
00194     strcpy(title1, bslash ) ; 
00195     strcat(title1, "gh coef. for k=" ) ; 
00196     strcat(title1, nom_k) ; 
00197     strcat(title1, ", i=" ) ; 
00198     strcat(title1, nom_i) ; 
00199     strcat(title1, " (domain " ) ;
00200     strcat(title1, nom_l) ; 
00201     strcat(title1, ")" ) ;  
00202     }
00203     else{
00204     strncpy(title1, title, 80) ; 
00205     }
00206 
00207     if (nomy == 0x0) {
00208     strcpy(nomy1, "log| c" ) ;
00209     strcat(nomy1, bslash ) ; 
00210     strcat(nomy1, "d" ) ;
00211     strcat(nomy1, nom_k ) ;
00212     strcat(nomy1, ",j," ) ;
00213     strcat(nomy1, nom_i ) ;
00214     strcat(nomy1, bslash ) ; 
00215     strcat(nomy1, "u |" ) ; 
00216     }
00217     else{
00218     strncpy(nomy1, nomy, 80) ;  
00219     }
00220     
00221     des_coef(cf, nt, pzero, nomx, nomy1, title1, device, newgraph, 
00222          nxpage, nypage) ;    
00223     
00224     delete [] cf ; 
00225     
00226 } 
00227 
00228 
00229             //------------------------------//
00230             //  phi coefficients    //
00231             //------------------------------//
00232 
00233 void des_coef_phi(const Valeur& uu, int l, int j, int i, double pzero, 
00234          const char* nomy, const char* title, const char* device, 
00235              int newgraph, int nxpage, int nypage) {
00236 
00237     assert(uu.get_etat() != ETATNONDEF) ;   
00238     uu.coef() ; 
00239     
00240     int np = uu.get_mg()->get_np(l) + 2 ; 
00241     
00242     double* cf = new double[np] ; 
00243     
00244     // Are all the coefficients zero ?
00245     // -------------------------------
00246     if (uu.get_etat() == ETATZERO) {
00247     for (int k=0; k<np; k++) {
00248         cf[k] = 0 ; 
00249     }
00250     }
00251     else{
00252     assert(uu.get_etat() == ETATQCQ) ;
00253     for (int k=0; k<np; k++) {
00254         cf[k] = (*(uu.c_cf))(l, k, j, i) ; 
00255     }
00256     }
00257 
00258     const char* nomx = "k" ; 
00259 
00260     char title1[80] ;
00261     char nomy1[80] ;
00262     char bslash[2] = {92,  '\0'} ;  // 92 is the ASCII code for the backslash 
00263                     // character
00264     char nom_l[3] ; 
00265     sprintf(nom_l, "%d", l) ; 
00266     char nom_j[4] ; 
00267     sprintf(nom_j, "%d", j) ; 
00268     char nom_i[4] ; 
00269     sprintf(nom_i, "%d", i) ; 
00270 
00271     if (title == 0x0) {
00272     strcpy(title1, bslash ) ; 
00273     strcat(title1, "gf coef. for j=" ) ; 
00274     strcat(title1, nom_j) ; 
00275     strcat(title1, ", i=" ) ; 
00276     strcat(title1, nom_i) ; 
00277     strcat(title1, " (domain " ) ;
00278     strcat(title1, nom_l) ; 
00279     strcat(title1, ")" ) ;  
00280     }
00281     else{
00282     strncpy(title1, title, 80) ; 
00283     }
00284 
00285     if (nomy == 0x0) {
00286     strcpy(nomy1, "log| c" ) ;
00287     strcat(nomy1, bslash ) ; 
00288     strcat(nomy1, "dk," ) ;
00289     strcat(nomy1, nom_j ) ;
00290     strcat(nomy1, "," ) ;
00291     strcat(nomy1, nom_i ) ;
00292     strcat(nomy1, bslash ) ; 
00293     strcat(nomy1, "u |" ) ; 
00294     }
00295     else{
00296     strncpy(nomy1, nomy, 80) ;  
00297     }
00298     
00299     des_coef(cf, np, pzero, nomx, nomy1, title1, device, newgraph, 
00300          nxpage, nypage) ;    
00301     
00302     delete [] cf ; 
00303     
00304 } 

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