diff --git a/sumpy/codegen.py b/sumpy/codegen.py index 1c91e7bf275cc7297acb537b60dabdffdb6e03d2..74b1a279347433b040c9e6ed3bd3f45dd4808490 100644 --- a/sumpy/codegen.py +++ b/sumpy/codegen.py @@ -109,7 +109,11 @@ hank1_01_result hank1_01(cdouble_t z) """ -def bessel_preamble_generator(seen_dtypes, seen_functions): +def bessel_preamble_generator(target, seen_dtypes, seen_functions): + from loopy.target.pyopencl import PyOpenCLTarget + if not isinstance(target, PyOpenCLTarget): + raise NotImplementedError("Only the PyOpenCLTarget is supported as of now") + require_bessel = False if any(func.name == "hank1_01" for func in seen_functions): yield ("50-sumpy-hankel", HANKEL_PREAMBLE) @@ -125,13 +129,17 @@ hank1_01_result_dtype = cl.tools.get_or_register_dtype("hank1_01_result", ) -def bessel_mangler(identifier, arg_dtypes): +def bessel_mangler(target, identifier, arg_dtypes): """A function "mangler" to make Bessel functions digestible for :mod:`loopy`. See argument *function_manglers* to :func:`loopy.make_kernel`. """ + from loopy.target.pyopencl import PyOpenCLTarget + if not isinstance(target, PyOpenCLTarget): + raise NotImplementedError("Only the PyOpenCLTarget is supported as of now") + if identifier == "hank1_01": return (np.dtype(hank1_01_result_dtype), identifier, (np.dtype(np.complex128),)) diff --git a/sumpy/expansion/__init__.py b/sumpy/expansion/__init__.py index 4cd9f1b63a30b1864e072ee0111fd6655868f154..b0c451f7f9501203e86f820ed32322885c23f3b9 100644 --- a/sumpy/expansion/__init__.py +++ b/sumpy/expansion/__init__.py @@ -67,14 +67,24 @@ class ExpansionBase(object): return len(self.get_coefficient_identifiers()) def coefficients_from_source(self, avec, bvec): - """ + """Form an expansion from a source point. + :arg avec: vector from source to center. :arg bvec: vector from center to target. Not usually necessary, except for line-Taylor expansion. + + :returns: a list of :mod:`sympy` expressions representing + the coefficients of the expansion. """ raise NotImplementedError def evaluate(self, coeffs, bvec): + """ + :return: a :mod:`sympy` expression corresponding + to the evaluated expansion with the coefficients + in *coeffs*. + """ + raise NotImplementedError def update_persistent_hash(self, key_hash, key_builder):