@@ -771,6 +771,27 @@ function trivial_partition(ranks,n;destination=MAIN)
771771 partition_in_main
772772end
773773
774+ function renumber_partition (partition_in)
775+ own_ids = map (own_to_global,partition_in)
776+ if eltype (own_ids) <: BlockPartitionOwnToGlobal{1}
777+ return partition_in
778+ end
779+ n_global = PartitionedArrays. getany (map (global_length,partition_in))
780+ n_own = map (own_length,partition_in)
781+ new_gids = variable_partition (n_own,n_global)
782+ v = PVector {Vector{Int}} (undef,partition_in)
783+ map (own_values (v),new_gids) do own_v, new_gids
784+ own_v .= own_to_global (new_gids)
785+ end
786+ consistent! (v) |> wait
787+ I = ghost_values (v)
788+ I_owner = map (ghost_to_owner,partition_in)
789+ new_ids2 = map (union_ghost,new_gids,I,I_owner)
790+ perm = map (PartitionedArrays. local_permutation,partition_in)
791+ partition_out = map (permute_indices,new_ids2,perm)
792+ partition_out
793+ end
794+
774795function local_range (p,np,n,ghost= false ,periodic= false )
775796 l = n ÷ np
776797 offset = l * (p- 1 )
@@ -1223,7 +1244,7 @@ assembly_cache(a::OwnAndGhostIndices) = a.assembly_cache
12231244local_permutation (a:: OwnAndGhostIndices ) = Int32 (1 ): Int32 (local_length (a))
12241245
12251246function replace_ghost (a:: OwnAndGhostIndices ,ghost:: GhostIndices )
1226- OwnAndGhostIndices (a. own,ghost)
1247+ OwnAndGhostIndices (a. own,ghost,a . global_to_owner )
12271248end
12281249
12291250function find_owner (indices,global_ids,:: Type{<:OwnAndGhostIndices{T}} ) where T
0 commit comments