SciML / SciML/OrdinaryDiffEqOperatorSplitting.jl

Sync API is cumbersome (in my opinion)

Open
#12 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Julia
Stars
8
Forks
6
Avg merge
48m
Merged PRs (30d)
8

Description

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?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the synchronize_solution_with_parameters! entry point for OperatorSplittingIntegrator and inspect how GenericSplitFunction dispatches synchronization types. Check the existing method and surrounding API behavior before assessing the proposed function-based overload. Done means determining whether the overload preserves current dispatch behavior and documenting or implementing the accepted approach.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
backend-api-design
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.