Skip to content

Commit b66b235

Browse files
authored
Merge pull request #93 from gridap/new_remote_extended_models_inherit_BC_labels
New remote extended models inherit bc labels
2 parents 056b5d6 + 11c45cd commit b66b235

3 files changed

Lines changed: 59 additions & 4 deletions

File tree

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## Unreleased
88

9+
### Added
10+
- Missing distributed functions. Since PR [#92](https://github.com/gridap/GridapEmbedded.jl/pull/92).
11+
- Background models extended with remote ghosts inherit Cartesian labels. Since PR [#93](https://github.com/gridap/GridapEmbedded.jl/pull/93).
12+
913
### Fixed
1014
- Unused `name` keywork argument in `square` and `quadrilateral` analytical geometries. Since PR [#86](https://github.com/gridap/GridapEmbedded.jl/pull/86).
1115
- Gluing of the remote root cells to the local+ghost mesh. Since PR [#91](https://github.com/gridap/GridapEmbedded.jl/pull/91).

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "GridapEmbedded"
22
uuid = "8838a6a3-0006-4405-b874-385995508d5d"
33
authors = ["Francesc Verdugo <f.verdugo.rojano@vu.nl>", "Eric Neiva <eric.neiva@college-de-france.fr>", "Pere Antoni Martorell <pere.antoni.martorell@upc.edu>", "Santiago Badia <santiago.badia@monash.edu>"]
4-
version = "0.9.3"
4+
version = "0.9.4"
55

66
[deps]
77
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"

src/Distributed/DistributedAgFEM.jl

Lines changed: 54 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -371,10 +371,61 @@ function add_remote_cells(model::DistributedDiscreteModel,remote_cells,remote_pa
371371

372372
# Build appended model
373373
lgrids = map(get_grid,local_views(model))
374-
grids = map(lazy_append,lgrids,rgrids)
375-
models = map(UnstructuredDiscreteModel,grids)
374+
_grids = map(lazy_append,lgrids,rgrids)
375+
_models = map(UnstructuredDiscreteModel,_grids)
376376
agids = add_remote_ids(gids,remote_cells,remote_parts)
377-
DistributedDiscreteModel(models,agids) |> merge_nodes
377+
amodel = DistributedDiscreteModel(_models,agids) |> merge_nodes
378+
379+
D = num_cell_dims(model)
380+
grids = map(get_grid,local_views(amodel))
381+
topos = map(get_grid_topology,local_views(amodel))
382+
d_to_dface_to_entity = map(topos) do topo
383+
[ fill(Int32(UNSET),num_faces(topo,d)) for d in 0:D ]
384+
end
385+
oldtopos = map(get_grid_topology,local_views(model))
386+
oldlabels = map(get_face_labeling,local_views(model))
387+
for d in 0:D
388+
_fill_labels!(d_to_dface_to_entity,
389+
oldlabels,
390+
oldtopos,
391+
topos,
392+
ncells,
393+
d,D,
394+
snd_lids,
395+
rgraph)
396+
end
397+
labels = map(d_to_dface_to_entity,oldlabels) do d_to_dface_to_entity,ol
398+
FaceLabeling(d_to_dface_to_entity,ol.tag_to_entities,ol.tag_to_name)
399+
end
400+
models = map(UnstructuredDiscreteModel,grids,topos,labels)
401+
DistributedDiscreteModel(models,agids)
402+
end
403+
404+
function _fill_labels!(d_to_dface_to_entity,llabels,ltopos,ntopos,nremotes,
405+
d::Int,D::Int,snd_lids,rgraph)
406+
snd_labels = map(ltopos,llabels,snd_lids) do topo,labels,lids
407+
dface_to_entity = get_face_entity(labels,d)
408+
T = eltype(eltype(dface_to_entity))
409+
labels = map(lids) do lids
410+
faces = map(Reindex(get_faces(topo,D,d)),lids)
411+
labels = map(Reindex(dface_to_entity),faces)
412+
reduce(append!,labels,init=T[])
413+
end
414+
Vector{Vector{T}}(labels)
415+
end
416+
rcv_labels = allocate_exchange(snd_labels,rgraph)
417+
exchange!(rcv_labels,snd_labels,rgraph) |> wait
418+
rlabels = map(PartitionedArrays.getdata,rcv_labels)
419+
map(d_to_dface_to_entity,llabels) do d_to_dface_to_entity,l
420+
l_face_entity = get_face_entity(l,d)
421+
d_to_dface_to_entity[d+1][1:length(l_face_entity)] = l_face_entity
422+
end
423+
map(d_to_dface_to_entity,ntopos,nremotes,rlabels) do d_to_dface_to_entity,nt,nr,r
424+
nr > 0 && begin
425+
rf = reduce(vcat,get_faces(nt,D,d)[end-nr+1:end])
426+
d_to_dface_to_entity[d+1][rf] = r
427+
end
428+
end
378429
end
379430

380431
function add_remote_aggregates(model::DistributedDiscreteModel,aggregates,aggregate_owner)

0 commit comments

Comments
 (0)