From 781ab9a1dac62f526a56b24baeb7175ed94e2de0 Mon Sep 17 00:00:00 2001 From: Pere Antoni Martorell Date: Thu, 1 Aug 2024 13:57:28 +0200 Subject: [PATCH] adding redistribute flags and adaptive weights --- src/Distributed/DistributedDiscretizations.jl | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/src/Distributed/DistributedDiscretizations.jl b/src/Distributed/DistributedDiscretizations.jl index 6e42bc6..08816f3 100644 --- a/src/Distributed/DistributedDiscretizations.jl +++ b/src/Distributed/DistributedDiscretizations.jl @@ -339,3 +339,56 @@ function remove_ghost_subfacets(cut::EmbeddedFacetDiscretization,facet_gids) cut.oid_to_ls, cut.geo) end + +function compute_redistribute_wights( + cut::DistributedEmbeddedDiscretization, + args...) + + geo = get_geometry(cut) + compute_redistribute_wights(cut,geo,args...) +end + +function compute_redistribute_wights( + cut::DistributedEmbeddedDiscretization, + geo::CSG.Geometry, + args...) + + compute_redistribute_wights(compute_bgcell_to_inoutcut(cut,geo),args...) +end + +function compute_redistribute_wights(cell_to_inoutcut,in_or_out=IN) + map(cell_to_inoutcut) do cell_to_inoutcut + map(cell_to_inoutcut) do inoutcut + Int( inoutcut ∈ (CUT,in_or_out) ) + end + end +end + +function compute_adaptive_flags( + cut::DistributedEmbeddedDiscretization, + args...) + + geo = get_geometry(cut) + compute_adaptive_flags(cut,geo,args...) +end + +function compute_adaptive_flags( + cut::DistributedEmbeddedDiscretization, + geo::CSG.Geometry, + args...) + + compute_adaptive_flags(compute_bgcell_to_inoutcut(cut,geo),args...) +end + +function compute_adaptive_flags(cell_to_inoutcut) + map(cell_to_inoutcut) do c_to_ioc + flags = zeros(Cint,length(c_to_ioc)) + flags .= nothing_flag + for (c,ioc) in enumerate(c_to_ioc) + if ioc == CUT + flags[c] = refine_flag + end + end + flags + end +end