From a5b7ae96167c3065ac6fbb1d9d7e9149e8f92018 Mon Sep 17 00:00:00 2001 From: "Alberto F. Martin" Date: Sat, 18 Nov 2023 23:35:39 +1100 Subject: [PATCH] Changed the signature of .adapt() s.t. it accepts any Integer and not necessarily Cint, as per required by p4est --- src/OctreeDistributedDiscreteModels.jl | 10 +++++++--- test/PoissonNonConformingOctreeModelsTests.jl | 4 ++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/OctreeDistributedDiscreteModels.jl b/src/OctreeDistributedDiscreteModels.jl index 8e6be90..193ffbd 100644 --- a/src/OctreeDistributedDiscreteModels.jl +++ b/src/OctreeDistributedDiscreteModels.jl @@ -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) @@ -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 diff --git a/test/PoissonNonConformingOctreeModelsTests.jl b/test/PoissonNonConformingOctreeModelsTests.jl index 4b32b05..4cb62bd 100644 --- a/test/PoissonNonConformingOctreeModelsTests.jl +++ b/test/PoissonNonConformingOctreeModelsTests.jl @@ -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 @@ -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