Particles: emission and held-attachment pins, column max recorded unclaimed, docs; the dead held-attachment loop deleted

Particle_source_rules: create_particles names TOPO_ISOLATED and not TOPO_FULL, destroy_particles names both (M6a, create
runs FULL, now fails without timing); the substep gate regex follows the viscous-material gate. A lone solid particle with
a tether attachment makes no tether lane (0 before, 0 attached, 0 after destroy): destroy_particles' attachment term in
`held` is dead and goes, with 'or attachment' in its comment; the test pins the absence. Column max keeps 1.5 and is
recorded as claiming no mutant (Mc1 lambda halved 1.2116, Mc2 no self term 1.3340 against shipped 1.3440). docs/soa-world.md
Fluid bullet: inverse-mass lambda, XSPH skip, the held-floor claim; Not done: the sheet sieve at 4 substeps.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-11-25 01:42:38 +01:00
commit e94977fe0b
4 changed files with 35 additions and 15 deletions

View file

@ -127,6 +127,23 @@ public sealed class Box3DSoaFluidTests
Readings.Add(line);
}
[Fact]
public void Destroying_a_lone_attached_particle_leaves_the_tether_lanes_as_before_the_attach()
{
// A particle with a tether attachment and no distance: does it make a tether lane, and does destroying it leave one behind?
using var world = Box3DSoaParticleTests.World(particles: 16, distances: 16, bends: 16, attachments: 4, tethers: 64);
var ps = new Box3DSoaParticleHandle[2];
world.CreateParticles([new((0f, 0f, 0f), 0.02f, 0.0125f), new((1f, 0f, 0f), 0.02f, 0.0125f)], ps);
var before = Snapshot(world.View);
world.Attach(Box3DSoaAttachKind.Static, ps[0], point: (0f, 0f, 0f), tether: true);
var held = world.View.TetherCount;
world.DestroyParticles([ps[0]]);
var line = $"HELD_ATTACHMENT tether lanes {before.Count} before the attach, {held} with a lone tethered particle, {world.View.TetherCount} after destroying it";
Readings.Add(line);
Console.Error.WriteLine(line);
SameTethers(before, Snapshot(world.View));
}
// ---- scenes ---------------------------------------------------------------------------------------------
private static float Sq(float x) => x * x;
@ -209,7 +226,7 @@ public sealed class Box3DSoaFluidTests
// Bounds follow lodur:ruling:deterministic-bound-margin: the geometric mean of the shipped worst and the least claimed mutant, separation >= 1.2.
// |mean - 1| at 3 s: shipped 0.0124, M2 (cell stays 2 r_max) 0.0152, M7 (fluid pairs also contact) 0.0206: bound sqrt(0.0124 x 0.0152) = 0.0137,
// separation 1.23. The max density reads 1.3440 shipped, 1.3576 under M2 and 1.2653 under M7: no mutant is 1.2 away, so the max has no
// claim; 1.5 is a sanity ceiling (the column compressing under its weight is the one-pass solver, not a defect: probe pours peaked at 1.07).
// claim (Mc1, lambda halved, reads 1.2116, 1.11 under shipped; Mc2, pass A without the self term, 1.3340, 1.01: unclaimed, a follow-up); 1.5 is a sanity ceiling (the column compressing under its weight is the one-pass solver, not a defect: probe pours peaked at 1.07).
private const float ColumnMax = 1.5f;
private const float ColumnMean = 0.0137f;
private const float FloorPenetration = 0.233f;

View file

@ -1090,6 +1090,13 @@ public sealed class Box3DSoaParticleSourceTests
Assert.Contains("rederive_topology(p, ", Body(c, $"int32_t ymir_particles_{command}("));
foreach (var command in new[] { "create_distances", "create_bends", "attach", "remove" })
Assert.DoesNotContain("TOPO_ISOLATED", Body(c, $"int32_t ymir_particles_{command}("));
// emission derives the isolated lanes only (a new particle holds no constraint); destroy names both, the graph changing when a victim held one
var created = Body(c, "int32_t ymir_particles_create_particles(");
Assert.Contains("TOPO_ISOLATED", created);
Assert.DoesNotContain("TOPO_FULL", created);
var destroyed = Body(c, "int32_t ymir_particles_destroy_particles(");
Assert.Contains("TOPO_ISOLATED", destroyed);
Assert.Contains("TOPO_FULL", destroyed);
Assert.Equal(0, Count(c + h, @"PxReal|physx"));
// the retired owners stay gone
var retired = string.Join("|", "create_" + "chain", "split_" + "chain", "destroy_" + "chain", "chain_" + "first", "chain_" + "size", "chain_stable_" + "id",
@ -1102,7 +1109,7 @@ public sealed class Box3DSoaParticleSourceTests
// no fluid path runs in a world with no live fluid: both passes sit behind the counter
var substep = StripComments(Body(c, "void ymir_particles_substep("));
Assert.Equal(1, Count(substep, @"if \(p->live_fluid > 0\)\s*\{\s*fluid_density\(p\);"));
Assert.Equal(1, Count(substep, @"if \(p->live_fluid > 0\)\s*\{\s*fluid_viscosity\(p\);"));
Assert.Equal(1, Count(substep, @"if \(p->live_fluid > 0 && viscous_material\(p\)\)\s*\{\s*fluid_viscosity\(p\);"));
// fluid has one writer of live_fluid pair: the two commands
Assert.Equal(0, Count(StripComments(c.Replace(Body(c, "int32_t ymir_particles_create_particles("), "").Replace(Body(c, "int32_t ymir_particles_destroy_particles("), "")), @"live_fluid\s*(\+\+|--|[-+]?=[^=])"));
}