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_equipot_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Graphics/des_equipot.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 #include"headcpp.h"
00058
00059
00060 #include <math.h>
00061
00062
00063 #include <cpgplot.h>
00064
00065
00066
00067 void des_equipot(float* uutab, int nx, int ny, float xmin, float xmax,
00068 float ymin, float ymax, int ncour, const char* nomx, const char* nomy,
00069 const char* title, const char* device, int newgraph, int nxpage,
00070 int nypage) {
00071
00072
00073
00074
00075 float uumin = uutab[0] ;
00076 float uumax = uutab[0] ;
00077 for (int i=1; i<nx*ny; i++) {
00078 uumin = (uutab[i] < uumin) ? uutab[i] : uumin ;
00079 uumax = (uutab[i] > uumax) ? uutab[i] : uumax ;
00080 }
00081
00082 cout << " " << title << " : min, max : " << uumin << " " << uumax
00083 << endl ;
00084
00085
00086
00087
00088 float* isopot = new float [ncour] ;
00089 float hh = (uumax-uumin) / float(ncour) ;
00090 for (int i=0; i<ncour; i++) {
00091 isopot[i] = uumin + hh * float(i) ;
00092 }
00093
00094
00095
00096 float hx = (xmax - xmin)/float(nx-1) ;
00097 float hy = (ymax - ymin)/float(ny-1) ;
00098
00099 float tr[6] ;
00100 tr[0] = xmin - hx ;
00101 tr[1] = hx ;
00102 tr[2] = 0 ;
00103 tr[3] = ymin - hy ;
00104 tr[4] = 0 ;
00105 tr[5] = hy ;
00106
00107
00108
00109
00110 if ( (newgraph == 1) || (newgraph == 3) ) {
00111
00112 if (device == 0x0) device = "?" ;
00113
00114 int ier = cpgbeg(0, device, nxpage, nypage) ;
00115 if (ier != 1) {
00116 cout << "des_equipot: problem in opening PGPLOT display !" << endl ;
00117 }
00118
00119 }
00120
00121
00122 float size = float(1.3) ;
00123 cpgsch(size) ;
00124
00125
00126 int lepais = 1 ;
00127 cpgslw(lepais) ;
00128
00129
00130 cpgscf(2) ;
00131
00132
00133 cpgenv(xmin, xmax, ymin, ymax, 1, 0 ) ;
00134 cpglab(nomx,nomy,title) ;
00135
00136
00137
00138 float dynamique = float(fabs(uumax - uumin)) ;
00139
00140 if (dynamique > 1.e-14) {
00141
00142 cpgcont(uutab, nx, ny, 1, nx, 1, ny, isopot, ncour, tr) ;
00143
00144 }
00145
00146
00147
00148
00149 if ( (newgraph == 2) || (newgraph == 3) ) {
00150 cpgend() ;
00151 }
00152
00153
00154 delete [] isopot ;
00155
00156 }