Skip to content
Snippets Groups Projects
Commit 55ad773d authored by Dominic Kempf's avatar Dominic Kempf
Browse files

Fixup and two more low hanging fruits

parent 29777e14
No related branches found
No related tags found
No related merge requests found
......@@ -38,17 +38,16 @@ def run_hook(name=None, args=[], kwargs={}):
if occ.count(True):
index = occ.index(True)
args = list(args)
ret = None
if index is not None:
args[index] = args[index].arg
ret = args[index].arg
# Run the actual hooks
ret = None
for hook in _hooks.get(name, ()):
ret = hook(*args, **kwargs)
# And modify the args for chained hooks
# Modify the args for chained hooks
if index is not None:
args[index] = ret
ret = hook(*args, **kwargs)
return ret
......@@ -28,6 +28,7 @@ from dune.perftool.generation import (backend,
post_include,
retrieve_cache_functions,
retrieve_cache_items,
ReturnArg,
run_hook,
template_parameter,
)
......@@ -492,6 +493,11 @@ def generate_kernel(integrals):
# Clean the cache from any data collected after the dry run
delete_cache_items("dryrundata")
# Run preprocessing from custom user code
knl = run_hook(name="loopy_kernel",
args=(ReturnArg(knl),),
)
return knl
......
""" Preprocessing algorithms for UFL forms """
from dune.perftool.generation import run_hook, ReturnArg
import ufl.classes as uc
import ufl.algorithms.apply_function_pullbacks as afp
......@@ -39,6 +40,10 @@ def preprocess_form(form):
formdata.preprocessed_form = apply_default_transformations(formdata.preprocessed_form)
# Run preprocessing from custom user code
formdata.preprocessed_form = run_hook(name="preprocess",
args=(ReturnArg(formdata.preprocessed_form),))
return formdata
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment