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

[bugfix] Adjust VectorExpression code

parent 50092cb3
No related branches found
No related tags found
No related merge requests found
...@@ -99,7 +99,8 @@ def evaluate_intersectionwise_constant_parameter_function(name): ...@@ -99,7 +99,8 @@ def evaluate_intersectionwise_constant_parameter_function(name):
pos = name_quadrature_position() pos = name_quadrature_position()
from dune.perftool.generation.loopy import valuearg from dune.perftool.generation.loopy import valuearg
define_parameter_funciton(name) import numpy
define_parameter_function(name)
valuearg(name, dtype=numpy.float64) valuearg(name, dtype=numpy.float64)
return '{} = {}.{}({}, {});'.format(name, return '{} = {}.{}({}, {});'.format(name,
......
...@@ -76,17 +76,20 @@ class Expression(Coefficient): ...@@ -76,17 +76,20 @@ class Expression(Coefficient):
class VectorExpression(Coefficient): class VectorExpression(Coefficient):
def __init__(self, expr, is_global=True, on_intersection=False, cell_type="triangle"): def __init__(self, expr, is_global=True, on_intersection=False, cell_type="triangle", cellwise_constant=False):
assert isinstance(expr, str) assert isinstance(expr, str)
self.c_expr = expr self.c_expr = expr
self.is_global = is_global self.is_global = is_global
self.on_intersection = on_intersection self.on_intersection = on_intersection
# Avoid ufl complaining about not matching dimension/cells # Avoid ufl complaining about not matching dimension/cells
_dg0vec = VectorElement("DG", cell_type, 0) if cellwise_constant:
_dgvec = VectorElement("DG", cell_type, 0)
else:
_dgvec = VectorElement("DG", cell_type, 1)
# Initialize a coefficient with a dummy finite element map. # Initialize a coefficient with a dummy finite element map.
Coefficient.__init__(self, _dg0vec) Coefficient.__init__(self, _dgvec)
# TODO the subdomain_data code needs a uflid, not idea how to get it here # TODO the subdomain_data code needs a uflid, not idea how to get it here
# The standard way through class decorator fails here... # The standard way through class decorator fails here...
......
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