From faf6c9b64949a76dc75ec8c2b860f163fa9ea774 Mon Sep 17 00:00:00 2001 From: Ricardo Rosa Date: Wed, 17 Aug 2022 07:48:50 -0300 Subject: [PATCH 1/3] ignore vscode stuff --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 3f02ca7..ce8b343 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,7 @@ *.jl.*.cov *.jl.mem Manifest.toml + +# vscode stuff +.vscode +.vscode/* \ No newline at end of file From 382d81cea298d692408607068dfd9373b91cc181 Mon Sep 17 00:00:00 2001 From: Ricardo Rosa Date: Wed, 17 Aug 2022 08:31:27 -0300 Subject: [PATCH 2/3] add reinit! to NoiseFunction --- src/noise_interfaces/common.jl | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/noise_interfaces/common.jl b/src/noise_interfaces/common.jl index e34fc92..c7a5141 100644 --- a/src/noise_interfaces/common.jl +++ b/src/noise_interfaces/common.jl @@ -75,6 +75,32 @@ function DiffEqBase.reinit!(W::AbstractNoiseProcess, dt; return nothing end +function DiffEqBase.reinit!(W::NoiseFunction, dt; + t0 = zero(W.curt), + erase_sol = true, + setup_next = false) + W.curt = t0 + W.dt = dt + + if isinplace(W) + W.curW .= first(W(t0)) + W.dW .= W.curW + if W.Z !== nothing + W.curZ .= last(W(t0)) + W.dZ .= W.curZ + end + else + W.curW = first(W(t0)) + W.dW = W.curW + if W.Z !== nothing + W.curZ = last(W(t0)) + W.dZ = W.curZ + end + end + + return nothing +end + function Base.reverse(W::AbstractNoiseProcess) if typeof(W) <: NoiseGrid if W.Z === nothing From 510eeb3b89d4621f2bac19133dc21cd51e5d14d5 Mon Sep 17 00:00:00 2001 From: Ricardo Rosa Date: Wed, 17 Aug 2022 10:14:09 -0300 Subject: [PATCH 3/3] `t0` and `reinit!` for `NoiseFunction` --- src/noise_interfaces/common.jl | 2 +- src/types.jl | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/noise_interfaces/common.jl b/src/noise_interfaces/common.jl index c7a5141..68c982d 100644 --- a/src/noise_interfaces/common.jl +++ b/src/noise_interfaces/common.jl @@ -76,7 +76,7 @@ function DiffEqBase.reinit!(W::AbstractNoiseProcess, dt; end function DiffEqBase.reinit!(W::NoiseFunction, dt; - t0 = zero(W.curt), + t0 = W.t0, erase_sol = true, setup_next = false) W.curt = t0 diff --git a/src/types.jl b/src/types.jl index 8849f99..8ca7bd6 100644 --- a/src/types.jl +++ b/src/types.jl @@ -542,6 +542,7 @@ mutable struct NoiseFunction{T, N, wType, zType, Tt, T2, T3, inplace} <: dt::Tt dW::T2 dZ::T3 + t0::Tt reset::Bool function NoiseFunction{iip}(t0, W, Z = nothing; @@ -560,7 +561,7 @@ mutable struct NoiseFunction{T, N, wType, zType, Tt, T2, T3, inplace} <: end new{typeof(noise_prototype), ndims(noise_prototype), typeof(W), typeof(Z), typeof(curt), typeof(curW), typeof(curZ), iip}(W, Z, curt, curW, curZ, - dt, dW, dZ, reset) + dt, dW, dZ, t0, reset) end end