Skip to content

Commit

Permalink
Changed the signature of .adapt() s.t. it accepts any Integer and not
Browse files Browse the repository at this point in the history
necessarily Cint, as per required by p4est
  • Loading branch information
amartinhuertas committed Nov 18, 2023
1 parent ea6a9a0 commit a5b7ae9
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

0 comments on commit a5b7ae9

Please sign in to comment.