One unusual type I pass in is an abstract type that is basically there to force a dispatch choice on the underlying function.
abstract type AbstractInterpolationMode end
abstract type InterpMode1 <: AbstractInterpolationMode end
abstract type InterpMode2 <: AbstractInterpolationMode end
This was one of the Kwargs that was passed to the top level function, and it defaulted to one of those.
Then there was a function call that looked something like this:
interpolationHelper!(::Type{InterpMode1}, o, t, p, f; kwargs...) = interpolateMode1!(o, t, p, f; kwargs...)
interpolationHelper!(::Type{InterpMode2}, o, t, p, f; kwargs...) = interpolateMode2!(o, t, p, f; kwargs...)
Some of the kwargs would be mutable structures containing mutable vectors, etc. that could be reused in calculations. If the kwarg wasn’t given, then the memory would be allocated instead, but it could be passed in to avoid garbage collection.
Does that make sense.
I’ve moved all of those off into a settings structure, still battling with allocation checks in the test functions. I think it is an interaction with the @test macro though and these “ref” memory pointers.
I’m attempting to build a dummy module with the ref pointers and the testing functions so the “@test” macro just calls that module and checks for the allocations. When I did this by hand it worked.
There is another top level function that had the InterpType where InterpType<:AbstractInterpolationMode as a kwargs…
That function interpolationHelper! with it passed in as the first argument. Then that InterpType isn’t used in the call to interpolationHelper!