OpenTURNSPythonFieldFunction¶
- class OpenTURNSPythonFieldFunction(inputMesh, inputDim, outputMesh, outputDim)¶
Override FieldFunction from Python.
- Parameters:
Methods
Accessor to the description of the input field values of the function.
Accessor to the dimension of the input field values of the function.
Accessor to the mesh of the input field of the function.
Accessor to the description of the output field values of the function.
Accessor to the dimension of the output field values.
Accessor to the mesh of the output field of the function.
setInputDescription
(descIn)Accessor to the description of the input field values of the function.
setOutputDescription
(descOut)Accessor to the description of the output field values of the function.
Notes
A OpenTURNSPythonFieldFunction acts on fields to produce fields:
with
a mesh of
and
a mesh of
.
A field is represented by a collection
of elements of
where
is a vertex of
and
the associated value in
.
- At least, you have to overload the function:
_exec(X): single evaluation, X is a
Field
. It returns aField
.
Examples
For example, we create the function which maps a field to another field sharing the same mesh and such that each value
of the input field is mapped into
.
>>> import openturns as ot >>> mesh = ot.Mesh(1) >>> class FUNC(ot.OpenTURNSPythonFieldFunction): ... def __init__(self): ... # first argument: ... super(FUNC, self).__init__(mesh, 2, mesh, 2) ... self.setInputDescription(['R', 'S']) ... self.setOutputDescription(['T', 'U']) ... def _exec(self, X): ... Y = ot.Field(self.getOutputMesh(), X.getValues() * ([2.0]*X.getValues().getDimension())) ... return Y >>> F = FUNC()
Create the associated FieldFunction:
>>> myFunc = ot.FieldFunction(F)
- __init__(inputMesh, inputDim, outputMesh, outputDim)¶
- getInputDescription()¶
Accessor to the description of the input field values of the function.
- Returns:
- descInsequence of str
The description of the input field values of the function.
- getInputDimension()¶
Accessor to the dimension of the input field values of the function.
- Returns:
- inputPointDimint
The dimension of the input field values of the function
.
- getInputMesh()¶
Accessor to the mesh of the input field of the function.
- Returns:
- inputMeshint
The mesh of the input field of the function.
- getOutputDescription()¶
Accessor to the description of the output field values of the function.
- Returns:
- descInsequence of str
The description of the output field values of the function.
- getOutputDimension()¶
Accessor to the dimension of the output field values.
- Returns:
- outputFieldDimint
The dimension of the output field values
.
- getOutputMesh()¶
Accessor to the mesh of the output field of the function.
- Returns:
- outputMeshint
The mesh of the output field of the function.
- setInputDescription(descIn)¶
Accessor to the description of the input field values of the function.
- Parameters:
- descInsequence of str
The description of the input field values of the function.
- setOutputDescription(descOut)¶
Accessor to the description of the output field values of the function.
- Parameters:
- descInsequence of str
The description of the input field values of the function.