Introduction:
objarray is a special type of Tcl_Obj to handle efficiently (in memory and cpu) arrays of basic numeric types at Tcl level.
This package was developed at CIMNE (www.cimne.com) mainly for GiD (www.gidhome.com), but is is implemented as an independent tcl package that can be used by other applications

To use it must load with 
package require objarray

Tcl_Obj objects automatically do internal conversion between strings and its special type and vice-versa, this facilitate its use.

The hdf5 plugin uses internally objarrays as bridge between HDF5-like arrays and GiD data.

The vtkobjarray is another specialized Tcl package that act as link between objarrays and vtk-like arrays 
(e.g. it is used by the GiD-vtk results import/export plugin)

Note: tclobj, hdf5 and vtkobjarray are Tcl packages developed at CIMNE for GiD

Syntax:

objarray length|type|incr|new_from_to|new|set|get|interleave|deinterleave|range|concat|sort|sum <obj>|<type> ?<increment>|<from> <to>|<size>|<index>? ?value?

Commands:

length: get the length of an existent object
objarray length $obj

type: return the type (chararray shortarray intarray longarray longlongarray floatarray doublearray)
objarray type $obj

incr: increment in $increment all array items (default increment is 1)
objarray incr $obj ?$increment?

new_from_to: allocate an array of type $type filled with integer-like values increasing from $from to $to
set obj [objarray new_from_to $type $from $to]

new: allocate an array of type $type of size $size initialized with $value if any
set obj [objarray new $type $size ?$value?]

set: set the value of the item $index (from 0 to n-1) with the value $value. The array space must be allocated previously
objarray set $obj $index ?$value?

set: get the value of the item $index (from 0 to n-1)
set value [objarray get $obj $index]

interleave: reorder the array of $num_components blocks interleaving items of each component
set obj "x0 x1 x2 y0 y1 y2"
set num_components 2
objarray interleave $obj $num_components
-> "x0 y0 x1 y1 x2 y2"

deinterleave: reorder the array to separate each component in consecutive blocks. The array size must be multiple of num_components
set obj "x0 y0 x1 y1 x2 y2"
set num_components 2
objarray deinterleave $obj $num_components
-> "x0 x1 x2 y0 y1 y2"

range: allocate an array with a subrange of another objarray
set obj2 [objarray range $obj $index_start $index_end]

concat: allocate an array joining two arrays (of same type)
set obj3 [objarray concat $obj $obj2]

sort: sort an array increasing
objarray sort $obj

sum: return the summatory reduction of all array items 
set total [objarray sum $obj]
