SimplicialCubature¶
- class SimplicialCubature(*args)¶
Integration over a mesh.
Methods
Accessor to the object's name.
Maximum absolute error accessor.
Maximum calls number accessor.
Maximum relative error accessor.
getName()Accessor to the object's name.
getRule()Integration rule accessor.
hasName()Test if the object is named.
integrate(*args)Evaluation of the integral of
on a mesh.
setMaximumAbsoluteError(maximumAbsoluteError)Maximum absolute error accessor.
setMaximumCallsNumber(maximumCallsNumber)Maximum calls number accessor.
setMaximumRelativeError(maximumRelativeError)Maximum relative error accessor.
setName(name)Accessor to the object's name.
setRule(rule)Integration rule accessor.
Notes
This is a reimplementation of the method described in [genz2003]. The original matlab file can be found at https://www.math.wsu.edu/faculty/genz/software/software.html.
The keys of
ResourceMaprelated to the class are:the key SimplicialCubature-DefaultMaximumAbsoluteError that defines the default maximum absolute error,
the key SimplicialCubature-DefaultMaximumRelativeError that defines the default maximum relative error,
the key SimplicialCubature-DefaultMaximumCallsNumber that defines the default maximum calls number,
the key SimplicialCubature-DefaultRule that defines the default integration rule,
the key SimplicialCubature-EvaluationBlockSize that defines the number of simplices over which the integrand is evaluated in a single batch, keeping the memory usage bounded,
the key SimplicialCubature-MarginalDiscretizationIntervalsNumber that defines the number of discretization intervals used along each marginal of the integration interval,
the key SimplicialCubature-MaximumRefinementNumber that defines the maximum number of simplices refined at each iteration.
The rule points of the simplices are built and the rule is contracted over the function values with
TBBwhen the integrand function allows parallel evaluation and more than one thread is available. The refinement sequence itself is serial, so the result does not depend on the number of threads.Examples
>>> import openturns as ot >>> vertices = [[0.0, 0.0], [1.0, 0.0], [0.0, 1.0]] >>> simplicies = [[0, 1, 2]] >>> mesh = ot.Mesh(vertices, simplicies) >>> algo = ot.SimplicialCubature() >>> f = ot.SymbolicFunction(['x1', 'x2'], ['exp(x1 + x2)']) >>> value = algo.integrate(f, mesh)
- __init__(*args)¶
- getClassName()¶
Accessor to the object’s name.
- Returns:
- class_namestr
The object class name (object.__class__.__name__).
- getMaximumAbsoluteError()¶
Maximum absolute error accessor.
- Returns:
- maximumAbsoluteErrorfloat
The maximum absolute error.
- getMaximumCallsNumber()¶
Maximum calls number accessor.
- Returns:
- maximumCallsNumberint
The maximum function calls number.
- getMaximumRelativeError()¶
Maximum relative error accessor.
- Returns:
- maximumRelativeErrorfloat
The maximum relative error.
- getName()¶
Accessor to the object’s name.
- Returns:
- namestr
The name of the object.
- getRule()¶
Integration rule accessor.
- Returns:
- ruleint in [1, 4]
The integration rule.
- hasName()¶
Test if the object is named.
- Returns:
- hasNamebool
True if the name is not empty.
- integrate(*args)¶
Evaluation of the integral of
on a mesh.
- Parameters:
- Returns:
- value
Point Approximation of the integral.
- value
Notes
The following
ResourceMapkeys are used:SimplicialCubature-DefaultMaximumAbsoluteError(Scalar, default:0.0): default maximum absolute error of the simplicial cubatureSimplicialCubature-DefaultMaximumCallsNumber(UnsignedInteger, default:100000): default maximum number of calls of the integrandSimplicialCubature-DefaultMaximumRelativeError(Scalar, default:1.0e-5): default maximum relative error of the simplicial cubatureSimplicialCubature-DefaultRule(UnsignedInteger, default:3): rank of the integration rule used by the simplicial cubature, from 1 to 4SimplicialCubature-MarginalDiscretizationIntervalsNumber(UnsignedInteger, default:1): number of discretization intervals used on each marginal of the integration domainSimplicialCubature-MaximumRefinementNumber(UnsignedInteger, default:2048): maximum number of simplices refined at each iteration
Examples
>>> import openturns as ot >>> vertices = [[0.0, 0.0], [1.0, 0.0], [0.0, 1.0]] >>> simplicies = [[0, 1, 2]] >>> mesh = ot.Mesh(vertices, simplicies) >>> algo = ot.SimplicialCubature() >>> f = ot.SymbolicFunction(['x1', 'x2'], ['exp(x1 + x2)']) >>> value = algo.integrate(f, mesh)
- setMaximumAbsoluteError(maximumAbsoluteError)¶
Maximum absolute error accessor.
- Parameters:
- maximumAbsoluteErrorfloat
The maximum absolute error.
- setMaximumCallsNumber(maximumCallsNumber)¶
Maximum calls number accessor.
- Parameters:
- maximumCallsNumberint
The maximum function calls number.
- setMaximumRelativeError(maximumRelativeError)¶
Maximum relative error accessor.
- Parameters:
- maximumRelativeErrorfloat
The maximum relative error.
- setName(name)¶
Accessor to the object’s name.
- Parameters:
- namestr
The name of the object.
- setRule(rule)¶
Integration rule accessor.
- Parameters:
- ruleint in [1, 4]
The integration rule.
OpenTURNS