diff --git a/MechJeb2/MechJebLib/Core/ODE/AbstractIVP.cs b/MechJeb2/MechJebLib/Core/ODE/AbstractIVP.cs index 0b3c560f..7be4d3d4 100644 --- a/MechJeb2/MechJebLib/Core/ODE/AbstractIVP.cs +++ b/MechJeb2/MechJebLib/Core/ODE/AbstractIVP.cs @@ -19,7 +19,6 @@ namespace MechJebLib.Core.ODE // TODO: // - Needs better MinStep based on next floating point number // - Configurable to throw or just continue at MinStep - // - Needs better initial step guessing // - Needs working event API public abstract class AbstractIVP { @@ -51,7 +50,7 @@ public abstract class AbstractIVP /// /// Starting step-size (can be zero for automatic guess). /// - public double Hstart { get; set; } + public double Hstart { get; set; } = 0.0; /// /// Interpolants are pulled on an evenly spaced grid @@ -136,7 +135,7 @@ private double EventFuncWrapper(double x, object? o) f(Y, T, Dy); - Habs = SelectInitialStep(f, T, Y, Dy, Direction); + Habs = Hstart > 0 ? Hstart : SelectInitialStep(f, T, Y, Dy, Direction); interpolant?.Add(T, Y, Dy); @@ -264,10 +263,10 @@ private int FillInterpolant(IVPFunc f, double t0, double tf, Hn interpolant, int } protected abstract (double, double) Step(IVPFunc f); - protected abstract double SelectInitialStep(IVPFunc f, double t0, IReadOnlyList y0, IReadOnlyList f0, int direction); - protected abstract void InitInterpolant(); - protected abstract void Interpolate(double x, Vn yout); - protected abstract void Init(); - protected abstract void Cleanup(); + protected abstract double SelectInitialStep(IVPFunc f, double t0, IReadOnlyList y0, IReadOnlyList f0, int direction); + protected abstract void InitInterpolant(); + protected abstract void Interpolate(double x, Vn yout); + protected abstract void Init(); + protected abstract void Cleanup(); } } diff --git a/MechJebLibTest/Maneuvers/ReturnFromMoonTests.cs b/MechJebLibTest/Maneuvers/ReturnFromMoonTests.cs index 362fe3fb..532658f5 100644 --- a/MechJebLibTest/Maneuvers/ReturnFromMoonTests.cs +++ b/MechJebLibTest/Maneuvers/ReturnFromMoonTests.cs @@ -24,7 +24,7 @@ private void NextManeuverToReturnFromMoonTest() // this forces JIT compilation(?) of the SQL solver which takes ~250ms ChangeOrbitalElement.ChangePeriapsis(1.0, new V3(1, 0, 0), new V3(0, 1.0, 0), 1.0); - Logger.Register(o => _testOutputHelper.WriteLine((string)o)); + //Logger.Register(o => _testOutputHelper.WriteLine((string)o)); double centralMu = 398600435436096; double moonMu = 4902800066163.8; var moonR0 = new V3(325420116.073166, -166367503.579338, -138858150.96145);