volumential.expression_eval#

Pointwise evaluation of symbolic scalar fields on the device.

This module owns ScalarFieldExpressionEvaluation together with the pymbolic/loopy plumbing that turns math.foo(x) lookups from a symbolic expression into callables the OpenCL target understands. It is re-exported by volumential.tools for backwards compatibility.

class volumential.expression_eval.ScalarFieldExpressionEvaluation(dim, expression, variables=None, dtype=<class 'numpy.float64'>, function_manglers=None, preamble_generators=None)[source]#

Bases: KernelCacheWrapper

Evaluate a field function on a set of D-d points. Useful for imposing analytic conditions efficiently.

get_cache_key() → tuple[Any, ...][source]#

Return a hashable key identifying the generated kernel.

get_normalised_expr()[source]#

Return expr rewritten in terms of the x0, x1, ... names used by the generated kernel.

get_variable_assignment_code() → str[source]#

Return the loopy snippet reading target coordinates into x0, ....

get_kernel(**kwargs)[source]#

Return the pointwise evaluation kernel.

get_optimized_kernel(ncpus=None, **kwargs)[source]#

Return the evaluation kernel parallelized over target points.