feat: dynamic simulation accepts a vector of workers to compute on
[skip ci]
This commit is contained in:
parent
39eacff904
commit
3f7163e0af
@ -26,14 +26,18 @@ struct DynamicSimulation{T} <: AbstractSimulation{T}
|
|||||||
iterations::Int
|
iterations::Int
|
||||||
timestep::T
|
timestep::T
|
||||||
|
|
||||||
|
workerPool::WorkerPool
|
||||||
|
|
||||||
function DynamicSimulation(
|
function DynamicSimulation(
|
||||||
grid::Grid{T},
|
grid::Grid{T},
|
||||||
bc::Boundary{T},
|
bc::Boundary{T},
|
||||||
approach::APPROACH,
|
approach::APPROACH,
|
||||||
timestep::T,
|
timestep::T,
|
||||||
|
workers::Vector{Int}=workers(),
|
||||||
)::DynamicSimulation{T} where {T}
|
)::DynamicSimulation{T} where {T}
|
||||||
timestep, iterations = adjustTimestep(grid, approach, timestep, 1, false)
|
timestep, iterations = adjustTimestep(grid, approach, timestep, 1, false)
|
||||||
new{T}(grid, Vector{Grid{T}}(), bc, approach, iterations, timestep)
|
workerPool = WorkerPool(workers)
|
||||||
|
new{T}(grid, Vector{Grid{T}}(), bc, approach, iterations, timestep, workerPool)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -66,7 +70,8 @@ Runs the simulation for all grid states in parallel.
|
|||||||
Nothing, but updates all grids in the simulation according to the defined approach and iterations.
|
Nothing, but updates all grids in the simulation according to the defined approach and iterations.
|
||||||
"""
|
"""
|
||||||
function next(simulation::DynamicSimulation{T})::Nothing where {T}
|
function next(simulation::DynamicSimulation{T})::Nothing where {T}
|
||||||
pmap(grid -> runSimulationForGrid(simulation, grid), simulation.grids)
|
pmap(grid -> runSimulationForGrid(simulation, grid), simulation.workerPool, simulation.grids)
|
||||||
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user