Package Scientific :: Package Geometry :: Module TensorAnalysis :: Class TensorField
[frames] | no frames]

Class TensorField

Functions.Interpolation.InterpolatingFunction --+
                                                |
                                               TensorField
Known Subclasses:

Tensor field of arbitrary rank

A tensor field is described by a tensor at each point of a three-dimensional rectangular grid. The grid spacing must be uniform. Tensor fields are implemented as a subclass of InterpolatingFunction from the module Scientific.Functions.Interpolation and thus share all methods defined in that class.

Evaluation:

Instance Methods
 
__add__(self, other)
number
__call__(self, *points)
Returns: the function value obtained by linear interpolation
InterpolatingFunction or number
__getitem__(self, index)
Returns: an InterpolatingFunction whose number of variables is reduced, or a number if no variable is left
 
__init__(self, rank, axes, values, default=None, period=(None, None, None), check=True)
 
__sub__(self, other)
(TensorField, TensorField, TensorField)
allDerivatives(self)
Returns: all three derivatives (x, y, z) on equal-sized grids
TensorField
derivative(self, variable)
Returns: the derivative with respect to variable
Scientifc.Geometry.Tensor
zero(self)
Returns: a tensor of the same rank as the field values with all elements equal to zero

Inherited from Functions.Interpolation.InterpolatingFunction: __abs__, __getattr__, __getslice__, __len__, arccos, arcsin, arctan, cos, cosh, definiteIntegral, exp, fitPolynomial, integral, log, selectInterval, sin, sinh, sqrt, tan, tanh

Method Details

__call__(self, *points)
(Call operator)

 
Returns: number
the function value obtained by linear interpolation
Raises:
  • TypeError - if the number of arguments (len(points)) does not match the number of variables of the function
  • ValueError - if the evaluation point is outside of the domain of definition and no default value is defined
Overrides: Functions.Interpolation.InterpolatingFunction.__call__
(inherited documentation)

__getitem__(self, index)
(Indexing operator)

 
Parameters:
  • i - any indexing expression possible for N.array that does not use N.NewAxis
Returns: InterpolatingFunction or number
an InterpolatingFunction whose number of variables is reduced, or a number if no variable is left
Raises:
  • TypeError - if i is not an allowed index expression
Overrides: Functions.Interpolation.InterpolatingFunction.__getitem__
(inherited documentation)

__init__(self, rank, axes, values, default=None, period=(None, None, None), check=True)
(Constructor)

 
Parameters:
  • rank (int) - the tensor rank
  • axes (sequence of Numeric.array of rank 1) - three arrays specifying the axis ticks for the three axes
  • values (Numeric.array of rank+3 dimensions) - an array containing the field values. Its first three dimensions correspond to the x, y, z directions and must have lengths compatible with the axis arrays. The remaining dimensions must have length 3.
  • default (Scientific.Geometry.Tensor or NoneType) - the value of the field for points outside the grid. A value of 'None' means that an exception will be raised for an attempt to evaluate the field outside the grid. Any other value must a tensor of the correct rank.
  • period (sequence of length three) - the period for each of the variables, or None for variables in which the function is not periodic.
Raises:
  • ValueError - if the arguments are not consistent
Overrides: Functions.Interpolation.InterpolatingFunction.__init__

allDerivatives(self)

 
Returns: (TensorField, TensorField, TensorField)
all three derivatives (x, y, z) on equal-sized grids

derivative(self, variable)

 
Parameters:
  • variable (int) - 0 for x, 1 for y, 2 for z
Returns: TensorField
the derivative with respect to variable
Overrides: Functions.Interpolation.InterpolatingFunction.derivative

zero(self)

 
Returns: Scientifc.Geometry.Tensor
a tensor of the same rank as the field values with all elements equal to zero