Skip to content
Snippets Groups Projects
Commit 62fbcbde authored by cmaffeo2's avatar cmaffeo2
Browse files

Removed gsl from RigidBody::Boltzmann

parent 0b88c2a4
No related branches found
No related tags found
No related merge requests found
......@@ -64,7 +64,7 @@ $(foreach SM,$(SMS), $(eval NV_FLAGS += -gencode arch=compute_$(SM),code=sm_$(SM
$(foreach SM,$(SMPTXS), $(eval NV_FLAGS += -gencode arch=compute_$(SM),code=compute_$(SM)) )
NVLD_FLAGS := $(NV_FLAGS) --device-link
LD_FLAGS = -L$(LIBRARY) -lgsl -lcurand -lcudart -lcudadevrt -Wl,-rpath,$(LIBRARY)
LD_FLAGS = -L$(LIBRARY) -lcurand -lcudart -lcudadevrt -Wl,-rpath,$(LIBRARY)
### Sources
CC_SRC := $(wildcard *.cpp)
......
/////////////////////////////////////////////////////////////////////////
// Author: Jeff Comer <jcomer2@illinois.edu>
#ifndef RANDOMGSL_H
#define RANDOMGSL_H
#include <gsl/gsl_rng.h>
#include <gsl/gsl_randist.h>
#include "useful.h"
class Random {
private:
gsl_rng* gslRando;
public:
// default constructor
Random() {
init(0);
}
// constructor with seed
Random(unsigned long seed) {
init(seed);
}
~Random() {
gsl_rng_free(gslRando);
}
// reinitialize with seed
void init(unsigned long seed) {
gslRando = gsl_rng_alloc(gsl_rng_mt19937);
gsl_rng_set(gslRando, seed);
}
// return a number uniformly distributed between 0 and 1
float uniform() {
return gsl_rng_uniform(gslRando);
}
long poisson(float lambda) {
return gsl_ran_poisson(gslRando, lambda);
}
// return a number from a standard gaussian distribution
float gaussian() {
return gsl_ran_ugaussian(gslRando);
}
// return a vector of gaussian random numbers
Vector3 gaussian_vector() {
return Vector3( gaussian(), gaussian(), gaussian() );
}
// return a random long
long integer() {
return gsl_rng_get(gslRando);
}
// randomly order an array of whatever
template <class Elem> void reorder(Elem *a, int n) {
for (int i = 0; i < (n-1); i++) {
int ie = i + (integer()%(n-i));
if (ie == i) continue;
// Swap.
const Elem e = a[ie];
a[ie] = a[i];
a[i] = e;
}
}
};
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment