summaryrefslogtreecommitdiff
path: root/src/graph_genfunc.c
blob: 8dcd0df0929c249fd02c247c97529cafb68edb6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

#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 *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);
	}

	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);

	return lattice;
}