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
1 change: 1 addition & 0 deletions Numos.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<Project Path="src\Numos.API\Numos.API.csproj"/>
<Project Path="src\Numos.Collections\Numos.Collections.csproj"/>
<Project Path="src\Numos.CoreSim\Numos.CoreSim.csproj"/>
<Project Path="src\Numos.Chunks\Numos.Chunks.csproj" />
<Project Path="src\Numos.Headless\Numos.Headless.csproj"/>
<Project Path="src\Numos.Maths\Numos.Maths.csproj"/>
<Project Path="src\Numos.Replay.Analyzers\Numos.Replay.Analyzers.csproj"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Numos.Chunks;
using Numos.CoreSim.Datatypes.Primitives;
using Numos.CoreSim.GasReactions;
using Numos.CoreSim.Replay;
Expand Down Expand Up @@ -34,7 +35,7 @@ internal SimulationWorkload(ScalingWorkloadOptions options)
if (options.GasCount <= 0 || options.CondensingGasCount < 0 || options.CondensingGasCount > options.GasCount)
throw new ArgumentException("Gas dimensions are invalid.", nameof(options));

if (options.ActiveVoxelCount is < 0 or > AtmosChunkConstants.MaximumVoxelCount)
if (options.ActiveVoxelCount is < 0 or > ChunkConstants.MaximumVoxelCount)
throw new ArgumentException("Active voxel count is invalid.", nameof(options));

