Exemple #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Time" /> class.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="context"/> is <c>null</c>.</exception>
        public Time(ParallelBindingContext context)
            : base(context)
        {
            var parameters = context.GetParameterSet <Parameters>();

            if (parameters.WorkDistributors.TryGetValue(typeof(ITimeBehavior), out var dist) && dist != null)
            {
                _initWorkload = new Workload(dist, parameters.Entities.Count);
            }
        }
Exemple #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Temperature" /> class.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="context"/> is <c>null</c>.</exception>
        public Temperature(ParallelBindingContext context)
            : base(context)
        {
            var parameters = context.GetParameterSet <Parameters>();

            if (parameters.WorkDistributors.TryGetValue(typeof(ITemperatureBehavior), out var dist))
            {
                _workload = new Workload(dist, parameters.Entities.Count);
            }
        }
Exemple #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Accept" /> class.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="context"/> is <c>null</c>.</exception>
        public Accept(ParallelBindingContext context)
            : base(context)
        {
            var parameters = context.GetParameterSet <Parameters>();

            if (parameters.WorkDistributors.TryGetValue(typeof(IAcceptBehavior), out var dist))
            {
                _probeWorkload  = new Workload(dist, parameters.Entities.Count);
                _acceptWorkload = new Workload(dist, parameters.Entities.Count);
            }
        }
Exemple #4
0
        /// <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));
                }
            }
        }
Exemple #5
0
        /// <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));
                }
            }
        }
Exemple #6
0
        /// <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));
                    }
                }
            }
        }
Exemple #7
0
        /// <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));
                }
            }
        }