← Back to team overview

dolfin team mailing list archive

Re: function dim

 

On Mon, Apr 16, 2007 at 12:25:22PM +0200, Garth N. Wells wrote:
> For the function Function::dim,
> 
>      /// Return the dimension of the value space for axis i
>      uint dim(unsigned int i) const;
> 
> what does i correspond to? I don't understand the comment.
> 
> Garth

The functions can generally be tensor-valued, so say that you have a
matrix-valued function. Then rank() returns 2 and dim() can be called
with argument i=0 or i=1 to return the number of rows and columns.

The size of the array values in the interpolate() function (to be used
by the file formats for output) should be computed as

    uint size = 1;
    for (uint i = 0; i < f.rank(); i++)
      size *= f.dim(i);

/Anders


Follow ups

References