Skip to content

Commit

Permalink
Code cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
kingsznhone committed May 4, 2024
1 parent fd7a33f commit fac4d65
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 24 deletions.
5 changes: 2 additions & 3 deletions DataConverter/DataReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public static List<PlanetTable> ReadData()
}
VSOP2013DATA.Add(planet);
}

ParallelLoopResult result = Parallel.For(0, 9, ip =>
{
ReadPlanet(VSOP2013DATA[ip], ip);
Expand Down Expand Up @@ -108,7 +108,7 @@ private static void ReadPlanet(PlanetTable Planet, int ip)

Planet.body = (VSOPBody)H.ip;
Planet.variables[H.iv].Body = (VSOPBody)H.ip;
Planet.variables[H.iv].Variable = (VSOPVariable) H.iv;
Planet.variables[H.iv].Variable = (VSOPVariable)H.iv;

Term[] buffer = new Term[H.nt];
for (int i = 0; i < H.nt; i++)
Expand Down Expand Up @@ -166,7 +166,6 @@ private static Term ReadTerm(string line, ref Term T)
//
for (int counter = 0; counter < 5; counter++)
{

Bufferiphi[index] = int.Parse(lineSpan[lineptr..(lineptr + 3)].Trim());
index++;
lineptr += 3;
Expand Down
5 changes: 2 additions & 3 deletions DataConverter/Program.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System.Diagnostics;
using System.IO;
using MessagePack;
using System.Diagnostics;
using System.IO.Compression;
using MessagePack;

namespace VSOP2013.DataConverter
{
Expand Down
5 changes: 2 additions & 3 deletions Demo/PerfTest.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Threading.Tasks;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Jobs;
using System;
using VSOP2013;

namespace Demo
Expand Down
27 changes: 26 additions & 1 deletion Demo/Program.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,32 @@
using System;
/* 项目“Demo (net7.0)”的未合并的更改
在此之前:
using System;
using System.Globalization;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Running;
在此之后:
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Running;
using System;
using System.Globalization;
*/

/* 项目“Demo (net6.0)”的未合并的更改
在此之前:
using System;
using System.Globalization;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Running;
在此之后:
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Running;
using System;
using System.Globalization;
*/

using BenchmarkDotNet.Running;
using System;
using System.Globalization;
using VSOP2013;

namespace Demo
Expand Down
Binary file modified VSOP2013.NET/Resources/NativeAccelerator.dll
Binary file not shown.
16 changes: 8 additions & 8 deletions VSOP2013.NET/Utility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public static double[] XYZtoLBR(double[] xyz)
lbr[1] = b;
lbr[2] = r;
lbr[3] = Vector256.Sum(vv * v1);
lbr[4] =-Vector256.Sum(vv * v2);
lbr[4] = -Vector256.Sum(vv * v2);
lbr[5] = Vector256.Sum(vv * v3);
return lbr.ToArray();
}
Expand Down Expand Up @@ -169,17 +169,17 @@ public static double[] LBRtoXYZ(double[] lbr)
if (Vector256.IsHardwareAccelerated)
{
Vector256<double> m1 = Vector256.Create(Math.Cos(b) * Math.Cos(l), r * Math.Sin(b) * Math.Cos(l), -r * Math.Cos(b) * Math.Sin(l), 0);
Vector256<double> m2 = Vector256.Create(Math.Cos(b) * Math.Sin(l), r * Math.Sin(b) * Math.Sin(l), r * Math.Cos(b) * Math.Cos(l) , 0);
Vector256<double> m3 = Vector256.Create(Math.Sin(b) , -r * Math.Cos(b) , 0 , 0);
Vector256<double> vv = Vector256.Create(dr , db , dl , 0);
Vector256<double> m2 = Vector256.Create(Math.Cos(b) * Math.Sin(l), r * Math.Sin(b) * Math.Sin(l), r * Math.Cos(b) * Math.Cos(l), 0);
Vector256<double> m3 = Vector256.Create(Math.Sin(b), -r * Math.Cos(b), 0, 0);

Vector256<double> vv = Vector256.Create(dr, db, dl, 0);

xyz[0] = x;
xyz[1] = y;
xyz[2] = z;
xyz[3] = Vector256.Sum(vv * m1);
xyz[4] = Vector256.Sum(vv * m2);
xyz[5] =-Vector256.Sum(vv * m3);
xyz[5] = -Vector256.Sum(vv * m3);
return xyz.ToArray();
}

Expand Down Expand Up @@ -316,7 +316,7 @@ public static double[] DynamicaltoICRS(double[] dynamical)
Vector256<double> m1 = Vector256.Create(Cphi, -Sphi * Ceps, Sphi * Seps, 0);
Vector256<double> m2 = Vector256.Create(Sphi, Cphi * Ceps, -Cphi * Seps, 0);
Vector256<double> m3 = Vector256.Create(0, Seps, Ceps, 0);

Vector256<double> vv = Vector256.Create(dynamical[0], dynamical[1], dynamical[2], 0);
Vector256<double> vdv = Vector256.Create(dynamical[3], dynamical[4], dynamical[5], 0);

Expand Down Expand Up @@ -388,7 +388,7 @@ public static double[] ICRStoDynamical(double[] icrs)
Vector256<double> m1 = Vector256.Create(Cphi, Sphi, 0, 0);
Vector256<double> m2 = Vector256.Create(-Sphi * Ceps, Cphi * Ceps, Seps, 0);
Vector256<double> m3 = Vector256.Create(Sphi * Seps, -Cphi * Seps, Ceps, 0);

Vector256<double> vv = Vector256.Create(icrs[0], icrs[1], icrs[2], 0);
Vector256<double> vdv = Vector256.Create(icrs[3], icrs[4], icrs[5], 0);

Expand Down
6 changes: 0 additions & 6 deletions VSOP2013.NET/VSOP2013.NET.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,6 @@ VSOP2013, computed the positions of the planets directly at any moment, as well
<None Update="Resources\NativeAccelerator.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Resources\NativeMethod.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Resources\NativeMethod.pdb">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>

0 comments on commit fac4d65

Please sign in to comment.