@@ -63,10 +63,23 @@ function ParallelDynamicalSystem(ds::CoreDynamicalSystem, states::Vector{<:Abstr
6363 pds = CoupledODEs(prob, ds. diffeq; internalnorm = inorm)
6464 end
6565 M = ds isa CoupledODEs && isinplace(ds)
66- prob = referrenced_sciml_prob(ds)
66+ prob = referrenced_sciml_prob(ds)
6767 return ParallelDynamicalSystemAnalytic{typeof(pds), M}(pds, dynamic_rule(ds), prob)
6868end
6969
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+
7083function ParallelDynamicalSystem(ds:: CoreDynamicalSystem , mappings:: Vector{<:Dict} )
7184 # convert to vector of arrays:
7285 u = Array(current_state(ds))
@@ -164,6 +177,14 @@ function set_state!(pdsa::PDSAM, u::AbstractArray, i::Int = 1)
164177 return pdsa
165178end
166179
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+
167188# We make one more extension here: for continuous time, in place systems
168189# the state is a matrix (each column a parallel state) for performance.
169190# 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]
210231initial_states(pdtds:: PDTDS ) = [initial_state(ds) for ds in pdtds. systems]
211232
212233# 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
214235function set_state!(pdtds:: PDTDS , u, i:: Int = 1 )
215236 # We need to set state in all systems, in case this does
216237 # some kind of resetting, e.g., the `u_modified!` stuff.
0 commit comments