/// <summary>
        /// Sets up for the specified simulation.
        /// </summary>
        /// <param name="simulation">The simulation.</param>
        /// <exception cref="SpiceSharp.CircuitException">Could not extract solver</exception>
        public virtual void Setup(TimeSimulation simulation)
        {
            var solver = simulation?.RealState?.Solver;

            if (solver == null)
            {
                throw new CircuitException("Could not extract solver");
            }
            IntegrationStates.Clear(i => new IntegrationState(1.0,
                                                              new DenseVector <double>(solver.Order),
                                                              StateManager.Build()));
        }
        /// <summary>
        /// Destroys the integration method.
        /// </summary>
        public virtual void Unsetup()
        {
            StateManager.Unsetup();

            // Clear the timesteps and solutions
            IntegrationStates.Clear((IntegrationState)null);

            // Clear variables
            Order    = 0;
            Slope    = 0.0;
            BaseTime = 0.0;
            Time     = 0.0;
        }