Functions | |
double | convertToDouble (const std::string &s) |
Parses and converts std::string objects to double values. | |
int | convertToInt (const std::string &s) |
Parses and converts std::string objects to int values. | |
string | toString (double x) |
Converts double values to their string representations. | |
string | toString (int x) |
Converts integer values to their string representations. | |
void | SEED_RANDOM (unsigned long seed) |
Seeds the random number generator used in all simulations. | |
double | RANDOM (double max) |
Uniform random number on the interval (0,max]. | |
double | RANDOM_CLOSED () |
Uniform random number on the interval (0,1). | |
int | RANDOM_INT (unsigned long min, unsigned long max) |
Uniform random number on the interval [min,max]. | |
double | RANDOM_GAUSSIAN () |
Normally distributed random number with mean 0 and variance 1. | |
void | trim (string &str) |
Removes leading and trailing whitespace (including tabs) from the string. | |
Variables | |
const double | PI = 3.14159265358979323846 |
const double | NA = 6.02214179e23 |
double NFutil::convertToDouble | ( | const std::string & | s | ) |
Parses and converts std::string objects to double values.
Just uses the standard library operations for converting strings to double values. Throws a run time exception if the parse failed.
int NFutil::convertToInt | ( | const std::string & | s | ) |
Parses and converts std::string objects to int values.
Just uses the standard library operations for converting strings to integers. Throws a run time exception if the parse failed.
double NFutil::RANDOM | ( | double | max | ) |
Uniform random number on the interval (0,max].
This function returns a random double on the half open interval (0,max]. This is important for selecting the next reaction to fire because we want the value to always be greater than zero, but the value can equal the max value.
double NFutil::RANDOM_CLOSED | ( | ) |
Uniform random number on the interval (0,1).
This function returns a random double on the closed interval (0,1). This is important for choosing the next dt in the simulation because we will take the log of this number and we don't want dt=0 or dt=infinity.
double NFutil::RANDOM_GAUSSIAN | ( | ) |
Normally distributed random number with mean 0 and variance 1.
Returns a normally distributed random number. Based on the java implementation of Random.nextGaussian, this method uses the polar method of G. E. P. Box, M. E. Muller, and G. Marsaglia, as described by Donald E. Knuth in The Art of Computer Programming, Volume 2: Seminumerical Algorithms, section 3.4.1, subsection C, algorithm P.
int NFutil::RANDOM_INT | ( | unsigned long | min, | |
unsigned long | max | |||
) |
Uniform random number on the interval [min,max].
This is a multipurpose function that selects a random number on the half open interval [min, max). This allows you to quickly select a random element from a list of known size. The function call would look something like: RANDOM_INT(0,sizeOfList). This is used to select the next molecule to be included in a reaction.
void NFutil::SEED_RANDOM | ( | unsigned long | seed | ) |
Seeds the random number generator used in all simulations.
Seed the random number generator with a positive 32bit integer If you don't call this function, the current time will be used as a seed so each run will be different.
string NFutil::toString | ( | int | x | ) |
Converts integer values to their string representations.
string NFutil::toString | ( | double | x | ) |
Converts double values to their string representations.
void NFutil::trim | ( | string & | str | ) |
Removes leading and trailing whitespace (including tabs) from the string.
const double NFutil::NA = 6.02214179e23 |
const double NFutil::PI = 3.14159265358979323846 |