/// <summary> /// Constructor /// </summary> /// <param name="method">The integration method</param> public StatePool(IntegrationMethod method) { Method = method ?? throw new ArgumentNullException(nameof(method)); int count = method.MaxOrder + 2; History = new ArrayHistory <Vector <double> >(count, (Vector <double>)null); }
/// <summary> /// Initializes a new instance of the <see cref="IntegrationMethod"/> class. /// </summary> /// <param name="maxOrder">The maximum integration order.</param> /// <exception cref="SpiceSharp.CircuitException">Invalid order {0}".FormatString(maxOrder)</exception> protected IntegrationMethod(int maxOrder) { if (maxOrder < 1) { throw new CircuitException("Invalid order {0}".FormatString(maxOrder)); } MaxOrder = maxOrder; // Allocate history of timesteps and solutions IntegrationStates = new ArrayHistory <IntegrationState>(maxOrder + 2); }
/// <summary> /// Constructor /// </summary> /// <param name="maxOrder">Maximum integration order</param> protected IntegrationMethod(int maxOrder) { if (maxOrder < 0) { throw new CircuitException("Invalid order {0}".FormatString(maxOrder)); } MaxOrder = maxOrder; // Allocate history of timesteps DeltaOld = new ArrayHistory <double>(maxOrder + 2); // Allocate history of solutions Solutions = new ArrayHistory <Vector <double> >(maxOrder + 1); // Create configuration Parameters.Add(new IntegrationParameters()); }