../lib/numru/gphys/varraycomposite.rb

# class NumRu::VArrayComposite < NumRu::VArray

a VArray that consists of multiple VArrays tiled regularly (possibly in multi-dimension). Except for the constructer "new" and attr_update, the usage of this class is the same as VArray.

Note that the name and the attributes of a VArrayComposite is borrowed form one of the VArrays contained (actually, the first one is used). Currently, no check is made regarding whether the names and attributes are the same among the VArrays contained. If you rename a VArrayComposite, the change will be made with all the VArrays contained. However, currently, change of the attributes are only reflected only in the first VArray. You have to call attr_update separately.

## Class methods

#### `VArrayComposite.new(varrays)`

  Constructor

  ARGUMENTS

  - varrays (NArray of VArray) : VArrays to be included, gridded regularly in a NArray.

  RETURN VALUE

  - a VArrayComposite

  EXAMPLES

  - Suppose that you have VArrays va00, va01, va10, va00, with va00 and va10 having a same 0th dimension length, va01 and va11 having a same 0th dimension length, and va00 and va01 having a same 1st dimention length.

        varrays = NArray[ [ va00, va01 ],
                          [ va10, va11 ] ]
        vac = VArrayComposite.new(varrays)

    This will create a composite VArray tiled two-dimensionally.

  - You can create a VArray that lacks one or more VArrays as long as the shape is unambiguous:

        vac = VArrayComposite.new(  NArray[ [ va00, va01 ],
                                            [ va10, nil ] ] )

    is allowed, but

        vac = VArrayComposite.new(  NArray[ [ va00, nil ],
                                            [ va10, nil ] ] )

    is prohibited.

    NOTICE: At this moment, handling of such nil-contianing VArrayComposite is very limited, and many methods do not work.

  - Suppose that you have 3D VArrays va0, va1, va2, va3, and you want to concatenate them with the 3rd dimension.

        varrays = NArray[ va0,va1,va2,va3 ].newdim(0,0)

    This will create a 3D NArray with a shape of [1,1,4]. Then you can make the composite as follows:

        vac = VArrayComposite.new(varrays)

Usage of all the other class methods are the same as in VArray.