Skip to content
Snippets Groups Projects
Commit 509b40b4 authored by Marcel Koch's avatar Marcel Koch
Browse files

Adds subelem inames to lfs_names

parent 632c5925
No related branches found
No related tags found
No related merge requests found
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()
......@@ -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))
......
......@@ -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
)
......
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