Skip to content

Instantly share code, notes, and snippets.

@wence-
Last active August 29, 2015 14:16
Show Gist options
  • Select an option

  • Save wence-/8eda6d2cad07de302a98 to your computer and use it in GitHub Desktop.

Select an option

Save wence-/8eda6d2cad07de302a98 to your computer and use it in GitHub Desktop.
diff --git a/firedrake/parloops.py b/firedrake/parloops.py
index 037f0cc..b198056 100644
--- a/firedrake/parloops.py
+++ b/firedrake/parloops.py
@@ -89,7 +89,7 @@ def _form_kernel(kernel, measure, args, **kwargs):
"par_loop_kernel", **kwargs)
-def par_loop(kernel, measure, args, **kwargs):
+def par_loop(kernel, measure, args, return_callable=False, **kwargs):
"""A :func:`par_loop` is a user-defined operation which reads and
writes :class:`.Function`\s by looping over the mesh cells or facets
and accessing the degrees of freedom on adjacent entities.
@@ -238,4 +238,7 @@ def par_loop(kernel, measure, args, **kwargs):
return f.dat(intent, _map['nodes'](f))
op2args += [mkarg(func, intent) for (func, intent) in args.itervalues()]
- return pyop2.par_loop(*op2args)
+ if return_callable:
+ return lambda: pyop2.par_loop(op2args)
+ else:
+ return pyop2.par_loop(*op2args)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment