From 526dc1c26028a85570fdc03b9bd98289aa513652 Mon Sep 17 00:00:00 2001 From: Cirdans-Home Date: Fri, 20 Nov 2020 14:54:35 +0100 Subject: [PATCH] Added options to set and test program --- prec/Makefile | 8 ++++---- prec/impl/psb_c_bjacprec_impl.f90 | 9 ++++++--- prec/impl/psb_c_prec_type_impl.f90 | 12 ++++++++---- prec/impl/psb_d_bjacprec_impl.f90 | 9 ++++++--- prec/impl/psb_d_prec_type_impl.f90 | 12 ++++++++---- prec/impl/psb_s_bjacprec_impl.f90 | 9 ++++++--- prec/impl/psb_s_prec_type_impl.f90 | 12 ++++++++---- prec/impl/psb_z_bjacprec_impl.f90 | 9 ++++++--- prec/impl/psb_z_prec_type_impl.f90 | 12 ++++++++---- test/pargen/psb_d_pde3d.f90 | 11 +++++++++++ test/pargen/psb_s_pde3d.f90 | 11 +++++++++++ 11 files changed, 82 insertions(+), 32 deletions(-) diff --git a/prec/Makefile b/prec/Makefile index 5fa10d4d..35420bc4 100644 --- a/prec/Makefile +++ b/prec/Makefile @@ -56,10 +56,10 @@ psb_s_bjacprec.o psb_s_diagprec.o psb_s_nullprec.o: psb_prec_mod.o psb_s_base_pr psb_d_bjacprec.o psb_d_diagprec.o psb_d_nullprec.o: psb_prec_mod.o psb_d_base_prec_mod.o psb_c_bjacprec.o psb_c_diagprec.o psb_c_nullprec.o: psb_prec_mod.o psb_c_base_prec_mod.o psb_z_bjacprec.o psb_z_diagprec.o psb_z_nullprec.o: psb_prec_mod.o psb_z_base_prec_mod.o -psb_s_bjacprec.o: psb_s_ilu_fact_mod.o psb_s_ainv_fact_mod.o -psb_d_bjacprec.o: psb_d_ilu_fact_mod.o psb_d_ainv_fact_mod.o -psb_c_bjacprec.o: psb_c_ilu_fact_mod.o psb_c_ainv_fact_mod.o -psb_z_bjacprec.o: psb_z_ilu_fact_mod.o psb_z_ainv_fact_mod.o +psb_s_bjacprec.o: psb_s_ilu_fact_mod.o psb_s_ainv_fact_mod.o psb_s_invk_fact_mod psb_s_invt_fact_mod +psb_d_bjacprec.o: psb_d_ilu_fact_mod.o psb_d_ainv_fact_mod.o psb_d_invk_fact_mod psb_d_invt_fact_mod +psb_c_bjacprec.o: psb_c_ilu_fact_mod.o psb_c_ainv_fact_mod.o psb_c_invk_fact_mod psb_c_invt_fact_mod +psb_z_bjacprec.o: psb_z_ilu_fact_mod.o psb_z_ainv_fact_mod.o psb_z_invk_fact_mod psb_z_invt_fact_mod psb_d_ainv_fact_mod.o: psb_prec_const_mod.o psb_ainv_tools_mod.o psb_s_ainv_fact_mod.o: psb_prec_const_mod.o psb_ainv_tools_mod.o psb_c_ainv_fact_mod.o: psb_prec_const_mod.o psb_ainv_tools_mod.o diff --git a/prec/impl/psb_c_bjacprec_impl.f90 b/prec/impl/psb_c_bjacprec_impl.f90 index 45b96432..e67bbc8d 100644 --- a/prec/impl/psb_c_bjacprec_impl.f90 +++ b/prec/impl/psb_c_bjacprec_impl.f90 @@ -448,6 +448,11 @@ subroutine psb_c_bjac_precinit(prec,info) info = psb_success_ call psb_realloc(psb_ifpsz,prec%iprcparm,info) + if (info /= psb_success_) then + info = psb_err_alloc_dealloc_ + call psb_Errpush(info,name) + goto 9999 + end if call psb_realloc(psb_rfpsz,prec%rprcparm,info) if (info /= psb_success_) then info = psb_err_alloc_dealloc_ @@ -1122,15 +1127,13 @@ subroutine psb_c_bjac_precsetr(prec,what,val,info) call psb_erractionsave(err_act) info = psb_success_ - if (.not.allocated(prec%iprcparm)) then + if (.not.allocated(prec%rprcparm)) then info = 1124 call psb_errpush(info,name,a_err="preconditioner") goto 9999 end if select case(what) - case (psb_f_type_) - prec%iprcparm(psb_f_type_) = val case (psb_fact_eps_) prec%rprcparm(psb_fact_eps_) = val diff --git a/prec/impl/psb_c_prec_type_impl.f90 b/prec/impl/psb_c_prec_type_impl.f90 index eada83ad..9120b124 100644 --- a/prec/impl/psb_c_prec_type_impl.f90 +++ b/prec/impl/psb_c_prec_type_impl.f90 @@ -354,9 +354,9 @@ subroutine psb_ccprecseti(prec,what,val,info,ilev,ilmax,pos,idx) ! We need to convert from the 'what' string to the corresponding integer ! value befor passing the call to the set of the inner method. select case (psb_toupper(what)) - case ("SUB_FILLIN") + case ('SUB_FILLIN') call prec%prec%precset(psb_ilu_fill_in_,val,info) - case('INV_FILLIN') + case ('INV_FILLIN') call prec%prec%precset(psb_inv_fillin_,val,info) case default info = psb_err_invalid_args_combination_ @@ -383,7 +383,7 @@ subroutine psb_ccprecsetr(prec,what,val,info,ilev,ilmax,pos,idx) character(len=*), optional, intent(in) :: pos ! Local variables - character(len=*), parameter :: name='amg_precsetr' + character(len=*), parameter :: name='psb_precsetr' info = psb_success_ @@ -419,7 +419,7 @@ subroutine psb_ccprecsetc(prec,what,string,info,ilev,ilmax,pos,idx) character(len=*), optional, intent(in) :: pos ! Local variables - character(len=*), parameter :: name='amg_precsetc' + character(len=*), parameter :: name='psb_precsetc' info = psb_success_ @@ -437,6 +437,10 @@ subroutine psb_ccprecsetc(prec,what,string,info,ilev,ilmax,pos,idx) call prec%prec%precset(psb_ilu_ialg_,psb_ilu_t_,info) case("AINV") call prec%prec%precset(psb_f_type_,psb_f_ainv_,info) + case("INVK") + call prec%prec%precset(psb_f_type_,psb_f_invk_,info) + case("INVT") + call prec%prec%precset(psb_f_type_,psb_f_invt_,info) case default ! Default to ILU(0) factorization call prec%prec%precset(psb_f_type_,psb_f_ilu_n_,info) diff --git a/prec/impl/psb_d_bjacprec_impl.f90 b/prec/impl/psb_d_bjacprec_impl.f90 index f07e713e..5d2c172c 100644 --- a/prec/impl/psb_d_bjacprec_impl.f90 +++ b/prec/impl/psb_d_bjacprec_impl.f90 @@ -448,6 +448,11 @@ subroutine psb_d_bjac_precinit(prec,info) info = psb_success_ call psb_realloc(psb_ifpsz,prec%iprcparm,info) + if (info /= psb_success_) then + info = psb_err_alloc_dealloc_ + call psb_Errpush(info,name) + goto 9999 + end if call psb_realloc(psb_rfpsz,prec%rprcparm,info) if (info /= psb_success_) then info = psb_err_alloc_dealloc_ @@ -1122,15 +1127,13 @@ subroutine psb_d_bjac_precsetr(prec,what,val,info) call psb_erractionsave(err_act) info = psb_success_ - if (.not.allocated(prec%iprcparm)) then + if (.not.allocated(prec%rprcparm)) then info = 1124 call psb_errpush(info,name,a_err="preconditioner") goto 9999 end if select case(what) - case (psb_f_type_) - prec%iprcparm(psb_f_type_) = val case (psb_fact_eps_) prec%rprcparm(psb_fact_eps_) = val diff --git a/prec/impl/psb_d_prec_type_impl.f90 b/prec/impl/psb_d_prec_type_impl.f90 index 13e43d76..127fcecc 100644 --- a/prec/impl/psb_d_prec_type_impl.f90 +++ b/prec/impl/psb_d_prec_type_impl.f90 @@ -354,9 +354,9 @@ subroutine psb_dcprecseti(prec,what,val,info,ilev,ilmax,pos,idx) ! We need to convert from the 'what' string to the corresponding integer ! value befor passing the call to the set of the inner method. select case (psb_toupper(what)) - case ("SUB_FILLIN") + case ('SUB_FILLIN') call prec%prec%precset(psb_ilu_fill_in_,val,info) - case('INV_FILLIN') + case ('INV_FILLIN') call prec%prec%precset(psb_inv_fillin_,val,info) case default info = psb_err_invalid_args_combination_ @@ -383,7 +383,7 @@ subroutine psb_dcprecsetr(prec,what,val,info,ilev,ilmax,pos,idx) character(len=*), optional, intent(in) :: pos ! Local variables - character(len=*), parameter :: name='amg_precsetr' + character(len=*), parameter :: name='psb_precsetr' info = psb_success_ @@ -419,7 +419,7 @@ subroutine psb_dcprecsetc(prec,what,string,info,ilev,ilmax,pos,idx) character(len=*), optional, intent(in) :: pos ! Local variables - character(len=*), parameter :: name='amg_precsetc' + character(len=*), parameter :: name='psb_precsetc' info = psb_success_ @@ -437,6 +437,10 @@ subroutine psb_dcprecsetc(prec,what,string,info,ilev,ilmax,pos,idx) call prec%prec%precset(psb_ilu_ialg_,psb_ilu_t_,info) case("AINV") call prec%prec%precset(psb_f_type_,psb_f_ainv_,info) + case("INVK") + call prec%prec%precset(psb_f_type_,psb_f_invk_,info) + case("INVT") + call prec%prec%precset(psb_f_type_,psb_f_invt_,info) case default ! Default to ILU(0) factorization call prec%prec%precset(psb_f_type_,psb_f_ilu_n_,info) diff --git a/prec/impl/psb_s_bjacprec_impl.f90 b/prec/impl/psb_s_bjacprec_impl.f90 index 3abe5c5d..e7530d67 100644 --- a/prec/impl/psb_s_bjacprec_impl.f90 +++ b/prec/impl/psb_s_bjacprec_impl.f90 @@ -448,6 +448,11 @@ subroutine psb_s_bjac_precinit(prec,info) info = psb_success_ call psb_realloc(psb_ifpsz,prec%iprcparm,info) + if (info /= psb_success_) then + info = psb_err_alloc_dealloc_ + call psb_Errpush(info,name) + goto 9999 + end if call psb_realloc(psb_rfpsz,prec%rprcparm,info) if (info /= psb_success_) then info = psb_err_alloc_dealloc_ @@ -1122,15 +1127,13 @@ subroutine psb_s_bjac_precsetr(prec,what,val,info) call psb_erractionsave(err_act) info = psb_success_ - if (.not.allocated(prec%iprcparm)) then + if (.not.allocated(prec%rprcparm)) then info = 1124 call psb_errpush(info,name,a_err="preconditioner") goto 9999 end if select case(what) - case (psb_f_type_) - prec%iprcparm(psb_f_type_) = val case (psb_fact_eps_) prec%rprcparm(psb_fact_eps_) = val diff --git a/prec/impl/psb_s_prec_type_impl.f90 b/prec/impl/psb_s_prec_type_impl.f90 index 507c1258..ff0ff2d7 100644 --- a/prec/impl/psb_s_prec_type_impl.f90 +++ b/prec/impl/psb_s_prec_type_impl.f90 @@ -354,9 +354,9 @@ subroutine psb_scprecseti(prec,what,val,info,ilev,ilmax,pos,idx) ! We need to convert from the 'what' string to the corresponding integer ! value befor passing the call to the set of the inner method. select case (psb_toupper(what)) - case ("SUB_FILLIN") + case ('SUB_FILLIN') call prec%prec%precset(psb_ilu_fill_in_,val,info) - case('INV_FILLIN') + case ('INV_FILLIN') call prec%prec%precset(psb_inv_fillin_,val,info) case default info = psb_err_invalid_args_combination_ @@ -383,7 +383,7 @@ subroutine psb_scprecsetr(prec,what,val,info,ilev,ilmax,pos,idx) character(len=*), optional, intent(in) :: pos ! Local variables - character(len=*), parameter :: name='amg_precsetr' + character(len=*), parameter :: name='psb_precsetr' info = psb_success_ @@ -419,7 +419,7 @@ subroutine psb_scprecsetc(prec,what,string,info,ilev,ilmax,pos,idx) character(len=*), optional, intent(in) :: pos ! Local variables - character(len=*), parameter :: name='amg_precsetc' + character(len=*), parameter :: name='psb_precsetc' info = psb_success_ @@ -437,6 +437,10 @@ subroutine psb_scprecsetc(prec,what,string,info,ilev,ilmax,pos,idx) call prec%prec%precset(psb_ilu_ialg_,psb_ilu_t_,info) case("AINV") call prec%prec%precset(psb_f_type_,psb_f_ainv_,info) + case("INVK") + call prec%prec%precset(psb_f_type_,psb_f_invk_,info) + case("INVT") + call prec%prec%precset(psb_f_type_,psb_f_invt_,info) case default ! Default to ILU(0) factorization call prec%prec%precset(psb_f_type_,psb_f_ilu_n_,info) diff --git a/prec/impl/psb_z_bjacprec_impl.f90 b/prec/impl/psb_z_bjacprec_impl.f90 index 321a9768..d59feaa0 100644 --- a/prec/impl/psb_z_bjacprec_impl.f90 +++ b/prec/impl/psb_z_bjacprec_impl.f90 @@ -448,6 +448,11 @@ subroutine psb_z_bjac_precinit(prec,info) info = psb_success_ call psb_realloc(psb_ifpsz,prec%iprcparm,info) + if (info /= psb_success_) then + info = psb_err_alloc_dealloc_ + call psb_Errpush(info,name) + goto 9999 + end if call psb_realloc(psb_rfpsz,prec%rprcparm,info) if (info /= psb_success_) then info = psb_err_alloc_dealloc_ @@ -1122,15 +1127,13 @@ subroutine psb_z_bjac_precsetr(prec,what,val,info) call psb_erractionsave(err_act) info = psb_success_ - if (.not.allocated(prec%iprcparm)) then + if (.not.allocated(prec%rprcparm)) then info = 1124 call psb_errpush(info,name,a_err="preconditioner") goto 9999 end if select case(what) - case (psb_f_type_) - prec%iprcparm(psb_f_type_) = val case (psb_fact_eps_) prec%rprcparm(psb_fact_eps_) = val diff --git a/prec/impl/psb_z_prec_type_impl.f90 b/prec/impl/psb_z_prec_type_impl.f90 index 753301ff..59f3047f 100644 --- a/prec/impl/psb_z_prec_type_impl.f90 +++ b/prec/impl/psb_z_prec_type_impl.f90 @@ -354,9 +354,9 @@ subroutine psb_zcprecseti(prec,what,val,info,ilev,ilmax,pos,idx) ! We need to convert from the 'what' string to the corresponding integer ! value befor passing the call to the set of the inner method. select case (psb_toupper(what)) - case ("SUB_FILLIN") + case ('SUB_FILLIN') call prec%prec%precset(psb_ilu_fill_in_,val,info) - case('INV_FILLIN') + case ('INV_FILLIN') call prec%prec%precset(psb_inv_fillin_,val,info) case default info = psb_err_invalid_args_combination_ @@ -383,7 +383,7 @@ subroutine psb_zcprecsetr(prec,what,val,info,ilev,ilmax,pos,idx) character(len=*), optional, intent(in) :: pos ! Local variables - character(len=*), parameter :: name='amg_precsetr' + character(len=*), parameter :: name='psb_precsetr' info = psb_success_ @@ -419,7 +419,7 @@ subroutine psb_zcprecsetc(prec,what,string,info,ilev,ilmax,pos,idx) character(len=*), optional, intent(in) :: pos ! Local variables - character(len=*), parameter :: name='amg_precsetc' + character(len=*), parameter :: name='psb_precsetc' info = psb_success_ @@ -437,6 +437,10 @@ subroutine psb_zcprecsetc(prec,what,string,info,ilev,ilmax,pos,idx) call prec%prec%precset(psb_ilu_ialg_,psb_ilu_t_,info) case("AINV") call prec%prec%precset(psb_f_type_,psb_f_ainv_,info) + case("INVK") + call prec%prec%precset(psb_f_type_,psb_f_invk_,info) + case("INVT") + call prec%prec%precset(psb_f_type_,psb_f_invt_,info) case default ! Default to ILU(0) factorization call prec%prec%precset(psb_f_type_,psb_f_ilu_n_,info) diff --git a/test/pargen/psb_d_pde3d.f90 b/test/pargen/psb_d_pde3d.f90 index ff168dde..91188e4f 100644 --- a/test/pargen/psb_d_pde3d.f90 +++ b/test/pargen/psb_d_pde3d.f90 @@ -681,6 +681,14 @@ program psb_d_pde3d call prec%set('inv_thresh', parms%inv_thresh, info) call prec%set('inv_fillin', parms%inv_fill, info) call prec%set('ilut_scale', parms%ilut_scale, info) + case ("INVK") + call prec%set('sub_fillin', parms%fill, info) + call prec%set('inv_fillin', parms%inv_fill, info) + case ("INVT") + call prec%set('sub_fillin', parms%fill, info) + call prec%set('inv_fillin', parms%inv_fill, info) + call prec%set('sub_iluthrs', parms%thresh, info) + call prec%set('inv_thresh', parms%inv_thresh, info) case default ! Do nothing, use default setting in the init routine end select @@ -884,6 +892,9 @@ contains write(psb_out_unit,'("Threshold : ",es12.5)') parms%thresh write(psb_out_unit,'("Scaling : ",a)') parms%ilut_scale case ('INVK') + write(psb_out_unit,'("Fill in : ",i0)') parms%fill + write(psb_out_unit,'("Invese Fill in : ",i0)') parms%inv_fill + case ('INVT') write(psb_out_unit,'("Fill in : ",i0)') parms%fill write(psb_out_unit,'("Threshold : ",es12.5)') parms%thresh write(psb_out_unit,'("Invese Fill in : ",i0)') parms%inv_fill diff --git a/test/pargen/psb_s_pde3d.f90 b/test/pargen/psb_s_pde3d.f90 index b301d0a3..f8908642 100644 --- a/test/pargen/psb_s_pde3d.f90 +++ b/test/pargen/psb_s_pde3d.f90 @@ -681,6 +681,14 @@ program psb_s_pde3d call prec%set('inv_thresh', parms%inv_thresh, info) call prec%set('inv_fillin', parms%inv_fill, info) call prec%set('ilut_scale', parms%ilut_scale, info) + case ("INVK") + call prec%set('sub_fillin', parms%fill, info) + call prec%set('inv_fillin', parms%inv_fill, info) + case ("INVT") + call prec%set('sub_fillin', parms%fill, info) + call prec%set('inv_fillin', parms%inv_fill, info) + call prec%set('sub_iluthrs', parms%thresh, info) + call prec%set('inv_thresh', parms%inv_thresh, info) case default ! Do nothing, use default setting in the init routine end select @@ -884,6 +892,9 @@ contains write(psb_out_unit,'("Threshold : ",es12.5)') parms%thresh write(psb_out_unit,'("Scaling : ",a)') parms%ilut_scale case ('INVK') + write(psb_out_unit,'("Fill in : ",i0)') parms%fill + write(psb_out_unit,'("Invese Fill in : ",i0)') parms%inv_fill + case ('INVT') write(psb_out_unit,'("Fill in : ",i0)') parms%fill write(psb_out_unit,'("Threshold : ",es12.5)') parms%thresh write(psb_out_unit,'("Invese Fill in : ",i0)') parms%inv_fill