@@ -63,10 +63,23 @@ function ParallelDynamicalSystem(ds::CoreDynamicalSystem, states::Vector{<:Abstr
63
63
pds = CoupledODEs (prob, ds. diffeq; internalnorm = inorm)
64
64
end
65
65
M = ds isa CoupledODEs && isinplace (ds)
66
- prob = referrenced_sciml_prob (ds)
66
+ prob = referrenced_sciml_prob (ds)
67
67
return ParallelDynamicalSystemAnalytic {typeof(pds), M} (pds, dynamic_rule (ds), prob)
68
68
end
69
69
70
+ function ParallelDynamicalSystem (smap:: StroboscopicMap ,states)
71
+ f, st = parallel_rule (smap. ds, states)
72
+ T = eltype (first (st))
73
+ prob = ODEProblem {true} (f, st, (T (initial_time (smap)), T (Inf )), current_parameters (smap))
74
+ inorm = prob. u0 isa Matrix ? matrixnorm : vectornorm
75
+ cont_pds = CoupledODEs (prob, smap. ds. diffeq; internalnorm = inorm)
76
+ pds = StroboscopicMap (cont_pds,smap. period)
77
+
78
+ M = smap. ds isa CoupledODEs && isinplace (smap. ds)
79
+ prob = referrenced_sciml_prob (smap. ds)
80
+ return ParallelDynamicalSystemAnalytic {typeof(pds), M} (pds, dynamic_rule (smap), prob)
81
+ end
82
+
70
83
function ParallelDynamicalSystem (ds:: CoreDynamicalSystem , mappings:: Vector{<:Dict} )
71
84
# convert to vector of arrays:
72
85
u = Array (current_state (ds))
@@ -164,6 +177,14 @@ function set_state!(pdsa::PDSAM, u::AbstractArray, i::Int = 1)
164
177
return pdsa
165
178
end
166
179
180
+
181
+ function set_state! (pdsa:: PDSAM{<: StroboscopicMap} , u:: AbstractArray , i:: Int = 1 )
182
+ current_state (pdsa, i) .= u
183
+ u_modified! (pdsa. ds. ds. integ, true )
184
+ return pdsa
185
+ end
186
+
187
+
167
188
# We make one more extension here: for continuous time, in place systems
168
189
# the state is a matrix (each column a parallel state) for performance.
169
190
# re-init will not work because there is no way to do the recursive copy. we do it ourselves
@@ -210,7 +231,7 @@ current_states(pdtds::PDTDS) = [current_state(ds) for ds in pdtds.systems]
210
231
initial_states (pdtds:: PDTDS ) = [initial_state (ds) for ds in pdtds. systems]
211
232
212
233
# Set stuff
213
- set_parameter! (pdtds:: PDTDS ) = for ds in pdtds. systems; set_parameter! (ds, args ... ); end
234
+ set_parameter! (pdtds:: PDTDS ,index,value ) = for ds in pdtds. systems; set_parameter! (ds, index,value ); end
214
235
function set_state! (pdtds:: PDTDS , u, i:: Int = 1 )
215
236
# We need to set state in all systems, in case this does
216
237
# some kind of resetting, e.g., the `u_modified!` stuff.
0 commit comments