Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/DomainBuffers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,11 @@ Return new buffer(s) that are coupled with the buffers provided as keyword argum
match.
"""
function couple_buffers(dbs::DomainBuffers; kwargs...)
return Dict(key => couple_buffers(db; (k => v[key] for (k, v) in kwargs)...) for (key, db) in dbs)
return Dict(
key => (all(haskey(v, key) for (_, v) in kwargs) ?
couple_buffers(db; (k => v[key] for (k, v) in kwargs)...) :
db) for (key, db) in dbs)
#return Dict(key => couple_buffers(db; (k => v[key] for (k, v) in kwargs)...) for (key, db) in dbs)
end

"""
Expand Down
12 changes: 10 additions & 2 deletions src/Simulation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,13 @@ end
CoupledSimulations(; kwargs...) = CoupledSimulations(NamedTuple{keys(kwargs)}(values(kwargs)))

function get_domain_simulation(cs::CoupledSimulations, name::String)
return CoupledSimulations(map(s -> get_domain_simulation(s, name), cs.sims))
end
# Need to return a named tuple with only the simulations that have a domain called `name`
sims = Pair{Symbol, Simulation}[]
for (key, sim) in zip(keys(cs.sims), values(cs.sims))
if haskey(sim.db, name)
push!(sims, key => get_domain_simulation(sim, name))
end
end
return CoupledSimulations(NamedTuple(sims))
# return CoupledSimulations(map(s -> get_domain_simulation(s, name), cs.sims))
end