11
11
#include "PloEch.h"
12
#include "Entities.h" /* F.Leray 21.04.04 : for update_2dbounds call*/
13
/*extern void compute_data_bounds(int cflag,char dataflag,double *x,double *y,int n1,int n2,double *drect);*/
14
extern void compute_data_bounds2(int cflag,char dataflag,char *logflags,double *x,double *y,int n1,int n2,double *drect);
15
extern void update_specification_bounds(sciPointObj *psubwin, double *rect,int flag);
16
extern int re_index_brect(double * brect, double * drect);
17
extern void strflag2axes_properties(sciPointObj * psubwin, char * strflag);
13
19
typedef void (level_f) __PARAMS((integer ival, double Cont, double xncont,
79
82
/*---------return the coordinates between [xi,xj] along one axis
80
83
* for which the value of f is zCont */
82
static double f_intercept(zCont, fi, xi, fj, xj)
83
double zCont,fi,xi,fj,xj;
85
static double f_intercept(double zCont, double fi, double xi, double fj, double xj)
85
87
return( xi+ (zCont-fi)*(xj-xi)/ (fj-fi));
88
90
/* check for boundary points */
90
static integer bdyp(i, j)
92
static integer bdyp(integer i, integer j)
93
94
return ( j == 0 || i == 0 || j == Gn2-1 || i == Gn1-1 );
98
99
static integer *itg_cont, *xbd_cont,*ybd_cont;
100
static integer get_itg_cont(i, j)
101
static integer get_itg_cont(integer i, integer j)
103
103
return( itg_cont[i+Gn1*j]);
106
static void inc_itg_cont(i, j, val)
106
static void inc_itg_cont(integer i, integer j, integer val)
109
108
itg_cont[i+Gn1*j] += val;
112
static integer not_same_sign(val1, val2)
111
static integer not_same_sign(double val1, double val2)
116
113
if ( ISNAN(val1) ==1 || ISNAN(val2) == 1) return(0);
117
114
/** 0.0 est consid\'er\'e comme positif **/
151
148
static double ZC=0.0;
152
149
static char ContNumFormat[100];
154
int C2F(contour)(x,y,z,n1,n2,flagnz,nz,zz,teta,alpha,legend,flag,bbox,zlev,lstr)
158
double x[],y[],z[],zz[],bbox[6],*zlev;
159
integer *n1,*n2,*nz,*flagnz;
151
int C2F(contour)(double *x, double *y, double *z, integer *n1, integer *n2, integer *flagnz, integer *nz, double *zz, double *teta, double *alpha, char *legend, integer *flag, double *bbox, double *zlev, integer lstr)
163
154
integer verbose=0,narg,fg;
253
244
/** interface for contour2d **/
255
int C2F(contour2)(x,y,z,n1,n2,flagnz,nz,zz,style,strflag,legend,brect,aaint,lstr1,lstr2)
256
double x[],y[],z[],zz[];
257
integer *n1,*n2,*nz,*flagnz;
260
char legend[],strflag[];
261
integer lstr1,lstr2,style[];
246
int C2F(contour2)(double *x, double *y, double *z, integer *n1, integer *n2, integer *flagnz, integer *nz, double *zz, integer *style, char *strflag, char *legend, double *brect, integer *aaint, integer lstr1, integer lstr2)
263
248
Contour2D(ContStore2,"contour2",x,y,z,n1,n2,flagnz,nz,zz,style,strflag,
264
249
legend,brect,aaint,lstr1,lstr2);
268
253
/* interface for contour2di used in macro contourf
269
254
* used when we want to get the values which constitues the contour inside Scilab
270
255
* contour2di + c2dex
256
* THIS PROCEDURE IS NO LONGUER USED
273
static int Contour2D(func,name,x,y,z,n1,n2,flagnz,nz,zz,style,strflag,legend,brect,aaint,lstr1,lstr2)
276
double x[],y[],z[],zz[];
277
integer *n1,*n2,*nz,*flagnz;
280
char legend[],strflag[];
281
integer lstr1,lstr2,style[];
259
static int Contour2D(ptr_level_f func, char *name, double *x, double *y, double *z, integer *n1, integer *n2, integer *flagnz, integer *nz, double *zz, integer *style, char *strflag, char *legend, double *brect, integer *aaint, integer lstr1, integer lstr2)
284
262
static double *zconst;
285
263
double zmin,zmax;
266
sciPointObj * psubwin = NULL; /* Adding F.Leray 22.04.04 */
288
268
/** Boundaries of the frame **/
289
update_frame_bounds(1,"gnn",x,y,n1,n2,aaint,strflag,brect);
269
if(version_flag() != 0)
270
update_frame_bounds(1,"gnn",x,y,n1,n2,aaint,strflag,brect);
271
else /* F.Leray 21.04.04 */
273
psubwin = sciGetSelectedSubWin (sciGetCurrentFigure ());
275
/* Force psubwin->is3d to FALSE: we are in 2D mode */
276
if (sciGetSurface(psubwin) == (sciPointObj *) NULL)
278
pSUBWIN_FEATURE (psubwin)->is3d = FALSE;
279
pSUBWIN_FEATURE (psubwin)->project[2]= 0;
281
pSUBWIN_FEATURE (psubwin)->theta_kp=pSUBWIN_FEATURE (psubwin)->theta;
282
pSUBWIN_FEATURE (psubwin)->alpha_kp=pSUBWIN_FEATURE (psubwin)->alpha;
283
pSUBWIN_FEATURE (psubwin)->alpha = 0.0;
284
pSUBWIN_FEATURE (psubwin)->theta = 270.0;
286
for (i=0;i<4;i++) pSUBWIN_FEATURE(psubwin)->axes.aaint[i] = aaint[i];
287
if (sciGetGraphicMode (psubwin)->autoscaling) {
288
/* compute and merge new specified bounds with psubwin->Srect */
289
switch (strflag[1]) {
291
/* do not change psubwin->Srect */
293
case '1' : case '3' : case '5' : case '7':
294
/* Force psubwin->Srect=brect */
295
re_index_brect(brect,drect);
297
case '2' : case '4' : case '6' : case '8':
298
/* Force psubwin->Srect to the x and y bounds */
299
/* compute_data_bounds(1,'g',x,y,*n1,*n2,drect); */
300
compute_data_bounds2(1,'g',pSUBWIN_FEATURE(psubwin)->logflags,x,y,*n1,*n2,drect);
303
if (!pSUBWIN_FEATURE(psubwin)->FirstPlot &&(strflag[1] == '7' || strflag[1] == '8')) { /* merge psubwin->Srect and drect */
304
drect[0] = Min(pSUBWIN_FEATURE(psubwin)->SRect[0],drect[0]); /*xmin*/
305
drect[2] = Min(pSUBWIN_FEATURE(psubwin)->SRect[2],drect[2]); /*ymin*/
306
drect[1] = Max(pSUBWIN_FEATURE(psubwin)->SRect[1],drect[1]); /*xmax*/
307
drect[3] = Max(pSUBWIN_FEATURE(psubwin)->SRect[3],drect[3]); /*ymax*/
309
if (strflag[1] != '0') update_specification_bounds(psubwin, drect,2);
311
strflag2axes_properties(psubwin, strflag);
312
pSUBWIN_FEATURE (psubwin)->FirstPlot = FALSE;
291
315
/** If Record is on **/
292
316
if (GetDriver()=='R' && strcmp(name,"contour2")==0 )
293
317
StoreContour2D("contour2",x,y,z,n1,n2,flagnz,nz,zz,style,strflag,legend,brect,aaint);
451
466
* c: indice of the contour Cont
452
467
*---------------------------------------------------------------------*/
454
static void look(func, i, j, ib, jb, qq, Cont,style)
469
static void look(ptr_level_f func, integer i, integer j, integer ib, integer jb, integer qq, double Cont, integer style)
464
471
integer ip,jp,im,jm,zds,ent=0,flag=0,wflag;
465
472
jp= j+1; ip= i+1; jm=j-1;im=i-1;
596
603
* suivant a explorer
597
604
*-----------------------------------------------------------------------*/
599
static integer ffnd (func, i1, i2, i3, i4, jj1, jj2, jj3, jj4, ent, qq, Cont, zds)
601
integer i1,i2,i3,i4, jj1, jj2, jj3, jj4, ent, qq;
606
static integer ffnd (ptr_level_f func, integer i1, integer i2, integer i3, integer i4, integer jj1, integer jj2, integer jj3, integer jj4, integer ent, integer qq, double Cont, integer *zds)
605
608
double phi1,phi2,phi3,phi4,xav,yav,phiav;
606
609
integer revflag,i;