/// <summary> /// Initializes a new instance of the <see cref="Biasing" /> class. /// </summary> /// <param name="context">The context.</param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="context"/> is <c>null</c>.</exception> public Biasing(ParallelBindingContext context) : base(context) { var parameters = context.GetParameterSet <Parameters>(); if (parameters.WorkDistributors.TryGetValue(typeof(IBiasingBehavior), out var dist) && dist != null) { _loadWorkload = new Workload(dist, parameters.Entities.Count); if (context.TryGetState(out IBiasingSimulationState bparent)) { context.AddLocalState <IBiasingSimulationState>(_state = new BiasingSimulationState(bparent)); } if (context.TryGetState(out IIterationSimulationState cparent)) { context.AddLocalState <IIterationSimulationState>(new IterationSimulationState(cparent)); } } }
/// <summary> /// Initializes a new instance of the <see cref="Noise" /> class. /// </summary> /// <param name="context">The context.</param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="context"/> is <c>null</c>.</exception> public Noise(ParallelBindingContext context) : base(context) { var parameters = context.GetParameterSet <Parameters>(); if (parameters.WorkDistributors.TryGetValue(typeof(INoiseBehavior), out var dist) && dist != null) { _noiseInitializeWorkload = new Workload(dist, parameters.Entities.Count); _noiseComputeWorkload = new Workload(dist, parameters.Entities.Count); if (context.TryGetState(out INoiseSimulationState parent)) { context.AddLocalState <INoiseSimulationState>(new NoiseSimulationState(parent)); } } }
/// <summary> /// Initializes a new instance of the <see cref="Frequency" /> class. /// </summary> /// <param name="context">The context.</param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="context"/> is <c>null</c>.</exception> public Frequency(ParallelBindingContext context) : base(context) { var parameters = context.GetParameterSet <Parameters>(); if (parameters.WorkDistributors.TryGetValue(typeof(IFrequencyBehavior), out var dist) && dist != null) { _initWorkload = new Workload(dist, parameters.Entities.Count); _loadWorkload = new Workload(dist, parameters.Entities.Count); if (context.TryGetState(out IComplexSimulationState parent)) { context.AddLocalState <IComplexSimulationState>(_state = new ComplexSimulationState(parent)); } } }
/// <summary> /// Initializes a new instance of the <see cref="Convergence" /> class. /// </summary> /// <param name="context">The context.</param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="context"/> is <c>null</c>.</exception> public Convergence(ParallelBindingContext context) : base(context) { var parameters = context.GetParameterSet <Parameters>(); if (parameters.WorkDistributors.TryGetValue(typeof(IConvergenceBehavior), out var dist) && dist != null) { _convergenceWorkload = new Workload <bool>((IWorkDistributor <bool>)dist, parameters.Entities.Count); if (context.TryGetState <IIterationSimulationState>(out var parent)) { if (!(parent is IterationSimulationState)) { context.AddLocalState <IIterationSimulationState>(new IterationSimulationState(parent)); } } } }