Skip to content

Commit

Permalink
Further adaptation static [] -> malloc / free, courtesy cl.exe...
Browse files Browse the repository at this point in the history
  • Loading branch information
willend committed Feb 25, 2024
1 parent 5198fa1 commit 21d1787
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions mcstas-comps/contrib/StatisticalChopper_Monitor.comp
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ SAVE
/* copy raw detector as correlation base */
long correlation_m = detector.m/f; /* new time binning for autocorrelation */

double p0[correlation_m*detector.n*detector.p]; /* static arrays to store correlation monitor */
double p1[correlation_m*detector.n*detector.p];
double p2[correlation_m*detector.n*detector.p];
double *p0=malloc*(correlation_m*detector.n*detector.p*sizeof(double)); /* Arrays to store correlation monitor */
double *p1=malloc*(correlation_m*detector.n*detector.p*sizeof(double));
double *p2=malloc*(correlation_m*detector.n*detector.p*sizeof(double));

/* initialize arrays to zero */
for (i=0;i<correlation_m*detector.n*detector.p;i++) p0[i]=p1[i]=p2[i]=0;
Expand Down Expand Up @@ -184,7 +184,7 @@ SAVE
detector.xmin,detector.xmax,detector.ymin,detector.ymax,
correlation_m,detector.n,
p0,p1,p2,file);

free(p0);free(p1);free(p2);
}

%}
Expand Down

0 comments on commit 21d1787

Please sign in to comment.