typedef struct __info
{
- int cc,steps,range,diff_rate,cpi,s_rate;
- double s,b,c,dr_ac,dr_cc;
- char z_diff,c_diff;
+ int cc,steps,range,diff_rate,cpi,s_rate,save_rate;
+ double s,b,c,dr_ac;
} info;
#define AMORPH 1
#define CC 0
#define DR_AC .5
-#define DR_CC .2
#define DIFF_RATE 1000
#define S_D .00001
#define MAKE_AMORPH(N) *(N)|=AMORPH
#define MAKE_CRYST(N) *(N)&=~AMORPH
-#define NLSOP_CLIENT 'c'
-#define NLSOP_NJOB 'N'
-#define NLSOP_CJOB 'C'
-
/* globals */
char p_file[MAX_CHARS];
}
}
}
- if(my_info->z_diff)
+ /* diff in z direction */
+ if(k!=0)
{
- if(k!=0)
+ off=i+j*d3_l->max_x+(k-1)*d3_l->max_x*d3_l->max_y;
+ carry=0;
+ if(!*(d3_l->status+off)&AMORPH) carry=(int)(my_info->dr_ac*(*(d3_l->extra+off)));
+ if(carry!=0)
{
- off=i+j*d3_l->max_x+(k-1)*d3_l->max_x*d3_l->max_y;
- carry=0;
- if(!*(d3_l->status+off)&AMORPH) carry=(int)(my_info->dr_ac*(*(d3_l->extra+off)));
- if(carry!=0)
- {
- *(d3_l->extra+off)-=carry;
- *(d3_l->extra+offset)+=carry;
- }
+ *(d3_l->extra+off)-=carry;
+ *(d3_l->extra+offset)+=carry;
}
- if(k!=d3_l->max_z-1)
+ }
+ if(k!=d3_l->max_z-1)
+ {
+ off=i+j*d3_l->max_x+(k+1)*d3_l->max_x*d3_l->max_y;
+ carry=0;
+ if(!*(d3_l->status+off)&AMORPH) carry=(int)(my_info->dr_ac*(*(d3_l->extra+off)));
+ if(carry!=0)
{
- off=i+j*d3_l->max_x+(k+1)*d3_l->max_x*d3_l->max_y;
- carry=0;
- if(!*(d3_l->status+off)&AMORPH) carry=(int)(my_info->dr_ac*(*(d3_l->extra+off)));
- if(carry!=0)
- {
- *(d3_l->extra+off)-=carry;
- *(d3_l->extra+offset)+=carry;
- }
+ *(d3_l->extra+off)-=carry;
+ *(d3_l->extra+offset)+=carry;
}
- }
+ }
}
} /* for z */
} /* for y */
u32 *nel_z;
u32 x_c,y_c,z_c;
int i,j;
- int resave;
int c_step;
unsigned char data[256];
t_net *net;
- resave=RESAVE;
c_step=0;
ne_max=0;
ip_max=0;
process_cell(&d3_l,x_c,y_c,z_c,&my_info,nel_z[z_c]);
}
distrib_c(&d3_l,&my_info,i,ip_max,c_profile);
- if(i%resave==0 && i!=0) {
+ i++;
+ if(i%my_info.save_rate==0) {
dc=DC_OK;
send_data(0);
dc=DC_QUIT;
}
- i++;
if(i%my_info.s_rate==0) sputter(&d3_l);
}
int send_job(t_net *net,t_input *input,t_display *display) {
+ char command[MAX_CONTENT];
+ int x,y,z;
+ info info;
+
+ /* default values */
+ x=X;
+ y=Y;
+ z=Z;
+ info.cc=CC;
+ info.steps=STEPS;
+ info.range=RANGE;
+ info.diff_rate=DIFF_RATE;
+ info.cpi=CPI;
+ info.s_rate=S_RATE;
+ info.save_rate=RESAVE;
+ info.s=S_D;
+ info.b=B_D;
+ info.c=C_D;
+ info.dr_ac=DR_AC;
+
+ strncpy(command,input->content,MAX_CONTENT);
+
+ strtok(command," ");
+ while(strtok(NULL," ")!=NULL) {
+ switch(command[0]) {
+ case 'b':
+ info.b=atof(command+1);
+ break;
+ case 'c':
+ info.c=atof(command+1);
+ break;
+ case 's':
+ info.s=atof(command+1);
+ break;
+ case 'd':
+ info.diff_rate=atoi(command+1);
+ break;
+ case 'D':
+ info.dr_ac=atof(command+1);
+ break;
+ case 'S':
+ info.steps=atoi(command+1);
+ break;
+ case 'C':
+ info.cpi=atoi(command+1);
+ break;
+ case 'r':
+ info.range=atoi(command+1);
+ break;
+ case 'R':
+ info.s_rate=atoi(command+1);
+ break;
+ case 'x':
+ info.save_rate=atoi(command+1);
+ break;
+ case 'X':
+ x=atoi(command+1);
+ break;
+ case 'Y':
+ y=atoi(command+1);
+ break;
+ case 'Z':
+ z=atoi(command+1);
+ break;
+ default:
+ display_new_line(display,"unknown command");
+ break;
+ }
+ }
+
+ command[0]=GUI_ADDJOB;
+ network_send_chan(net,0,data,1);
+
+ network_send_chan(net,0,(unsigned char *)&x,sizeof(int));
+ network_send_chan(net,0,(unsigned char *)&y,sizeof(int));
+ network_send_chan(net,0,(unsigned char *)&z,sizeof(int));
+
+ network_send_chan(net,0,(unsigned char *)&info,sizeof(info));
+
return 1;
}
if(ret==N_ERROR) printf("FATAL: getting step number failed\n");
if(dc!=DC_QUIT) {
- snprintf(filename,128,"nlsop_b%f_c%f_s%f_ds%d_dr%f_Z%c__%d_of_%d.save",
+ snprintf(filename,128,"./data/nlsop_b%f_c%f_s%f_ds%d_dr%f_-_%d_of_%d.save",
job->info.b,job->info.c,job->info.s,
job->info.diff_rate,job->info.dr_ac,
- job->info.z_diff?'y':'n',
job->step,job->info.steps);
if((fd=open(filename,O_WRONLY|O_CREAT))<0) {
printf("FATAL: unable to open file %s\n",filename);