diff --git a/python/dune/perftool/sumfact/tabulation.py b/python/dune/perftool/sumfact/tabulation.py index ca00eee59e403c92770188ca7d3e77de234e5960..68277a18a48c6aefc4be6075e42d1bbb22e6b950 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)