Exemple #1
0
            /// <summary>
            /// Accepts a solution at the current timepoint.
            /// </summary>
            public virtual void Accept()
            {
                // Store the accepted solution
                State.Solution.CopyTo(States.Value.Solution);

                // When just starting out, we want to copy all the states to the previous states.
                if (BaseTime.Equals(0.0))
                {
                    foreach (var istate in States)
                    {
                        istate.Delta = Parameters.MaxStep;
                        States.Value.State.CopyTo(istate.State);
                    }
                }

                // Accept all the registered states
                foreach (var state in RegisteredStates)
                {
                    state.Accept();
                }

                // Clear the breakpoints
                while (Time > Breakpoints.First)
                {
                    Breakpoints.ClearBreakpoint();
                }
                Break = false;
            }
Exemple #2
0
            /// <inheritdoc/>
            public virtual void Initialize()
            {
                Time       = 0.0;
                BaseTime   = 0.0;
                Order      = 1;
                Slope      = 0.0;
                _saveDelta = double.PositiveInfinity;

                // Breakpoints
                Break = true;
                Breakpoints.Clear();
                Breakpoints.SetBreakpoint(Parameters.StartTime);
                Breakpoints.SetBreakpoint(Parameters.StopTime);

                // Create the prediction vector
                State.Solution.CopyTo(States.Value.Solution);
                Prediction = new DenseVector <double>(State.Solver.Size);

                // Calculate an initial timestep
                Delta = Math.Min(Parameters.StopTime / 50.0, Parameters.InitialStep) / 10.0;
            }