Skip to content
Snippets Groups Projects
Commit 6b37b34e authored by René Heß's avatar René Heß
Browse files

Small cleanup

parent 6e1e94ca
No related branches found
No related tags found
No related merge requests found
......@@ -92,8 +92,8 @@ class PDELabInterface(object):
def pymbolic_list_tensor(self, o, visitor):
return pymbolic_list_tensor(o, visitor)
def pymbolic_identity(self, o, visitor):
return pymbolic_identity(o, visitor)
def pymbolic_identity(self, o):
return pymbolic_identity(o)
#
# Geometry related generator functions
......
......@@ -320,11 +320,7 @@ def define_constant_jacobian_inveser_transposed(name, restriction):
globalarg(name, dtype=np.float64, shape=(dim, dim), managed=False)
if get_option('turn_off_diagonal_jacobian'):
jit_type = 'Dune::FieldMatrix<double,{},{}>'.format(dim,dim)
else:
jit_type = 'auto'
jit_type = type_jacobian_inverse_transposed(restriction)
return '{} {} = {}.jacobianInverseTransposed({});'.format(jit_type,
name,
geo,
......
......@@ -44,7 +44,7 @@ def identity_iname(name, bound):
return name
def define_identity(name, expr, visitor):
def define_identity(name, expr):
i = identity_iname("i", expr.ufl_shape[0])
j = identity_iname("j", expr.ufl_shape[1])
instruction(assignee=prim.Subscript(prim.Variable(name), (prim.Variable(i), prim.Variable(j))),
......@@ -54,12 +54,12 @@ def define_identity(name, expr, visitor):
@kernel_cached
def pymbolic_identity(expr, visitor):
name = get_counted_variable("identity")
def pymbolic_identity(expr):
name = "identity_{}_{}".format(expr.ufl_shape[0],expr.ufl_shape[1])
temporary_variable(name,
shape=expr.ufl_shape,
shape_impl=('fm',),
dtype=np.float64,
)
define_identity(name, expr, visitor)
define_identity(name, expr)
return prim.Variable(name)
......@@ -136,7 +136,7 @@ def split_into_accumulation_terms(expr):
# - Replacing (\nabla v)_{k,l} by I_{k,l} after step 4.
if len(set(indexed_test_arg.index._indices)) < len(indexed_test_arg.index._indices):
if len(indexed_test_arg.index._indices)>2:
raise NotImplementedError("Test argument with more than three indices and double occurence ist not implemted.")
raise NotImplementedError("Test argument with more than three indices and double occurence ist not implemented.")
mod_index_map = {indexed_test_arg.index: MultiIndex((newi[0], newi[1]))}
mod_indexed_test_arg = replace_expression(indexed_test_arg.expr,
replacemap = mod_index_map)
......
......@@ -43,7 +43,7 @@ class LocalDiagonalJITReplacer(MultiFunction):
return MultiIndex(tuple(self.local_replacemap.get(i, i) for i in o))
def indexed(self, o):
if self.local_replacemap!={}:
if self.local_replacemap:
if isinstance(o.ufl_operands[1], MultiIndex):
return self.reuse_if_untouched(o, *tuple(self.call(op) for op in o.ufl_operands))
else:
......
......@@ -229,14 +229,14 @@ class UFL2LoopyVisitor(ModifiedTerminalTracker):
def list_tensor(self, o):
return self.interface.pymbolic_list_tensor(o, self)
def identity(self, o):
return self.interface.pymbolic_identity(o)
#
# Handlers for arithmetic operators and functions
# Those handlers would be valid in any code going from UFL to pymbolic
#
def identity(self, o):
return self.interface.pymbolic_identity(o, self)
def product(self, o):
return Product(tuple(self.call(op) for op in o.ufl_operands))
......
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