Changeset 3079 for branches

Show
Ignore:
Timestamp:
05/18/11 19:47:02 (12 months ago)
Author:
pkwi
Message:

Implementation of unsigned long long int for ncount instead of double. Suspected cause of problems with "hanging" simulations above apx. 1e11.

mcrun --test produces an OK on my machine, but please consider if this could cause breaks elsewhere?

Location:
branches/mcstas-1.x/lib/share
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • branches/mcstas-1.x/lib/share/mcstas-r.c

    r3076 r3079  
    742742/* Number of neutron histories to simulate. */ 
    743743#ifndef DANSE 
    744 mcstatic double mcncount             = 1e6; 
    745 mcstatic double mcrun_num            = 0; 
     744mcstatic unsigned long long int mcncount             = 1e6; 
     745mcstatic unsigned long long int mcrun_num            = 0; 
    746746#endif 
    747747 
     
    923923 
    924924/* mcset_ncount: set total number of neutrons to generate */ 
    925 void mcset_ncount(double count) 
     925void mcset_ncount(unsigned long long int count) 
    926926{ 
    927927  mcncount = count; 
     
    929929 
    930930/* mcget_ncount: get total number of neutrons to generate */ 
    931 double mcget_ncount(void) 
     931unsigned long long int mcget_ncount(void) 
    932932{ 
    933933  return mcncount; 
     
    935935 
    936936/* mcget_run_num: get curent number of neutrons in TRACE */ 
    937 double mcget_run_num(void) 
     937unsigned long long int mcget_run_num(void) 
    938938{ 
    939939  return mcrun_num; 
     
    48724872mcsetn_arg(char *arg) 
    48734873{ 
    4874   mcset_ncount(strtod(arg, NULL)); 
     4874  mcset_ncount((long long int) strtod(arg, NULL)); 
    48754875} 
    48764876 
     
    52815281  else 
    52825282  { 
    5283     printf("%.2f %% (%10.1f/%10.1f)\n", 100*mcget_run_num()/mcget_ncount(), mcget_run_num(), mcget_ncount()); 
     5283    printf("%.2f %% (%10.1f/%10.1f)\n", 100.0*mcget_run_num()/mcget_ncount(), 1.0*mcget_run_num(), 1.0*mcget_ncount()); 
    52845284  } 
    52855285  t0 = (time_t)mcstartdate; 
  • branches/mcstas-1.x/lib/share/mcstas-r.h

    r2699 r3079  
    517517 */ 
    518518 
    519 void   mcset_ncount(double count); 
    520 double mcget_ncount(void); 
    521 double mcget_run_num(void); 
     519void   mcset_ncount(unsigned long long int count); 
     520unsigned long long int mcget_ncount(void); 
     521unsigned long long int mcget_run_num(void); 
    522522double mcdetector_out(char *cname, double p0, double p1, double p2, char *filename); 
    523523double mcdetector_out_0D(char *t, double p0, double p1, double p2, char *c, Coords pos);