Data Class

The following table shows arithmetic operations that can be performed point-wise on Data objects.
\begin{tableii}{l\vert l}{textrm}{expression}{Description}
\lineii{+\var{arg0}} ...
...r{arg1}} {raises \var{arg0} to the power of \var{arg1} \index{**}}
\end{tableii}
At least one of the arguments arg0 or arg1 must be a Data object. Either of the arguments may be a Data object, a python number or a numpy object.

If arg0 or arg1 are not defined on the same FunctionSpace, then an attempt is made to convert arg0 to the FunctionSpace of arg1 or to convert arg1 to the FunctionSpace of arg0. Both arguments must have the same shape or one of the arguments may be of rank 0 (a constant).

The returned Data object has the same shape and is defined on the data sample points as arg0 or arg1.

The following table shows the update operations that can be applied to Data objects:
\begin{tableii}{l\vert l}{textrm}{expression}{Description}
\lineii{\var{arg0}+=\...
...r{arg0}**=\var{arg2}} {raises \var{arg0} by \var{arg2} \index{**}}
\end{tableii}
arg0 must be a Data object. arg1 must be a Data object or an object that can be converted into a Data object. arg1 must have the same shape as arg0 or have rank 0. In the latter case it is assumed that the values of arg1 are constant for all components. arg1 must be defined in the same FunctionSpace as arg0 or it must be possible to interpolate arg1 onto the FunctionSpace of arg0.

The Data class supports taking slices from a Data object as well as assigning new values to a slice of an existing Data object. The following expressions for taking and setting slices are valid:
\begin{tableiii}{l\vert ll}{textrm}{rank of \var{arg}}{slicing expression}{shape...
...-\var{l0},\var{u1}-\var{l1},\var{u2}-\var{l2},\var{u3}-\var{l3})}
\end{tableiii}
where s is the shape of arg and

$\displaystyle 0 \le \var{l0} \le \var{u0} \le \var{s[0]},$

$\displaystyle 0 \le \var{l1} \le \var{u1} \le \var{s[1]},$

$\displaystyle 0 \le \var{l2} \le \var{u2} \le \var{s[2]},$

$\displaystyle 0 \le \var{l3} \le \var{u3} \le \var{s[3]}.$

Any of the lower indexes l0, l1, l2 and l3 may not be present in which case 0 is assumed. Any of the upper indexes u0, u1, u2 and u3 may be omitted, in which case, the upper limit for that dimension is assumed. The lower and upper index may be identical, in which case the column and the lower or upper index may be dropped. In the returned or in the object assigned to a slice, the corresponding component is dropped, i.e. the rank is reduced by one in comparison to arg. The following examples show slicing in action:
\begin{python}
t=Data(1.,(4,4,6,6),Function(mydomain))
t[1,1,1,0]=9.
s=t[:2,:,2:6,5]  ...

esys@esscc.uq.edu.au