From 5e8a959d863c338650408c9063cfa429aa995fd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20He=C3=9F?= <rene.hess@iwr.uni-heidelberg.de> Date: Thu, 20 Oct 2016 10:41:34 +0200 Subject: [PATCH] Pytest --- python/dune/perftool/pdelab/argument.py | 2 +- python/dune/perftool/sumfact/amatrix.py | 1 + python/dune/perftool/sumfact/sumfact.py | 19 ++++++++++--------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/python/dune/perftool/pdelab/argument.py b/python/dune/perftool/pdelab/argument.py index ff6ff6e9..b537093b 100644 --- a/python/dune/perftool/pdelab/argument.py +++ b/python/dune/perftool/pdelab/argument.py @@ -102,7 +102,7 @@ def name_trialfunction_gradient(element, restriction, component): # This is just a temporary test used to create an A-matrix as # local operator class member. Right now it doesn't evaluate # anything. - if get_option("sumfact") and restriction==Restriction.NONE: + if get_option("sumfact") and restriction == Restriction.NONE: from dune.perftool.sumfact import evaluate_coefficient_gradient_sumfact evaluate_coefficient_gradient_sumfact(element, name, container, restriction, component) diff --git a/python/dune/perftool/sumfact/amatrix.py b/python/dune/perftool/sumfact/amatrix.py index 4703180a..6b4d9114 100644 --- a/python/dune/perftool/sumfact/amatrix.py +++ b/python/dune/perftool/sumfact/amatrix.py @@ -17,6 +17,7 @@ from dune.perftool.pdelab.localoperator import (name_domain_field, from dune.perftool.sumfact.sumfact import AMatrix, sumfact + @class_member("operator") def define_alignment(name): alignment = get_option("sumfact_alignment") diff --git a/python/dune/perftool/sumfact/sumfact.py b/python/dune/perftool/sumfact/sumfact.py index 5884b2f0..9bbd6e02 100644 --- a/python/dune/perftool/sumfact/sumfact.py +++ b/python/dune/perftool/sumfact/sumfact.py @@ -75,10 +75,11 @@ class _GlobalSumfactCounter(object): def _sumfact_rows_iname(a_matrix, count): # TODO: Avoid caching? # count = _GlobalSumfactCounter().get() - name = "sf_cols_"+str(count) + name = "sf_cols_" + str(count) domain(name, a_matrix.m) return name + def sumfact_rows_iname(a_matrix): count = _GlobalSumfactCounter().get() name = _sumfact_rows_iname(a_matrix, count) @@ -89,7 +90,7 @@ def sumfact_rows_iname(a_matrix): def _sumfact_collumns_iname(input_collumns, count): # TODO: Avoid caching? # count = _GlobalSumfactCounter().get() - name = "sf_rows_"+str(count) + name = "sf_rows_" + str(count) domain(name, int(input_collumns)) return name @@ -179,19 +180,19 @@ def sumfact(element, name, container, restriction, component, a_matrices, inp, o # Special case for 1D if len(a_matrices) == 1: input_collumns = sumfact_kernel(a_matrices[0], inp, out, input_collumns, - first=True, element=element, name=name, container=container, - restriction=restriction, component=component) + first=True, element=element, name=name, container=container, + restriction=restriction, component=component) else: # Create buffer buffer_1 = name_buffer(a_matrices) if len(a_matrices) > 2: buffer_2 = name_buffer(a_matrices) - if len(a_matrices)%2 == 0: + if len(a_matrices) % 2 == 0: # First kernel input_collumns = sumfact_kernel(a_matrices[0], inp, out, input_collumns, - first=True, element=element, name=name, container=container, - restriction=restriction, component=component) + first=True, element=element, name=name, container=container, + restriction=restriction, component=component) # In between kernels for mat_1, mat_2 in zip(a_matrices[1:-2:2], a_matrices[2:-1:2]): @@ -203,8 +204,8 @@ def sumfact(element, name, container, restriction, component, a_matrices, inp, o else: # First kernel input_collumns = sumfact_kernel(a_matrices[0], inp, out, input_collumns, - first=True, element=element, name=name, container=container, - restriction=restriction, component=component) + first=True, element=element, name=name, container=container, + restriction=restriction, component=component) # Second kernel input_collumns = sumfact_kernel(a_matrices[1], buffer_1, buffer_2, input_collumns) -- GitLab