@ -98,7 +98,7 @@
! info - integer , output .
! info - integer , output .
! Error code .
! Error code .
!
!
subroutine mld_daggrmat_asb ( a , desc_a , ilaggr , nlaggr , p , info )
subroutine mld_daggrmat_asb ( a , desc_a , ilaggr , nlaggr , p arms, ac , op_prol , op_restr , info )
use psb_base_mod
use psb_base_mod
use mld_d_inner_mod , mld_protect_name = > mld_daggrmat_asb
use mld_d_inner_mod , mld_protect_name = > mld_daggrmat_asb
@ -109,11 +109,12 @@ subroutine mld_daggrmat_asb(a,desc_a,ilaggr,nlaggr,p,info)
type ( psb_dspmat_type ) , intent ( in ) :: a
type ( psb_dspmat_type ) , intent ( in ) :: a
type ( psb_desc_type ) , intent ( in ) :: desc_a
type ( psb_desc_type ) , intent ( in ) :: desc_a
integer ( psb_ipk_ ) , intent ( inout ) :: ilaggr ( : ) , nlaggr ( : )
integer ( psb_ipk_ ) , intent ( inout ) :: ilaggr ( : ) , nlaggr ( : )
type ( mld_d_onelev_type ) , intent ( inout ) , target :: p
type ( mld_dml_parms ) , intent ( inout ) :: parms
! ! $ type ( mld_d_onelev_type ) , intent ( inout ) , target :: p
integer ( psb_ipk_ ) , intent ( out ) :: info
integer ( psb_ipk_ ) , intent ( out ) :: info
type ( psb_dspmat_type ) , intent ( inout ) :: ac , op_prol , op_restr
! Local variables
! Local variables
type ( psb_dspmat_type ) :: ac , op_prol , op_restr
type ( psb_d_coo_sparse_mat ) :: acoo , bcoo
type ( psb_d_coo_sparse_mat ) :: acoo , bcoo
type ( psb_d_csr_sparse_mat ) :: acsr1
type ( psb_d_csr_sparse_mat ) :: acsr1
integer ( psb_ipk_ ) :: nzl , ntaggr , err_act
integer ( psb_ipk_ ) :: nzl , ntaggr , err_act
@ -133,26 +134,26 @@ subroutine mld_daggrmat_asb(a,desc_a,ilaggr,nlaggr,p,info)
call psb_info ( ictxt , me , np )
call psb_info ( ictxt , me , np )
select case ( p % p arms% aggr_kind )
select case ( p arms% aggr_kind )
case ( mld_no_smooth_ )
case ( mld_no_smooth_ )
call mld_daggrmat_nosmth_asb ( a , desc_a , ilaggr , nlaggr , &
call mld_daggrmat_nosmth_asb ( a , desc_a , ilaggr , nlaggr , &
& p % p arms, ac , op_prol , op_restr , info )
& p arms, ac , op_prol , op_restr , info )
case ( mld_smooth_prol_ )
case ( mld_smooth_prol_ )
call mld_daggrmat_smth_asb ( a , desc_a , ilaggr , nlaggr , &
call mld_daggrmat_smth_asb ( a , desc_a , ilaggr , nlaggr , &
& p % p arms, ac , op_prol , op_restr , info )
& p arms, ac , op_prol , op_restr , info )
case ( mld_biz_prol_ )
case ( mld_biz_prol_ )
call mld_daggrmat_biz_asb ( a , desc_a , ilaggr , nlaggr , &
call mld_daggrmat_biz_asb ( a , desc_a , ilaggr , nlaggr , &
& p % p arms, ac , op_prol , op_restr , info )
& p arms, ac , op_prol , op_restr , info )
case ( mld_min_energy_ )
case ( mld_min_energy_ )
call mld_daggrmat_minnrg_asb ( a , desc_a , ilaggr , nlaggr , &
call mld_daggrmat_minnrg_asb ( a , desc_a , ilaggr , nlaggr , &
& p % p arms, ac , op_prol , op_restr , info )
& p arms, ac , op_prol , op_restr , info )
case default
case default
info = psb_err_internal_error_
info = psb_err_internal_error_
@ -166,113 +167,113 @@ subroutine mld_daggrmat_asb(a,desc_a,ilaggr,nlaggr,p,info)
end if
end if
! ! $
ntaggr = sum ( nlaggr )
! ! $ ntaggr = sum ( nlaggr )
! ! $
select case ( p % parms % coarse_mat )
! ! $ select case ( p % parms % coarse_mat )
! ! $
case ( mld_distr_mat_ )
! ! $ case ( mld_distr_mat_ )
! ! $
call ac % mv_to ( bcoo )
! ! $ call ac % mv_to ( bcoo )
if ( p % parms % clean_zeros ) call bcoo % clean_zeros ( info )
! ! $ if ( p % parms % clean_zeros ) call bcoo % clean_zeros ( info )
nzl = bcoo % get_nzeros ( )
! ! $ nzl = bcoo % get_nzeros ( )
! ! $
if ( info == psb_success_ ) call psb_cdall ( ictxt , p % desc_ac , info , nl = nlaggr ( me + 1 ) )
! ! $ if ( info == psb_success_ ) call psb_cdall ( ictxt , p % desc_ac , info , nl = nlaggr ( me + 1 ) )
if ( info == psb_success_ ) call psb_cdins ( nzl , bcoo % ia , bcoo % ja , p % desc_ac , info )
! ! $ if ( info == psb_success_ ) call psb_cdins ( nzl , bcoo % ia , bcoo % ja , p % desc_ac , info )
if ( info == psb_success_ ) call psb_cdasb ( p % desc_ac , info )
! ! $ if ( info == psb_success_ ) call psb_cdasb ( p % desc_ac , info )
if ( info == psb_success_ ) call psb_glob_to_loc ( bcoo % ia ( 1 : nzl ) , p % desc_ac , info , iact = 'I' )
! ! $ if ( info == psb_success_ ) call psb_glob_to_loc ( bcoo % ia ( 1 : nzl ) , p % desc_ac , info , iact = 'I' )
if ( info == psb_success_ ) call psb_glob_to_loc ( bcoo % ja ( 1 : nzl ) , p % desc_ac , info , iact = 'I' )
! ! $ if ( info == psb_success_ ) call psb_glob_to_loc ( bcoo % ja ( 1 : nzl ) , p % desc_ac , info , iact = 'I' )
if ( info / = psb_success_ ) then
! ! $ if ( info / = psb_success_ ) then
call psb_errpush ( psb_err_internal_error_ , name , &
! ! $ call psb_errpush ( psb_err_internal_error_ , name , &
& a_err = 'Creating p%desc_ac and converting ac' )
! ! $ & a_err = 'Creating p%desc_ac and converting ac' )
go to 9999
! ! $ go to 9999
end if
! ! $ end if
if ( debug_level > = psb_debug_outer_ ) &
! ! $ if ( debug_level > = psb_debug_outer_ ) &
& write ( debug_unit , * ) me , ' ' , trim ( name ) , &
! ! $ & write ( debug_unit , * ) me , ' ' , trim ( name ) , &
& 'Assembld aux descr. distr.'
! ! $ & 'Assembld aux descr. distr.'
call p % ac % mv_from ( bcoo )
! ! $ call p % ac % mv_from ( bcoo )
! ! $
call p % ac % set_nrows ( p % desc_ac % get_local_rows ( ) )
! ! $ call p % ac % set_nrows ( p % desc_ac % get_local_rows ( ) )
call p % ac % set_ncols ( p % desc_ac % get_local_cols ( ) )
! ! $ call p % ac % set_ncols ( p % desc_ac % get_local_cols ( ) )
call p % ac % set_asb ( )
! ! $ call p % ac % set_asb ( )
! ! $
if ( info / = psb_success_ ) then
! ! $ if ( info / = psb_success_ ) then
call psb_errpush ( psb_err_from_subroutine_ , name , a_err = 'psb_sp_free' )
! ! $ call psb_errpush ( psb_err_from_subroutine_ , name , a_err = 'psb_sp_free' )
go to 9999
! ! $ go to 9999
end if
! ! $ end if
! ! $
if ( np > 1 ) then
! ! $ if ( np > 1 ) then
call op_prol % mv_to ( acsr1 )
! ! $ call op_prol % mv_to ( acsr1 )
nzl = acsr1 % get_nzeros ( )
! ! $ nzl = acsr1 % get_nzeros ( )
call psb_glob_to_loc ( acsr1 % ja ( 1 : nzl ) , p % desc_ac , info , 'I' )
! ! $ call psb_glob_to_loc ( acsr1 % ja ( 1 : nzl ) , p % desc_ac , info , 'I' )
if ( info / = psb_success_ ) then
! ! $ if ( info / = psb_success_ ) then
call psb_errpush ( psb_err_from_subroutine_ , name , a_err = 'psb_glob_to_loc' )
! ! $ call psb_errpush ( psb_err_from_subroutine_ , name , a_err = 'psb_glob_to_loc' )
go to 9999
! ! $ go to 9999
end if
! ! $ end if
call op_prol % mv_from ( acsr1 )
! ! $ call op_prol % mv_from ( acsr1 )
endif
! ! $ endif
call op_prol % set_ncols ( p % desc_ac % get_local_cols ( ) )
! ! $ call op_prol % set_ncols ( p % desc_ac % get_local_cols ( ) )
! ! $
if ( np > 1 ) then
! ! $ if ( np > 1 ) then
call op_restr % cscnv ( info , type = 'coo' , dupl = psb_dupl_add_ )
! ! $ call op_restr % cscnv ( info , type = 'coo' , dupl = psb_dupl_add_ )
call op_restr % mv_to ( acoo )
! ! $ call op_restr % mv_to ( acoo )
nzl = acoo % get_nzeros ( )
! ! $ nzl = acoo % get_nzeros ( )
if ( info == psb_success_ ) call psb_glob_to_loc ( acoo % ia ( 1 : nzl ) , p % desc_ac , info , 'I' )
! ! $ if ( info == psb_success_ ) call psb_glob_to_loc ( acoo % ia ( 1 : nzl ) , p % desc_ac , info , 'I' )
call acoo % set_dupl ( psb_dupl_add_ )
! ! $ call acoo % set_dupl ( psb_dupl_add_ )
if ( info == psb_success_ ) call op_restr % mv_from ( acoo )
! ! $ if ( info == psb_success_ ) call op_restr % mv_from ( acoo )
if ( info == psb_success_ ) call op_restr % cscnv ( info , type = 'csr' )
! ! $ if ( info == psb_success_ ) call op_restr % cscnv ( info , type = 'csr' )
if ( info / = psb_success_ ) then
! ! $ if ( info / = psb_success_ ) then
call psb_errpush ( psb_err_internal_error_ , name , &
! ! $ call psb_errpush ( psb_err_internal_error_ , name , &
& a_err = 'Converting op_restr to local' )
! ! $ & a_err = 'Converting op_restr to local' )
go to 9999
! ! $ go to 9999
end if
! ! $ end if
end if
! ! $ end if
!
! ! $ !
! Clip to local rows .
! ! $ ! Clip to local rows .
!
! ! $ !
call op_restr % set_nrows ( p % desc_ac % get_local_rows ( ) )
! ! $ call op_restr % set_nrows ( p % desc_ac % get_local_rows ( ) )
! ! $
if ( debug_level > = psb_debug_outer_ ) &
! ! $ if ( debug_level > = psb_debug_outer_ ) &
& write ( debug_unit , * ) me , ' ' , trim ( name ) , &
! ! $ & write ( debug_unit , * ) me , ' ' , trim ( name ) , &
& 'Done ac '
! ! $ & 'Done ac '
! ! $
case ( mld_repl_mat_ )
! ! $ case ( mld_repl_mat_ )
!
! ! $ !
!
! ! $ !
call psb_cdall ( ictxt , p % desc_ac , info , mg = ntaggr , repl = . true . )
! ! $ call psb_cdall ( ictxt , p % desc_ac , info , mg = ntaggr , repl = . true . )
if ( info == psb_success_ ) call psb_cdasb ( p % desc_ac , info )
! ! $ if ( info == psb_success_ ) call psb_cdasb ( p % desc_ac , info )
if ( ( info == psb_success_ ) . and . p % parms % clean_zeros ) call ac % clean_zeros ( info )
! ! $ if ( ( info == psb_success_ ) . and . p % parms % clean_zeros ) call ac % clean_zeros ( info )
if ( info == psb_success_ ) &
! ! $ if ( info == psb_success_ ) &
& call psb_gather ( p % ac , ac , p % desc_ac , info , dupl = psb_dupl_add_ , keeploc = . false . )
! ! $ & call psb_gather ( p % ac , ac , p % desc_ac , info , dupl = psb_dupl_add_ , keeploc = . false . )
! ! $
if ( info / = psb_success_ ) go to 9999
! ! $ if ( info / = psb_success_ ) go to 9999
! ! $
case default
! ! $ case default
info = psb_err_internal_error_
! ! $ info = psb_err_internal_error_
call psb_errpush ( info , name , a_err = 'invalid mld_coarse_mat_' )
! ! $ call psb_errpush ( info , name , a_err = 'invalid mld_coarse_mat_' )
go to 9999
! ! $ go to 9999
end select
! ! $ end select
! ! $
call p % ac % cscnv ( info , type = 'csr' , dupl = psb_dupl_add_ )
! ! $ call p % ac % cscnv ( info , type = 'csr' , dupl = psb_dupl_add_ )
if ( info / = psb_success_ ) then
! ! $ if ( info / = psb_success_ ) then
call psb_errpush ( psb_err_from_subroutine_ , name , a_err = 'spcnv' )
! ! $ call psb_errpush ( psb_err_from_subroutine_ , name , a_err = 'spcnv' )
go to 9999
! ! $ go to 9999
end if
! ! $ end if
! ! $
!
! ! $ !
! Copy the prolongation / restriction matrices into the descriptor map .
! ! $ ! Copy the prolongation / restriction matrices into the descriptor map .
! op_restr = > PR ^ T i . e . restriction operator
! ! $ ! op_restr = > PR ^ T i . e . restriction operator
! op_prol = > PR i . e . prolongation operator
! ! $ ! op_prol = > PR i . e . prolongation operator
!
! ! $ !
! ! $
p % map = psb_linmap ( psb_map_aggr_ , desc_a , &
! ! $ p % map = psb_linmap ( psb_map_aggr_ , desc_a , &
& p % desc_ac , op_restr , op_prol , ilaggr , nlaggr )
! ! $ & p % desc_ac , op_restr , op_prol , ilaggr , nlaggr )
if ( info == psb_success_ ) call op_prol % free ( )
! ! $ if ( info == psb_success_ ) call op_prol % free ( )
if ( info == psb_success_ ) call op_restr % free ( )
! ! $ if ( info == psb_success_ ) call op_restr % free ( )
if ( info / = psb_success_ ) then
! ! $ if ( info / = psb_success_ ) then
call psb_errpush ( psb_err_from_subroutine_ , name , a_err = 'sp_Free' )
! ! $ call psb_errpush ( psb_err_from_subroutine_ , name , a_err = 'sp_Free' )
go to 9999
! ! $ go to 9999
end if
! ! $ end if
call psb_erractionrestore ( err_act )
call psb_erractionrestore ( err_act )