< Summary

Information
Class: GridForge.Grids.Topology.GridContactQueryScratch
Assembly: GridForge
File(s): /home/runner/work/GridForge/GridForge/src/GridForge/Grids/Topology/GridContactQueryScratch.cs
Line coverage
100%
Covered lines: 11
Uncovered lines: 0
Coverable lines: 11
Total lines: 48
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
.ctor(...)100%11100%
Clear()100%11100%

File(s)

/home/runner/work/GridForge/GridForge/src/GridForge/Grids/Topology/GridContactQueryScratch.cs

#LineLine coverage
 1//=======================================================================
 2// GridContactQueryScratch.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 SwiftCollections;
 9
 10namespace GridForge.Grids.Topology;
 11
 12/// <summary>
 13/// Owns reusable temporary storage for allocation-free warmed exact-contact queries.
 14/// </summary>
 15/// <remarks>
 16/// Instances are caller-owned, retain capacity between calls, and are not thread-safe.
 17/// </remarks>
 18public sealed class GridContactQueryScratch
 19{
 20    internal SwiftList<Voxel> SourceVoxels { get; }
 21
 22    internal SwiftList<Voxel> CandidateVoxels { get; }
 23
 24    internal SwiftHashSet<Voxel> ProcessedVoxels { get; }
 25
 26    /// <summary>
 27    /// Initializes scratch storage with optional expected source and per-source candidate counts.
 28    /// </summary>
 729    public GridContactQueryScratch(int sourceCapacity = 0, int candidateCapacity = 0)
 30    {
 731        SwiftThrowHelper.ThrowIfNegative(sourceCapacity, nameof(sourceCapacity));
 732        SwiftThrowHelper.ThrowIfNegative(candidateCapacity, nameof(candidateCapacity));
 33
 734        SourceVoxels = new SwiftList<Voxel>(sourceCapacity);
 735        CandidateVoxels = new SwiftList<Voxel>(candidateCapacity);
 736        ProcessedVoxels = new SwiftHashSet<Voxel>(candidateCapacity);
 737    }
 38
 39    /// <summary>
 40    /// Clears retained references without releasing reusable capacity.
 41    /// </summary>
 42    public void Clear()
 43    {
 2444        SourceVoxels.Clear();
 2445        CandidateVoxels.Clear();
 2446        ProcessedVoxels.Clear();
 2447    }
 48}