From e062f4ccebdfd64a0385e13f32d0a1cf7d7e8591 Mon Sep 17 00:00:00 2001 From: Dominic Kempf <dominic.kempf@iwr.uni-heidelberg.de> Date: Tue, 11 Jul 2017 17:35:27 +0200 Subject: [PATCH] Add additional shape information to basis evaluation. Even if the basis scalar, it is worth to put a shape of (n, 1), because that is how PDELab thinks about it. Not doing so can have you end up with mismatches between `Dune::FieldVector<double, 1>` and `double`. --- python/dune/perftool/pdelab/basis.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/dune/perftool/pdelab/basis.py b/python/dune/perftool/pdelab/basis.py index 15bc54d5..3fd62f3c 100644 --- a/python/dune/perftool/pdelab/basis.py +++ b/python/dune/perftool/pdelab/basis.py @@ -92,7 +92,7 @@ def declare_cache_temporary(element, restriction, which): @kernel_cached def evaluate_basis(leaf_element, name, restriction): lfs = name_leaf_lfs(leaf_element, restriction) - temporary_variable(name, shape=(name_lfs_bound(lfs),), decl_method=declare_cache_temporary(leaf_element, restriction, 'Function')) + temporary_variable(name, shape=(name_lfs_bound(lfs), 1), decl_method=declare_cache_temporary(leaf_element, restriction, 'Function')) cache = name_localbasis_cache(leaf_element) qp = get_backend("qp_in_cell")(restriction) instruction(inames=get_backend("quad_inames")(), @@ -113,7 +113,7 @@ def pymbolic_basis(leaf_element, restriction, number, context=''): evaluate_basis(leaf_element, name, restriction) iname, = lfs_inames(leaf_element, restriction, number, context=context) - return Subscript(Variable(name), (Variable(iname),)) + return Subscript(Variable(name), (Variable(iname), 0)) @backend(interface="evaluate_grad") @@ -166,7 +166,7 @@ def evaluate_coefficient(visitor, element, name, container, restriction, index): lfs = name_lfs(element, restriction, index) basis = visitor.interface.pymbolic_basis(sub_element, restriction, 0, context='trial') - basisindex, = get_pymbolic_indices(basis) + basisindex, _ = get_pymbolic_indices(basis) if get_option("blockstructured"): from dune.perftool.blockstructured.argument import pymbolic_coefficient -- GitLab