Basic Info:
This DLL allows you to use multiple dimensional arrays. I decided to write it as a DLL in order to increase the number of dimensions possible. Each function (script) is commented in detail, so make sure you read each of them and how it is used. I have made a .gmk that uses each of these functions to further display how each function can be used. I doubt you will have many questions about this DLL as it is pretty straight forward. The only thing I want to make note of is to make sure you use the NArray_GetMaxDimensions() and/or NArray_GetMaxDimensionSize() functions (or calculate it yourself) to make sure you are not making the array too large. If you make the array too large then an unexpected error will occur. Also, if you make the array near the max size then it will take some time to create the array.
How It Works:
For those curious how it works, basically I translate the multidimensional coordinates of an element into a single coordinate of a one dimensional array. In other words, if you want a N-Dimensional array then the narray[x,y,z,w,...] is translated to array1D[element]. This is done mathematically by the algorithm:
element = x+y*sizeof(x)+z*sizeof(y)*sizeof(x)+w*sizeof(z)*si
zeof(y)*sizeof(x)+....etc
What You Can Do:
- Create an Array (all values of an array must be same type: real, or string)
- Set an Element
- Get an Element
- Delete an Array (to free memory)
- Get Datatype of Array (real or string)
- Get Size of Array (quantity of elements in array)
- Get Size of Dimension (quantity of elements in dimension)
- Get Max Quantity of Dimensions at given Size (before crash will occur)
- Get Max Size of Each Dimension at Given Quantity of Dimensions (before crash will occur)
- Get Max Size of Array (max quantity of elements in array possible before crash will occur)
- Resize Array (shrinking will create data loss)
Edited by margoose, 29 November 2009 - 09:00 AM.












