mirror of
https://github.com/sfilippone/amg4psblas.git
synced 2026-10-07 07:04:59 +00:00
Merge branch 'mrgext' into MixedI8
This commit is contained in:
+18
-18
@@ -8,13 +8,13 @@ FINCLUDES=$(FMFLAG)$(HERE) $(FMFLAG)$(MODDIR) $(FMFLAG)$(INCDIR) $(PSBLAS_INCLUD
|
||||
|
||||
|
||||
|
||||
DMPFOBJS=mld_daggrmat_nosmth_asb.o mld_daggrmat_smth_asb.o mld_daggrmat_minnrg_asb.o mld_daggrmat_biz_asb.o
|
||||
DMPFOBJS=
|
||||
|
||||
SMPFOBJS=mld_saggrmat_nosmth_asb.o mld_saggrmat_smth_asb.o mld_saggrmat_minnrg_asb.o mld_saggrmat_biz_asb.o
|
||||
SMPFOBJS=
|
||||
|
||||
ZMPFOBJS=mld_zaggrmat_nosmth_asb.o mld_zaggrmat_smth_asb.o mld_zaggrmat_minnrg_asb.o mld_zaggrmat_biz_asb.o
|
||||
ZMPFOBJS=
|
||||
|
||||
CMPFOBJS=mld_caggrmat_nosmth_asb.o mld_caggrmat_smth_asb.o mld_caggrmat_minnrg_asb.o mld_caggrmat_biz_asb.o
|
||||
CMPFOBJS=
|
||||
|
||||
|
||||
MPFOBJS=$(SMPFOBJS) $(DMPFOBJS) $(CMPFOBJS) $(ZMPFOBJS)
|
||||
@@ -24,27 +24,23 @@ MPCOBJS=mld_dslud_interface.o mld_zslud_interface.o
|
||||
|
||||
DINNEROBJS= mld_dmlprec_bld.o mld_dfile_prec_descr.o \
|
||||
mld_d_smoothers_bld.o mld_d_hierarchy_bld.o \
|
||||
mld_daggrmap_bld.o \
|
||||
mld_d_dec_map_bld.o mld_dmlprec_aply.o mld_daggrmat_asb.o \
|
||||
$(DMPFOBJS) mld_d_extprol_bld.o mld_d_lev_aggrmap_bld.o mld_d_lev_aggrmat_asb.o
|
||||
mld_dmlprec_aply.o \
|
||||
$(DMPFOBJS) mld_d_extprol_bld.o
|
||||
|
||||
SINNEROBJS= mld_smlprec_bld.o mld_sfile_prec_descr.o \
|
||||
mld_s_smoothers_bld.o mld_s_hierarchy_bld.o \
|
||||
mld_saggrmap_bld.o \
|
||||
mld_s_dec_map_bld.o mld_smlprec_aply.o mld_saggrmat_asb.o \
|
||||
$(SMPFOBJS) mld_s_extprol_bld.o mld_s_lev_aggrmap_bld.o mld_s_lev_aggrmat_asb.o
|
||||
mld_smlprec_aply.o \
|
||||
$(SMPFOBJS) mld_s_extprol_bld.o
|
||||
|
||||
ZINNEROBJS= mld_zmlprec_bld.o mld_zfile_prec_descr.o \
|
||||
mld_z_smoothers_bld.o mld_z_hierarchy_bld.o \
|
||||
mld_zaggrmap_bld.o \
|
||||
mld_z_dec_map_bld.o mld_zmlprec_aply.o mld_zaggrmat_asb.o \
|
||||
$(ZMPFOBJS) mld_z_extprol_bld.o mld_z_lev_aggrmap_bld.o mld_z_lev_aggrmat_asb.o
|
||||
mld_zmlprec_aply.o \
|
||||
$(ZMPFOBJS) mld_z_extprol_bld.o
|
||||
|
||||
CINNEROBJS= mld_cmlprec_bld.o mld_cfile_prec_descr.o \
|
||||
mld_c_smoothers_bld.o mld_c_hierarchy_bld.o \
|
||||
mld_caggrmap_bld.o \
|
||||
mld_c_dec_map_bld.o mld_cmlprec_aply.o mld_caggrmat_asb.o \
|
||||
$(CMPFOBJS) mld_c_extprol_bld.o mld_c_lev_aggrmap_bld.o mld_c_lev_aggrmat_asb.o
|
||||
mld_cmlprec_aply.o \
|
||||
$(CMPFOBJS) mld_c_extprol_bld.o
|
||||
|
||||
INNEROBJS= $(SINNEROBJS) $(DINNEROBJS) $(CINNEROBJS) $(ZINNEROBJS)
|
||||
|
||||
@@ -71,10 +67,12 @@ OBJS=$(F90OBJS) $(COBJS) $(MPCOBJS)
|
||||
|
||||
LIBNAME=libmld_prec.a
|
||||
|
||||
lib: $(OBJS) levd smoothd solvd
|
||||
lib: $(OBJS) aggrd levd smoothd solvd
|
||||
$(AR) $(HERE)/$(LIBNAME) $(OBJS)
|
||||
$(RANLIB) $(HERE)/$(LIBNAME)
|
||||
|
||||
aggrd:
|
||||
cd aggregator && $(MAKE)
|
||||
levd:
|
||||
cd level && $(MAKE)
|
||||
smoothd:
|
||||
@@ -89,9 +87,11 @@ mpobjs:
|
||||
veryclean: clean
|
||||
/bin/rm -f $(LIBNAME)
|
||||
|
||||
clean: solvclean smoothclean levclean
|
||||
clean: solvclean smoothclean levclean aggrclean
|
||||
/bin/rm -f $(OBJS) $(LOCAL_MODS)
|
||||
|
||||
aggrclean:
|
||||
cd aggregator && $(MAKE) clean
|
||||
levclean:
|
||||
cd level && $(MAKE) clean
|
||||
smoothclean:
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
include ../../../Make.inc
|
||||
LIBDIR=../../../lib
|
||||
INCDIR=../../../include
|
||||
MODDIR=../../../modules
|
||||
HERE=../..
|
||||
|
||||
FINCLUDES=$(FMFLAG)$(HERE) $(FMFLAG)$(MODDIR) $(FMFLAG)$(INCDIR) $(PSBLAS_INCLUDES)
|
||||
|
||||
#CINCLUDES= -I${SUPERLU_INCDIR} -I${HSL_INCDIR} -I${SPRAL_INCDIR} -I/home/users/pasqua/Ambra/BootCMatch/include -lBCM -L/home/users/pasqua/Ambra/BootCMatch/lib -lm
|
||||
|
||||
OBJS= \
|
||||
mld_s_dec_aggregator_mat_asb.o \
|
||||
mld_s_dec_aggregator_tprol.o \
|
||||
mld_s_symdec_aggregator_tprol.o \
|
||||
mld_s_map_to_tprol.o mld_s_soc1_map_bld.o mld_s_soc2_map_bld.o\
|
||||
mld_saggrmat_biz_asb.o mld_saggrmat_minnrg_asb.o\
|
||||
mld_saggrmat_nosmth_asb.o mld_saggrmat_smth_asb.o \
|
||||
mld_d_dec_aggregator_mat_asb.o \
|
||||
mld_d_dec_aggregator_tprol.o \
|
||||
mld_d_symdec_aggregator_tprol.o \
|
||||
mld_d_map_to_tprol.o mld_d_soc1_map_bld.o mld_d_soc2_map_bld.o\
|
||||
mld_daggrmat_biz_asb.o mld_daggrmat_minnrg_asb.o\
|
||||
mld_daggrmat_nosmth_asb.o mld_daggrmat_smth_asb.o \
|
||||
mld_c_dec_aggregator_mat_asb.o \
|
||||
mld_c_dec_aggregator_tprol.o \
|
||||
mld_c_symdec_aggregator_tprol.o \
|
||||
mld_c_map_to_tprol.o mld_c_soc1_map_bld.o mld_c_soc2_map_bld.o\
|
||||
mld_caggrmat_biz_asb.o mld_caggrmat_minnrg_asb.o\
|
||||
mld_caggrmat_nosmth_asb.o mld_caggrmat_smth_asb.o \
|
||||
mld_z_dec_aggregator_mat_asb.o \
|
||||
mld_z_dec_aggregator_tprol.o \
|
||||
mld_z_symdec_aggregator_tprol.o \
|
||||
mld_z_map_to_tprol.o mld_z_soc1_map_bld.o mld_z_soc2_map_bld.o\
|
||||
mld_zaggrmat_biz_asb.o mld_zaggrmat_minnrg_asb.o\
|
||||
mld_zaggrmat_nosmth_asb.o mld_zaggrmat_smth_asb.o
|
||||
|
||||
#mld_s_hybrid_aggregator_tprol.o \
|
||||
#mld_d_hybrid_aggregator_tprol.o \
|
||||
#mld_c_hybrid_aggregator_tprol.o \
|
||||
#mld_z_hybrid_aggregator_tprol.o \
|
||||
|
||||
#bootCMatch_interface.o mld_d_bcmatch_aggregator_tprol.o\
|
||||
#mld_d_bcmatch_map_to_tprol.o mld_d_bcmatch_aggregator_mat_asb.o \
|
||||
|
||||
|
||||
LIBNAME=libmld_prec.a
|
||||
|
||||
lib: $(OBJS)
|
||||
$(AR) $(HERE)/$(LIBNAME) $(OBJS)
|
||||
$(RANLIB) $(HERE)/$(LIBNAME)
|
||||
|
||||
mpobjs:
|
||||
(make $(MPFOBJS) F90="$(MPF90)" F90COPT="$(F90COPT)")
|
||||
(make $(MPCOBJS) CC="$(MPCC)" CCOPT="$(CCOPT)")
|
||||
|
||||
veryclean: clean
|
||||
/bin/rm -f $(LIBNAME)
|
||||
|
||||
clean:
|
||||
/bin/rm -f $(OBJS) $(LOCAL_MODS)
|
||||
+59
-41
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
!
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
@@ -35,12 +35,20 @@
|
||||
! POSSIBILITY OF SUCH DAMAGE.
|
||||
!
|
||||
!
|
||||
! File: mld_caggrmat_asb.f90
|
||||
! File: mld_c_dec_aggregator_mat_asb.f90
|
||||
!
|
||||
! Subroutine: mld_caggrmat_asb
|
||||
! Subroutine: mld_c_dec_aggregator_mat_asb
|
||||
! Version: complex
|
||||
!
|
||||
! This routine builds a coarse-level matrix A_C from a fine-level matrix A
|
||||
! This routine builds the matrix associated to the current level of the
|
||||
! multilevel preconditioner from the matrix associated to the previous level,
|
||||
! by using the user-specified aggregation technique (therefore, it also builds the
|
||||
! prolongation and restriction operators mapping the current level to the
|
||||
! previous one and vice versa).
|
||||
! The current level is regarded as the coarse one, while the previous as
|
||||
! the fine one. This is in agreement with the fact that the routine is called,
|
||||
! by mld_mlprec_bld, only on levels >=2.
|
||||
! The coarse-level matrix A_C is built from a fine-level matrix A
|
||||
! by using the Galerkin approach, i.e.
|
||||
!
|
||||
! A_C = P_C^T A P_C,
|
||||
@@ -50,7 +58,7 @@
|
||||
! A mapping from the nodes of the adjacency graph of A to the nodes of the
|
||||
! adjacency graph of A_C has been computed by the mld_aggrmap_bld subroutine.
|
||||
! The prolongator P_C is built here from this mapping, according to the
|
||||
! value of p%iprcparm(mld_aggr_prol_), specified by the user through
|
||||
! value of p%iprcparm(mld_aggr_kind_), specified by the user through
|
||||
! mld_cprecinit and mld_zprecset.
|
||||
! On output from this routine the entries of AC, op_prol, op_restr
|
||||
! are still in "global numbering" mode; this is fixed in the calling routine
|
||||
@@ -64,13 +72,13 @@
|
||||
! 4. minimum energy
|
||||
! 1. The non-smoothed aggregation uses as prolongator the piecewise constant
|
||||
! interpolation operator corresponding to the fine-to-coarse level mapping built
|
||||
! by mld_aggrmap_bld. This is called tentative prolongator.
|
||||
! by p%aggr%bld_tprol. This is called tentative prolongator.
|
||||
! 2. The smoothed aggregation uses as prolongator the operator obtained by applying
|
||||
! a damped Jacobi smoother to the tentative prolongator.
|
||||
! 3. The "bizarre" aggregation uses a prolongator proposed by the authors of MLD2P4.
|
||||
! This prolongator still requires a deep analysis and testing and its use is
|
||||
! not recommended.
|
||||
! 4. Minimum energy aggregation: ADD REFERENCE.
|
||||
! 4. Minimum energy aggregation
|
||||
!
|
||||
! For more details see
|
||||
! M. Brezina and P. Vanek, A black-box iterative solver based on a two-level
|
||||
@@ -78,24 +86,28 @@
|
||||
! P. D'Ambra, D. di Serafino and S. Filippone, On the development of PSBLAS-based
|
||||
! parallel two-level Schwarz preconditioners, Appl. Num. Math., 57 (2007),
|
||||
! 1181-1196.
|
||||
! M. Sala, R. Tuminaro: A new Petrov-Galerkin smoothed aggregation preconditioner
|
||||
! for nonsymmetric linear systems, SIAM J. Sci. Comput., 31(1):143-166 (2008)
|
||||
!
|
||||
!
|
||||
! The main structure is:
|
||||
! 1. Perform sanity checks;
|
||||
! 2. Compute prolongator/restrictor/AC
|
||||
!
|
||||
!
|
||||
! Arguments:
|
||||
! ag - type(mld_c_dec_aggregator_type), input/output.
|
||||
! The aggregator object
|
||||
! parms - type(mld_sml_parms), input
|
||||
! The aggregation parameters
|
||||
! a - type(psb_cspmat_type), input.
|
||||
! The sparse matrix structure containing the local part of
|
||||
! the fine-level matrix.
|
||||
! desc_a - type(psb_desc_type), input.
|
||||
! The communication descriptor of the fine-level matrix.
|
||||
! p - type(mld_c_onelev_type), input/output.
|
||||
! The 'one-level' data structure that will contain the local
|
||||
! part of the matrix to be built as well as the information
|
||||
! concerning the prolongator and its transpose.
|
||||
! parms - type(mld_sml_parms), input
|
||||
! Parameters controlling the choice of algorithm
|
||||
! ac - type(psb_cspmat_type), output
|
||||
! The coarse matrix on output
|
||||
!
|
||||
! ilaggr - integer, dimension(:), input
|
||||
! The mapping between the row indices of the coarse-level
|
||||
! matrix and the row indices of the fine-level matrix.
|
||||
@@ -106,6 +118,9 @@
|
||||
! the various processes do not overlap.
|
||||
! nlaggr - integer, dimension(:) input
|
||||
! nlaggr(i) contains the aggregates held by process i.
|
||||
! ac - type(psb_cspmat_type), output
|
||||
! The coarse matrix on output
|
||||
!
|
||||
! op_prol - type(psb_cspmat_type), input/output
|
||||
! The tentative prolongator on input, the computed prolongator on output
|
||||
!
|
||||
@@ -114,43 +129,45 @@
|
||||
!
|
||||
! info - integer, output.
|
||||
! Error code.
|
||||
!
|
||||
subroutine mld_caggrmat_asb(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info)
|
||||
|
||||
!
|
||||
subroutine mld_c_dec_aggregator_mat_asb(ag,parms,a,desc_a,ilaggr,nlaggr,ac,op_prol,op_restr,info)
|
||||
use psb_base_mod
|
||||
use mld_base_prec_type
|
||||
use mld_c_inner_mod, mld_protect_name => mld_caggrmat_asb
|
||||
|
||||
use mld_c_prec_type, mld_protect_name => mld_c_dec_aggregator_mat_asb
|
||||
use mld_c_inner_mod
|
||||
implicit none
|
||||
|
||||
class(mld_c_dec_aggregator_type), target, intent(inout) :: ag
|
||||
type(mld_sml_parms), intent(inout) :: parms
|
||||
type(psb_cspmat_type), intent(in) :: a
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(inout) :: ilaggr(:), nlaggr(:)
|
||||
type(psb_cspmat_type), intent(inout) :: op_prol
|
||||
type(psb_cspmat_type), intent(out) :: ac,op_restr
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
! Arguments
|
||||
type(psb_cspmat_type), intent(in) :: a
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(inout) :: ilaggr(:), nlaggr(:)
|
||||
type(mld_sml_parms), intent(inout) :: parms
|
||||
type(psb_cspmat_type), intent(inout) :: ac, op_prol,op_restr
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
! Local variables
|
||||
! Local variables
|
||||
character(len=20) :: name
|
||||
integer(psb_mpik_) :: ictxt, np, me
|
||||
type(psb_c_coo_sparse_mat) :: acoo, bcoo
|
||||
type(psb_c_csr_sparse_mat) :: acsr1
|
||||
integer(psb_ipk_) :: nzl,ntaggr, err_act
|
||||
integer(psb_ipk_) :: nzl,ntaggr
|
||||
integer(psb_ipk_) :: err_act
|
||||
integer(psb_ipk_) :: debug_level, debug_unit
|
||||
integer(psb_ipk_) :: ictxt,np,me
|
||||
character(len=20) :: name
|
||||
|
||||
name='mld_aggrmat_asb'
|
||||
if(psb_get_errstatus().ne.0) return
|
||||
info=psb_success_
|
||||
name='mld_c_dec_aggregator_mat_asb'
|
||||
if (psb_get_errstatus().ne.0) return
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
|
||||
|
||||
info = psb_success_
|
||||
ictxt = desc_a%get_context()
|
||||
call psb_info(ictxt,me,np)
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
|
||||
!
|
||||
! Build the coarse-level matrix from the fine-level one, starting from
|
||||
! the mapping defined by mld_aggrmap_bld and applying the aggregation
|
||||
! algorithm specified by
|
||||
!
|
||||
select case (parms%aggr_prol)
|
||||
case (mld_no_smooth_)
|
||||
|
||||
@@ -183,11 +200,12 @@ subroutine mld_caggrmat_asb(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,inf
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine mld_caggrmat_asb
|
||||
|
||||
end subroutine mld_c_dec_aggregator_mat_asb
|
||||
+32
-61
@@ -1,7 +1,6 @@
|
||||
|
||||
!
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
@@ -36,15 +35,15 @@
|
||||
! POSSIBILITY OF SUCH DAMAGE.
|
||||
!
|
||||
!
|
||||
! File: mld_c_lev_aggrmap_bld.f90
|
||||
! File: mld_c_dec_aggregator_tprol.f90
|
||||
!
|
||||
! Subroutine: mld_c_lev_aggrmap_bld
|
||||
! Subroutine: mld_c_dec_aggregator_tprol
|
||||
! Version: complex
|
||||
!
|
||||
! This routine is just an interface to aggrmap_bld where the real work is performed.
|
||||
! It takes care of some consistency checking though.
|
||||
!
|
||||
! See mld_caggrmap_bld for constraints on input/oput arguments.
|
||||
! This routine is mainly an interface to map_bld where the real work is performed.
|
||||
! It takes care of some consistency checking, and calls map_to_tprol, which is
|
||||
! refactored and shared among all the aggregation methods that produce a simple
|
||||
! integer mapping.
|
||||
!
|
||||
!
|
||||
! Arguments:
|
||||
@@ -73,31 +72,27 @@
|
||||
! info - integer, output.
|
||||
! Error code.
|
||||
!
|
||||
subroutine mld_c_lev_aggrmap_bld(p,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
|
||||
subroutine mld_c_dec_aggregator_build_tprol(ag,parms,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
use psb_base_mod
|
||||
use mld_base_prec_type
|
||||
use mld_c_inner_mod, mld_protect_name => mld_c_lev_aggrmap_bld
|
||||
|
||||
use mld_c_prec_type, mld_protect_name => mld_c_dec_aggregator_build_tprol
|
||||
use mld_c_inner_mod
|
||||
implicit none
|
||||
|
||||
! Arguments
|
||||
type(mld_c_onelev_type), intent(inout), target :: p
|
||||
type(psb_cspmat_type), intent(in) :: a
|
||||
class(mld_c_dec_aggregator_type), target, intent(inout) :: ag
|
||||
type(mld_sml_parms), intent(inout) :: parms
|
||||
type(psb_cspmat_type), intent(in) :: a
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
|
||||
type(psb_cspmat_type), intent(out) :: op_prol
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
|
||||
! Local variables
|
||||
character(len=20) :: name
|
||||
integer(psb_mpk_) :: ictxt, np, me
|
||||
integer(psb_ipk_) :: err_act
|
||||
integer(psb_ipk_) :: nzl, ntaggr
|
||||
character(len=20) :: name
|
||||
integer(psb_mpik_) :: ictxt, np, me
|
||||
integer(psb_ipk_) :: err_act
|
||||
integer(psb_ipk_) :: ntaggr
|
||||
integer(psb_ipk_) :: debug_level, debug_unit
|
||||
|
||||
name='mld_c_lev_aggrmap_bld'
|
||||
name='mld_c_dec_aggregator_tprol'
|
||||
if (psb_get_errstatus().ne.0) return
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
@@ -106,52 +101,28 @@ subroutine mld_c_lev_aggrmap_bld(p,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
ictxt = desc_a%get_context()
|
||||
call psb_info(ictxt,me,np)
|
||||
|
||||
call mld_check_def(p%parms%ml_cycle,'Multilevel cycle',&
|
||||
call mld_check_def(parms%ml_cycle,'Multilevel cycle',&
|
||||
& mld_mult_ml_,is_legal_ml_cycle)
|
||||
call mld_check_def(p%parms%par_aggr_alg,'Aggregation',&
|
||||
call mld_check_def(parms%par_aggr_alg,'Aggregation',&
|
||||
& mld_dec_aggr_,is_legal_ml_par_aggr_alg)
|
||||
call mld_check_def(p%parms%aggr_ord,'Ordering',&
|
||||
call mld_check_def(parms%aggr_ord,'Ordering',&
|
||||
& mld_aggr_ord_nat_,is_legal_ml_aggr_ord)
|
||||
call mld_check_def(p%parms%aggr_thresh,'Aggr_Thresh',szero,is_legal_s_aggr_thrs)
|
||||
call mld_check_def(parms%aggr_thresh,'Aggr_Thresh',szero,is_legal_s_aggr_thrs)
|
||||
|
||||
select case(p%parms%par_aggr_alg)
|
||||
case (mld_dec_aggr_, mld_sym_dec_aggr_)
|
||||
|
||||
!
|
||||
! Build a mapping between the row indices of the fine-level matrix
|
||||
! and the row indices of the coarse-level matrix, according to a decoupled
|
||||
! aggregation algorithm. This also defines a tentative prolongator from
|
||||
! the coarse to the fine level.
|
||||
!
|
||||
call mld_aggrmap_bld(p%parms%par_aggr_alg,p%parms%aggr_ord,p%parms%aggr_thresh,&
|
||||
& a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='mld_aggrmap_bld')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
case (mld_bcmatch_aggr_)
|
||||
write(0,*) 'Matching is not implemented yet '
|
||||
info = -1111
|
||||
call psb_errpush(psb_err_input_value_invalid_i_,name,&
|
||||
& i_err=(/ione,p%parms%par_aggr_alg,izero,izero,izero/))
|
||||
call ag%map_bld(parms%aggr_ord,parms%aggr_thresh,a,desc_a,nlaggr,ilaggr,info)
|
||||
|
||||
if (info==psb_success_) call mld_map_to_tprol(desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
call psb_errpush(info,name,a_err='map_bld/map_to_tprol')
|
||||
goto 9999
|
||||
|
||||
case default
|
||||
|
||||
info = -1
|
||||
call psb_errpush(psb_err_input_value_invalid_i_,name,&
|
||||
& i_err=(/ione,p%parms%par_aggr_alg,izero,izero,izero/))
|
||||
goto 9999
|
||||
|
||||
end select
|
||||
|
||||
endif
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
|
||||
end subroutine mld_c_lev_aggrmap_bld
|
||||
|
||||
end subroutine mld_c_dec_aggregator_build_tprol
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
@@ -9,7 +9,7 @@
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Daniela di Serafino
|
||||
!
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions
|
||||
! are met:
|
||||
@@ -35,15 +35,17 @@
|
||||
! POSSIBILITY OF SUCH DAMAGE.
|
||||
!
|
||||
!
|
||||
! File: mld_caggrmap_bld.f90
|
||||
! File: mld_c_map_to_tprol.f90
|
||||
!
|
||||
! Subroutine: mld_caggrmap_bld
|
||||
! Subroutine: mld_c_map_to_tprol
|
||||
! Version: complex
|
||||
!
|
||||
! This routine builds a mapping from the row indices of the fine-level matrix
|
||||
! to the row indices of the coarse-level matrix, according to a decoupled
|
||||
! aggregation algorithm. This mapping will be used by mld_aggrmat_asb to
|
||||
! build the coarse-level matrix.
|
||||
! This routine uses a mapping from the row indices of the fine-level matrix
|
||||
! to the row indices of the coarse-level matrix to build a tentative
|
||||
! prolongator, i.e. a piecewise constant operator.
|
||||
! This is later used to build the final operator; the code has been refactored here
|
||||
! to be shared among all the methods that provide the tentative prolongator
|
||||
! through a simple integer mapping.
|
||||
!
|
||||
! The aggregation algorithm is a parallel version of that described in
|
||||
! * M. Brezina and P. Vanek, A black-box iterative solver based on a
|
||||
@@ -83,28 +85,21 @@
|
||||
! info - integer, output.
|
||||
! Error code.
|
||||
!
|
||||
subroutine mld_caggrmap_bld(aggr_type,iorder,theta,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
subroutine mld_c_map_to_tprol(desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
|
||||
use psb_base_mod
|
||||
use mld_base_prec_type
|
||||
use mld_c_inner_mod, mld_protect_name => mld_caggrmap_bld
|
||||
use mld_c_inner_mod, mld_protect_name => mld_c_map_to_tprol
|
||||
|
||||
implicit none
|
||||
|
||||
! Arguments
|
||||
integer(psb_ipk_), intent(in) :: iorder
|
||||
integer(psb_ipk_), intent(in) :: aggr_type
|
||||
real(psb_spk_), intent(in) :: theta
|
||||
type(psb_cspmat_type), intent(in) :: a
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
|
||||
integer(psb_ipk_), allocatable, intent(inout) :: ilaggr(:),nlaggr(:)
|
||||
type(psb_cspmat_type), intent(out) :: op_prol
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_), allocatable :: ils(:), neigh(:)
|
||||
integer(psb_ipk_) :: icnt,nlp,k,n,ia,isz,nr, naggr,i,j,m,naggrm1, naggrp1, ntaggr
|
||||
type(psb_cspmat_type) :: atmp, atrans
|
||||
type(psb_c_coo_sparse_mat) :: tmpcoo
|
||||
integer(psb_ipk_) :: debug_level, debug_unit,err_act
|
||||
integer(psb_ipk_) :: ictxt,np,me
|
||||
@@ -113,7 +108,7 @@ subroutine mld_caggrmap_bld(aggr_type,iorder,theta,a,desc_a,ilaggr,nlaggr,op_pro
|
||||
|
||||
if(psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
name = 'mld_aggrmap_bld'
|
||||
name = 'mld_map_to_tprol'
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
@@ -123,40 +118,6 @@ subroutine mld_caggrmap_bld(aggr_type,iorder,theta,a,desc_a,ilaggr,nlaggr,op_pro
|
||||
nrow = desc_a%get_local_rows()
|
||||
ncol = desc_a%get_local_cols()
|
||||
|
||||
select case (aggr_type)
|
||||
case (mld_dec_aggr_)
|
||||
call mld_dec_map_bld(iorder,theta,a,desc_a,nlaggr,ilaggr,info)
|
||||
|
||||
case (mld_sym_dec_aggr_)
|
||||
nr = a%get_nrows()
|
||||
call a%csclip(atmp,info,imax=nr,jmax=nr,&
|
||||
& rscale=.false.,cscale=.false.)
|
||||
call atmp%set_nrows(nr)
|
||||
call atmp%set_ncols(nr)
|
||||
if (info == psb_success_) call atmp%transp(atrans)
|
||||
if (info == psb_success_) call atrans%cscnv(info,type='COO')
|
||||
if (info == psb_success_) call psb_rwextd(nr,atmp,info,b=atrans,rowscale=.false.)
|
||||
call atmp%set_nrows(nr)
|
||||
call atmp%set_ncols(nr)
|
||||
if (info == psb_success_) call atrans%free()
|
||||
if (info == psb_success_) call atmp%cscnv(info,type='CSR')
|
||||
if (info == psb_success_) call mld_dec_map_bld(iorder,theta,atmp,desc_a,nlaggr,ilaggr,info)
|
||||
if (info == psb_success_) call atmp%free()
|
||||
|
||||
case default
|
||||
|
||||
info = -1
|
||||
call psb_errpush(psb_err_input_value_invalid_i_,name,&
|
||||
& i_err=(/ione,aggr_type,izero,izero,izero/))
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name,a_err='dec_map_bld')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
naggr = nlaggr(me+1)
|
||||
ntaggr = sum(nlaggr)
|
||||
naggrm1 = sum(nlaggr(1:me))
|
||||
@@ -186,4 +147,4 @@ subroutine mld_caggrmap_bld(aggr_type,iorder,theta,a,desc_a,ilaggr,nlaggr,op_pro
|
||||
|
||||
return
|
||||
|
||||
end subroutine mld_caggrmap_bld
|
||||
end subroutine mld_c_map_to_tprol
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
@@ -36,13 +36,13 @@
|
||||
!
|
||||
!
|
||||
!
|
||||
! File: mld_c_dec_map__bld.f90
|
||||
! File: mld_c_soc1_map__bld.f90
|
||||
!
|
||||
! Subroutine: mld_c_dec_map_bld
|
||||
! Subroutine: mld_c_soc1_map_bld
|
||||
! Version: complex
|
||||
!
|
||||
! This routine builds the tentative prolongator based on the
|
||||
! decoupled aggregation algorithm presented in
|
||||
! strength of connection aggregation algorithm presented in
|
||||
!
|
||||
! M. Brezina and P. Vanek, A black-box iterative solver based on a
|
||||
! two-level Schwarz method, Computing, 63 (1999), 233-263.
|
||||
@@ -67,11 +67,11 @@
|
||||
!
|
||||
!
|
||||
!
|
||||
subroutine mld_c_dec_map_bld(iorder,theta,a,desc_a,nlaggr,ilaggr,info)
|
||||
subroutine mld_c_soc1_map_bld(iorder,theta,a,desc_a,nlaggr,ilaggr,info)
|
||||
|
||||
use psb_base_mod
|
||||
use mld_base_prec_type
|
||||
use mld_c_inner_mod, mld_protect_name => mld_c_dec_map_bld
|
||||
use mld_c_inner_mod!, mld_protect_name => mld_c_soc1_map_bld
|
||||
|
||||
implicit none
|
||||
|
||||
@@ -98,7 +98,7 @@ subroutine mld_c_dec_map_bld(iorder,theta,a,desc_a,nlaggr,ilaggr,info)
|
||||
|
||||
if (psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
name = 'mld_dec_map_bld'
|
||||
name = 'mld_soc1_map_bld'
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
@@ -247,7 +247,7 @@ subroutine mld_c_dec_map_bld(iorder,theta,a,desc_a,nlaggr,ilaggr,info)
|
||||
! Find its strongly connected neighbourhood not
|
||||
! already aggregated, and make it into a new aggregate.
|
||||
!
|
||||
cpling = dzero
|
||||
cpling = szero
|
||||
ip = 0
|
||||
do k=1, nz
|
||||
j = icol(k)
|
||||
@@ -318,5 +318,5 @@ subroutine mld_c_dec_map_bld(iorder,theta,a,desc_a,nlaggr,ilaggr,info)
|
||||
|
||||
return
|
||||
|
||||
end subroutine mld_c_dec_map_bld
|
||||
end subroutine mld_c_soc1_map_bld
|
||||
|
||||
@@ -0,0 +1,330 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
! (C) Copyright 2008-2018
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Daniela di Serafino
|
||||
!
|
||||
! 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.
|
||||
! 3. The name of the MLD2P4 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
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE MLD2P4 GROUP OR ITS CONTRIBUTORS
|
||||
! 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.
|
||||
!
|
||||
!
|
||||
!
|
||||
! File: mld_c_soc2_map__bld.f90
|
||||
!
|
||||
! Subroutine: mld_c_soc2_map_bld
|
||||
! Version: complex
|
||||
!
|
||||
! The aggregator object hosts the aggregation method for building
|
||||
! the multilevel hierarchy. This variant is based on the method
|
||||
! presented in
|
||||
!
|
||||
! S. Gratton, P. Henon, P. Jiranek and X. Vasseur:
|
||||
! Reducing complexity of algebraic multigrid by aggregation
|
||||
! Numerical Lin. Algebra with Applications, 2016, 23:501-518
|
||||
!
|
||||
! Note: upon exit
|
||||
!
|
||||
! Arguments:
|
||||
! a - type(psb_cspmat_type).
|
||||
! The sparse matrix structure containing the local part of the
|
||||
! matrix to be preconditioned.
|
||||
! desc_a - type(psb_desc_type), input.
|
||||
! The communication descriptor of a.
|
||||
! p - type(mld_cprec_type), input/output.
|
||||
! The preconditioner data structure; upon exit it contains
|
||||
! the multilevel hierarchy of prolongators, restrictors
|
||||
! and coarse matrices.
|
||||
! info - integer, output.
|
||||
! Error code.
|
||||
!
|
||||
!
|
||||
!
|
||||
subroutine mld_c_soc2_map_bld(iorder,theta,a,desc_a,nlaggr,ilaggr,info)
|
||||
|
||||
use psb_base_mod
|
||||
use mld_base_prec_type
|
||||
use mld_c_inner_mod!, mld_protect_name => mld_c_soc2_map_bld
|
||||
|
||||
implicit none
|
||||
|
||||
! Arguments
|
||||
integer(psb_ipk_), intent(in) :: iorder
|
||||
type(psb_cspmat_type), intent(in) :: a
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
real(psb_spk_), intent(in) :: theta
|
||||
integer(psb_ipk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_), allocatable :: ils(:), neigh(:), irow(:), icol(:),&
|
||||
& ideg(:), idxs(:), tmpaggr(:)
|
||||
complex(psb_spk_), allocatable :: val(:), diag(:)
|
||||
integer(psb_ipk_) :: icnt,nlp,k,n,ia,isz,nr,nc,naggr,i,j,m, nz, ilg, ii, ip, ip1,nzcnt
|
||||
type(psb_c_csr_sparse_mat) :: acsr, muij, s_neigh
|
||||
type(psb_c_coo_sparse_mat) :: s_neigh_coo
|
||||
real(psb_spk_) :: cpling, tcl
|
||||
logical :: disjoint
|
||||
integer(psb_ipk_) :: debug_level, debug_unit,err_act
|
||||
integer(psb_ipk_) :: ictxt,np,me
|
||||
integer(psb_ipk_) :: nrow, ncol, n_ne
|
||||
character(len=20) :: name, ch_err
|
||||
|
||||
if (psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
name = 'mld_soc2_map_bld'
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
!
|
||||
ictxt=desc_a%get_context()
|
||||
call psb_info(ictxt,me,np)
|
||||
nrow = desc_a%get_local_rows()
|
||||
ncol = desc_a%get_local_cols()
|
||||
|
||||
nr = a%get_nrows()
|
||||
nc = a%get_ncols()
|
||||
allocate(ilaggr(nr),neigh(nr),ideg(nr),idxs(nr),icol(nr),stat=info)
|
||||
if(info /= psb_success_) then
|
||||
info=psb_err_alloc_request_
|
||||
call psb_errpush(info,name,i_err=(/2*nr,izero,izero,izero,izero/),&
|
||||
& a_err='integer')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
diag = a%get_diag(info)
|
||||
if(info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
call psb_errpush(info,name,a_err='psb_sp_getdiag')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
!
|
||||
! Phase zero: compute muij
|
||||
!
|
||||
call a%cp_to(muij)
|
||||
do i=1, nr
|
||||
do k=muij%irp(i),muij%irp(i+1)-1
|
||||
j = muij%ja(k)
|
||||
if (j<= nr) muij%val(k) = abs(muij%val(k))/sqrt(abs(diag(i)*diag(j)))
|
||||
end do
|
||||
end do
|
||||
!write(*,*) 'murows/cols ',maxval(mu_rows),maxval(mu_cols)
|
||||
!
|
||||
! Compute the 1-neigbour; mark strong links with +1, weak links with -1
|
||||
!
|
||||
call s_neigh_coo%allocate(nr,nr,muij%get_nzeros())
|
||||
ip = 0
|
||||
do i=1, nr
|
||||
do k=muij%irp(i),muij%irp(i+1)-1
|
||||
j = muij%ja(k)
|
||||
if (j<=nr) then
|
||||
ip = ip + 1
|
||||
s_neigh_coo%ia(ip) = i
|
||||
s_neigh_coo%ja(ip) = j
|
||||
if (real(muij%val(k)) >= theta) then
|
||||
s_neigh_coo%val(ip) = sone
|
||||
else
|
||||
s_neigh_coo%val(ip) = -sone
|
||||
end if
|
||||
end if
|
||||
end do
|
||||
end do
|
||||
!write(*,*) 'S_NEIGH: ',nr,ip
|
||||
call s_neigh_coo%set_nzeros(ip)
|
||||
call s_neigh%mv_from_coo(s_neigh_coo,info)
|
||||
|
||||
if (iorder == mld_aggr_ord_nat_) then
|
||||
do i=1, nr
|
||||
ilaggr(i) = -(nr+1)
|
||||
idxs(i) = i
|
||||
end do
|
||||
else
|
||||
do i=1, nr
|
||||
ilaggr(i) = -(nr+1)
|
||||
ideg(i) = muij%irp(i+1) - muij%irp(i)
|
||||
end do
|
||||
call psb_msort(ideg,ix=idxs,dir=psb_sort_down_)
|
||||
end if
|
||||
|
||||
|
||||
!
|
||||
! Phase one: Start with disjoint groups.
|
||||
!
|
||||
naggr = 0
|
||||
icnt = 0
|
||||
step1: do ii=1, nr
|
||||
i = idxs(ii)
|
||||
|
||||
if (ilaggr(i) == -(nr+1)) then
|
||||
!
|
||||
! Get the 1-neighbourhood of I
|
||||
!
|
||||
ip1 = s_neigh%irp(i)
|
||||
nz = s_neigh%irp(i+1)-ip1
|
||||
!
|
||||
! If the neighbourhood only contains I, skip it
|
||||
!
|
||||
if (nz ==0) then
|
||||
ilaggr(i) = 0
|
||||
cycle step1
|
||||
end if
|
||||
if ((nz==1).and.(s_neigh%ja(ip1)==i)) then
|
||||
ilaggr(i) = 0
|
||||
cycle step1
|
||||
end if
|
||||
!
|
||||
! If the whole strongly coupled neighborhood of I is
|
||||
! as yet unconnected, turn it into the next aggregate.
|
||||
!
|
||||
nzcnt = count(real(s_neigh%val(ip1:ip1+nz-1)) > 0)
|
||||
icol(1:nzcnt) = pack(s_neigh%ja(ip1:ip1+nz-1),(real(s_neigh%val(ip1:ip1+nz-1)) > 0))
|
||||
disjoint = all(ilaggr(icol(1:nzcnt)) == -(nr+1))
|
||||
if (disjoint) then
|
||||
icnt = icnt + 1
|
||||
naggr = naggr + 1
|
||||
do k=1, nzcnt
|
||||
ilaggr(icol(k)) = naggr
|
||||
end do
|
||||
ilaggr(i) = naggr
|
||||
end if
|
||||
endif
|
||||
enddo step1
|
||||
|
||||
if (debug_level >= psb_debug_outer_) then
|
||||
write(debug_unit,*) me,' ',trim(name),&
|
||||
& ' Check 1:',count(ilaggr == -(nr+1))
|
||||
end if
|
||||
|
||||
!
|
||||
! Phase two: join the neighbours
|
||||
!
|
||||
tmpaggr = ilaggr
|
||||
step2: do ii=1,nr
|
||||
i = idxs(ii)
|
||||
|
||||
if (ilaggr(i) == -(nr+1)) then
|
||||
!
|
||||
! Find the most strongly connected neighbour that is
|
||||
! already aggregated, if any, and join its aggregate
|
||||
!
|
||||
cpling = szero
|
||||
ip = 0
|
||||
do k=s_neigh%irp(i), s_neigh%irp(i+1)-1
|
||||
j = s_neigh%ja(k)
|
||||
if ((1<=j).and.(j<=nr)) then
|
||||
if ( (tmpaggr(j) > 0).and. (real(muij%val(k)) > cpling)&
|
||||
& .and.(real(s_neigh%val(k))>0)) then
|
||||
ip = k
|
||||
cpling = muij%val(k)
|
||||
end if
|
||||
end if
|
||||
enddo
|
||||
if (ip > 0) then
|
||||
ilaggr(i) = ilaggr(s_neigh%ja(ip))
|
||||
end if
|
||||
end if
|
||||
end do step2
|
||||
|
||||
|
||||
!
|
||||
! Phase three: sweep over leftovers, if any
|
||||
!
|
||||
step3: do ii=1,nr
|
||||
i = idxs(ii)
|
||||
|
||||
if (ilaggr(i) < 0) then
|
||||
!
|
||||
! Find its strongly connected neighbourhood not
|
||||
! already aggregated, and make it into a new aggregate.
|
||||
!
|
||||
ip = 0
|
||||
do k=s_neigh%irp(i), s_neigh%irp(i+1)-1
|
||||
j = s_neigh%ja(k)
|
||||
if ((1<=j).and.(j<=nr)) then
|
||||
if (ilaggr(j) < 0) then
|
||||
ip = ip + 1
|
||||
icol(ip) = j
|
||||
end if
|
||||
end if
|
||||
enddo
|
||||
if (ip > 0) then
|
||||
icnt = icnt + 1
|
||||
naggr = naggr + 1
|
||||
ilaggr(i) = naggr
|
||||
do k=1, ip
|
||||
ilaggr(icol(k)) = naggr
|
||||
end do
|
||||
end if
|
||||
end if
|
||||
end do step3
|
||||
|
||||
|
||||
if (count(ilaggr<0) >0) then
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name,a_err='Fatal error: some leftovers')
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
if (naggr > ncol) then
|
||||
write(0,*) name,'Error : naggr > ncol',naggr,ncol
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name,a_err='Fatal error: naggr>ncol')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
call psb_realloc(ncol,ilaggr,info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
ch_err='psb_realloc'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
allocate(nlaggr(np),stat=info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_alloc_request_
|
||||
call psb_errpush(info,name,i_err=(/np,izero,izero,izero,izero/),&
|
||||
& a_err='integer')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
nlaggr(:) = 0
|
||||
nlaggr(me+1) = naggr
|
||||
call psb_sum(ictxt,nlaggr(1:np))
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine mld_c_soc2_map_bld
|
||||
|
||||
@@ -0,0 +1,146 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
! (C) Copyright 2008-2018
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Daniela di Serafino
|
||||
!
|
||||
! 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.
|
||||
! 3. The name of the MLD2P4 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
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE MLD2P4 GROUP OR ITS CONTRIBUTORS
|
||||
! 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.
|
||||
!
|
||||
!
|
||||
! File: mld_c_symdec_aggregator_tprol.f90
|
||||
!
|
||||
! Subroutine: mld_c_symdec_aggregator_tprol
|
||||
! Version: complex
|
||||
!
|
||||
!
|
||||
! This routine is mainly an interface to map_bld where the real work is performed.
|
||||
! It takes care of some consistency checking, and calls map_to_tprol, which is
|
||||
! refactored and shared among all the aggregation methods that produce a simple
|
||||
! integer mapping.
|
||||
!
|
||||
!
|
||||
!
|
||||
! Arguments:
|
||||
! p - type(mld_c_onelev_type), input/output.
|
||||
! The 'one-level' data structure containing the control
|
||||
! parameters and (eventually) coarse matrix and prolongator/restrictors.
|
||||
!
|
||||
! a - type(psb_cspmat_type).
|
||||
! The sparse matrix structure containing the local part of the
|
||||
! fine-level matrix.
|
||||
! desc_a - type(psb_desc_type), input.
|
||||
! The communication descriptor of a.
|
||||
! ilaggr - integer, dimension(:), allocatable, output
|
||||
! The mapping between the row indices of the coarse-level
|
||||
! matrix and the row indices of the fine-level matrix.
|
||||
! ilaggr(i)=j means that node i in the adjacency graph
|
||||
! of the fine-level matrix is mapped onto node j in the
|
||||
! adjacency graph of the coarse-level matrix. Note that on exit the indices
|
||||
! will be shifted so as to make sure the ranges on the various processes do not
|
||||
! overlap.
|
||||
! nlaggr - integer, dimension(:), allocatable, output
|
||||
! nlaggr(i) contains the aggregates held by process i.
|
||||
! op_prol - type(psb_cspmat_type), output
|
||||
! The tentative prolongator, based on ilaggr.
|
||||
!
|
||||
! info - integer, output.
|
||||
! Error code.
|
||||
!
|
||||
subroutine mld_c_symdec_aggregator_build_tprol(ag,parms,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
use psb_base_mod
|
||||
use mld_c_prec_type
|
||||
use mld_c_symdec_aggregator_mod, mld_protect_name => mld_c_symdec_aggregator_build_tprol
|
||||
use mld_c_inner_mod
|
||||
implicit none
|
||||
class(mld_c_symdec_aggregator_type), target, intent(inout) :: ag
|
||||
type(mld_sml_parms), intent(inout) :: parms
|
||||
type(psb_cspmat_type), intent(in) :: a
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
|
||||
type(psb_cspmat_type), intent(out) :: op_prol
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
! Local variables
|
||||
type(psb_cspmat_type) :: atmp, atrans
|
||||
character(len=20) :: name
|
||||
integer(psb_mpik_) :: ictxt, np, me
|
||||
integer(psb_ipk_) :: err_act
|
||||
integer(psb_ipk_) :: ntaggr, nr
|
||||
integer(psb_ipk_) :: debug_level, debug_unit
|
||||
|
||||
name='mld_c_symdec_aggregator_tprol'
|
||||
if (psb_get_errstatus().ne.0) return
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
info = psb_success_
|
||||
ictxt = desc_a%get_context()
|
||||
call psb_info(ictxt,me,np)
|
||||
|
||||
call mld_check_def(parms%ml_cycle,'Multilevel cycle',&
|
||||
& mld_mult_ml_,is_legal_ml_cycle)
|
||||
call mld_check_def(parms%par_aggr_alg,'Aggregation',&
|
||||
& mld_dec_aggr_,is_legal_ml_par_aggr_alg)
|
||||
call mld_check_def(parms%aggr_ord,'Ordering',&
|
||||
& mld_aggr_ord_nat_,is_legal_ml_aggr_ord)
|
||||
call mld_check_def(parms%aggr_thresh,'Aggr_Thresh',szero,is_legal_s_aggr_thrs)
|
||||
|
||||
nr = a%get_nrows()
|
||||
call a%csclip(atmp,info,imax=nr,jmax=nr,&
|
||||
& rscale=.false.,cscale=.false.)
|
||||
call atmp%set_nrows(nr)
|
||||
call atmp%set_ncols(nr)
|
||||
if (info == psb_success_) call atmp%transp(atrans)
|
||||
if (info == psb_success_) call atrans%cscnv(info,type='COO')
|
||||
if (info == psb_success_) call psb_rwextd(nr,atmp,info,b=atrans,rowscale=.false.)
|
||||
call atmp%set_nrows(nr)
|
||||
call atmp%set_ncols(nr)
|
||||
if (info == psb_success_) call atrans%free()
|
||||
if (info == psb_success_) call atmp%cscnv(info,type='CSR')
|
||||
|
||||
if (info == psb_success_) &
|
||||
& call ag%map_bld(parms%aggr_ord,parms%aggr_thresh,atmp,desc_a,nlaggr,ilaggr,info)
|
||||
if (info == psb_success_) call atmp%free()
|
||||
|
||||
if (info == psb_success_) call mld_map_to_tprol(desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
call psb_errpush(info,name,a_err='map_bld/map_to_tprol')
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
|
||||
end subroutine mld_c_symdec_aggregator_build_tprol
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
+32
-11
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
@@ -117,11 +117,11 @@ subroutine mld_caggrmat_nosmth_asb(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_re
|
||||
integer(psb_ipk_) :: ictxt,np,me, icomm, ndx, minfo
|
||||
character(len=20) :: name
|
||||
integer(psb_ipk_) :: ierr(5)
|
||||
type(psb_c_coo_sparse_mat) :: ac_coo, acoo
|
||||
type(psb_c_coo_sparse_mat) :: ac_coo, tmpcoo
|
||||
type(psb_c_csr_sparse_mat) :: acsr1, acsr2
|
||||
integer(psb_ipk_) :: debug_level, debug_unit
|
||||
integer(psb_ipk_) :: nrow, nglob, ncol, ntaggr, nzl, ip, &
|
||||
& naggr, nzt, naggrm1, i, k
|
||||
& naggr, nzt, naggrm1, naggrp1, i, k
|
||||
|
||||
name='mld_aggrmat_nosmth_asb'
|
||||
if(psb_get_errstatus().ne.0) return
|
||||
@@ -137,16 +137,37 @@ subroutine mld_caggrmat_nosmth_asb(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_re
|
||||
ncol = desc_a%get_local_cols()
|
||||
|
||||
|
||||
naggr = nlaggr(me+1)
|
||||
ntaggr = sum(nlaggr)
|
||||
naggrm1=sum(nlaggr(1:me))
|
||||
naggr = nlaggr(me+1)
|
||||
ntaggr = sum(nlaggr)
|
||||
naggrm1 = sum(nlaggr(1:me))
|
||||
naggrp1 = sum(nlaggr(1:me+1))
|
||||
|
||||
call acoo%allocate(ncol,ntaggr,ncol)
|
||||
|
||||
call op_prol%cscnv(info,type='csr',dupl=psb_dupl_add_)
|
||||
if (info /= psb_success_) goto 9999
|
||||
call op_prol%transp(op_restr)
|
||||
|
||||
call op_prol%cp_to(tmpcoo)
|
||||
call op_prol%cscnv(info,type='csr',dupl=psb_dupl_add_)
|
||||
|
||||
call tmpcoo%transp()
|
||||
nzl = tmpcoo%get_nzeros()
|
||||
i=0
|
||||
!
|
||||
! Now we have to fix this. The only rows of tmpcoo/op_restr that are correct
|
||||
! are those corresponding to "local" aggregates, i.e. indices in ilaggr(:)
|
||||
!
|
||||
do k=1, nzl
|
||||
if ((naggrm1 < tmpcoo%ia(k)) .and.(tmpcoo%ia(k) <= naggrp1)) then
|
||||
i = i+1
|
||||
tmpcoo%val(i) = tmpcoo%val(k)
|
||||
tmpcoo%ia(i) = tmpcoo%ia(k)
|
||||
tmpcoo%ja(i) = tmpcoo%ja(k)
|
||||
end if
|
||||
end do
|
||||
call tmpcoo%set_nzeros(i)
|
||||
! call tmpcoo%trim()
|
||||
call op_restr%mv_from(tmpcoo)
|
||||
call op_restr%cscnv(info,type='csr',dupl=psb_dupl_add_)
|
||||
|
||||
if (info /= psb_success_) goto 9999
|
||||
|
||||
call a%cp_to(ac_coo)
|
||||
|
||||
nzt = ac_coo%get_nzeros()
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
+59
-41
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
!
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
@@ -35,12 +35,20 @@
|
||||
! POSSIBILITY OF SUCH DAMAGE.
|
||||
!
|
||||
!
|
||||
! File: mld_daggrmat_asb.f90
|
||||
! File: mld_d_dec_aggregator_mat_asb.f90
|
||||
!
|
||||
! Subroutine: mld_daggrmat_asb
|
||||
! Subroutine: mld_d_dec_aggregator_mat_asb
|
||||
! Version: real
|
||||
!
|
||||
! This routine builds a coarse-level matrix A_C from a fine-level matrix A
|
||||
! This routine builds the matrix associated to the current level of the
|
||||
! multilevel preconditioner from the matrix associated to the previous level,
|
||||
! by using the user-specified aggregation technique (therefore, it also builds the
|
||||
! prolongation and restriction operators mapping the current level to the
|
||||
! previous one and vice versa).
|
||||
! The current level is regarded as the coarse one, while the previous as
|
||||
! the fine one. This is in agreement with the fact that the routine is called,
|
||||
! by mld_mlprec_bld, only on levels >=2.
|
||||
! The coarse-level matrix A_C is built from a fine-level matrix A
|
||||
! by using the Galerkin approach, i.e.
|
||||
!
|
||||
! A_C = P_C^T A P_C,
|
||||
@@ -50,7 +58,7 @@
|
||||
! A mapping from the nodes of the adjacency graph of A to the nodes of the
|
||||
! adjacency graph of A_C has been computed by the mld_aggrmap_bld subroutine.
|
||||
! The prolongator P_C is built here from this mapping, according to the
|
||||
! value of p%iprcparm(mld_aggr_prol_), specified by the user through
|
||||
! value of p%iprcparm(mld_aggr_kind_), specified by the user through
|
||||
! mld_dprecinit and mld_zprecset.
|
||||
! On output from this routine the entries of AC, op_prol, op_restr
|
||||
! are still in "global numbering" mode; this is fixed in the calling routine
|
||||
@@ -64,13 +72,13 @@
|
||||
! 4. minimum energy
|
||||
! 1. The non-smoothed aggregation uses as prolongator the piecewise constant
|
||||
! interpolation operator corresponding to the fine-to-coarse level mapping built
|
||||
! by mld_aggrmap_bld. This is called tentative prolongator.
|
||||
! by p%aggr%bld_tprol. This is called tentative prolongator.
|
||||
! 2. The smoothed aggregation uses as prolongator the operator obtained by applying
|
||||
! a damped Jacobi smoother to the tentative prolongator.
|
||||
! 3. The "bizarre" aggregation uses a prolongator proposed by the authors of MLD2P4.
|
||||
! This prolongator still requires a deep analysis and testing and its use is
|
||||
! not recommended.
|
||||
! 4. Minimum energy aggregation: ADD REFERENCE.
|
||||
! 4. Minimum energy aggregation
|
||||
!
|
||||
! For more details see
|
||||
! M. Brezina and P. Vanek, A black-box iterative solver based on a two-level
|
||||
@@ -78,24 +86,28 @@
|
||||
! P. D'Ambra, D. di Serafino and S. Filippone, On the development of PSBLAS-based
|
||||
! parallel two-level Schwarz preconditioners, Appl. Num. Math., 57 (2007),
|
||||
! 1181-1196.
|
||||
! M. Sala, R. Tuminaro: A new Petrov-Galerkin smoothed aggregation preconditioner
|
||||
! for nonsymmetric linear systems, SIAM J. Sci. Comput., 31(1):143-166 (2008)
|
||||
!
|
||||
!
|
||||
! The main structure is:
|
||||
! 1. Perform sanity checks;
|
||||
! 2. Compute prolongator/restrictor/AC
|
||||
!
|
||||
!
|
||||
! Arguments:
|
||||
! ag - type(mld_d_dec_aggregator_type), input/output.
|
||||
! The aggregator object
|
||||
! parms - type(mld_dml_parms), input
|
||||
! The aggregation parameters
|
||||
! a - type(psb_dspmat_type), input.
|
||||
! The sparse matrix structure containing the local part of
|
||||
! the fine-level matrix.
|
||||
! desc_a - type(psb_desc_type), input.
|
||||
! The communication descriptor of the fine-level matrix.
|
||||
! p - type(mld_d_onelev_type), input/output.
|
||||
! The 'one-level' data structure that will contain the local
|
||||
! part of the matrix to be built as well as the information
|
||||
! concerning the prolongator and its transpose.
|
||||
! parms - type(mld_dml_parms), input
|
||||
! Parameters controlling the choice of algorithm
|
||||
! ac - type(psb_dspmat_type), output
|
||||
! The coarse matrix on output
|
||||
!
|
||||
! ilaggr - integer, dimension(:), input
|
||||
! The mapping between the row indices of the coarse-level
|
||||
! matrix and the row indices of the fine-level matrix.
|
||||
@@ -106,6 +118,9 @@
|
||||
! the various processes do not overlap.
|
||||
! nlaggr - integer, dimension(:) input
|
||||
! nlaggr(i) contains the aggregates held by process i.
|
||||
! ac - type(psb_dspmat_type), output
|
||||
! The coarse matrix on output
|
||||
!
|
||||
! op_prol - type(psb_dspmat_type), input/output
|
||||
! The tentative prolongator on input, the computed prolongator on output
|
||||
!
|
||||
@@ -114,43 +129,45 @@
|
||||
!
|
||||
! info - integer, output.
|
||||
! Error code.
|
||||
!
|
||||
subroutine mld_daggrmat_asb(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info)
|
||||
|
||||
!
|
||||
subroutine mld_d_dec_aggregator_mat_asb(ag,parms,a,desc_a,ilaggr,nlaggr,ac,op_prol,op_restr,info)
|
||||
use psb_base_mod
|
||||
use mld_base_prec_type
|
||||
use mld_d_inner_mod, mld_protect_name => mld_daggrmat_asb
|
||||
|
||||
use mld_d_prec_type, mld_protect_name => mld_d_dec_aggregator_mat_asb
|
||||
use mld_d_inner_mod
|
||||
implicit none
|
||||
|
||||
class(mld_d_dec_aggregator_type), target, intent(inout) :: ag
|
||||
type(mld_dml_parms), intent(inout) :: parms
|
||||
type(psb_dspmat_type), intent(in) :: a
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(inout) :: ilaggr(:), nlaggr(:)
|
||||
type(psb_dspmat_type), intent(inout) :: op_prol
|
||||
type(psb_dspmat_type), intent(out) :: ac,op_restr
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
! Arguments
|
||||
type(psb_dspmat_type), intent(in) :: a
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(inout) :: ilaggr(:), nlaggr(:)
|
||||
type(mld_dml_parms), intent(inout) :: parms
|
||||
type(psb_dspmat_type), intent(inout) :: ac, op_prol,op_restr
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
! Local variables
|
||||
! Local variables
|
||||
character(len=20) :: name
|
||||
integer(psb_mpik_) :: ictxt, np, me
|
||||
type(psb_d_coo_sparse_mat) :: acoo, bcoo
|
||||
type(psb_d_csr_sparse_mat) :: acsr1
|
||||
integer(psb_ipk_) :: nzl,ntaggr, err_act
|
||||
integer(psb_ipk_) :: nzl,ntaggr
|
||||
integer(psb_ipk_) :: err_act
|
||||
integer(psb_ipk_) :: debug_level, debug_unit
|
||||
integer(psb_ipk_) :: ictxt,np,me
|
||||
character(len=20) :: name
|
||||
|
||||
name='mld_aggrmat_asb'
|
||||
if(psb_get_errstatus().ne.0) return
|
||||
info=psb_success_
|
||||
name='mld_d_dec_aggregator_mat_asb'
|
||||
if (psb_get_errstatus().ne.0) return
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
|
||||
|
||||
info = psb_success_
|
||||
ictxt = desc_a%get_context()
|
||||
call psb_info(ictxt,me,np)
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
|
||||
!
|
||||
! Build the coarse-level matrix from the fine-level one, starting from
|
||||
! the mapping defined by mld_aggrmap_bld and applying the aggregation
|
||||
! algorithm specified by
|
||||
!
|
||||
select case (parms%aggr_prol)
|
||||
case (mld_no_smooth_)
|
||||
|
||||
@@ -183,11 +200,12 @@ subroutine mld_daggrmat_asb(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,inf
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine mld_daggrmat_asb
|
||||
|
||||
end subroutine mld_d_dec_aggregator_mat_asb
|
||||
+32
-61
@@ -1,7 +1,6 @@
|
||||
|
||||
!
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
@@ -36,15 +35,15 @@
|
||||
! POSSIBILITY OF SUCH DAMAGE.
|
||||
!
|
||||
!
|
||||
! File: mld_d_lev_aggrmap_bld.f90
|
||||
! File: mld_d_dec_aggregator_tprol.f90
|
||||
!
|
||||
! Subroutine: mld_d_lev_aggrmap_bld
|
||||
! Subroutine: mld_d_dec_aggregator_tprol
|
||||
! Version: real
|
||||
!
|
||||
! This routine is just an interface to aggrmap_bld where the real work is performed.
|
||||
! It takes care of some consistency checking though.
|
||||
!
|
||||
! See mld_daggrmap_bld for constraints on input/oput arguments.
|
||||
! This routine is mainly an interface to map_bld where the real work is performed.
|
||||
! It takes care of some consistency checking, and calls map_to_tprol, which is
|
||||
! refactored and shared among all the aggregation methods that produce a simple
|
||||
! integer mapping.
|
||||
!
|
||||
!
|
||||
! Arguments:
|
||||
@@ -73,31 +72,27 @@
|
||||
! info - integer, output.
|
||||
! Error code.
|
||||
!
|
||||
subroutine mld_d_lev_aggrmap_bld(p,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
|
||||
subroutine mld_d_dec_aggregator_build_tprol(ag,parms,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
use psb_base_mod
|
||||
use mld_base_prec_type
|
||||
use mld_d_inner_mod, mld_protect_name => mld_d_lev_aggrmap_bld
|
||||
|
||||
use mld_d_prec_type, mld_protect_name => mld_d_dec_aggregator_build_tprol
|
||||
use mld_d_inner_mod
|
||||
implicit none
|
||||
|
||||
! Arguments
|
||||
type(mld_d_onelev_type), intent(inout), target :: p
|
||||
type(psb_dspmat_type), intent(in) :: a
|
||||
class(mld_d_dec_aggregator_type), target, intent(inout) :: ag
|
||||
type(mld_dml_parms), intent(inout) :: parms
|
||||
type(psb_dspmat_type), intent(in) :: a
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
|
||||
type(psb_dspmat_type), intent(out) :: op_prol
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
|
||||
! Local variables
|
||||
character(len=20) :: name
|
||||
integer(psb_mpk_) :: ictxt, np, me
|
||||
integer(psb_ipk_) :: err_act
|
||||
integer(psb_ipk_) :: nzl, ntaggr
|
||||
character(len=20) :: name
|
||||
integer(psb_mpik_) :: ictxt, np, me
|
||||
integer(psb_ipk_) :: err_act
|
||||
integer(psb_ipk_) :: ntaggr
|
||||
integer(psb_ipk_) :: debug_level, debug_unit
|
||||
|
||||
name='mld_d_lev_aggrmap_bld'
|
||||
name='mld_d_dec_aggregator_tprol'
|
||||
if (psb_get_errstatus().ne.0) return
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
@@ -106,52 +101,28 @@ subroutine mld_d_lev_aggrmap_bld(p,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
ictxt = desc_a%get_context()
|
||||
call psb_info(ictxt,me,np)
|
||||
|
||||
call mld_check_def(p%parms%ml_cycle,'Multilevel cycle',&
|
||||
call mld_check_def(parms%ml_cycle,'Multilevel cycle',&
|
||||
& mld_mult_ml_,is_legal_ml_cycle)
|
||||
call mld_check_def(p%parms%par_aggr_alg,'Aggregation',&
|
||||
call mld_check_def(parms%par_aggr_alg,'Aggregation',&
|
||||
& mld_dec_aggr_,is_legal_ml_par_aggr_alg)
|
||||
call mld_check_def(p%parms%aggr_ord,'Ordering',&
|
||||
call mld_check_def(parms%aggr_ord,'Ordering',&
|
||||
& mld_aggr_ord_nat_,is_legal_ml_aggr_ord)
|
||||
call mld_check_def(p%parms%aggr_thresh,'Aggr_Thresh',dzero,is_legal_d_aggr_thrs)
|
||||
call mld_check_def(parms%aggr_thresh,'Aggr_Thresh',dzero,is_legal_d_aggr_thrs)
|
||||
|
||||
select case(p%parms%par_aggr_alg)
|
||||
case (mld_dec_aggr_, mld_sym_dec_aggr_)
|
||||
|
||||
!
|
||||
! Build a mapping between the row indices of the fine-level matrix
|
||||
! and the row indices of the coarse-level matrix, according to a decoupled
|
||||
! aggregation algorithm. This also defines a tentative prolongator from
|
||||
! the coarse to the fine level.
|
||||
!
|
||||
call mld_aggrmap_bld(p%parms%par_aggr_alg,p%parms%aggr_ord,p%parms%aggr_thresh,&
|
||||
& a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='mld_aggrmap_bld')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
case (mld_bcmatch_aggr_)
|
||||
write(0,*) 'Matching is not implemented yet '
|
||||
info = -1111
|
||||
call psb_errpush(psb_err_input_value_invalid_i_,name,&
|
||||
& i_err=(/ione,p%parms%par_aggr_alg,izero,izero,izero/))
|
||||
call ag%map_bld(parms%aggr_ord,parms%aggr_thresh,a,desc_a,nlaggr,ilaggr,info)
|
||||
|
||||
if (info==psb_success_) call mld_map_to_tprol(desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
call psb_errpush(info,name,a_err='map_bld/map_to_tprol')
|
||||
goto 9999
|
||||
|
||||
case default
|
||||
|
||||
info = -1
|
||||
call psb_errpush(psb_err_input_value_invalid_i_,name,&
|
||||
& i_err=(/ione,p%parms%par_aggr_alg,izero,izero,izero/))
|
||||
goto 9999
|
||||
|
||||
end select
|
||||
|
||||
endif
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
|
||||
end subroutine mld_d_lev_aggrmap_bld
|
||||
|
||||
end subroutine mld_d_dec_aggregator_build_tprol
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
@@ -9,7 +9,7 @@
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Daniela di Serafino
|
||||
!
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions
|
||||
! are met:
|
||||
@@ -35,15 +35,17 @@
|
||||
! POSSIBILITY OF SUCH DAMAGE.
|
||||
!
|
||||
!
|
||||
! File: mld_daggrmap_bld.f90
|
||||
! File: mld_d_map_to_tprol.f90
|
||||
!
|
||||
! Subroutine: mld_daggrmap_bld
|
||||
! Subroutine: mld_d_map_to_tprol
|
||||
! Version: real
|
||||
!
|
||||
! This routine builds a mapping from the row indices of the fine-level matrix
|
||||
! to the row indices of the coarse-level matrix, according to a decoupled
|
||||
! aggregation algorithm. This mapping will be used by mld_aggrmat_asb to
|
||||
! build the coarse-level matrix.
|
||||
! This routine uses a mapping from the row indices of the fine-level matrix
|
||||
! to the row indices of the coarse-level matrix to build a tentative
|
||||
! prolongator, i.e. a piecewise constant operator.
|
||||
! This is later used to build the final operator; the code has been refactored here
|
||||
! to be shared among all the methods that provide the tentative prolongator
|
||||
! through a simple integer mapping.
|
||||
!
|
||||
! The aggregation algorithm is a parallel version of that described in
|
||||
! * M. Brezina and P. Vanek, A black-box iterative solver based on a
|
||||
@@ -83,28 +85,21 @@
|
||||
! info - integer, output.
|
||||
! Error code.
|
||||
!
|
||||
subroutine mld_daggrmap_bld(aggr_type,iorder,theta,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
subroutine mld_d_map_to_tprol(desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
|
||||
use psb_base_mod
|
||||
use mld_base_prec_type
|
||||
use mld_d_inner_mod, mld_protect_name => mld_daggrmap_bld
|
||||
use mld_d_inner_mod, mld_protect_name => mld_d_map_to_tprol
|
||||
|
||||
implicit none
|
||||
|
||||
! Arguments
|
||||
integer(psb_ipk_), intent(in) :: iorder
|
||||
integer(psb_ipk_), intent(in) :: aggr_type
|
||||
real(psb_dpk_), intent(in) :: theta
|
||||
type(psb_dspmat_type), intent(in) :: a
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
|
||||
integer(psb_ipk_), allocatable, intent(inout) :: ilaggr(:),nlaggr(:)
|
||||
type(psb_dspmat_type), intent(out) :: op_prol
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_), allocatable :: ils(:), neigh(:)
|
||||
integer(psb_ipk_) :: icnt,nlp,k,n,ia,isz,nr, naggr,i,j,m,naggrm1, naggrp1, ntaggr
|
||||
type(psb_dspmat_type) :: atmp, atrans
|
||||
type(psb_d_coo_sparse_mat) :: tmpcoo
|
||||
integer(psb_ipk_) :: debug_level, debug_unit,err_act
|
||||
integer(psb_ipk_) :: ictxt,np,me
|
||||
@@ -113,7 +108,7 @@ subroutine mld_daggrmap_bld(aggr_type,iorder,theta,a,desc_a,ilaggr,nlaggr,op_pro
|
||||
|
||||
if(psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
name = 'mld_aggrmap_bld'
|
||||
name = 'mld_map_to_tprol'
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
@@ -123,40 +118,6 @@ subroutine mld_daggrmap_bld(aggr_type,iorder,theta,a,desc_a,ilaggr,nlaggr,op_pro
|
||||
nrow = desc_a%get_local_rows()
|
||||
ncol = desc_a%get_local_cols()
|
||||
|
||||
select case (aggr_type)
|
||||
case (mld_dec_aggr_)
|
||||
call mld_dec_map_bld(iorder,theta,a,desc_a,nlaggr,ilaggr,info)
|
||||
|
||||
case (mld_sym_dec_aggr_)
|
||||
nr = a%get_nrows()
|
||||
call a%csclip(atmp,info,imax=nr,jmax=nr,&
|
||||
& rscale=.false.,cscale=.false.)
|
||||
call atmp%set_nrows(nr)
|
||||
call atmp%set_ncols(nr)
|
||||
if (info == psb_success_) call atmp%transp(atrans)
|
||||
if (info == psb_success_) call atrans%cscnv(info,type='COO')
|
||||
if (info == psb_success_) call psb_rwextd(nr,atmp,info,b=atrans,rowscale=.false.)
|
||||
call atmp%set_nrows(nr)
|
||||
call atmp%set_ncols(nr)
|
||||
if (info == psb_success_) call atrans%free()
|
||||
if (info == psb_success_) call atmp%cscnv(info,type='CSR')
|
||||
if (info == psb_success_) call mld_dec_map_bld(iorder,theta,atmp,desc_a,nlaggr,ilaggr,info)
|
||||
if (info == psb_success_) call atmp%free()
|
||||
|
||||
case default
|
||||
|
||||
info = -1
|
||||
call psb_errpush(psb_err_input_value_invalid_i_,name,&
|
||||
& i_err=(/ione,aggr_type,izero,izero,izero/))
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name,a_err='dec_map_bld')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
naggr = nlaggr(me+1)
|
||||
ntaggr = sum(nlaggr)
|
||||
naggrm1 = sum(nlaggr(1:me))
|
||||
@@ -186,4 +147,4 @@ subroutine mld_daggrmap_bld(aggr_type,iorder,theta,a,desc_a,ilaggr,nlaggr,op_pro
|
||||
|
||||
return
|
||||
|
||||
end subroutine mld_daggrmap_bld
|
||||
end subroutine mld_d_map_to_tprol
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
@@ -36,13 +36,13 @@
|
||||
!
|
||||
!
|
||||
!
|
||||
! File: mld_d_dec_map__bld.f90
|
||||
! File: mld_d_soc1_map__bld.f90
|
||||
!
|
||||
! Subroutine: mld_d_dec_map_bld
|
||||
! Subroutine: mld_d_soc1_map_bld
|
||||
! Version: real
|
||||
!
|
||||
! This routine builds the tentative prolongator based on the
|
||||
! decoupled aggregation algorithm presented in
|
||||
! strength of connection aggregation algorithm presented in
|
||||
!
|
||||
! M. Brezina and P. Vanek, A black-box iterative solver based on a
|
||||
! two-level Schwarz method, Computing, 63 (1999), 233-263.
|
||||
@@ -67,11 +67,11 @@
|
||||
!
|
||||
!
|
||||
!
|
||||
subroutine mld_d_dec_map_bld(iorder,theta,a,desc_a,nlaggr,ilaggr,info)
|
||||
subroutine mld_d_soc1_map_bld(iorder,theta,a,desc_a,nlaggr,ilaggr,info)
|
||||
|
||||
use psb_base_mod
|
||||
use mld_base_prec_type
|
||||
use mld_d_inner_mod, mld_protect_name => mld_d_dec_map_bld
|
||||
use mld_d_inner_mod!, mld_protect_name => mld_d_soc1_map_bld
|
||||
|
||||
implicit none
|
||||
|
||||
@@ -98,7 +98,7 @@ subroutine mld_d_dec_map_bld(iorder,theta,a,desc_a,nlaggr,ilaggr,info)
|
||||
|
||||
if (psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
name = 'mld_dec_map_bld'
|
||||
name = 'mld_soc1_map_bld'
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
@@ -318,5 +318,5 @@ subroutine mld_d_dec_map_bld(iorder,theta,a,desc_a,nlaggr,ilaggr,info)
|
||||
|
||||
return
|
||||
|
||||
end subroutine mld_d_dec_map_bld
|
||||
end subroutine mld_d_soc1_map_bld
|
||||
|
||||
@@ -0,0 +1,330 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
! (C) Copyright 2008-2018
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Daniela di Serafino
|
||||
!
|
||||
! 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.
|
||||
! 3. The name of the MLD2P4 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
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE MLD2P4 GROUP OR ITS CONTRIBUTORS
|
||||
! 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.
|
||||
!
|
||||
!
|
||||
!
|
||||
! File: mld_d_soc2_map__bld.f90
|
||||
!
|
||||
! Subroutine: mld_d_soc2_map_bld
|
||||
! Version: real
|
||||
!
|
||||
! The aggregator object hosts the aggregation method for building
|
||||
! the multilevel hierarchy. This variant is based on the method
|
||||
! presented in
|
||||
!
|
||||
! S. Gratton, P. Henon, P. Jiranek and X. Vasseur:
|
||||
! Reducing complexity of algebraic multigrid by aggregation
|
||||
! Numerical Lin. Algebra with Applications, 2016, 23:501-518
|
||||
!
|
||||
! Note: upon exit
|
||||
!
|
||||
! Arguments:
|
||||
! a - type(psb_dspmat_type).
|
||||
! The sparse matrix structure containing the local part of the
|
||||
! matrix to be preconditioned.
|
||||
! desc_a - type(psb_desc_type), input.
|
||||
! The communication descriptor of a.
|
||||
! p - type(mld_dprec_type), input/output.
|
||||
! The preconditioner data structure; upon exit it contains
|
||||
! the multilevel hierarchy of prolongators, restrictors
|
||||
! and coarse matrices.
|
||||
! info - integer, output.
|
||||
! Error code.
|
||||
!
|
||||
!
|
||||
!
|
||||
subroutine mld_d_soc2_map_bld(iorder,theta,a,desc_a,nlaggr,ilaggr,info)
|
||||
|
||||
use psb_base_mod
|
||||
use mld_base_prec_type
|
||||
use mld_d_inner_mod!, mld_protect_name => mld_d_soc2_map_bld
|
||||
|
||||
implicit none
|
||||
|
||||
! Arguments
|
||||
integer(psb_ipk_), intent(in) :: iorder
|
||||
type(psb_dspmat_type), intent(in) :: a
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
real(psb_dpk_), intent(in) :: theta
|
||||
integer(psb_ipk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_), allocatable :: ils(:), neigh(:), irow(:), icol(:),&
|
||||
& ideg(:), idxs(:), tmpaggr(:)
|
||||
real(psb_dpk_), allocatable :: val(:), diag(:)
|
||||
integer(psb_ipk_) :: icnt,nlp,k,n,ia,isz,nr,nc,naggr,i,j,m, nz, ilg, ii, ip, ip1,nzcnt
|
||||
type(psb_d_csr_sparse_mat) :: acsr, muij, s_neigh
|
||||
type(psb_d_coo_sparse_mat) :: s_neigh_coo
|
||||
real(psb_dpk_) :: cpling, tcl
|
||||
logical :: disjoint
|
||||
integer(psb_ipk_) :: debug_level, debug_unit,err_act
|
||||
integer(psb_ipk_) :: ictxt,np,me
|
||||
integer(psb_ipk_) :: nrow, ncol, n_ne
|
||||
character(len=20) :: name, ch_err
|
||||
|
||||
if (psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
name = 'mld_soc2_map_bld'
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
!
|
||||
ictxt=desc_a%get_context()
|
||||
call psb_info(ictxt,me,np)
|
||||
nrow = desc_a%get_local_rows()
|
||||
ncol = desc_a%get_local_cols()
|
||||
|
||||
nr = a%get_nrows()
|
||||
nc = a%get_ncols()
|
||||
allocate(ilaggr(nr),neigh(nr),ideg(nr),idxs(nr),icol(nr),stat=info)
|
||||
if(info /= psb_success_) then
|
||||
info=psb_err_alloc_request_
|
||||
call psb_errpush(info,name,i_err=(/2*nr,izero,izero,izero,izero/),&
|
||||
& a_err='integer')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
diag = a%get_diag(info)
|
||||
if(info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
call psb_errpush(info,name,a_err='psb_sp_getdiag')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
!
|
||||
! Phase zero: compute muij
|
||||
!
|
||||
call a%cp_to(muij)
|
||||
do i=1, nr
|
||||
do k=muij%irp(i),muij%irp(i+1)-1
|
||||
j = muij%ja(k)
|
||||
if (j<= nr) muij%val(k) = abs(muij%val(k))/sqrt(abs(diag(i)*diag(j)))
|
||||
end do
|
||||
end do
|
||||
!write(*,*) 'murows/cols ',maxval(mu_rows),maxval(mu_cols)
|
||||
!
|
||||
! Compute the 1-neigbour; mark strong links with +1, weak links with -1
|
||||
!
|
||||
call s_neigh_coo%allocate(nr,nr,muij%get_nzeros())
|
||||
ip = 0
|
||||
do i=1, nr
|
||||
do k=muij%irp(i),muij%irp(i+1)-1
|
||||
j = muij%ja(k)
|
||||
if (j<=nr) then
|
||||
ip = ip + 1
|
||||
s_neigh_coo%ia(ip) = i
|
||||
s_neigh_coo%ja(ip) = j
|
||||
if (real(muij%val(k)) >= theta) then
|
||||
s_neigh_coo%val(ip) = done
|
||||
else
|
||||
s_neigh_coo%val(ip) = -done
|
||||
end if
|
||||
end if
|
||||
end do
|
||||
end do
|
||||
!write(*,*) 'S_NEIGH: ',nr,ip
|
||||
call s_neigh_coo%set_nzeros(ip)
|
||||
call s_neigh%mv_from_coo(s_neigh_coo,info)
|
||||
|
||||
if (iorder == mld_aggr_ord_nat_) then
|
||||
do i=1, nr
|
||||
ilaggr(i) = -(nr+1)
|
||||
idxs(i) = i
|
||||
end do
|
||||
else
|
||||
do i=1, nr
|
||||
ilaggr(i) = -(nr+1)
|
||||
ideg(i) = muij%irp(i+1) - muij%irp(i)
|
||||
end do
|
||||
call psb_msort(ideg,ix=idxs,dir=psb_sort_down_)
|
||||
end if
|
||||
|
||||
|
||||
!
|
||||
! Phase one: Start with disjoint groups.
|
||||
!
|
||||
naggr = 0
|
||||
icnt = 0
|
||||
step1: do ii=1, nr
|
||||
i = idxs(ii)
|
||||
|
||||
if (ilaggr(i) == -(nr+1)) then
|
||||
!
|
||||
! Get the 1-neighbourhood of I
|
||||
!
|
||||
ip1 = s_neigh%irp(i)
|
||||
nz = s_neigh%irp(i+1)-ip1
|
||||
!
|
||||
! If the neighbourhood only contains I, skip it
|
||||
!
|
||||
if (nz ==0) then
|
||||
ilaggr(i) = 0
|
||||
cycle step1
|
||||
end if
|
||||
if ((nz==1).and.(s_neigh%ja(ip1)==i)) then
|
||||
ilaggr(i) = 0
|
||||
cycle step1
|
||||
end if
|
||||
!
|
||||
! If the whole strongly coupled neighborhood of I is
|
||||
! as yet unconnected, turn it into the next aggregate.
|
||||
!
|
||||
nzcnt = count(real(s_neigh%val(ip1:ip1+nz-1)) > 0)
|
||||
icol(1:nzcnt) = pack(s_neigh%ja(ip1:ip1+nz-1),(real(s_neigh%val(ip1:ip1+nz-1)) > 0))
|
||||
disjoint = all(ilaggr(icol(1:nzcnt)) == -(nr+1))
|
||||
if (disjoint) then
|
||||
icnt = icnt + 1
|
||||
naggr = naggr + 1
|
||||
do k=1, nzcnt
|
||||
ilaggr(icol(k)) = naggr
|
||||
end do
|
||||
ilaggr(i) = naggr
|
||||
end if
|
||||
endif
|
||||
enddo step1
|
||||
|
||||
if (debug_level >= psb_debug_outer_) then
|
||||
write(debug_unit,*) me,' ',trim(name),&
|
||||
& ' Check 1:',count(ilaggr == -(nr+1))
|
||||
end if
|
||||
|
||||
!
|
||||
! Phase two: join the neighbours
|
||||
!
|
||||
tmpaggr = ilaggr
|
||||
step2: do ii=1,nr
|
||||
i = idxs(ii)
|
||||
|
||||
if (ilaggr(i) == -(nr+1)) then
|
||||
!
|
||||
! Find the most strongly connected neighbour that is
|
||||
! already aggregated, if any, and join its aggregate
|
||||
!
|
||||
cpling = dzero
|
||||
ip = 0
|
||||
do k=s_neigh%irp(i), s_neigh%irp(i+1)-1
|
||||
j = s_neigh%ja(k)
|
||||
if ((1<=j).and.(j<=nr)) then
|
||||
if ( (tmpaggr(j) > 0).and. (real(muij%val(k)) > cpling)&
|
||||
& .and.(real(s_neigh%val(k))>0)) then
|
||||
ip = k
|
||||
cpling = muij%val(k)
|
||||
end if
|
||||
end if
|
||||
enddo
|
||||
if (ip > 0) then
|
||||
ilaggr(i) = ilaggr(s_neigh%ja(ip))
|
||||
end if
|
||||
end if
|
||||
end do step2
|
||||
|
||||
|
||||
!
|
||||
! Phase three: sweep over leftovers, if any
|
||||
!
|
||||
step3: do ii=1,nr
|
||||
i = idxs(ii)
|
||||
|
||||
if (ilaggr(i) < 0) then
|
||||
!
|
||||
! Find its strongly connected neighbourhood not
|
||||
! already aggregated, and make it into a new aggregate.
|
||||
!
|
||||
ip = 0
|
||||
do k=s_neigh%irp(i), s_neigh%irp(i+1)-1
|
||||
j = s_neigh%ja(k)
|
||||
if ((1<=j).and.(j<=nr)) then
|
||||
if (ilaggr(j) < 0) then
|
||||
ip = ip + 1
|
||||
icol(ip) = j
|
||||
end if
|
||||
end if
|
||||
enddo
|
||||
if (ip > 0) then
|
||||
icnt = icnt + 1
|
||||
naggr = naggr + 1
|
||||
ilaggr(i) = naggr
|
||||
do k=1, ip
|
||||
ilaggr(icol(k)) = naggr
|
||||
end do
|
||||
end if
|
||||
end if
|
||||
end do step3
|
||||
|
||||
|
||||
if (count(ilaggr<0) >0) then
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name,a_err='Fatal error: some leftovers')
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
if (naggr > ncol) then
|
||||
write(0,*) name,'Error : naggr > ncol',naggr,ncol
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name,a_err='Fatal error: naggr>ncol')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
call psb_realloc(ncol,ilaggr,info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
ch_err='psb_realloc'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
allocate(nlaggr(np),stat=info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_alloc_request_
|
||||
call psb_errpush(info,name,i_err=(/np,izero,izero,izero,izero/),&
|
||||
& a_err='integer')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
nlaggr(:) = 0
|
||||
nlaggr(me+1) = naggr
|
||||
call psb_sum(ictxt,nlaggr(1:np))
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine mld_d_soc2_map_bld
|
||||
|
||||
@@ -0,0 +1,146 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
! (C) Copyright 2008-2018
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Daniela di Serafino
|
||||
!
|
||||
! 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.
|
||||
! 3. The name of the MLD2P4 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
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE MLD2P4 GROUP OR ITS CONTRIBUTORS
|
||||
! 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.
|
||||
!
|
||||
!
|
||||
! File: mld_d_symdec_aggregator_tprol.f90
|
||||
!
|
||||
! Subroutine: mld_d_symdec_aggregator_tprol
|
||||
! Version: real
|
||||
!
|
||||
!
|
||||
! This routine is mainly an interface to map_bld where the real work is performed.
|
||||
! It takes care of some consistency checking, and calls map_to_tprol, which is
|
||||
! refactored and shared among all the aggregation methods that produce a simple
|
||||
! integer mapping.
|
||||
!
|
||||
!
|
||||
!
|
||||
! Arguments:
|
||||
! p - type(mld_d_onelev_type), input/output.
|
||||
! The 'one-level' data structure containing the control
|
||||
! parameters and (eventually) coarse matrix and prolongator/restrictors.
|
||||
!
|
||||
! a - type(psb_dspmat_type).
|
||||
! The sparse matrix structure containing the local part of the
|
||||
! fine-level matrix.
|
||||
! desc_a - type(psb_desc_type), input.
|
||||
! The communication descriptor of a.
|
||||
! ilaggr - integer, dimension(:), allocatable, output
|
||||
! The mapping between the row indices of the coarse-level
|
||||
! matrix and the row indices of the fine-level matrix.
|
||||
! ilaggr(i)=j means that node i in the adjacency graph
|
||||
! of the fine-level matrix is mapped onto node j in the
|
||||
! adjacency graph of the coarse-level matrix. Note that on exit the indices
|
||||
! will be shifted so as to make sure the ranges on the various processes do not
|
||||
! overlap.
|
||||
! nlaggr - integer, dimension(:), allocatable, output
|
||||
! nlaggr(i) contains the aggregates held by process i.
|
||||
! op_prol - type(psb_dspmat_type), output
|
||||
! The tentative prolongator, based on ilaggr.
|
||||
!
|
||||
! info - integer, output.
|
||||
! Error code.
|
||||
!
|
||||
subroutine mld_d_symdec_aggregator_build_tprol(ag,parms,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
use psb_base_mod
|
||||
use mld_d_prec_type
|
||||
use mld_d_symdec_aggregator_mod, mld_protect_name => mld_d_symdec_aggregator_build_tprol
|
||||
use mld_d_inner_mod
|
||||
implicit none
|
||||
class(mld_d_symdec_aggregator_type), target, intent(inout) :: ag
|
||||
type(mld_dml_parms), intent(inout) :: parms
|
||||
type(psb_dspmat_type), intent(in) :: a
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
|
||||
type(psb_dspmat_type), intent(out) :: op_prol
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
! Local variables
|
||||
type(psb_dspmat_type) :: atmp, atrans
|
||||
character(len=20) :: name
|
||||
integer(psb_mpik_) :: ictxt, np, me
|
||||
integer(psb_ipk_) :: err_act
|
||||
integer(psb_ipk_) :: ntaggr, nr
|
||||
integer(psb_ipk_) :: debug_level, debug_unit
|
||||
|
||||
name='mld_d_symdec_aggregator_tprol'
|
||||
if (psb_get_errstatus().ne.0) return
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
info = psb_success_
|
||||
ictxt = desc_a%get_context()
|
||||
call psb_info(ictxt,me,np)
|
||||
|
||||
call mld_check_def(parms%ml_cycle,'Multilevel cycle',&
|
||||
& mld_mult_ml_,is_legal_ml_cycle)
|
||||
call mld_check_def(parms%par_aggr_alg,'Aggregation',&
|
||||
& mld_dec_aggr_,is_legal_ml_par_aggr_alg)
|
||||
call mld_check_def(parms%aggr_ord,'Ordering',&
|
||||
& mld_aggr_ord_nat_,is_legal_ml_aggr_ord)
|
||||
call mld_check_def(parms%aggr_thresh,'Aggr_Thresh',dzero,is_legal_d_aggr_thrs)
|
||||
|
||||
nr = a%get_nrows()
|
||||
call a%csclip(atmp,info,imax=nr,jmax=nr,&
|
||||
& rscale=.false.,cscale=.false.)
|
||||
call atmp%set_nrows(nr)
|
||||
call atmp%set_ncols(nr)
|
||||
if (info == psb_success_) call atmp%transp(atrans)
|
||||
if (info == psb_success_) call atrans%cscnv(info,type='COO')
|
||||
if (info == psb_success_) call psb_rwextd(nr,atmp,info,b=atrans,rowscale=.false.)
|
||||
call atmp%set_nrows(nr)
|
||||
call atmp%set_ncols(nr)
|
||||
if (info == psb_success_) call atrans%free()
|
||||
if (info == psb_success_) call atmp%cscnv(info,type='CSR')
|
||||
|
||||
if (info == psb_success_) &
|
||||
& call ag%map_bld(parms%aggr_ord,parms%aggr_thresh,atmp,desc_a,nlaggr,ilaggr,info)
|
||||
if (info == psb_success_) call atmp%free()
|
||||
|
||||
if (info == psb_success_) call mld_map_to_tprol(desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
call psb_errpush(info,name,a_err='map_bld/map_to_tprol')
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
|
||||
end subroutine mld_d_symdec_aggregator_build_tprol
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
+32
-11
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
@@ -117,11 +117,11 @@ subroutine mld_daggrmat_nosmth_asb(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_re
|
||||
integer(psb_ipk_) :: ictxt,np,me, icomm, ndx, minfo
|
||||
character(len=20) :: name
|
||||
integer(psb_ipk_) :: ierr(5)
|
||||
type(psb_d_coo_sparse_mat) :: ac_coo, acoo
|
||||
type(psb_d_coo_sparse_mat) :: ac_coo, tmpcoo
|
||||
type(psb_d_csr_sparse_mat) :: acsr1, acsr2
|
||||
integer(psb_ipk_) :: debug_level, debug_unit
|
||||
integer(psb_ipk_) :: nrow, nglob, ncol, ntaggr, nzl, ip, &
|
||||
& naggr, nzt, naggrm1, i, k
|
||||
& naggr, nzt, naggrm1, naggrp1, i, k
|
||||
|
||||
name='mld_aggrmat_nosmth_asb'
|
||||
if(psb_get_errstatus().ne.0) return
|
||||
@@ -137,16 +137,37 @@ subroutine mld_daggrmat_nosmth_asb(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_re
|
||||
ncol = desc_a%get_local_cols()
|
||||
|
||||
|
||||
naggr = nlaggr(me+1)
|
||||
ntaggr = sum(nlaggr)
|
||||
naggrm1=sum(nlaggr(1:me))
|
||||
naggr = nlaggr(me+1)
|
||||
ntaggr = sum(nlaggr)
|
||||
naggrm1 = sum(nlaggr(1:me))
|
||||
naggrp1 = sum(nlaggr(1:me+1))
|
||||
|
||||
call acoo%allocate(ncol,ntaggr,ncol)
|
||||
|
||||
call op_prol%cscnv(info,type='csr',dupl=psb_dupl_add_)
|
||||
if (info /= psb_success_) goto 9999
|
||||
call op_prol%transp(op_restr)
|
||||
|
||||
call op_prol%cp_to(tmpcoo)
|
||||
call op_prol%cscnv(info,type='csr',dupl=psb_dupl_add_)
|
||||
|
||||
call tmpcoo%transp()
|
||||
nzl = tmpcoo%get_nzeros()
|
||||
i=0
|
||||
!
|
||||
! Now we have to fix this. The only rows of tmpcoo/op_restr that are correct
|
||||
! are those corresponding to "local" aggregates, i.e. indices in ilaggr(:)
|
||||
!
|
||||
do k=1, nzl
|
||||
if ((naggrm1 < tmpcoo%ia(k)) .and.(tmpcoo%ia(k) <= naggrp1)) then
|
||||
i = i+1
|
||||
tmpcoo%val(i) = tmpcoo%val(k)
|
||||
tmpcoo%ia(i) = tmpcoo%ia(k)
|
||||
tmpcoo%ja(i) = tmpcoo%ja(k)
|
||||
end if
|
||||
end do
|
||||
call tmpcoo%set_nzeros(i)
|
||||
! call tmpcoo%trim()
|
||||
call op_restr%mv_from(tmpcoo)
|
||||
call op_restr%cscnv(info,type='csr',dupl=psb_dupl_add_)
|
||||
|
||||
if (info /= psb_success_) goto 9999
|
||||
|
||||
call a%cp_to(ac_coo)
|
||||
|
||||
nzt = ac_coo%get_nzeros()
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
+59
-41
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
!
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
@@ -35,12 +35,20 @@
|
||||
! POSSIBILITY OF SUCH DAMAGE.
|
||||
!
|
||||
!
|
||||
! File: mld_saggrmat_asb.f90
|
||||
! File: mld_s_dec_aggregator_mat_asb.f90
|
||||
!
|
||||
! Subroutine: mld_saggrmat_asb
|
||||
! Subroutine: mld_s_dec_aggregator_mat_asb
|
||||
! Version: real
|
||||
!
|
||||
! This routine builds a coarse-level matrix A_C from a fine-level matrix A
|
||||
! This routine builds the matrix associated to the current level of the
|
||||
! multilevel preconditioner from the matrix associated to the previous level,
|
||||
! by using the user-specified aggregation technique (therefore, it also builds the
|
||||
! prolongation and restriction operators mapping the current level to the
|
||||
! previous one and vice versa).
|
||||
! The current level is regarded as the coarse one, while the previous as
|
||||
! the fine one. This is in agreement with the fact that the routine is called,
|
||||
! by mld_mlprec_bld, only on levels >=2.
|
||||
! The coarse-level matrix A_C is built from a fine-level matrix A
|
||||
! by using the Galerkin approach, i.e.
|
||||
!
|
||||
! A_C = P_C^T A P_C,
|
||||
@@ -50,7 +58,7 @@
|
||||
! A mapping from the nodes of the adjacency graph of A to the nodes of the
|
||||
! adjacency graph of A_C has been computed by the mld_aggrmap_bld subroutine.
|
||||
! The prolongator P_C is built here from this mapping, according to the
|
||||
! value of p%iprcparm(mld_aggr_prol_), specified by the user through
|
||||
! value of p%iprcparm(mld_aggr_kind_), specified by the user through
|
||||
! mld_sprecinit and mld_zprecset.
|
||||
! On output from this routine the entries of AC, op_prol, op_restr
|
||||
! are still in "global numbering" mode; this is fixed in the calling routine
|
||||
@@ -64,13 +72,13 @@
|
||||
! 4. minimum energy
|
||||
! 1. The non-smoothed aggregation uses as prolongator the piecewise constant
|
||||
! interpolation operator corresponding to the fine-to-coarse level mapping built
|
||||
! by mld_aggrmap_bld. This is called tentative prolongator.
|
||||
! by p%aggr%bld_tprol. This is called tentative prolongator.
|
||||
! 2. The smoothed aggregation uses as prolongator the operator obtained by applying
|
||||
! a damped Jacobi smoother to the tentative prolongator.
|
||||
! 3. The "bizarre" aggregation uses a prolongator proposed by the authors of MLD2P4.
|
||||
! This prolongator still requires a deep analysis and testing and its use is
|
||||
! not recommended.
|
||||
! 4. Minimum energy aggregation: ADD REFERENCE.
|
||||
! 4. Minimum energy aggregation
|
||||
!
|
||||
! For more details see
|
||||
! M. Brezina and P. Vanek, A black-box iterative solver based on a two-level
|
||||
@@ -78,24 +86,28 @@
|
||||
! P. D'Ambra, D. di Serafino and S. Filippone, On the development of PSBLAS-based
|
||||
! parallel two-level Schwarz preconditioners, Appl. Num. Math., 57 (2007),
|
||||
! 1181-1196.
|
||||
! M. Sala, R. Tuminaro: A new Petrov-Galerkin smoothed aggregation preconditioner
|
||||
! for nonsymmetric linear systems, SIAM J. Sci. Comput., 31(1):143-166 (2008)
|
||||
!
|
||||
!
|
||||
! The main structure is:
|
||||
! 1. Perform sanity checks;
|
||||
! 2. Compute prolongator/restrictor/AC
|
||||
!
|
||||
!
|
||||
! Arguments:
|
||||
! ag - type(mld_s_dec_aggregator_type), input/output.
|
||||
! The aggregator object
|
||||
! parms - type(mld_sml_parms), input
|
||||
! The aggregation parameters
|
||||
! a - type(psb_sspmat_type), input.
|
||||
! The sparse matrix structure containing the local part of
|
||||
! the fine-level matrix.
|
||||
! desc_a - type(psb_desc_type), input.
|
||||
! The communication descriptor of the fine-level matrix.
|
||||
! p - type(mld_s_onelev_type), input/output.
|
||||
! The 'one-level' data structure that will contain the local
|
||||
! part of the matrix to be built as well as the information
|
||||
! concerning the prolongator and its transpose.
|
||||
! parms - type(mld_sml_parms), input
|
||||
! Parameters controlling the choice of algorithm
|
||||
! ac - type(psb_sspmat_type), output
|
||||
! The coarse matrix on output
|
||||
!
|
||||
! ilaggr - integer, dimension(:), input
|
||||
! The mapping between the row indices of the coarse-level
|
||||
! matrix and the row indices of the fine-level matrix.
|
||||
@@ -106,6 +118,9 @@
|
||||
! the various processes do not overlap.
|
||||
! nlaggr - integer, dimension(:) input
|
||||
! nlaggr(i) contains the aggregates held by process i.
|
||||
! ac - type(psb_sspmat_type), output
|
||||
! The coarse matrix on output
|
||||
!
|
||||
! op_prol - type(psb_sspmat_type), input/output
|
||||
! The tentative prolongator on input, the computed prolongator on output
|
||||
!
|
||||
@@ -114,43 +129,45 @@
|
||||
!
|
||||
! info - integer, output.
|
||||
! Error code.
|
||||
!
|
||||
subroutine mld_saggrmat_asb(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info)
|
||||
|
||||
!
|
||||
subroutine mld_s_dec_aggregator_mat_asb(ag,parms,a,desc_a,ilaggr,nlaggr,ac,op_prol,op_restr,info)
|
||||
use psb_base_mod
|
||||
use mld_base_prec_type
|
||||
use mld_s_inner_mod, mld_protect_name => mld_saggrmat_asb
|
||||
|
||||
use mld_s_prec_type, mld_protect_name => mld_s_dec_aggregator_mat_asb
|
||||
use mld_s_inner_mod
|
||||
implicit none
|
||||
|
||||
class(mld_s_dec_aggregator_type), target, intent(inout) :: ag
|
||||
type(mld_sml_parms), intent(inout) :: parms
|
||||
type(psb_sspmat_type), intent(in) :: a
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(inout) :: ilaggr(:), nlaggr(:)
|
||||
type(psb_sspmat_type), intent(inout) :: op_prol
|
||||
type(psb_sspmat_type), intent(out) :: ac,op_restr
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
! Arguments
|
||||
type(psb_sspmat_type), intent(in) :: a
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(inout) :: ilaggr(:), nlaggr(:)
|
||||
type(mld_sml_parms), intent(inout) :: parms
|
||||
type(psb_sspmat_type), intent(inout) :: ac, op_prol,op_restr
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
! Local variables
|
||||
! Local variables
|
||||
character(len=20) :: name
|
||||
integer(psb_mpik_) :: ictxt, np, me
|
||||
type(psb_s_coo_sparse_mat) :: acoo, bcoo
|
||||
type(psb_s_csr_sparse_mat) :: acsr1
|
||||
integer(psb_ipk_) :: nzl,ntaggr, err_act
|
||||
integer(psb_ipk_) :: nzl,ntaggr
|
||||
integer(psb_ipk_) :: err_act
|
||||
integer(psb_ipk_) :: debug_level, debug_unit
|
||||
integer(psb_ipk_) :: ictxt,np,me
|
||||
character(len=20) :: name
|
||||
|
||||
name='mld_aggrmat_asb'
|
||||
if(psb_get_errstatus().ne.0) return
|
||||
info=psb_success_
|
||||
name='mld_s_dec_aggregator_mat_asb'
|
||||
if (psb_get_errstatus().ne.0) return
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
|
||||
|
||||
info = psb_success_
|
||||
ictxt = desc_a%get_context()
|
||||
call psb_info(ictxt,me,np)
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
|
||||
!
|
||||
! Build the coarse-level matrix from the fine-level one, starting from
|
||||
! the mapping defined by mld_aggrmap_bld and applying the aggregation
|
||||
! algorithm specified by
|
||||
!
|
||||
select case (parms%aggr_prol)
|
||||
case (mld_no_smooth_)
|
||||
|
||||
@@ -183,11 +200,12 @@ subroutine mld_saggrmat_asb(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,inf
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine mld_saggrmat_asb
|
||||
|
||||
end subroutine mld_s_dec_aggregator_mat_asb
|
||||
+32
-61
@@ -1,7 +1,6 @@
|
||||
|
||||
!
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
@@ -36,15 +35,15 @@
|
||||
! POSSIBILITY OF SUCH DAMAGE.
|
||||
!
|
||||
!
|
||||
! File: mld_s_lev_aggrmap_bld.f90
|
||||
! File: mld_s_dec_aggregator_tprol.f90
|
||||
!
|
||||
! Subroutine: mld_s_lev_aggrmap_bld
|
||||
! Subroutine: mld_s_dec_aggregator_tprol
|
||||
! Version: real
|
||||
!
|
||||
! This routine is just an interface to aggrmap_bld where the real work is performed.
|
||||
! It takes care of some consistency checking though.
|
||||
!
|
||||
! See mld_saggrmap_bld for constraints on input/oput arguments.
|
||||
! This routine is mainly an interface to map_bld where the real work is performed.
|
||||
! It takes care of some consistency checking, and calls map_to_tprol, which is
|
||||
! refactored and shared among all the aggregation methods that produce a simple
|
||||
! integer mapping.
|
||||
!
|
||||
!
|
||||
! Arguments:
|
||||
@@ -73,31 +72,27 @@
|
||||
! info - integer, output.
|
||||
! Error code.
|
||||
!
|
||||
subroutine mld_s_lev_aggrmap_bld(p,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
|
||||
subroutine mld_s_dec_aggregator_build_tprol(ag,parms,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
use psb_base_mod
|
||||
use mld_base_prec_type
|
||||
use mld_s_inner_mod, mld_protect_name => mld_s_lev_aggrmap_bld
|
||||
|
||||
use mld_s_prec_type, mld_protect_name => mld_s_dec_aggregator_build_tprol
|
||||
use mld_s_inner_mod
|
||||
implicit none
|
||||
|
||||
! Arguments
|
||||
type(mld_s_onelev_type), intent(inout), target :: p
|
||||
type(psb_sspmat_type), intent(in) :: a
|
||||
class(mld_s_dec_aggregator_type), target, intent(inout) :: ag
|
||||
type(mld_sml_parms), intent(inout) :: parms
|
||||
type(psb_sspmat_type), intent(in) :: a
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
|
||||
type(psb_sspmat_type), intent(out) :: op_prol
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
|
||||
! Local variables
|
||||
character(len=20) :: name
|
||||
integer(psb_mpk_) :: ictxt, np, me
|
||||
integer(psb_ipk_) :: err_act
|
||||
integer(psb_ipk_) :: nzl, ntaggr
|
||||
character(len=20) :: name
|
||||
integer(psb_mpik_) :: ictxt, np, me
|
||||
integer(psb_ipk_) :: err_act
|
||||
integer(psb_ipk_) :: ntaggr
|
||||
integer(psb_ipk_) :: debug_level, debug_unit
|
||||
|
||||
name='mld_s_lev_aggrmap_bld'
|
||||
name='mld_s_dec_aggregator_tprol'
|
||||
if (psb_get_errstatus().ne.0) return
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
@@ -106,52 +101,28 @@ subroutine mld_s_lev_aggrmap_bld(p,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
ictxt = desc_a%get_context()
|
||||
call psb_info(ictxt,me,np)
|
||||
|
||||
call mld_check_def(p%parms%ml_cycle,'Multilevel cycle',&
|
||||
call mld_check_def(parms%ml_cycle,'Multilevel cycle',&
|
||||
& mld_mult_ml_,is_legal_ml_cycle)
|
||||
call mld_check_def(p%parms%par_aggr_alg,'Aggregation',&
|
||||
call mld_check_def(parms%par_aggr_alg,'Aggregation',&
|
||||
& mld_dec_aggr_,is_legal_ml_par_aggr_alg)
|
||||
call mld_check_def(p%parms%aggr_ord,'Ordering',&
|
||||
call mld_check_def(parms%aggr_ord,'Ordering',&
|
||||
& mld_aggr_ord_nat_,is_legal_ml_aggr_ord)
|
||||
call mld_check_def(p%parms%aggr_thresh,'Aggr_Thresh',szero,is_legal_s_aggr_thrs)
|
||||
call mld_check_def(parms%aggr_thresh,'Aggr_Thresh',szero,is_legal_s_aggr_thrs)
|
||||
|
||||
select case(p%parms%par_aggr_alg)
|
||||
case (mld_dec_aggr_, mld_sym_dec_aggr_)
|
||||
|
||||
!
|
||||
! Build a mapping between the row indices of the fine-level matrix
|
||||
! and the row indices of the coarse-level matrix, according to a decoupled
|
||||
! aggregation algorithm. This also defines a tentative prolongator from
|
||||
! the coarse to the fine level.
|
||||
!
|
||||
call mld_aggrmap_bld(p%parms%par_aggr_alg,p%parms%aggr_ord,p%parms%aggr_thresh,&
|
||||
& a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='mld_aggrmap_bld')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
case (mld_bcmatch_aggr_)
|
||||
write(0,*) 'Matching is not implemented yet '
|
||||
info = -1111
|
||||
call psb_errpush(psb_err_input_value_invalid_i_,name,&
|
||||
& i_err=(/ione,p%parms%par_aggr_alg,izero,izero,izero/))
|
||||
call ag%map_bld(parms%aggr_ord,parms%aggr_thresh,a,desc_a,nlaggr,ilaggr,info)
|
||||
|
||||
if (info==psb_success_) call mld_map_to_tprol(desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
call psb_errpush(info,name,a_err='map_bld/map_to_tprol')
|
||||
goto 9999
|
||||
|
||||
case default
|
||||
|
||||
info = -1
|
||||
call psb_errpush(psb_err_input_value_invalid_i_,name,&
|
||||
& i_err=(/ione,p%parms%par_aggr_alg,izero,izero,izero/))
|
||||
goto 9999
|
||||
|
||||
end select
|
||||
|
||||
endif
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
|
||||
end subroutine mld_s_lev_aggrmap_bld
|
||||
|
||||
end subroutine mld_s_dec_aggregator_build_tprol
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
@@ -9,7 +9,7 @@
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Daniela di Serafino
|
||||
!
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions
|
||||
! are met:
|
||||
@@ -35,15 +35,17 @@
|
||||
! POSSIBILITY OF SUCH DAMAGE.
|
||||
!
|
||||
!
|
||||
! File: mld_saggrmap_bld.f90
|
||||
! File: mld_s_map_to_tprol.f90
|
||||
!
|
||||
! Subroutine: mld_saggrmap_bld
|
||||
! Subroutine: mld_s_map_to_tprol
|
||||
! Version: real
|
||||
!
|
||||
! This routine builds a mapping from the row indices of the fine-level matrix
|
||||
! to the row indices of the coarse-level matrix, according to a decoupled
|
||||
! aggregation algorithm. This mapping will be used by mld_aggrmat_asb to
|
||||
! build the coarse-level matrix.
|
||||
! This routine uses a mapping from the row indices of the fine-level matrix
|
||||
! to the row indices of the coarse-level matrix to build a tentative
|
||||
! prolongator, i.e. a piecewise constant operator.
|
||||
! This is later used to build the final operator; the code has been refactored here
|
||||
! to be shared among all the methods that provide the tentative prolongator
|
||||
! through a simple integer mapping.
|
||||
!
|
||||
! The aggregation algorithm is a parallel version of that described in
|
||||
! * M. Brezina and P. Vanek, A black-box iterative solver based on a
|
||||
@@ -83,28 +85,21 @@
|
||||
! info - integer, output.
|
||||
! Error code.
|
||||
!
|
||||
subroutine mld_saggrmap_bld(aggr_type,iorder,theta,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
subroutine mld_s_map_to_tprol(desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
|
||||
use psb_base_mod
|
||||
use mld_base_prec_type
|
||||
use mld_s_inner_mod, mld_protect_name => mld_saggrmap_bld
|
||||
use mld_s_inner_mod, mld_protect_name => mld_s_map_to_tprol
|
||||
|
||||
implicit none
|
||||
|
||||
! Arguments
|
||||
integer(psb_ipk_), intent(in) :: iorder
|
||||
integer(psb_ipk_), intent(in) :: aggr_type
|
||||
real(psb_spk_), intent(in) :: theta
|
||||
type(psb_sspmat_type), intent(in) :: a
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
|
||||
integer(psb_ipk_), allocatable, intent(inout) :: ilaggr(:),nlaggr(:)
|
||||
type(psb_sspmat_type), intent(out) :: op_prol
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_), allocatable :: ils(:), neigh(:)
|
||||
integer(psb_ipk_) :: icnt,nlp,k,n,ia,isz,nr, naggr,i,j,m,naggrm1, naggrp1, ntaggr
|
||||
type(psb_sspmat_type) :: atmp, atrans
|
||||
type(psb_s_coo_sparse_mat) :: tmpcoo
|
||||
integer(psb_ipk_) :: debug_level, debug_unit,err_act
|
||||
integer(psb_ipk_) :: ictxt,np,me
|
||||
@@ -113,7 +108,7 @@ subroutine mld_saggrmap_bld(aggr_type,iorder,theta,a,desc_a,ilaggr,nlaggr,op_pro
|
||||
|
||||
if(psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
name = 'mld_aggrmap_bld'
|
||||
name = 'mld_map_to_tprol'
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
@@ -123,40 +118,6 @@ subroutine mld_saggrmap_bld(aggr_type,iorder,theta,a,desc_a,ilaggr,nlaggr,op_pro
|
||||
nrow = desc_a%get_local_rows()
|
||||
ncol = desc_a%get_local_cols()
|
||||
|
||||
select case (aggr_type)
|
||||
case (mld_dec_aggr_)
|
||||
call mld_dec_map_bld(iorder,theta,a,desc_a,nlaggr,ilaggr,info)
|
||||
|
||||
case (mld_sym_dec_aggr_)
|
||||
nr = a%get_nrows()
|
||||
call a%csclip(atmp,info,imax=nr,jmax=nr,&
|
||||
& rscale=.false.,cscale=.false.)
|
||||
call atmp%set_nrows(nr)
|
||||
call atmp%set_ncols(nr)
|
||||
if (info == psb_success_) call atmp%transp(atrans)
|
||||
if (info == psb_success_) call atrans%cscnv(info,type='COO')
|
||||
if (info == psb_success_) call psb_rwextd(nr,atmp,info,b=atrans,rowscale=.false.)
|
||||
call atmp%set_nrows(nr)
|
||||
call atmp%set_ncols(nr)
|
||||
if (info == psb_success_) call atrans%free()
|
||||
if (info == psb_success_) call atmp%cscnv(info,type='CSR')
|
||||
if (info == psb_success_) call mld_dec_map_bld(iorder,theta,atmp,desc_a,nlaggr,ilaggr,info)
|
||||
if (info == psb_success_) call atmp%free()
|
||||
|
||||
case default
|
||||
|
||||
info = -1
|
||||
call psb_errpush(psb_err_input_value_invalid_i_,name,&
|
||||
& i_err=(/ione,aggr_type,izero,izero,izero/))
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name,a_err='dec_map_bld')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
naggr = nlaggr(me+1)
|
||||
ntaggr = sum(nlaggr)
|
||||
naggrm1 = sum(nlaggr(1:me))
|
||||
@@ -186,4 +147,4 @@ subroutine mld_saggrmap_bld(aggr_type,iorder,theta,a,desc_a,ilaggr,nlaggr,op_pro
|
||||
|
||||
return
|
||||
|
||||
end subroutine mld_saggrmap_bld
|
||||
end subroutine mld_s_map_to_tprol
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
@@ -36,13 +36,13 @@
|
||||
!
|
||||
!
|
||||
!
|
||||
! File: mld_s_dec_map__bld.f90
|
||||
! File: mld_s_soc1_map__bld.f90
|
||||
!
|
||||
! Subroutine: mld_s_dec_map_bld
|
||||
! Subroutine: mld_s_soc1_map_bld
|
||||
! Version: real
|
||||
!
|
||||
! This routine builds the tentative prolongator based on the
|
||||
! decoupled aggregation algorithm presented in
|
||||
! strength of connection aggregation algorithm presented in
|
||||
!
|
||||
! M. Brezina and P. Vanek, A black-box iterative solver based on a
|
||||
! two-level Schwarz method, Computing, 63 (1999), 233-263.
|
||||
@@ -67,11 +67,11 @@
|
||||
!
|
||||
!
|
||||
!
|
||||
subroutine mld_s_dec_map_bld(iorder,theta,a,desc_a,nlaggr,ilaggr,info)
|
||||
subroutine mld_s_soc1_map_bld(iorder,theta,a,desc_a,nlaggr,ilaggr,info)
|
||||
|
||||
use psb_base_mod
|
||||
use mld_base_prec_type
|
||||
use mld_s_inner_mod, mld_protect_name => mld_s_dec_map_bld
|
||||
use mld_s_inner_mod!, mld_protect_name => mld_s_soc1_map_bld
|
||||
|
||||
implicit none
|
||||
|
||||
@@ -98,7 +98,7 @@ subroutine mld_s_dec_map_bld(iorder,theta,a,desc_a,nlaggr,ilaggr,info)
|
||||
|
||||
if (psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
name = 'mld_dec_map_bld'
|
||||
name = 'mld_soc1_map_bld'
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
@@ -247,7 +247,7 @@ subroutine mld_s_dec_map_bld(iorder,theta,a,desc_a,nlaggr,ilaggr,info)
|
||||
! Find its strongly connected neighbourhood not
|
||||
! already aggregated, and make it into a new aggregate.
|
||||
!
|
||||
cpling = dzero
|
||||
cpling = szero
|
||||
ip = 0
|
||||
do k=1, nz
|
||||
j = icol(k)
|
||||
@@ -318,5 +318,5 @@ subroutine mld_s_dec_map_bld(iorder,theta,a,desc_a,nlaggr,ilaggr,info)
|
||||
|
||||
return
|
||||
|
||||
end subroutine mld_s_dec_map_bld
|
||||
end subroutine mld_s_soc1_map_bld
|
||||
|
||||
@@ -0,0 +1,330 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
! (C) Copyright 2008-2018
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Daniela di Serafino
|
||||
!
|
||||
! 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.
|
||||
! 3. The name of the MLD2P4 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
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE MLD2P4 GROUP OR ITS CONTRIBUTORS
|
||||
! 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.
|
||||
!
|
||||
!
|
||||
!
|
||||
! File: mld_s_soc2_map__bld.f90
|
||||
!
|
||||
! Subroutine: mld_s_soc2_map_bld
|
||||
! Version: real
|
||||
!
|
||||
! The aggregator object hosts the aggregation method for building
|
||||
! the multilevel hierarchy. This variant is based on the method
|
||||
! presented in
|
||||
!
|
||||
! S. Gratton, P. Henon, P. Jiranek and X. Vasseur:
|
||||
! Reducing complexity of algebraic multigrid by aggregation
|
||||
! Numerical Lin. Algebra with Applications, 2016, 23:501-518
|
||||
!
|
||||
! Note: upon exit
|
||||
!
|
||||
! Arguments:
|
||||
! a - type(psb_sspmat_type).
|
||||
! The sparse matrix structure containing the local part of the
|
||||
! matrix to be preconditioned.
|
||||
! desc_a - type(psb_desc_type), input.
|
||||
! The communication descriptor of a.
|
||||
! p - type(mld_sprec_type), input/output.
|
||||
! The preconditioner data structure; upon exit it contains
|
||||
! the multilevel hierarchy of prolongators, restrictors
|
||||
! and coarse matrices.
|
||||
! info - integer, output.
|
||||
! Error code.
|
||||
!
|
||||
!
|
||||
!
|
||||
subroutine mld_s_soc2_map_bld(iorder,theta,a,desc_a,nlaggr,ilaggr,info)
|
||||
|
||||
use psb_base_mod
|
||||
use mld_base_prec_type
|
||||
use mld_s_inner_mod!, mld_protect_name => mld_s_soc2_map_bld
|
||||
|
||||
implicit none
|
||||
|
||||
! Arguments
|
||||
integer(psb_ipk_), intent(in) :: iorder
|
||||
type(psb_sspmat_type), intent(in) :: a
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
real(psb_spk_), intent(in) :: theta
|
||||
integer(psb_ipk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_), allocatable :: ils(:), neigh(:), irow(:), icol(:),&
|
||||
& ideg(:), idxs(:), tmpaggr(:)
|
||||
real(psb_spk_), allocatable :: val(:), diag(:)
|
||||
integer(psb_ipk_) :: icnt,nlp,k,n,ia,isz,nr,nc,naggr,i,j,m, nz, ilg, ii, ip, ip1,nzcnt
|
||||
type(psb_s_csr_sparse_mat) :: acsr, muij, s_neigh
|
||||
type(psb_s_coo_sparse_mat) :: s_neigh_coo
|
||||
real(psb_spk_) :: cpling, tcl
|
||||
logical :: disjoint
|
||||
integer(psb_ipk_) :: debug_level, debug_unit,err_act
|
||||
integer(psb_ipk_) :: ictxt,np,me
|
||||
integer(psb_ipk_) :: nrow, ncol, n_ne
|
||||
character(len=20) :: name, ch_err
|
||||
|
||||
if (psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
name = 'mld_soc2_map_bld'
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
!
|
||||
ictxt=desc_a%get_context()
|
||||
call psb_info(ictxt,me,np)
|
||||
nrow = desc_a%get_local_rows()
|
||||
ncol = desc_a%get_local_cols()
|
||||
|
||||
nr = a%get_nrows()
|
||||
nc = a%get_ncols()
|
||||
allocate(ilaggr(nr),neigh(nr),ideg(nr),idxs(nr),icol(nr),stat=info)
|
||||
if(info /= psb_success_) then
|
||||
info=psb_err_alloc_request_
|
||||
call psb_errpush(info,name,i_err=(/2*nr,izero,izero,izero,izero/),&
|
||||
& a_err='integer')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
diag = a%get_diag(info)
|
||||
if(info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
call psb_errpush(info,name,a_err='psb_sp_getdiag')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
!
|
||||
! Phase zero: compute muij
|
||||
!
|
||||
call a%cp_to(muij)
|
||||
do i=1, nr
|
||||
do k=muij%irp(i),muij%irp(i+1)-1
|
||||
j = muij%ja(k)
|
||||
if (j<= nr) muij%val(k) = abs(muij%val(k))/sqrt(abs(diag(i)*diag(j)))
|
||||
end do
|
||||
end do
|
||||
!write(*,*) 'murows/cols ',maxval(mu_rows),maxval(mu_cols)
|
||||
!
|
||||
! Compute the 1-neigbour; mark strong links with +1, weak links with -1
|
||||
!
|
||||
call s_neigh_coo%allocate(nr,nr,muij%get_nzeros())
|
||||
ip = 0
|
||||
do i=1, nr
|
||||
do k=muij%irp(i),muij%irp(i+1)-1
|
||||
j = muij%ja(k)
|
||||
if (j<=nr) then
|
||||
ip = ip + 1
|
||||
s_neigh_coo%ia(ip) = i
|
||||
s_neigh_coo%ja(ip) = j
|
||||
if (real(muij%val(k)) >= theta) then
|
||||
s_neigh_coo%val(ip) = sone
|
||||
else
|
||||
s_neigh_coo%val(ip) = -sone
|
||||
end if
|
||||
end if
|
||||
end do
|
||||
end do
|
||||
!write(*,*) 'S_NEIGH: ',nr,ip
|
||||
call s_neigh_coo%set_nzeros(ip)
|
||||
call s_neigh%mv_from_coo(s_neigh_coo,info)
|
||||
|
||||
if (iorder == mld_aggr_ord_nat_) then
|
||||
do i=1, nr
|
||||
ilaggr(i) = -(nr+1)
|
||||
idxs(i) = i
|
||||
end do
|
||||
else
|
||||
do i=1, nr
|
||||
ilaggr(i) = -(nr+1)
|
||||
ideg(i) = muij%irp(i+1) - muij%irp(i)
|
||||
end do
|
||||
call psb_msort(ideg,ix=idxs,dir=psb_sort_down_)
|
||||
end if
|
||||
|
||||
|
||||
!
|
||||
! Phase one: Start with disjoint groups.
|
||||
!
|
||||
naggr = 0
|
||||
icnt = 0
|
||||
step1: do ii=1, nr
|
||||
i = idxs(ii)
|
||||
|
||||
if (ilaggr(i) == -(nr+1)) then
|
||||
!
|
||||
! Get the 1-neighbourhood of I
|
||||
!
|
||||
ip1 = s_neigh%irp(i)
|
||||
nz = s_neigh%irp(i+1)-ip1
|
||||
!
|
||||
! If the neighbourhood only contains I, skip it
|
||||
!
|
||||
if (nz ==0) then
|
||||
ilaggr(i) = 0
|
||||
cycle step1
|
||||
end if
|
||||
if ((nz==1).and.(s_neigh%ja(ip1)==i)) then
|
||||
ilaggr(i) = 0
|
||||
cycle step1
|
||||
end if
|
||||
!
|
||||
! If the whole strongly coupled neighborhood of I is
|
||||
! as yet unconnected, turn it into the next aggregate.
|
||||
!
|
||||
nzcnt = count(real(s_neigh%val(ip1:ip1+nz-1)) > 0)
|
||||
icol(1:nzcnt) = pack(s_neigh%ja(ip1:ip1+nz-1),(real(s_neigh%val(ip1:ip1+nz-1)) > 0))
|
||||
disjoint = all(ilaggr(icol(1:nzcnt)) == -(nr+1))
|
||||
if (disjoint) then
|
||||
icnt = icnt + 1
|
||||
naggr = naggr + 1
|
||||
do k=1, nzcnt
|
||||
ilaggr(icol(k)) = naggr
|
||||
end do
|
||||
ilaggr(i) = naggr
|
||||
end if
|
||||
endif
|
||||
enddo step1
|
||||
|
||||
if (debug_level >= psb_debug_outer_) then
|
||||
write(debug_unit,*) me,' ',trim(name),&
|
||||
& ' Check 1:',count(ilaggr == -(nr+1))
|
||||
end if
|
||||
|
||||
!
|
||||
! Phase two: join the neighbours
|
||||
!
|
||||
tmpaggr = ilaggr
|
||||
step2: do ii=1,nr
|
||||
i = idxs(ii)
|
||||
|
||||
if (ilaggr(i) == -(nr+1)) then
|
||||
!
|
||||
! Find the most strongly connected neighbour that is
|
||||
! already aggregated, if any, and join its aggregate
|
||||
!
|
||||
cpling = szero
|
||||
ip = 0
|
||||
do k=s_neigh%irp(i), s_neigh%irp(i+1)-1
|
||||
j = s_neigh%ja(k)
|
||||
if ((1<=j).and.(j<=nr)) then
|
||||
if ( (tmpaggr(j) > 0).and. (real(muij%val(k)) > cpling)&
|
||||
& .and.(real(s_neigh%val(k))>0)) then
|
||||
ip = k
|
||||
cpling = muij%val(k)
|
||||
end if
|
||||
end if
|
||||
enddo
|
||||
if (ip > 0) then
|
||||
ilaggr(i) = ilaggr(s_neigh%ja(ip))
|
||||
end if
|
||||
end if
|
||||
end do step2
|
||||
|
||||
|
||||
!
|
||||
! Phase three: sweep over leftovers, if any
|
||||
!
|
||||
step3: do ii=1,nr
|
||||
i = idxs(ii)
|
||||
|
||||
if (ilaggr(i) < 0) then
|
||||
!
|
||||
! Find its strongly connected neighbourhood not
|
||||
! already aggregated, and make it into a new aggregate.
|
||||
!
|
||||
ip = 0
|
||||
do k=s_neigh%irp(i), s_neigh%irp(i+1)-1
|
||||
j = s_neigh%ja(k)
|
||||
if ((1<=j).and.(j<=nr)) then
|
||||
if (ilaggr(j) < 0) then
|
||||
ip = ip + 1
|
||||
icol(ip) = j
|
||||
end if
|
||||
end if
|
||||
enddo
|
||||
if (ip > 0) then
|
||||
icnt = icnt + 1
|
||||
naggr = naggr + 1
|
||||
ilaggr(i) = naggr
|
||||
do k=1, ip
|
||||
ilaggr(icol(k)) = naggr
|
||||
end do
|
||||
end if
|
||||
end if
|
||||
end do step3
|
||||
|
||||
|
||||
if (count(ilaggr<0) >0) then
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name,a_err='Fatal error: some leftovers')
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
if (naggr > ncol) then
|
||||
write(0,*) name,'Error : naggr > ncol',naggr,ncol
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name,a_err='Fatal error: naggr>ncol')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
call psb_realloc(ncol,ilaggr,info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
ch_err='psb_realloc'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
allocate(nlaggr(np),stat=info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_alloc_request_
|
||||
call psb_errpush(info,name,i_err=(/np,izero,izero,izero,izero/),&
|
||||
& a_err='integer')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
nlaggr(:) = 0
|
||||
nlaggr(me+1) = naggr
|
||||
call psb_sum(ictxt,nlaggr(1:np))
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine mld_s_soc2_map_bld
|
||||
|
||||
@@ -0,0 +1,146 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
! (C) Copyright 2008-2018
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Daniela di Serafino
|
||||
!
|
||||
! 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.
|
||||
! 3. The name of the MLD2P4 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
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE MLD2P4 GROUP OR ITS CONTRIBUTORS
|
||||
! 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.
|
||||
!
|
||||
!
|
||||
! File: mld_s_symdec_aggregator_tprol.f90
|
||||
!
|
||||
! Subroutine: mld_s_symdec_aggregator_tprol
|
||||
! Version: real
|
||||
!
|
||||
!
|
||||
! This routine is mainly an interface to map_bld where the real work is performed.
|
||||
! It takes care of some consistency checking, and calls map_to_tprol, which is
|
||||
! refactored and shared among all the aggregation methods that produce a simple
|
||||
! integer mapping.
|
||||
!
|
||||
!
|
||||
!
|
||||
! Arguments:
|
||||
! p - type(mld_s_onelev_type), input/output.
|
||||
! The 'one-level' data structure containing the control
|
||||
! parameters and (eventually) coarse matrix and prolongator/restrictors.
|
||||
!
|
||||
! a - type(psb_sspmat_type).
|
||||
! The sparse matrix structure containing the local part of the
|
||||
! fine-level matrix.
|
||||
! desc_a - type(psb_desc_type), input.
|
||||
! The communication descriptor of a.
|
||||
! ilaggr - integer, dimension(:), allocatable, output
|
||||
! The mapping between the row indices of the coarse-level
|
||||
! matrix and the row indices of the fine-level matrix.
|
||||
! ilaggr(i)=j means that node i in the adjacency graph
|
||||
! of the fine-level matrix is mapped onto node j in the
|
||||
! adjacency graph of the coarse-level matrix. Note that on exit the indices
|
||||
! will be shifted so as to make sure the ranges on the various processes do not
|
||||
! overlap.
|
||||
! nlaggr - integer, dimension(:), allocatable, output
|
||||
! nlaggr(i) contains the aggregates held by process i.
|
||||
! op_prol - type(psb_sspmat_type), output
|
||||
! The tentative prolongator, based on ilaggr.
|
||||
!
|
||||
! info - integer, output.
|
||||
! Error code.
|
||||
!
|
||||
subroutine mld_s_symdec_aggregator_build_tprol(ag,parms,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
use psb_base_mod
|
||||
use mld_s_prec_type
|
||||
use mld_s_symdec_aggregator_mod, mld_protect_name => mld_s_symdec_aggregator_build_tprol
|
||||
use mld_s_inner_mod
|
||||
implicit none
|
||||
class(mld_s_symdec_aggregator_type), target, intent(inout) :: ag
|
||||
type(mld_sml_parms), intent(inout) :: parms
|
||||
type(psb_sspmat_type), intent(in) :: a
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
|
||||
type(psb_sspmat_type), intent(out) :: op_prol
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
! Local variables
|
||||
type(psb_sspmat_type) :: atmp, atrans
|
||||
character(len=20) :: name
|
||||
integer(psb_mpik_) :: ictxt, np, me
|
||||
integer(psb_ipk_) :: err_act
|
||||
integer(psb_ipk_) :: ntaggr, nr
|
||||
integer(psb_ipk_) :: debug_level, debug_unit
|
||||
|
||||
name='mld_s_symdec_aggregator_tprol'
|
||||
if (psb_get_errstatus().ne.0) return
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
info = psb_success_
|
||||
ictxt = desc_a%get_context()
|
||||
call psb_info(ictxt,me,np)
|
||||
|
||||
call mld_check_def(parms%ml_cycle,'Multilevel cycle',&
|
||||
& mld_mult_ml_,is_legal_ml_cycle)
|
||||
call mld_check_def(parms%par_aggr_alg,'Aggregation',&
|
||||
& mld_dec_aggr_,is_legal_ml_par_aggr_alg)
|
||||
call mld_check_def(parms%aggr_ord,'Ordering',&
|
||||
& mld_aggr_ord_nat_,is_legal_ml_aggr_ord)
|
||||
call mld_check_def(parms%aggr_thresh,'Aggr_Thresh',szero,is_legal_s_aggr_thrs)
|
||||
|
||||
nr = a%get_nrows()
|
||||
call a%csclip(atmp,info,imax=nr,jmax=nr,&
|
||||
& rscale=.false.,cscale=.false.)
|
||||
call atmp%set_nrows(nr)
|
||||
call atmp%set_ncols(nr)
|
||||
if (info == psb_success_) call atmp%transp(atrans)
|
||||
if (info == psb_success_) call atrans%cscnv(info,type='COO')
|
||||
if (info == psb_success_) call psb_rwextd(nr,atmp,info,b=atrans,rowscale=.false.)
|
||||
call atmp%set_nrows(nr)
|
||||
call atmp%set_ncols(nr)
|
||||
if (info == psb_success_) call atrans%free()
|
||||
if (info == psb_success_) call atmp%cscnv(info,type='CSR')
|
||||
|
||||
if (info == psb_success_) &
|
||||
& call ag%map_bld(parms%aggr_ord,parms%aggr_thresh,atmp,desc_a,nlaggr,ilaggr,info)
|
||||
if (info == psb_success_) call atmp%free()
|
||||
|
||||
if (info == psb_success_) call mld_map_to_tprol(desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
call psb_errpush(info,name,a_err='map_bld/map_to_tprol')
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
|
||||
end subroutine mld_s_symdec_aggregator_build_tprol
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
+32
-11
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
@@ -117,11 +117,11 @@ subroutine mld_saggrmat_nosmth_asb(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_re
|
||||
integer(psb_ipk_) :: ictxt,np,me, icomm, ndx, minfo
|
||||
character(len=20) :: name
|
||||
integer(psb_ipk_) :: ierr(5)
|
||||
type(psb_s_coo_sparse_mat) :: ac_coo, acoo
|
||||
type(psb_s_coo_sparse_mat) :: ac_coo, tmpcoo
|
||||
type(psb_s_csr_sparse_mat) :: acsr1, acsr2
|
||||
integer(psb_ipk_) :: debug_level, debug_unit
|
||||
integer(psb_ipk_) :: nrow, nglob, ncol, ntaggr, nzl, ip, &
|
||||
& naggr, nzt, naggrm1, i, k
|
||||
& naggr, nzt, naggrm1, naggrp1, i, k
|
||||
|
||||
name='mld_aggrmat_nosmth_asb'
|
||||
if(psb_get_errstatus().ne.0) return
|
||||
@@ -137,16 +137,37 @@ subroutine mld_saggrmat_nosmth_asb(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_re
|
||||
ncol = desc_a%get_local_cols()
|
||||
|
||||
|
||||
naggr = nlaggr(me+1)
|
||||
ntaggr = sum(nlaggr)
|
||||
naggrm1=sum(nlaggr(1:me))
|
||||
naggr = nlaggr(me+1)
|
||||
ntaggr = sum(nlaggr)
|
||||
naggrm1 = sum(nlaggr(1:me))
|
||||
naggrp1 = sum(nlaggr(1:me+1))
|
||||
|
||||
call acoo%allocate(ncol,ntaggr,ncol)
|
||||
|
||||
call op_prol%cscnv(info,type='csr',dupl=psb_dupl_add_)
|
||||
if (info /= psb_success_) goto 9999
|
||||
call op_prol%transp(op_restr)
|
||||
|
||||
call op_prol%cp_to(tmpcoo)
|
||||
call op_prol%cscnv(info,type='csr',dupl=psb_dupl_add_)
|
||||
|
||||
call tmpcoo%transp()
|
||||
nzl = tmpcoo%get_nzeros()
|
||||
i=0
|
||||
!
|
||||
! Now we have to fix this. The only rows of tmpcoo/op_restr that are correct
|
||||
! are those corresponding to "local" aggregates, i.e. indices in ilaggr(:)
|
||||
!
|
||||
do k=1, nzl
|
||||
if ((naggrm1 < tmpcoo%ia(k)) .and.(tmpcoo%ia(k) <= naggrp1)) then
|
||||
i = i+1
|
||||
tmpcoo%val(i) = tmpcoo%val(k)
|
||||
tmpcoo%ia(i) = tmpcoo%ia(k)
|
||||
tmpcoo%ja(i) = tmpcoo%ja(k)
|
||||
end if
|
||||
end do
|
||||
call tmpcoo%set_nzeros(i)
|
||||
! call tmpcoo%trim()
|
||||
call op_restr%mv_from(tmpcoo)
|
||||
call op_restr%cscnv(info,type='csr',dupl=psb_dupl_add_)
|
||||
|
||||
if (info /= psb_success_) goto 9999
|
||||
|
||||
call a%cp_to(ac_coo)
|
||||
|
||||
nzt = ac_coo%get_nzeros()
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
+59
-41
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
!
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
@@ -35,12 +35,20 @@
|
||||
! POSSIBILITY OF SUCH DAMAGE.
|
||||
!
|
||||
!
|
||||
! File: mld_zaggrmat_asb.f90
|
||||
! File: mld_z_dec_aggregator_mat_asb.f90
|
||||
!
|
||||
! Subroutine: mld_zaggrmat_asb
|
||||
! Subroutine: mld_z_dec_aggregator_mat_asb
|
||||
! Version: complex
|
||||
!
|
||||
! This routine builds a coarse-level matrix A_C from a fine-level matrix A
|
||||
! This routine builds the matrix associated to the current level of the
|
||||
! multilevel preconditioner from the matrix associated to the previous level,
|
||||
! by using the user-specified aggregation technique (therefore, it also builds the
|
||||
! prolongation and restriction operators mapping the current level to the
|
||||
! previous one and vice versa).
|
||||
! The current level is regarded as the coarse one, while the previous as
|
||||
! the fine one. This is in agreement with the fact that the routine is called,
|
||||
! by mld_mlprec_bld, only on levels >=2.
|
||||
! The coarse-level matrix A_C is built from a fine-level matrix A
|
||||
! by using the Galerkin approach, i.e.
|
||||
!
|
||||
! A_C = P_C^T A P_C,
|
||||
@@ -50,7 +58,7 @@
|
||||
! A mapping from the nodes of the adjacency graph of A to the nodes of the
|
||||
! adjacency graph of A_C has been computed by the mld_aggrmap_bld subroutine.
|
||||
! The prolongator P_C is built here from this mapping, according to the
|
||||
! value of p%iprcparm(mld_aggr_prol_), specified by the user through
|
||||
! value of p%iprcparm(mld_aggr_kind_), specified by the user through
|
||||
! mld_zprecinit and mld_zprecset.
|
||||
! On output from this routine the entries of AC, op_prol, op_restr
|
||||
! are still in "global numbering" mode; this is fixed in the calling routine
|
||||
@@ -64,13 +72,13 @@
|
||||
! 4. minimum energy
|
||||
! 1. The non-smoothed aggregation uses as prolongator the piecewise constant
|
||||
! interpolation operator corresponding to the fine-to-coarse level mapping built
|
||||
! by mld_aggrmap_bld. This is called tentative prolongator.
|
||||
! by p%aggr%bld_tprol. This is called tentative prolongator.
|
||||
! 2. The smoothed aggregation uses as prolongator the operator obtained by applying
|
||||
! a damped Jacobi smoother to the tentative prolongator.
|
||||
! 3. The "bizarre" aggregation uses a prolongator proposed by the authors of MLD2P4.
|
||||
! This prolongator still requires a deep analysis and testing and its use is
|
||||
! not recommended.
|
||||
! 4. Minimum energy aggregation: ADD REFERENCE.
|
||||
! 4. Minimum energy aggregation
|
||||
!
|
||||
! For more details see
|
||||
! M. Brezina and P. Vanek, A black-box iterative solver based on a two-level
|
||||
@@ -78,24 +86,28 @@
|
||||
! P. D'Ambra, D. di Serafino and S. Filippone, On the development of PSBLAS-based
|
||||
! parallel two-level Schwarz preconditioners, Appl. Num. Math., 57 (2007),
|
||||
! 1181-1196.
|
||||
! M. Sala, R. Tuminaro: A new Petrov-Galerkin smoothed aggregation preconditioner
|
||||
! for nonsymmetric linear systems, SIAM J. Sci. Comput., 31(1):143-166 (2008)
|
||||
!
|
||||
!
|
||||
! The main structure is:
|
||||
! 1. Perform sanity checks;
|
||||
! 2. Compute prolongator/restrictor/AC
|
||||
!
|
||||
!
|
||||
! Arguments:
|
||||
! ag - type(mld_z_dec_aggregator_type), input/output.
|
||||
! The aggregator object
|
||||
! parms - type(mld_dml_parms), input
|
||||
! The aggregation parameters
|
||||
! a - type(psb_zspmat_type), input.
|
||||
! The sparse matrix structure containing the local part of
|
||||
! the fine-level matrix.
|
||||
! desc_a - type(psb_desc_type), input.
|
||||
! The communication descriptor of the fine-level matrix.
|
||||
! p - type(mld_z_onelev_type), input/output.
|
||||
! The 'one-level' data structure that will contain the local
|
||||
! part of the matrix to be built as well as the information
|
||||
! concerning the prolongator and its transpose.
|
||||
! parms - type(mld_dml_parms), input
|
||||
! Parameters controlling the choice of algorithm
|
||||
! ac - type(psb_zspmat_type), output
|
||||
! The coarse matrix on output
|
||||
!
|
||||
! ilaggr - integer, dimension(:), input
|
||||
! The mapping between the row indices of the coarse-level
|
||||
! matrix and the row indices of the fine-level matrix.
|
||||
@@ -106,6 +118,9 @@
|
||||
! the various processes do not overlap.
|
||||
! nlaggr - integer, dimension(:) input
|
||||
! nlaggr(i) contains the aggregates held by process i.
|
||||
! ac - type(psb_zspmat_type), output
|
||||
! The coarse matrix on output
|
||||
!
|
||||
! op_prol - type(psb_zspmat_type), input/output
|
||||
! The tentative prolongator on input, the computed prolongator on output
|
||||
!
|
||||
@@ -114,43 +129,45 @@
|
||||
!
|
||||
! info - integer, output.
|
||||
! Error code.
|
||||
!
|
||||
subroutine mld_zaggrmat_asb(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,info)
|
||||
|
||||
!
|
||||
subroutine mld_z_dec_aggregator_mat_asb(ag,parms,a,desc_a,ilaggr,nlaggr,ac,op_prol,op_restr,info)
|
||||
use psb_base_mod
|
||||
use mld_base_prec_type
|
||||
use mld_z_inner_mod, mld_protect_name => mld_zaggrmat_asb
|
||||
|
||||
use mld_z_prec_type, mld_protect_name => mld_z_dec_aggregator_mat_asb
|
||||
use mld_z_inner_mod
|
||||
implicit none
|
||||
|
||||
class(mld_z_dec_aggregator_type), target, intent(inout) :: ag
|
||||
type(mld_dml_parms), intent(inout) :: parms
|
||||
type(psb_zspmat_type), intent(in) :: a
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(inout) :: ilaggr(:), nlaggr(:)
|
||||
type(psb_zspmat_type), intent(inout) :: op_prol
|
||||
type(psb_zspmat_type), intent(out) :: ac,op_restr
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
! Arguments
|
||||
type(psb_zspmat_type), intent(in) :: a
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(inout) :: ilaggr(:), nlaggr(:)
|
||||
type(mld_dml_parms), intent(inout) :: parms
|
||||
type(psb_zspmat_type), intent(inout) :: ac, op_prol,op_restr
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
! Local variables
|
||||
! Local variables
|
||||
character(len=20) :: name
|
||||
integer(psb_mpik_) :: ictxt, np, me
|
||||
type(psb_z_coo_sparse_mat) :: acoo, bcoo
|
||||
type(psb_z_csr_sparse_mat) :: acsr1
|
||||
integer(psb_ipk_) :: nzl,ntaggr, err_act
|
||||
integer(psb_ipk_) :: nzl,ntaggr
|
||||
integer(psb_ipk_) :: err_act
|
||||
integer(psb_ipk_) :: debug_level, debug_unit
|
||||
integer(psb_ipk_) :: ictxt,np,me
|
||||
character(len=20) :: name
|
||||
|
||||
name='mld_aggrmat_asb'
|
||||
if(psb_get_errstatus().ne.0) return
|
||||
info=psb_success_
|
||||
name='mld_z_dec_aggregator_mat_asb'
|
||||
if (psb_get_errstatus().ne.0) return
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
|
||||
|
||||
info = psb_success_
|
||||
ictxt = desc_a%get_context()
|
||||
call psb_info(ictxt,me,np)
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
|
||||
!
|
||||
! Build the coarse-level matrix from the fine-level one, starting from
|
||||
! the mapping defined by mld_aggrmap_bld and applying the aggregation
|
||||
! algorithm specified by
|
||||
!
|
||||
select case (parms%aggr_prol)
|
||||
case (mld_no_smooth_)
|
||||
|
||||
@@ -183,11 +200,12 @@ subroutine mld_zaggrmat_asb(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_restr,inf
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine mld_zaggrmat_asb
|
||||
|
||||
end subroutine mld_z_dec_aggregator_mat_asb
|
||||
+32
-61
@@ -1,7 +1,6 @@
|
||||
|
||||
!
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
@@ -36,15 +35,15 @@
|
||||
! POSSIBILITY OF SUCH DAMAGE.
|
||||
!
|
||||
!
|
||||
! File: mld_z_lev_aggrmap_bld.f90
|
||||
! File: mld_z_dec_aggregator_tprol.f90
|
||||
!
|
||||
! Subroutine: mld_z_lev_aggrmap_bld
|
||||
! Subroutine: mld_z_dec_aggregator_tprol
|
||||
! Version: complex
|
||||
!
|
||||
! This routine is just an interface to aggrmap_bld where the real work is performed.
|
||||
! It takes care of some consistency checking though.
|
||||
!
|
||||
! See mld_zaggrmap_bld for constraints on input/oput arguments.
|
||||
! This routine is mainly an interface to map_bld where the real work is performed.
|
||||
! It takes care of some consistency checking, and calls map_to_tprol, which is
|
||||
! refactored and shared among all the aggregation methods that produce a simple
|
||||
! integer mapping.
|
||||
!
|
||||
!
|
||||
! Arguments:
|
||||
@@ -73,31 +72,27 @@
|
||||
! info - integer, output.
|
||||
! Error code.
|
||||
!
|
||||
subroutine mld_z_lev_aggrmap_bld(p,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
|
||||
subroutine mld_z_dec_aggregator_build_tprol(ag,parms,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
use psb_base_mod
|
||||
use mld_base_prec_type
|
||||
use mld_z_inner_mod, mld_protect_name => mld_z_lev_aggrmap_bld
|
||||
|
||||
use mld_z_prec_type, mld_protect_name => mld_z_dec_aggregator_build_tprol
|
||||
use mld_z_inner_mod
|
||||
implicit none
|
||||
|
||||
! Arguments
|
||||
type(mld_z_onelev_type), intent(inout), target :: p
|
||||
type(psb_zspmat_type), intent(in) :: a
|
||||
class(mld_z_dec_aggregator_type), target, intent(inout) :: ag
|
||||
type(mld_dml_parms), intent(inout) :: parms
|
||||
type(psb_zspmat_type), intent(in) :: a
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
|
||||
type(psb_zspmat_type), intent(out) :: op_prol
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
|
||||
! Local variables
|
||||
character(len=20) :: name
|
||||
integer(psb_mpk_) :: ictxt, np, me
|
||||
integer(psb_ipk_) :: err_act
|
||||
integer(psb_ipk_) :: nzl, ntaggr
|
||||
character(len=20) :: name
|
||||
integer(psb_mpik_) :: ictxt, np, me
|
||||
integer(psb_ipk_) :: err_act
|
||||
integer(psb_ipk_) :: ntaggr
|
||||
integer(psb_ipk_) :: debug_level, debug_unit
|
||||
|
||||
name='mld_z_lev_aggrmap_bld'
|
||||
name='mld_z_dec_aggregator_tprol'
|
||||
if (psb_get_errstatus().ne.0) return
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
@@ -106,52 +101,28 @@ subroutine mld_z_lev_aggrmap_bld(p,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
ictxt = desc_a%get_context()
|
||||
call psb_info(ictxt,me,np)
|
||||
|
||||
call mld_check_def(p%parms%ml_cycle,'Multilevel cycle',&
|
||||
call mld_check_def(parms%ml_cycle,'Multilevel cycle',&
|
||||
& mld_mult_ml_,is_legal_ml_cycle)
|
||||
call mld_check_def(p%parms%par_aggr_alg,'Aggregation',&
|
||||
call mld_check_def(parms%par_aggr_alg,'Aggregation',&
|
||||
& mld_dec_aggr_,is_legal_ml_par_aggr_alg)
|
||||
call mld_check_def(p%parms%aggr_ord,'Ordering',&
|
||||
call mld_check_def(parms%aggr_ord,'Ordering',&
|
||||
& mld_aggr_ord_nat_,is_legal_ml_aggr_ord)
|
||||
call mld_check_def(p%parms%aggr_thresh,'Aggr_Thresh',dzero,is_legal_d_aggr_thrs)
|
||||
call mld_check_def(parms%aggr_thresh,'Aggr_Thresh',dzero,is_legal_d_aggr_thrs)
|
||||
|
||||
select case(p%parms%par_aggr_alg)
|
||||
case (mld_dec_aggr_, mld_sym_dec_aggr_)
|
||||
|
||||
!
|
||||
! Build a mapping between the row indices of the fine-level matrix
|
||||
! and the row indices of the coarse-level matrix, according to a decoupled
|
||||
! aggregation algorithm. This also defines a tentative prolongator from
|
||||
! the coarse to the fine level.
|
||||
!
|
||||
call mld_aggrmap_bld(p%parms%par_aggr_alg,p%parms%aggr_ord,p%parms%aggr_thresh,&
|
||||
& a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='mld_aggrmap_bld')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
case (mld_bcmatch_aggr_)
|
||||
write(0,*) 'Matching is not implemented yet '
|
||||
info = -1111
|
||||
call psb_errpush(psb_err_input_value_invalid_i_,name,&
|
||||
& i_err=(/ione,p%parms%par_aggr_alg,izero,izero,izero/))
|
||||
call ag%map_bld(parms%aggr_ord,parms%aggr_thresh,a,desc_a,nlaggr,ilaggr,info)
|
||||
|
||||
if (info==psb_success_) call mld_map_to_tprol(desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
call psb_errpush(info,name,a_err='map_bld/map_to_tprol')
|
||||
goto 9999
|
||||
|
||||
case default
|
||||
|
||||
info = -1
|
||||
call psb_errpush(psb_err_input_value_invalid_i_,name,&
|
||||
& i_err=(/ione,p%parms%par_aggr_alg,izero,izero,izero/))
|
||||
goto 9999
|
||||
|
||||
end select
|
||||
|
||||
endif
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
|
||||
end subroutine mld_z_lev_aggrmap_bld
|
||||
|
||||
end subroutine mld_z_dec_aggregator_build_tprol
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
@@ -9,7 +9,7 @@
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Daniela di Serafino
|
||||
!
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions
|
||||
! are met:
|
||||
@@ -35,15 +35,17 @@
|
||||
! POSSIBILITY OF SUCH DAMAGE.
|
||||
!
|
||||
!
|
||||
! File: mld_zaggrmap_bld.f90
|
||||
! File: mld_z_map_to_tprol.f90
|
||||
!
|
||||
! Subroutine: mld_zaggrmap_bld
|
||||
! Subroutine: mld_z_map_to_tprol
|
||||
! Version: complex
|
||||
!
|
||||
! This routine builds a mapping from the row indices of the fine-level matrix
|
||||
! to the row indices of the coarse-level matrix, according to a decoupled
|
||||
! aggregation algorithm. This mapping will be used by mld_aggrmat_asb to
|
||||
! build the coarse-level matrix.
|
||||
! This routine uses a mapping from the row indices of the fine-level matrix
|
||||
! to the row indices of the coarse-level matrix to build a tentative
|
||||
! prolongator, i.e. a piecewise constant operator.
|
||||
! This is later used to build the final operator; the code has been refactored here
|
||||
! to be shared among all the methods that provide the tentative prolongator
|
||||
! through a simple integer mapping.
|
||||
!
|
||||
! The aggregation algorithm is a parallel version of that described in
|
||||
! * M. Brezina and P. Vanek, A black-box iterative solver based on a
|
||||
@@ -83,28 +85,21 @@
|
||||
! info - integer, output.
|
||||
! Error code.
|
||||
!
|
||||
subroutine mld_zaggrmap_bld(aggr_type,iorder,theta,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
subroutine mld_z_map_to_tprol(desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
|
||||
use psb_base_mod
|
||||
use mld_base_prec_type
|
||||
use mld_z_inner_mod, mld_protect_name => mld_zaggrmap_bld
|
||||
use mld_z_inner_mod, mld_protect_name => mld_z_map_to_tprol
|
||||
|
||||
implicit none
|
||||
|
||||
! Arguments
|
||||
integer(psb_ipk_), intent(in) :: iorder
|
||||
integer(psb_ipk_), intent(in) :: aggr_type
|
||||
real(psb_dpk_), intent(in) :: theta
|
||||
type(psb_zspmat_type), intent(in) :: a
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
|
||||
integer(psb_ipk_), allocatable, intent(inout) :: ilaggr(:),nlaggr(:)
|
||||
type(psb_zspmat_type), intent(out) :: op_prol
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_), allocatable :: ils(:), neigh(:)
|
||||
integer(psb_ipk_) :: icnt,nlp,k,n,ia,isz,nr, naggr,i,j,m,naggrm1, naggrp1, ntaggr
|
||||
type(psb_zspmat_type) :: atmp, atrans
|
||||
type(psb_z_coo_sparse_mat) :: tmpcoo
|
||||
integer(psb_ipk_) :: debug_level, debug_unit,err_act
|
||||
integer(psb_ipk_) :: ictxt,np,me
|
||||
@@ -113,7 +108,7 @@ subroutine mld_zaggrmap_bld(aggr_type,iorder,theta,a,desc_a,ilaggr,nlaggr,op_pro
|
||||
|
||||
if(psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
name = 'mld_aggrmap_bld'
|
||||
name = 'mld_map_to_tprol'
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
@@ -123,40 +118,6 @@ subroutine mld_zaggrmap_bld(aggr_type,iorder,theta,a,desc_a,ilaggr,nlaggr,op_pro
|
||||
nrow = desc_a%get_local_rows()
|
||||
ncol = desc_a%get_local_cols()
|
||||
|
||||
select case (aggr_type)
|
||||
case (mld_dec_aggr_)
|
||||
call mld_dec_map_bld(iorder,theta,a,desc_a,nlaggr,ilaggr,info)
|
||||
|
||||
case (mld_sym_dec_aggr_)
|
||||
nr = a%get_nrows()
|
||||
call a%csclip(atmp,info,imax=nr,jmax=nr,&
|
||||
& rscale=.false.,cscale=.false.)
|
||||
call atmp%set_nrows(nr)
|
||||
call atmp%set_ncols(nr)
|
||||
if (info == psb_success_) call atmp%transp(atrans)
|
||||
if (info == psb_success_) call atrans%cscnv(info,type='COO')
|
||||
if (info == psb_success_) call psb_rwextd(nr,atmp,info,b=atrans,rowscale=.false.)
|
||||
call atmp%set_nrows(nr)
|
||||
call atmp%set_ncols(nr)
|
||||
if (info == psb_success_) call atrans%free()
|
||||
if (info == psb_success_) call atmp%cscnv(info,type='CSR')
|
||||
if (info == psb_success_) call mld_dec_map_bld(iorder,theta,atmp,desc_a,nlaggr,ilaggr,info)
|
||||
if (info == psb_success_) call atmp%free()
|
||||
|
||||
case default
|
||||
|
||||
info = -1
|
||||
call psb_errpush(psb_err_input_value_invalid_i_,name,&
|
||||
& i_err=(/ione,aggr_type,izero,izero,izero/))
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name,a_err='dec_map_bld')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
naggr = nlaggr(me+1)
|
||||
ntaggr = sum(nlaggr)
|
||||
naggrm1 = sum(nlaggr(1:me))
|
||||
@@ -186,4 +147,4 @@ subroutine mld_zaggrmap_bld(aggr_type,iorder,theta,a,desc_a,ilaggr,nlaggr,op_pro
|
||||
|
||||
return
|
||||
|
||||
end subroutine mld_zaggrmap_bld
|
||||
end subroutine mld_z_map_to_tprol
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
@@ -36,13 +36,13 @@
|
||||
!
|
||||
!
|
||||
!
|
||||
! File: mld_z_dec_map__bld.f90
|
||||
! File: mld_z_soc1_map__bld.f90
|
||||
!
|
||||
! Subroutine: mld_z_dec_map_bld
|
||||
! Subroutine: mld_z_soc1_map_bld
|
||||
! Version: complex
|
||||
!
|
||||
! This routine builds the tentative prolongator based on the
|
||||
! decoupled aggregation algorithm presented in
|
||||
! strength of connection aggregation algorithm presented in
|
||||
!
|
||||
! M. Brezina and P. Vanek, A black-box iterative solver based on a
|
||||
! two-level Schwarz method, Computing, 63 (1999), 233-263.
|
||||
@@ -67,11 +67,11 @@
|
||||
!
|
||||
!
|
||||
!
|
||||
subroutine mld_z_dec_map_bld(iorder,theta,a,desc_a,nlaggr,ilaggr,info)
|
||||
subroutine mld_z_soc1_map_bld(iorder,theta,a,desc_a,nlaggr,ilaggr,info)
|
||||
|
||||
use psb_base_mod
|
||||
use mld_base_prec_type
|
||||
use mld_z_inner_mod, mld_protect_name => mld_z_dec_map_bld
|
||||
use mld_z_inner_mod!, mld_protect_name => mld_z_soc1_map_bld
|
||||
|
||||
implicit none
|
||||
|
||||
@@ -98,7 +98,7 @@ subroutine mld_z_dec_map_bld(iorder,theta,a,desc_a,nlaggr,ilaggr,info)
|
||||
|
||||
if (psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
name = 'mld_dec_map_bld'
|
||||
name = 'mld_soc1_map_bld'
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
@@ -318,5 +318,5 @@ subroutine mld_z_dec_map_bld(iorder,theta,a,desc_a,nlaggr,ilaggr,info)
|
||||
|
||||
return
|
||||
|
||||
end subroutine mld_z_dec_map_bld
|
||||
end subroutine mld_z_soc1_map_bld
|
||||
|
||||
@@ -0,0 +1,330 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
! (C) Copyright 2008-2018
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Daniela di Serafino
|
||||
!
|
||||
! 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.
|
||||
! 3. The name of the MLD2P4 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
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE MLD2P4 GROUP OR ITS CONTRIBUTORS
|
||||
! 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.
|
||||
!
|
||||
!
|
||||
!
|
||||
! File: mld_z_soc2_map__bld.f90
|
||||
!
|
||||
! Subroutine: mld_z_soc2_map_bld
|
||||
! Version: complex
|
||||
!
|
||||
! The aggregator object hosts the aggregation method for building
|
||||
! the multilevel hierarchy. This variant is based on the method
|
||||
! presented in
|
||||
!
|
||||
! S. Gratton, P. Henon, P. Jiranek and X. Vasseur:
|
||||
! Reducing complexity of algebraic multigrid by aggregation
|
||||
! Numerical Lin. Algebra with Applications, 2016, 23:501-518
|
||||
!
|
||||
! Note: upon exit
|
||||
!
|
||||
! Arguments:
|
||||
! a - type(psb_zspmat_type).
|
||||
! The sparse matrix structure containing the local part of the
|
||||
! matrix to be preconditioned.
|
||||
! desc_a - type(psb_desc_type), input.
|
||||
! The communication descriptor of a.
|
||||
! p - type(mld_zprec_type), input/output.
|
||||
! The preconditioner data structure; upon exit it contains
|
||||
! the multilevel hierarchy of prolongators, restrictors
|
||||
! and coarse matrices.
|
||||
! info - integer, output.
|
||||
! Error code.
|
||||
!
|
||||
!
|
||||
!
|
||||
subroutine mld_z_soc2_map_bld(iorder,theta,a,desc_a,nlaggr,ilaggr,info)
|
||||
|
||||
use psb_base_mod
|
||||
use mld_base_prec_type
|
||||
use mld_z_inner_mod!, mld_protect_name => mld_z_soc2_map_bld
|
||||
|
||||
implicit none
|
||||
|
||||
! Arguments
|
||||
integer(psb_ipk_), intent(in) :: iorder
|
||||
type(psb_zspmat_type), intent(in) :: a
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
real(psb_dpk_), intent(in) :: theta
|
||||
integer(psb_ipk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_), allocatable :: ils(:), neigh(:), irow(:), icol(:),&
|
||||
& ideg(:), idxs(:), tmpaggr(:)
|
||||
complex(psb_dpk_), allocatable :: val(:), diag(:)
|
||||
integer(psb_ipk_) :: icnt,nlp,k,n,ia,isz,nr,nc,naggr,i,j,m, nz, ilg, ii, ip, ip1,nzcnt
|
||||
type(psb_z_csr_sparse_mat) :: acsr, muij, s_neigh
|
||||
type(psb_z_coo_sparse_mat) :: s_neigh_coo
|
||||
real(psb_dpk_) :: cpling, tcl
|
||||
logical :: disjoint
|
||||
integer(psb_ipk_) :: debug_level, debug_unit,err_act
|
||||
integer(psb_ipk_) :: ictxt,np,me
|
||||
integer(psb_ipk_) :: nrow, ncol, n_ne
|
||||
character(len=20) :: name, ch_err
|
||||
|
||||
if (psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
name = 'mld_soc2_map_bld'
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
!
|
||||
ictxt=desc_a%get_context()
|
||||
call psb_info(ictxt,me,np)
|
||||
nrow = desc_a%get_local_rows()
|
||||
ncol = desc_a%get_local_cols()
|
||||
|
||||
nr = a%get_nrows()
|
||||
nc = a%get_ncols()
|
||||
allocate(ilaggr(nr),neigh(nr),ideg(nr),idxs(nr),icol(nr),stat=info)
|
||||
if(info /= psb_success_) then
|
||||
info=psb_err_alloc_request_
|
||||
call psb_errpush(info,name,i_err=(/2*nr,izero,izero,izero,izero/),&
|
||||
& a_err='integer')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
diag = a%get_diag(info)
|
||||
if(info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
call psb_errpush(info,name,a_err='psb_sp_getdiag')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
!
|
||||
! Phase zero: compute muij
|
||||
!
|
||||
call a%cp_to(muij)
|
||||
do i=1, nr
|
||||
do k=muij%irp(i),muij%irp(i+1)-1
|
||||
j = muij%ja(k)
|
||||
if (j<= nr) muij%val(k) = abs(muij%val(k))/sqrt(abs(diag(i)*diag(j)))
|
||||
end do
|
||||
end do
|
||||
!write(*,*) 'murows/cols ',maxval(mu_rows),maxval(mu_cols)
|
||||
!
|
||||
! Compute the 1-neigbour; mark strong links with +1, weak links with -1
|
||||
!
|
||||
call s_neigh_coo%allocate(nr,nr,muij%get_nzeros())
|
||||
ip = 0
|
||||
do i=1, nr
|
||||
do k=muij%irp(i),muij%irp(i+1)-1
|
||||
j = muij%ja(k)
|
||||
if (j<=nr) then
|
||||
ip = ip + 1
|
||||
s_neigh_coo%ia(ip) = i
|
||||
s_neigh_coo%ja(ip) = j
|
||||
if (real(muij%val(k)) >= theta) then
|
||||
s_neigh_coo%val(ip) = done
|
||||
else
|
||||
s_neigh_coo%val(ip) = -done
|
||||
end if
|
||||
end if
|
||||
end do
|
||||
end do
|
||||
!write(*,*) 'S_NEIGH: ',nr,ip
|
||||
call s_neigh_coo%set_nzeros(ip)
|
||||
call s_neigh%mv_from_coo(s_neigh_coo,info)
|
||||
|
||||
if (iorder == mld_aggr_ord_nat_) then
|
||||
do i=1, nr
|
||||
ilaggr(i) = -(nr+1)
|
||||
idxs(i) = i
|
||||
end do
|
||||
else
|
||||
do i=1, nr
|
||||
ilaggr(i) = -(nr+1)
|
||||
ideg(i) = muij%irp(i+1) - muij%irp(i)
|
||||
end do
|
||||
call psb_msort(ideg,ix=idxs,dir=psb_sort_down_)
|
||||
end if
|
||||
|
||||
|
||||
!
|
||||
! Phase one: Start with disjoint groups.
|
||||
!
|
||||
naggr = 0
|
||||
icnt = 0
|
||||
step1: do ii=1, nr
|
||||
i = idxs(ii)
|
||||
|
||||
if (ilaggr(i) == -(nr+1)) then
|
||||
!
|
||||
! Get the 1-neighbourhood of I
|
||||
!
|
||||
ip1 = s_neigh%irp(i)
|
||||
nz = s_neigh%irp(i+1)-ip1
|
||||
!
|
||||
! If the neighbourhood only contains I, skip it
|
||||
!
|
||||
if (nz ==0) then
|
||||
ilaggr(i) = 0
|
||||
cycle step1
|
||||
end if
|
||||
if ((nz==1).and.(s_neigh%ja(ip1)==i)) then
|
||||
ilaggr(i) = 0
|
||||
cycle step1
|
||||
end if
|
||||
!
|
||||
! If the whole strongly coupled neighborhood of I is
|
||||
! as yet unconnected, turn it into the next aggregate.
|
||||
!
|
||||
nzcnt = count(real(s_neigh%val(ip1:ip1+nz-1)) > 0)
|
||||
icol(1:nzcnt) = pack(s_neigh%ja(ip1:ip1+nz-1),(real(s_neigh%val(ip1:ip1+nz-1)) > 0))
|
||||
disjoint = all(ilaggr(icol(1:nzcnt)) == -(nr+1))
|
||||
if (disjoint) then
|
||||
icnt = icnt + 1
|
||||
naggr = naggr + 1
|
||||
do k=1, nzcnt
|
||||
ilaggr(icol(k)) = naggr
|
||||
end do
|
||||
ilaggr(i) = naggr
|
||||
end if
|
||||
endif
|
||||
enddo step1
|
||||
|
||||
if (debug_level >= psb_debug_outer_) then
|
||||
write(debug_unit,*) me,' ',trim(name),&
|
||||
& ' Check 1:',count(ilaggr == -(nr+1))
|
||||
end if
|
||||
|
||||
!
|
||||
! Phase two: join the neighbours
|
||||
!
|
||||
tmpaggr = ilaggr
|
||||
step2: do ii=1,nr
|
||||
i = idxs(ii)
|
||||
|
||||
if (ilaggr(i) == -(nr+1)) then
|
||||
!
|
||||
! Find the most strongly connected neighbour that is
|
||||
! already aggregated, if any, and join its aggregate
|
||||
!
|
||||
cpling = dzero
|
||||
ip = 0
|
||||
do k=s_neigh%irp(i), s_neigh%irp(i+1)-1
|
||||
j = s_neigh%ja(k)
|
||||
if ((1<=j).and.(j<=nr)) then
|
||||
if ( (tmpaggr(j) > 0).and. (real(muij%val(k)) > cpling)&
|
||||
& .and.(real(s_neigh%val(k))>0)) then
|
||||
ip = k
|
||||
cpling = muij%val(k)
|
||||
end if
|
||||
end if
|
||||
enddo
|
||||
if (ip > 0) then
|
||||
ilaggr(i) = ilaggr(s_neigh%ja(ip))
|
||||
end if
|
||||
end if
|
||||
end do step2
|
||||
|
||||
|
||||
!
|
||||
! Phase three: sweep over leftovers, if any
|
||||
!
|
||||
step3: do ii=1,nr
|
||||
i = idxs(ii)
|
||||
|
||||
if (ilaggr(i) < 0) then
|
||||
!
|
||||
! Find its strongly connected neighbourhood not
|
||||
! already aggregated, and make it into a new aggregate.
|
||||
!
|
||||
ip = 0
|
||||
do k=s_neigh%irp(i), s_neigh%irp(i+1)-1
|
||||
j = s_neigh%ja(k)
|
||||
if ((1<=j).and.(j<=nr)) then
|
||||
if (ilaggr(j) < 0) then
|
||||
ip = ip + 1
|
||||
icol(ip) = j
|
||||
end if
|
||||
end if
|
||||
enddo
|
||||
if (ip > 0) then
|
||||
icnt = icnt + 1
|
||||
naggr = naggr + 1
|
||||
ilaggr(i) = naggr
|
||||
do k=1, ip
|
||||
ilaggr(icol(k)) = naggr
|
||||
end do
|
||||
end if
|
||||
end if
|
||||
end do step3
|
||||
|
||||
|
||||
if (count(ilaggr<0) >0) then
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name,a_err='Fatal error: some leftovers')
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
if (naggr > ncol) then
|
||||
write(0,*) name,'Error : naggr > ncol',naggr,ncol
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name,a_err='Fatal error: naggr>ncol')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
call psb_realloc(ncol,ilaggr,info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
ch_err='psb_realloc'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
allocate(nlaggr(np),stat=info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_alloc_request_
|
||||
call psb_errpush(info,name,i_err=(/np,izero,izero,izero,izero/),&
|
||||
& a_err='integer')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
nlaggr(:) = 0
|
||||
nlaggr(me+1) = naggr
|
||||
call psb_sum(ictxt,nlaggr(1:np))
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine mld_z_soc2_map_bld
|
||||
|
||||
@@ -0,0 +1,146 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
! (C) Copyright 2008-2018
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Daniela di Serafino
|
||||
!
|
||||
! 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.
|
||||
! 3. The name of the MLD2P4 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
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE MLD2P4 GROUP OR ITS CONTRIBUTORS
|
||||
! 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.
|
||||
!
|
||||
!
|
||||
! File: mld_z_symdec_aggregator_tprol.f90
|
||||
!
|
||||
! Subroutine: mld_z_symdec_aggregator_tprol
|
||||
! Version: complex
|
||||
!
|
||||
!
|
||||
! This routine is mainly an interface to map_bld where the real work is performed.
|
||||
! It takes care of some consistency checking, and calls map_to_tprol, which is
|
||||
! refactored and shared among all the aggregation methods that produce a simple
|
||||
! integer mapping.
|
||||
!
|
||||
!
|
||||
!
|
||||
! Arguments:
|
||||
! p - type(mld_z_onelev_type), input/output.
|
||||
! The 'one-level' data structure containing the control
|
||||
! parameters and (eventually) coarse matrix and prolongator/restrictors.
|
||||
!
|
||||
! a - type(psb_zspmat_type).
|
||||
! The sparse matrix structure containing the local part of the
|
||||
! fine-level matrix.
|
||||
! desc_a - type(psb_desc_type), input.
|
||||
! The communication descriptor of a.
|
||||
! ilaggr - integer, dimension(:), allocatable, output
|
||||
! The mapping between the row indices of the coarse-level
|
||||
! matrix and the row indices of the fine-level matrix.
|
||||
! ilaggr(i)=j means that node i in the adjacency graph
|
||||
! of the fine-level matrix is mapped onto node j in the
|
||||
! adjacency graph of the coarse-level matrix. Note that on exit the indices
|
||||
! will be shifted so as to make sure the ranges on the various processes do not
|
||||
! overlap.
|
||||
! nlaggr - integer, dimension(:), allocatable, output
|
||||
! nlaggr(i) contains the aggregates held by process i.
|
||||
! op_prol - type(psb_zspmat_type), output
|
||||
! The tentative prolongator, based on ilaggr.
|
||||
!
|
||||
! info - integer, output.
|
||||
! Error code.
|
||||
!
|
||||
subroutine mld_z_symdec_aggregator_build_tprol(ag,parms,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
use psb_base_mod
|
||||
use mld_z_prec_type
|
||||
use mld_z_symdec_aggregator_mod, mld_protect_name => mld_z_symdec_aggregator_build_tprol
|
||||
use mld_z_inner_mod
|
||||
implicit none
|
||||
class(mld_z_symdec_aggregator_type), target, intent(inout) :: ag
|
||||
type(mld_dml_parms), intent(inout) :: parms
|
||||
type(psb_zspmat_type), intent(in) :: a
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
|
||||
type(psb_zspmat_type), intent(out) :: op_prol
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
! Local variables
|
||||
type(psb_zspmat_type) :: atmp, atrans
|
||||
character(len=20) :: name
|
||||
integer(psb_mpik_) :: ictxt, np, me
|
||||
integer(psb_ipk_) :: err_act
|
||||
integer(psb_ipk_) :: ntaggr, nr
|
||||
integer(psb_ipk_) :: debug_level, debug_unit
|
||||
|
||||
name='mld_z_symdec_aggregator_tprol'
|
||||
if (psb_get_errstatus().ne.0) return
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
info = psb_success_
|
||||
ictxt = desc_a%get_context()
|
||||
call psb_info(ictxt,me,np)
|
||||
|
||||
call mld_check_def(parms%ml_cycle,'Multilevel cycle',&
|
||||
& mld_mult_ml_,is_legal_ml_cycle)
|
||||
call mld_check_def(parms%par_aggr_alg,'Aggregation',&
|
||||
& mld_dec_aggr_,is_legal_ml_par_aggr_alg)
|
||||
call mld_check_def(parms%aggr_ord,'Ordering',&
|
||||
& mld_aggr_ord_nat_,is_legal_ml_aggr_ord)
|
||||
call mld_check_def(parms%aggr_thresh,'Aggr_Thresh',dzero,is_legal_d_aggr_thrs)
|
||||
|
||||
nr = a%get_nrows()
|
||||
call a%csclip(atmp,info,imax=nr,jmax=nr,&
|
||||
& rscale=.false.,cscale=.false.)
|
||||
call atmp%set_nrows(nr)
|
||||
call atmp%set_ncols(nr)
|
||||
if (info == psb_success_) call atmp%transp(atrans)
|
||||
if (info == psb_success_) call atrans%cscnv(info,type='COO')
|
||||
if (info == psb_success_) call psb_rwextd(nr,atmp,info,b=atrans,rowscale=.false.)
|
||||
call atmp%set_nrows(nr)
|
||||
call atmp%set_ncols(nr)
|
||||
if (info == psb_success_) call atrans%free()
|
||||
if (info == psb_success_) call atmp%cscnv(info,type='CSR')
|
||||
|
||||
if (info == psb_success_) &
|
||||
& call ag%map_bld(parms%aggr_ord,parms%aggr_thresh,atmp,desc_a,nlaggr,ilaggr,info)
|
||||
if (info == psb_success_) call atmp%free()
|
||||
|
||||
if (info == psb_success_) call mld_map_to_tprol(desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
call psb_errpush(info,name,a_err='map_bld/map_to_tprol')
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
|
||||
end subroutine mld_z_symdec_aggregator_build_tprol
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
+32
-11
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
@@ -117,11 +117,11 @@ subroutine mld_zaggrmat_nosmth_asb(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_re
|
||||
integer(psb_ipk_) :: ictxt,np,me, icomm, ndx, minfo
|
||||
character(len=20) :: name
|
||||
integer(psb_ipk_) :: ierr(5)
|
||||
type(psb_z_coo_sparse_mat) :: ac_coo, acoo
|
||||
type(psb_z_coo_sparse_mat) :: ac_coo, tmpcoo
|
||||
type(psb_z_csr_sparse_mat) :: acsr1, acsr2
|
||||
integer(psb_ipk_) :: debug_level, debug_unit
|
||||
integer(psb_ipk_) :: nrow, nglob, ncol, ntaggr, nzl, ip, &
|
||||
& naggr, nzt, naggrm1, i, k
|
||||
& naggr, nzt, naggrm1, naggrp1, i, k
|
||||
|
||||
name='mld_aggrmat_nosmth_asb'
|
||||
if(psb_get_errstatus().ne.0) return
|
||||
@@ -137,16 +137,37 @@ subroutine mld_zaggrmat_nosmth_asb(a,desc_a,ilaggr,nlaggr,parms,ac,op_prol,op_re
|
||||
ncol = desc_a%get_local_cols()
|
||||
|
||||
|
||||
naggr = nlaggr(me+1)
|
||||
ntaggr = sum(nlaggr)
|
||||
naggrm1=sum(nlaggr(1:me))
|
||||
naggr = nlaggr(me+1)
|
||||
ntaggr = sum(nlaggr)
|
||||
naggrm1 = sum(nlaggr(1:me))
|
||||
naggrp1 = sum(nlaggr(1:me+1))
|
||||
|
||||
call acoo%allocate(ncol,ntaggr,ncol)
|
||||
|
||||
call op_prol%cscnv(info,type='csr',dupl=psb_dupl_add_)
|
||||
if (info /= psb_success_) goto 9999
|
||||
call op_prol%transp(op_restr)
|
||||
|
||||
call op_prol%cp_to(tmpcoo)
|
||||
call op_prol%cscnv(info,type='csr',dupl=psb_dupl_add_)
|
||||
|
||||
call tmpcoo%transp()
|
||||
nzl = tmpcoo%get_nzeros()
|
||||
i=0
|
||||
!
|
||||
! Now we have to fix this. The only rows of tmpcoo/op_restr that are correct
|
||||
! are those corresponding to "local" aggregates, i.e. indices in ilaggr(:)
|
||||
!
|
||||
do k=1, nzl
|
||||
if ((naggrm1 < tmpcoo%ia(k)) .and.(tmpcoo%ia(k) <= naggrp1)) then
|
||||
i = i+1
|
||||
tmpcoo%val(i) = tmpcoo%val(k)
|
||||
tmpcoo%ia(i) = tmpcoo%ia(k)
|
||||
tmpcoo%ja(i) = tmpcoo%ja(k)
|
||||
end if
|
||||
end do
|
||||
call tmpcoo%set_nzeros(i)
|
||||
! call tmpcoo%trim()
|
||||
call op_restr%mv_from(tmpcoo)
|
||||
call op_restr%cscnv(info,type='csr',dupl=psb_dupl_add_)
|
||||
|
||||
if (info /= psb_success_) goto 9999
|
||||
|
||||
call a%cp_to(ac_coo)
|
||||
|
||||
nzt = ac_coo%get_nzeros()
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
@@ -17,6 +17,8 @@ mld_c_base_onelev_csetr.o \
|
||||
mld_c_base_onelev_descr.o \
|
||||
mld_c_base_onelev_dump.o \
|
||||
mld_c_base_onelev_free.o \
|
||||
mld_c_base_onelev_mat_asb.o \
|
||||
mld_c_base_onelev_setag.o \
|
||||
mld_c_base_onelev_setc.o \
|
||||
mld_c_base_onelev_seti.o \
|
||||
mld_c_base_onelev_setr.o \
|
||||
@@ -31,6 +33,8 @@ mld_d_base_onelev_csetr.o \
|
||||
mld_d_base_onelev_descr.o \
|
||||
mld_d_base_onelev_dump.o \
|
||||
mld_d_base_onelev_free.o \
|
||||
mld_d_base_onelev_mat_asb.o \
|
||||
mld_d_base_onelev_setag.o \
|
||||
mld_d_base_onelev_setc.o \
|
||||
mld_d_base_onelev_seti.o \
|
||||
mld_d_base_onelev_setr.o \
|
||||
@@ -45,6 +49,8 @@ mld_s_base_onelev_csetr.o \
|
||||
mld_s_base_onelev_descr.o \
|
||||
mld_s_base_onelev_dump.o \
|
||||
mld_s_base_onelev_free.o \
|
||||
mld_s_base_onelev_mat_asb.o \
|
||||
mld_s_base_onelev_setag.o \
|
||||
mld_s_base_onelev_setc.o \
|
||||
mld_s_base_onelev_seti.o \
|
||||
mld_s_base_onelev_setr.o \
|
||||
@@ -59,6 +65,8 @@ mld_z_base_onelev_csetr.o \
|
||||
mld_z_base_onelev_descr.o \
|
||||
mld_z_base_onelev_dump.o \
|
||||
mld_z_base_onelev_free.o \
|
||||
mld_z_base_onelev_mat_asb.o \
|
||||
mld_z_base_onelev_setag.o \
|
||||
mld_z_base_onelev_setc.o \
|
||||
mld_z_base_onelev_seti.o \
|
||||
mld_z_base_onelev_setr.o \
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
@@ -39,6 +39,9 @@ subroutine mld_c_base_onelev_cseti(lv,what,val,info,pos)
|
||||
|
||||
use psb_base_mod
|
||||
use mld_c_onelev_mod, mld_protect_name => mld_c_base_onelev_cseti
|
||||
use mld_c_base_aggregator_mod
|
||||
use mld_c_dec_aggregator_mod
|
||||
use mld_c_symdec_aggregator_mod
|
||||
use mld_c_jac_smoother
|
||||
use mld_c_as_smoother
|
||||
use mld_c_diag_solver
|
||||
@@ -182,12 +185,31 @@ subroutine mld_c_base_onelev_cseti(lv,what,val,info,pos)
|
||||
|
||||
case ('PAR_AGGR_ALG')
|
||||
lv%parms%par_aggr_alg = val
|
||||
|
||||
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)
|
||||
case(mld_dec_aggr_)
|
||||
allocate(mld_c_dec_aggregator_type :: lv%aggr, stat=info)
|
||||
case(mld_sym_dec_aggr_)
|
||||
allocate(mld_c_symdec_aggregator_type :: lv%aggr, stat=info)
|
||||
case default
|
||||
info = psb_err_internal_error_
|
||||
end select
|
||||
if (info == psb_success_) call lv%aggr%default()
|
||||
|
||||
case ('AGGR_ORD')
|
||||
lv%parms%aggr_ord = val
|
||||
|
||||
case ('AGGR_TYPE')
|
||||
lv%parms%aggr_type = val
|
||||
if (allocated(lv%aggr)) call lv%aggr%set_aggr_type(lv%parms,info)
|
||||
|
||||
case ('AGGR_PROL')
|
||||
lv%parms%aggr_prol = val
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
@@ -66,9 +66,18 @@ subroutine mld_c_base_onelev_descr(lv,il,nl,ilmin,info,iout)
|
||||
|
||||
write(iout_,*)
|
||||
if (il == ilmin) then
|
||||
call lv%parms%mldescr(iout_,info)
|
||||
call lv%parms%mlcycledsc(iout_,info)
|
||||
if (allocated(lv%aggr)) then
|
||||
call lv%aggr%descr(lv%parms,iout_,info)
|
||||
else
|
||||
write(iout_,*) 'Internal error: unallocated aggregator object'
|
||||
info = psb_err_internal_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
write(iout_,*)
|
||||
end if
|
||||
|
||||
if (il > 1) then
|
||||
|
||||
if (coarse) then
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
|
||||
+40
-40
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
@@ -35,9 +35,9 @@
|
||||
! POSSIBILITY OF SUCH DAMAGE.
|
||||
!
|
||||
!
|
||||
! File: mld_c_lev_aggrmat_asb.f90
|
||||
! File: mld_c_onelev_mat_asb.f90
|
||||
!
|
||||
! Subroutine: mld_c_lev_aggrmat_asb
|
||||
! Subroutine: mld_c_onelev_mat_asb
|
||||
! Version: complex
|
||||
!
|
||||
! This routine builds the matrix associated to the current level of the
|
||||
@@ -83,16 +83,16 @@
|
||||
! info - integer, output.
|
||||
! Error code.
|
||||
!
|
||||
subroutine mld_c_lev_aggrmat_asb(p,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
subroutine mld_c_base_onelev_mat_asb(lv,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
|
||||
use psb_base_mod
|
||||
use mld_base_prec_type
|
||||
use mld_c_inner_mod, mld_protect_name => mld_c_lev_aggrmat_asb
|
||||
use mld_c_onelev_mod, mld_protect_name => mld_c_base_onelev_mat_asb
|
||||
|
||||
implicit none
|
||||
|
||||
! Arguments
|
||||
type(mld_c_onelev_type), intent(inout), target :: p
|
||||
class(mld_c_onelev_type), intent(inout), target :: lv
|
||||
type(psb_cspmat_type), intent(in) :: a
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(inout) :: ilaggr(:),nlaggr(:)
|
||||
@@ -101,7 +101,7 @@ subroutine mld_c_lev_aggrmat_asb(p,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
|
||||
|
||||
! Local variables
|
||||
character(len=20) :: name
|
||||
character(len=24) :: name
|
||||
integer(psb_mpk_) :: ictxt, np, me
|
||||
integer(psb_ipk_) :: err_act
|
||||
type(psb_cspmat_type) :: ac, op_restr
|
||||
@@ -110,7 +110,7 @@ subroutine mld_c_lev_aggrmat_asb(p,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
integer(psb_ipk_) :: nzl, ntaggr
|
||||
integer(psb_ipk_) :: debug_level, debug_unit
|
||||
|
||||
name='mld_c_lev_aggrmat_asb'
|
||||
name='mld_c_onelev_mat_asb'
|
||||
if (psb_get_errstatus().ne.0) return
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
@@ -119,25 +119,25 @@ subroutine mld_c_lev_aggrmat_asb(p,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
ictxt = desc_a%get_context()
|
||||
call psb_info(ictxt,me,np)
|
||||
|
||||
call mld_check_def(p%parms%aggr_prol,'Smoother',&
|
||||
call mld_check_def(lv%parms%aggr_prol,'Smoother',&
|
||||
& mld_smooth_prol_,is_legal_ml_aggr_prol)
|
||||
call mld_check_def(p%parms%coarse_mat,'Coarse matrix',&
|
||||
call mld_check_def(lv%parms%coarse_mat,'Coarse matrix',&
|
||||
& mld_distr_mat_,is_legal_ml_coarse_mat)
|
||||
call mld_check_def(p%parms%aggr_filter,'Use filtered matrix',&
|
||||
call mld_check_def(lv%parms%aggr_filter,'Use filtered matrix',&
|
||||
& mld_no_filter_mat_,is_legal_aggr_filter)
|
||||
call mld_check_def(p%parms%aggr_omega_alg,'Omega Alg.',&
|
||||
call mld_check_def(lv%parms%aggr_omega_alg,'Omega Alg.',&
|
||||
& mld_eig_est_,is_legal_ml_aggr_omega_alg)
|
||||
call mld_check_def(p%parms%aggr_eig,'Eigenvalue estimate',&
|
||||
call mld_check_def(lv%parms%aggr_eig,'Eigenvalue estimate',&
|
||||
& mld_max_norm_,is_legal_ml_aggr_eig)
|
||||
call mld_check_def(p%parms%aggr_omega_val,'Omega',szero,is_legal_s_omega)
|
||||
call mld_check_def(lv%parms%aggr_omega_val,'Omega',szero,is_legal_s_omega)
|
||||
|
||||
|
||||
!
|
||||
! Build the coarse-level matrix from the fine-level one, starting from
|
||||
! the mapping defined by mld_aggrmap_bld and applying the aggregation
|
||||
! algorithm specified by p%iprcparm(mld_aggr_prol_)
|
||||
! algorithm specified by lv%iprcparm(mld_aggr_prol_)
|
||||
!
|
||||
call mld_caggrmat_asb(a,desc_a,ilaggr,nlaggr,p%parms,ac,op_prol,op_restr,info)
|
||||
call lv%aggr%mat_asb(lv%parms,a,desc_a,ilaggr,nlaggr,ac,op_prol,op_restr,info)
|
||||
|
||||
if(info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='mld_aggrmat_asb')
|
||||
@@ -149,31 +149,31 @@ subroutine mld_c_lev_aggrmat_asb(p,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
|
||||
ntaggr = sum(nlaggr)
|
||||
|
||||
select case(p%parms%coarse_mat)
|
||||
select case(lv%parms%coarse_mat)
|
||||
|
||||
case(mld_distr_mat_)
|
||||
|
||||
call ac%mv_to(bcoo)
|
||||
nzl = bcoo%get_nzeros()
|
||||
|
||||
if (info == psb_success_) call psb_cdall(ictxt,p%desc_ac,info,nl=nlaggr(me+1))
|
||||
if (info == psb_success_) call psb_cdins(nzl,bcoo%ia,bcoo%ja,p%desc_ac,info)
|
||||
if (info == psb_success_) call psb_cdasb(p%desc_ac,info)
|
||||
if (info == psb_success_) call psb_glob_to_loc(bcoo%ia(1:nzl),p%desc_ac,info,iact='I')
|
||||
if (info == psb_success_) call psb_glob_to_loc(bcoo%ja(1:nzl),p%desc_ac,info,iact='I')
|
||||
if (info == psb_success_) call psb_cdall(ictxt,lv%desc_ac,info,nl=nlaggr(me+1))
|
||||
if (info == psb_success_) call psb_cdins(nzl,bcoo%ia,bcoo%ja,lv%desc_ac,info)
|
||||
if (info == psb_success_) call psb_cdasb(lv%desc_ac,info)
|
||||
if (info == psb_success_) call psb_glob_to_loc(bcoo%ia(1:nzl),lv%desc_ac,info,iact='I')
|
||||
if (info == psb_success_) call psb_glob_to_loc(bcoo%ja(1:nzl),lv%desc_ac,info,iact='I')
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_internal_error_,name,&
|
||||
& a_err='Creating p%desc_ac and converting ac')
|
||||
& a_err='Creating lv%desc_ac and converting ac')
|
||||
goto 9999
|
||||
end if
|
||||
if (debug_level >= psb_debug_outer_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),&
|
||||
& 'Assembld aux descr. distr.'
|
||||
call p%ac%mv_from(bcoo)
|
||||
call lv%ac%mv_from(bcoo)
|
||||
|
||||
call p%ac%set_nrows(p%desc_ac%get_local_rows())
|
||||
call p%ac%set_ncols(p%desc_ac%get_local_cols())
|
||||
call p%ac%set_asb()
|
||||
call lv%ac%set_nrows(lv%desc_ac%get_local_rows())
|
||||
call lv%ac%set_ncols(lv%desc_ac%get_local_cols())
|
||||
call lv%ac%set_asb()
|
||||
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='psb_sp_free')
|
||||
@@ -183,20 +183,20 @@ subroutine mld_c_lev_aggrmat_asb(p,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
if (np>1) then
|
||||
call op_prol%mv_to(acsr1)
|
||||
nzl = acsr1%get_nzeros()
|
||||
call psb_glob_to_loc(acsr1%ja(1:nzl),p%desc_ac,info,'I')
|
||||
call psb_glob_to_loc(acsr1%ja(1:nzl),lv%desc_ac,info,'I')
|
||||
if(info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='psb_glob_to_loc')
|
||||
goto 9999
|
||||
end if
|
||||
call op_prol%mv_from(acsr1)
|
||||
endif
|
||||
call op_prol%set_ncols(p%desc_ac%get_local_cols())
|
||||
call op_prol%set_ncols(lv%desc_ac%get_local_cols())
|
||||
|
||||
if (np>1) then
|
||||
call op_restr%cscnv(info,type='coo',dupl=psb_dupl_add_)
|
||||
call op_restr%mv_to(acoo)
|
||||
nzl = acoo%get_nzeros()
|
||||
if (info == psb_success_) call psb_glob_to_loc(acoo%ia(1:nzl),p%desc_ac,info,'I')
|
||||
if (info == psb_success_) call psb_glob_to_loc(acoo%ia(1:nzl),lv%desc_ac,info,'I')
|
||||
call acoo%set_dupl(psb_dupl_add_)
|
||||
if (info == psb_success_) call op_restr%mv_from(acoo)
|
||||
if (info == psb_success_) call op_restr%cscnv(info,type='csr')
|
||||
@@ -209,7 +209,7 @@ subroutine mld_c_lev_aggrmat_asb(p,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
!
|
||||
! Clip to local rows.
|
||||
!
|
||||
call op_restr%set_nrows(p%desc_ac%get_local_rows())
|
||||
call op_restr%set_nrows(lv%desc_ac%get_local_rows())
|
||||
|
||||
if (debug_level >= psb_debug_outer_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),&
|
||||
@@ -218,10 +218,10 @@ subroutine mld_c_lev_aggrmat_asb(p,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
case(mld_repl_mat_)
|
||||
!
|
||||
!
|
||||
call psb_cdall(ictxt,p%desc_ac,info,mg=ntaggr,repl=.true.)
|
||||
if (info == psb_success_) call psb_cdasb(p%desc_ac,info)
|
||||
call psb_cdall(ictxt,lv%desc_ac,info,mg=ntaggr,repl=.true.)
|
||||
if (info == psb_success_) call psb_cdasb(lv%desc_ac,info)
|
||||
if (info == psb_success_) &
|
||||
& call psb_gather(p%ac,ac,p%desc_ac,info,dupl=psb_dupl_add_,keeploc=.false.)
|
||||
& call psb_gather(lv%ac,ac,lv%desc_ac,info,dupl=psb_dupl_add_,keeploc=.false.)
|
||||
|
||||
if (info /= psb_success_) goto 9999
|
||||
|
||||
@@ -231,7 +231,7 @@ subroutine mld_c_lev_aggrmat_asb(p,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
call p%ac%cscnv(info,type='csr',dupl=psb_dupl_add_)
|
||||
call lv%ac%cscnv(info,type='csr',dupl=psb_dupl_add_)
|
||||
if(info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='spcnv')
|
||||
goto 9999
|
||||
@@ -243,8 +243,8 @@ subroutine mld_c_lev_aggrmat_asb(p,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
! op_prol => PR i.e. prolongation operator
|
||||
!
|
||||
|
||||
p%map = psb_linmap(psb_map_aggr_,desc_a,&
|
||||
& p%desc_ac,op_restr,op_prol,ilaggr,nlaggr)
|
||||
lv%map = psb_linmap(psb_map_aggr_,desc_a,&
|
||||
& lv%desc_ac,op_restr,op_prol,ilaggr,nlaggr)
|
||||
if (info == psb_success_) call op_prol%free()
|
||||
if (info == psb_success_) call op_restr%free()
|
||||
if(info /= psb_success_) then
|
||||
@@ -255,8 +255,8 @@ subroutine mld_c_lev_aggrmat_asb(p,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
! Fix the base_a and base_desc pointers for handling of residuals.
|
||||
! This is correct because this routine is only called at levels >=2.
|
||||
!
|
||||
p%base_a => p%ac
|
||||
p%base_desc => p%desc_ac
|
||||
lv%base_a => lv%ac
|
||||
lv%base_desc => lv%desc_ac
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
@@ -264,4 +264,4 @@ subroutine mld_c_lev_aggrmat_asb(p,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
|
||||
end subroutine mld_c_lev_aggrmat_asb
|
||||
end subroutine mld_c_base_onelev_mat_asb
|
||||
@@ -0,0 +1,81 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
! (C) Copyright 2008-2018
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Daniela di Serafino
|
||||
!
|
||||
! 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.
|
||||
! 3. The name of the MLD2P4 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
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE MLD2P4 GROUP OR ITS CONTRIBUTORS
|
||||
! 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.
|
||||
!
|
||||
!
|
||||
subroutine mld_c_base_onelev_setag(lv,val,info,pos)
|
||||
|
||||
use psb_base_mod
|
||||
use mld_c_onelev_mod, mld_protect_name => mld_c_base_onelev_setag
|
||||
|
||||
implicit none
|
||||
|
||||
! Arguments
|
||||
class(mld_c_onelev_type), target, intent(inout) :: lv
|
||||
class(mld_c_base_aggregator_type), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
character(len=*), optional, intent(in) :: pos
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: ipos_
|
||||
character(len=*), parameter :: name='mld_base_onelev_setag'
|
||||
|
||||
info = psb_success_
|
||||
|
||||
! Ignore pos for aggregator
|
||||
|
||||
if (allocated(lv%aggr)) then
|
||||
if (.not.same_type_as(lv%aggr,val)) then
|
||||
call lv%aggr%free(info)
|
||||
deallocate(lv%aggr,stat=info)
|
||||
if (info /= 0) then
|
||||
info = 3111
|
||||
return
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
|
||||
if (.not.allocated(lv%aggr)) then
|
||||
allocate(lv%aggr,mold=val,stat=info)
|
||||
if (info /= 0) then
|
||||
info = 3111
|
||||
return
|
||||
end if
|
||||
lv%parms%par_aggr_alg = mld_ext_aggr_
|
||||
lv%parms%aggr_type = mld_noalg_
|
||||
end if
|
||||
|
||||
end subroutine mld_c_base_onelev_setag
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
@@ -39,6 +39,9 @@ subroutine mld_c_base_onelev_seti(lv,what,val,info,pos)
|
||||
|
||||
use psb_base_mod
|
||||
use mld_c_onelev_mod, mld_protect_name => mld_c_base_onelev_seti
|
||||
use mld_c_base_aggregator_mod
|
||||
use mld_c_dec_aggregator_mod
|
||||
use mld_c_symdec_aggregator_mod
|
||||
use mld_c_jac_smoother
|
||||
use mld_c_as_smoother
|
||||
use mld_c_diag_solver
|
||||
@@ -116,7 +119,7 @@ subroutine mld_c_base_onelev_seti(lv,what,val,info,pos)
|
||||
case (mld_fbgs_)
|
||||
call lv%set(mld_c_jac_smoother_mold,info,pos='pre')
|
||||
if (info == 0) call lv%set(mld_c_gs_solver_mold,info,pos='pre')
|
||||
call lv%set(mld_c_jac_smoother_mold,info,pos='post')
|
||||
if (info == 0) call lv%set(mld_c_jac_smoother_mold,info,pos='post')
|
||||
if (info == 0) call lv%set(mld_c_bwgs_solver_mold,info,pos='post')
|
||||
|
||||
|
||||
@@ -182,12 +185,31 @@ subroutine mld_c_base_onelev_seti(lv,what,val,info,pos)
|
||||
|
||||
case (mld_par_aggr_alg_)
|
||||
lv%parms%par_aggr_alg = val
|
||||
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)
|
||||
case(mld_dec_aggr_)
|
||||
allocate(mld_c_dec_aggregator_type :: lv%aggr, stat=info)
|
||||
case(mld_sym_dec_aggr_)
|
||||
allocate(mld_c_symdec_aggregator_type :: lv%aggr, stat=info)
|
||||
case default
|
||||
info = psb_err_internal_error_
|
||||
end select
|
||||
if (info == psb_success_) call lv%aggr%default()
|
||||
|
||||
case (mld_aggr_ord_)
|
||||
lv%parms%aggr_ord = val
|
||||
|
||||
case (mld_aggr_type_)
|
||||
lv%parms%aggr_type = val
|
||||
if (allocated(lv%aggr)) call lv%aggr%set_aggr_type(lv%parms,info)
|
||||
|
||||
case (mld_aggr_prol_)
|
||||
lv%parms%aggr_prol = val
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
@@ -39,6 +39,9 @@ subroutine mld_d_base_onelev_cseti(lv,what,val,info,pos)
|
||||
|
||||
use psb_base_mod
|
||||
use mld_d_onelev_mod, mld_protect_name => mld_d_base_onelev_cseti
|
||||
use mld_d_base_aggregator_mod
|
||||
use mld_d_dec_aggregator_mod
|
||||
use mld_d_symdec_aggregator_mod
|
||||
use mld_d_jac_smoother
|
||||
use mld_d_as_smoother
|
||||
use mld_d_diag_solver
|
||||
@@ -202,12 +205,31 @@ subroutine mld_d_base_onelev_cseti(lv,what,val,info,pos)
|
||||
|
||||
case ('PAR_AGGR_ALG')
|
||||
lv%parms%par_aggr_alg = val
|
||||
|
||||
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)
|
||||
case(mld_dec_aggr_)
|
||||
allocate(mld_d_dec_aggregator_type :: lv%aggr, stat=info)
|
||||
case(mld_sym_dec_aggr_)
|
||||
allocate(mld_d_symdec_aggregator_type :: lv%aggr, stat=info)
|
||||
case default
|
||||
info = psb_err_internal_error_
|
||||
end select
|
||||
if (info == psb_success_) call lv%aggr%default()
|
||||
|
||||
case ('AGGR_ORD')
|
||||
lv%parms%aggr_ord = val
|
||||
|
||||
case ('AGGR_TYPE')
|
||||
lv%parms%aggr_type = val
|
||||
if (allocated(lv%aggr)) call lv%aggr%set_aggr_type(lv%parms,info)
|
||||
|
||||
case ('AGGR_PROL')
|
||||
lv%parms%aggr_prol = val
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
@@ -66,9 +66,18 @@ subroutine mld_d_base_onelev_descr(lv,il,nl,ilmin,info,iout)
|
||||
|
||||
write(iout_,*)
|
||||
if (il == ilmin) then
|
||||
call lv%parms%mldescr(iout_,info)
|
||||
call lv%parms%mlcycledsc(iout_,info)
|
||||
if (allocated(lv%aggr)) then
|
||||
call lv%aggr%descr(lv%parms,iout_,info)
|
||||
else
|
||||
write(iout_,*) 'Internal error: unallocated aggregator object'
|
||||
info = psb_err_internal_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
write(iout_,*)
|
||||
end if
|
||||
|
||||
if (il > 1) then
|
||||
|
||||
if (coarse) then
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
|
||||
+40
-40
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
@@ -35,9 +35,9 @@
|
||||
! POSSIBILITY OF SUCH DAMAGE.
|
||||
!
|
||||
!
|
||||
! File: mld_d_lev_aggrmat_asb.f90
|
||||
! File: mld_d_onelev_mat_asb.f90
|
||||
!
|
||||
! Subroutine: mld_d_lev_aggrmat_asb
|
||||
! Subroutine: mld_d_onelev_mat_asb
|
||||
! Version: real
|
||||
!
|
||||
! This routine builds the matrix associated to the current level of the
|
||||
@@ -83,16 +83,16 @@
|
||||
! info - integer, output.
|
||||
! Error code.
|
||||
!
|
||||
subroutine mld_d_lev_aggrmat_asb(p,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
subroutine mld_d_base_onelev_mat_asb(lv,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
|
||||
use psb_base_mod
|
||||
use mld_base_prec_type
|
||||
use mld_d_inner_mod, mld_protect_name => mld_d_lev_aggrmat_asb
|
||||
use mld_d_onelev_mod, mld_protect_name => mld_d_base_onelev_mat_asb
|
||||
|
||||
implicit none
|
||||
|
||||
! Arguments
|
||||
type(mld_d_onelev_type), intent(inout), target :: p
|
||||
class(mld_d_onelev_type), intent(inout), target :: lv
|
||||
type(psb_dspmat_type), intent(in) :: a
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(inout) :: ilaggr(:),nlaggr(:)
|
||||
@@ -101,7 +101,7 @@ subroutine mld_d_lev_aggrmat_asb(p,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
|
||||
|
||||
! Local variables
|
||||
character(len=20) :: name
|
||||
character(len=24) :: name
|
||||
integer(psb_mpk_) :: ictxt, np, me
|
||||
integer(psb_ipk_) :: err_act
|
||||
type(psb_dspmat_type) :: ac, op_restr
|
||||
@@ -110,7 +110,7 @@ subroutine mld_d_lev_aggrmat_asb(p,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
integer(psb_ipk_) :: nzl, ntaggr
|
||||
integer(psb_ipk_) :: debug_level, debug_unit
|
||||
|
||||
name='mld_d_lev_aggrmat_asb'
|
||||
name='mld_d_onelev_mat_asb'
|
||||
if (psb_get_errstatus().ne.0) return
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
@@ -119,25 +119,25 @@ subroutine mld_d_lev_aggrmat_asb(p,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
ictxt = desc_a%get_context()
|
||||
call psb_info(ictxt,me,np)
|
||||
|
||||
call mld_check_def(p%parms%aggr_prol,'Smoother',&
|
||||
call mld_check_def(lv%parms%aggr_prol,'Smoother',&
|
||||
& mld_smooth_prol_,is_legal_ml_aggr_prol)
|
||||
call mld_check_def(p%parms%coarse_mat,'Coarse matrix',&
|
||||
call mld_check_def(lv%parms%coarse_mat,'Coarse matrix',&
|
||||
& mld_distr_mat_,is_legal_ml_coarse_mat)
|
||||
call mld_check_def(p%parms%aggr_filter,'Use filtered matrix',&
|
||||
call mld_check_def(lv%parms%aggr_filter,'Use filtered matrix',&
|
||||
& mld_no_filter_mat_,is_legal_aggr_filter)
|
||||
call mld_check_def(p%parms%aggr_omega_alg,'Omega Alg.',&
|
||||
call mld_check_def(lv%parms%aggr_omega_alg,'Omega Alg.',&
|
||||
& mld_eig_est_,is_legal_ml_aggr_omega_alg)
|
||||
call mld_check_def(p%parms%aggr_eig,'Eigenvalue estimate',&
|
||||
call mld_check_def(lv%parms%aggr_eig,'Eigenvalue estimate',&
|
||||
& mld_max_norm_,is_legal_ml_aggr_eig)
|
||||
call mld_check_def(p%parms%aggr_omega_val,'Omega',dzero,is_legal_d_omega)
|
||||
call mld_check_def(lv%parms%aggr_omega_val,'Omega',dzero,is_legal_d_omega)
|
||||
|
||||
|
||||
!
|
||||
! Build the coarse-level matrix from the fine-level one, starting from
|
||||
! the mapping defined by mld_aggrmap_bld and applying the aggregation
|
||||
! algorithm specified by p%iprcparm(mld_aggr_prol_)
|
||||
! algorithm specified by lv%iprcparm(mld_aggr_prol_)
|
||||
!
|
||||
call mld_daggrmat_asb(a,desc_a,ilaggr,nlaggr,p%parms,ac,op_prol,op_restr,info)
|
||||
call lv%aggr%mat_asb(lv%parms,a,desc_a,ilaggr,nlaggr,ac,op_prol,op_restr,info)
|
||||
|
||||
if(info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='mld_aggrmat_asb')
|
||||
@@ -149,31 +149,31 @@ subroutine mld_d_lev_aggrmat_asb(p,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
|
||||
ntaggr = sum(nlaggr)
|
||||
|
||||
select case(p%parms%coarse_mat)
|
||||
select case(lv%parms%coarse_mat)
|
||||
|
||||
case(mld_distr_mat_)
|
||||
|
||||
call ac%mv_to(bcoo)
|
||||
nzl = bcoo%get_nzeros()
|
||||
|
||||
if (info == psb_success_) call psb_cdall(ictxt,p%desc_ac,info,nl=nlaggr(me+1))
|
||||
if (info == psb_success_) call psb_cdins(nzl,bcoo%ia,bcoo%ja,p%desc_ac,info)
|
||||
if (info == psb_success_) call psb_cdasb(p%desc_ac,info)
|
||||
if (info == psb_success_) call psb_glob_to_loc(bcoo%ia(1:nzl),p%desc_ac,info,iact='I')
|
||||
if (info == psb_success_) call psb_glob_to_loc(bcoo%ja(1:nzl),p%desc_ac,info,iact='I')
|
||||
if (info == psb_success_) call psb_cdall(ictxt,lv%desc_ac,info,nl=nlaggr(me+1))
|
||||
if (info == psb_success_) call psb_cdins(nzl,bcoo%ia,bcoo%ja,lv%desc_ac,info)
|
||||
if (info == psb_success_) call psb_cdasb(lv%desc_ac,info)
|
||||
if (info == psb_success_) call psb_glob_to_loc(bcoo%ia(1:nzl),lv%desc_ac,info,iact='I')
|
||||
if (info == psb_success_) call psb_glob_to_loc(bcoo%ja(1:nzl),lv%desc_ac,info,iact='I')
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_internal_error_,name,&
|
||||
& a_err='Creating p%desc_ac and converting ac')
|
||||
& a_err='Creating lv%desc_ac and converting ac')
|
||||
goto 9999
|
||||
end if
|
||||
if (debug_level >= psb_debug_outer_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),&
|
||||
& 'Assembld aux descr. distr.'
|
||||
call p%ac%mv_from(bcoo)
|
||||
call lv%ac%mv_from(bcoo)
|
||||
|
||||
call p%ac%set_nrows(p%desc_ac%get_local_rows())
|
||||
call p%ac%set_ncols(p%desc_ac%get_local_cols())
|
||||
call p%ac%set_asb()
|
||||
call lv%ac%set_nrows(lv%desc_ac%get_local_rows())
|
||||
call lv%ac%set_ncols(lv%desc_ac%get_local_cols())
|
||||
call lv%ac%set_asb()
|
||||
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='psb_sp_free')
|
||||
@@ -183,20 +183,20 @@ subroutine mld_d_lev_aggrmat_asb(p,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
if (np>1) then
|
||||
call op_prol%mv_to(acsr1)
|
||||
nzl = acsr1%get_nzeros()
|
||||
call psb_glob_to_loc(acsr1%ja(1:nzl),p%desc_ac,info,'I')
|
||||
call psb_glob_to_loc(acsr1%ja(1:nzl),lv%desc_ac,info,'I')
|
||||
if(info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='psb_glob_to_loc')
|
||||
goto 9999
|
||||
end if
|
||||
call op_prol%mv_from(acsr1)
|
||||
endif
|
||||
call op_prol%set_ncols(p%desc_ac%get_local_cols())
|
||||
call op_prol%set_ncols(lv%desc_ac%get_local_cols())
|
||||
|
||||
if (np>1) then
|
||||
call op_restr%cscnv(info,type='coo',dupl=psb_dupl_add_)
|
||||
call op_restr%mv_to(acoo)
|
||||
nzl = acoo%get_nzeros()
|
||||
if (info == psb_success_) call psb_glob_to_loc(acoo%ia(1:nzl),p%desc_ac,info,'I')
|
||||
if (info == psb_success_) call psb_glob_to_loc(acoo%ia(1:nzl),lv%desc_ac,info,'I')
|
||||
call acoo%set_dupl(psb_dupl_add_)
|
||||
if (info == psb_success_) call op_restr%mv_from(acoo)
|
||||
if (info == psb_success_) call op_restr%cscnv(info,type='csr')
|
||||
@@ -209,7 +209,7 @@ subroutine mld_d_lev_aggrmat_asb(p,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
!
|
||||
! Clip to local rows.
|
||||
!
|
||||
call op_restr%set_nrows(p%desc_ac%get_local_rows())
|
||||
call op_restr%set_nrows(lv%desc_ac%get_local_rows())
|
||||
|
||||
if (debug_level >= psb_debug_outer_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),&
|
||||
@@ -218,10 +218,10 @@ subroutine mld_d_lev_aggrmat_asb(p,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
case(mld_repl_mat_)
|
||||
!
|
||||
!
|
||||
call psb_cdall(ictxt,p%desc_ac,info,mg=ntaggr,repl=.true.)
|
||||
if (info == psb_success_) call psb_cdasb(p%desc_ac,info)
|
||||
call psb_cdall(ictxt,lv%desc_ac,info,mg=ntaggr,repl=.true.)
|
||||
if (info == psb_success_) call psb_cdasb(lv%desc_ac,info)
|
||||
if (info == psb_success_) &
|
||||
& call psb_gather(p%ac,ac,p%desc_ac,info,dupl=psb_dupl_add_,keeploc=.false.)
|
||||
& call psb_gather(lv%ac,ac,lv%desc_ac,info,dupl=psb_dupl_add_,keeploc=.false.)
|
||||
|
||||
if (info /= psb_success_) goto 9999
|
||||
|
||||
@@ -231,7 +231,7 @@ subroutine mld_d_lev_aggrmat_asb(p,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
call p%ac%cscnv(info,type='csr',dupl=psb_dupl_add_)
|
||||
call lv%ac%cscnv(info,type='csr',dupl=psb_dupl_add_)
|
||||
if(info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='spcnv')
|
||||
goto 9999
|
||||
@@ -243,8 +243,8 @@ subroutine mld_d_lev_aggrmat_asb(p,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
! op_prol => PR i.e. prolongation operator
|
||||
!
|
||||
|
||||
p%map = psb_linmap(psb_map_aggr_,desc_a,&
|
||||
& p%desc_ac,op_restr,op_prol,ilaggr,nlaggr)
|
||||
lv%map = psb_linmap(psb_map_aggr_,desc_a,&
|
||||
& lv%desc_ac,op_restr,op_prol,ilaggr,nlaggr)
|
||||
if (info == psb_success_) call op_prol%free()
|
||||
if (info == psb_success_) call op_restr%free()
|
||||
if(info /= psb_success_) then
|
||||
@@ -255,8 +255,8 @@ subroutine mld_d_lev_aggrmat_asb(p,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
! Fix the base_a and base_desc pointers for handling of residuals.
|
||||
! This is correct because this routine is only called at levels >=2.
|
||||
!
|
||||
p%base_a => p%ac
|
||||
p%base_desc => p%desc_ac
|
||||
lv%base_a => lv%ac
|
||||
lv%base_desc => lv%desc_ac
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
@@ -264,4 +264,4 @@ subroutine mld_d_lev_aggrmat_asb(p,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
|
||||
end subroutine mld_d_lev_aggrmat_asb
|
||||
end subroutine mld_d_base_onelev_mat_asb
|
||||
@@ -0,0 +1,81 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
! (C) Copyright 2008-2018
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Daniela di Serafino
|
||||
!
|
||||
! 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.
|
||||
! 3. The name of the MLD2P4 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
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE MLD2P4 GROUP OR ITS CONTRIBUTORS
|
||||
! 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.
|
||||
!
|
||||
!
|
||||
subroutine mld_d_base_onelev_setag(lv,val,info,pos)
|
||||
|
||||
use psb_base_mod
|
||||
use mld_d_onelev_mod, mld_protect_name => mld_d_base_onelev_setag
|
||||
|
||||
implicit none
|
||||
|
||||
! Arguments
|
||||
class(mld_d_onelev_type), target, intent(inout) :: lv
|
||||
class(mld_d_base_aggregator_type), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
character(len=*), optional, intent(in) :: pos
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: ipos_
|
||||
character(len=*), parameter :: name='mld_base_onelev_setag'
|
||||
|
||||
info = psb_success_
|
||||
|
||||
! Ignore pos for aggregator
|
||||
|
||||
if (allocated(lv%aggr)) then
|
||||
if (.not.same_type_as(lv%aggr,val)) then
|
||||
call lv%aggr%free(info)
|
||||
deallocate(lv%aggr,stat=info)
|
||||
if (info /= 0) then
|
||||
info = 3111
|
||||
return
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
|
||||
if (.not.allocated(lv%aggr)) then
|
||||
allocate(lv%aggr,mold=val,stat=info)
|
||||
if (info /= 0) then
|
||||
info = 3111
|
||||
return
|
||||
end if
|
||||
lv%parms%par_aggr_alg = mld_ext_aggr_
|
||||
lv%parms%aggr_type = mld_noalg_
|
||||
end if
|
||||
|
||||
end subroutine mld_d_base_onelev_setag
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
@@ -39,6 +39,9 @@ subroutine mld_d_base_onelev_seti(lv,what,val,info,pos)
|
||||
|
||||
use psb_base_mod
|
||||
use mld_d_onelev_mod, mld_protect_name => mld_d_base_onelev_seti
|
||||
use mld_d_base_aggregator_mod
|
||||
use mld_d_dec_aggregator_mod
|
||||
use mld_d_symdec_aggregator_mod
|
||||
use mld_d_jac_smoother
|
||||
use mld_d_as_smoother
|
||||
use mld_d_diag_solver
|
||||
@@ -128,7 +131,7 @@ subroutine mld_d_base_onelev_seti(lv,what,val,info,pos)
|
||||
case (mld_fbgs_)
|
||||
call lv%set(mld_d_jac_smoother_mold,info,pos='pre')
|
||||
if (info == 0) call lv%set(mld_d_gs_solver_mold,info,pos='pre')
|
||||
call lv%set(mld_d_jac_smoother_mold,info,pos='post')
|
||||
if (info == 0) call lv%set(mld_d_jac_smoother_mold,info,pos='post')
|
||||
if (info == 0) call lv%set(mld_d_bwgs_solver_mold,info,pos='post')
|
||||
|
||||
|
||||
@@ -202,12 +205,31 @@ subroutine mld_d_base_onelev_seti(lv,what,val,info,pos)
|
||||
|
||||
case (mld_par_aggr_alg_)
|
||||
lv%parms%par_aggr_alg = val
|
||||
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)
|
||||
case(mld_dec_aggr_)
|
||||
allocate(mld_d_dec_aggregator_type :: lv%aggr, stat=info)
|
||||
case(mld_sym_dec_aggr_)
|
||||
allocate(mld_d_symdec_aggregator_type :: lv%aggr, stat=info)
|
||||
case default
|
||||
info = psb_err_internal_error_
|
||||
end select
|
||||
if (info == psb_success_) call lv%aggr%default()
|
||||
|
||||
case (mld_aggr_ord_)
|
||||
lv%parms%aggr_ord = val
|
||||
|
||||
case (mld_aggr_type_)
|
||||
lv%parms%aggr_type = val
|
||||
if (allocated(lv%aggr)) call lv%aggr%set_aggr_type(lv%parms,info)
|
||||
|
||||
case (mld_aggr_prol_)
|
||||
lv%parms%aggr_prol = val
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
@@ -39,6 +39,9 @@ subroutine mld_s_base_onelev_cseti(lv,what,val,info,pos)
|
||||
|
||||
use psb_base_mod
|
||||
use mld_s_onelev_mod, mld_protect_name => mld_s_base_onelev_cseti
|
||||
use mld_s_base_aggregator_mod
|
||||
use mld_s_dec_aggregator_mod
|
||||
use mld_s_symdec_aggregator_mod
|
||||
use mld_s_jac_smoother
|
||||
use mld_s_as_smoother
|
||||
use mld_s_diag_solver
|
||||
@@ -182,12 +185,31 @@ subroutine mld_s_base_onelev_cseti(lv,what,val,info,pos)
|
||||
|
||||
case ('PAR_AGGR_ALG')
|
||||
lv%parms%par_aggr_alg = val
|
||||
|
||||
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)
|
||||
case(mld_dec_aggr_)
|
||||
allocate(mld_s_dec_aggregator_type :: lv%aggr, stat=info)
|
||||
case(mld_sym_dec_aggr_)
|
||||
allocate(mld_s_symdec_aggregator_type :: lv%aggr, stat=info)
|
||||
case default
|
||||
info = psb_err_internal_error_
|
||||
end select
|
||||
if (info == psb_success_) call lv%aggr%default()
|
||||
|
||||
case ('AGGR_ORD')
|
||||
lv%parms%aggr_ord = val
|
||||
|
||||
case ('AGGR_TYPE')
|
||||
lv%parms%aggr_type = val
|
||||
if (allocated(lv%aggr)) call lv%aggr%set_aggr_type(lv%parms,info)
|
||||
|
||||
case ('AGGR_PROL')
|
||||
lv%parms%aggr_prol = val
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
@@ -66,9 +66,18 @@ subroutine mld_s_base_onelev_descr(lv,il,nl,ilmin,info,iout)
|
||||
|
||||
write(iout_,*)
|
||||
if (il == ilmin) then
|
||||
call lv%parms%mldescr(iout_,info)
|
||||
call lv%parms%mlcycledsc(iout_,info)
|
||||
if (allocated(lv%aggr)) then
|
||||
call lv%aggr%descr(lv%parms,iout_,info)
|
||||
else
|
||||
write(iout_,*) 'Internal error: unallocated aggregator object'
|
||||
info = psb_err_internal_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
write(iout_,*)
|
||||
end if
|
||||
|
||||
if (il > 1) then
|
||||
|
||||
if (coarse) then
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
|
||||
+40
-40
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
@@ -35,9 +35,9 @@
|
||||
! POSSIBILITY OF SUCH DAMAGE.
|
||||
!
|
||||
!
|
||||
! File: mld_s_lev_aggrmat_asb.f90
|
||||
! File: mld_s_onelev_mat_asb.f90
|
||||
!
|
||||
! Subroutine: mld_s_lev_aggrmat_asb
|
||||
! Subroutine: mld_s_onelev_mat_asb
|
||||
! Version: real
|
||||
!
|
||||
! This routine builds the matrix associated to the current level of the
|
||||
@@ -83,16 +83,16 @@
|
||||
! info - integer, output.
|
||||
! Error code.
|
||||
!
|
||||
subroutine mld_s_lev_aggrmat_asb(p,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
subroutine mld_s_base_onelev_mat_asb(lv,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
|
||||
use psb_base_mod
|
||||
use mld_base_prec_type
|
||||
use mld_s_inner_mod, mld_protect_name => mld_s_lev_aggrmat_asb
|
||||
use mld_s_onelev_mod, mld_protect_name => mld_s_base_onelev_mat_asb
|
||||
|
||||
implicit none
|
||||
|
||||
! Arguments
|
||||
type(mld_s_onelev_type), intent(inout), target :: p
|
||||
class(mld_s_onelev_type), intent(inout), target :: lv
|
||||
type(psb_sspmat_type), intent(in) :: a
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(inout) :: ilaggr(:),nlaggr(:)
|
||||
@@ -101,7 +101,7 @@ subroutine mld_s_lev_aggrmat_asb(p,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
|
||||
|
||||
! Local variables
|
||||
character(len=20) :: name
|
||||
character(len=24) :: name
|
||||
integer(psb_mpk_) :: ictxt, np, me
|
||||
integer(psb_ipk_) :: err_act
|
||||
type(psb_sspmat_type) :: ac, op_restr
|
||||
@@ -110,7 +110,7 @@ subroutine mld_s_lev_aggrmat_asb(p,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
integer(psb_ipk_) :: nzl, ntaggr
|
||||
integer(psb_ipk_) :: debug_level, debug_unit
|
||||
|
||||
name='mld_s_lev_aggrmat_asb'
|
||||
name='mld_s_onelev_mat_asb'
|
||||
if (psb_get_errstatus().ne.0) return
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
@@ -119,25 +119,25 @@ subroutine mld_s_lev_aggrmat_asb(p,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
ictxt = desc_a%get_context()
|
||||
call psb_info(ictxt,me,np)
|
||||
|
||||
call mld_check_def(p%parms%aggr_prol,'Smoother',&
|
||||
call mld_check_def(lv%parms%aggr_prol,'Smoother',&
|
||||
& mld_smooth_prol_,is_legal_ml_aggr_prol)
|
||||
call mld_check_def(p%parms%coarse_mat,'Coarse matrix',&
|
||||
call mld_check_def(lv%parms%coarse_mat,'Coarse matrix',&
|
||||
& mld_distr_mat_,is_legal_ml_coarse_mat)
|
||||
call mld_check_def(p%parms%aggr_filter,'Use filtered matrix',&
|
||||
call mld_check_def(lv%parms%aggr_filter,'Use filtered matrix',&
|
||||
& mld_no_filter_mat_,is_legal_aggr_filter)
|
||||
call mld_check_def(p%parms%aggr_omega_alg,'Omega Alg.',&
|
||||
call mld_check_def(lv%parms%aggr_omega_alg,'Omega Alg.',&
|
||||
& mld_eig_est_,is_legal_ml_aggr_omega_alg)
|
||||
call mld_check_def(p%parms%aggr_eig,'Eigenvalue estimate',&
|
||||
call mld_check_def(lv%parms%aggr_eig,'Eigenvalue estimate',&
|
||||
& mld_max_norm_,is_legal_ml_aggr_eig)
|
||||
call mld_check_def(p%parms%aggr_omega_val,'Omega',szero,is_legal_s_omega)
|
||||
call mld_check_def(lv%parms%aggr_omega_val,'Omega',szero,is_legal_s_omega)
|
||||
|
||||
|
||||
!
|
||||
! Build the coarse-level matrix from the fine-level one, starting from
|
||||
! the mapping defined by mld_aggrmap_bld and applying the aggregation
|
||||
! algorithm specified by p%iprcparm(mld_aggr_prol_)
|
||||
! algorithm specified by lv%iprcparm(mld_aggr_prol_)
|
||||
!
|
||||
call mld_saggrmat_asb(a,desc_a,ilaggr,nlaggr,p%parms,ac,op_prol,op_restr,info)
|
||||
call lv%aggr%mat_asb(lv%parms,a,desc_a,ilaggr,nlaggr,ac,op_prol,op_restr,info)
|
||||
|
||||
if(info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='mld_aggrmat_asb')
|
||||
@@ -149,31 +149,31 @@ subroutine mld_s_lev_aggrmat_asb(p,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
|
||||
ntaggr = sum(nlaggr)
|
||||
|
||||
select case(p%parms%coarse_mat)
|
||||
select case(lv%parms%coarse_mat)
|
||||
|
||||
case(mld_distr_mat_)
|
||||
|
||||
call ac%mv_to(bcoo)
|
||||
nzl = bcoo%get_nzeros()
|
||||
|
||||
if (info == psb_success_) call psb_cdall(ictxt,p%desc_ac,info,nl=nlaggr(me+1))
|
||||
if (info == psb_success_) call psb_cdins(nzl,bcoo%ia,bcoo%ja,p%desc_ac,info)
|
||||
if (info == psb_success_) call psb_cdasb(p%desc_ac,info)
|
||||
if (info == psb_success_) call psb_glob_to_loc(bcoo%ia(1:nzl),p%desc_ac,info,iact='I')
|
||||
if (info == psb_success_) call psb_glob_to_loc(bcoo%ja(1:nzl),p%desc_ac,info,iact='I')
|
||||
if (info == psb_success_) call psb_cdall(ictxt,lv%desc_ac,info,nl=nlaggr(me+1))
|
||||
if (info == psb_success_) call psb_cdins(nzl,bcoo%ia,bcoo%ja,lv%desc_ac,info)
|
||||
if (info == psb_success_) call psb_cdasb(lv%desc_ac,info)
|
||||
if (info == psb_success_) call psb_glob_to_loc(bcoo%ia(1:nzl),lv%desc_ac,info,iact='I')
|
||||
if (info == psb_success_) call psb_glob_to_loc(bcoo%ja(1:nzl),lv%desc_ac,info,iact='I')
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_internal_error_,name,&
|
||||
& a_err='Creating p%desc_ac and converting ac')
|
||||
& a_err='Creating lv%desc_ac and converting ac')
|
||||
goto 9999
|
||||
end if
|
||||
if (debug_level >= psb_debug_outer_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),&
|
||||
& 'Assembld aux descr. distr.'
|
||||
call p%ac%mv_from(bcoo)
|
||||
call lv%ac%mv_from(bcoo)
|
||||
|
||||
call p%ac%set_nrows(p%desc_ac%get_local_rows())
|
||||
call p%ac%set_ncols(p%desc_ac%get_local_cols())
|
||||
call p%ac%set_asb()
|
||||
call lv%ac%set_nrows(lv%desc_ac%get_local_rows())
|
||||
call lv%ac%set_ncols(lv%desc_ac%get_local_cols())
|
||||
call lv%ac%set_asb()
|
||||
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='psb_sp_free')
|
||||
@@ -183,20 +183,20 @@ subroutine mld_s_lev_aggrmat_asb(p,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
if (np>1) then
|
||||
call op_prol%mv_to(acsr1)
|
||||
nzl = acsr1%get_nzeros()
|
||||
call psb_glob_to_loc(acsr1%ja(1:nzl),p%desc_ac,info,'I')
|
||||
call psb_glob_to_loc(acsr1%ja(1:nzl),lv%desc_ac,info,'I')
|
||||
if(info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='psb_glob_to_loc')
|
||||
goto 9999
|
||||
end if
|
||||
call op_prol%mv_from(acsr1)
|
||||
endif
|
||||
call op_prol%set_ncols(p%desc_ac%get_local_cols())
|
||||
call op_prol%set_ncols(lv%desc_ac%get_local_cols())
|
||||
|
||||
if (np>1) then
|
||||
call op_restr%cscnv(info,type='coo',dupl=psb_dupl_add_)
|
||||
call op_restr%mv_to(acoo)
|
||||
nzl = acoo%get_nzeros()
|
||||
if (info == psb_success_) call psb_glob_to_loc(acoo%ia(1:nzl),p%desc_ac,info,'I')
|
||||
if (info == psb_success_) call psb_glob_to_loc(acoo%ia(1:nzl),lv%desc_ac,info,'I')
|
||||
call acoo%set_dupl(psb_dupl_add_)
|
||||
if (info == psb_success_) call op_restr%mv_from(acoo)
|
||||
if (info == psb_success_) call op_restr%cscnv(info,type='csr')
|
||||
@@ -209,7 +209,7 @@ subroutine mld_s_lev_aggrmat_asb(p,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
!
|
||||
! Clip to local rows.
|
||||
!
|
||||
call op_restr%set_nrows(p%desc_ac%get_local_rows())
|
||||
call op_restr%set_nrows(lv%desc_ac%get_local_rows())
|
||||
|
||||
if (debug_level >= psb_debug_outer_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),&
|
||||
@@ -218,10 +218,10 @@ subroutine mld_s_lev_aggrmat_asb(p,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
case(mld_repl_mat_)
|
||||
!
|
||||
!
|
||||
call psb_cdall(ictxt,p%desc_ac,info,mg=ntaggr,repl=.true.)
|
||||
if (info == psb_success_) call psb_cdasb(p%desc_ac,info)
|
||||
call psb_cdall(ictxt,lv%desc_ac,info,mg=ntaggr,repl=.true.)
|
||||
if (info == psb_success_) call psb_cdasb(lv%desc_ac,info)
|
||||
if (info == psb_success_) &
|
||||
& call psb_gather(p%ac,ac,p%desc_ac,info,dupl=psb_dupl_add_,keeploc=.false.)
|
||||
& call psb_gather(lv%ac,ac,lv%desc_ac,info,dupl=psb_dupl_add_,keeploc=.false.)
|
||||
|
||||
if (info /= psb_success_) goto 9999
|
||||
|
||||
@@ -231,7 +231,7 @@ subroutine mld_s_lev_aggrmat_asb(p,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
call p%ac%cscnv(info,type='csr',dupl=psb_dupl_add_)
|
||||
call lv%ac%cscnv(info,type='csr',dupl=psb_dupl_add_)
|
||||
if(info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='spcnv')
|
||||
goto 9999
|
||||
@@ -243,8 +243,8 @@ subroutine mld_s_lev_aggrmat_asb(p,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
! op_prol => PR i.e. prolongation operator
|
||||
!
|
||||
|
||||
p%map = psb_linmap(psb_map_aggr_,desc_a,&
|
||||
& p%desc_ac,op_restr,op_prol,ilaggr,nlaggr)
|
||||
lv%map = psb_linmap(psb_map_aggr_,desc_a,&
|
||||
& lv%desc_ac,op_restr,op_prol,ilaggr,nlaggr)
|
||||
if (info == psb_success_) call op_prol%free()
|
||||
if (info == psb_success_) call op_restr%free()
|
||||
if(info /= psb_success_) then
|
||||
@@ -255,8 +255,8 @@ subroutine mld_s_lev_aggrmat_asb(p,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
! Fix the base_a and base_desc pointers for handling of residuals.
|
||||
! This is correct because this routine is only called at levels >=2.
|
||||
!
|
||||
p%base_a => p%ac
|
||||
p%base_desc => p%desc_ac
|
||||
lv%base_a => lv%ac
|
||||
lv%base_desc => lv%desc_ac
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
@@ -264,4 +264,4 @@ subroutine mld_s_lev_aggrmat_asb(p,a,desc_a,ilaggr,nlaggr,op_prol,info)
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
|
||||
end subroutine mld_s_lev_aggrmat_asb
|
||||
end subroutine mld_s_base_onelev_mat_asb
|
||||
@@ -0,0 +1,81 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
! (C) Copyright 2008-2018
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Daniela di Serafino
|
||||
!
|
||||
! 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.
|
||||
! 3. The name of the MLD2P4 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
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE MLD2P4 GROUP OR ITS CONTRIBUTORS
|
||||
! 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.
|
||||
!
|
||||
!
|
||||
subroutine mld_s_base_onelev_setag(lv,val,info,pos)
|
||||
|
||||
use psb_base_mod
|
||||
use mld_s_onelev_mod, mld_protect_name => mld_s_base_onelev_setag
|
||||
|
||||
implicit none
|
||||
|
||||
! Arguments
|
||||
class(mld_s_onelev_type), target, intent(inout) :: lv
|
||||
class(mld_s_base_aggregator_type), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
character(len=*), optional, intent(in) :: pos
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: ipos_
|
||||
character(len=*), parameter :: name='mld_base_onelev_setag'
|
||||
|
||||
info = psb_success_
|
||||
|
||||
! Ignore pos for aggregator
|
||||
|
||||
if (allocated(lv%aggr)) then
|
||||
if (.not.same_type_as(lv%aggr,val)) then
|
||||
call lv%aggr%free(info)
|
||||
deallocate(lv%aggr,stat=info)
|
||||
if (info /= 0) then
|
||||
info = 3111
|
||||
return
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
|
||||
if (.not.allocated(lv%aggr)) then
|
||||
allocate(lv%aggr,mold=val,stat=info)
|
||||
if (info /= 0) then
|
||||
info = 3111
|
||||
return
|
||||
end if
|
||||
lv%parms%par_aggr_alg = mld_ext_aggr_
|
||||
lv%parms%aggr_type = mld_noalg_
|
||||
end if
|
||||
|
||||
end subroutine mld_s_base_onelev_setag
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
@@ -39,6 +39,9 @@ subroutine mld_s_base_onelev_seti(lv,what,val,info,pos)
|
||||
|
||||
use psb_base_mod
|
||||
use mld_s_onelev_mod, mld_protect_name => mld_s_base_onelev_seti
|
||||
use mld_s_base_aggregator_mod
|
||||
use mld_s_dec_aggregator_mod
|
||||
use mld_s_symdec_aggregator_mod
|
||||
use mld_s_jac_smoother
|
||||
use mld_s_as_smoother
|
||||
use mld_s_diag_solver
|
||||
@@ -116,7 +119,7 @@ subroutine mld_s_base_onelev_seti(lv,what,val,info,pos)
|
||||
case (mld_fbgs_)
|
||||
call lv%set(mld_s_jac_smoother_mold,info,pos='pre')
|
||||
if (info == 0) call lv%set(mld_s_gs_solver_mold,info,pos='pre')
|
||||
call lv%set(mld_s_jac_smoother_mold,info,pos='post')
|
||||
if (info == 0) call lv%set(mld_s_jac_smoother_mold,info,pos='post')
|
||||
if (info == 0) call lv%set(mld_s_bwgs_solver_mold,info,pos='post')
|
||||
|
||||
|
||||
@@ -182,12 +185,31 @@ subroutine mld_s_base_onelev_seti(lv,what,val,info,pos)
|
||||
|
||||
case (mld_par_aggr_alg_)
|
||||
lv%parms%par_aggr_alg = val
|
||||
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)
|
||||
case(mld_dec_aggr_)
|
||||
allocate(mld_s_dec_aggregator_type :: lv%aggr, stat=info)
|
||||
case(mld_sym_dec_aggr_)
|
||||
allocate(mld_s_symdec_aggregator_type :: lv%aggr, stat=info)
|
||||
case default
|
||||
info = psb_err_internal_error_
|
||||
end select
|
||||
if (info == psb_success_) call lv%aggr%default()
|
||||
|
||||
case (mld_aggr_ord_)
|
||||
lv%parms%aggr_ord = val
|
||||
|
||||
case (mld_aggr_type_)
|
||||
lv%parms%aggr_type = val
|
||||
if (allocated(lv%aggr)) call lv%aggr%set_aggr_type(lv%parms,info)
|
||||
|
||||
case (mld_aggr_prol_)
|
||||
lv%parms%aggr_prol = val
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
@@ -39,6 +39,9 @@ subroutine mld_z_base_onelev_cseti(lv,what,val,info,pos)
|
||||
|
||||
use psb_base_mod
|
||||
use mld_z_onelev_mod, mld_protect_name => mld_z_base_onelev_cseti
|
||||
use mld_z_base_aggregator_mod
|
||||
use mld_z_dec_aggregator_mod
|
||||
use mld_z_symdec_aggregator_mod
|
||||
use mld_z_jac_smoother
|
||||
use mld_z_as_smoother
|
||||
use mld_z_diag_solver
|
||||
@@ -202,12 +205,31 @@ subroutine mld_z_base_onelev_cseti(lv,what,val,info,pos)
|
||||
|
||||
case ('PAR_AGGR_ALG')
|
||||
lv%parms%par_aggr_alg = val
|
||||
|
||||
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)
|
||||
case(mld_dec_aggr_)
|
||||
allocate(mld_z_dec_aggregator_type :: lv%aggr, stat=info)
|
||||
case(mld_sym_dec_aggr_)
|
||||
allocate(mld_z_symdec_aggregator_type :: lv%aggr, stat=info)
|
||||
case default
|
||||
info = psb_err_internal_error_
|
||||
end select
|
||||
if (info == psb_success_) call lv%aggr%default()
|
||||
|
||||
case ('AGGR_ORD')
|
||||
lv%parms%aggr_ord = val
|
||||
|
||||
case ('AGGR_TYPE')
|
||||
lv%parms%aggr_type = val
|
||||
if (allocated(lv%aggr)) call lv%aggr%set_aggr_type(lv%parms,info)
|
||||
|
||||
case ('AGGR_PROL')
|
||||
lv%parms%aggr_prol = val
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
@@ -66,9 +66,18 @@ subroutine mld_z_base_onelev_descr(lv,il,nl,ilmin,info,iout)
|
||||
|
||||
write(iout_,*)
|
||||
if (il == ilmin) then
|
||||
call lv%parms%mldescr(iout_,info)
|
||||
call lv%parms%mlcycledsc(iout_,info)
|
||||
if (allocated(lv%aggr)) then
|
||||
call lv%aggr%descr(lv%parms,iout_,info)
|
||||
else
|
||||
write(iout_,*) 'Internal error: unallocated aggregator object'
|
||||
info = psb_err_internal_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
write(iout_,*)
|
||||
end if
|
||||
|
||||
if (il > 1) then
|
||||
|
||||
if (coarse) then
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!
|
||||
!
|
||||
! MLD2P4 version 2.1
|
||||
! MLD2P4 version 2.2
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user