diff --git a/amgprec/impl/amg_ccprecset.F90 b/amgprec/impl/amg_ccprecset.F90 index dacf4877..1c634877 100644 --- a/amgprec/impl/amg_ccprecset.F90 +++ b/amgprec/impl/amg_ccprecset.F90 @@ -1,15 +1,15 @@ -! -! +! +! ! AMG4PSBLAS version 1.0 ! Algebraic Multigrid Package ! based on PSBLAS (Parallel Sparse BLAS version 3.5) -! -! (C) Copyright 2020 -! -! Salvatore Filippone -! Pasqua D'Ambra -! Fabio Durastante -! +! +! (C) Copyright 2020 +! +! Salvatore Filippone +! Pasqua D'Ambra +! Fabio Durastante +! ! Redistribution and use in source and binary forms, with or without ! modification, are permitted provided that the following conditions ! are met: @@ -21,7 +21,7 @@ ! 3. The name of the AMG4PSBLAS group or the names of its contributors may ! not be used to endorse or promote products derived from this ! software without specific written permission. -! +! ! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED ! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR @@ -33,8 +33,8 @@ ! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ! POSSIBILITY OF SUCH DAMAGE. -! -! +! +! ! File: amg_cprecset.f90 ! ! Subroutine: amg_cprecseti @@ -44,7 +44,7 @@ ! precisely, the integer parameter identified by 'what' is assigned the value ! contained in 'val'. ! For the multilevel preconditioners, the levels are numbered in increasing -! order starting from the finest one, i.e. level 1 is the finest level. +! order starting from the finest one, i.e. level 1 is the finest level. ! ! To set character and complex parameters, see amg_cprecsetc and amg_cprecsetr, ! respectively. @@ -64,7 +64,7 @@ ! Error code. ! ilev - integer, optional, input. ! For the multilevel preconditioner, the level at which the -! preconditioner parameter has to be set. +! preconditioner parameter has to be set. ! If nlev is not present, the parameter identified by 'what' ! is set at all the appropriate levels. ! @@ -74,7 +74,7 @@ ! the parameter must have the same value at all the levels but the coarsest one. ! For this reason, the interface amg_precset to this routine has been built in ! such a way that ilev is not visible to the user (see amg_prec_mod.f90). -! +! subroutine amg_ccprecseti(p,what,val,info,ilev,ilmax,pos,idx) use psb_base_mod @@ -86,10 +86,13 @@ subroutine amg_ccprecseti(p,what,val,info,ilev,ilmax,pos,idx) use amg_c_ilu_solver use amg_c_id_solver use amg_c_gs_solver + use amg_c_ainv_solver + use amg_c_invk_solver + use amg_c_invt_solver #if defined(HAVE_SLU_) use amg_c_slu_solver #endif -#if defined(HAVE_MUMPS_) +#if defined(HAVE_MUMPS_) use amg_c_mumps_solver #endif @@ -98,7 +101,7 @@ subroutine amg_ccprecseti(p,what,val,info,ilev,ilmax,pos,idx) ! Arguments class(amg_cprec_type), intent(inout) :: p - character(len=*), intent(in) :: what + character(len=*), intent(in) :: what integer(psb_ipk_), intent(in) :: val integer(psb_ipk_), intent(out) :: info integer(psb_ipk_), optional, intent(in) :: ilev,ilmax @@ -111,17 +114,17 @@ subroutine amg_ccprecseti(p,what,val,info,ilev,ilmax,pos,idx) info = psb_success_ - if (.not.allocated(p%precv)) then + if (.not.allocated(p%precv)) then info = 3111 write(psb_err_unit,*) name,& & ': Error: uninitialized preconditioner,',& &' should call amg_PRECINIT' - return + return endif nlev_ = size(p%precv) - if (present(ilev)) then + if (present(ilev)) then ilev_ = ilev if (present(ilmax)) then ilmax_ = ilmax @@ -129,22 +132,22 @@ subroutine amg_ccprecseti(p,what,val,info,ilev,ilmax,pos,idx) ilmax_ = ilev_ end if else - ilev_ = 1 + ilev_ = 1 ilmax_ = nlev_ end if - if ((ilev_<1).or.(ilev_ > nlev_)) then + if ((ilev_<1).or.(ilev_ > nlev_)) then info = -1 write(psb_err_unit,*) name,& &': Error: invalid ILEV/NLEV combination',ilev_, nlev_ return endif - if ((ilmax_<1).or.(ilmax_ > nlev_)) then + if ((ilmax_<1).or.(ilmax_ > nlev_)) then info = -1 write(psb_err_unit,*) name,& &': Error: invalid ILMAX/NLEV combination',ilmax_, nlev_ return endif - + select case(psb_toupper(what)) case ('MIN_COARSE_SIZE') p%ag_data%min_coarse_size = max(val,-1) @@ -160,130 +163,17 @@ subroutine amg_ccprecseti(p,what,val,info,ilev,ilmax,pos,idx) ! ! Set preconditioner parameters at level ilev. ! - if (present(ilev)) then - - select case(psb_toupper(what)) - case('SMOOTHER_TYPE','SUB_SOLVE','SMOOTHER_SWEEPS',& - & 'ML_CYCLE','PAR_AGGR_ALG','AGGR_ORD',& - & 'AGGR_TYPE','AGGR_PROL','AGGR_OMEGA_ALG',& - & 'AGGR_EIG','SUB_RESTR','SUB_PROL', & - & 'SUB_OVR','SUB_FILLIN',& - & 'COARSE_MAT') + if (present(ilev)) then + + select case(psb_toupper(what)) + case('SUB_OVR','SUB_FILLIN','SMOOTHER_SWEEPS') do il=ilev_, ilmax_ call p%precv(il)%set(what,val,info,pos=pos) end do - case('COARSE_SUBSOLVE') - if (ilev_ /= nlev_) then - write(psb_err_unit,*) name,& - & ': Error: Inconsistent specification of WHAT vs. ILEV' - info = -2 - return - end if - call p%precv(ilev_)%set('SUB_SOLVE',val,info,pos=pos) - case('COARSE_SOLVE') - if (ilev_ /= nlev_) then - write(psb_err_unit,*) name,& - & ': Error: Inconsistent specification of WHAT vs. ILEV' - info = -2 - return - end if - if (nlev_ > 1) then - call p%precv(nlev_)%set('COARSE_SOLVE',val,info,pos=pos) - select case (val) - case(amg_bjac_,amg_l1_bjac_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',val,info,pos=pos) -#if defined(HAVE_SLU_) - call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) -#elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) -#else - call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) -#endif - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info) - case(amg_slu_) -#if defined(HAVE_SLU_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',val,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) -#elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#endif - case(psb_ilu_n_, psb_ilu_t_,psb_milu_n_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',val,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) - case(amg_mumps_) -#if defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',val,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#endif - case(amg_umf_) -#if defined(HAVE_SLU_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) -#elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#endif - - case(amg_sludist_) -#if defined(HAVE_SLU_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) -#elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#endif - case(amg_jac_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_diag_scale_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) - case(amg_l1_jac_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_l1_diag_scale_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) - case(amg_gs_,amg_fbgs_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) - case(amg_bwgs_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_bwgs_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) - case(amg_l1_gs_,amg_l1_fbgs_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_l1_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) - end select - - endif case('COARSE_SWEEPS') - if (ilev_ /= nlev_) then + if (ilev_ /= nlev_) then write(psb_err_unit,*) name,& & ': Error: Inconsistent specification of WHAT vs. ILEV' info = -2 @@ -292,14 +182,14 @@ subroutine amg_ccprecseti(p,what,val,info,ilev,ilmax,pos,idx) call p%precv(nlev_)%set('SMOOTHER_SWEEPS',val,info,pos=pos) case('COARSE_FILLIN') - if (ilev_ /= nlev_) then + if (ilev_ /= nlev_) then write(psb_err_unit,*) name,& & ': Error: Inconsistent specification of WHAT vs. ILEV' info = -2 return end if call p%precv(nlev_)%set('SUB_FILLIN',val,info,pos=pos) - + case default do il=ilev_, ilmax_ call p%precv(il)%set(what,val,info,pos=pos,idx=idx) @@ -307,131 +197,18 @@ subroutine amg_ccprecseti(p,what,val,info,ilev,ilmax,pos,idx) end select - else if (.not.present(ilev)) then + else if (.not.present(ilev)) then ! ! ilev not specified: set preconditioner parameters at all the appropriate ! levels ! - select case(psb_toupper(trim(what))) - case('SUB_SOLVE','SUB_RESTR','SUB_PROL',& - & 'SUB_OVR','SUB_FILLIN',& - & 'SMOOTHER_SWEEPS','SMOOTHER_TYPE') + select case(psb_toupper(trim(what))) + case('SUB_OVR','SUB_FILLIN','SMOOTHER_SWEEPS') do ilev_=1,max(1,nlev_-1) call p%precv(ilev_)%set(what,val,info,pos=pos) - if (info /= 0) return - end do - - case('ML_CYCLE','PAR_AGGR_ALG','AGGR_ORD','AGGR_PROL','AGGR_TYPE',& - & 'AGGR_OMEGA_ALG','AGGR_EIG','AGGR_FILTER') - do ilev_=1,nlev_ - call p%precv(ilev_)%set(what,val,info,pos=pos) - if (info /= 0) return + if (info /= 0) return end do - case('COARSE_MAT') - if (nlev_ > 1) then - call p%precv(nlev_)%set('COARSE_MAT',val,info,pos=pos) - end if - - case('COARSE_SOLVE') - if (nlev_ > 1) then - call p%precv(nlev_)%set('COARSE_SOLVE',val,info,pos=pos) - select case (val) - case(amg_bjac_,amg_l1_bjac_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',val,info,pos=pos) -#if defined(HAVE_SLU_) - call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) -#elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) -#else - call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) -#endif - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info) - case(amg_slu_) -#if defined(HAVE_SLU_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',val,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) -#elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#endif - case(psb_ilu_n_, psb_ilu_t_,psb_milu_n_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',val,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) - case(amg_mumps_) -#if defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',val,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#endif - case(amg_umf_) -#if defined(HAVE_SLU_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) -#elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#endif - - case(amg_sludist_) -#if defined(HAVE_SLU_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) -#elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#endif - case(amg_jac_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_diag_scale_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) - - case(amg_l1_jac_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_l1_diag_scale_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) - case(amg_gs_,amg_fbgs_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) - case(amg_bwgs_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_bwgs_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) - case(amg_l1_gs_,amg_l1_fbgs_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_l1_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) - end select - endif - - case('COARSE_SUBSOLVE') - if (nlev_ > 1) then - call p%precv(nlev_)%set('SUB_SOLVE',val,info,pos=pos) - endif case('COARSE_SWEEPS') @@ -440,10 +217,10 @@ subroutine amg_ccprecseti(p,what,val,info,ilev,ilmax,pos,idx) end if case('COARSE_FILLIN') - if (nlev_ > 1) then + if (nlev_ > 1) then call p%precv(nlev_)%set('SUB_FILLIN',val,info,pos=pos) end if - + case default do ilev_=1,nlev_ call p%precv(ilev_)%set(what,val,info,pos=pos,idx=idx) @@ -462,7 +239,7 @@ end subroutine amg_ccprecseti ! precisely, the character parameter identified by 'what' is assigned the value ! contained in 'val'. ! For the multilevel preconditioners, the levels are numbered in increasing -! order starting from the finest one, i.e. level 1 is the finest level. +! order starting from the finest one, i.e. level 1 is the finest level. ! ! To set integer and complex parameters, see amg_cprecseti and amg_cprecsetr, ! respectively. @@ -482,7 +259,7 @@ end subroutine amg_ccprecseti ! Error code. ! ilev - integer, optional, input. ! For the multilevel preconditioner, the level at which the -! preconditioner parameter has to be set. +! preconditioner parameter has to be set. ! If nlev is not present, the parameter identified by 'what' ! is set at all the appropriate levels. ! @@ -492,7 +269,7 @@ end subroutine amg_ccprecseti ! the parameter must have the same value at all the levels but the coarsest one. ! For this reason, the interface amg_precset to this routine has been built in ! such a way that ilev is not visible to the user (see amg_prec_mod.f90). -! +! subroutine amg_ccprecsetc(p,what,string,info,ilev,ilmax,pos,idx) use psb_base_mod @@ -504,10 +281,13 @@ subroutine amg_ccprecsetc(p,what,string,info,ilev,ilmax,pos,idx) use amg_c_ilu_solver use amg_c_id_solver use amg_c_gs_solver + use amg_c_ainv_solver + use amg_c_invk_solver + use amg_c_invt_solver #if defined(HAVE_SLU_) use amg_c_slu_solver #endif -#if defined(HAVE_MUMPS_) +#if defined(HAVE_MUMPS_) use amg_c_mumps_solver #endif @@ -516,7 +296,7 @@ subroutine amg_ccprecsetc(p,what,string,info,ilev,ilmax,pos,idx) ! Arguments class(amg_cprec_type), intent(inout) :: p - character(len=*), intent(in) :: what + character(len=*), intent(in) :: what character(len=*), intent(in) :: string integer(psb_ipk_), intent(out) :: info integer(psb_ipk_), optional, intent(in) :: ilev,ilmax @@ -529,17 +309,17 @@ subroutine amg_ccprecsetc(p,what,string,info,ilev,ilmax,pos,idx) info = psb_success_ - if (.not.allocated(p%precv)) then + if (.not.allocated(p%precv)) then info = 3111 write(psb_err_unit,*) name,& & ': Error: uninitialized preconditioner,',& &' should call amg_PRECINIT' - return + return endif nlev_ = size(p%precv) - if (present(ilev)) then + if (present(ilev)) then ilev_ = ilev if (present(ilmax)) then ilmax_ = ilmax @@ -547,39 +327,86 @@ subroutine amg_ccprecsetc(p,what,string,info,ilev,ilmax,pos,idx) ilmax_ = ilev_ end if else - ilev_ = 1 + ilev_ = 1 ilmax_ = nlev_ end if - if ((ilev_<1).or.(ilev_ > nlev_)) then + if ((ilev_<1).or.(ilev_ > nlev_)) then info = -1 write(psb_err_unit,*) name,& &': Error: invalid ILEV/NLEV combination',ilev_, nlev_ return endif - if ((ilmax_<1).or.(ilmax_ > nlev_)) then + if ((ilmax_<1).or.(ilmax_ > nlev_)) then info = -1 write(psb_err_unit,*) name,& &': Error: invalid ILMAX/NLEV combination',ilmax_, nlev_ return endif - + ! ! Set preconditioner parameters at level ilev. ! - if (present(ilev)) then - - select case(psb_toupper(what)) - case('SMOOTHER_TYPE','SUB_SOLVE',& - & 'ML_CYCLE','PAR_AGGR_ALG','AGGR_ORD',& - & 'AGGR_TYPE','AGGR_PROL','AGGR_OMEGA_ALG',& - & 'AGGR_EIG','SUB_RESTR','SUB_PROL', & - & 'COARSE_MAT') + if (present(ilev)) then + + select case(psb_toupper(what)) + case('SMOOTHER_TYPE') + ! Select the type of smoother between the one implemented in the library + ! every new smoother should be added here + select case(psb_toupper(string)) + case ('BJAC') + do il=ilev_, ilmax_ + call p%precv(il)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + end do + case ('L1-BJAC') + do il=ilev_, ilmax_ + call p%precv(il)%set('SMOOTHER_TYPE',amg_l1_bjac_,info,pos=pos) + end do + case('GS','FWGS','FBGS') + do il=ilev_, ilmax_ + call p%precv(il)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(il)%set('SUB_SOLVE',amg_gs_,info,pos=pos) + end do + case('L1-GS','L1-FWGS','L1-FBGS') + do il=ilev_, ilmax_ + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_l1_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos) + end do + case ('BWGS') + do il=ilev_, ilmax_ + call p%precv(il)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(il)%set('SUB_SOLVE',amg_bwgs_,info,pos=pos) + end do + case('JACOBI') + do il=ilev_, ilmax_ + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_diag_scale_,info,pos=pos) + end do + case('L1-JACOBI') + do il=ilev_, ilmax_ + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_l1_diag_scale_,info,pos=pos) + end do + end select + case('SUB_SOLVE','ML_CYCLE','PAR_AGGR_ALG','AGGR_TYPE','SUB_RESTR'& + & ,'SUB_PROL') + ! These are handled elsewhere do il=ilev_, ilmax_ - call p%precv(il)%set(what,string,info,pos=pos) + call p%precv(nlev_)%set(what,string,info,pos=pos) end do - + case('COARSE_MAT') + ! Select if the coarsest matrix is handled in a distributed way, few + ! rows per rank, or if it is replicated completely on every rank + select case(psb_toupper(string)) + case('DISTR') + do il=ilev_, ilmax_ + call p%precv(il)%set(what,amg_distr_mat_,info,pos=pos) + end do + case('REPL') + do il=ilev_, ilmax_ + call p%precv(il)%set(what,amg_repl_mat_,info,pos=pos) + end do case('COARSE_SUBSOLVE') - if (ilev_ /= nlev_) then + if (ilev_ /= nlev_) then write(psb_err_unit,*) name,& & ': Error: Inconsistent specification of WHAT vs. ILEV' info = -2 @@ -587,106 +414,117 @@ subroutine amg_ccprecsetc(p,what,string,info,ilev,ilmax,pos,idx) end if call p%precv(ilev_)%set('SUB_SOLVE',string,info,pos=pos) case('COARSE_SOLVE') - if (ilev_ /= nlev_) then + if (ilev_ /= nlev_) then write(psb_err_unit,*) name,& & ': Error: Inconsistent specification of WHAT vs. ILEV' info = -2 return end if - if (nlev_ > 1) then - call p%precv(nlev_)%set('COARSE_SOLVE',string,info,pos=pos) - select case (psb_toupper(trim(string))) - case('BJAC', 'L1-BJAC') - call p%precv(nlev_)%set('SMOOTHER_TYPE',psb_toupper(trim(string)),info,pos=pos) + if (nlev_ > 1) then + select case (psb_toupper(string)) + case('BJAC') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + case('L1-BJAC') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_l1_bjac_,info,pos=pos) #if defined(HAVE_SLU_) - call p%precv(nlev_)%set('SUB_SOLVE','SLU',info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) #elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SUB_SOLVE','MUMPS',info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) #else - call p%precv(nlev_)%set('SUB_SOLVE','ILU',info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) #endif - call p%precv(nlev_)%set('COARSE_MAT','dist',info) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info) case('SLU') #if defined(HAVE_SLU_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','SLU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','REPL',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) #elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','MUMPS',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','ILU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) #endif - case('ILU','MILU','ILUT') - call p%precv(nlev_)%set('SMOOTHER_TYPE','bjac',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',string,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','REPL',info,pos=pos) + case('ILU') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) + case('ILUT') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_t_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) + case('MILU') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_milu_n_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) case('MUMPS') -#if defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',string,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','ILU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) +#if defined(HAVE_MUMPS_) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) #endif case('UMF') #if defined(HAVE_SLU_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','SLU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','REPL',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) #elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','MUMPS',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','ILU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) #endif - + case('SLUDIST') #if defined(HAVE_SLU_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','SLU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','REPL',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) #elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','MUMPS',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','ILU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) #endif - case('JAC','JACOBI') - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','DIAG',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) - - case('L1-JACOBI') - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','L1-DIAG',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) - case('GS','FWGS','FBGS') - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','GS',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) + case('JACOBI','JAC') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_diag_scale_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) + + case('L1-JACOBI','L1-JAC') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_l1_diag_scale_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) + case('GS','FBGS') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) case('BWGS') - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','BWGS',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) - case('L1-GS') - call p%precv(nlev_)%set('SMOOTHER_TYPE','L1-BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','GS',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_bwgs_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) + case('L1-GS','L1-FBGS') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_l1_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) end select - - endif + + end if + + end select case default do il=ilev_, ilmax_ @@ -695,127 +533,140 @@ subroutine amg_ccprecsetc(p,what,string,info,ilev,ilmax,pos,idx) end select - else if (.not.present(ilev)) then + + + else if (.not.present(ilev)) then ! ! ilev not specified: set preconditioner parameters at all the appropriate ! levels ! - select case(psb_toupper(trim(what))) + select case(psb_toupper(trim(what))) case('SUB_SOLVE','SUB_RESTR','SUB_PROL',& & 'SMOOTHER_TYPE') do ilev_=1,max(1,nlev_-1) call p%precv(ilev_)%set(what,string,info,pos=pos) - if (info /= 0) return + if (info /= 0) return end do case('ML_CYCLE','PAR_AGGR_ALG','AGGR_ORD','AGGR_PROL','AGGR_TYPE',& & 'AGGR_OMEGA_ALG','AGGR_EIG','AGGR_FILTER') do ilev_=1,nlev_ call p%precv(ilev_)%set(what,string,info,pos=pos) - if (info /= 0) return + if (info /= 0) return end do case('COARSE_MAT') - if (nlev_ > 1) then + if (nlev_ > 1) then call p%precv(nlev_)%set('COARSE_MAT',string,info,pos=pos) end if case('COARSE_SOLVE') - if (nlev_ > 1) then + if (nlev_ > 1) then call p%precv(nlev_)%set('COARSE_SOLVE',string,info,pos=pos) select case (psb_toupper(trim(string))) - case('BJAC', 'L1-BJAC') - call p%precv(nlev_)%set('SMOOTHER_TYPE',psb_toupper(trim(string)),info,pos=pos) + case('BJAC') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + case('L1-BJAC') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_l1_bjac_,info,pos=pos) #if defined(HAVE_SLU_) - call p%precv(nlev_)%set('SUB_SOLVE','SLU',info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) #elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SUB_SOLVE','MUMPS',info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) #else - call p%precv(nlev_)%set('SUB_SOLVE','ILU',info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) #endif - call p%precv(nlev_)%set('COARSE_MAT','DIST',info) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info) case('SLU') #if defined(HAVE_SLU_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',string,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','REPL',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) #elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','MUMPS',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','ILU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) #endif - case('ILU', 'ILUT','MILU') - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',string,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','REPL',info,pos=pos) + case('ILU') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) + case('ILUT') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_t_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) + case('MILU') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_milu_n_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) case('MUMPS') -#if defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',string,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','ILU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) +#if defined(HAVE_MUMPS_) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) #endif - case('UMF') + case('UMF') #if defined(HAVE_SLU_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','SLU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','REPL',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) #elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','MUMPS',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','ILU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) #endif - + case('SLUDIST') #if defined(HAVE_SLU_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','SLU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','REPL',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) #elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','MUMPS',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','ILU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) #endif - case('JAC','JACOBI') - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','DIAG',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) - case('L1-JACOBI') - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','L1-DIAG',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) - case('GS','FWGS','FBGS') - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','GS',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) + case('JACOBI','JAC') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_diag_scale_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) + + case('L1-JACOBI','L1-JAC') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_l1_diag_scale_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) + case('GS','FBGS') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) case('BWGS') - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','BWGS',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) - case('L1-GS') - call p%precv(nlev_)%set('SMOOTHER_TYPE','L1-BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','GS',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_bwgs_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) + case('L1-FBGS','L1-GS') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_l1_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) end select - endif + endif case('COARSE_SUBSOLVE') - if (nlev_ > 1) then + if (nlev_ > 1) then call p%precv(nlev_)%set('SUB_SOLVE',string,info,pos=pos) endif @@ -827,7 +678,7 @@ subroutine amg_ccprecsetc(p,what,string,info,ilev,ilmax,pos,idx) endif - + end subroutine amg_ccprecsetc @@ -839,7 +690,7 @@ end subroutine amg_ccprecsetc ! precisely, the complex parameter identified by 'what' is assigned the value ! contained in 'val'. ! For the multilevel preconditioners, the levels are numbered in increasing -! order starting from the finest one, i.e. level 1 is the finest level. +! order starting from the finest one, i.e. level 1 is the finest level. ! ! To set integer and character parameters, see amg_cprecseti and amg_cprecsetc, ! respectively. @@ -858,7 +709,7 @@ end subroutine amg_ccprecsetc ! Error code. ! ilev - integer, optional, input. ! For the multilevel preconditioner, the level at which the -! preconditioner parameter has to be set. +! preconditioner parameter has to be set. ! If nlev is not present, the parameter identified by 'what' ! is set at all the appropriate levels. ! @@ -868,7 +719,7 @@ end subroutine amg_ccprecsetc ! the parameter must have the same value at all the levels but the coarsest one. ! For this reason, the interface amg_precset to this routine has been built in ! such a way that ilev is not visible to the user (see amg_prec_mod.f90). -! +! subroutine amg_ccprecsetr(p,what,val,info,ilev,ilmax,pos,idx) use psb_base_mod @@ -878,7 +729,7 @@ subroutine amg_ccprecsetr(p,what,val,info,ilev,ilmax,pos,idx) ! Arguments class(amg_cprec_type), intent(inout) :: p - character(len=*), intent(in) :: what + character(len=*), intent(in) :: what real(psb_spk_), intent(in) :: val integer(psb_ipk_), intent(out) :: info integer(psb_ipk_), optional, intent(in) :: ilev,ilmax @@ -887,15 +738,15 @@ subroutine amg_ccprecsetr(p,what,val,info,ilev,ilmax,pos,idx) ! Local variables integer(psb_ipk_) :: ilev_,nlev_, ilmax_, il - real(psb_spk_) :: thr + real(psb_spk_) :: thr character(len=*), parameter :: name='amg_precsetr' info = psb_success_ - if (present(ilev)) then + if (present(ilev)) then ilev_ = ilev else - ilev_ = 1 + ilev_ = 1 end if select case(psb_toupper(what)) @@ -904,16 +755,16 @@ subroutine amg_ccprecsetr(p,what,val,info,ilev,ilmax,pos,idx) return end select - if (.not.allocated(p%precv)) then + if (.not.allocated(p%precv)) then write(psb_err_unit,*) name,& &': Error: uninitialized preconditioner,',& - &' should call amg_PRECINIT' + &' should call amg_PRECINIT' info = 3111 - return + return endif nlev_ = size(p%precv) - if (present(ilev)) then + if (present(ilev)) then ilev_ = ilev if (present(ilmax)) then ilmax_ = ilmax @@ -921,16 +772,16 @@ subroutine amg_ccprecsetr(p,what,val,info,ilev,ilmax,pos,idx) ilmax_ = ilev_ end if else - ilev_ = 1 + ilev_ = 1 ilmax_ = nlev_ end if - if ((ilev_<1).or.(ilev_ > nlev_)) then + if ((ilev_<1).or.(ilev_ > nlev_)) then info = -1 write(psb_err_unit,*) name,& &': Error: invalid ILEV/NLEV combination',ilev_, nlev_ return endif - if ((ilmax_<1).or.(ilmax_ > nlev_)) then + if ((ilmax_<1).or.(ilmax_ > nlev_)) then info = -1 write(psb_err_unit,*) name,& &': Error: invalid ILMAX/NLEV combination',ilmax_, nlev_ @@ -941,18 +792,18 @@ subroutine amg_ccprecsetr(p,what,val,info,ilev,ilmax,pos,idx) ! ! Set preconditioner parameters at level ilev. ! - if (present(ilev)) then + if (present(ilev)) then do il=ilev_, ilmax_ call p%precv(il)%set(what,val,info,pos=pos,idx=idx) end do - else if (.not.present(ilev)) then + else if (.not.present(ilev)) then ! ! ilev not specified: set preconditioner parameters at all the appropriate levels ! - select case(psb_toupper(what)) + select case(psb_toupper(what)) case('COARSE_ILUTHRS') ilev_=nlev_ call p%precv(ilev_)%set('SUB_ILUTHRS',val,info,pos=pos) @@ -967,5 +818,3 @@ subroutine amg_ccprecsetr(p,what,val,info,ilev,ilmax,pos,idx) endif end subroutine amg_ccprecsetr - - diff --git a/amgprec/impl/amg_dcprecset.F90 b/amgprec/impl/amg_dcprecset.F90 index c16e10ce..5c4aa5e9 100644 --- a/amgprec/impl/amg_dcprecset.F90 +++ b/amgprec/impl/amg_dcprecset.F90 @@ -1,15 +1,15 @@ -! -! +! +! ! AMG4PSBLAS version 1.0 ! Algebraic Multigrid Package ! based on PSBLAS (Parallel Sparse BLAS version 3.5) -! -! (C) Copyright 2020 -! -! Salvatore Filippone -! Pasqua D'Ambra -! Fabio Durastante -! +! +! (C) Copyright 2020 +! +! Salvatore Filippone +! Pasqua D'Ambra +! Fabio Durastante +! ! Redistribution and use in source and binary forms, with or without ! modification, are permitted provided that the following conditions ! are met: @@ -21,7 +21,7 @@ ! 3. The name of the AMG4PSBLAS group or the names of its contributors may ! not be used to endorse or promote products derived from this ! software without specific written permission. -! +! ! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED ! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR @@ -33,8 +33,8 @@ ! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ! POSSIBILITY OF SUCH DAMAGE. -! -! +! +! ! File: amg_dprecset.f90 ! ! Subroutine: amg_dprecseti @@ -44,7 +44,7 @@ ! precisely, the integer parameter identified by 'what' is assigned the value ! contained in 'val'. ! For the multilevel preconditioners, the levels are numbered in increasing -! order starting from the finest one, i.e. level 1 is the finest level. +! order starting from the finest one, i.e. level 1 is the finest level. ! ! To set character and real parameters, see amg_dprecsetc and amg_dprecsetr, ! respectively. @@ -64,7 +64,7 @@ ! Error code. ! ilev - integer, optional, input. ! For the multilevel preconditioner, the level at which the -! preconditioner parameter has to be set. +! preconditioner parameter has to be set. ! If nlev is not present, the parameter identified by 'what' ! is set at all the appropriate levels. ! @@ -74,7 +74,7 @@ ! the parameter must have the same value at all the levels but the coarsest one. ! For this reason, the interface amg_precset to this routine has been built in ! such a way that ilev is not visible to the user (see amg_prec_mod.f90). -! +! subroutine amg_dcprecseti(p,what,val,info,ilev,ilmax,pos,idx) use psb_base_mod @@ -86,6 +86,9 @@ subroutine amg_dcprecseti(p,what,val,info,ilev,ilmax,pos,idx) use amg_d_ilu_solver use amg_d_id_solver use amg_d_gs_solver + use amg_d_ainv_solver + use amg_d_invk_solver + use amg_d_invt_solver #if defined(HAVE_UMF_) use amg_d_umf_solver #endif @@ -95,7 +98,7 @@ subroutine amg_dcprecseti(p,what,val,info,ilev,ilmax,pos,idx) #if defined(HAVE_SLU_) use amg_d_slu_solver #endif -#if defined(HAVE_MUMPS_) +#if defined(HAVE_MUMPS_) use amg_d_mumps_solver #endif @@ -104,7 +107,7 @@ subroutine amg_dcprecseti(p,what,val,info,ilev,ilmax,pos,idx) ! Arguments class(amg_dprec_type), intent(inout) :: p - character(len=*), intent(in) :: what + character(len=*), intent(in) :: what integer(psb_ipk_), intent(in) :: val integer(psb_ipk_), intent(out) :: info integer(psb_ipk_), optional, intent(in) :: ilev,ilmax @@ -117,17 +120,17 @@ subroutine amg_dcprecseti(p,what,val,info,ilev,ilmax,pos,idx) info = psb_success_ - if (.not.allocated(p%precv)) then + if (.not.allocated(p%precv)) then info = 3111 write(psb_err_unit,*) name,& & ': Error: uninitialized preconditioner,',& &' should call amg_PRECINIT' - return + return endif nlev_ = size(p%precv) - if (present(ilev)) then + if (present(ilev)) then ilev_ = ilev if (present(ilmax)) then ilmax_ = ilmax @@ -135,22 +138,22 @@ subroutine amg_dcprecseti(p,what,val,info,ilev,ilmax,pos,idx) ilmax_ = ilev_ end if else - ilev_ = 1 + ilev_ = 1 ilmax_ = nlev_ end if - if ((ilev_<1).or.(ilev_ > nlev_)) then + if ((ilev_<1).or.(ilev_ > nlev_)) then info = -1 write(psb_err_unit,*) name,& &': Error: invalid ILEV/NLEV combination',ilev_, nlev_ return endif - if ((ilmax_<1).or.(ilmax_ > nlev_)) then + if ((ilmax_<1).or.(ilmax_ > nlev_)) then info = -1 write(psb_err_unit,*) name,& &': Error: invalid ILMAX/NLEV combination',ilmax_, nlev_ return endif - + select case(psb_toupper(what)) case ('MIN_COARSE_SIZE') p%ag_data%min_coarse_size = max(val,-1) @@ -166,144 +169,17 @@ subroutine amg_dcprecseti(p,what,val,info,ilev,ilmax,pos,idx) ! ! Set preconditioner parameters at level ilev. ! - if (present(ilev)) then - - select case(psb_toupper(what)) - case('SMOOTHER_TYPE','SUB_SOLVE','SMOOTHER_SWEEPS',& - & 'ML_CYCLE','PAR_AGGR_ALG','AGGR_ORD',& - & 'AGGR_TYPE','AGGR_PROL','AGGR_OMEGA_ALG',& - & 'AGGR_EIG','SUB_RESTR','SUB_PROL', & - & 'SUB_OVR','SUB_FILLIN',& - & 'COARSE_MAT') + if (present(ilev)) then + + select case(psb_toupper(what)) + case('SUB_OVR','SUB_FILLIN','SMOOTHER_SWEEPS') do il=ilev_, ilmax_ call p%precv(il)%set(what,val,info,pos=pos) end do - case('COARSE_SUBSOLVE') - if (ilev_ /= nlev_) then - write(psb_err_unit,*) name,& - & ': Error: Inconsistent specification of WHAT vs. ILEV' - info = -2 - return - end if - call p%precv(ilev_)%set('SUB_SOLVE',val,info,pos=pos) - case('COARSE_SOLVE') - if (ilev_ /= nlev_) then - write(psb_err_unit,*) name,& - & ': Error: Inconsistent specification of WHAT vs. ILEV' - info = -2 - return - end if - if (nlev_ > 1) then - call p%precv(nlev_)%set('COARSE_SOLVE',val,info,pos=pos) - select case (val) - case(amg_bjac_,amg_l1_bjac_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',val,info,pos=pos) -#if defined(HAVE_UMF_) - call p%precv(nlev_)%set('SUB_SOLVE',amg_umf_,info,pos=pos) -#elif defined(HAVE_SLU_) - call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) -#elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) -#else - call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) -#endif - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info) - case(amg_slu_) -#if defined(HAVE_SLU_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',val,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) -#elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#endif - case(psb_ilu_n_, psb_ilu_t_,psb_milu_n_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',val,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) - case(amg_mumps_) -#if defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',val,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#endif - case(amg_umf_) -#if defined(HAVE_UMF_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',val,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) -#elif defined(HAVE_SLU_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) -#elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#endif - - case(amg_sludist_) -#if defined(HAVE_SLUDIST_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',val,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#elif defined(HAVE_UMF_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_umf_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) -#elif defined(HAVE_SLU_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) -#elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#endif - case(amg_jac_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_diag_scale_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) - case(amg_l1_jac_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_l1_diag_scale_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) - case(amg_gs_,amg_fbgs_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) - case(amg_bwgs_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_bwgs_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) - case(amg_l1_gs_,amg_l1_fbgs_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_l1_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) - end select - - endif case('COARSE_SWEEPS') - if (ilev_ /= nlev_) then + if (ilev_ /= nlev_) then write(psb_err_unit,*) name,& & ': Error: Inconsistent specification of WHAT vs. ILEV' info = -2 @@ -312,14 +188,14 @@ subroutine amg_dcprecseti(p,what,val,info,ilev,ilmax,pos,idx) call p%precv(nlev_)%set('SMOOTHER_SWEEPS',val,info,pos=pos) case('COARSE_FILLIN') - if (ilev_ /= nlev_) then + if (ilev_ /= nlev_) then write(psb_err_unit,*) name,& & ': Error: Inconsistent specification of WHAT vs. ILEV' info = -2 return end if call p%precv(nlev_)%set('SUB_FILLIN',val,info,pos=pos) - + case default do il=ilev_, ilmax_ call p%precv(il)%set(what,val,info,pos=pos,idx=idx) @@ -327,145 +203,18 @@ subroutine amg_dcprecseti(p,what,val,info,ilev,ilmax,pos,idx) end select - else if (.not.present(ilev)) then + else if (.not.present(ilev)) then ! ! ilev not specified: set preconditioner parameters at all the appropriate ! levels ! - select case(psb_toupper(trim(what))) - case('SUB_SOLVE','SUB_RESTR','SUB_PROL',& - & 'SUB_OVR','SUB_FILLIN',& - & 'SMOOTHER_SWEEPS','SMOOTHER_TYPE') + select case(psb_toupper(trim(what))) + case('SUB_OVR','SUB_FILLIN','SMOOTHER_SWEEPS') do ilev_=1,max(1,nlev_-1) call p%precv(ilev_)%set(what,val,info,pos=pos) - if (info /= 0) return - end do - - case('ML_CYCLE','PAR_AGGR_ALG','AGGR_ORD','AGGR_PROL','AGGR_TYPE',& - & 'AGGR_OMEGA_ALG','AGGR_EIG','AGGR_FILTER') - do ilev_=1,nlev_ - call p%precv(ilev_)%set(what,val,info,pos=pos) - if (info /= 0) return + if (info /= 0) return end do - case('COARSE_MAT') - if (nlev_ > 1) then - call p%precv(nlev_)%set('COARSE_MAT',val,info,pos=pos) - end if - - case('COARSE_SOLVE') - if (nlev_ > 1) then - call p%precv(nlev_)%set('COARSE_SOLVE',val,info,pos=pos) - select case (val) - case(amg_bjac_,amg_l1_bjac_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',val,info,pos=pos) -#if defined(HAVE_UMF_) - call p%precv(nlev_)%set('SUB_SOLVE',amg_umf_,info,pos=pos) -#elif defined(HAVE_SLU_) - call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) -#elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) -#else - call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) -#endif - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info) - case(amg_slu_) -#if defined(HAVE_SLU_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',val,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) -#elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#endif - case(psb_ilu_n_, psb_ilu_t_,psb_milu_n_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',val,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) - case(amg_mumps_) -#if defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',val,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#endif - case(amg_umf_) -#if defined(HAVE_UMF_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',val,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) -#elif defined(HAVE_SLU_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) -#elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#endif - - case(amg_sludist_) -#if defined(HAVE_SLUDIST_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',val,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#elif defined(HAVE_UMF_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_umf_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) -#elif defined(HAVE_SLU_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) -#elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#endif - case(amg_jac_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_diag_scale_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) - - case(amg_l1_jac_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_l1_diag_scale_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) - case(amg_gs_,amg_fbgs_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) - case(amg_bwgs_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_bwgs_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) - case(amg_l1_gs_,amg_l1_fbgs_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_l1_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) - end select - endif - - case('COARSE_SUBSOLVE') - if (nlev_ > 1) then - call p%precv(nlev_)%set('SUB_SOLVE',val,info,pos=pos) - endif case('COARSE_SWEEPS') @@ -474,10 +223,10 @@ subroutine amg_dcprecseti(p,what,val,info,ilev,ilmax,pos,idx) end if case('COARSE_FILLIN') - if (nlev_ > 1) then + if (nlev_ > 1) then call p%precv(nlev_)%set('SUB_FILLIN',val,info,pos=pos) end if - + case default do ilev_=1,nlev_ call p%precv(ilev_)%set(what,val,info,pos=pos,idx=idx) @@ -496,7 +245,7 @@ end subroutine amg_dcprecseti ! precisely, the character parameter identified by 'what' is assigned the value ! contained in 'val'. ! For the multilevel preconditioners, the levels are numbered in increasing -! order starting from the finest one, i.e. level 1 is the finest level. +! order starting from the finest one, i.e. level 1 is the finest level. ! ! To set integer and real parameters, see amg_dprecseti and amg_dprecsetr, ! respectively. @@ -516,7 +265,7 @@ end subroutine amg_dcprecseti ! Error code. ! ilev - integer, optional, input. ! For the multilevel preconditioner, the level at which the -! preconditioner parameter has to be set. +! preconditioner parameter has to be set. ! If nlev is not present, the parameter identified by 'what' ! is set at all the appropriate levels. ! @@ -526,7 +275,7 @@ end subroutine amg_dcprecseti ! the parameter must have the same value at all the levels but the coarsest one. ! For this reason, the interface amg_precset to this routine has been built in ! such a way that ilev is not visible to the user (see amg_prec_mod.f90). -! +! subroutine amg_dcprecsetc(p,what,string,info,ilev,ilmax,pos,idx) use psb_base_mod @@ -538,6 +287,9 @@ subroutine amg_dcprecsetc(p,what,string,info,ilev,ilmax,pos,idx) use amg_d_ilu_solver use amg_d_id_solver use amg_d_gs_solver + use amg_d_ainv_solver + use amg_d_invk_solver + use amg_d_invt_solver #if defined(HAVE_UMF_) use amg_d_umf_solver #endif @@ -547,7 +299,7 @@ subroutine amg_dcprecsetc(p,what,string,info,ilev,ilmax,pos,idx) #if defined(HAVE_SLU_) use amg_d_slu_solver #endif -#if defined(HAVE_MUMPS_) +#if defined(HAVE_MUMPS_) use amg_d_mumps_solver #endif @@ -556,7 +308,7 @@ subroutine amg_dcprecsetc(p,what,string,info,ilev,ilmax,pos,idx) ! Arguments class(amg_dprec_type), intent(inout) :: p - character(len=*), intent(in) :: what + character(len=*), intent(in) :: what character(len=*), intent(in) :: string integer(psb_ipk_), intent(out) :: info integer(psb_ipk_), optional, intent(in) :: ilev,ilmax @@ -569,17 +321,17 @@ subroutine amg_dcprecsetc(p,what,string,info,ilev,ilmax,pos,idx) info = psb_success_ - if (.not.allocated(p%precv)) then + if (.not.allocated(p%precv)) then info = 3111 write(psb_err_unit,*) name,& & ': Error: uninitialized preconditioner,',& &' should call amg_PRECINIT' - return + return endif nlev_ = size(p%precv) - if (present(ilev)) then + if (present(ilev)) then ilev_ = ilev if (present(ilmax)) then ilmax_ = ilmax @@ -587,39 +339,86 @@ subroutine amg_dcprecsetc(p,what,string,info,ilev,ilmax,pos,idx) ilmax_ = ilev_ end if else - ilev_ = 1 + ilev_ = 1 ilmax_ = nlev_ end if - if ((ilev_<1).or.(ilev_ > nlev_)) then + if ((ilev_<1).or.(ilev_ > nlev_)) then info = -1 write(psb_err_unit,*) name,& &': Error: invalid ILEV/NLEV combination',ilev_, nlev_ return endif - if ((ilmax_<1).or.(ilmax_ > nlev_)) then + if ((ilmax_<1).or.(ilmax_ > nlev_)) then info = -1 write(psb_err_unit,*) name,& &': Error: invalid ILMAX/NLEV combination',ilmax_, nlev_ return endif - + ! ! Set preconditioner parameters at level ilev. ! - if (present(ilev)) then - - select case(psb_toupper(what)) - case('SMOOTHER_TYPE','SUB_SOLVE',& - & 'ML_CYCLE','PAR_AGGR_ALG','AGGR_ORD',& - & 'AGGR_TYPE','AGGR_PROL','AGGR_OMEGA_ALG',& - & 'AGGR_EIG','SUB_RESTR','SUB_PROL', & - & 'COARSE_MAT') + if (present(ilev)) then + + select case(psb_toupper(what)) + case('SMOOTHER_TYPE') + ! Select the type of smoother between the one implemented in the library + ! every new smoother should be added here + select case(psb_toupper(string)) + case ('BJAC') + do il=ilev_, ilmax_ + call p%precv(il)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + end do + case ('L1-BJAC') + do il=ilev_, ilmax_ + call p%precv(il)%set('SMOOTHER_TYPE',amg_l1_bjac_,info,pos=pos) + end do + case('GS','FWGS','FBGS') + do il=ilev_, ilmax_ + call p%precv(il)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(il)%set('SUB_SOLVE',amg_gs_,info,pos=pos) + end do + case('L1-GS','L1-FWGS','L1-FBGS') + do il=ilev_, ilmax_ + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_l1_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos) + end do + case ('BWGS') + do il=ilev_, ilmax_ + call p%precv(il)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(il)%set('SUB_SOLVE',amg_bwgs_,info,pos=pos) + end do + case('JACOBI') + do il=ilev_, ilmax_ + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_diag_scale_,info,pos=pos) + end do + case('L1-JACOBI') + do il=ilev_, ilmax_ + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_l1_diag_scale_,info,pos=pos) + end do + end select + case('SUB_SOLVE','ML_CYCLE','PAR_AGGR_ALG','AGGR_TYPE','SUB_RESTR'& + & ,'SUB_PROL') + ! These are handled elsewhere do il=ilev_, ilmax_ - call p%precv(il)%set(what,string,info,pos=pos) + call p%precv(nlev_)%set(what,string,info,pos=pos) end do - + case('COARSE_MAT') + ! Select if the coarsest matrix is handled in a distributed way, few + ! rows per rank, or if it is replicated completely on every rank + select case(psb_toupper(string)) + case('DISTR') + do il=ilev_, ilmax_ + call p%precv(il)%set(what,amg_distr_mat_,info,pos=pos) + end do + case('REPL') + do il=ilev_, ilmax_ + call p%precv(il)%set(what,amg_repl_mat_,info,pos=pos) + end do case('COARSE_SUBSOLVE') - if (ilev_ /= nlev_) then + if (ilev_ /= nlev_) then write(psb_err_unit,*) name,& & ': Error: Inconsistent specification of WHAT vs. ILEV' info = -2 @@ -627,119 +426,131 @@ subroutine amg_dcprecsetc(p,what,string,info,ilev,ilmax,pos,idx) end if call p%precv(ilev_)%set('SUB_SOLVE',string,info,pos=pos) case('COARSE_SOLVE') - if (ilev_ /= nlev_) then + if (ilev_ /= nlev_) then write(psb_err_unit,*) name,& & ': Error: Inconsistent specification of WHAT vs. ILEV' info = -2 return end if - if (nlev_ > 1) then - call p%precv(nlev_)%set('COARSE_SOLVE',string,info,pos=pos) - select case (psb_toupper(trim(string))) - case('BJAC', 'L1-BJAC') - call p%precv(nlev_)%set('SMOOTHER_TYPE',psb_toupper(trim(string)),info,pos=pos) + if (nlev_ > 1) then + select case (psb_toupper(string)) + case('BJAC') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + case('L1-BJAC') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_l1_bjac_,info,pos=pos) #if defined(HAVE_UMF_) - call p%precv(nlev_)%set('SUB_SOLVE','UMF',info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_umf_,info,pos=pos) #elif defined(HAVE_SLU_) - call p%precv(nlev_)%set('SUB_SOLVE','SLU',info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) #elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SUB_SOLVE','MUMPS',info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) #else - call p%precv(nlev_)%set('SUB_SOLVE','ILU',info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) #endif - call p%precv(nlev_)%set('COARSE_MAT','dist',info) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info) case('SLU') #if defined(HAVE_SLU_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','SLU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','REPL',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) #elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','MUMPS',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','ILU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) #endif - case('ILU','MILU','ILUT') - call p%precv(nlev_)%set('SMOOTHER_TYPE','bjac',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',string,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','REPL',info,pos=pos) + case('ILU') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) + case('ILUT') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_t_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) + case('MILU') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_milu_n_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) case('MUMPS') -#if defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',string,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','ILU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) +#if defined(HAVE_MUMPS_) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) #endif - case('UMF') -#if defined(HAVE_UMF_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',string,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','REPL',info,pos=pos) + case('UMF') +#if defined(HAVE_UMF_) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_umf_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) #elif defined(HAVE_SLU_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','SLU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','REPL',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) #elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','MUMPS',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','ILU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) -#endif + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) +#endif + case('SLUDIST') -#if defined(HAVE_SLUDIST_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',string,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) -#elif defined(HAVE_UMF_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','UMF',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','REPL',info,pos=pos) +#if defined(HAVE_SLUDIST_) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_sludist_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) +#elif defined(HAVE_UMF_) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_umf_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) #elif defined(HAVE_SLU_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','SLU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','REPL',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) #elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','MUMPS',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','ILU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) #endif - case('JAC','JACOBI') - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','DIAG',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) - - case('L1-JACOBI') - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','L1-DIAG',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) - case('GS','FWGS','FBGS') - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','GS',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) + case('JACOBI','JAC') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_diag_scale_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) + + case('L1-JACOBI','L1-JAC') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_l1_diag_scale_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) + case('GS','FBGS') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) case('BWGS') - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','BWGS',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) - case('L1-GS') - call p%precv(nlev_)%set('SMOOTHER_TYPE','L1-BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','GS',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_bwgs_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) + case('L1-GS','L1-FBGS') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_l1_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) end select - - endif + + end if + + end select case default do il=ilev_, ilmax_ @@ -748,141 +559,154 @@ subroutine amg_dcprecsetc(p,what,string,info,ilev,ilmax,pos,idx) end select - else if (.not.present(ilev)) then + + + else if (.not.present(ilev)) then ! ! ilev not specified: set preconditioner parameters at all the appropriate ! levels ! - select case(psb_toupper(trim(what))) + select case(psb_toupper(trim(what))) case('SUB_SOLVE','SUB_RESTR','SUB_PROL',& & 'SMOOTHER_TYPE') do ilev_=1,max(1,nlev_-1) call p%precv(ilev_)%set(what,string,info,pos=pos) - if (info /= 0) return + if (info /= 0) return end do case('ML_CYCLE','PAR_AGGR_ALG','AGGR_ORD','AGGR_PROL','AGGR_TYPE',& & 'AGGR_OMEGA_ALG','AGGR_EIG','AGGR_FILTER') do ilev_=1,nlev_ call p%precv(ilev_)%set(what,string,info,pos=pos) - if (info /= 0) return + if (info /= 0) return end do case('COARSE_MAT') - if (nlev_ > 1) then + if (nlev_ > 1) then call p%precv(nlev_)%set('COARSE_MAT',string,info,pos=pos) end if case('COARSE_SOLVE') - if (nlev_ > 1) then + if (nlev_ > 1) then call p%precv(nlev_)%set('COARSE_SOLVE',string,info,pos=pos) select case (psb_toupper(trim(string))) - case('BJAC', 'L1-BJAC') - call p%precv(nlev_)%set('SMOOTHER_TYPE',psb_toupper(trim(string)),info,pos=pos) + case('BJAC') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + case('L1-BJAC') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_l1_bjac_,info,pos=pos) #if defined(HAVE_UMF_) - call p%precv(nlev_)%set('SUB_SOLVE','UMF',info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_umf_,info,pos=pos) #elif defined(HAVE_SLU_) - call p%precv(nlev_)%set('SUB_SOLVE','SLU',info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) #elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SUB_SOLVE','MUMPS',info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) #else - call p%precv(nlev_)%set('SUB_SOLVE','ILU',info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) #endif - call p%precv(nlev_)%set('COARSE_MAT','DIST',info) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info) case('SLU') #if defined(HAVE_SLU_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',string,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','REPL',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) #elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','MUMPS',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','ILU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) #endif - case('ILU', 'ILUT','MILU') - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',string,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','REPL',info,pos=pos) + case('ILU') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) + case('ILUT') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_t_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) + case('MILU') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_milu_n_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) case('MUMPS') -#if defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',string,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','ILU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) +#if defined(HAVE_MUMPS_) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) #endif - case('UMF') -#if defined(HAVE_UMF_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',string,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','REPL',info,pos=pos) + case('UMF') +#if defined(HAVE_UMF_) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_umf_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) #elif defined(HAVE_SLU_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','SLU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','REPL',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) #elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','MUMPS',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','ILU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) #endif - + case('SLUDIST') -#if defined(HAVE_SLUDIST_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',string,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) -#elif defined(HAVE_UMF_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','UMF',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','REPL',info,pos=pos) +#if defined(HAVE_SLUDIST_) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_sludist_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) +#elif defined(HAVE_UMF_) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_umf_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) #elif defined(HAVE_SLU_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','SLU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','REPL',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) #elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','MUMPS',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','ILU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) #endif - case('JAC','JACOBI') - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','DIAG',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) - case('L1-JACOBI') - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','L1-DIAG',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) - case('GS','FWGS','FBGS') - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','GS',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) + case('JACOBI','JAC') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_diag_scale_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) + + case('L1-JACOBI','L1-JAC') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_l1_diag_scale_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) + case('GS','FBGS') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) case('BWGS') - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','BWGS',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) - case('L1-GS') - call p%precv(nlev_)%set('SMOOTHER_TYPE','L1-BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','GS',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_bwgs_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) + case('L1-FBGS','L1-GS') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_l1_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) end select - endif + endif case('COARSE_SUBSOLVE') - if (nlev_ > 1) then + if (nlev_ > 1) then call p%precv(nlev_)%set('SUB_SOLVE',string,info,pos=pos) endif @@ -894,7 +718,7 @@ subroutine amg_dcprecsetc(p,what,string,info,ilev,ilmax,pos,idx) endif - + end subroutine amg_dcprecsetc @@ -906,7 +730,7 @@ end subroutine amg_dcprecsetc ! precisely, the real parameter identified by 'what' is assigned the value ! contained in 'val'. ! For the multilevel preconditioners, the levels are numbered in increasing -! order starting from the finest one, i.e. level 1 is the finest level. +! order starting from the finest one, i.e. level 1 is the finest level. ! ! To set integer and character parameters, see amg_dprecseti and amg_dprecsetc, ! respectively. @@ -925,7 +749,7 @@ end subroutine amg_dcprecsetc ! Error code. ! ilev - integer, optional, input. ! For the multilevel preconditioner, the level at which the -! preconditioner parameter has to be set. +! preconditioner parameter has to be set. ! If nlev is not present, the parameter identified by 'what' ! is set at all the appropriate levels. ! @@ -935,7 +759,7 @@ end subroutine amg_dcprecsetc ! the parameter must have the same value at all the levels but the coarsest one. ! For this reason, the interface amg_precset to this routine has been built in ! such a way that ilev is not visible to the user (see amg_prec_mod.f90). -! +! subroutine amg_dcprecsetr(p,what,val,info,ilev,ilmax,pos,idx) use psb_base_mod @@ -945,7 +769,7 @@ subroutine amg_dcprecsetr(p,what,val,info,ilev,ilmax,pos,idx) ! Arguments class(amg_dprec_type), intent(inout) :: p - character(len=*), intent(in) :: what + character(len=*), intent(in) :: what real(psb_dpk_), intent(in) :: val integer(psb_ipk_), intent(out) :: info integer(psb_ipk_), optional, intent(in) :: ilev,ilmax @@ -954,15 +778,15 @@ subroutine amg_dcprecsetr(p,what,val,info,ilev,ilmax,pos,idx) ! Local variables integer(psb_ipk_) :: ilev_,nlev_, ilmax_, il - real(psb_dpk_) :: thr + real(psb_dpk_) :: thr character(len=*), parameter :: name='amg_precsetr' info = psb_success_ - if (present(ilev)) then + if (present(ilev)) then ilev_ = ilev else - ilev_ = 1 + ilev_ = 1 end if select case(psb_toupper(what)) @@ -971,16 +795,16 @@ subroutine amg_dcprecsetr(p,what,val,info,ilev,ilmax,pos,idx) return end select - if (.not.allocated(p%precv)) then + if (.not.allocated(p%precv)) then write(psb_err_unit,*) name,& &': Error: uninitialized preconditioner,',& - &' should call amg_PRECINIT' + &' should call amg_PRECINIT' info = 3111 - return + return endif nlev_ = size(p%precv) - if (present(ilev)) then + if (present(ilev)) then ilev_ = ilev if (present(ilmax)) then ilmax_ = ilmax @@ -988,16 +812,16 @@ subroutine amg_dcprecsetr(p,what,val,info,ilev,ilmax,pos,idx) ilmax_ = ilev_ end if else - ilev_ = 1 + ilev_ = 1 ilmax_ = nlev_ end if - if ((ilev_<1).or.(ilev_ > nlev_)) then + if ((ilev_<1).or.(ilev_ > nlev_)) then info = -1 write(psb_err_unit,*) name,& &': Error: invalid ILEV/NLEV combination',ilev_, nlev_ return endif - if ((ilmax_<1).or.(ilmax_ > nlev_)) then + if ((ilmax_<1).or.(ilmax_ > nlev_)) then info = -1 write(psb_err_unit,*) name,& &': Error: invalid ILMAX/NLEV combination',ilmax_, nlev_ @@ -1008,18 +832,18 @@ subroutine amg_dcprecsetr(p,what,val,info,ilev,ilmax,pos,idx) ! ! Set preconditioner parameters at level ilev. ! - if (present(ilev)) then + if (present(ilev)) then do il=ilev_, ilmax_ call p%precv(il)%set(what,val,info,pos=pos,idx=idx) end do - else if (.not.present(ilev)) then + else if (.not.present(ilev)) then ! ! ilev not specified: set preconditioner parameters at all the appropriate levels ! - select case(psb_toupper(what)) + select case(psb_toupper(what)) case('COARSE_ILUTHRS') ilev_=nlev_ call p%precv(ilev_)%set('SUB_ILUTHRS',val,info,pos=pos) @@ -1034,5 +858,3 @@ subroutine amg_dcprecsetr(p,what,val,info,ilev,ilmax,pos,idx) endif end subroutine amg_dcprecsetr - - diff --git a/amgprec/impl/amg_scprecset.F90 b/amgprec/impl/amg_scprecset.F90 index 1ebb6a4c..2fd1fb29 100644 --- a/amgprec/impl/amg_scprecset.F90 +++ b/amgprec/impl/amg_scprecset.F90 @@ -1,15 +1,15 @@ -! -! +! +! ! AMG4PSBLAS version 1.0 ! Algebraic Multigrid Package ! based on PSBLAS (Parallel Sparse BLAS version 3.5) -! -! (C) Copyright 2020 -! -! Salvatore Filippone -! Pasqua D'Ambra -! Fabio Durastante -! +! +! (C) Copyright 2020 +! +! Salvatore Filippone +! Pasqua D'Ambra +! Fabio Durastante +! ! Redistribution and use in source and binary forms, with or without ! modification, are permitted provided that the following conditions ! are met: @@ -21,7 +21,7 @@ ! 3. The name of the AMG4PSBLAS group or the names of its contributors may ! not be used to endorse or promote products derived from this ! software without specific written permission. -! +! ! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED ! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR @@ -33,8 +33,8 @@ ! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ! POSSIBILITY OF SUCH DAMAGE. -! -! +! +! ! File: amg_sprecset.f90 ! ! Subroutine: amg_sprecseti @@ -44,7 +44,7 @@ ! precisely, the integer parameter identified by 'what' is assigned the value ! contained in 'val'. ! For the multilevel preconditioners, the levels are numbered in increasing -! order starting from the finest one, i.e. level 1 is the finest level. +! order starting from the finest one, i.e. level 1 is the finest level. ! ! To set character and real parameters, see amg_sprecsetc and amg_sprecsetr, ! respectively. @@ -64,7 +64,7 @@ ! Error code. ! ilev - integer, optional, input. ! For the multilevel preconditioner, the level at which the -! preconditioner parameter has to be set. +! preconditioner parameter has to be set. ! If nlev is not present, the parameter identified by 'what' ! is set at all the appropriate levels. ! @@ -74,7 +74,7 @@ ! the parameter must have the same value at all the levels but the coarsest one. ! For this reason, the interface amg_precset to this routine has been built in ! such a way that ilev is not visible to the user (see amg_prec_mod.f90). -! +! subroutine amg_scprecseti(p,what,val,info,ilev,ilmax,pos,idx) use psb_base_mod @@ -86,10 +86,13 @@ subroutine amg_scprecseti(p,what,val,info,ilev,ilmax,pos,idx) use amg_s_ilu_solver use amg_s_id_solver use amg_s_gs_solver + use amg_s_ainv_solver + use amg_s_invk_solver + use amg_s_invt_solver #if defined(HAVE_SLU_) use amg_s_slu_solver #endif -#if defined(HAVE_MUMPS_) +#if defined(HAVE_MUMPS_) use amg_s_mumps_solver #endif @@ -98,7 +101,7 @@ subroutine amg_scprecseti(p,what,val,info,ilev,ilmax,pos,idx) ! Arguments class(amg_sprec_type), intent(inout) :: p - character(len=*), intent(in) :: what + character(len=*), intent(in) :: what integer(psb_ipk_), intent(in) :: val integer(psb_ipk_), intent(out) :: info integer(psb_ipk_), optional, intent(in) :: ilev,ilmax @@ -111,17 +114,17 @@ subroutine amg_scprecseti(p,what,val,info,ilev,ilmax,pos,idx) info = psb_success_ - if (.not.allocated(p%precv)) then + if (.not.allocated(p%precv)) then info = 3111 write(psb_err_unit,*) name,& & ': Error: uninitialized preconditioner,',& &' should call amg_PRECINIT' - return + return endif nlev_ = size(p%precv) - if (present(ilev)) then + if (present(ilev)) then ilev_ = ilev if (present(ilmax)) then ilmax_ = ilmax @@ -129,22 +132,22 @@ subroutine amg_scprecseti(p,what,val,info,ilev,ilmax,pos,idx) ilmax_ = ilev_ end if else - ilev_ = 1 + ilev_ = 1 ilmax_ = nlev_ end if - if ((ilev_<1).or.(ilev_ > nlev_)) then + if ((ilev_<1).or.(ilev_ > nlev_)) then info = -1 write(psb_err_unit,*) name,& &': Error: invalid ILEV/NLEV combination',ilev_, nlev_ return endif - if ((ilmax_<1).or.(ilmax_ > nlev_)) then + if ((ilmax_<1).or.(ilmax_ > nlev_)) then info = -1 write(psb_err_unit,*) name,& &': Error: invalid ILMAX/NLEV combination',ilmax_, nlev_ return endif - + select case(psb_toupper(what)) case ('MIN_COARSE_SIZE') p%ag_data%min_coarse_size = max(val,-1) @@ -160,130 +163,17 @@ subroutine amg_scprecseti(p,what,val,info,ilev,ilmax,pos,idx) ! ! Set preconditioner parameters at level ilev. ! - if (present(ilev)) then - - select case(psb_toupper(what)) - case('SMOOTHER_TYPE','SUB_SOLVE','SMOOTHER_SWEEPS',& - & 'ML_CYCLE','PAR_AGGR_ALG','AGGR_ORD',& - & 'AGGR_TYPE','AGGR_PROL','AGGR_OMEGA_ALG',& - & 'AGGR_EIG','SUB_RESTR','SUB_PROL', & - & 'SUB_OVR','SUB_FILLIN',& - & 'COARSE_MAT') + if (present(ilev)) then + + select case(psb_toupper(what)) + case('SUB_OVR','SUB_FILLIN','SMOOTHER_SWEEPS') do il=ilev_, ilmax_ call p%precv(il)%set(what,val,info,pos=pos) end do - case('COARSE_SUBSOLVE') - if (ilev_ /= nlev_) then - write(psb_err_unit,*) name,& - & ': Error: Inconsistent specification of WHAT vs. ILEV' - info = -2 - return - end if - call p%precv(ilev_)%set('SUB_SOLVE',val,info,pos=pos) - case('COARSE_SOLVE') - if (ilev_ /= nlev_) then - write(psb_err_unit,*) name,& - & ': Error: Inconsistent specification of WHAT vs. ILEV' - info = -2 - return - end if - if (nlev_ > 1) then - call p%precv(nlev_)%set('COARSE_SOLVE',val,info,pos=pos) - select case (val) - case(amg_bjac_,amg_l1_bjac_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',val,info,pos=pos) -#if defined(HAVE_SLU_) - call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) -#elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) -#else - call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) -#endif - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info) - case(amg_slu_) -#if defined(HAVE_SLU_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',val,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) -#elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#endif - case(psb_ilu_n_, psb_ilu_t_,psb_milu_n_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',val,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) - case(amg_mumps_) -#if defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',val,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#endif - case(amg_umf_) -#if defined(HAVE_SLU_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) -#elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#endif - - case(amg_sludist_) -#if defined(HAVE_SLU_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) -#elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#endif - case(amg_jac_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_diag_scale_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) - case(amg_l1_jac_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_l1_diag_scale_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) - case(amg_gs_,amg_fbgs_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) - case(amg_bwgs_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_bwgs_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) - case(amg_l1_gs_,amg_l1_fbgs_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_l1_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) - end select - - endif case('COARSE_SWEEPS') - if (ilev_ /= nlev_) then + if (ilev_ /= nlev_) then write(psb_err_unit,*) name,& & ': Error: Inconsistent specification of WHAT vs. ILEV' info = -2 @@ -292,14 +182,14 @@ subroutine amg_scprecseti(p,what,val,info,ilev,ilmax,pos,idx) call p%precv(nlev_)%set('SMOOTHER_SWEEPS',val,info,pos=pos) case('COARSE_FILLIN') - if (ilev_ /= nlev_) then + if (ilev_ /= nlev_) then write(psb_err_unit,*) name,& & ': Error: Inconsistent specification of WHAT vs. ILEV' info = -2 return end if call p%precv(nlev_)%set('SUB_FILLIN',val,info,pos=pos) - + case default do il=ilev_, ilmax_ call p%precv(il)%set(what,val,info,pos=pos,idx=idx) @@ -307,131 +197,18 @@ subroutine amg_scprecseti(p,what,val,info,ilev,ilmax,pos,idx) end select - else if (.not.present(ilev)) then + else if (.not.present(ilev)) then ! ! ilev not specified: set preconditioner parameters at all the appropriate ! levels ! - select case(psb_toupper(trim(what))) - case('SUB_SOLVE','SUB_RESTR','SUB_PROL',& - & 'SUB_OVR','SUB_FILLIN',& - & 'SMOOTHER_SWEEPS','SMOOTHER_TYPE') + select case(psb_toupper(trim(what))) + case('SUB_OVR','SUB_FILLIN','SMOOTHER_SWEEPS') do ilev_=1,max(1,nlev_-1) call p%precv(ilev_)%set(what,val,info,pos=pos) - if (info /= 0) return - end do - - case('ML_CYCLE','PAR_AGGR_ALG','AGGR_ORD','AGGR_PROL','AGGR_TYPE',& - & 'AGGR_OMEGA_ALG','AGGR_EIG','AGGR_FILTER') - do ilev_=1,nlev_ - call p%precv(ilev_)%set(what,val,info,pos=pos) - if (info /= 0) return + if (info /= 0) return end do - case('COARSE_MAT') - if (nlev_ > 1) then - call p%precv(nlev_)%set('COARSE_MAT',val,info,pos=pos) - end if - - case('COARSE_SOLVE') - if (nlev_ > 1) then - call p%precv(nlev_)%set('COARSE_SOLVE',val,info,pos=pos) - select case (val) - case(amg_bjac_,amg_l1_bjac_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',val,info,pos=pos) -#if defined(HAVE_SLU_) - call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) -#elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) -#else - call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) -#endif - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info) - case(amg_slu_) -#if defined(HAVE_SLU_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',val,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) -#elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#endif - case(psb_ilu_n_, psb_ilu_t_,psb_milu_n_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',val,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) - case(amg_mumps_) -#if defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',val,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#endif - case(amg_umf_) -#if defined(HAVE_SLU_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) -#elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#endif - - case(amg_sludist_) -#if defined(HAVE_SLU_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) -#elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#endif - case(amg_jac_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_diag_scale_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) - - case(amg_l1_jac_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_l1_diag_scale_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) - case(amg_gs_,amg_fbgs_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) - case(amg_bwgs_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_bwgs_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) - case(amg_l1_gs_,amg_l1_fbgs_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_l1_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) - end select - endif - - case('COARSE_SUBSOLVE') - if (nlev_ > 1) then - call p%precv(nlev_)%set('SUB_SOLVE',val,info,pos=pos) - endif case('COARSE_SWEEPS') @@ -440,10 +217,10 @@ subroutine amg_scprecseti(p,what,val,info,ilev,ilmax,pos,idx) end if case('COARSE_FILLIN') - if (nlev_ > 1) then + if (nlev_ > 1) then call p%precv(nlev_)%set('SUB_FILLIN',val,info,pos=pos) end if - + case default do ilev_=1,nlev_ call p%precv(ilev_)%set(what,val,info,pos=pos,idx=idx) @@ -462,7 +239,7 @@ end subroutine amg_scprecseti ! precisely, the character parameter identified by 'what' is assigned the value ! contained in 'val'. ! For the multilevel preconditioners, the levels are numbered in increasing -! order starting from the finest one, i.e. level 1 is the finest level. +! order starting from the finest one, i.e. level 1 is the finest level. ! ! To set integer and real parameters, see amg_sprecseti and amg_sprecsetr, ! respectively. @@ -482,7 +259,7 @@ end subroutine amg_scprecseti ! Error code. ! ilev - integer, optional, input. ! For the multilevel preconditioner, the level at which the -! preconditioner parameter has to be set. +! preconditioner parameter has to be set. ! If nlev is not present, the parameter identified by 'what' ! is set at all the appropriate levels. ! @@ -492,7 +269,7 @@ end subroutine amg_scprecseti ! the parameter must have the same value at all the levels but the coarsest one. ! For this reason, the interface amg_precset to this routine has been built in ! such a way that ilev is not visible to the user (see amg_prec_mod.f90). -! +! subroutine amg_scprecsetc(p,what,string,info,ilev,ilmax,pos,idx) use psb_base_mod @@ -504,10 +281,13 @@ subroutine amg_scprecsetc(p,what,string,info,ilev,ilmax,pos,idx) use amg_s_ilu_solver use amg_s_id_solver use amg_s_gs_solver + use amg_s_ainv_solver + use amg_s_invk_solver + use amg_s_invt_solver #if defined(HAVE_SLU_) use amg_s_slu_solver #endif -#if defined(HAVE_MUMPS_) +#if defined(HAVE_MUMPS_) use amg_s_mumps_solver #endif @@ -516,7 +296,7 @@ subroutine amg_scprecsetc(p,what,string,info,ilev,ilmax,pos,idx) ! Arguments class(amg_sprec_type), intent(inout) :: p - character(len=*), intent(in) :: what + character(len=*), intent(in) :: what character(len=*), intent(in) :: string integer(psb_ipk_), intent(out) :: info integer(psb_ipk_), optional, intent(in) :: ilev,ilmax @@ -529,17 +309,17 @@ subroutine amg_scprecsetc(p,what,string,info,ilev,ilmax,pos,idx) info = psb_success_ - if (.not.allocated(p%precv)) then + if (.not.allocated(p%precv)) then info = 3111 write(psb_err_unit,*) name,& & ': Error: uninitialized preconditioner,',& &' should call amg_PRECINIT' - return + return endif nlev_ = size(p%precv) - if (present(ilev)) then + if (present(ilev)) then ilev_ = ilev if (present(ilmax)) then ilmax_ = ilmax @@ -547,39 +327,86 @@ subroutine amg_scprecsetc(p,what,string,info,ilev,ilmax,pos,idx) ilmax_ = ilev_ end if else - ilev_ = 1 + ilev_ = 1 ilmax_ = nlev_ end if - if ((ilev_<1).or.(ilev_ > nlev_)) then + if ((ilev_<1).or.(ilev_ > nlev_)) then info = -1 write(psb_err_unit,*) name,& &': Error: invalid ILEV/NLEV combination',ilev_, nlev_ return endif - if ((ilmax_<1).or.(ilmax_ > nlev_)) then + if ((ilmax_<1).or.(ilmax_ > nlev_)) then info = -1 write(psb_err_unit,*) name,& &': Error: invalid ILMAX/NLEV combination',ilmax_, nlev_ return endif - + ! ! Set preconditioner parameters at level ilev. ! - if (present(ilev)) then - - select case(psb_toupper(what)) - case('SMOOTHER_TYPE','SUB_SOLVE',& - & 'ML_CYCLE','PAR_AGGR_ALG','AGGR_ORD',& - & 'AGGR_TYPE','AGGR_PROL','AGGR_OMEGA_ALG',& - & 'AGGR_EIG','SUB_RESTR','SUB_PROL', & - & 'COARSE_MAT') + if (present(ilev)) then + + select case(psb_toupper(what)) + case('SMOOTHER_TYPE') + ! Select the type of smoother between the one implemented in the library + ! every new smoother should be added here + select case(psb_toupper(string)) + case ('BJAC') + do il=ilev_, ilmax_ + call p%precv(il)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + end do + case ('L1-BJAC') + do il=ilev_, ilmax_ + call p%precv(il)%set('SMOOTHER_TYPE',amg_l1_bjac_,info,pos=pos) + end do + case('GS','FWGS','FBGS') + do il=ilev_, ilmax_ + call p%precv(il)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(il)%set('SUB_SOLVE',amg_gs_,info,pos=pos) + end do + case('L1-GS','L1-FWGS','L1-FBGS') + do il=ilev_, ilmax_ + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_l1_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos) + end do + case ('BWGS') + do il=ilev_, ilmax_ + call p%precv(il)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(il)%set('SUB_SOLVE',amg_bwgs_,info,pos=pos) + end do + case('JACOBI') + do il=ilev_, ilmax_ + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_diag_scale_,info,pos=pos) + end do + case('L1-JACOBI') + do il=ilev_, ilmax_ + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_l1_diag_scale_,info,pos=pos) + end do + end select + case('SUB_SOLVE','ML_CYCLE','PAR_AGGR_ALG','AGGR_TYPE','SUB_RESTR'& + & ,'SUB_PROL') + ! These are handled elsewhere do il=ilev_, ilmax_ - call p%precv(il)%set(what,string,info,pos=pos) + call p%precv(nlev_)%set(what,string,info,pos=pos) end do - + case('COARSE_MAT') + ! Select if the coarsest matrix is handled in a distributed way, few + ! rows per rank, or if it is replicated completely on every rank + select case(psb_toupper(string)) + case('DISTR') + do il=ilev_, ilmax_ + call p%precv(il)%set(what,amg_distr_mat_,info,pos=pos) + end do + case('REPL') + do il=ilev_, ilmax_ + call p%precv(il)%set(what,amg_repl_mat_,info,pos=pos) + end do case('COARSE_SUBSOLVE') - if (ilev_ /= nlev_) then + if (ilev_ /= nlev_) then write(psb_err_unit,*) name,& & ': Error: Inconsistent specification of WHAT vs. ILEV' info = -2 @@ -587,106 +414,117 @@ subroutine amg_scprecsetc(p,what,string,info,ilev,ilmax,pos,idx) end if call p%precv(ilev_)%set('SUB_SOLVE',string,info,pos=pos) case('COARSE_SOLVE') - if (ilev_ /= nlev_) then + if (ilev_ /= nlev_) then write(psb_err_unit,*) name,& & ': Error: Inconsistent specification of WHAT vs. ILEV' info = -2 return end if - if (nlev_ > 1) then - call p%precv(nlev_)%set('COARSE_SOLVE',string,info,pos=pos) - select case (psb_toupper(trim(string))) - case('BJAC', 'L1-BJAC') - call p%precv(nlev_)%set('SMOOTHER_TYPE',psb_toupper(trim(string)),info,pos=pos) + if (nlev_ > 1) then + select case (psb_toupper(string)) + case('BJAC') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + case('L1-BJAC') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_l1_bjac_,info,pos=pos) #if defined(HAVE_SLU_) - call p%precv(nlev_)%set('SUB_SOLVE','SLU',info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) #elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SUB_SOLVE','MUMPS',info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) #else - call p%precv(nlev_)%set('SUB_SOLVE','ILU',info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) #endif - call p%precv(nlev_)%set('COARSE_MAT','dist',info) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info) case('SLU') #if defined(HAVE_SLU_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','SLU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','REPL',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) #elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','MUMPS',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','ILU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) #endif - case('ILU','MILU','ILUT') - call p%precv(nlev_)%set('SMOOTHER_TYPE','bjac',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',string,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','REPL',info,pos=pos) + case('ILU') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) + case('ILUT') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_t_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) + case('MILU') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_milu_n_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) case('MUMPS') -#if defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',string,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','ILU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) +#if defined(HAVE_MUMPS_) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) #endif case('UMF') #if defined(HAVE_SLU_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','SLU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','REPL',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) #elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','MUMPS',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','ILU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) #endif - + case('SLUDIST') #if defined(HAVE_SLU_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','SLU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','REPL',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) #elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','MUMPS',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','ILU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) #endif - case('JAC','JACOBI') - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','DIAG',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) - - case('L1-JACOBI') - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','L1-DIAG',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) - case('GS','FWGS','FBGS') - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','GS',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) + case('JACOBI','JAC') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_diag_scale_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) + + case('L1-JACOBI','L1-JAC') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_l1_diag_scale_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) + case('GS','FBGS') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) case('BWGS') - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','BWGS',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) - case('L1-GS') - call p%precv(nlev_)%set('SMOOTHER_TYPE','L1-BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','GS',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_bwgs_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) + case('L1-GS','L1-FBGS') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_l1_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) end select - - endif + + end if + + end select case default do il=ilev_, ilmax_ @@ -695,127 +533,140 @@ subroutine amg_scprecsetc(p,what,string,info,ilev,ilmax,pos,idx) end select - else if (.not.present(ilev)) then + + + else if (.not.present(ilev)) then ! ! ilev not specified: set preconditioner parameters at all the appropriate ! levels ! - select case(psb_toupper(trim(what))) + select case(psb_toupper(trim(what))) case('SUB_SOLVE','SUB_RESTR','SUB_PROL',& & 'SMOOTHER_TYPE') do ilev_=1,max(1,nlev_-1) call p%precv(ilev_)%set(what,string,info,pos=pos) - if (info /= 0) return + if (info /= 0) return end do case('ML_CYCLE','PAR_AGGR_ALG','AGGR_ORD','AGGR_PROL','AGGR_TYPE',& & 'AGGR_OMEGA_ALG','AGGR_EIG','AGGR_FILTER') do ilev_=1,nlev_ call p%precv(ilev_)%set(what,string,info,pos=pos) - if (info /= 0) return + if (info /= 0) return end do case('COARSE_MAT') - if (nlev_ > 1) then + if (nlev_ > 1) then call p%precv(nlev_)%set('COARSE_MAT',string,info,pos=pos) end if case('COARSE_SOLVE') - if (nlev_ > 1) then + if (nlev_ > 1) then call p%precv(nlev_)%set('COARSE_SOLVE',string,info,pos=pos) select case (psb_toupper(trim(string))) - case('BJAC', 'L1-BJAC') - call p%precv(nlev_)%set('SMOOTHER_TYPE',psb_toupper(trim(string)),info,pos=pos) + case('BJAC') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + case('L1-BJAC') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_l1_bjac_,info,pos=pos) #if defined(HAVE_SLU_) - call p%precv(nlev_)%set('SUB_SOLVE','SLU',info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) #elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SUB_SOLVE','MUMPS',info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) #else - call p%precv(nlev_)%set('SUB_SOLVE','ILU',info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) #endif - call p%precv(nlev_)%set('COARSE_MAT','DIST',info) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info) case('SLU') #if defined(HAVE_SLU_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',string,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','REPL',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) #elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','MUMPS',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','ILU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) #endif - case('ILU', 'ILUT','MILU') - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',string,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','REPL',info,pos=pos) + case('ILU') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) + case('ILUT') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_t_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) + case('MILU') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_milu_n_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) case('MUMPS') -#if defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',string,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','ILU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) +#if defined(HAVE_MUMPS_) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) #endif - case('UMF') + case('UMF') #if defined(HAVE_SLU_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','SLU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','REPL',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) #elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','MUMPS',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','ILU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) #endif - + case('SLUDIST') #if defined(HAVE_SLU_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','SLU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','REPL',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) #elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','MUMPS',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','ILU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) #endif - case('JAC','JACOBI') - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','DIAG',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) - case('L1-JACOBI') - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','L1-DIAG',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) - case('GS','FWGS','FBGS') - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','GS',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) + case('JACOBI','JAC') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_diag_scale_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) + + case('L1-JACOBI','L1-JAC') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_l1_diag_scale_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) + case('GS','FBGS') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) case('BWGS') - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','BWGS',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) - case('L1-GS') - call p%precv(nlev_)%set('SMOOTHER_TYPE','L1-BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','GS',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_bwgs_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) + case('L1-FBGS','L1-GS') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_l1_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) end select - endif + endif case('COARSE_SUBSOLVE') - if (nlev_ > 1) then + if (nlev_ > 1) then call p%precv(nlev_)%set('SUB_SOLVE',string,info,pos=pos) endif @@ -827,7 +678,7 @@ subroutine amg_scprecsetc(p,what,string,info,ilev,ilmax,pos,idx) endif - + end subroutine amg_scprecsetc @@ -839,7 +690,7 @@ end subroutine amg_scprecsetc ! precisely, the real parameter identified by 'what' is assigned the value ! contained in 'val'. ! For the multilevel preconditioners, the levels are numbered in increasing -! order starting from the finest one, i.e. level 1 is the finest level. +! order starting from the finest one, i.e. level 1 is the finest level. ! ! To set integer and character parameters, see amg_sprecseti and amg_sprecsetc, ! respectively. @@ -858,7 +709,7 @@ end subroutine amg_scprecsetc ! Error code. ! ilev - integer, optional, input. ! For the multilevel preconditioner, the level at which the -! preconditioner parameter has to be set. +! preconditioner parameter has to be set. ! If nlev is not present, the parameter identified by 'what' ! is set at all the appropriate levels. ! @@ -868,7 +719,7 @@ end subroutine amg_scprecsetc ! the parameter must have the same value at all the levels but the coarsest one. ! For this reason, the interface amg_precset to this routine has been built in ! such a way that ilev is not visible to the user (see amg_prec_mod.f90). -! +! subroutine amg_scprecsetr(p,what,val,info,ilev,ilmax,pos,idx) use psb_base_mod @@ -878,7 +729,7 @@ subroutine amg_scprecsetr(p,what,val,info,ilev,ilmax,pos,idx) ! Arguments class(amg_sprec_type), intent(inout) :: p - character(len=*), intent(in) :: what + character(len=*), intent(in) :: what real(psb_spk_), intent(in) :: val integer(psb_ipk_), intent(out) :: info integer(psb_ipk_), optional, intent(in) :: ilev,ilmax @@ -887,15 +738,15 @@ subroutine amg_scprecsetr(p,what,val,info,ilev,ilmax,pos,idx) ! Local variables integer(psb_ipk_) :: ilev_,nlev_, ilmax_, il - real(psb_spk_) :: thr + real(psb_spk_) :: thr character(len=*), parameter :: name='amg_precsetr' info = psb_success_ - if (present(ilev)) then + if (present(ilev)) then ilev_ = ilev else - ilev_ = 1 + ilev_ = 1 end if select case(psb_toupper(what)) @@ -904,16 +755,16 @@ subroutine amg_scprecsetr(p,what,val,info,ilev,ilmax,pos,idx) return end select - if (.not.allocated(p%precv)) then + if (.not.allocated(p%precv)) then write(psb_err_unit,*) name,& &': Error: uninitialized preconditioner,',& - &' should call amg_PRECINIT' + &' should call amg_PRECINIT' info = 3111 - return + return endif nlev_ = size(p%precv) - if (present(ilev)) then + if (present(ilev)) then ilev_ = ilev if (present(ilmax)) then ilmax_ = ilmax @@ -921,16 +772,16 @@ subroutine amg_scprecsetr(p,what,val,info,ilev,ilmax,pos,idx) ilmax_ = ilev_ end if else - ilev_ = 1 + ilev_ = 1 ilmax_ = nlev_ end if - if ((ilev_<1).or.(ilev_ > nlev_)) then + if ((ilev_<1).or.(ilev_ > nlev_)) then info = -1 write(psb_err_unit,*) name,& &': Error: invalid ILEV/NLEV combination',ilev_, nlev_ return endif - if ((ilmax_<1).or.(ilmax_ > nlev_)) then + if ((ilmax_<1).or.(ilmax_ > nlev_)) then info = -1 write(psb_err_unit,*) name,& &': Error: invalid ILMAX/NLEV combination',ilmax_, nlev_ @@ -941,18 +792,18 @@ subroutine amg_scprecsetr(p,what,val,info,ilev,ilmax,pos,idx) ! ! Set preconditioner parameters at level ilev. ! - if (present(ilev)) then + if (present(ilev)) then do il=ilev_, ilmax_ call p%precv(il)%set(what,val,info,pos=pos,idx=idx) end do - else if (.not.present(ilev)) then + else if (.not.present(ilev)) then ! ! ilev not specified: set preconditioner parameters at all the appropriate levels ! - select case(psb_toupper(what)) + select case(psb_toupper(what)) case('COARSE_ILUTHRS') ilev_=nlev_ call p%precv(ilev_)%set('SUB_ILUTHRS',val,info,pos=pos) @@ -967,5 +818,3 @@ subroutine amg_scprecsetr(p,what,val,info,ilev,ilmax,pos,idx) endif end subroutine amg_scprecsetr - - diff --git a/amgprec/impl/amg_zcprecset.F90 b/amgprec/impl/amg_zcprecset.F90 index 34bc200d..5febde22 100644 --- a/amgprec/impl/amg_zcprecset.F90 +++ b/amgprec/impl/amg_zcprecset.F90 @@ -1,15 +1,15 @@ -! -! +! +! ! AMG4PSBLAS version 1.0 ! Algebraic Multigrid Package ! based on PSBLAS (Parallel Sparse BLAS version 3.5) -! -! (C) Copyright 2020 -! -! Salvatore Filippone -! Pasqua D'Ambra -! Fabio Durastante -! +! +! (C) Copyright 2020 +! +! Salvatore Filippone +! Pasqua D'Ambra +! Fabio Durastante +! ! Redistribution and use in source and binary forms, with or without ! modification, are permitted provided that the following conditions ! are met: @@ -21,7 +21,7 @@ ! 3. The name of the AMG4PSBLAS group or the names of its contributors may ! not be used to endorse or promote products derived from this ! software without specific written permission. -! +! ! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED ! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR @@ -33,8 +33,8 @@ ! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ! POSSIBILITY OF SUCH DAMAGE. -! -! +! +! ! File: amg_zprecset.f90 ! ! Subroutine: amg_zprecseti @@ -44,7 +44,7 @@ ! precisely, the integer parameter identified by 'what' is assigned the value ! contained in 'val'. ! For the multilevel preconditioners, the levels are numbered in increasing -! order starting from the finest one, i.e. level 1 is the finest level. +! order starting from the finest one, i.e. level 1 is the finest level. ! ! To set character and complex parameters, see amg_zprecsetc and amg_zprecsetr, ! respectively. @@ -64,7 +64,7 @@ ! Error code. ! ilev - integer, optional, input. ! For the multilevel preconditioner, the level at which the -! preconditioner parameter has to be set. +! preconditioner parameter has to be set. ! If nlev is not present, the parameter identified by 'what' ! is set at all the appropriate levels. ! @@ -74,7 +74,7 @@ ! the parameter must have the same value at all the levels but the coarsest one. ! For this reason, the interface amg_precset to this routine has been built in ! such a way that ilev is not visible to the user (see amg_prec_mod.f90). -! +! subroutine amg_zcprecseti(p,what,val,info,ilev,ilmax,pos,idx) use psb_base_mod @@ -86,6 +86,9 @@ subroutine amg_zcprecseti(p,what,val,info,ilev,ilmax,pos,idx) use amg_z_ilu_solver use amg_z_id_solver use amg_z_gs_solver + use amg_z_ainv_solver + use amg_z_invk_solver + use amg_z_invt_solver #if defined(HAVE_UMF_) use amg_z_umf_solver #endif @@ -95,7 +98,7 @@ subroutine amg_zcprecseti(p,what,val,info,ilev,ilmax,pos,idx) #if defined(HAVE_SLU_) use amg_z_slu_solver #endif -#if defined(HAVE_MUMPS_) +#if defined(HAVE_MUMPS_) use amg_z_mumps_solver #endif @@ -104,7 +107,7 @@ subroutine amg_zcprecseti(p,what,val,info,ilev,ilmax,pos,idx) ! Arguments class(amg_zprec_type), intent(inout) :: p - character(len=*), intent(in) :: what + character(len=*), intent(in) :: what integer(psb_ipk_), intent(in) :: val integer(psb_ipk_), intent(out) :: info integer(psb_ipk_), optional, intent(in) :: ilev,ilmax @@ -117,17 +120,17 @@ subroutine amg_zcprecseti(p,what,val,info,ilev,ilmax,pos,idx) info = psb_success_ - if (.not.allocated(p%precv)) then + if (.not.allocated(p%precv)) then info = 3111 write(psb_err_unit,*) name,& & ': Error: uninitialized preconditioner,',& &' should call amg_PRECINIT' - return + return endif nlev_ = size(p%precv) - if (present(ilev)) then + if (present(ilev)) then ilev_ = ilev if (present(ilmax)) then ilmax_ = ilmax @@ -135,22 +138,22 @@ subroutine amg_zcprecseti(p,what,val,info,ilev,ilmax,pos,idx) ilmax_ = ilev_ end if else - ilev_ = 1 + ilev_ = 1 ilmax_ = nlev_ end if - if ((ilev_<1).or.(ilev_ > nlev_)) then + if ((ilev_<1).or.(ilev_ > nlev_)) then info = -1 write(psb_err_unit,*) name,& &': Error: invalid ILEV/NLEV combination',ilev_, nlev_ return endif - if ((ilmax_<1).or.(ilmax_ > nlev_)) then + if ((ilmax_<1).or.(ilmax_ > nlev_)) then info = -1 write(psb_err_unit,*) name,& &': Error: invalid ILMAX/NLEV combination',ilmax_, nlev_ return endif - + select case(psb_toupper(what)) case ('MIN_COARSE_SIZE') p%ag_data%min_coarse_size = max(val,-1) @@ -166,144 +169,17 @@ subroutine amg_zcprecseti(p,what,val,info,ilev,ilmax,pos,idx) ! ! Set preconditioner parameters at level ilev. ! - if (present(ilev)) then - - select case(psb_toupper(what)) - case('SMOOTHER_TYPE','SUB_SOLVE','SMOOTHER_SWEEPS',& - & 'ML_CYCLE','PAR_AGGR_ALG','AGGR_ORD',& - & 'AGGR_TYPE','AGGR_PROL','AGGR_OMEGA_ALG',& - & 'AGGR_EIG','SUB_RESTR','SUB_PROL', & - & 'SUB_OVR','SUB_FILLIN',& - & 'COARSE_MAT') + if (present(ilev)) then + + select case(psb_toupper(what)) + case('SUB_OVR','SUB_FILLIN','SMOOTHER_SWEEPS') do il=ilev_, ilmax_ call p%precv(il)%set(what,val,info,pos=pos) end do - case('COARSE_SUBSOLVE') - if (ilev_ /= nlev_) then - write(psb_err_unit,*) name,& - & ': Error: Inconsistent specification of WHAT vs. ILEV' - info = -2 - return - end if - call p%precv(ilev_)%set('SUB_SOLVE',val,info,pos=pos) - case('COARSE_SOLVE') - if (ilev_ /= nlev_) then - write(psb_err_unit,*) name,& - & ': Error: Inconsistent specification of WHAT vs. ILEV' - info = -2 - return - end if - if (nlev_ > 1) then - call p%precv(nlev_)%set('COARSE_SOLVE',val,info,pos=pos) - select case (val) - case(amg_bjac_,amg_l1_bjac_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',val,info,pos=pos) -#if defined(HAVE_UMF_) - call p%precv(nlev_)%set('SUB_SOLVE',amg_umf_,info,pos=pos) -#elif defined(HAVE_SLU_) - call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) -#elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) -#else - call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) -#endif - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info) - case(amg_slu_) -#if defined(HAVE_SLU_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',val,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) -#elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#endif - case(psb_ilu_n_, psb_ilu_t_,psb_milu_n_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',val,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) - case(amg_mumps_) -#if defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',val,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#endif - case(amg_umf_) -#if defined(HAVE_UMF_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',val,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) -#elif defined(HAVE_SLU_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) -#elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#endif - - case(amg_sludist_) -#if defined(HAVE_SLUDIST_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',val,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#elif defined(HAVE_UMF_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_umf_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) -#elif defined(HAVE_SLU_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) -#elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#endif - case(amg_jac_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_diag_scale_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) - case(amg_l1_jac_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_l1_diag_scale_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) - case(amg_gs_,amg_fbgs_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) - case(amg_bwgs_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_bwgs_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) - case(amg_l1_gs_,amg_l1_fbgs_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_l1_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) - end select - - endif case('COARSE_SWEEPS') - if (ilev_ /= nlev_) then + if (ilev_ /= nlev_) then write(psb_err_unit,*) name,& & ': Error: Inconsistent specification of WHAT vs. ILEV' info = -2 @@ -312,14 +188,14 @@ subroutine amg_zcprecseti(p,what,val,info,ilev,ilmax,pos,idx) call p%precv(nlev_)%set('SMOOTHER_SWEEPS',val,info,pos=pos) case('COARSE_FILLIN') - if (ilev_ /= nlev_) then + if (ilev_ /= nlev_) then write(psb_err_unit,*) name,& & ': Error: Inconsistent specification of WHAT vs. ILEV' info = -2 return end if call p%precv(nlev_)%set('SUB_FILLIN',val,info,pos=pos) - + case default do il=ilev_, ilmax_ call p%precv(il)%set(what,val,info,pos=pos,idx=idx) @@ -327,145 +203,18 @@ subroutine amg_zcprecseti(p,what,val,info,ilev,ilmax,pos,idx) end select - else if (.not.present(ilev)) then + else if (.not.present(ilev)) then ! ! ilev not specified: set preconditioner parameters at all the appropriate ! levels ! - select case(psb_toupper(trim(what))) - case('SUB_SOLVE','SUB_RESTR','SUB_PROL',& - & 'SUB_OVR','SUB_FILLIN',& - & 'SMOOTHER_SWEEPS','SMOOTHER_TYPE') + select case(psb_toupper(trim(what))) + case('SUB_OVR','SUB_FILLIN','SMOOTHER_SWEEPS') do ilev_=1,max(1,nlev_-1) call p%precv(ilev_)%set(what,val,info,pos=pos) - if (info /= 0) return - end do - - case('ML_CYCLE','PAR_AGGR_ALG','AGGR_ORD','AGGR_PROL','AGGR_TYPE',& - & 'AGGR_OMEGA_ALG','AGGR_EIG','AGGR_FILTER') - do ilev_=1,nlev_ - call p%precv(ilev_)%set(what,val,info,pos=pos) - if (info /= 0) return + if (info /= 0) return end do - case('COARSE_MAT') - if (nlev_ > 1) then - call p%precv(nlev_)%set('COARSE_MAT',val,info,pos=pos) - end if - - case('COARSE_SOLVE') - if (nlev_ > 1) then - call p%precv(nlev_)%set('COARSE_SOLVE',val,info,pos=pos) - select case (val) - case(amg_bjac_,amg_l1_bjac_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',val,info,pos=pos) -#if defined(HAVE_UMF_) - call p%precv(nlev_)%set('SUB_SOLVE',amg_umf_,info,pos=pos) -#elif defined(HAVE_SLU_) - call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) -#elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) -#else - call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) -#endif - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info) - case(amg_slu_) -#if defined(HAVE_SLU_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',val,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) -#elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#endif - case(psb_ilu_n_, psb_ilu_t_,psb_milu_n_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',val,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) - case(amg_mumps_) -#if defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',val,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#endif - case(amg_umf_) -#if defined(HAVE_UMF_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',val,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) -#elif defined(HAVE_SLU_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) -#elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#endif - - case(amg_sludist_) -#if defined(HAVE_SLUDIST_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',val,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#elif defined(HAVE_UMF_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_umf_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) -#elif defined(HAVE_SLU_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) -#elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) -#endif - case(amg_jac_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_diag_scale_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) - - case(amg_l1_jac_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_l1_diag_scale_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) - case(amg_gs_,amg_fbgs_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) - case(amg_bwgs_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_bwgs_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) - case(amg_l1_gs_,amg_l1_fbgs_) - call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_l1_bjac_,info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) - end select - endif - - case('COARSE_SUBSOLVE') - if (nlev_ > 1) then - call p%precv(nlev_)%set('SUB_SOLVE',val,info,pos=pos) - endif case('COARSE_SWEEPS') @@ -474,10 +223,10 @@ subroutine amg_zcprecseti(p,what,val,info,ilev,ilmax,pos,idx) end if case('COARSE_FILLIN') - if (nlev_ > 1) then + if (nlev_ > 1) then call p%precv(nlev_)%set('SUB_FILLIN',val,info,pos=pos) end if - + case default do ilev_=1,nlev_ call p%precv(ilev_)%set(what,val,info,pos=pos,idx=idx) @@ -496,7 +245,7 @@ end subroutine amg_zcprecseti ! precisely, the character parameter identified by 'what' is assigned the value ! contained in 'val'. ! For the multilevel preconditioners, the levels are numbered in increasing -! order starting from the finest one, i.e. level 1 is the finest level. +! order starting from the finest one, i.e. level 1 is the finest level. ! ! To set integer and complex parameters, see amg_zprecseti and amg_zprecsetr, ! respectively. @@ -516,7 +265,7 @@ end subroutine amg_zcprecseti ! Error code. ! ilev - integer, optional, input. ! For the multilevel preconditioner, the level at which the -! preconditioner parameter has to be set. +! preconditioner parameter has to be set. ! If nlev is not present, the parameter identified by 'what' ! is set at all the appropriate levels. ! @@ -526,7 +275,7 @@ end subroutine amg_zcprecseti ! the parameter must have the same value at all the levels but the coarsest one. ! For this reason, the interface amg_precset to this routine has been built in ! such a way that ilev is not visible to the user (see amg_prec_mod.f90). -! +! subroutine amg_zcprecsetc(p,what,string,info,ilev,ilmax,pos,idx) use psb_base_mod @@ -538,6 +287,9 @@ subroutine amg_zcprecsetc(p,what,string,info,ilev,ilmax,pos,idx) use amg_z_ilu_solver use amg_z_id_solver use amg_z_gs_solver + use amg_z_ainv_solver + use amg_z_invk_solver + use amg_z_invt_solver #if defined(HAVE_UMF_) use amg_z_umf_solver #endif @@ -547,7 +299,7 @@ subroutine amg_zcprecsetc(p,what,string,info,ilev,ilmax,pos,idx) #if defined(HAVE_SLU_) use amg_z_slu_solver #endif -#if defined(HAVE_MUMPS_) +#if defined(HAVE_MUMPS_) use amg_z_mumps_solver #endif @@ -556,7 +308,7 @@ subroutine amg_zcprecsetc(p,what,string,info,ilev,ilmax,pos,idx) ! Arguments class(amg_zprec_type), intent(inout) :: p - character(len=*), intent(in) :: what + character(len=*), intent(in) :: what character(len=*), intent(in) :: string integer(psb_ipk_), intent(out) :: info integer(psb_ipk_), optional, intent(in) :: ilev,ilmax @@ -569,17 +321,17 @@ subroutine amg_zcprecsetc(p,what,string,info,ilev,ilmax,pos,idx) info = psb_success_ - if (.not.allocated(p%precv)) then + if (.not.allocated(p%precv)) then info = 3111 write(psb_err_unit,*) name,& & ': Error: uninitialized preconditioner,',& &' should call amg_PRECINIT' - return + return endif nlev_ = size(p%precv) - if (present(ilev)) then + if (present(ilev)) then ilev_ = ilev if (present(ilmax)) then ilmax_ = ilmax @@ -587,39 +339,86 @@ subroutine amg_zcprecsetc(p,what,string,info,ilev,ilmax,pos,idx) ilmax_ = ilev_ end if else - ilev_ = 1 + ilev_ = 1 ilmax_ = nlev_ end if - if ((ilev_<1).or.(ilev_ > nlev_)) then + if ((ilev_<1).or.(ilev_ > nlev_)) then info = -1 write(psb_err_unit,*) name,& &': Error: invalid ILEV/NLEV combination',ilev_, nlev_ return endif - if ((ilmax_<1).or.(ilmax_ > nlev_)) then + if ((ilmax_<1).or.(ilmax_ > nlev_)) then info = -1 write(psb_err_unit,*) name,& &': Error: invalid ILMAX/NLEV combination',ilmax_, nlev_ return endif - + ! ! Set preconditioner parameters at level ilev. ! - if (present(ilev)) then - - select case(psb_toupper(what)) - case('SMOOTHER_TYPE','SUB_SOLVE',& - & 'ML_CYCLE','PAR_AGGR_ALG','AGGR_ORD',& - & 'AGGR_TYPE','AGGR_PROL','AGGR_OMEGA_ALG',& - & 'AGGR_EIG','SUB_RESTR','SUB_PROL', & - & 'COARSE_MAT') + if (present(ilev)) then + + select case(psb_toupper(what)) + case('SMOOTHER_TYPE') + ! Select the type of smoother between the one implemented in the library + ! every new smoother should be added here + select case(psb_toupper(string)) + case ('BJAC') + do il=ilev_, ilmax_ + call p%precv(il)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + end do + case ('L1-BJAC') + do il=ilev_, ilmax_ + call p%precv(il)%set('SMOOTHER_TYPE',amg_l1_bjac_,info,pos=pos) + end do + case('GS','FWGS','FBGS') + do il=ilev_, ilmax_ + call p%precv(il)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(il)%set('SUB_SOLVE',amg_gs_,info,pos=pos) + end do + case('L1-GS','L1-FWGS','L1-FBGS') + do il=ilev_, ilmax_ + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_l1_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos) + end do + case ('BWGS') + do il=ilev_, ilmax_ + call p%precv(il)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(il)%set('SUB_SOLVE',amg_bwgs_,info,pos=pos) + end do + case('JACOBI') + do il=ilev_, ilmax_ + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_diag_scale_,info,pos=pos) + end do + case('L1-JACOBI') + do il=ilev_, ilmax_ + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_l1_diag_scale_,info,pos=pos) + end do + end select + case('SUB_SOLVE','ML_CYCLE','PAR_AGGR_ALG','AGGR_TYPE','SUB_RESTR'& + & ,'SUB_PROL') + ! These are handled elsewhere do il=ilev_, ilmax_ - call p%precv(il)%set(what,string,info,pos=pos) + call p%precv(nlev_)%set(what,string,info,pos=pos) end do - + case('COARSE_MAT') + ! Select if the coarsest matrix is handled in a distributed way, few + ! rows per rank, or if it is replicated completely on every rank + select case(psb_toupper(string)) + case('DISTR') + do il=ilev_, ilmax_ + call p%precv(il)%set(what,amg_distr_mat_,info,pos=pos) + end do + case('REPL') + do il=ilev_, ilmax_ + call p%precv(il)%set(what,amg_repl_mat_,info,pos=pos) + end do case('COARSE_SUBSOLVE') - if (ilev_ /= nlev_) then + if (ilev_ /= nlev_) then write(psb_err_unit,*) name,& & ': Error: Inconsistent specification of WHAT vs. ILEV' info = -2 @@ -627,119 +426,131 @@ subroutine amg_zcprecsetc(p,what,string,info,ilev,ilmax,pos,idx) end if call p%precv(ilev_)%set('SUB_SOLVE',string,info,pos=pos) case('COARSE_SOLVE') - if (ilev_ /= nlev_) then + if (ilev_ /= nlev_) then write(psb_err_unit,*) name,& & ': Error: Inconsistent specification of WHAT vs. ILEV' info = -2 return end if - if (nlev_ > 1) then - call p%precv(nlev_)%set('COARSE_SOLVE',string,info,pos=pos) - select case (psb_toupper(trim(string))) - case('BJAC', 'L1-BJAC') - call p%precv(nlev_)%set('SMOOTHER_TYPE',psb_toupper(trim(string)),info,pos=pos) + if (nlev_ > 1) then + select case (psb_toupper(string)) + case('BJAC') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + case('L1-BJAC') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_l1_bjac_,info,pos=pos) #if defined(HAVE_UMF_) - call p%precv(nlev_)%set('SUB_SOLVE','UMF',info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_umf_,info,pos=pos) #elif defined(HAVE_SLU_) - call p%precv(nlev_)%set('SUB_SOLVE','SLU',info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) #elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SUB_SOLVE','MUMPS',info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) #else - call p%precv(nlev_)%set('SUB_SOLVE','ILU',info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) #endif - call p%precv(nlev_)%set('COARSE_MAT','dist',info) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info) case('SLU') #if defined(HAVE_SLU_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','SLU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','REPL',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) #elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','MUMPS',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','ILU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) #endif - case('ILU','MILU','ILUT') - call p%precv(nlev_)%set('SMOOTHER_TYPE','bjac',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',string,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','REPL',info,pos=pos) + case('ILU') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) + case('ILUT') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_t_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) + case('MILU') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_milu_n_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) case('MUMPS') -#if defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',string,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','ILU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) +#if defined(HAVE_MUMPS_) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) #endif - case('UMF') -#if defined(HAVE_UMF_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',string,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','REPL',info,pos=pos) + case('UMF') +#if defined(HAVE_UMF_) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_umf_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) #elif defined(HAVE_SLU_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','SLU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','REPL',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) #elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','MUMPS',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','ILU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) -#endif + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) +#endif + case('SLUDIST') -#if defined(HAVE_SLUDIST_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',string,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) -#elif defined(HAVE_UMF_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','UMF',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','REPL',info,pos=pos) +#if defined(HAVE_SLUDIST_) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_sludist_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) +#elif defined(HAVE_UMF_) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_umf_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) #elif defined(HAVE_SLU_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','SLU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','REPL',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) #elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','MUMPS',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','ILU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) #endif - case('JAC','JACOBI') - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','DIAG',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) - - case('L1-JACOBI') - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','L1-DIAG',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) - case('GS','FWGS','FBGS') - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','GS',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) + case('JACOBI','JAC') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_diag_scale_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) + + case('L1-JACOBI','L1-JAC') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_l1_diag_scale_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) + case('GS','FBGS') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) case('BWGS') - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','BWGS',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) - case('L1-GS') - call p%precv(nlev_)%set('SMOOTHER_TYPE','L1-BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','GS',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_bwgs_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) + case('L1-GS','L1-FBGS') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_l1_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) end select - - endif + + end if + + end select case default do il=ilev_, ilmax_ @@ -748,141 +559,154 @@ subroutine amg_zcprecsetc(p,what,string,info,ilev,ilmax,pos,idx) end select - else if (.not.present(ilev)) then + + + else if (.not.present(ilev)) then ! ! ilev not specified: set preconditioner parameters at all the appropriate ! levels ! - select case(psb_toupper(trim(what))) + select case(psb_toupper(trim(what))) case('SUB_SOLVE','SUB_RESTR','SUB_PROL',& & 'SMOOTHER_TYPE') do ilev_=1,max(1,nlev_-1) call p%precv(ilev_)%set(what,string,info,pos=pos) - if (info /= 0) return + if (info /= 0) return end do case('ML_CYCLE','PAR_AGGR_ALG','AGGR_ORD','AGGR_PROL','AGGR_TYPE',& & 'AGGR_OMEGA_ALG','AGGR_EIG','AGGR_FILTER') do ilev_=1,nlev_ call p%precv(ilev_)%set(what,string,info,pos=pos) - if (info /= 0) return + if (info /= 0) return end do case('COARSE_MAT') - if (nlev_ > 1) then + if (nlev_ > 1) then call p%precv(nlev_)%set('COARSE_MAT',string,info,pos=pos) end if case('COARSE_SOLVE') - if (nlev_ > 1) then + if (nlev_ > 1) then call p%precv(nlev_)%set('COARSE_SOLVE',string,info,pos=pos) select case (psb_toupper(trim(string))) - case('BJAC', 'L1-BJAC') - call p%precv(nlev_)%set('SMOOTHER_TYPE',psb_toupper(trim(string)),info,pos=pos) + case('BJAC') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + case('L1-BJAC') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_l1_bjac_,info,pos=pos) #if defined(HAVE_UMF_) - call p%precv(nlev_)%set('SUB_SOLVE','UMF',info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_umf_,info,pos=pos) #elif defined(HAVE_SLU_) - call p%precv(nlev_)%set('SUB_SOLVE','SLU',info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) #elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SUB_SOLVE','MUMPS',info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) #else - call p%precv(nlev_)%set('SUB_SOLVE','ILU',info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) #endif - call p%precv(nlev_)%set('COARSE_MAT','DIST',info) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info) case('SLU') #if defined(HAVE_SLU_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',string,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','REPL',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) #elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','MUMPS',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','ILU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) #endif - case('ILU', 'ILUT','MILU') - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',string,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','REPL',info,pos=pos) + case('ILU') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) + case('ILUT') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_t_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) + case('MILU') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_milu_n_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) case('MUMPS') -#if defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',string,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','ILU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) +#if defined(HAVE_MUMPS_) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) #endif - case('UMF') -#if defined(HAVE_UMF_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',string,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','REPL',info,pos=pos) + case('UMF') +#if defined(HAVE_UMF_) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_umf_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) #elif defined(HAVE_SLU_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','SLU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','REPL',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) #elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','MUMPS',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','ILU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) #endif - + case('SLUDIST') -#if defined(HAVE_SLUDIST_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE',string,info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) -#elif defined(HAVE_UMF_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','UMF',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','REPL',info,pos=pos) +#if defined(HAVE_SLUDIST_) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_sludist_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) +#elif defined(HAVE_UMF_) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_umf_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) #elif defined(HAVE_SLU_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','SLU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','REPL',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_slu_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_repl_mat_,info,pos=pos) #elif defined(HAVE_MUMPS_) - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','MUMPS',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) -#else - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','ILU',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_mumps_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) +#else + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',psb_ilu_n_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) #endif - case('JAC','JACOBI') - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','DIAG',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) - case('L1-JACOBI') - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','L1-DIAG',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) - case('GS','FWGS','FBGS') - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','GS',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) + case('JACOBI','JAC') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_diag_scale_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) + + case('L1-JACOBI','L1-JAC') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_l1_diag_scale_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) + case('GS','FBGS') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) case('BWGS') - call p%precv(nlev_)%set('SMOOTHER_TYPE','BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','BWGS',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) - case('L1-GS') - call p%precv(nlev_)%set('SMOOTHER_TYPE','L1-BJAC',info,pos=pos) - call p%precv(nlev_)%set('SUB_SOLVE','GS',info,pos=pos) - call p%precv(nlev_)%set('COARSE_MAT','DIST',info,pos=pos) + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_bwgs_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) + case('L1-FBGS','L1-GS') + call p%precv(nlev_)%set('SMOOTHER_TYPE',amg_l1_bjac_,info,pos=pos) + call p%precv(nlev_)%set('SUB_SOLVE',amg_gs_,info,pos=pos) + call p%precv(nlev_)%set('COARSE_MAT',amg_distr_mat_,info,pos=pos) end select - endif + endif case('COARSE_SUBSOLVE') - if (nlev_ > 1) then + if (nlev_ > 1) then call p%precv(nlev_)%set('SUB_SOLVE',string,info,pos=pos) endif @@ -894,7 +718,7 @@ subroutine amg_zcprecsetc(p,what,string,info,ilev,ilmax,pos,idx) endif - + end subroutine amg_zcprecsetc @@ -906,7 +730,7 @@ end subroutine amg_zcprecsetc ! precisely, the complex parameter identified by 'what' is assigned the value ! contained in 'val'. ! For the multilevel preconditioners, the levels are numbered in increasing -! order starting from the finest one, i.e. level 1 is the finest level. +! order starting from the finest one, i.e. level 1 is the finest level. ! ! To set integer and character parameters, see amg_zprecseti and amg_zprecsetc, ! respectively. @@ -925,7 +749,7 @@ end subroutine amg_zcprecsetc ! Error code. ! ilev - integer, optional, input. ! For the multilevel preconditioner, the level at which the -! preconditioner parameter has to be set. +! preconditioner parameter has to be set. ! If nlev is not present, the parameter identified by 'what' ! is set at all the appropriate levels. ! @@ -935,7 +759,7 @@ end subroutine amg_zcprecsetc ! the parameter must have the same value at all the levels but the coarsest one. ! For this reason, the interface amg_precset to this routine has been built in ! such a way that ilev is not visible to the user (see amg_prec_mod.f90). -! +! subroutine amg_zcprecsetr(p,what,val,info,ilev,ilmax,pos,idx) use psb_base_mod @@ -945,7 +769,7 @@ subroutine amg_zcprecsetr(p,what,val,info,ilev,ilmax,pos,idx) ! Arguments class(amg_zprec_type), intent(inout) :: p - character(len=*), intent(in) :: what + character(len=*), intent(in) :: what real(psb_dpk_), intent(in) :: val integer(psb_ipk_), intent(out) :: info integer(psb_ipk_), optional, intent(in) :: ilev,ilmax @@ -954,15 +778,15 @@ subroutine amg_zcprecsetr(p,what,val,info,ilev,ilmax,pos,idx) ! Local variables integer(psb_ipk_) :: ilev_,nlev_, ilmax_, il - real(psb_dpk_) :: thr + real(psb_dpk_) :: thr character(len=*), parameter :: name='amg_precsetr' info = psb_success_ - if (present(ilev)) then + if (present(ilev)) then ilev_ = ilev else - ilev_ = 1 + ilev_ = 1 end if select case(psb_toupper(what)) @@ -971,16 +795,16 @@ subroutine amg_zcprecsetr(p,what,val,info,ilev,ilmax,pos,idx) return end select - if (.not.allocated(p%precv)) then + if (.not.allocated(p%precv)) then write(psb_err_unit,*) name,& &': Error: uninitialized preconditioner,',& - &' should call amg_PRECINIT' + &' should call amg_PRECINIT' info = 3111 - return + return endif nlev_ = size(p%precv) - if (present(ilev)) then + if (present(ilev)) then ilev_ = ilev if (present(ilmax)) then ilmax_ = ilmax @@ -988,16 +812,16 @@ subroutine amg_zcprecsetr(p,what,val,info,ilev,ilmax,pos,idx) ilmax_ = ilev_ end if else - ilev_ = 1 + ilev_ = 1 ilmax_ = nlev_ end if - if ((ilev_<1).or.(ilev_ > nlev_)) then + if ((ilev_<1).or.(ilev_ > nlev_)) then info = -1 write(psb_err_unit,*) name,& &': Error: invalid ILEV/NLEV combination',ilev_, nlev_ return endif - if ((ilmax_<1).or.(ilmax_ > nlev_)) then + if ((ilmax_<1).or.(ilmax_ > nlev_)) then info = -1 write(psb_err_unit,*) name,& &': Error: invalid ILMAX/NLEV combination',ilmax_, nlev_ @@ -1008,18 +832,18 @@ subroutine amg_zcprecsetr(p,what,val,info,ilev,ilmax,pos,idx) ! ! Set preconditioner parameters at level ilev. ! - if (present(ilev)) then + if (present(ilev)) then do il=ilev_, ilmax_ call p%precv(il)%set(what,val,info,pos=pos,idx=idx) end do - else if (.not.present(ilev)) then + else if (.not.present(ilev)) then ! ! ilev not specified: set preconditioner parameters at all the appropriate levels ! - select case(psb_toupper(what)) + select case(psb_toupper(what)) case('COARSE_ILUTHRS') ilev_=nlev_ call p%precv(ilev_)%set('SUB_ILUTHRS',val,info,pos=pos) @@ -1034,5 +858,3 @@ subroutine amg_zcprecsetr(p,what,val,info,ilev,ilmax,pos,idx) endif end subroutine amg_zcprecsetr - - diff --git a/amgprec/impl/level/amg_c_base_onelev_csetc.F90 b/amgprec/impl/level/amg_c_base_onelev_csetc.F90 index 32338bff..4c9a1528 100644 --- a/amgprec/impl/level/amg_c_base_onelev_csetc.F90 +++ b/amgprec/impl/level/amg_c_base_onelev_csetc.F90 @@ -1,15 +1,15 @@ -! -! +! +! ! AMG4PSBLAS version 1.0 ! Algebraic Multigrid Package ! based on PSBLAS (Parallel Sparse BLAS version 3.5) -! -! (C) Copyright 2020 -! -! Salvatore Filippone -! Pasqua D'Ambra -! Fabio Durastante -! +! +! (C) Copyright 2020 +! +! Salvatore Filippone +! Pasqua D'Ambra +! Fabio Durastante +! ! Redistribution and use in source and binary forms, with or without ! modification, are permitted provided that the following conditions ! are met: @@ -21,7 +21,7 @@ ! 3. The name of the AMG4PSBLAS group or the names of its contributors may ! not be used to endorse or promote products derived from this ! software without specific written permission. -! +! ! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED ! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR @@ -33,10 +33,10 @@ ! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ! POSSIBILITY OF SUCH DAMAGE. -! -! +! +! subroutine amg_c_base_onelev_csetc(lv,what,val,info,pos,idx) - + use psb_base_mod use amg_c_onelev_mod, amg_protect_name => amg_c_base_onelev_csetc use amg_c_base_aggregator_mod @@ -49,6 +49,9 @@ subroutine amg_c_base_onelev_csetc(lv,what,val,info,pos,idx) use amg_c_ilu_solver use amg_c_id_solver use amg_c_gs_solver + use amg_c_ainv_solver + use amg_c_invk_solver + use amg_c_invt_solver #if defined(HAVE_SLU_) use amg_c_slu_solver #endif @@ -59,16 +62,16 @@ subroutine amg_c_base_onelev_csetc(lv,what,val,info,pos,idx) Implicit None ! Arguments - class(amg_c_onelev_type), intent(inout) :: lv - character(len=*), intent(in) :: what + class(amg_c_onelev_type), intent(inout) :: lv + character(len=*), intent(in) :: what character(len=*), intent(in) :: val integer(psb_ipk_), intent(out) :: info character(len=*), optional, intent(in) :: pos integer(psb_ipk_), intent(in), optional :: idx - ! Local + ! Local integer(psb_ipk_) :: ipos_, err_act character(len=20) :: name='c_base_onelev_csetc' - integer(psb_ipk_) :: ival + integer(psb_ipk_) :: ival type(amg_c_base_smoother_type) :: amg_c_base_smoother_mold type(amg_c_jac_smoother_type) :: amg_c_jac_smoother_mold type(amg_c_l1_jac_smoother_type) :: amg_c_l1_jac_smoother_mold @@ -79,13 +82,16 @@ subroutine amg_c_base_onelev_csetc(lv,what,val,info,pos,idx) type(amg_c_id_solver_type) :: amg_c_id_solver_mold type(amg_c_gs_solver_type) :: amg_c_gs_solver_mold type(amg_c_bwgs_solver_type) :: amg_c_bwgs_solver_mold + type(amg_c_ainv_solver_type) :: amg_c_ainv_solver_mold + type(amg_c_invk_solver_type) :: amg_c_invk_solver_mold + type(amg_c_invt_solver_type) :: amg_c_invt_solver_mold #if defined(HAVE_SLU_) type(amg_c_slu_solver_type) :: amg_c_slu_solver_mold #endif #if defined(HAVE_MUMPS_) type(amg_c_mumps_solver_type) :: amg_c_mumps_solver_mold #endif - + call psb_erractionsave(err_act) @@ -106,14 +112,14 @@ subroutine amg_c_base_onelev_csetc(lv,what,val,info,pos,idx) else ipos_ = amg_smooth_both_ end if - + select case (psb_toupper(trim(what))) case ('SMOOTHER_TYPE') select case (psb_toupper(trim(val))) case ('NOPREC','NONE') call lv%set(amg_c_base_smoother_mold,info,pos=pos) if (info == 0) call lv%set(amg_c_id_solver_mold,info,pos=pos) - + case ('JAC','JACOBI') call lv%set(amg_c_jac_smoother_mold,info,pos=pos) if (info == 0) call lv%set(amg_c_diag_solver_mold,info,pos=pos) @@ -121,11 +127,11 @@ subroutine amg_c_base_onelev_csetc(lv,what,val,info,pos,idx) case ('L1-JACOBI') call lv%set(amg_c_jac_smoother_mold,info,pos=pos) if (info == 0) call lv%set(amg_c_l1_diag_solver_mold,info,pos=pos) - + case ('BJAC') call lv%set(amg_c_jac_smoother_mold,info,pos=pos) if (info == 0) call lv%set(amg_c_ilu_solver_mold,info,pos=pos) - + case ('L1-BJAC') call lv%set(amg_c_l1_jac_smoother_mold,info,pos=pos) if (info == 0) call lv%set(amg_c_ilu_solver_mold,info,pos=pos) @@ -154,67 +160,73 @@ subroutine amg_c_base_onelev_csetc(lv,what,val,info,pos,idx) case ('L1-BWGS') call lv%set(amg_c_l1_jac_smoother_mold,info,pos='pre') if (info == 0) call lv%set(amg_c_bwgs_solver_mold,info,pos='pre') - if (allocated(lv%sm2a)) deallocate(lv%sm2a) + if (allocated(lv%sm2a)) deallocate(lv%sm2a) case ('L1-FBGS') call lv%set(amg_c_l1_jac_smoother_mold,info,pos='pre') if (info == 0) call lv%set(amg_c_gs_solver_mold,info,pos='pre') call lv%set(amg_c_l1_jac_smoother_mold,info,pos='post') if (info == 0) call lv%set(amg_c_bwgs_solver_mold,info,pos='post') - + case default ! - ! Do nothing and hope for the best :) + ! Do nothing and hope for the best :) ! end select - if ((ipos_==amg_smooth_pre_).or.(ipos_==amg_smooth_both_)) then + if ((ipos_==amg_smooth_pre_).or.(ipos_==amg_smooth_both_)) then if (allocated(lv%sm)) call lv%sm%default() end if if ((ipos_==amg_smooth_post_).or.(ipos_==amg_smooth_both_)) then if (allocated(lv%sm2a)) call lv%sm2a%default() end if - + case('SUB_SOLVE') select case (psb_toupper(trim(val))) case ('NONE','NOPREC','FACT_NONE') call lv%set(amg_c_id_solver_mold,info,pos=pos) - + case ('DIAG') call lv%set(amg_c_diag_solver_mold,info,pos=pos) - + case ('L1-DIAG') call lv%set(amg_c_l1_diag_solver_mold,info,pos=pos) - + case ('GS','FGS','FWGS') call lv%set(amg_c_gs_solver_mold,info,pos=pos) - + case ('BGS','BWGS') call lv%set(amg_c_bwgs_solver_mold,info,pos=pos) - + + case ('AINV') + call lv%set(amg_c_ainv_solver_mold,info,pos=pos) + case ('INVK') + call lv%set(amg_c_invk_solver_mold,info,pos=pos) + case ('INVT') + call lv%set(amg_c_invt_solver_mold,info,pos=pos) case ('ILU','ILUT','MILU') call lv%set(amg_c_ilu_solver_mold,info,pos=pos) if (info == 0) then - if ((ipos_==amg_smooth_pre_) .or.(ipos_==amg_smooth_both_)) then + if ((ipos_==amg_smooth_pre_) .or.(ipos_==amg_smooth_both_)) then call lv%sm%sv%set('SUB_SOLVE',val,info) end if - if ((ipos_==amg_smooth_post_).or.(ipos_==amg_smooth_both_))then + if ((ipos_==amg_smooth_post_).or.(ipos_==amg_smooth_both_))then if (allocated(lv%sm2a)) call lv%sm2a%sv%set('SUB_SOLVE',val,info) end if end if #ifdef HAVE_SLU_ - case ('SLU') + case ('SLU') call lv%set(amg_c_slu_solver_mold,info,pos=pos) #endif #ifdef HAVE_MUMPS_ - case ('MUMPS') + case ('MUMPS') call lv%set(amg_c_mumps_solver_mold,info,pos=pos) #endif case default ! - ! Do nothing and hope for the best :) + ! Do nothing and hope for the best :) ! end select - + case ('ML_CYCLE') lv%parms%ml_cycle = amg_stringval(val) @@ -229,7 +241,7 @@ subroutine amg_c_base_onelev_csetc(lv,what,val,info,pos,idx) return end if end if - + select case(ival) case(amg_dec_aggr_) allocate(amg_c_dec_aggregator_type :: lv%aggr, stat=info) @@ -239,7 +251,7 @@ subroutine amg_c_base_onelev_csetc(lv,what,val,info,pos,idx) info = psb_err_internal_error_ end select if (info == psb_success_) call lv%aggr%default() - + case ('AGGR_ORD') lv%parms%aggr_ord = amg_stringval(val) @@ -266,13 +278,13 @@ subroutine amg_c_base_onelev_csetc(lv,what,val,info,pos,idx) lv%parms%coarse_solve = amg_stringval(val) case default - if ((ipos_==amg_smooth_pre_) .or.(ipos_==amg_smooth_both_)) then - if (allocated(lv%sm)) then + if ((ipos_==amg_smooth_pre_) .or.(ipos_==amg_smooth_both_)) then + if (allocated(lv%sm)) then call lv%sm%set(what,val,info,idx=idx) end if end if - if ((ipos_==amg_smooth_post_).or.(ipos_==amg_smooth_both_))then - if (allocated(lv%sm2a)) then + if ((ipos_==amg_smooth_post_).or.(ipos_==amg_smooth_both_))then + if (allocated(lv%sm2a)) then call lv%sm2a%set(what,val,info,idx=idx) end if end if diff --git a/amgprec/impl/level/amg_d_base_onelev_csetc.F90 b/amgprec/impl/level/amg_d_base_onelev_csetc.F90 index 087459f7..cf8cf189 100644 --- a/amgprec/impl/level/amg_d_base_onelev_csetc.F90 +++ b/amgprec/impl/level/amg_d_base_onelev_csetc.F90 @@ -1,15 +1,15 @@ -! -! +! +! ! AMG4PSBLAS version 1.0 ! Algebraic Multigrid Package ! based on PSBLAS (Parallel Sparse BLAS version 3.5) -! -! (C) Copyright 2020 -! -! Salvatore Filippone -! Pasqua D'Ambra -! Fabio Durastante -! +! +! (C) Copyright 2020 +! +! Salvatore Filippone +! Pasqua D'Ambra +! Fabio Durastante +! ! Redistribution and use in source and binary forms, with or without ! modification, are permitted provided that the following conditions ! are met: @@ -21,7 +21,7 @@ ! 3. The name of the AMG4PSBLAS group or the names of its contributors may ! not be used to endorse or promote products derived from this ! software without specific written permission. -! +! ! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED ! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR @@ -33,10 +33,10 @@ ! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ! POSSIBILITY OF SUCH DAMAGE. -! -! +! +! subroutine amg_d_base_onelev_csetc(lv,what,val,info,pos,idx) - + use psb_base_mod use amg_d_onelev_mod, amg_protect_name => amg_d_base_onelev_csetc use amg_d_base_aggregator_mod @@ -49,6 +49,9 @@ subroutine amg_d_base_onelev_csetc(lv,what,val,info,pos,idx) use amg_d_ilu_solver use amg_d_id_solver use amg_d_gs_solver + use amg_d_ainv_solver + use amg_d_invk_solver + use amg_d_invt_solver #if defined(HAVE_UMF_) use amg_d_umf_solver #endif @@ -65,16 +68,16 @@ subroutine amg_d_base_onelev_csetc(lv,what,val,info,pos,idx) Implicit None ! Arguments - class(amg_d_onelev_type), intent(inout) :: lv - character(len=*), intent(in) :: what + class(amg_d_onelev_type), intent(inout) :: lv + character(len=*), intent(in) :: what character(len=*), intent(in) :: val integer(psb_ipk_), intent(out) :: info character(len=*), optional, intent(in) :: pos integer(psb_ipk_), intent(in), optional :: idx - ! Local + ! Local integer(psb_ipk_) :: ipos_, err_act character(len=20) :: name='d_base_onelev_csetc' - integer(psb_ipk_) :: ival + integer(psb_ipk_) :: ival type(amg_d_base_smoother_type) :: amg_d_base_smoother_mold type(amg_d_jac_smoother_type) :: amg_d_jac_smoother_mold type(amg_d_l1_jac_smoother_type) :: amg_d_l1_jac_smoother_mold @@ -85,6 +88,9 @@ subroutine amg_d_base_onelev_csetc(lv,what,val,info,pos,idx) type(amg_d_id_solver_type) :: amg_d_id_solver_mold type(amg_d_gs_solver_type) :: amg_d_gs_solver_mold type(amg_d_bwgs_solver_type) :: amg_d_bwgs_solver_mold + type(amg_d_ainv_solver_type) :: amg_d_ainv_solver_mold + type(amg_d_invk_solver_type) :: amg_d_invk_solver_mold + type(amg_d_invt_solver_type) :: amg_d_invt_solver_mold #if defined(HAVE_UMF_) type(amg_d_umf_solver_type) :: amg_d_umf_solver_mold #endif @@ -97,7 +103,7 @@ subroutine amg_d_base_onelev_csetc(lv,what,val,info,pos,idx) #if defined(HAVE_MUMPS_) type(amg_d_mumps_solver_type) :: amg_d_mumps_solver_mold #endif - + call psb_erractionsave(err_act) @@ -118,14 +124,14 @@ subroutine amg_d_base_onelev_csetc(lv,what,val,info,pos,idx) else ipos_ = amg_smooth_both_ end if - + select case (psb_toupper(trim(what))) case ('SMOOTHER_TYPE') select case (psb_toupper(trim(val))) case ('NOPREC','NONE') call lv%set(amg_d_base_smoother_mold,info,pos=pos) if (info == 0) call lv%set(amg_d_id_solver_mold,info,pos=pos) - + case ('JAC','JACOBI') call lv%set(amg_d_jac_smoother_mold,info,pos=pos) if (info == 0) call lv%set(amg_d_diag_solver_mold,info,pos=pos) @@ -133,11 +139,11 @@ subroutine amg_d_base_onelev_csetc(lv,what,val,info,pos,idx) case ('L1-JACOBI') call lv%set(amg_d_jac_smoother_mold,info,pos=pos) if (info == 0) call lv%set(amg_d_l1_diag_solver_mold,info,pos=pos) - + case ('BJAC') call lv%set(amg_d_jac_smoother_mold,info,pos=pos) if (info == 0) call lv%set(amg_d_ilu_solver_mold,info,pos=pos) - + case ('L1-BJAC') call lv%set(amg_d_l1_jac_smoother_mold,info,pos=pos) if (info == 0) call lv%set(amg_d_ilu_solver_mold,info,pos=pos) @@ -166,59 +172,65 @@ subroutine amg_d_base_onelev_csetc(lv,what,val,info,pos,idx) case ('L1-BWGS') call lv%set(amg_d_l1_jac_smoother_mold,info,pos='pre') if (info == 0) call lv%set(amg_d_bwgs_solver_mold,info,pos='pre') - if (allocated(lv%sm2a)) deallocate(lv%sm2a) + if (allocated(lv%sm2a)) deallocate(lv%sm2a) case ('L1-FBGS') call lv%set(amg_d_l1_jac_smoother_mold,info,pos='pre') if (info == 0) call lv%set(amg_d_gs_solver_mold,info,pos='pre') call lv%set(amg_d_l1_jac_smoother_mold,info,pos='post') if (info == 0) call lv%set(amg_d_bwgs_solver_mold,info,pos='post') - + case default ! - ! Do nothing and hope for the best :) + ! Do nothing and hope for the best :) ! end select - if ((ipos_==amg_smooth_pre_).or.(ipos_==amg_smooth_both_)) then + if ((ipos_==amg_smooth_pre_).or.(ipos_==amg_smooth_both_)) then if (allocated(lv%sm)) call lv%sm%default() end if if ((ipos_==amg_smooth_post_).or.(ipos_==amg_smooth_both_)) then if (allocated(lv%sm2a)) call lv%sm2a%default() end if - + case('SUB_SOLVE') select case (psb_toupper(trim(val))) case ('NONE','NOPREC','FACT_NONE') call lv%set(amg_d_id_solver_mold,info,pos=pos) - + case ('DIAG') call lv%set(amg_d_diag_solver_mold,info,pos=pos) - + case ('L1-DIAG') call lv%set(amg_d_l1_diag_solver_mold,info,pos=pos) - + case ('GS','FGS','FWGS') call lv%set(amg_d_gs_solver_mold,info,pos=pos) - + case ('BGS','BWGS') call lv%set(amg_d_bwgs_solver_mold,info,pos=pos) - + + case ('AINV') + call lv%set(amg_d_ainv_solver_mold,info,pos=pos) + case ('INVK') + call lv%set(amg_d_invk_solver_mold,info,pos=pos) + case ('INVT') + call lv%set(amg_d_invt_solver_mold,info,pos=pos) case ('ILU','ILUT','MILU') call lv%set(amg_d_ilu_solver_mold,info,pos=pos) if (info == 0) then - if ((ipos_==amg_smooth_pre_) .or.(ipos_==amg_smooth_both_)) then + if ((ipos_==amg_smooth_pre_) .or.(ipos_==amg_smooth_both_)) then call lv%sm%sv%set('SUB_SOLVE',val,info) end if - if ((ipos_==amg_smooth_post_).or.(ipos_==amg_smooth_both_))then + if ((ipos_==amg_smooth_post_).or.(ipos_==amg_smooth_both_))then if (allocated(lv%sm2a)) call lv%sm2a%sv%set('SUB_SOLVE',val,info) end if end if #ifdef HAVE_SLU_ - case ('SLU') + case ('SLU') call lv%set(amg_d_slu_solver_mold,info,pos=pos) #endif #ifdef HAVE_MUMPS_ - case ('MUMPS') + case ('MUMPS') call lv%set(amg_d_mumps_solver_mold,info,pos=pos) #endif #ifdef HAVE_SLUDIST_ @@ -231,10 +243,10 @@ subroutine amg_d_base_onelev_csetc(lv,what,val,info,pos,idx) #endif case default ! - ! Do nothing and hope for the best :) + ! Do nothing and hope for the best :) ! end select - + case ('ML_CYCLE') lv%parms%ml_cycle = amg_stringval(val) @@ -249,7 +261,7 @@ subroutine amg_d_base_onelev_csetc(lv,what,val,info,pos,idx) return end if end if - + select case(ival) case(amg_dec_aggr_) allocate(amg_d_dec_aggregator_type :: lv%aggr, stat=info) @@ -259,7 +271,7 @@ subroutine amg_d_base_onelev_csetc(lv,what,val,info,pos,idx) info = psb_err_internal_error_ end select if (info == psb_success_) call lv%aggr%default() - + case ('AGGR_ORD') lv%parms%aggr_ord = amg_stringval(val) @@ -286,13 +298,13 @@ subroutine amg_d_base_onelev_csetc(lv,what,val,info,pos,idx) lv%parms%coarse_solve = amg_stringval(val) case default - if ((ipos_==amg_smooth_pre_) .or.(ipos_==amg_smooth_both_)) then - if (allocated(lv%sm)) then + if ((ipos_==amg_smooth_pre_) .or.(ipos_==amg_smooth_both_)) then + if (allocated(lv%sm)) then call lv%sm%set(what,val,info,idx=idx) end if end if - if ((ipos_==amg_smooth_post_).or.(ipos_==amg_smooth_both_))then - if (allocated(lv%sm2a)) then + if ((ipos_==amg_smooth_post_).or.(ipos_==amg_smooth_both_))then + if (allocated(lv%sm2a)) then call lv%sm2a%set(what,val,info,idx=idx) end if end if diff --git a/amgprec/impl/level/amg_s_base_onelev_csetc.F90 b/amgprec/impl/level/amg_s_base_onelev_csetc.F90 index 015f76dc..ca90e8b6 100644 --- a/amgprec/impl/level/amg_s_base_onelev_csetc.F90 +++ b/amgprec/impl/level/amg_s_base_onelev_csetc.F90 @@ -1,15 +1,15 @@ -! -! +! +! ! AMG4PSBLAS version 1.0 ! Algebraic Multigrid Package ! based on PSBLAS (Parallel Sparse BLAS version 3.5) -! -! (C) Copyright 2020 -! -! Salvatore Filippone -! Pasqua D'Ambra -! Fabio Durastante -! +! +! (C) Copyright 2020 +! +! Salvatore Filippone +! Pasqua D'Ambra +! Fabio Durastante +! ! Redistribution and use in source and binary forms, with or without ! modification, are permitted provided that the following conditions ! are met: @@ -21,7 +21,7 @@ ! 3. The name of the AMG4PSBLAS group or the names of its contributors may ! not be used to endorse or promote products derived from this ! software without specific written permission. -! +! ! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED ! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR @@ -33,10 +33,10 @@ ! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ! POSSIBILITY OF SUCH DAMAGE. -! -! +! +! subroutine amg_s_base_onelev_csetc(lv,what,val,info,pos,idx) - + use psb_base_mod use amg_s_onelev_mod, amg_protect_name => amg_s_base_onelev_csetc use amg_s_base_aggregator_mod @@ -49,6 +49,9 @@ subroutine amg_s_base_onelev_csetc(lv,what,val,info,pos,idx) use amg_s_ilu_solver use amg_s_id_solver use amg_s_gs_solver + use amg_s_ainv_solver + use amg_s_invk_solver + use amg_s_invt_solver #if defined(HAVE_SLU_) use amg_s_slu_solver #endif @@ -59,16 +62,16 @@ subroutine amg_s_base_onelev_csetc(lv,what,val,info,pos,idx) Implicit None ! Arguments - class(amg_s_onelev_type), intent(inout) :: lv - character(len=*), intent(in) :: what + class(amg_s_onelev_type), intent(inout) :: lv + character(len=*), intent(in) :: what character(len=*), intent(in) :: val integer(psb_ipk_), intent(out) :: info character(len=*), optional, intent(in) :: pos integer(psb_ipk_), intent(in), optional :: idx - ! Local + ! Local integer(psb_ipk_) :: ipos_, err_act character(len=20) :: name='s_base_onelev_csetc' - integer(psb_ipk_) :: ival + integer(psb_ipk_) :: ival type(amg_s_base_smoother_type) :: amg_s_base_smoother_mold type(amg_s_jac_smoother_type) :: amg_s_jac_smoother_mold type(amg_s_l1_jac_smoother_type) :: amg_s_l1_jac_smoother_mold @@ -79,13 +82,16 @@ subroutine amg_s_base_onelev_csetc(lv,what,val,info,pos,idx) type(amg_s_id_solver_type) :: amg_s_id_solver_mold type(amg_s_gs_solver_type) :: amg_s_gs_solver_mold type(amg_s_bwgs_solver_type) :: amg_s_bwgs_solver_mold + type(amg_s_ainv_solver_type) :: amg_s_ainv_solver_mold + type(amg_s_invk_solver_type) :: amg_s_invk_solver_mold + type(amg_s_invt_solver_type) :: amg_s_invt_solver_mold #if defined(HAVE_SLU_) type(amg_s_slu_solver_type) :: amg_s_slu_solver_mold #endif #if defined(HAVE_MUMPS_) type(amg_s_mumps_solver_type) :: amg_s_mumps_solver_mold #endif - + call psb_erractionsave(err_act) @@ -106,14 +112,14 @@ subroutine amg_s_base_onelev_csetc(lv,what,val,info,pos,idx) else ipos_ = amg_smooth_both_ end if - + select case (psb_toupper(trim(what))) case ('SMOOTHER_TYPE') select case (psb_toupper(trim(val))) case ('NOPREC','NONE') call lv%set(amg_s_base_smoother_mold,info,pos=pos) if (info == 0) call lv%set(amg_s_id_solver_mold,info,pos=pos) - + case ('JAC','JACOBI') call lv%set(amg_s_jac_smoother_mold,info,pos=pos) if (info == 0) call lv%set(amg_s_diag_solver_mold,info,pos=pos) @@ -121,11 +127,11 @@ subroutine amg_s_base_onelev_csetc(lv,what,val,info,pos,idx) case ('L1-JACOBI') call lv%set(amg_s_jac_smoother_mold,info,pos=pos) if (info == 0) call lv%set(amg_s_l1_diag_solver_mold,info,pos=pos) - + case ('BJAC') call lv%set(amg_s_jac_smoother_mold,info,pos=pos) if (info == 0) call lv%set(amg_s_ilu_solver_mold,info,pos=pos) - + case ('L1-BJAC') call lv%set(amg_s_l1_jac_smoother_mold,info,pos=pos) if (info == 0) call lv%set(amg_s_ilu_solver_mold,info,pos=pos) @@ -154,67 +160,73 @@ subroutine amg_s_base_onelev_csetc(lv,what,val,info,pos,idx) case ('L1-BWGS') call lv%set(amg_s_l1_jac_smoother_mold,info,pos='pre') if (info == 0) call lv%set(amg_s_bwgs_solver_mold,info,pos='pre') - if (allocated(lv%sm2a)) deallocate(lv%sm2a) + if (allocated(lv%sm2a)) deallocate(lv%sm2a) case ('L1-FBGS') call lv%set(amg_s_l1_jac_smoother_mold,info,pos='pre') if (info == 0) call lv%set(amg_s_gs_solver_mold,info,pos='pre') call lv%set(amg_s_l1_jac_smoother_mold,info,pos='post') if (info == 0) call lv%set(amg_s_bwgs_solver_mold,info,pos='post') - + case default ! - ! Do nothing and hope for the best :) + ! Do nothing and hope for the best :) ! end select - if ((ipos_==amg_smooth_pre_).or.(ipos_==amg_smooth_both_)) then + if ((ipos_==amg_smooth_pre_).or.(ipos_==amg_smooth_both_)) then if (allocated(lv%sm)) call lv%sm%default() end if if ((ipos_==amg_smooth_post_).or.(ipos_==amg_smooth_both_)) then if (allocated(lv%sm2a)) call lv%sm2a%default() end if - + case('SUB_SOLVE') select case (psb_toupper(trim(val))) case ('NONE','NOPREC','FACT_NONE') call lv%set(amg_s_id_solver_mold,info,pos=pos) - + case ('DIAG') call lv%set(amg_s_diag_solver_mold,info,pos=pos) - + case ('L1-DIAG') call lv%set(amg_s_l1_diag_solver_mold,info,pos=pos) - + case ('GS','FGS','FWGS') call lv%set(amg_s_gs_solver_mold,info,pos=pos) - + case ('BGS','BWGS') call lv%set(amg_s_bwgs_solver_mold,info,pos=pos) - + + case ('AINV') + call lv%set(amg_s_ainv_solver_mold,info,pos=pos) + case ('INVK') + call lv%set(amg_s_invk_solver_mold,info,pos=pos) + case ('INVT') + call lv%set(amg_s_invt_solver_mold,info,pos=pos) case ('ILU','ILUT','MILU') call lv%set(amg_s_ilu_solver_mold,info,pos=pos) if (info == 0) then - if ((ipos_==amg_smooth_pre_) .or.(ipos_==amg_smooth_both_)) then + if ((ipos_==amg_smooth_pre_) .or.(ipos_==amg_smooth_both_)) then call lv%sm%sv%set('SUB_SOLVE',val,info) end if - if ((ipos_==amg_smooth_post_).or.(ipos_==amg_smooth_both_))then + if ((ipos_==amg_smooth_post_).or.(ipos_==amg_smooth_both_))then if (allocated(lv%sm2a)) call lv%sm2a%sv%set('SUB_SOLVE',val,info) end if end if #ifdef HAVE_SLU_ - case ('SLU') + case ('SLU') call lv%set(amg_s_slu_solver_mold,info,pos=pos) #endif #ifdef HAVE_MUMPS_ - case ('MUMPS') + case ('MUMPS') call lv%set(amg_s_mumps_solver_mold,info,pos=pos) #endif case default ! - ! Do nothing and hope for the best :) + ! Do nothing and hope for the best :) ! end select - + case ('ML_CYCLE') lv%parms%ml_cycle = amg_stringval(val) @@ -229,7 +241,7 @@ subroutine amg_s_base_onelev_csetc(lv,what,val,info,pos,idx) return end if end if - + select case(ival) case(amg_dec_aggr_) allocate(amg_s_dec_aggregator_type :: lv%aggr, stat=info) @@ -239,7 +251,7 @@ subroutine amg_s_base_onelev_csetc(lv,what,val,info,pos,idx) info = psb_err_internal_error_ end select if (info == psb_success_) call lv%aggr%default() - + case ('AGGR_ORD') lv%parms%aggr_ord = amg_stringval(val) @@ -266,13 +278,13 @@ subroutine amg_s_base_onelev_csetc(lv,what,val,info,pos,idx) lv%parms%coarse_solve = amg_stringval(val) case default - if ((ipos_==amg_smooth_pre_) .or.(ipos_==amg_smooth_both_)) then - if (allocated(lv%sm)) then + if ((ipos_==amg_smooth_pre_) .or.(ipos_==amg_smooth_both_)) then + if (allocated(lv%sm)) then call lv%sm%set(what,val,info,idx=idx) end if end if - if ((ipos_==amg_smooth_post_).or.(ipos_==amg_smooth_both_))then - if (allocated(lv%sm2a)) then + if ((ipos_==amg_smooth_post_).or.(ipos_==amg_smooth_both_))then + if (allocated(lv%sm2a)) then call lv%sm2a%set(what,val,info,idx=idx) end if end if diff --git a/amgprec/impl/level/amg_z_base_onelev_csetc.F90 b/amgprec/impl/level/amg_z_base_onelev_csetc.F90 index 1bcbc42a..519d5fc6 100644 --- a/amgprec/impl/level/amg_z_base_onelev_csetc.F90 +++ b/amgprec/impl/level/amg_z_base_onelev_csetc.F90 @@ -1,15 +1,15 @@ -! -! +! +! ! AMG4PSBLAS version 1.0 ! Algebraic Multigrid Package ! based on PSBLAS (Parallel Sparse BLAS version 3.5) -! -! (C) Copyright 2020 -! -! Salvatore Filippone -! Pasqua D'Ambra -! Fabio Durastante -! +! +! (C) Copyright 2020 +! +! Salvatore Filippone +! Pasqua D'Ambra +! Fabio Durastante +! ! Redistribution and use in source and binary forms, with or without ! modification, are permitted provided that the following conditions ! are met: @@ -21,7 +21,7 @@ ! 3. The name of the AMG4PSBLAS group or the names of its contributors may ! not be used to endorse or promote products derived from this ! software without specific written permission. -! +! ! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED ! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR @@ -33,10 +33,10 @@ ! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ! POSSIBILITY OF SUCH DAMAGE. -! -! +! +! subroutine amg_z_base_onelev_csetc(lv,what,val,info,pos,idx) - + use psb_base_mod use amg_z_onelev_mod, amg_protect_name => amg_z_base_onelev_csetc use amg_z_base_aggregator_mod @@ -49,6 +49,9 @@ subroutine amg_z_base_onelev_csetc(lv,what,val,info,pos,idx) use amg_z_ilu_solver use amg_z_id_solver use amg_z_gs_solver + use amg_z_ainv_solver + use amg_z_invk_solver + use amg_z_invt_solver #if defined(HAVE_UMF_) use amg_z_umf_solver #endif @@ -65,16 +68,16 @@ subroutine amg_z_base_onelev_csetc(lv,what,val,info,pos,idx) Implicit None ! Arguments - class(amg_z_onelev_type), intent(inout) :: lv - character(len=*), intent(in) :: what + class(amg_z_onelev_type), intent(inout) :: lv + character(len=*), intent(in) :: what character(len=*), intent(in) :: val integer(psb_ipk_), intent(out) :: info character(len=*), optional, intent(in) :: pos integer(psb_ipk_), intent(in), optional :: idx - ! Local + ! Local integer(psb_ipk_) :: ipos_, err_act character(len=20) :: name='z_base_onelev_csetc' - integer(psb_ipk_) :: ival + integer(psb_ipk_) :: ival type(amg_z_base_smoother_type) :: amg_z_base_smoother_mold type(amg_z_jac_smoother_type) :: amg_z_jac_smoother_mold type(amg_z_l1_jac_smoother_type) :: amg_z_l1_jac_smoother_mold @@ -85,6 +88,9 @@ subroutine amg_z_base_onelev_csetc(lv,what,val,info,pos,idx) type(amg_z_id_solver_type) :: amg_z_id_solver_mold type(amg_z_gs_solver_type) :: amg_z_gs_solver_mold type(amg_z_bwgs_solver_type) :: amg_z_bwgs_solver_mold + type(amg_z_ainv_solver_type) :: amg_z_ainv_solver_mold + type(amg_z_invk_solver_type) :: amg_z_invk_solver_mold + type(amg_z_invt_solver_type) :: amg_z_invt_solver_mold #if defined(HAVE_UMF_) type(amg_z_umf_solver_type) :: amg_z_umf_solver_mold #endif @@ -97,7 +103,7 @@ subroutine amg_z_base_onelev_csetc(lv,what,val,info,pos,idx) #if defined(HAVE_MUMPS_) type(amg_z_mumps_solver_type) :: amg_z_mumps_solver_mold #endif - + call psb_erractionsave(err_act) @@ -118,14 +124,14 @@ subroutine amg_z_base_onelev_csetc(lv,what,val,info,pos,idx) else ipos_ = amg_smooth_both_ end if - + select case (psb_toupper(trim(what))) case ('SMOOTHER_TYPE') select case (psb_toupper(trim(val))) case ('NOPREC','NONE') call lv%set(amg_z_base_smoother_mold,info,pos=pos) if (info == 0) call lv%set(amg_z_id_solver_mold,info,pos=pos) - + case ('JAC','JACOBI') call lv%set(amg_z_jac_smoother_mold,info,pos=pos) if (info == 0) call lv%set(amg_z_diag_solver_mold,info,pos=pos) @@ -133,11 +139,11 @@ subroutine amg_z_base_onelev_csetc(lv,what,val,info,pos,idx) case ('L1-JACOBI') call lv%set(amg_z_jac_smoother_mold,info,pos=pos) if (info == 0) call lv%set(amg_z_l1_diag_solver_mold,info,pos=pos) - + case ('BJAC') call lv%set(amg_z_jac_smoother_mold,info,pos=pos) if (info == 0) call lv%set(amg_z_ilu_solver_mold,info,pos=pos) - + case ('L1-BJAC') call lv%set(amg_z_l1_jac_smoother_mold,info,pos=pos) if (info == 0) call lv%set(amg_z_ilu_solver_mold,info,pos=pos) @@ -166,59 +172,65 @@ subroutine amg_z_base_onelev_csetc(lv,what,val,info,pos,idx) case ('L1-BWGS') call lv%set(amg_z_l1_jac_smoother_mold,info,pos='pre') if (info == 0) call lv%set(amg_z_bwgs_solver_mold,info,pos='pre') - if (allocated(lv%sm2a)) deallocate(lv%sm2a) + if (allocated(lv%sm2a)) deallocate(lv%sm2a) case ('L1-FBGS') call lv%set(amg_z_l1_jac_smoother_mold,info,pos='pre') if (info == 0) call lv%set(amg_z_gs_solver_mold,info,pos='pre') call lv%set(amg_z_l1_jac_smoother_mold,info,pos='post') if (info == 0) call lv%set(amg_z_bwgs_solver_mold,info,pos='post') - + case default ! - ! Do nothing and hope for the best :) + ! Do nothing and hope for the best :) ! end select - if ((ipos_==amg_smooth_pre_).or.(ipos_==amg_smooth_both_)) then + if ((ipos_==amg_smooth_pre_).or.(ipos_==amg_smooth_both_)) then if (allocated(lv%sm)) call lv%sm%default() end if if ((ipos_==amg_smooth_post_).or.(ipos_==amg_smooth_both_)) then if (allocated(lv%sm2a)) call lv%sm2a%default() end if - + case('SUB_SOLVE') select case (psb_toupper(trim(val))) case ('NONE','NOPREC','FACT_NONE') call lv%set(amg_z_id_solver_mold,info,pos=pos) - + case ('DIAG') call lv%set(amg_z_diag_solver_mold,info,pos=pos) - + case ('L1-DIAG') call lv%set(amg_z_l1_diag_solver_mold,info,pos=pos) - + case ('GS','FGS','FWGS') call lv%set(amg_z_gs_solver_mold,info,pos=pos) - + case ('BGS','BWGS') call lv%set(amg_z_bwgs_solver_mold,info,pos=pos) - + + case ('AINV') + call lv%set(amg_z_ainv_solver_mold,info,pos=pos) + case ('INVK') + call lv%set(amg_z_invk_solver_mold,info,pos=pos) + case ('INVT') + call lv%set(amg_z_invt_solver_mold,info,pos=pos) case ('ILU','ILUT','MILU') call lv%set(amg_z_ilu_solver_mold,info,pos=pos) if (info == 0) then - if ((ipos_==amg_smooth_pre_) .or.(ipos_==amg_smooth_both_)) then + if ((ipos_==amg_smooth_pre_) .or.(ipos_==amg_smooth_both_)) then call lv%sm%sv%set('SUB_SOLVE',val,info) end if - if ((ipos_==amg_smooth_post_).or.(ipos_==amg_smooth_both_))then + if ((ipos_==amg_smooth_post_).or.(ipos_==amg_smooth_both_))then if (allocated(lv%sm2a)) call lv%sm2a%sv%set('SUB_SOLVE',val,info) end if end if #ifdef HAVE_SLU_ - case ('SLU') + case ('SLU') call lv%set(amg_z_slu_solver_mold,info,pos=pos) #endif #ifdef HAVE_MUMPS_ - case ('MUMPS') + case ('MUMPS') call lv%set(amg_z_mumps_solver_mold,info,pos=pos) #endif #ifdef HAVE_SLUDIST_ @@ -231,10 +243,10 @@ subroutine amg_z_base_onelev_csetc(lv,what,val,info,pos,idx) #endif case default ! - ! Do nothing and hope for the best :) + ! Do nothing and hope for the best :) ! end select - + case ('ML_CYCLE') lv%parms%ml_cycle = amg_stringval(val) @@ -249,7 +261,7 @@ subroutine amg_z_base_onelev_csetc(lv,what,val,info,pos,idx) return end if end if - + select case(ival) case(amg_dec_aggr_) allocate(amg_z_dec_aggregator_type :: lv%aggr, stat=info) @@ -259,7 +271,7 @@ subroutine amg_z_base_onelev_csetc(lv,what,val,info,pos,idx) info = psb_err_internal_error_ end select if (info == psb_success_) call lv%aggr%default() - + case ('AGGR_ORD') lv%parms%aggr_ord = amg_stringval(val) @@ -286,13 +298,13 @@ subroutine amg_z_base_onelev_csetc(lv,what,val,info,pos,idx) lv%parms%coarse_solve = amg_stringval(val) case default - if ((ipos_==amg_smooth_pre_) .or.(ipos_==amg_smooth_both_)) then - if (allocated(lv%sm)) then + if ((ipos_==amg_smooth_pre_) .or.(ipos_==amg_smooth_both_)) then + if (allocated(lv%sm)) then call lv%sm%set(what,val,info,idx=idx) end if end if - if ((ipos_==amg_smooth_post_).or.(ipos_==amg_smooth_both_))then - if (allocated(lv%sm2a)) then + if ((ipos_==amg_smooth_post_).or.(ipos_==amg_smooth_both_))then + if (allocated(lv%sm2a)) then call lv%sm2a%set(what,val,info,idx=idx) end if end if diff --git a/tests/pdegen/amg_d_pde2d.f90 b/tests/pdegen/amg_d_pde2d.f90 index 59fa185d..14989737 100644 --- a/tests/pdegen/amg_d_pde2d.f90 +++ b/tests/pdegen/amg_d_pde2d.f90 @@ -112,9 +112,6 @@ program amg_d_pde2d type(solverdata) :: s_choice ! preconditioner data - type(amg_d_invt_solver_type) :: invtsv - type(amg_d_invk_solver_type) :: invksv - type(amg_d_ainv_solver_type) :: ainvsv type precdata ! preconditioner type @@ -309,11 +306,11 @@ program amg_d_pde2d call prec%set('sub_prol', p_choice%prol, info) select case(trim(psb_toupper(p_choice%solve))) case('INVK') - call prec%set(invksv, info) + call prec%set('sub_solve', p_choice%solve, info) case('INVT') - call prec%set(invtsv, info) + call prec%set('sub_solve', p_choice%solve, info) case('AINV') - call prec%set(ainvsv, info) + call prec%set('sub_solve', p_choice%solve, info) call prec%set('ainv_alg', p_choice%variant, info) case default call prec%set('sub_solve', p_choice%solve, info) @@ -336,12 +333,12 @@ program amg_d_pde2d call prec%set('sub_prol', p_choice%prol2, info,pos='post') select case(trim(psb_toupper(p_choice%solve2))) case('INVK') - call prec%set(invksv, info, pos='post') + call prec%set('sub_solve', p_choice%solve, info) case('INVT') - call prec%set(invtsv, info, pos='post') + call prec%set('sub_solve', p_choice%solve, info) case('AINV') - call prec%set(ainvsv, info, pos='post') - call prec%set('ainv_alg', p_choice%variant2, info, pos='post') + call prec%set('sub_solve', p_choice%solve, info) + call prec%set('ainv_alg', p_choice%variant, info) case default call prec%set('sub_solve', p_choice%solve2, info, pos='post') end select diff --git a/tests/pdegen/amg_d_pde3d.f90 b/tests/pdegen/amg_d_pde3d.f90 index 276ba2cc..6e118514 100644 --- a/tests/pdegen/amg_d_pde3d.f90 +++ b/tests/pdegen/amg_d_pde3d.f90 @@ -113,9 +113,6 @@ program amg_d_pde3d type(solverdata) :: s_choice ! preconditioner data - type(amg_d_invt_solver_type) :: invtsv - type(amg_d_invk_solver_type) :: invksv - type(amg_d_ainv_solver_type) :: ainvsv type precdata ! preconditioner type @@ -313,11 +310,11 @@ program amg_d_pde3d call prec%set('sub_prol', p_choice%prol, info) select case(trim(psb_toupper(p_choice%solve))) case('INVK') - call prec%set(invksv, info) + call prec%set('sub_solve', p_choice%solve, info) case('INVT') - call prec%set(invtsv, info) + call prec%set('sub_solve', p_choice%solve, info) case('AINV') - call prec%set(ainvsv, info) + call prec%set('sub_solve', p_choice%solve, info) call prec%set('ainv_alg', p_choice%variant, info) case default call prec%set('sub_solve', p_choice%solve, info) @@ -340,12 +337,12 @@ program amg_d_pde3d call prec%set('sub_prol', p_choice%prol2, info,pos='post') select case(trim(psb_toupper(p_choice%solve2))) case('INVK') - call prec%set(invksv, info, pos='post') + call prec%set('sub_solve', p_choice%solve, info) case('INVT') - call prec%set(invtsv, info, pos='post') + call prec%set('sub_solve', p_choice%solve, info) case('AINV') - call prec%set(ainvsv, info, pos='post') - call prec%set('ainv_alg', p_choice%variant2, info, pos='post') + call prec%set('sub_solve', p_choice%solve, info) + call prec%set('ainv_alg', p_choice%variant, info) case default call prec%set('sub_solve', p_choice%solve2, info, pos='post') end select diff --git a/tests/pdegen/amg_s_pde2d.f90 b/tests/pdegen/amg_s_pde2d.f90 index 5cb44192..65065864 100644 --- a/tests/pdegen/amg_s_pde2d.f90 +++ b/tests/pdegen/amg_s_pde2d.f90 @@ -112,9 +112,6 @@ program amg_s_pde2d type(solverdata) :: s_choice ! preconditioner data - type(amg_s_invt_solver_type) :: invtsv - type(amg_s_invk_solver_type) :: invksv - type(amg_s_ainv_solver_type) :: ainvsv type precdata ! preconditioner type @@ -309,11 +306,11 @@ program amg_s_pde2d call prec%set('sub_prol', p_choice%prol, info) select case(trim(psb_toupper(p_choice%solve))) case('INVK') - call prec%set(invksv, info) + call prec%set('sub_solve', p_choice%solve, info) case('INVT') - call prec%set(invtsv, info) + call prec%set('sub_solve', p_choice%solve, info) case('AINV') - call prec%set(ainvsv, info) + call prec%set('sub_solve', p_choice%solve, info) call prec%set('ainv_alg', p_choice%variant, info) case default call prec%set('sub_solve', p_choice%solve, info) @@ -336,12 +333,12 @@ program amg_s_pde2d call prec%set('sub_prol', p_choice%prol2, info,pos='post') select case(trim(psb_toupper(p_choice%solve2))) case('INVK') - call prec%set(invksv, info, pos='post') + call prec%set('sub_solve', p_choice%solve, info) case('INVT') - call prec%set(invtsv, info, pos='post') + call prec%set('sub_solve', p_choice%solve, info) case('AINV') - call prec%set(ainvsv, info, pos='post') - call prec%set('ainv_alg', p_choice%variant2, info, pos='post') + call prec%set('sub_solve', p_choice%solve, info) + call prec%set('ainv_alg', p_choice%variant, info) case default call prec%set('sub_solve', p_choice%solve2, info, pos='post') end select diff --git a/tests/pdegen/amg_s_pde3d.f90 b/tests/pdegen/amg_s_pde3d.f90 index 467987e6..b63f9bf1 100644 --- a/tests/pdegen/amg_s_pde3d.f90 +++ b/tests/pdegen/amg_s_pde3d.f90 @@ -113,9 +113,6 @@ program amg_s_pde3d type(solverdata) :: s_choice ! preconditioner data - type(amg_s_invt_solver_type) :: invtsv - type(amg_s_invk_solver_type) :: invksv - type(amg_s_ainv_solver_type) :: ainvsv type precdata ! preconditioner type @@ -313,11 +310,11 @@ program amg_s_pde3d call prec%set('sub_prol', p_choice%prol, info) select case(trim(psb_toupper(p_choice%solve))) case('INVK') - call prec%set(invksv, info) + call prec%set('sub_solve', p_choice%solve, info) case('INVT') - call prec%set(invtsv, info) + call prec%set('sub_solve', p_choice%solve, info) case('AINV') - call prec%set(ainvsv, info) + call prec%set('sub_solve', p_choice%solve, info) call prec%set('ainv_alg', p_choice%variant, info) case default call prec%set('sub_solve', p_choice%solve, info) @@ -340,12 +337,12 @@ program amg_s_pde3d call prec%set('sub_prol', p_choice%prol2, info,pos='post') select case(trim(psb_toupper(p_choice%solve2))) case('INVK') - call prec%set(invksv, info, pos='post') + call prec%set('sub_solve', p_choice%solve, info) case('INVT') - call prec%set(invtsv, info, pos='post') + call prec%set('sub_solve', p_choice%solve, info) case('AINV') - call prec%set(ainvsv, info, pos='post') - call prec%set('ainv_alg', p_choice%variant2, info, pos='post') + call prec%set('sub_solve', p_choice%solve, info) + call prec%set('ainv_alg', p_choice%variant, info) case default call prec%set('sub_solve', p_choice%solve2, info, pos='post') end select