pyopensn.math.ScalarSpatialFunction
- class pyopensn.math.ScalarSpatialFunction
Scalar spatial function.
Functions that accept a 3D vector as input and return a scalar.
Wrapper of
opensn::ScalarSpatialFunction
.Examples
>>> # Create from a Python function >>> def foo(point): ... return point.Norm() >>> f = ScalarSpatialFunction(foo) >>> >>> # Create from lambda >>> a = Vector3(0., 0., 1.) >>> g = ScalarSpatialFunction(lambda p : p @ a) >>> >>> # Evaluate >>> f(Vector3(4., 4., 7.)) 9.0 >>> g(Vector3(1., 2., 3.)) 3.0
- __call__(self: pyopensn.math.ScalarSpatialFunction, xyz: pyopensn.math.Vector3) float
Evaluate the associated function.
- Parameters:
xyz (pyopensn.math.Vector3) – The xyz coordinates of the point where the function is called.
- __init__(self: pyopensn.math.ScalarSpatialFunction, func: Callable[[pyopensn.math.Vector3], float]) None
Construct a scalar spatial function from associated Python function or lambda.
- Parameters:
func (Callable[[pyopensn.math.Vector3], float]) – Referenced scalar spatial function.