Skip to content

Commit bb45545

Browse files
Merge pull request #2865 from ChrisRackauckas-Claude/add-woperator-copy-method
Add copy method for WOperator
2 parents 4051c26 + 262c57c commit bb45545

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lib/OrdinaryDiffEqDifferentiation/src/derivative_utils.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,17 @@ mutable struct WOperator{IIP, T,
323323
_func_cache, _concrete_form,
324324
jacvec)
325325
end
326+
327+
function Base.copy(W::WOperator{IIP, T, MType, GType, JType, F, C, JV}) where {IIP, T, MType, GType, JType, F, C, JV}
328+
return new{IIP, T, MType, GType, JType, F, C, JV}(
329+
W.mass_matrix,
330+
W.gamma,
331+
W.J,
332+
W._func_cache === nothing ? nothing : copy(W._func_cache),
333+
W._concrete_form === nothing ? nothing : copy(W._concrete_form),
334+
W.jacvec
335+
)
336+
end
326337
end
327338
function WOperator{IIP}(f::F, u, gamma) where {IIP, F}
328339
if isa(f, Union{SplitFunction, DynamicalODEFunction})

0 commit comments

Comments
 (0)