diff --git a/src/Grids.jl b/src/Grids.jl index 9c99b00..26f00bf 100644 --- a/src/Grids.jl +++ b/src/Grids.jl @@ -1090,31 +1090,37 @@ function get_tiled_cellranges(model::PB.Model, ntiles::Int, interior_domain_name interior_domain = PB.get_domain(model, interior_domain_name) interior_cellranges = cellrange_cartesiantile(interior_domain, interior_domain.grid, ntiles, operatorID=operatorID) + io = IOBuffer() + println(io, "get_tiled_cellranges:") + cellranges = [] # vector of vectors, 1 per tile for it in 1:ntiles - println("creating CellRanges for tile $it") + println(io, " creating CellRanges for tile $it") tcellranges = [] push!(tcellranges, interior_cellranges[it]) for dom in model.domains if !isnothing(dom.grid) && dom != interior_domain push!(tcellranges, cellrange_from_columns(dom, dom.grid, interior_cellranges[it])) - println(" add CellRange for domain $(dom.name) length $(length(last(tcellranges).indices))") + println(io, " add CellRange for domain $(dom.name) length $(length(last(tcellranges).indices))") end end push!(cellranges, tcellranges) end # create cellranges for scalar Domains cellrangesscalar = [] - @info "creating CellRanges for scalar domains" + println(io, " creating CellRanges for scalar domains") for dom in model.domains if isnothing(dom.grid) push!(cellrangesscalar, create_default_cellrange(dom, dom.grid, operatorID=operatorID)) - @info " added CellRange for scalar domain $(dom.name)" + println(io, " added CellRange for scalar domain $(dom.name)") end end - @info "adding CellRanges for scalar domains to first tile" + println(io, " adding CellRanges for scalar domains to first tile") + append!(first(cellranges), cellrangesscalar) + @info String(take!(io)) + return cellranges end diff --git a/src/Model.jl b/src/Model.jl index 34e5dde..29b35e0 100644 --- a/src/Model.jl +++ b/src/Model.jl @@ -717,7 +717,9 @@ end function _dispatch_cellranges(@nospecialize(method::AbstractReactionMethod), cellranges) if is_do_barrier(method) - return (nothing, ) + operatorID = method.operatorID + any_cellranges = any((cr.operatorID == 0 || cr.operatorID in operatorID) for cr in cellranges) + return any_cellranges ? (nothing, ) : () else domain = method.domain operatorID = method.operatorID diff --git a/src/reactionmethods/SetupInitializeUtilityMethods.jl b/src/reactionmethods/SetupInitializeUtilityMethods.jl index 89ee9c0..e2bad36 100644 --- a/src/reactionmethods/SetupInitializeUtilityMethods.jl +++ b/src/reactionmethods/SetupInitializeUtilityMethods.jl @@ -222,11 +222,11 @@ function do_method_barrier(m::ReactionMethod, _, _, _) end """ - reaction_method_thread_barrier(barrier) + reaction_method_thread_barrier(barrier, barrierfn; [operatorID=[1]]) Create a ReactionMethod holding a thread barrier `barrier`. """ -function reaction_method_thread_barrier(barrier, barrierfn) +function reaction_method_thread_barrier(barrier, barrierfn; operatorID=[1]) return ReactionMethod( do_method_barrier, @@ -234,7 +234,7 @@ function reaction_method_thread_barrier(barrier, barrierfn) "thread_barrier", (VarList_nothing(),), (barrier, barrierfn), # p - [-1], + operatorID, Domain(name="thread_barrier", ID=-1, parameters=Dict{String, Any}()), ) end