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 des_coef_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Graphics/des_coef.C,v 1.3 2008/08/19 06:42:00 j_novak Exp $" ;
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058 #include"headcpp.h"
00059
00060
00061 #include <math.h>
00062
00063
00064 #include <cpgplot.h>
00065
00066
00067
00068 void des_coef(const double* cf, int n, double pzero,
00069 const char* nomx, const char* nomy, const char* title, const char* device,
00070 int newgraph, int nxpage, int nypage) {
00071
00072 float xdes[2], ydes[2] ;
00073
00074 double pzerol = log10(pzero) ;
00075 ydes[0] = float(pzerol) ;
00076
00077
00078
00079
00080 double xmin = - 1 ;
00081 double xmax = n ;
00082 double ymin = pzerol ;
00083 double ymax = pzerol ;
00084
00085 for (int i=0; i<n; i++) {
00086 double yl = log10(fabs(cf[i])) ;
00087 if ( yl > ymax ) ymax = yl ;
00088 }
00089 double yamp = ymax - ymin ;
00090 ymax = ymax + 0.05 * yamp ;
00091 ymin = ymin - 0.05 * yamp ;
00092
00093 if (ymax <= pzerol) ymax = 2*pzerol ;
00094
00095
00096
00097
00098 if ( (newgraph == 1) || (newgraph == 3) ) {
00099
00100 if (device == 0x0) device = "?" ;
00101
00102 int ier = cpgbeg(0, device, nxpage, nypage) ;
00103 if (ier != 1) {
00104 cout << "des_coef: problem in opening PGPLOT display !" << endl ;
00105 }
00106
00107 }
00108
00109
00110 float size = float(1.3) ;
00111 cpgsch(size) ;
00112
00113
00114 int lepais = 1 ;
00115 cpgslw(lepais) ;
00116
00117
00118 cpgscf(2) ;
00119
00120
00121 float xmin1 = float(xmin) ;
00122 float xmax1 = float(xmax) ;
00123 float ymin1 = float(ymin) ;
00124 float ymax1 = float(ymax) ;
00125 cpgenv(xmin1, xmax1, ymin1, ymax1, 0, 0 ) ;
00126 cpglab(nomx, nomy, title) ;
00127
00128
00129 for (int i=0; i<n; i++) {
00130 int lstyle ;
00131 xdes[0] = float( i ) ;
00132 xdes[1] = xdes[0] ;
00133 if ( fabs(cf[i]) < pzero ) {
00134 ydes[1] = float(pzerol) ;
00135 lstyle = 1 ;
00136 }
00137 else {
00138 ydes[1] = float( log10(fabs(cf[i])) ) ;
00139 if (cf[i] < 0) lstyle = 2 ;
00140 else lstyle = 1 ;
00141 }
00142 cpgsls(lstyle) ;
00143
00144 cpgline(2, xdes, ydes) ;
00145 }
00146
00147 cpgsls(1) ;
00148
00149
00150
00151
00152 if ( (newgraph == 2) || (newgraph == 3) ) {
00153 cpgend() ;
00154 }
00155
00156 }
00157
00158