module OrdinaryDiffEqLowOrderRK

import OrdinaryDiffEqCore: isfsal, beta2_default, beta1_default,
    alg_stability_size,
    ssp_coefficient, OrdinaryDiffEqAlgorithm,
    OrdinaryDiffEqExponentialAlgorithm,
    explicit_rk_docstring, generic_solver_docstring,
    trivial_limiter!,
    OrdinaryDiffEqAdaptiveAlgorithm,
    unwrap_alg, perform_step!,
    _ode_addsteps!, @OnDemandTableauExtract,
    constvalue,
    OrdinaryDiffEqMutableCache,
    OrdinaryDiffEqConstantCache, @fold,
    @cache, CompiledFloats, alg_cache, CompositeAlgorithm,
    AutoAlgSwitch, _ode_interpolant, _ode_interpolant!,
    accept_step_controller, DerivativeOrderNotPossibleError,
    get_fsalfirstlast
using SciMLBase: SciMLBase
import SciMLBase: alg_order, @def, _unwrap_val, du_cache, full_cache, u_cache
import MuladdMacro: @muladd
import FastBroadcast: @..
import LinearAlgebra: norm
import RecursiveArrayTools: recursivefill!, recursive_unitless_bottom_eltype,
    copyat_or_push!
using FastBroadcast: Serial
using DiffEqBase: @tight_loop_macros, calculate_residuals, calculate_residuals!
import DiffEqBase: prepare_alg, initialize!
import OrdinaryDiffEqCore

using Reexport: Reexport, @reexport
@reexport using SciMLBase

include("algorithms.jl")
include("alg_utils.jl")
include("low_order_rk_caches.jl")
include("low_order_rk_tableaus.jl")
include("interp_func.jl")
include("interpolants.jl")
include("low_order_rk_perform_step.jl")
include("low_order_rk_addsteps.jl")
include("split_perform_step.jl")
include("fixed_timestep_perform_step.jl")

export Euler, SplitEuler, Heun, Ralston, Midpoint, RK4,
    BS3, OwrenZen3, OwrenZen4, OwrenZen5, BS5,
    DP5, Anas5, RKO65, FRK65, RKM, MSRK5, MSRK6,
    PSRK4p7q6, PSRK3p5q4, PSRK3p6q5, Stepanov5, SIR54,
    Alshina2, Alshina3, Alshina6, AutoDP5,
    Ralston4

# Cross-sublibrary cache/tableau types that other OrdinaryDiffEq solver
# sublibraries (e.g. OrdinaryDiffEqAdamsBashforthMoulton) reference to reuse
# these low-order RK steps. Marked public so those references are recognized as
# a supported extension API rather than internal access.
@static if VERSION >= v"1.11.0-DEV.469"
    eval(
        Expr(
            :public,
            :BS3Cache, :BS3ConstantCache, :RK4Cache, :RK4ConstantCache
        )
    )
end

end
