diff options
Diffstat (limited to 'src/graph_genfunc.c')
-rw-r--r-- | src/graph_genfunc.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/src/graph_genfunc.c b/src/graph_genfunc.c index 8dcd0df..d396206 100644 --- a/src/graph_genfunc.c +++ b/src/graph_genfunc.c @@ -1,26 +1,18 @@ #include "fracture.h" -double *genfunc_uniform(unsigned int L, bound_t boundary, gsl_rng *r, unsigned int *num) { - *num = 2 * pow(L / 2, 2); +double *genfunc_uniform(uint_t num, gsl_rng *r) { + double *lattice = (double *)malloc(2 * num * sizeof(double)); - double *lattice = (double *)malloc(2 * (*num) * sizeof(double)); - for (unsigned int i = 0; i < (*num); i++) { - lattice[2*i] = gsl_ran_flat(r, 0, 1); - lattice[2*i+1] = gsl_ran_flat(r, 0, 1); + for (uint_t i = 0; i < 2 * num; i++) { + lattice[i] = gsl_rng_uniform(r); } return lattice; } -double g(double rho, double dist) { - return 1 - gsl_sf_exp(-M_PI * rho * dist); -} - -double *genfunc_hyperuniform(unsigned int L, bound_t boundary, gsl_rng *r, unsigned int *num) { - *num = 2 * pow(L / 2, 2); - - double *lattice = spheres(*num, 0.8, 0.5, 0.9, 100, 100000); +double *genfunc_hyperuniform(uint_t num, gsl_rng *r) { + double *lattice = spheres(num, 0.8, 0.5, 0.9, 100, 100000); return lattice; } |