Struct NativeArraySharedInt | Entities | 0.10.0-preview.6
docs.unity3d.com
    Show / Hide Table of Contents

    Struct NativeArraySharedInt

    Merge sort index list referencing NativeArray values. Provide list of shared values, indices to shared values, and lists of source i value indices with identical shared value. As an example: Given Source NativeArray: [A,A,A,B,B,C,C,A,B] Provides: Shared value indices: [0,0,0,1,1,2,2,0,1] Shared value counts: [4,3,2] (number of occurrences of a shared value) Shared values: [A,B,C] (not stored in this structure) Sorted indices: [0,1,2,7,3,4,8,5,6] (using these indices to look up values in the source array would give you [A,A,A,A,B,B,B,C,C]) Shared value start offsets (into sorted indices): [0,4,7]

    Namespace: Unity.Entities
    Syntax
    public struct NativeArraySharedInt : IDisposable

    Constructors

    NativeArraySharedInt(NativeArray<Int32>, Allocator)

    Declaration
    public NativeArraySharedInt(NativeArray<int> sourceBuffer, Allocator allocator)
    Parameters
    Type Name Description
    NativeArray<Int32> sourceBuffer
    Allocator allocator

    Properties

    SharedValueCount

    Number of shared (unique) values in source NativeArray

    Declaration
    public int SharedValueCount { get; }
    Property Value
    Type Description
    Int32

    SourceBuffer

    Original Source Values (passed into constructor)

    Declaration
    public NativeArray<int> SourceBuffer { get; }
    Property Value
    Type Description
    NativeArray<Int32>

    Methods

    Dispose()

    Declaration
    public void Dispose()

    GetSharedIndexArray()

    Indices into shared values. For example, given source array: [A,A,A,B,B,C,C,A,B] shared values are: [A,B,C] shared index array would contain: [0,0,0,1,1,2,2,0,1]

    Declaration
    public NativeArray<int> GetSharedIndexArray()
    Returns
    Type Description
    NativeArray<Int32>

    Index NativeArray where each element refers to the index of a shared value in a list of shared (unique) values.

    GetSharedIndexBySourceIndex(Int32)

    Index of shared value associated with an element in the source buffer. For example, given source array: [A,A,A,B,B,C,C,A,B] shared values are: [A,B,C] Given the index 2 into the source array (A), the return value would be 0 (A in shared values).

    Declaration
    public int GetSharedIndexBySourceIndex(int indexIntoSourceBuffer)
    Parameters
    Type Name Description
    Int32 indexIntoSourceBuffer

    Index of source value

    Returns
    Type Description
    Int32

    Index into the list of shared values

    GetSharedValueIndexCountArray()

    Array of number of occurrences of all shared values. For example, given source array: [A,A,A,B,B,C,C,A,B] shared values are: [A,B,C] Shared value counts: [4,3,2] (number of occurrences of a shared value)

    Declaration
    public NativeArray<int> GetSharedValueIndexCountArray()
    Returns
    Type Description
    NativeArray<Int32>

    Count NativeArray where each element refers to the number of occurrences of each shared value.

    GetSharedValueIndexCountBySourceIndex(Int32)

    Number of occurrences of a shared (unique) value shared by a given a source index. For example, given source array: [A,A,A,B,B,C,C,A,B] shared values are: [A,B,C] Shared value counts: [4,3,2] (number of occurrences of a shared value) Given the index 2 into the source array (A), the return value would be 4 (for 4 occurrences of A in the source buffer).

    Declaration
    public int GetSharedValueIndexCountBySourceIndex(int indexIntoSourceBuffer)
    Parameters
    Type Name Description
    Int32 indexIntoSourceBuffer

    Index of source value.

    Returns
    Type Description
    Int32

    Count of total occurrences of the shared value at a source buffer index in the source buffer.

    GetSharedValueIndicesBySharedIndex(Int32)

    Array of indices into source NativeArray which share the same shared value For example, given source array: [A,A,A,B,B,C,C,A,B] shared values are: [A,B,C] Shared value counts: [4,3,2] (number of occurrences of a shared value) Shared value start offsets (into sorted indices): [0,4,7] Given the index 0 into the shared value array (A), the returned array would contain [0,1,2,7] (indices into the source array which point to the shared value A).

    Declaration
    public NativeArray<int> GetSharedValueIndicesBySharedIndex(int sharedValueIndex)
    Parameters
    Type Name Description
    Int32 sharedValueIndex

    Index of shared value

    Returns
    Type Description
    NativeArray<Int32>

    Index NativeArray where each element refers to an index into the source array.

    GetSharedValueIndicesBySourceIndex(Int32)

    Array of indices into shared value indices NativeArray which share the same source value For example, given Source NativeArray: [A,A,A,B,B,C,C,A,B] shared values are: [A,B,C] Shared value indices: [0,0,0,1,1,2,2,0,1] Given the index 2 into the source array (A), the returned array would contain: [0,1,2,7] (indices in SharedValueIndices that have a value of 0, i.e. where A is in the shared values)

    Declaration
    public NativeArray<int> GetSharedValueIndicesBySourceIndex(int indexIntoSourceBuffer)
    Parameters
    Type Name Description
    Int32 indexIntoSourceBuffer

    Index of source value

    Returns
    Type Description
    NativeArray<Int32>

    Index NativeArray where each element refers to an index into the shared value indices array.

    GetSortedIndices()

    Indices into source NativeArray sorted by value

    Declaration
    public NativeArray<int> GetSortedIndices()
    Returns
    Type Description
    NativeArray<Int32>

    Index NativeArray where each element refers to an element in the source NativeArray

    Schedule(JobHandle)

    Schedule jobs to collect and sort shared values.

    Declaration
    public JobHandle Schedule(JobHandle inputDeps)
    Parameters
    Type Name Description
    JobHandle inputDeps

    Dependent JobHandle

    Returns
    Type Description
    JobHandle

    JobHandle

    In This Article
    • Constructors
      • NativeArraySharedInt(NativeArray<Int32>, Allocator)
    • Properties
      • SharedValueCount
      • SourceBuffer
    • Methods
      • Dispose()
      • GetSharedIndexArray()
      • GetSharedIndexBySourceIndex(Int32)
      • GetSharedValueIndexCountArray()
      • GetSharedValueIndexCountBySourceIndex(Int32)
      • GetSharedValueIndicesBySharedIndex(Int32)
      • GetSharedValueIndicesBySourceIndex(Int32)
      • GetSortedIndices()
      • Schedule(JobHandle)
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023