Skip to content

Commit

Permalink
Refactored a piece of code within a function which is going
Browse files Browse the repository at this point in the history
to be useful in other scenarios
  • Loading branch information
amartinhuertas committed Oct 17, 2023
1 parent e456035 commit c74589a
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/OctreeDistributedDiscreteModels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1230,11 +1230,9 @@ function Gridap.Adaptivity.refine(model::OctreeDistributedDiscreteModel{Dc,Dp};
end
end

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

Gridap.Helpers.@notimplementedif parts!=nothing
function _refine_coarsen_balance!(model::OctreeDistributedDiscreteModel{Dc,Dp},
refinement_and_coarsening_flags::MPIArray{<:Vector}) where {Dc,Dp}

# Variables which are updated accross calls to init_fn_callback_2d
current_quadrant_index_within_tree = Cint(0)
Expand Down Expand Up @@ -1430,6 +1428,16 @@ function Gridap.Adaptivity.adapt(model::OctreeDistributedDiscreteModel{Dc,Dp},
pXest_coarsen!(Val{Dc}, ptr_new_pXest, coarsen_fn_callback_c)
pXest_balance!(Val{Dc}, ptr_new_pXest)
pXest_update_flags!(Val{Dc},model.ptr_pXest,ptr_new_pXest)
ptr_new_pXest
end

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

Gridap.Helpers.@notimplementedif parts!=nothing

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 Down

0 comments on commit c74589a

Please sign in to comment.