Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</PropertyGroup>

<PropertyGroup>
<PackageBaseVersion>1.0.3</PackageBaseVersion>
<PackageBaseVersion>2.0.0</PackageBaseVersion>
<MinVerTagPrefix></MinVerTagPrefix>
</PropertyGroup>

Expand Down
1 change: 1 addition & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Workspaces.Common" Version="4.14.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.14.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.10" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.0" />
<PackageVersion Include="MinVer" Version="6.0.0" />
<PackageVersion Include="Shouldly" Version="4.3.0" />
Expand Down
Empty file added FMA_Optimizations_Summary.md
Empty file.
3 changes: 2 additions & 1 deletion Geopack.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<Folder Name="/docs/">
<File Path="docs/NuGetPackages.md" />
<File Path="docs\ReleaseNotes_GeopackV1.md" />
<File Path="docs\ReleaseNotes_GeopackV2.md" />
</Folder>
<Folder Name="/GitHub/" />
<Folder Name="/GitHub/workflows/">
Expand All @@ -31,4 +32,4 @@
<Folder Name="/tests/">
<Project Path="UnitTests/UnitTests.csproj" />
</Folder>
</Solution>
</Solution>
5 changes: 3 additions & 2 deletions NuGet.Config
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
</packageSources>
<packageSourceMapping>
<packageSource key="nuget.org">
<package pattern="*"/>
<package pattern="AuroraScienceHub.*" />
<package pattern="*" />
</packageSource>
<packageSource key="AuroraScienceHub">
<package pattern="AuroraScienceHub.*"/>
<package pattern="AuroraScienceHub.*" />
</packageSource>
</packageSourceMapping>
<disabledPackageSources>
Expand Down
14 changes: 14 additions & 0 deletions UnitTests/Extensions/TestExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Shouldly;

namespace AuroraScienceHub.Geopack.UnitTests.Extensions;

/// <summary>
/// Test extensions
/// </summary>
public static class TestExtensions
{
private const double MinimalTestsPrecision = 0.000000000008d;

internal static void ShouldApproximatelyBe(this double actual, double expected)
=> actual.ShouldBe(expected, MinimalTestsPrecision);
}
15 changes: 10 additions & 5 deletions UnitTests/ExternalFieldModels/ExternalFieldModelsTests.T89.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using AuroraScienceHub.Geopack.Contracts.Models;
using AuroraScienceHub.Geopack.Contracts.Cartesian;
using AuroraScienceHub.Geopack.Contracts.Coordinates;
using AuroraScienceHub.Geopack.Contracts.PhysicalQuantities;
using Shouldly;

namespace AuroraScienceHub.Geopack.UnitTests.ExternalFieldModels;
Expand All @@ -20,12 +22,15 @@ public void T89_ShouldReturnCorrectValues(
double x, double y, double z,
double expectedBx, double expectedBy, double expectedBz)
{
// Arrange
CartesianLocation location = CartesianLocation.New(x, y, z, CoordinateSystem.GSW);

// Act
CartesianFieldVector resultField = _t89.Calculate(iopt, new double[10], ps, x, y, z);
CartesianVector<MagneticField> resultField = _t89.Calculate(iopt, new double[10], ps, location);

// Assert
resultField.Bx.ShouldBe(expectedBx, MinimalTestsPrecision);
resultField.By.ShouldBe(expectedBy, MinimalTestsPrecision);
resultField.Bz.ShouldBe(expectedBz, MinimalTestsPrecision);
resultField.X.ShouldBe(expectedBx, MinimalTestsPrecision);
resultField.Y.ShouldBe(expectedBy, MinimalTestsPrecision);
resultField.Z.ShouldBe(expectedBz, MinimalTestsPrecision);
}
}
43 changes: 0 additions & 43 deletions UnitTests/Geopack/GeopackTests.BCarSph_08.cs

This file was deleted.

88 changes: 0 additions & 88 deletions UnitTests/Geopack/GeopackTests.BSphCar_08.cs

This file was deleted.

81 changes: 81 additions & 0 deletions UnitTests/Geopack/GeopackTests.Recalc.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
using AuroraScienceHub.Geopack.Contracts.Cartesian;
using AuroraScienceHub.Geopack.Contracts.Coordinates;
using AuroraScienceHub.Geopack.Contracts.Engine;
using AuroraScienceHub.Geopack.Contracts.PhysicalQuantities;
using AuroraScienceHub.Geopack.UnitTests.Extensions;
using AuroraScienceHub.Geopack.UnitTests.Geopack.TestData.Models;
using AuroraScienceHub.Geopack.UnitTests.Utils;
using Shouldly;

namespace AuroraScienceHub.Geopack.UnitTests.Geopack;

