If my understanding is correct, to add a sync function to a GenericSplitFunction, you need to overload synchronize_solution_with_parameters!(integrator, params, sync::MySync) where MySync is some type the user must define. To be concrete, at minimum I need to define all the below:
struct MySync end
sync = MySync()
function OrdinaryDiffEqOperatorSplitting.synchronize_solution_with_parameters!(
outer_integrator::OrdinaryDiffEqOperatorSplitting.OperatorSplittingIntegrator,
::SciMLBase.NullParameters,
::MySync
)
@info "Sync called at time $(outer_integrator.t)"
end
I feel this is a bit cumbersome and would like to suggest just a function-based approach where the user just needs to supply a function directly such as
my_sync(outer_integrator, params) = ...
We would just need to add
function synchronize_solution_with_parameters!(outer_integrator::OperatorSplittingIntegrator, p, sync::F) where {F<:Function}
sync(outer_integrator, p)
end
and we could still keep the other way as well. This should be OK since the functions should be known at compile time.
Am I missing something why this can't work? Or will hamper other wanted behavior?
If my understanding is correct, to add a sync function to a
GenericSplitFunction, you need to overloadsynchronize_solution_with_parameters!(integrator, params, sync::MySync)whereMySyncis some type the user must define. To be concrete, at minimum I need to define all the below:I feel this is a bit cumbersome and would like to suggest just a function-based approach where the user just needs to supply a function directly such as
We would just need to add
and we could still keep the other way as well. This should be OK since the functions should be known at compile time.
Am I missing something why this can't work? Or will hamper other wanted behavior?