diff --git a/python/dune/perftool/options.py b/python/dune/perftool/options.py index bca3b2a28be7a4ffd7a34de7734297e9949c380e..e125c1918afee31717575e3447eea461430a2465 100644 --- a/python/dune/perftool/options.py +++ b/python/dune/perftool/options.py @@ -96,6 +96,8 @@ class PerftoolFormOptionsArray(ImmutableRecord): control = PerftoolOption(default=False, helpstr="Generate operator of derivative w.r.t. the control variable") objective_function = PerftoolOption(default=None, helpstr="Name of form representing the objective function in UFL file") control_variable = PerftoolOption(default=None, helpstr="Name of control variable in UFL file") + block_preconditioner_diagonal = PerftoolOption(default=False, helpstr="Whether this operator should implement the diagonal part of a block preconditioner") + block_preconditioner_offdiagonal = PerftoolOption(default=False, helpstr="Whether this operator should implement the off-diagonal part of a block preconditioner") # Until more sophisticated logic is needed, we keep the actual option data in this module _global_options = PerftoolGlobalOptionsArray() @@ -173,6 +175,12 @@ def process_form_options(opt, form): if opt.filename is None: opt = opt.copy(filename="{}_{}_file.hh".format(get_option("target_name"), opt.classname)) + if opt.block_preconditioner_diagonal or opt.block_preconditioner_offdiagonal: + assert opt.numerical_jacobian is False + opt = opt.copy(generate_residuals=False, + generate_jacobians=False, + matrix_free=True, + ) return opt