From 5277d72f9a3f86a85a40ff61ff7bb8e5c6f7f0bd Mon Sep 17 00:00:00 2001
From: Dominic Kempf <dominic.kempf@iwr.uni-heidelberg.de>
Date: Wed, 6 Feb 2019 15:20:05 +0100
Subject: [PATCH] Add caching to the jacobian definition method

This onleiner makes my richards example faster by 70%.
---
 python/dune/codegen/sumfact/geometry.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/python/dune/codegen/sumfact/geometry.py b/python/dune/codegen/sumfact/geometry.py
index 3a9a5a5a..08e9d43e 100644
--- a/python/dune/codegen/sumfact/geometry.py
+++ b/python/dune/codegen/sumfact/geometry.py
@@ -525,6 +525,7 @@ def name_meshwidth():
     return name
 
 
+@kernel_cached
 def _name_jacobian(i, j, restriction, visitor):
     """Return the (i, j) component of the jacobian of the geometry mapping
 
@@ -534,8 +535,6 @@ def _name_jacobian(i, j, restriction, visitor):
     Note: At the moment this only works for the mappings from reference cells
     to the cell and not for the geometry mappings of intersections.
     """
-    do_predicates = visitor.do_predicates
-
     # Create matrix sequence with derivative in j direction
     matrix_sequence = construct_basis_matrix_sequence(derivative=j,
                                                       facedir=get_facedir(restriction),
-- 
GitLab