20 #include "headcpp.hpp"
23 #include "tensor_impl.hpp"
28 int cpgbeg(
int unit,
const char *file,
int nxsub,
int nysub);
29 void cpgsch(
float size);
31 void cpgscf(
int font);
32 void cpgenv(
float xmin,
float xmax,
float ymin,
float ymax,
int just,
int axis);
33 void cpglab(
const char *xlbl,
const char *ylbl,
const char *toplbl);
34 void cpgcont(
const float *a,
int idim,
int jdim,
int i1,
int i2,
int j1,
int j2,
const float *c,
int nc,
const float *tr);
39 void des_equipot(
float* uutab,
int nx,
int ny,
float xmin,
float xmax,
40 float ymin,
float ymax,
int ncour,
const char* nomx,
const char* nomy,
41 const char* title,
const char* device = 0x0,
int newgraph = 3,
42 int nxpage = 1,
int nypage = 1) ;
44 void des_equipot(
float* uutab,
int nx,
int ny,
float xmin,
float xmax,
45 float ymin,
float ymax,
int ncour,
const char* nomx,
const char* nomy,
46 const char* title,
const char* device,
int newgraph,
int nxpage,
52 float uumin = uutab[0] ;
53 float uumax = uutab[0] ;
54 for (
int i=1; i<nx*ny; i++) {
55 uumin = (uutab[i] < uumin) ? uutab[i] : uumin ;
56 uumax = (uutab[i] > uumax) ? uutab[i] : uumax ;
59 cout <<
" " << title <<
" : min, max : " << uumin <<
" " << uumax
65 float* isopot =
new float [ncour] ;
66 float hh = float(uumax-uumin) / float(ncour) ;
67 for (
int i=0; i<ncour; i++) {
68 isopot[i] = uumin + hh * float(i) ;
73 float hx = (xmax - xmin)/
float(nx-1) ;
74 float hy = (ymax - ymin)/
float(ny-1) ;
87 if ( (newgraph == 1) || (newgraph == 3) ) {
89 if (device == 0x0) device =
"?" ;
91 int ier = cpgbeg(0, device, nxpage, nypage) ;
93 cout <<
"des_equipot: problem in opening PGPLOT display !" << endl ;
99 float size = float(1.3) ;
110 cpgenv(xmin, xmax, ymin, ymax, 1, 0 ) ;
111 cpglab(nomx,nomy,title) ;
115 float dynamique = float(fabs(uumax - uumin)) ;
117 if (dynamique > 1.e-14) {
119 cpgcont(uutab, nx, ny, 1, nx, 1, ny, isopot, ncour, tr) ;
126 if ( (newgraph == 2) || (newgraph == 3) ) {
136 void des_coupe (
const Scalar& uu,
const Point& x0,
137 int num_un,
double var_un_min,
double var_un_max,
138 int num_deux,
double var_deux_min,
double var_deux_max,
139 const char* title,
const char* axis_one,
const char* axis_two,
int ncour,
int n_un,
int n_deux) {
141 assert ((num_un>0) && (num_un<=uu.get_ndim())) ;
142 assert ((num_deux>0) && (num_deux<=uu.get_ndim())) ;
143 assert (num_un != num_deux) ;
147 float* uutab =
new float[n_un*n_deux] ;
149 double h_un = (var_un_max - var_un_min) /
double(n_un-1) ;
150 double h_deux = (var_deux_max - var_deux_min) /
double(n_deux-1) ;
154 for (
int j=0; j<n_deux; j++) {
156 double var_deux = var_deux_min + h_deux * j ;
158 for (
int i=0; i<n_un; i++) {
160 double var_un = var_un_min + h_un * i ;
162 points.set(num_un) = var_un ;
163 points.set(num_deux) = var_deux ;
165 uutab[n_deux*j+i] = float(uu.val_point(points)) ;
169 const char* nomy = (axis_two==0x0) ?
"" : axis_two ;
170 const char* nomx = (axis_one==0x0) ?
"" : axis_one ;
172 const char* titi = (title==0x0) ?
"" : title ;
177 des_equipot(uutab, n_un, n_deux,
float(var_un_min),
float(var_un_max),
float(var_deux_min),
float(var_deux_max),
179 titi, device, newgraph) ;
186 void des_coupe_zeronotdef (
const Scalar& uu,
const Point& x0,
187 int num_un,
double var_un_min,
double var_un_max,
188 int num_deux,
double var_deux_min,
double var_deux_max,
189 const char* title,
const char* axis_one,
const char* axis_two,
int ncour,
int n_un,
int n_deux) {
191 assert ((num_un>0) && (num_un<=uu.get_ndim())) ;
192 assert ((num_deux>0) && (num_deux<=uu.get_ndim())) ;
193 assert (num_un != num_deux) ;
197 float* uutab =
new float[n_un*n_deux] ;
199 double h_un = (var_un_max - var_un_min) /
double(n_un-1) ;
200 double h_deux = (var_deux_max - var_deux_min) /
double(n_deux-1) ;
204 for (
int j=0; j<n_deux; j++) {
206 double var_deux = var_deux_min + h_deux * j ;
208 for (
int i=0; i<n_un; i++) {
210 double var_un = var_un_min + h_un * i ;
212 points.set(num_un) = var_un ;
213 points.set(num_deux) = var_deux ;
215 uutab[n_deux*j+i] = float(uu.val_point_zeronotdef(points)) ;
219 const char* nomy = (axis_two==0x0) ?
"" : axis_two ;
220 const char* nomx = (axis_one==0x0) ?
"" : axis_one ;
222 const char* titi = (title==0x0) ?
"" : title ;
227 des_equipot(uutab, n_un, n_deux,
float(var_un_min),
float(var_un_max),
float(var_deux_min),
float(var_deux_max),
229 titi, device, newgraph) ;
233 void des_sphere (
const Scalar& uu,
const Point& x0,
double rad,
const char* title,
int ncour,
int n_theta,
int n_phi) {
236 if (uu.get_space().get_ndim()!=3) {
237 cerr <<
"des_sphere only defined for 3-dimensional spaces" << endl ;
243 float* uutab =
new float[n_theta*n_phi] ;
245 double h_phi = 2*M_PI / double(n_phi-1) ;
246 double h_theta = M_PI / double(n_theta-1) ;
252 for (
int j=0 ; j<n_theta ; j++) {
254 for (
int i=0 ; i<n_phi ; i++) {
257 MM.set(1) = rad*sin(theta)*cos(phi) + x0(1) ;
258 MM.set(2) = rad*sin(theta)*sin(phi) + x0(2) ;
259 MM.set(3) = rad*cos(theta) + x0(3) ;
260 uutab[j*n_theta+i] = float(uu.val_point(MM)) ;
266 const char* nomy =
"theta" ;
267 const char* nomx =
"phi" ;
269 const char* titi = (title==0x0) ?
"" : title ;
274 des_equipot(uutab, n_phi, n_theta, 0,
float(2*M_PI), 0,
float(M_PI), ncour, nomx, nomy, titi, device, newgraph) ;