You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
269 lines
8.7 KiB
Fortran
269 lines
8.7 KiB
Fortran
8 years ago
|
!
|
||
|
!
|
||
4 years ago
|
! AMG4PSBLAS version 1.0
|
||
|
! Algebraic Multigrid Package
|
||
8 years ago
|
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||
8 years ago
|
!
|
||
4 years ago
|
! (C) Copyright 2020
|
||
8 years ago
|
!
|
||
7 years ago
|
! Salvatore Filippone
|
||
|
! Pasqua D'Ambra
|
||
4 years ago
|
! Fabio Durastante
|
||
8 years ago
|
!
|
||
|
! Redistribution and use in source and binary forms, with or without
|
||
|
! modification, are permitted provided that the following conditions
|
||
|
! are met:
|
||
|
! 1. Redistributions of source code must retain the above copyright
|
||
|
! notice, this list of conditions and the following disclaimer.
|
||
|
! 2. Redistributions in binary form must reproduce the above copyright
|
||
|
! notice, this list of conditions, and the following disclaimer in the
|
||
|
! documentation and/or other materials provided with the distribution.
|
||
4 years ago
|
! 3. The name of the AMG4PSBLAS group or the names of its contributors may
|
||
8 years ago
|
! 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
|
||
4 years ago
|
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AMG4PSBLAS GROUP OR ITS CONTRIBUTORS
|
||
8 years ago
|
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||
|
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||
|
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||
|
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||
|
! 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.
|
||
|
!
|
||
|
!
|
||
4 years ago
|
subroutine amg_s_base_onelev_cseti(lv,what,val,info,pos,idx)
|
||
12 years ago
|
|
||
|
use psb_base_mod
|
||
4 years ago
|
use amg_s_onelev_mod, amg_protect_name => amg_s_base_onelev_cseti
|
||
|
use amg_s_base_aggregator_mod
|
||
|
use amg_s_dec_aggregator_mod
|
||
|
use amg_s_symdec_aggregator_mod
|
||
|
use amg_s_jac_smoother
|
||
|
use amg_s_as_smoother
|
||
|
use amg_s_diag_solver
|
||
|
use amg_s_l1_diag_solver
|
||
|
use amg_s_ilu_solver
|
||
|
use amg_s_id_solver
|
||
|
use amg_s_gs_solver
|
||
9 years ago
|
#if defined(HAVE_SLU_)
|
||
4 years ago
|
use amg_s_slu_solver
|
||
9 years ago
|
#endif
|
||
|
#if defined(HAVE_MUMPS_)
|
||
4 years ago
|
use amg_s_mumps_solver
|
||
9 years ago
|
#endif
|
||
12 years ago
|
|
||
|
Implicit None
|
||
|
|
||
|
! Arguments
|
||
4 years ago
|
class(amg_s_onelev_type), intent(inout) :: lv
|
||
12 years ago
|
character(len=*), intent(in) :: what
|
||
|
integer(psb_ipk_), intent(in) :: val
|
||
|
integer(psb_ipk_), intent(out) :: info
|
||
6 years ago
|
character(len=*), optional, intent(in) :: pos
|
||
|
integer(psb_ipk_), intent(in), optional :: idx
|
||
9 years ago
|
! Local
|
||
|
integer(psb_ipk_) :: ipos_, err_act
|
||
12 years ago
|
character(len=20) :: name='s_base_onelev_cseti'
|
||
4 years ago
|
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
|
||
|
type(amg_s_as_smoother_type) :: amg_s_as_smoother_mold
|
||
|
type(amg_s_diag_solver_type) :: amg_s_diag_solver_mold
|
||
|
type(amg_s_l1_diag_solver_type) :: amg_s_l1_diag_solver_mold
|
||
|
type(amg_s_ilu_solver_type) :: amg_s_ilu_solver_mold
|
||
|
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
|
||
9 years ago
|
#if defined(HAVE_SLU_)
|
||
4 years ago
|
type(amg_s_slu_solver_type) :: amg_s_slu_solver_mold
|
||
9 years ago
|
#endif
|
||
|
#if defined(HAVE_MUMPS_)
|
||
4 years ago
|
type(amg_s_mumps_solver_type) :: amg_s_mumps_solver_mold
|
||
9 years ago
|
#endif
|
||
|
|
||
12 years ago
|
call psb_erractionsave(err_act)
|
||
|
info = psb_success_
|
||
|
|
||
9 years ago
|
if (present(pos)) then
|
||
|
select case(psb_toupper(trim(pos)))
|
||
|
case('PRE')
|
||
4 years ago
|
ipos_ = amg_smooth_pre_
|
||
9 years ago
|
case('POST')
|
||
4 years ago
|
ipos_ = amg_smooth_post_
|
||
9 years ago
|
case default
|
||
4 years ago
|
ipos_ = amg_smooth_both_
|
||
9 years ago
|
end select
|
||
|
else
|
||
4 years ago
|
ipos_ = amg_smooth_both_
|
||
9 years ago
|
end if
|
||
|
|
||
12 years ago
|
select case (psb_toupper(what))
|
||
9 years ago
|
case ('SMOOTHER_TYPE')
|
||
|
select case (val)
|
||
4 years ago
|
case (amg_noprec_)
|
||
|
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)
|
||
9 years ago
|
|
||
4 years ago
|
case (amg_jac_)
|
||
|
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)
|
||
6 years ago
|
|
||
4 years ago
|
case (amg_l1_jac_)
|
||
|
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)
|
||
9 years ago
|
|
||
4 years ago
|
case (amg_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)
|
||
5 years ago
|
|
||
4 years ago
|
case (amg_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)
|
||
9 years ago
|
|
||
4 years ago
|
case (amg_as_)
|
||
|
call lv%set(amg_s_as_smoother_mold,info,pos=pos)
|
||
|
if (info == 0) call lv%set(amg_s_ilu_solver_mold,info,pos=pos)
|
||
8 years ago
|
|
||
4 years ago
|
case (amg_fbgs_)
|
||
|
call lv%set(amg_s_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_jac_smoother_mold,info,pos='post')
|
||
|
if (info == 0) call lv%set(amg_s_bwgs_solver_mold,info,pos='post')
|
||
9 years ago
|
|
||
|
case default
|
||
|
!
|
||
|
! Do nothing and hope for the best :)
|
||
|
!
|
||
|
end select
|
||
4 years ago
|
if ((ipos_==amg_smooth_pre_).or.(ipos_==amg_smooth_both_)) then
|
||
8 years ago
|
if (allocated(lv%sm)) call lv%sm%default()
|
||
8 years ago
|
end if
|
||
4 years ago
|
if ((ipos_==amg_smooth_post_).or.(ipos_==amg_smooth_both_)) then
|
||
8 years ago
|
if (allocated(lv%sm2a)) call lv%sm2a%default()
|
||
|
end if
|
||
|
|
||
9 years ago
|
|
||
|
case('SUB_SOLVE')
|
||
|
select case (val)
|
||
4 years ago
|
case (amg_f_none_)
|
||
|
call lv%set(amg_s_id_solver_mold,info,pos=pos)
|
||
9 years ago
|
|
||
4 years ago
|
case (amg_diag_scale_)
|
||
|
call lv%set(amg_s_diag_solver_mold,info,pos=pos)
|
||
9 years ago
|
|
||
4 years ago
|
case (amg_l1_diag_scale_)
|
||
|
call lv%set(amg_s_l1_diag_solver_mold,info,pos=pos)
|
||
6 years ago
|
|
||
4 years ago
|
case (amg_gs_)
|
||
|
call lv%set(amg_s_gs_solver_mold,info,pos=pos)
|
||
9 years ago
|
|
||
4 years ago
|
case (amg_bwgs_)
|
||
|
call lv%set(amg_s_bwgs_solver_mold,info,pos=pos)
|
||
9 years ago
|
|
||
4 years ago
|
case (psb_ilu_n_,psb_milu_n_,psb_ilu_t_)
|
||
4 years ago
|
call lv%set(amg_s_ilu_solver_mold,info,pos=pos)
|
||
9 years ago
|
if (info == 0) then
|
||
4 years ago
|
if ((ipos_==amg_smooth_pre_) .or.(ipos_==amg_smooth_both_)) then
|
||
9 years ago
|
call lv%sm%sv%set('SUB_SOLVE',val,info)
|
||
8 years ago
|
end if
|
||
4 years ago
|
if ((ipos_==amg_smooth_post_).or.(ipos_==amg_smooth_both_))then
|
||
9 years ago
|
if (allocated(lv%sm2a)) call lv%sm2a%sv%set('SUB_SOLVE',val,info)
|
||
8 years ago
|
end if
|
||
9 years ago
|
end if
|
||
|
#ifdef HAVE_SLU_
|
||
4 years ago
|
case (amg_slu_)
|
||
|
call lv%set(amg_s_slu_solver_mold,info,pos=pos)
|
||
9 years ago
|
#endif
|
||
|
#ifdef HAVE_MUMPS_
|
||
4 years ago
|
case (amg_mumps_)
|
||
|
call lv%set(amg_s_mumps_solver_mold,info,pos=pos)
|
||
9 years ago
|
#endif
|
||
|
case default
|
||
|
!
|
||
|
! Do nothing and hope for the best :)
|
||
|
!
|
||
|
end select
|
||
|
|
||
12 years ago
|
|
||
|
case ('SMOOTHER_SWEEPS')
|
||
4 years ago
|
if ((ipos_==amg_smooth_pre_) .or.(ipos_==amg_smooth_both_)) &
|
||
8 years ago
|
& lv%parms%sweeps_pre = val
|
||
4 years ago
|
if ((ipos_==amg_smooth_post_).or.(ipos_==amg_smooth_both_)) &
|
||
8 years ago
|
& lv%parms%sweeps_post = val
|
||
12 years ago
|
|
||
8 years ago
|
case ('ML_CYCLE')
|
||
|
lv%parms%ml_cycle = val
|
||
12 years ago
|
|
||
8 years ago
|
case ('PAR_AGGR_ALG')
|
||
|
lv%parms%par_aggr_alg = val
|
||
7 years ago
|
if (allocated(lv%aggr)) then
|
||
|
call lv%aggr%free(info)
|
||
|
if (info == 0) deallocate(lv%aggr,stat=info)
|
||
|
if (info /= 0) then
|
||
|
info = psb_err_internal_error_
|
||
|
return
|
||
|
end if
|
||
|
end if
|
||
|
|
||
|
select case(val)
|
||
4 years ago
|
case(amg_dec_aggr_)
|
||
|
allocate(amg_s_dec_aggregator_type :: lv%aggr, stat=info)
|
||
|
case(amg_sym_dec_aggr_)
|
||
|
allocate(amg_s_symdec_aggregator_type :: lv%aggr, stat=info)
|
||
7 years ago
|
case default
|
||
|
info = psb_err_internal_error_
|
||
|
end select
|
||
7 years ago
|
if (info == psb_success_) call lv%aggr%default()
|
||
|
|
||
9 years ago
|
case ('AGGR_ORD')
|
||
|
lv%parms%aggr_ord = val
|
||
|
|
||
8 years ago
|
case ('AGGR_TYPE')
|
||
|
lv%parms%aggr_type = val
|
||
7 years ago
|
if (allocated(lv%aggr)) call lv%aggr%set_aggr_type(lv%parms,info)
|
||
8 years ago
|
|
||
|
case ('AGGR_PROL')
|
||
|
lv%parms%aggr_prol = val
|
||
12 years ago
|
|
||
|
case ('COARSE_MAT')
|
||
|
lv%parms%coarse_mat = val
|
||
|
|
||
|
case ('AGGR_OMEGA_ALG')
|
||
|
lv%parms%aggr_omega_alg= val
|
||
|
|
||
|
case ('AGGR_EIG')
|
||
|
lv%parms%aggr_eig = val
|
||
|
|
||
|
case ('AGGR_FILTER')
|
||
|
lv%parms%aggr_filter = val
|
||
|
|
||
|
case ('COARSE_SOLVE')
|
||
|
lv%parms%coarse_solve = val
|
||
|
|
||
|
case default
|
||
4 years ago
|
if ((ipos_==amg_smooth_pre_) .or.(ipos_==amg_smooth_both_)) then
|
||
9 years ago
|
if (allocated(lv%sm)) then
|
||
6 years ago
|
call lv%sm%set(what,val,info,idx=idx)
|
||
9 years ago
|
end if
|
||
8 years ago
|
end if
|
||
4 years ago
|
if ((ipos_==amg_smooth_post_).or.(ipos_==amg_smooth_both_))then
|
||
9 years ago
|
if (allocated(lv%sm2a)) then
|
||
6 years ago
|
call lv%sm2a%set(what,val,info,idx=idx)
|
||
9 years ago
|
end if
|
||
8 years ago
|
end if
|
||
6 years ago
|
if (allocated(lv%aggr)) call lv%aggr%set(what,val,info,idx=idx)
|
||
9 years ago
|
|
||
12 years ago
|
end select
|
||
|
if (info /= psb_success_) goto 9999
|
||
|
call psb_erractionrestore(err_act)
|
||
|
return
|
||
|
|
||
10 years ago
|
9999 call psb_error_handler(err_act)
|
||
12 years ago
|
return
|
||
10 years ago
|
|
||
4 years ago
|
end subroutine amg_s_base_onelev_cseti
|