fix: rng performance
This commit is contained in:
+6
-4
@@ -3,6 +3,7 @@
|
||||
#include <gsl/gsl_rng.h>
|
||||
#include <gsl/gsl_spline.h>
|
||||
#include <gsl/gsl_monte_miser.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include "render.h"
|
||||
|
||||
@@ -101,11 +102,10 @@ int pixel_render(const System *system, int i, int j, const Spline_data spline_da
|
||||
|
||||
int render(System *system, double *buffer, int pixel_render_max, double pixel_render_err, double chi_rela_err) {
|
||||
double h = (system->H)*(system->w)/(system->W);
|
||||
double tanpsi2 = (system->w)*(system->w)+h*h;
|
||||
double cotpsi2 = 1/tanpsi2;
|
||||
//double tanpsi2 = (system->w)*(system->w)+h*h;
|
||||
//double cotpsi2 = 1/tanpsi2;
|
||||
//double bmax = R0/sqrt(f(R0)*(1+cotpsi2));
|
||||
double rmax = sqrt(tanpsi2);
|
||||
gsl_rng *r = gsl_rng_alloc(gsl_rng_default);
|
||||
double rmax = hypot(system->w, h);
|
||||
|
||||
double *x=NULL;
|
||||
double *y = NULL;
|
||||
@@ -122,6 +122,7 @@ int render(System *system, double *buffer, int pixel_render_max, double pixel_re
|
||||
{
|
||||
gsl_interp_accel *acc = gsl_interp_accel_alloc();
|
||||
Spline_data spline_data = {spline, acc};
|
||||
gsl_rng *r = gsl_rng_alloc(gsl_rng_default);
|
||||
|
||||
#pragma omp for
|
||||
for(int j = 0; j < H; j++) {
|
||||
@@ -131,6 +132,7 @@ int render(System *system, double *buffer, int pixel_render_max, double pixel_re
|
||||
}
|
||||
|
||||
gsl_interp_accel_free(acc);
|
||||
gsl_rng_free(r);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user