Skip to content

Commit 134b905

Browse files
authored
Merge pull request #95 from pmartorell/add_p4est_functions
Adding redistribute flags and adaptive weights
2 parents d579786 + 1185b7d commit 134b905

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

NEWS.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [Unreleased]
8+
9+
### Added
10+
11+
- Adding `compute_redistribute_weights` and `compute_adaptive_flags` functions for load balancing and adaptive mesh refinement, respectively. Since PR [#95](https://github.com/gridap/GridapEmbedded.jl/pull/95).
12+
13+
714
## [0.9.4] - 2024-07-09
815

916
### Added

src/Distributed/DistributedDiscretizations.jl

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,3 +339,56 @@ function remove_ghost_subfacets(cut::EmbeddedFacetDiscretization,facet_gids)
339339
cut.oid_to_ls,
340340
cut.geo)
341341
end
342+
343+
function compute_redistribute_wights(
344+
cut::DistributedEmbeddedDiscretization,
345+
args...)
346+
347+
geo = get_geometry(cut)
348+
compute_redistribute_wights(cut,geo,args...)
349+
end
350+
351+
function compute_redistribute_wights(
352+
cut::DistributedEmbeddedDiscretization,
353+
geo::CSG.Geometry,
354+
args...)
355+
356+
compute_redistribute_wights(compute_bgcell_to_inoutcut(cut,geo),args...)
357+
end
358+
359+
function compute_redistribute_wights(cell_to_inoutcut,in_or_out=IN)
360+
map(cell_to_inoutcut) do cell_to_inoutcut
361+
map(cell_to_inoutcut) do inoutcut
362+
Int( inoutcut (CUT,in_or_out) )
363+
end
364+
end
365+
end
366+
367+
function compute_adaptive_flags(
368+
cut::DistributedEmbeddedDiscretization,
369+
args...)
370+
371+
geo = get_geometry(cut)
372+
compute_adaptive_flags(cut,geo,args...)
373+
end
374+
375+
function compute_adaptive_flags(
376+
cut::DistributedEmbeddedDiscretization,
377+
geo::CSG.Geometry,
378+
args...)
379+
380+
compute_adaptive_flags(compute_bgcell_to_inoutcut(cut,geo),args...)
381+
end
382+
383+
function compute_adaptive_flags(cell_to_inoutcut)
384+
map(cell_to_inoutcut) do c_to_ioc
385+
flags = zeros(Cint,length(c_to_ioc))
386+
flags .= nothing_flag
387+
for (c,ioc) in enumerate(c_to_ioc)
388+
if ioc == CUT
389+
flags[c] = refine_flag
390+
end
391+
end
392+
flags
393+
end
394+
end

0 commit comments

Comments
 (0)