projects
/
physik
/
nlsop.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
some more work getting random reject method to work
[physik/nlsop.git]
/
nlsop.c
diff --git
a/nlsop.c
b/nlsop.c
index
58f19f7
..
10a3f2f
100644
(file)
--- a/
nlsop.c
+++ b/
nlsop.c
@@
-694,13
+694,15
@@
int get_c_ratio(double *c_ratio,char *pfile,info *my_info,d3_lattice *d3_l)
return 1;
}
return 1;
}
-
int
get_reject_graph(info *my_info,d3_lattice *d3_l,char *file,u32 *graph) {
+
u32
get_reject_graph(info *my_info,d3_lattice *d3_l,char *file,u32 *graph) {
double a,b;
int i,j,k;
int fd;
char buf[32],*p;
unsigned char *flag;
double a,b;
int i,j,k;
int fd;
char buf[32],*p;
unsigned char *flag;
+ u32 max;
+ max=0;
if((fd=open(file,O_RDONLY))<0)
{
puts("cannot open file to calculate rejection graph");
if((fd=open(file,O_RDONLY))<0)
{
puts("cannot open file to calculate rejection graph");
@@
-738,18
+740,21
@@
int get_reject_graph(info *my_info,d3_lattice *d3_l,char *file,u32 *graph) {
}
/* do (linear) interpolation here! */
i=0;
}
/* do (linear) interpolation here! */
i=0;
+ a=0;
while(i<d3_l->max_z)
{
while(i<d3_l->max_z)
{
- a=0;
-
- // WEITER HIER !!
-
+ /* graph[0] is 0! */
+ j=i;
+ i++;
+ while(flag[i]==0&&i<d3_l->max_z) i++;
+ printf("debug: i = %d j = %d\n",i,j);
+ for(k=j+1;k<i;k++) graph[k]=(int)((k-j)*((int)graph[i]-(int)graph[j])/(i-j))+graph[j];
+ if(graph[i]>max) max=graph[i];
}
}
- printf("%s graph:\n",file);
- for(i=0;i<d3_l->max_z;i++) printf("%02d | %d\n",i,graph[i]);
+ free(flag);
- return
1
;
+ return
max
;
}
int main(int argc,char **argv)
}
int main(int argc,char **argv)
@@
-829,6
+834,7
@@
int main(int argc,char **argv)
convert=0;
strcpy(r_file,"");
mode=0;
convert=0;
strcpy(r_file,"");
mode=0;
+ u32 ne_max;
for(i=1;i<argc;i++)
{
for(i=1;i<argc;i++)
{
@@
-1045,11
+1051,7
@@
int main(int argc,char **argv)
puts("failed allocating memory for nuclear energy loss graph");
return -1;
}
puts("failed allocating memory for nuclear energy loss graph");
return -1;
}
- if(get_reject_graph(&my_info,&d3_l,p_file,c_profile)!=1)
- {
- puts("failed to get reject graph");
- return -1;
- }
+ ne_max=get_reject_graph(&my_info,&d3_l,p_file,c_profile);
/* break here for testing ... */
return 23;
/* break here for testing ... */
return 23;