From dec5228de98a6248fdccea6e1295f8f56d983469 Mon Sep 17 00:00:00 2001 From: Dominic Kempf <dominic.kempf@iwr.uni-heidelberg.de> Date: Wed, 28 Feb 2018 14:55:54 +0100 Subject: [PATCH] Correctly generate names for combined theta matrices fixes a nasty bug, where face information was omitted --- python/dune/perftool/sumfact/tabulation.py | 53 ++++++++++------------ 1 file changed, 24 insertions(+), 29 deletions(-) diff --git a/python/dune/perftool/sumfact/tabulation.py b/python/dune/perftool/sumfact/tabulation.py index ca00eee5..68277a18 100644 --- a/python/dune/perftool/sumfact/tabulation.py +++ b/python/dune/perftool/sumfact/tabulation.py @@ -62,14 +62,27 @@ class BasisTabulationMatrix(BasisTabulationMatrixBase, ImmutableRecord): slice_index=slice_index, ) + @property + def _shortname(self): + infos = ["d{}".format(self.basis_size), + "q{}".format(self.quadrature_size)] + + if self.transpose: + infos.append("T") + + if self.derivative: + infos.append("dx") + + if self.face is not None: + infos.append("f{}".format(self.face)) + + if self.slice_size is not None: + infos.append("s{}".format(self.slice_index)) + + return "".join(infos) + def __str__(self): - return "{}{}A{}{}{}" \ - .format("face{}_".format(self.face) if self.face is not None else "", - "d" if self.derivative else "", - self.basis_size, - "T" if self.transpose else "", - "_slice{}".format(self.slice_index) if self.slice_size is not None else "", - ) + return "Theta_{}".format(self._shortname) @property def rows(self): @@ -96,14 +109,7 @@ class BasisTabulationMatrix(BasisTabulationMatrixBase, ImmutableRecord): return size def pymbolic(self, indices): - name = "{}{}Theta{}{}_qp{}_dof{}" \ - .format("face{}_".format(self.face) if self.face is not None else "", - "d" if self.derivative else "", - "T" if self.transpose else "", - "_slice{}".format(self.slice_index) if self.slice_size is not None else "", - self.quadrature_size, - self.basis_size, - ) + name = str(self) define_theta(name, self) return prim.Subscript(prim.Variable(name), indices) @@ -140,11 +146,7 @@ class BasisTabulationMatrixArray(BasisTabulationMatrixBase): self.width = width def __str__(self): - abbrevs = tuple("{}A{}{}".format("d" if t.derivative else "", - self.basis_size, - "s{}".format(t.slice_index) if t.slice_size is not None else "") - for t in self.tabs) - return "_".join(abbrevs) + return "_".join((t._shortname for t in self.tabs)) @property def quadrature_size(self): @@ -196,15 +198,8 @@ class BasisTabulationMatrixArray(BasisTabulationMatrixBase): theta = self.tabs[0].pymbolic(indices[:-1]) return prim.Call(ExplicitVCLCast(dtype_floatingpoint(), vector_width=get_vcl_type_size(dtype_floatingpoint())), (theta,)) - abbrevs = tuple("{}x{}".format("d" if t.derivative else "", - "s{}".format(t.slice_index) if t.slice_size is not None else "") - for t in self.tabs) - name = "ThetaLarge{}{}_{}_qp{}_dof{}".format("face{}_".format(self.face) if self.face is not None else "", - "T" if self.transpose else "", - "_".join(abbrevs), - self.tabs[0].quadrature_size, - self.tabs[0].basis_size, - ) + name = str(self) + for i, tab in enumerate(self.tabs): define_theta(name, tab, additional_indices=(i,), width=self.width) -- GitLab