Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New remote extended models inherit bc labels #93

Merged
merged 3 commits into from
Jul 8, 2024
Merged
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
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

### Added
- Missing distributed functions. Since PR [#92](https://github.com/gridap/GridapEmbedded.jl/pull/92).
- Background models extended with remote ghosts inherit Cartesian labels. Since PR [#93](https://github.com/gridap/GridapEmbedded.jl/pull/93).

### Fixed
- Unused `name` keywork argument in `square` and `quadrilateral` analytical geometries. Since PR [#86](https://github.com/gridap/GridapEmbedded.jl/pull/86).
- Gluing of the remote root cells to the local+ghost mesh. Since PR [#91](https://github.com/gridap/GridapEmbedded.jl/pull/91).
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "GridapEmbedded"
uuid = "8838a6a3-0006-4405-b874-385995508d5d"
authors = ["Francesc Verdugo <[email protected]>", "Eric Neiva <[email protected]>", "Pere Antoni Martorell <[email protected]>", "Santiago Badia <[email protected]>"]
version = "0.9.3"
version = "0.9.4"

[deps]
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
Expand Down
57 changes: 54 additions & 3 deletions src/Distributed/DistributedAgFEM.jl
Original file line number Diff line number Diff line change
Expand Up @@ -371,10 +371,61 @@ function add_remote_cells(model::DistributedDiscreteModel,remote_cells,remote_pa

# Build appended model
lgrids = map(get_grid,local_views(model))
grids = map(lazy_append,lgrids,rgrids)
models = map(UnstructuredDiscreteModel,grids)
_grids = map(lazy_append,lgrids,rgrids)
_models = map(UnstructuredDiscreteModel,_grids)
agids = add_remote_ids(gids,remote_cells,remote_parts)
DistributedDiscreteModel(models,agids) |> merge_nodes
amodel = DistributedDiscreteModel(_models,agids) |> merge_nodes

D = num_cell_dims(model)
grids = map(get_grid,local_views(amodel))
topos = map(get_grid_topology,local_views(amodel))
d_to_dface_to_entity = map(topos) do topo
[ fill(Int32(UNSET),num_faces(topo,d)) for d in 0:D ]
end
oldtopos = map(get_grid_topology,local_views(model))
oldlabels = map(get_face_labeling,local_views(model))
for d in 0:D
_fill_labels!(d_to_dface_to_entity,
oldlabels,
oldtopos,
topos,
ncells,
d,D,
snd_lids,
rgraph)
end
labels = map(d_to_dface_to_entity,oldlabels) do d_to_dface_to_entity,ol
FaceLabeling(d_to_dface_to_entity,ol.tag_to_entities,ol.tag_to_name)
end
models = map(UnstructuredDiscreteModel,grids,topos,labels)
DistributedDiscreteModel(models,agids)
end

function _fill_labels!(d_to_dface_to_entity,llabels,ltopos,ntopos,nremotes,
d::Int,D::Int,snd_lids,rgraph)
snd_labels = map(ltopos,llabels,snd_lids) do topo,labels,lids
dface_to_entity = get_face_entity(labels,d)
T = eltype(eltype(dface_to_entity))
labels = map(lids) do lids
faces = map(Reindex(get_faces(topo,D,d)),lids)
labels = map(Reindex(dface_to_entity),faces)
reduce(append!,labels,init=T[])
end
Vector{Vector{T}}(labels)
end
rcv_labels = allocate_exchange(snd_labels,rgraph)
exchange!(rcv_labels,snd_labels,rgraph) |> wait
rlabels = map(PartitionedArrays.getdata,rcv_labels)
map(d_to_dface_to_entity,llabels) do d_to_dface_to_entity,l
l_face_entity = get_face_entity(l,d)
d_to_dface_to_entity[d+1][1:length(l_face_entity)] = l_face_entity
end
map(d_to_dface_to_entity,ntopos,nremotes,rlabels) do d_to_dface_to_entity,nt,nr,r
nr > 0 && begin
rf = reduce(vcat,get_faces(nt,D,d)[end-nr+1:end])
d_to_dface_to_entity[d+1][rf] = r
end
end
end

function add_remote_aggregates(model::DistributedDiscreteModel,aggregates,aggregate_owner)
Expand Down
Loading