ZLab.Discrete ZLab.Discrete
ZLab.Discrete ZLab.Discrete
Developed by Zeke Zhang

Search Results for

    Edit this page

    Method ForEachVoxelParallel

    | Edit this page View Source

    ForEachVoxelParallel<T>(IGrid<T>, Action<Vector3, T>, int?)

    Parallel z-slice enumeration. Use only if the work done in action is heavy enough to justify the parallel overhead.

    Declaration
    public static void ForEachVoxelParallel<T>(this IGrid<T> g, Action<Vector3, T> action, int? maxDegree = null)
    Parameters
    Type Name Description
    IGrid<T> g

    The grid to enumerate.

    Action<Vector3, T> action

    Action to invoke for each voxel, with parameters (position, value)

    int? maxDegree

    Max degree of parallelism. Default (null) lets the system decide.

    Type Parameters
    Name Description
    T
    Remarks
    grid.ForEachVoxelParallel((pos, val) => { /* heavy work per voxel */ }, maxDegree: Environment.ProcessorCount);