public NativeArray(int size) { _pointer = NativePointer.Allocate(sizeof(NativeStruct), executionSpace); ((NativeStruct *)Instance)->Length = size; ((NativeStruct *)Instance)->Data = KokkosLibrary.Allocate(executionSpace, (ulong)(size * elementSize)); _isOwner = true; data_pointer = (T *)((NativeStruct *)Instance)->Data; }
public NativeArray(T[] array) { _pointer = NativePointer.Allocate(sizeof(NativeStruct), executionSpace); _isOwner = true; ((NativeStruct *)Instance)->Length = array.Length; ((NativeStruct *)Instance)->Data = KokkosLibrary.Allocate(executionSpace, (ulong)(array.Length * elementSize)); data_pointer = (T *)((NativeStruct *)Instance)->Data; if (data_pointer != null) { for (int i = 0; i < array.Length; i++) { data_pointer[i] = array[i]; } } }