Esempio n. 1
0
        /// <summary>
        /// Copy a managed array's elements to a native array
        /// </summary>
        ///
        /// <param name="src">
        /// Array to copy from
        /// </param>
        ///
        /// <param name="dest">
        /// Array to copy to
        /// </param>
        ///
        /// <exception cref="ArgumentException">
        /// If the arrays have different sizes
        /// </exception>
        private static void Copy(T[,] src, NativeArray2D <T> dest)
        {
            dest.RequireWriteAccess();

            if (src.GetLength(0) != dest.Length0 ||
                src.GetLength(1) != dest.Length1)
            {
                throw new ArgumentException("Arrays must have the same size");
            }

            for (int index0 = 0; index0 < dest.Length0; ++index0)
            {
                for (int index1 = 0; index1 < dest.Length1; ++index1)
                {
                    dest[index0, index1] = src[index0, index1];
                }
            }
        }