From 11871f97fe2c546079175553ce7384c3d68074b8 Mon Sep 17 00:00:00 2001 From: Dominic Kempf <dominic.kempf@iwr.uni-heidelberg.de> Date: Fri, 12 Jan 2018 14:47:34 +0100 Subject: [PATCH] Fix CompositeGridFunctionSpaces with 1 child These might sound completely silly, but they are useful when writing code generic w.r.t. the number of components --- python/dune/perftool/options.py | 2 +- python/dune/perftool/pdelab/driver/gridfunctionspace.py | 4 ++++ python/dune/perftool/pdelab/driver/interpolate.py | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/python/dune/perftool/options.py b/python/dune/perftool/options.py index 9fe285b9..78d28b18 100644 --- a/python/dune/perftool/options.py +++ b/python/dune/perftool/options.py @@ -63,7 +63,7 @@ class PerftoolOptionsArray(ImmutableRecord): turn_off_diagonal_jacobian = PerftoolOption(default=False, helpstr="Do not use diagonal_jacobian transformation on the ufl tree and cast result of jacobianInverseTransposed into a FieldMatrix.") architecture = PerftoolOption(default="haswell", helpstr="The architecture to optimize for. Possible values: haswell|knl") grid_offset = PerftoolOption(default=False, helpstr="Set to true if you want a yasp grid where the lower left corner is not in the origin.") - simplify = PerftoolOption(default=True, helpstr="Whether to simplify expressions using sympy") + simplify = PerftoolOption(default=False, helpstr="Whether to simplify expressions using sympy") precision_bits = PerftoolOption(default=64, helpstr="The number of bits for the floating point type") assure_statement_ordering = PerftoolOption(default=False, helpstr="Whether special care should be taken for a good statement ordering in sumfact kernels, runs into a loopy scheduler performance bug, but is necessary for production.") diff --git a/python/dune/perftool/pdelab/driver/gridfunctionspace.py b/python/dune/perftool/pdelab/driver/gridfunctionspace.py index c1b439ea..f4392e36 100644 --- a/python/dune/perftool/pdelab/driver/gridfunctionspace.py +++ b/python/dune/perftool/pdelab/driver/gridfunctionspace.py @@ -234,6 +234,8 @@ def name_gfs(element, is_dirichlet, treepath=(), root=True): subgfs.append(name_gfs(subel, is_dirichlet[k:k + subel.value_size()], treepath=treepath + (i,), root=False)) k = k + subel.value_size() name = "_".join(subgfs) + if len(subgfs) == 1: + name = "{}_dummy".format(name) name = "{}_{}".format(name, "_".join(str(t) for t in treepath)) define_composite_gfs(element, is_dirichlet, name, tuple(subgfs), root) return name @@ -272,6 +274,8 @@ def type_gfs(element, is_dirichlet, root=True): subgfs.append(type_gfs(subel, is_dirichlet[k:k + subel.value_size()], root=False)) k = k + subel.value_size() name = "_".join(subgfs) + if len(subgfs) == 1: + name = "{}_dummy".format(name) typedef_composite_gfs(element, name, tuple(subgfs), root) return name else: diff --git a/python/dune/perftool/pdelab/driver/interpolate.py b/python/dune/perftool/pdelab/driver/interpolate.py index ebbdbfd3..c3c5911e 100644 --- a/python/dune/perftool/pdelab/driver/interpolate.py +++ b/python/dune/perftool/pdelab/driver/interpolate.py @@ -52,6 +52,8 @@ def name_boundary_function(element, func): childs.append(name_boundary_function(subel, func[k:k + subel.value_size()])) k = k + subel.value_size() name = "_".join(childs) + if len(childs) == 1: + name = "{}_dummy".format(name) define_compositegfs_parameterfunction(name, tuple(childs)) return name else: -- GitLab