示例#1
0
文件: u_pan.c 项目: coliveira/xfignew
void pan_up(int shift)
{
    zoomyoff += (posn_rnd[cur_gridunit][P_GRID3]/display_zoomscale*(shift?5.0:1.0));
    reset_sideruler();
    redisplay_sideruler();
    setup_grid();
}
示例#2
0
文件: u_pan.c 项目: coliveira/xfignew
void pan_left(int shift)
{
    zoomxoff += (posn_rnd[cur_gridunit][P_GRID3]/display_zoomscale*(shift?5.0:1.0));
    reset_topruler();
    redisplay_topruler();
    setup_grid();
}
示例#3
0
int main (int argc, char *argv[])
{
   double **phi, **oldphi;
   int    **mask;
   int    i, j, k;
   int    nptsx = 200, nptsy = 200;
   int    nsteps  = 500;

   phi = (double **)malloc(sizeof(double*)*nptsy);
   oldphi = (double **)malloc(sizeof(double*)*nptsy);
   mask = (int **)malloc(sizeof(int*)*nptsy);
   for (k=0;k<nptsy;k++){
        phi[k] = (double *)malloc(sizeof(double)*nptsx);
        oldphi[k] = (double *)malloc(sizeof(double)*nptsx);
        mask[k] = (int *)malloc(sizeof(int)*nptsx);
   }

   setup_grid (phi, nptsx, nptsy, mask);
 
/* Iterate to find solution */
   for(k=1;k<=nsteps;k++){
         for(j=0;j<nptsy;j++)
            for(i=0;i<nptsx;i++)
               oldphi[j][i] = phi[j][i];
         for(j=0;j<nptsy;j++)
            for(i=0;i<nptsx;i++)
               if (mask[j][i]) phi[j][i] = 0.25*(oldphi[j][i-1] +
                  oldphi[j][i+1] + oldphi[j-1][i] + oldphi[j+1][i]);
   }
   output_array (phi, nptsx, nptsy);
 
   return 0;
}
示例#4
0
文件: u_pan.c 项目: coliveira/xfignew
void pan_down(int shift)
{
    zoomyoff -= (posn_rnd[cur_gridunit][P_GRID3]/display_zoomscale*(shift?5.0:1.0));
    if (!appres.allownegcoords && (zoomyoff < 0))
	zoomyoff = 0;
    reset_sideruler();
    redisplay_sideruler();
    setup_grid();
}
示例#5
0
int main (int argc, char *argv[])
{
   float *h_phi;
   float *h_oldphi;
   int *h_mask;
   int nsize1=sizeof(float)*NPTSX*NPTSY;
   int nsize2=sizeof(int)*NPTSX*NPTSY;

   h_phi = (float *)malloc(nsize1);
   h_oldphi = (float *)malloc(nsize1);
   h_mask = (int *)malloc(nsize2);
   setup_grid (h_oldphi, NPTSX, NPTSY, h_mask);
   performUpdates(h_phi,h_oldphi,h_mask,NPTSX,NPTSY,NSTEPS);
 
   output_array (h_phi, NPTSX, NPTSY);
 
   return 0;
}
示例#6
0
文件: u_pan.c 项目: coliveira/xfignew
void
pan_origin(void)
{
    /* turn off Compose key LED */
    setCompLED(0);

    if (zoomxoff == 0 && zoomyoff == 0)
	return;
    if (zoomyoff != 0) {
	zoomyoff = 0;
	setup_sideruler();
	redisplay_sideruler();
    }
    if (zoomxoff != 0) {
	zoomxoff = 0;
	reset_topruler();
	redisplay_topruler();
    }
    setup_grid();
}