Skip to content

Commit

Permalink
Added subpackages of original OrdinaryDiffEq. Also had to define type…
Browse files Browse the repository at this point in the history
…-specific versions of get_fsalfirstlast for each mutable cache type
  • Loading branch information
jdeldre committed Aug 29, 2024
1 parent 7b21639 commit 2bd0c62
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 11 deletions.
8 changes: 6 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,24 @@ version = "0.3.7"

[deps]
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e"
IterativeSolvers = "42fd0dbc-a981-5370-80f2-aaf504508153"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
LinearMaps = "7a12625a-238d-50fd-b39a-03d52299707e"
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8"
OrdinaryDiffEqTsit5 = "b1df2697-797e-41e3-8120-5422d3b24e4a"
PkgBenchmark = "32113eaa-f34f-5b0d-bd6c-c81e245fc73d"
RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"

[compat]
BenchmarkTools = "0.5, 1"
DiffEqBase = "6.154"
IterativeSolvers = "0.9"
LinearAlgebra = "1.6"
LinearMaps = "^2.4, 3.2, 3.3"
OrdinaryDiffEq = "6.50"
OrdinaryDiffEqCore = "1.3"
OrdinaryDiffEqTsit5 = "1.1"
PkgBenchmark = "0.2.10"
RecursiveArrayTools = "2.2 - 2.38.5, 2.38.6, 3"
Reexport = "0.2.0, 1.0"
Expand Down
12 changes: 7 additions & 5 deletions src/ConstrainedSystems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@ using RecursiveArrayTools
#using IterativeSolvers
#using UnPack
using Reexport
@reexport using OrdinaryDiffEq
#@reexport using OrdinaryDiffEq
@reexport using OrdinaryDiffEqCore
@reexport using OrdinaryDiffEqTsit5

import OrdinaryDiffEq: OrdinaryDiffEqAlgorithm, alg_order, alg_cache,
import OrdinaryDiffEqCore: OrdinaryDiffEqAlgorithm, alg_order, alg_cache,
OrdinaryDiffEqMutableCache, OrdinaryDiffEqConstantCache,
initialize!, perform_step!, @muladd, @unpack, constvalue,
full_cache, @..
initialize!, perform_step!, constvalue,
full_cache, get_fsalfirstlast, @muladd, @unpack, @..


import OrdinaryDiffEq.DiffEqBase: AbstractDiffEqLinearOperator,
import DiffEqBase: AbstractDiffEqLinearOperator,
DEFAULT_UPDATE_FUNC, has_exp,
AbstractODEFunction, isinplace, numargs

Expand Down
3 changes: 3 additions & 0 deletions src/timemarching/algorithms.jl
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ end

#######

get_fsalfirstlast(cache::LiskaIFHERKCache, u) = (cache.fsalfirst, cache.k)
function initialize!(integrator,cache::LiskaIFHERKCache)
@unpack k,fsalfirst = cache

Expand Down Expand Up @@ -529,6 +530,7 @@ end

####

get_fsalfirstlast(cache::IFHEEulerCache, u) = (cache.fsalfirst, cache.k)
function initialize!(integrator,cache::IFHEEulerCache)
@unpack k,fsalfirst = cache

Expand Down Expand Up @@ -663,6 +665,7 @@ end

#### Half-explicit Trapezoidal/Adams-Bashforth 2 (HETrapezoidalAB2) ####

get_fsalfirstlast(cache::HETrapezoidalAB2Cache, u) = (cache.fsalfirst, cache.k)
function initialize!(integrator,cache::HETrapezoidalAB2Cache)
@unpack ki,k,fsalfirst = cache

Expand Down
2 changes: 1 addition & 1 deletion src/timemarching/misc_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ end
#@inline UNITLESS_ABS2(x::AbstractArray) = (isempty(x) && return sum(UNITLESS_ABS2,zero(eltype(x))); sum(UNITLESS_ABS2, x))

# A workaround that avoids redefinition
import OrdinaryDiffEq.DiffEqBase: UNITLESS_ABS2, ODE_DEFAULT_NORM, recursive_length
import DiffEqBase: UNITLESS_ABS2, ODE_DEFAULT_NORM, recursive_length
@inline MY_UNITLESS_ABS2(x::Number) = abs2(x)
@inline MY_UNITLESS_ABS2(x::AbstractArray) = (isempty(x) && return sum(MY_UNITLESS_ABS2,zero(eltype(x))); sum(MY_UNITLESS_ABS2, x))
@inline MY_UNITLESS_ABS2(x::ArrayPartition) = sum(MY_UNITLESS_ABS2, x.x)
Expand Down
6 changes: 3 additions & 3 deletions src/timemarching/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ DEFAULT_PARAM_UPDATE_FUNC(u,p,t) = p


### Abstract algorithms ###
abstract type ConstrainedOrdinaryDiffEqAlgorithm <: OrdinaryDiffEq.OrdinaryDiffEqAlgorithm end
abstract type ConstrainedOrdinaryDiffEqAlgorithm <: OrdinaryDiffEqCore.OrdinaryDiffEqAlgorithm end

### Abstract caches ###
# The sc parameter specifies whether it contains static constraint operators or not
# If false, then it expects that the state vector contains a component for updating the opertors
abstract type ConstrainedODEMutableCache{sc,solverType} <: OrdinaryDiffEqMutableCache end
abstract type ConstrainedODEConstantCache{sc,solverType} <: OrdinaryDiffEqConstantCache end
abstract type ConstrainedODEMutableCache{sc,solverType} <: OrdinaryDiffEqCore.OrdinaryDiffEqMutableCache end
abstract type ConstrainedODEConstantCache{sc,solverType} <: OrdinaryDiffEqCore.OrdinaryDiffEqConstantCache end


#### Operator and function types ####
Expand Down

0 comments on commit 2bd0c62

Please sign in to comment.