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

Fix all of renes complaints

parent c2bb160c
No related branches found
No related tags found
No related merge requests found
""" Generator functions to evaluate trial and test functions
NB: Basis evaluation is only needed for the trial function argument in jacobians, as the
multiplication withthe test function is part of the sum factorization kernel.
multiplication with the test function is part of the sum factorization kernel.
"""
from dune.perftool.generation import (backend,
cached,
......@@ -28,7 +28,7 @@ from dune.perftool.pdelab.restriction import restricted_name
from pytools import product
import pymbolic.primitives as p
import pymbolic.primitives as prim
@cached
......@@ -37,6 +37,7 @@ def pymbolic_trialfunction(element, restriction, component):
rows = quadrature_points_per_direction()
cols = basis_functions_per_direction()
a_matrix = AMatrix(theta, rows, cols)
# TODO: this is 2D only
a_matrices = (a_matrix, a_matrix)
# Do stage 1
......@@ -51,7 +52,9 @@ def pymbolic_trialfunction(element, restriction, component):
insn_dep=frozenset({insn_dep}),
)
return p.Subscript(p.Variable(var), tuple(p.Variable(i) for i in quadrature_inames()))
return prim.Subscript(prim.Variable(var),
tuple(prim.Variable(i) for i in quadrature_inames())
)
@iname
......@@ -78,10 +81,13 @@ def evaluate_basis(element, name, restriction):
inames = lfs_inames(element, restriction)
assert(len(quad_inames) == len(inames))
instruction(expression=p.Product(tuple(p.Call(ColMajorAccess(theta), (p.Variable(i), p.Variable(j)))
for (i, j) in zip(quad_inames, inames))
),
assignee=p.Variable(name),
instruction(expression=prim.Product(tuple(prim.Call(ColMajorAccess(theta),
(prim.Variable(i), prim.Variable(j))
)
for (i, j) in zip(quad_inames, inames)
)
),
assignee=prim.Variable(name),
forced_iname_deps=frozenset(quad_inames + inames),
forced_iname_deps_is_final=True,
)
......@@ -95,4 +101,4 @@ def pymbolic_basis(element, restriction, number):
name = restricted_name(name, restriction)
evaluate_basis(element, name, restriction)
return p.Variable(name)
return prim.Variable(name)
""" Some grabbag tools """
import pymbolic.primitives as p
import pymbolic.primitives as prim
def get_pymbolic_basename(expr):
assert isinstance(expr, p.Expression), "Type: {}, expr: {}".format(type(expr), expr)
assert isinstance(expr, prim.Expression), "Type: {}, expr: {}".format(type(expr), expr)
if isinstance(expr, p.Variable):
if isinstance(expr, prim.Variable):
return expr.name
if isinstance(expr, p.Subscript):
if isinstance(expr, prim.Subscript):
return get_pymbolic_basename(expr.aggregate)
raise NotImplementedError("Cannot determine basename of {}".format(expr))
def get_pymbolic_indices(expr):
if not isinstance(expr, p.Subscript):
if not isinstance(expr, prim.Subscript):
return ()
def ind(i):
......
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