From 95b6e8ddce367afef10b3ddc1c34b385ee6efdee Mon Sep 17 00:00:00 2001
From: Dominic Kempf <dominic.kempf@iwr.uni-heidelberg.de>
Date: Wed, 7 Mar 2018 10:46:31 +0100
Subject: [PATCH] Add option to switch off generation of alpha_* methods

---
 python/dune/perftool/options.py              | 3 ++-
 python/dune/perftool/pdelab/localoperator.py | 3 +++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/python/dune/perftool/options.py b/python/dune/perftool/options.py
index 6c239ccd..bca3b2a2 100644
--- a/python/dune/perftool/options.py
+++ b/python/dune/perftool/options.py
@@ -69,7 +69,7 @@ class PerftoolFormOptionsArray(ImmutableRecord):
     filename = PerftoolOption(default=None, helpstr="The filename to use for this LocalOperator")
     classname = PerftoolOption(default=None, helpstr="The name of the C++ class to generate")
     numerical_jacobian = PerftoolOption(default=False, helpstr="use numerical jacobians (only makes sense, if uflpdelab for some reason fails to generate analytic jacobians)")
-    matrix_free = PerftoolOption(default=False, helpstr="Use iterative solver with matrix free jacobian application")
+    matrix_free = PerftoolOption(default=False, helpstr="Generate jacobian_apply_* methods for matrix free solvers")
     print_transformations = PerftoolOption(default=False, helpstr="print out dot files after ufl tree transformations")
     print_transformations_dir = PerftoolOption(default=".", helpstr="place where to put dot files (can be omitted)")
     quadrature_order = PerftoolOption(_type=int, helpstr="Quadrature order used for all integrals.")
@@ -87,6 +87,7 @@ class PerftoolFormOptionsArray(ImmutableRecord):
     simplify = PerftoolOption(default=False, helpstr="Whether to simplify expressions using sympy")
     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.")
     generate_jacobians = PerftoolOption(default=True, helpstr="Whether jacobian_* methods should be generated. This is set to false automatically, when numerical_jacobian is set to true.")
+    generate_residuals = PerftoolOption(default=True, helpstr="Whether alpha_* methods should be generated.")
     unroll_dimension_loops = PerftoolOption(default=False, helpstr="whether loops over the geometric dimension should be unrolled")
     precompute_quadrature_info = PerftoolOption(default=True, helpstr="compute quadrature points and weights in the constructor of the local operator")
     blockstructured = PerftoolOption(default=False, helpstr="Use block structure")
diff --git a/python/dune/perftool/pdelab/localoperator.py b/python/dune/perftool/pdelab/localoperator.py
index 1a9d9c46..9f196a65 100644
--- a/python/dune/perftool/pdelab/localoperator.py
+++ b/python/dune/perftool/pdelab/localoperator.py
@@ -745,6 +745,9 @@ def local_operator_default_settings(operator, form):
 
 
 def generate_residual_kernels(form, original_form):
+    if not get_form_option("generate_residuals"):
+        return {}
+
     logger = logging.getLogger(__name__)
     with global_context(form_type='residual'):
         operator_kernels = {}
-- 
GitLab