OpenTURNSPythonFieldFunction

class OpenTURNSPythonFieldFunction(n=0, p=0, s=0)

Override FieldFunction from Python.

Parameters:

spatialDim : int, \geq 1

Dimension n of the domain \cD

inputDim : int, \geq 1

Dimension d of the values of the input field

outputDim : int, \geq 1

Dimension d' of the values of the output field

Notes

You have to overload the function:
_exec(X): single evaluation, X is a Field, returns a Field

Examples

>>> import openturns as ot
>>> class FUNC(ot.OpenTURNSPythonFieldFunction):
...     def __init__(self):
...         # first argument:
...         super(FUNC, self).__init__(2, 2, 1)
...         self.setInputDescription(['R', 'S'])
...         self.setOutputDescription(['T', 'U'])
...     def _exec(self, X):
...         Y = ot.Field(X.getMesh(), X.getValues() * ([2.0]*X.getValues().getDimension()))
...         return Y
>>> F = FUNC()

Create the associated FieldFunction:

>>> myFunc = ot.FieldFunction(F)

Methods

__call__(…) <==> x(…)
getInputDescription()
getInputDimension()
getOutputDescription()
getOutputDimension()
getSpatialDimension()
setInputDescription(descIn)
setOutputDescription(descOut)
__init__(n=0, p=0, s=0)

x.__init__(…) initializes x; see help(type(x)) for signature