< Summary

Information
Class: GridForge.Grids.GridNavigationBodyTraceReport
Assembly: GridForge
File(s): /home/runner/work/GridForge/GridForge/src/GridForge/Grids/Support/GridNavigationBodyTrace.cs
Line coverage
100%
Covered lines: 8
Uncovered lines: 0
Coverable lines: 8
Total lines: 119
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_IsComplete()100%11100%
.ctor(...)100%11100%

File(s)

/home/runner/work/GridForge/GridForge/src/GridForge/Grids/Support/GridNavigationBodyTrace.cs

#LineLine coverage
 1//=======================================================================
 2// GridNavigationBodyTrace.cs
 3//=======================================================================
 4// MIT License, Copyright (c) 2024-present David Oravsky (mrdav30)
 5// See LICENSE file in the project root for full license information.
 6//=======================================================================
 7
 8using GridForge.Configuration;
 9using GridForge.Grids.Topology;
 10using GridForge.Spatial;
 11
 12namespace GridForge.Grids;
 13
 14/// <summary>Reports the outcome of a bounded swept navigation-body trace.</summary>
 15public enum GridNavigationBodyTraceStatus : byte
 16{
 17    /// <summary>The complete physical prism union was written.</summary>
 18    Complete,
 19    /// <summary>The complete canonical set was written, but at least one required cell is physically absent.</summary>
 20    IncompletePhysicalCoverage,
 21    /// <summary>The inputs or an exact topology prism could not be represented.</summary>
 22    InvalidOrUnrepresentableGeometry,
 23    /// <summary>The candidate-address ceiling was exhausted.</summary>
 24    AddressLimitExceeded,
 25    /// <summary>The complete required and dependency-evidence output ceiling was exhausted.</summary>
 26    OutputLimitExceeded,
 27    /// <summary>The combined grid and address work ceiling was exhausted.</summary>
 28    CandidateWorkLimitExceeded,
 29    /// <summary>The candidate-grid ceiling was exhausted.</summary>
 30    GridCandidateLimitExceeded,
 31    /// <summary>Checked body-top or query-bounds arithmetic overflowed.</summary>
 32    ArithmeticOverflow
 33}
 34
 35/// <summary>Describes how one published trace cell participates in coverage validation.</summary>
 36public enum GridNavigationBodyTraceCellRole : byte
 37{
 38    /// <summary>The cell identity contributes directly to the required physical coverage.</summary>
 39    RequiredCoverage,
 40    /// <summary>
 41    /// The missing cell is an OR alternative whose mutation invalidates the negative proof without
 42    /// making the cell an additional physical requirement.
 43    /// </summary>
 44    PhysicalAlternativeDependency
 45}
 46
 47/// <summary>Identifies one topology cell and its physical generation evidence.</summary>
 48public readonly struct GridNavigationBodyTraceCell
 49{
 50    /// <summary>The exact world, grid-generation, and topology-local address.</summary>
 51    public WorldVoxelIndex Cell { get; }
 52
 53    /// <summary>The normalized grid binding key, independent of its recyclable runtime slot.</summary>
 54    public GridConfigurationKey ConfigurationKey { get; }
 55
 56    /// <summary>Whether physical storage contained this address during the trace.</summary>
 57    public bool IsPhysicallyPresent { get; }
 58
 59    /// <summary>The last committed sequence applied to the owning grid generation.</summary>
 60    public ulong GridLastChangeSequence { get; }
 61
 62    /// <summary>How this identity participates in the physical coverage proof.</summary>
 63    public GridNavigationBodyTraceCellRole Role { get; }
 64
 65    internal GridNavigationBodyTraceCell(
 66        WorldVoxelIndex cell,
 67        GridConfigurationKey configurationKey,
 68        bool isPhysicallyPresent,
 69        ulong gridLastChangeSequence,
 70        GridNavigationBodyTraceCellRole role)
 71    {
 72        Cell = cell;
 73        ConfigurationKey = configurationKey;
 74        IsPhysicallyPresent = isPhysicallyPresent;
 75        GridLastChangeSequence = gridLastChangeSequence;
 76        Role = role;
 77    }
 78}
 79
 80/// <summary>Summarizes one bounded swept navigation-body trace.</summary>
 81public readonly struct GridNavigationBodyTraceReport
 82{
 83    /// <summary>The completion status.</summary>
 84    public GridNavigationBodyTraceStatus Status { get; }
 85
 86    /// <summary>The number of candidate grids examined.</summary>
 87    public int GridCandidateCount { get; }
 88
 89    /// <summary>The number of candidate addresses examined.</summary>
 90    public int AddressCandidateCount { get; }
 91
 92    /// <summary>The exact combined grid and address work completed.</summary>
 93    public long CandidateWorkCount { get; }
 94
 95    /// <summary>The number of required and dependency-evidence cells written.</summary>
 96    public int CellCount { get; }
 97
 98    /// <summary>The exact committed world revision observed by the trace.</summary>
 99    public GridCoveredAddressRunStamp RunStamp { get; }
 100
 101    /// <summary>Whether the complete physical prism union was written.</summary>
 2102    public bool IsComplete => Status == GridNavigationBodyTraceStatus.Complete;
 103
 104    internal GridNavigationBodyTraceReport(
 105        GridNavigationBodyTraceStatus status,
 106        int gridCandidateCount,
 107        int addressCandidateCount,
 108        long candidateWorkCount,
 109        int cellCount,
 110        GridCoveredAddressRunStamp runStamp)
 111    {
 74112        Status = status;
 74113        GridCandidateCount = gridCandidateCount;
 74114        AddressCandidateCount = addressCandidateCount;
 74115        CandidateWorkCount = candidateWorkCount;
 74116        CellCount = cellCount;
 74117        RunStamp = runStamp;
 74118    }
 119}