OpenTURNSPythonPointToFieldFunction¶
- class OpenTURNSPythonPointToFieldFunction(inputDim, outputMesh, outputDim)¶
Override PointToFieldFunction from Python.
- Parameters:
- inputDimpositive int
Dimension
of the input vector
- outputMesh
Mesh
The output mesh
- outputDimpositive int
Dimension of the output field values d’
Methods
Accessor to the description of the input values of the function.
Accessor to the dimension of the input point of the function.
Accessor to the description of the output field values.
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 values of the function.
setOutputDescription
(descOut)Accessor to the description of the output field values.
Notes
A OpenTURNSPythonPointToFieldFunction acts on points to produce fields:
with
a mesh of
.
A field is represented by a collection
of elements of
where
is a vertex of
and
the associated value in
.
Using the class OpenTURNSPythonPointToFieldFunction allows one to define a persistent state between the evaluations of the function.
- At least, you have to overload the function:
_exec(X): a single evaluation, where X is a
Point
. It returns aField
.
Examples
For example, we create the function which maps the point
into the field where the output values are
on the regular grid
.
>>> import openturns as ot >>> class FUNC(ot.OpenTURNSPythonPointToFieldFunction): ... def __init__(self): ... mesh = ot.RegularGrid(0.0, 0.1, 11) ... super(FUNC, self).__init__(2, mesh, 2) ... self.setInputDescription(['R', 'S']) ... self.setOutputDescription(['T', 'U']) ... def _exec(self, X): ... size = self.getOutputMesh().getVerticesNumber() ... Y = [ot.Point(X)*i for i in range(size)] ... return Y >>> F = FUNC()
- __init__(inputDim, outputMesh, outputDim)¶
- getInputDescription()¶
Accessor to the description of the input values of the function.
- Returns:
- descInsequence of str
The description of the input values of the function.
- getInputDimension()¶
Accessor to the dimension of the input point of the function.
- Returns:
- inputPointDimint
The dimension of the input point of the function
.
- getOutputDescription()¶
Accessor to the description of the output field values.
- Returns:
- descOutsequence 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 values of the function.
- Parameters:
- descInsequence of str
The description of the input values of the function.
- setOutputDescription(descOut)¶
Accessor to the description of the output field values.
- Parameters:
- descOutsequence of str
The description of theof the output field values of the function.