/// <summary>
        /// Setup behavior
        /// </summary>
        /// <param name="simulation">Simulation</param>
        /// <param name="provider">Data provider</param>
        public override void Setup(Simulation simulation, SetupDataProvider provider)
        {
            base.Setup(simulation, provider);
            if (provider == null)
            {
                throw new ArgumentNullException(nameof(provider));
            }

            // Get parameters
            BaseParameters = provider.GetParameterSet <BaseParameters>();

            // Clear all events
            if (UpdateFlux != null)
            {
                foreach (var inv in UpdateFlux.GetInvocationList())
                {
                    UpdateFlux -= (EventHandler <UpdateFluxEventArgs>)inv;
                }
            }
        }
Example #2
0
        /// <summary>
        /// Bind behavior.
        /// </summary>
        /// <param name="simulation">The simulation.</param>
        /// <param name="context">Data provider</param>
        public override void Bind(Simulation simulation, BindingContext context)
        {
            base.Bind(simulation, context);

            // Clear all events
            if (UpdateFlux != null)
            {
                foreach (var inv in UpdateFlux.GetInvocationList())
                {
                    UpdateFlux -= (EventHandler <UpdateFluxEventArgs>)inv;
                }
            }

            var solver = State.Solver;

            BranchBranchPtr = solver.GetMatrixElement(BranchEq, BranchEq);
            BranchPtr       = solver.GetRhsElement(BranchEq);

            var method = ((TimeSimulation)simulation).Method;

            _flux = method.CreateDerivative();
        }
Example #3
0
        /// <summary>
        /// Setup behavior
        /// </summary>
        /// <param name="provider">Data provider</param>
        public override void Setup(SetupDataProvider provider)
        {
            if (provider == null)
            {
                throw new ArgumentNullException(nameof(provider));
            }

            // Get parameters
            _bp = provider.GetParameterSet <BaseParameters>("entity");

            // Get behaviors
            _load = provider.GetBehavior <LoadBehavior>("entity");

            // Clear all events
            if (UpdateFlux != null)
            {
                foreach (var inv in UpdateFlux.GetInvocationList())
                {
                    UpdateFlux -= (EventHandler <UpdateFluxEventArgs>)inv;
                }
            }
        }