Skip to content

Commit

Permalink
Merge pull request #54 from gridap/adapt_for_general_integers
Browse files Browse the repository at this point in the history
Changed the signature of .adapt() s.t. it accepts any Integer and not necessarily Cint, as per required by p4est
  • Loading branch information
amartinhuertas authored Nov 18, 2023
2 parents ea6a9a0 + a5b7ae9 commit aae4b59
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 7 additions & 3 deletions src/OctreeDistributedDiscreteModels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1432,12 +1432,16 @@ function _refine_coarsen_balance!(model::OctreeDistributedDiscreteModel{Dc,Dp},
end

function Gridap.Adaptivity.adapt(model::OctreeDistributedDiscreteModel{Dc,Dp},
refinement_and_coarsening_flags::MPIArray{<:Vector{Cint}};
refinement_and_coarsening_flags::MPIArray{<:Vector{<:Integer}};
parts=nothing) where {Dc,Dp}

Gridap.Helpers.@notimplementedif parts!=nothing

_refinement_and_coarsening_flags = map(refinement_and_coarsening_flags) do flags
convert(Vector{Cint},flags)
end

ptr_new_pXest = _refine_coarsen_balance!(model, refinement_and_coarsening_flags)
ptr_new_pXest = _refine_coarsen_balance!(model, _refinement_and_coarsening_flags)

# Extract ghost and lnodes
ptr_pXest_ghost = setup_pXest_ghost(Val{Dc}, ptr_new_pXest)
Expand All @@ -1457,7 +1461,7 @@ function Gridap.Adaptivity.adapt(model::OctreeDistributedDiscreteModel{Dc,Dp},
adaptivity_glue = _compute_fine_to_coarse_model_glue(model.parts,
model.dmodel,
fmodel,
refinement_and_coarsening_flags)
_refinement_and_coarsening_flags)
adaptive_models = map(local_views(model),
local_views(fmodel),
adaptivity_glue) do model, fmodel, glue
Expand Down
4 changes: 2 additions & 2 deletions test/PoissonNonConformingOctreeModelsTests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ module PoissonNonConformingOctreeModelsTests
reffe=ReferenceFE(lagrangian,T,order)
VH=FESpace(dmodel,reffe;dirichlet_tags="boundary")
UH=TrialFESpace(VH,u)
ref_coarse_flags=map(ranks,partition(get_cell_gids(dmodel.dmodel))) do rank,indices
ref_coarse_flags=map(ranks,partition(get_cell_gids(dmodel.dmodel))) do rank,indices
flags=zeros(Cint,length(indices))
flags.=nothing_flag

Expand Down Expand Up @@ -176,7 +176,7 @@ module PoissonNonConformingOctreeModelsTests

degree = 2*order+1
ref_coarse_flags=map(ranks,partition(get_cell_gids(dmodel.dmodel))) do rank,indices
flags=zeros(Cint,length(indices))
flags=zeros(Int,length(indices))
flags.=nothing_flag
if (rank==1)
flags[1:2^Dc].=coarsen_flag
Expand Down

2 comments on commit aae4b59

@amartinhuertas
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/95585

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.3.3 -m "<description of version>" aae4b5902f803f3528abb3bd73411fb3b7216b81
git push origin v0.3.3

Please sign in to comment.