Skip to content

Commit

Permalink
assume only one problem
Browse files Browse the repository at this point in the history
  • Loading branch information
AbdAlazezAhmed committed Aug 15, 2024
1 parent d2af0f9 commit 071ecd4
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/solver/adaptivity.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,21 @@ end
"""
get_reaction_tangent(integrator::OS.OperatorSplittingIntegrator)
Returns the maximal reaction magnitude using the [`PointwiseODEFunction`](@ref) of an operator splitting integrator that uses [`LieTrotterGodunov`](@ref) [Lie:1880:tti,Tro:1959:psg,God:1959:dmn](@cite).
It is assumed that the problem containing the reaction tangent is a [`PointwiseODEFunction`](@ref).
"""
@inline function get_reaction_tangent(integrator::OS.OperatorSplittingIntegrator)
reaction_subintegrators = unrolled_filter(subintegrator -> subintegrator.f isa PointwiseODEFunction, integrator.subintegrators)
isempty(reaction_subintegrators) && @error "PointwiseODEFunction not found"
_get_reaction_tangent(reaction_subintegrators)
end

@inline @unroll function _get_reaction_tangent(subintegrators)
@unroll for subintegrator in subintegrators
@inline #=@unroll=# function _get_reaction_tangent(subintegrators)
subintegrator = subintegrators[1]
# @unroll for subintegrator in subintegrators
#TODO: It should be either all the the same type or just one subintegrator after filtering, don't unroll?
φₘidx = transmembranepotential_index(subintegrator.f.ode)
return maximum(@view subintegrator.cache.dumat[:, φₘidx])
end
φₘidx = transmembranepotential_index(subintegrator.f.ode)
return maximum(@view subintegrator.cache.dumat[:, φₘidx])
# end
end

@inline function OS.stepsize_controller!(integrator::OS.OperatorSplittingIntegrator, alg::AdaptiveOperatorSplittingAlgorithm)
Expand Down

0 comments on commit 071ecd4

Please sign in to comment.