public partial class GeopackTests
{
[Fact(DisplayName = "Basic test: Computation context should be correct")]
public async Task RecalcCommonBlocks_ShouldBeCorrect()
{
// Act
ComputationContext context = s_geopack.Recalc(
fixture.InputData.DateTime,
CartesianVector<Velocity>.New(fixture.InputData.VGSEX, fixture.InputData.VGSEY, fixture.InputData.VGSEZ,
CoordinateSystem.GSE));

// Assert
string rawData = await EmbeddedResourceReader.ReadTextAsync(CommonsDataFileName);
GeopackCommons approvedData = GeopackDataParser.ParseRecalcCommons(rawData);

for (int i = 0; i < context.G.Length; i++)
{
context.G[i].ShouldApproximatelyBe(approvedData.G![i]);
context.H[i].ShouldApproximatelyBe(approvedData.H![i]);
context.REC[i].ShouldApproximatelyBe(approvedData.REC![i]);
}

context.ST0.ShouldApproximatelyBe(approvedData.ST0);
context.CT0.ShouldApproximatelyBe(approvedData.CT0);
context.SL0.ShouldApproximatelyBe(approvedData.SL0);
context.CL0.ShouldApproximatelyBe(approvedData.CL0);
context.CTCL.ShouldApproximatelyBe(approvedData.CTCL);
context.STCL.ShouldApproximatelyBe(approvedData.STCL);
context.CTSL.ShouldApproximatelyBe(approvedData.CTSL);
context.STSL.ShouldApproximatelyBe(approvedData.STSL);
context.SFI.ShouldApproximatelyBe(approvedData.SFI);
context.CFI.ShouldApproximatelyBe(approvedData.CFI);
context.SPS.ShouldApproximatelyBe(approvedData.SPS);
context.CPS.ShouldApproximatelyBe(approvedData.CPS);
context.CGST.ShouldApproximatelyBe(approvedData.CGST);
context.SGST.ShouldApproximatelyBe(approvedData.SGST);
context.PSI.ShouldApproximatelyBe(approvedData.PSI);
context.A11.ShouldApproximatelyBe(approvedData.A11);
context.A21.ShouldApproximatelyBe(approvedData.A21);
context.A31.ShouldApproximatelyBe(approvedData.A31);
context.A12.ShouldApproximatelyBe(approvedData.A12);
context.A22.ShouldApproximatelyBe(approvedData.A22);
context.A32.ShouldApproximatelyBe(approvedData.A32);
context.A13.ShouldApproximatelyBe(approvedData.A13);
context.A23.ShouldApproximatelyBe(approvedData.A23);
context.A33.ShouldApproximatelyBe(approvedData.A33);
context.E11.ShouldApproximatelyBe(approvedData.E11);
context.E21.ShouldApproximatelyBe(approvedData.E21);
context.E31.ShouldApproximatelyBe(approvedData.E31);
context.E12.ShouldApproximatelyBe(approvedData.E12);
context.E22.ShouldApproximatelyBe(approvedData.E22);
context.E32.ShouldApproximatelyBe(approvedData.E32);
context.E13.ShouldApproximatelyBe(approvedData.E13);
context.E23.ShouldApproximatelyBe(approvedData.E23);
context.E33.ShouldApproximatelyBe(approvedData.E33);
}

[Fact(DisplayName = "Recalc should throw if incorrect sw velocity coordinate system")]
public void Recalc_Throw()
{
// Act
Action act = () => s_geopack.Recalc(
fixture.InputData.DateTime,
CartesianVector<Velocity>.New(fixture.InputData.VGSEX, fixture.InputData.VGSEY, fixture.InputData.VGSEZ,
CoordinateSystem.GSW));

// Assert
act.ShouldThrow<InvalidOperationException>();
}
}
64 changes: 0 additions & 64 deletions UnitTests/Geopack/GeopackTests.Recalc_08.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using AuroraScienceHub.Geopack.Contracts.Models;
using AuroraScienceHub.Geopack.Contracts.PhysicalObjects;
using AuroraScienceHub.Geopack.UnitTests.Extensions;
using Shouldly;

namespace AuroraScienceHub.Geopack.UnitTests.Geopack;
Expand All @@ -18,13 +19,13 @@ public void SUN_08_VariousDates_ReturnsExpectedValues(
DateTime date = new(year, month, day, hour, minute, second);

// Act
Sun sun = _geopack.Sun_08(date);
Sun sun = s_geopack.Sun(date);

// Assert
sun.DateTime.ShouldBe(date);
sun.Gst.ShouldBe(gst, MinimalTestsPrecision);
sun.Slong.ShouldBe(slong, MinimalTestsPrecision);
sun.Srasn.ShouldBe(srasn, MinimalTestsPrecision);
sun.Sdec.ShouldBe(sdec, MinimalTestsPrecision);
sun.Gst.ShouldApproximatelyBe(gst);
sun.Slong.ShouldApproximatelyBe(slong);
sun.Srasn.ShouldApproximatelyBe(srasn);
sun.Sdec.ShouldApproximatelyBe(sdec);
}
}
Loading