@@ -637,6 +637,16 @@ function split_matrix(
637637 SplitMatrix (blocks,row_permutation,col_permutation)
638638end
639639
640+ function split_matrix (
641+ own_own:: AbstractMatrix ,
642+ own_ghost:: AbstractMatrix ,
643+ ghost_own:: AbstractMatrix ,
644+ ghost_ghost:: AbstractMatrix ,
645+ row_permutation,
646+ col_permutation)
647+ blocks = split_matrix_blocks (own_own,own_ghost,ghost_own,ghost_ghost)
648+ split_matrix (blocks,row_permutation,col_permutation)
649+ end
640650
641651Base. size (a:: AbstractSplitMatrix ) = (length (a. row_permutation),length (a. col_permutation))
642652Base. IndexStyle (:: Type{<:AbstractSplitMatrix} ) = IndexCartesian ()
@@ -1294,6 +1304,33 @@ function psparse!(C,V,cache)
12941304 end
12951305end
12961306
1307+ function psparse_from_split_blocks (oo,oh,ho,hh,rowp,colp;assembled= false )
1308+ rperms = map (local_permutation,rowp)
1309+ cperms = map (local_permutation,colp)
1310+ values = map (split_matrix,oo,oh,ho,hh,rperms,cperms)
1311+ PSparseMatrix (values,rowp,colp,assembled)
1312+ end
1313+
1314+ function psparse_from_split_blocks (oo,oh,rowp,colp;assembled= true )
1315+ ho = map (oo,rowp,colp) do oo, rows, cols
1316+ T = typeof (oo)
1317+ Tv = eltype (oo)
1318+ Ti = indextype (oo)
1319+ n_ghost_rows = ghost_length (rows)
1320+ n_own_cols = own_length (cols)
1321+ sparse_matrix (T,Ti[],Ti[],Tv[],n_ghost_rows,n_own_cols)
1322+ end
1323+ hh = map (oo,rowp,colp) do oo, rows, cols
1324+ T = typeof (oo)
1325+ Tv = eltype (oo)
1326+ Ti = indextype (oo)
1327+ n_ghost_rows = ghost_length (rows)
1328+ n_ghost_cols = ghost_length (cols)
1329+ sparse_matrix (T,Ti[],Ti[],Tv[],n_ghost_rows,n_ghost_cols)
1330+ end
1331+ psparse_from_split_blocks (oo,oh,ho,hh,rowp,colp;assembled)
1332+ end
1333+
12971334function assemble (A:: PSparseMatrix ;kwargs... )
12981335 rows = map (remove_ghost,partition (axes (A,1 )))
12991336 assemble (A,rows;kwargs... )
0 commit comments