Options = options;
Expand Down Expand Up @@ -159,7 +160,7 @@ private static IEnumerable<LinearGasReaction> CreateReactions(AtmosConfig config

private void CreateChunk(ScalingWorkloadOptions options, Int3 position, int chunkIndex, bool awake)
{
Kernel.CreateAndRegisterChunk(position, options.ChunkWidth, options.ChunkHeight, options.ChunkDepth);
Kernel.CreateAndRegisterChunk(position);
var chunk = Kernel.GetChunkForDangerousAccess(position);
if (!awake)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using BenchmarkDotNet.Attributes;
using Numos.API;
using Numos.Chunks;
using Numos.Chunks.Topology;
using Numos.CoreSim.Datatypes.Primitives;

namespace Numos.CoreSim.Benchmarks.Scaling;
Expand All @@ -15,8 +17,8 @@ namespace Numos.CoreSim.Benchmarks.Scaling;
[BenchmarkCategory("Scaling", "ExplicitTopology")]
public class ExplicitTopologyBenchmarks
{
private AtmosChunkHandle _chunk;
private ExplicitLinkDefinition[] _definitions = [];
private ChunkHandle _chunk;
private ExplicitLinkDefinition<AtmosLinkFlags>[] _definitions = [];
private ExplicitLinkSetHandle _links;
private AtmosSimulation _simulation = null!;
private AtmosWorld _world = null!;
Expand Down Expand Up @@ -56,13 +58,13 @@ public void Setup()

_simulation.AddGasToVoxel(_chunk, 0, "BenchmarkGas", EdgeCount, 300f);
var source = _simulation.GetCellRef(_chunk, 0);
_definitions = new ExplicitLinkDefinition[EdgeCount];
_definitions = new ExplicitLinkDefinition<AtmosLinkFlags>[EdgeCount];
for (int index = 0; index < EdgeCount; index++)
{
_definitions[index] = new ExplicitLinkDefinition(
_definitions[index] = new ExplicitLinkDefinition<AtmosLinkFlags>(
source,
_simulation.GetCellRef(_chunk, checked((ushort)(index + 1))),
ExplicitLinkFlags.GasTransport);
AtmosLinkFlags.GasTransport);
}

_links = _world.CreateLinks(_definitions);
Expand Down
3 changes: 2 additions & 1 deletion benchmarks/Numos.Replay.Benchmarks/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Globalization;
using System.Runtime.InteropServices;
using Numos.API;
using Numos.Chunks;
using Numos.CoreSim;
using Numos.CoreSim.Replay;
using Numos.Maths;
Expand Down Expand Up @@ -65,7 +66,7 @@
var timeline = new AtmosReplayTimeline(simulation);
for (int tick = 0; tick < 200; tick++)
{
if (tick % 17 == 0) simulation.AddGasToVoxel(new AtmosChunkHandle(default), 0, 0, 0.25f, 300f);
if (tick % 17 == 0) simulation.AddGasToVoxel(new ChunkHandle(default), 0, 0, 0.25f, 300f);
simulation.Tick();
timeline.ObserveLiveState();
}
Expand Down
2 changes: 1 addition & 1 deletion docs/deterministic_replay.md
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ all of them, so don't skip steps on the assumption that a missing one will alway
pointing at the registration host class.
3. Most operations need nothing else here -- the field order in the record's primary constructor becomes the wire
layout, mapped through `Numos.Replay.SourceGen`'s fixed set of recognized field types (primitives, `Int3`,
`VoxelClassification`, `AtmosSimulationId`, `ExplicitLinkSetHandle`, and a nested-operation kind for a world
`VoxelClassification`, `SimulationId`, `ExplicitLinkSetHandle`, and a nested-operation kind for a world
operation embedding a whole `AtmosOperation`). An unrecognized field type fails the build with
`NUMOSREPLAYGEN001` rather than silently miscoding.

Expand Down
5 changes: 4 additions & 1 deletion eng/package_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"Numos.Maths": (),
"Numos.Units": (),
"Numos.Collections": ("Numos.Maths",),
"Numos.CoreSim": ("Numos.Maths", "Numos.Collections", "Numos.Units",),
"Numos.Chunks": ("Numos.Maths", "Numos.Collections",),
"Numos.CoreSim": ("Numos.Maths", "Numos.Collections", "Numos.Chunks", "Numos.Units",),
"Numos.API": ("Numos.CoreSim",),
"Numos.API.Dangerous": ("Numos.API",),
"Numos.Serialization": ("Numos.API",),
Expand All @@ -22,6 +23,7 @@
PACKAGE_VERSION_FILES = {
"Numos.Maths": Path("src/Numos.CoreSim/Version.props"),
"Numos.Collections": Path("src/Numos.CoreSim/Version.props"),
"Numos.Chunks": Path("src/Numos.CoreSim/Version.props"),
"Numos.Units": Path("src/Numos.CoreSim/Version.props"),
"Numos.CoreSim": Path("src/Numos.CoreSim/Version.props"),
"Numos.API": Path("src/Numos.CoreSim/Version.props"),
Expand All @@ -35,6 +37,7 @@
"coresim": (
"Numos.Maths",
"Numos.Collections",
"Numos.Chunks",
"Numos.Units",
"Numos.CoreSim",
"Numos.API",
Expand Down
4 changes: 3 additions & 1 deletion src/Numos.API.Dangerous/AtmosDangerousApi.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using Numos.Chunks;

namespace Numos.API.Dangerous;

/// <summary>
Expand Down Expand Up @@ -34,7 +36,7 @@ internal AtmosDangerousApi(AtmosSimulation simulation)
/// </remarks>
/// <exception cref="KeyNotFoundException">No chunk is registered at the handle's position.</exception>
/// <exception cref="ObjectDisposedException">The simulation has been disposed.</exception>
public AtmosDangerousChunk GetChunk(AtmosChunkHandle chunk)
public AtmosDangerousChunk GetChunk(ChunkHandle chunk)
{
return new AtmosDangerousChunk(_simulation.Kernel.GetChunkForDangerousAccess(chunk.Position));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using Numos.Chunks.Topology;

namespace Numos.API.Dangerous;

/// <summary>
Expand Down Expand Up @@ -35,7 +37,7 @@ internal AtmosDangerousWorldSolverApi(AtmosWorldSolverContext context)
/// <param name="cell">A current cell reference from the callback's world.</param>
/// <returns>The unchecked live chunk view.</returns>
/// <exception cref="ArgumentException">The cell does not identify live storage in this world.</exception>
public AtmosDangerousChunk GetChunk(AtmosCellRef cell)
public AtmosDangerousChunk GetChunk(VoxelRef cell)
{
if (!_context.World.TryGetSimulation(cell.Simulation, out var simulation) || simulation == null)
throw new ArgumentException("The cell does not identify a live simulation in this world.", nameof(cell));
Expand Down
8 changes: 0 additions & 8 deletions src/Numos.API/AtmosChunkHandle.cs

This file was deleted.

5 changes: 3 additions & 2 deletions src/Numos.API/AtmosSimulation.GasMixtures.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using JetBrains.Annotations;
using Numos.Chunks;
using Numos.CoreSim;

namespace Numos.API;
Expand Down Expand Up @@ -34,7 +35,7 @@ public GasMixture CreateGasMixture(
/// becomes stale if that chunk is removed or replaced at the same grid position.
/// </remarks>
[PublicAPI]
public IGasMixture GetVoxelGasMixture(AtmosChunkHandle chunk, ushort localVoxelIndex)
public IGasMixture GetVoxelGasMixture(ChunkHandle chunk, ushort localVoxelIndex)
{
lock (_mixtureGate)
{
Expand All @@ -46,7 +47,7 @@ public IGasMixture GetVoxelGasMixture(AtmosChunkHandle chunk, ushort localVoxelI

/// <summary>Creates sandboxed live access to one voxel addressed by local coordinates.</summary>
[PublicAPI]
public IGasMixture GetVoxelGasMixture(AtmosChunkHandle chunk, int x, int y, int z)
public IGasMixture GetVoxelGasMixture(ChunkHandle chunk, int x, int y, int z)
{
lock (_mixtureGate)
{
Expand Down
5 changes: 3 additions & 2 deletions src/Numos.API/AtmosSimulation.SolverStorage.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using JetBrains.Annotations;
using Numos.Chunks;
using Numos.Collections;
using Numos.CoreSim;

Expand Down Expand Up @@ -183,7 +184,7 @@ public T GetOrCreateGasSolverData<T>(int gasId, object key, Func<GasProperties,
/// </example>
[PublicAPI]
public T[] GetOrCreateChunkSolverArray<T>(
AtmosChunkHandle chunk, object key, bool captureForRollback, int? length = null)
ChunkHandle chunk, object key, bool captureForRollback, int? length = null)
{
ThrowIfDisposed();
return _kernel.GetOrCreateChunkSolverArray<T>(chunk.Position, key, captureForRollback, length);
Expand Down Expand Up @@ -224,7 +225,7 @@ public T[] GetOrCreateChunkSolverArray<T>(
/// </code>
/// </example>
[PublicAPI]
public FlatArray<T> GetOrCreateChunkSolverFlatArray<T>(AtmosChunkHandle chunk, object key, bool captureForRollback)
public FlatArray<T> GetOrCreateChunkSolverFlatArray<T>(ChunkHandle chunk, object key, bool captureForRollback)
{
ThrowIfDisposed();
return _kernel.GetOrCreateChunkSolverFlatArray<T>(chunk.Position, key, captureForRollback);
Expand Down
Loading
Loading