/// <summary> /// constructor for simulation options, a class sub to SimulationInput /// </summary> /// <param name="seed">random number generator seed (-1=randomly chosen seed, >=0 reproducible sequence)</param> /// <param name="rngType">random number generator type</param> /// <param name="absWeightingType">absorption weighting type</param> /// <param name="phaseFunctionType">phase function type</param> /// <param name="databases">list of DatabaseType indicating data to be written database for post-processing</param> /// <param name="trackStatistics">flag indicating whether to track statistics about where photons end up</param> /// <param name="russianRouletteWeightThreshold">weight threshold to perform RR (default=0, no RR)</param> /// <param name="simulationIndex">index of simulation</param> public SimulationOptions( int seed, RandomNumberGeneratorType rngType, AbsorptionWeightingType absWeightingType, PhaseFunctionType phaseFunctionType, IList <DatabaseType> databases, bool trackStatistics, double russianRouletteWeightThreshold, int simulationIndex) { RandomNumberGeneratorType = rngType; AbsorptionWeightingType = absWeightingType; PhaseFunctionType = phaseFunctionType; Databases = databases; // check if databases list is null and if so make empty if (Databases == null) { Databases = new List <DatabaseType>() { }; } Seed = seed; //if (Seed == -1) // handling of random seed moved to RNGFactory 10/01/11 //{ // Seed = GetRandomSeed(); //} SimulationIndex = simulationIndex; TrackStatistics = trackStatistics; RussianRouletteWeightThreshold = russianRouletteWeightThreshold; }
public RandomNumberStream(StorageLocation location, RandomNumberGeneratorType type = RandomNumberGeneratorType.MRG32K3A, int seed = 111) { _location = location; _innerStream = ExecutionContext.Executor.CreateRandomNumberStream(location, type, seed); Type = type; Seed = seed; }
public IntelMKLRandomNumberStream(RandomNumberGeneratorType type, int seed) { RandomStream = new IntPtr(); int status = -1; status = vslNewStream(ref RandomStream, (int)type, seed); //status = vslNewStream(ref randomStream, BRNGMapper[(int)BRNG.MRG32K3A], seed); if (status != 0) throw new Exception("Random number generation stream failed to initialise."); }
public IntelMKLRandomNumberStream(RandomNumberGeneratorType type, int seed) { RandomStream = new IntPtr(); int status = -1; status = vslNewStream(ref RandomStream, (int)type, seed); //status = vslNewStream(ref randomStream, BRNGMapper[(int)BRNG.MRG32K3A], seed); if (status != 0) { throw new Exception("Random number generation stream failed to initialise."); } }
/// <summary> /// constructor that uses Henyey-Greenstein phase function, does not save photon data to database, /// tallies 2nd moment information, does not track statistics and designates simulation index to 0 /// </summary> /// <param name="seed"></param> /// <param name="rngType"></param> /// <param name="absWeightingType"></param> public SimulationOptions( int seed, RandomNumberGeneratorType rngType, AbsorptionWeightingType absWeightingType) : this(seed, rngType, absWeightingType, PhaseFunctionType.HenyeyGreenstein, new List <DatabaseType>() { }, // databases to be written false, // track statistics 0.0, // Russian Roulette weight threshold: =0.0 -> no RR performed 0) { }
/// <summary> /// Returns an instance of the desired random number generator /// </summary> /// <param name="type">RandomNumberGeneratorType enum</param> /// <param name="seed">integer seed for the RNG, seed=-1 -> random seed, otherwise seeded with input seed</param> /// <returns>Random</returns> public static Random GetRandomNumberGenerator(RandomNumberGeneratorType type, int seed) { if (seed == -1) { seed = GetRandomSeed(); } switch (type) { case RandomNumberGeneratorType.MersenneTwister: return(new MathNet.Numerics.Random.MersenneTwister(seed, true)); default: throw new ArgumentOutOfRangeException("type"); } }
public IDisposable CreateRandomNumberStream(RandomNumberGeneratorType type, int seed) { GeneratorType generatorType; switch (type) { case RandomNumberGeneratorType.MRG32K3A: generatorType = GeneratorType.PseudoMRG32K3A; break; default: generatorType = GeneratorType.PseudoMRG32K3A; break; } var device = new CudaRandDevice(generatorType); device.SetPseudoRandomGeneratorSeed((uint)seed); return(device); }
public abstract IDisposable CreateRandomNumberStream(RandomNumberGeneratorType type, int seed);
public RandomNumberStream CreateRandom(RandomNumberGeneratorType type = RandomNumberGeneratorType.MRG32K3A, int seed = 111) { return(new RandomNumberStream(StorageLocation, type, seed)); }
public IDisposable CreateRandomNumberStream(StorageLocation location, RandomNumberGeneratorType type, int seed) { return(Provider(location).CreateRandomNumberStream(type, seed)); }
public override IDisposable CreateRandomNumberStream(RandomNumberGeneratorType type, int seed) { return(new IntelMKLRandomNumberStream(type, seed)); }
public IDisposable CreateRandomNumberStream(StorageLocation location, RandomNumberGeneratorType type, int seed) { throw new NotImplementedException(); }
/// <summary> /// Returns an instance of the desired random number generator with random seeding /// </summary> /// <param name="type">RandomNumberGeneratorType</param> /// <returns>Random</returns> public static Random GetRandomNumberGenerator(RandomNumberGeneratorType type) { return(GetRandomNumberGenerator(type, -1)); }