From 5a96fcd7fe3477c960ad7d86091e3175455ca519 Mon Sep 17 00:00:00 2001 From: Iglesia Dolci Date: Fri, 6 Dec 2024 10:31:29 +0000 Subject: [PATCH] Add all reduced functional arguments. --- .../adjoint/ensemble_reduced_functional.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/firedrake/adjoint/ensemble_reduced_functional.py b/firedrake/adjoint/ensemble_reduced_functional.py index a2f9ea7915..0ee4fd9b90 100644 --- a/firedrake/adjoint/ensemble_reduced_functional.py +++ b/firedrake/adjoint/ensemble_reduced_functional.py @@ -59,8 +59,22 @@ class EnsembleReducedFunctional(ReducedFunctional): `_. """ def __init__(self, J, control, ensemble, scatter_control=True, - gather_functional=None): - super(EnsembleReducedFunctional, self).__init__(J, control) + gather_functional=None, + derivative_components=None, + scale=1.0, tape=None, + eval_cb_pre=lambda *args: None, + eval_cb_post=lambda *args: None, + derivative_cb_pre=lambda controls: controls, + derivative_cb_post=lambda checkpoint, derivative_components, controls: derivative_components, + hessian_cb_pre=lambda *args: None, + hessian_cb_post=lambda *args: None): + super(EnsembleReducedFunctional, self).__init__( + J, control, derivative_components=derivative_components, + scale=scale, tape=tape, eval_cb_pre=eval_cb_pre, + eval_cb_post=eval_cb_post, derivative_cb_pre=derivative_cb_pre, + derivative_cb_post=derivative_cb_post, + hessian_cb_pre=hessian_cb_pre, + hessian_cb_post=hessian_cb_post) self.ensemble = ensemble self.scatter_control = scatter_control self.gather_functional = gather_functional