From 509b40b494e658f7ede21a25eeefb2062732eb2e Mon Sep 17 00:00:00 2001 From: Marcel Koch <marcel.koch@uni-muenster.de> Date: Thu, 20 Jul 2017 15:57:46 +0200 Subject: [PATCH] Adds subelem inames to lfs_names --- python/dune/perftool/blockstructured/spaces.py | 8 +++++--- python/dune/perftool/pdelab/basis.py | 4 ++-- python/dune/perftool/pdelab/localoperator.py | 11 ++++++----- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/python/dune/perftool/blockstructured/spaces.py b/python/dune/perftool/blockstructured/spaces.py index c7537358..42cd9174 100644 --- a/python/dune/perftool/blockstructured/spaces.py +++ b/python/dune/perftool/blockstructured/spaces.py @@ -1,8 +1,10 @@ from dune.perftool.generation import (backend, domain) -from dune.perftool.pdelab.geometry import local_dimension +from dune.perftool.pdelab.geometry import world_dimension +from dune.perftool.blockstructured.tools import sub_element_inames +#TODO subelem_inames hinzufugen? @backend(interface="lfs_inames", name="blockstructured") def lfs_inames(element, restriction, count=None, context=''): assert not ((context == '') and (count is None)) @@ -13,6 +15,6 @@ def lfs_inames(element, restriction, count=None, context=''): context = str(count) name = "micro_{}_index".format(context) - domain(name, pow(2,local_dimension())) + domain(name, pow(2,world_dimension())) - return name, + return (name, ) + sub_element_inames() diff --git a/python/dune/perftool/pdelab/basis.py b/python/dune/perftool/pdelab/basis.py index 5fec4cc6..756a8d71 100644 --- a/python/dune/perftool/pdelab/basis.py +++ b/python/dune/perftool/pdelab/basis.py @@ -102,7 +102,7 @@ def pymbolic_basis(leaf_element, restriction, number, context=''): name = "phi_{}".format(FEM_name_mangling(leaf_element)) name = restricted_name(name, restriction) get_backend("evaluate_basis", selector=option_switch("blockstructured"))(leaf_element, name, restriction) - iname, = get_backend("lfs_inames", selector=option_switch("blockstructured"))(leaf_element, restriction, number, context=context) + iname = get_backend("lfs_inames", selector=option_switch("blockstructured"))(leaf_element, restriction, number, context=context)[0] return Subscript(Variable(name), (Variable(iname), )) @@ -130,7 +130,7 @@ def pymbolic_reference_gradient(leaf_element, restriction, number, context=''): name = "js_{}".format(FEM_name_mangling(leaf_element)) name = restricted_name(name, restriction) get_backend("evaluate_grad", selector=option_switch("blockstructured"))(leaf_element, name, restriction) - iname, = get_backend("lfs_inames", selector=option_switch("blockstructured"))(leaf_element, restriction, number, context=context) + iname = get_backend("lfs_inames", selector=option_switch("blockstructured"))(leaf_element, restriction, number, context=context)[0] return Subscript(Variable(name), (Variable(iname), 0)) diff --git a/python/dune/perftool/pdelab/localoperator.py b/python/dune/perftool/pdelab/localoperator.py index 3617d789..bde143f8 100644 --- a/python/dune/perftool/pdelab/localoperator.py +++ b/python/dune/perftool/pdelab/localoperator.py @@ -243,11 +243,11 @@ def determine_accumulation_space(expr, number, measure, idims=None): lfs = lfs_child(lfs, idims, shape=subel.value_shape(), symmetry=subel.symmetry()) subel = subel.sub_elements()[0] - iname, = get_backend("lfs_inames", selector=option_switch("blockstructured"))(subel, ma.restriction, count=number) + iname = get_backend("lfs_inames", selector=option_switch("blockstructured"))(subel, ma.restriction, count=number)[0] lfsi = Variable(iname) if get_option("blockstructured"): from dune.perftool.blockstructured.tools import micro_index_to_macro_index - lfsi =micro_index_to_macro_index(lfsi) + lfsi = micro_index_to_macro_index(lfsi) # If the LFS is not yet a pymbolic expression, make it one from pymbolic.primitives import Expression @@ -319,6 +319,9 @@ def generate_accumulation_instruction(visitor, accterm, measure, subdomain_id): # When we do not do sumfactorization we do not split the test function assert(accterm.argument.expr is None) + # TODO boundary_predicates may reset visitor's inames, is that wanted? + predicates = boundary_predicates(accterm.term, measure, subdomain_id, visitor) + # Do the tree traversal to get a pymbolic expression representing this expression pymbolic_expr = visitor(accterm.term) @@ -336,8 +339,6 @@ def generate_accumulation_instruction(visitor, accterm, measure, subdomain_id): from dune.perftool.pdelab.argument import name_accumulation_variable accumvar = name_accumulation_variable((test_lfs.get_restriction() + ansatz_lfs.get_restriction())) - predicates = boundary_predicates(accterm.term, measure, subdomain_id, visitor) - rank = 1 if ansatz_lfs.lfs is None else 2 from dune.perftool.pdelab.argument import PDELabAccumulationFunction @@ -352,7 +353,7 @@ def generate_accumulation_instruction(visitor, accterm, measure, subdomain_id): instruction(assignees=(), expression=expr, - forced_iname_deps=frozenset(visitor.inames).union(frozenset(quad_inames)), + forced_iname_deps=frozenset(quad_inames).union(frozenset(visitor.inames)), forced_iname_deps_is_final=True, predicates=predicates ) -- GitLab