Skip to content

Commit

Permalink
Merge pull request #93 from gridap/new_remote_extended_models_inherit…
Browse files Browse the repository at this point in the history
…_BC_labels

New remote extended models inherit bc labels
  • Loading branch information
ericneiva authored Jul 8, 2024
2 parents 056b5d6 + 11c45cd commit b66b235
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 4 deletions.
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

2 comments on commit b66b235

@ericneiva
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/110674

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.9.4 -m "<description of version>" b66b235f9873814ce25a615c71a2f2e7c5fed550
git push origin v0.9.4

Please sign in to comment.