diff --git a/mlprec/mld_c_base_aggregator_mod.f90 b/mlprec/mld_c_base_aggregator_mod.f90 index 8bf95b5a..ebf096c2 100644 --- a/mlprec/mld_c_base_aggregator_mod.f90 +++ b/mlprec/mld_c_base_aggregator_mod.f90 @@ -37,14 +37,7 @@ ! ! ! The aggregator object hosts the aggregation method for building -! the multilevel hierarchy. The basic version is the -! decoupled 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. -! 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. +! the multilevel hierarchy. ! module mld_c_base_aggregator_mod @@ -54,45 +47,37 @@ module mld_c_base_aggregator_mod & psb_ipk_, psb_long_int_k_, psb_desc_type, psb_i_base_vect_type, & & psb_erractionsave, psb_error_handler, psb_success_ ! - ! sm - class(mld_T_base_smoother_type), allocatable - ! The current level preconditioner (aka smoother). - ! parms - type(mld_RTml_parms) - ! The parameters defining the multilevel strategy. - ! ac - The local part of the current-level matrix, built by - ! coarsening the previous-level matrix. - ! desc_ac - type(psb_desc_type). - ! The communication descriptor associated to the matrix - ! stored in ac. - ! base_a - type(psb_Tspmat_type), pointer. - ! Pointer (really a pointer!) to the local part of the current - ! matrix (so we have a unified treatment of residuals). - ! We need this to avoid passing explicitly the current matrix - ! to the routine which applies the preconditioner. - ! base_desc - type(psb_desc_type), pointer. - ! Pointer to the communication descriptor associated to the - ! matrix pointed by base_a. - ! map - Stores the maps (restriction and prolongation) between the - ! vector spaces associated to the index spaces of the previous - ! and current levels. - ! - ! Methods: - ! Most methods follow the encapsulation hierarchy: they take whatever action - ! is appropriate for the current object, then call the corresponding method for - ! the contained object. - ! As an example: the descr() method prints out a description of the - ! level. It starts by invoking the descr() method of the parms object, - ! then calls the descr() method of the smoother object. - ! - ! descr - Prints a description of the object. - ! default - Set default values - ! dump - Dump to file object contents - ! set - Sets various parameters; when a request is unknown - ! it is passed to the smoother object for further processing. - ! check - Sanity checks. - ! sizeof - Total memory occupation in bytes - ! get_nzeros - Number of nonzeros - ! + ! ! + !> \class mld_c_base_aggregator_type + !! + !! It is the data type containing the basic interface definition for + !! building a multigrid hierarchy by aggregation. The base object has no attributes, + !! it is intended to be essentially an abstract type. + !! + !! + !! type mld_c_base_aggregator_type + !! end type + !! + !! + !! Methods: + !! + !! bld_tprol - Build a tentative prolongator + !! + !! mat_asb - Build the final prolongator/restrictor and the + !! coarse matrix ac + !! + !! update_next - Transfer information to the next level; default is + !! to do nothing, i.e. aggregators at different + !! levels are independent. + !! + !! default - Apply defaults + !! set_aggr_type - For aggregator that have internal options. + !! fmt - Return a short string description + !! descr - Print a more detailed description + !! + !! cseti, csetr, csetc - Set internal parameters, if any + ! type mld_c_base_aggregator_type contains @@ -232,7 +217,28 @@ contains return end subroutine mld_c_base_aggregator_set_aggr_type - + + ! + !> Function bld_tprol: + !! \memberof mld_c_base_aggregator_type + !! \brief Build a tentative prolongator. + !! The routine will map the local matrix entries to aggregates. + !! The mapping is store in ILAGGR; for each local row index I, + !! ILAGGR(I) contains the index of the aggregate to which index I + !! will contribute, in global numbering. + !! Many aggregation produce a binary tentative prolongators, but some + !! do not, hence we also need the OP_PROL output. + !! + !! \param ag The input aggregator object + !! \param parms The auxiliary parameters object + !! \param a The local matrix part + !! \param desc_a The descriptor + !! \param ilaggr Output aggregation map + !! \param nlaggr Sizes of ilaggr on all processes + !! \param op_prol The tentative prolongator operator + !! \param info Return code + !! + ! subroutine mld_c_base_aggregator_build_tprol(ag,parms,a,desc_a,ilaggr,nlaggr,op_prol,info) use psb_base_mod implicit none @@ -262,7 +268,25 @@ contains end subroutine mld_c_base_aggregator_build_tprol - + ! + !> Function mat_asb + !! \memberof mld_c_base_aggregator_type + !! \brief Build prolongator/restrictor/coarse matrix. + !! + !! + !! \param ag The input aggregator object + !! \param parms The auxiliary parameters object + !! \param a The local matrix part + !! \param desc_a The descriptor + !! \param ilaggr Aggregation map + !! \param nlaggr Sizes of ilaggr on all processes + !! \param ac On output the coarse matrix + !! \param op_prol On input, the tentative prolongator operator, on output + !! the final prolongator + !! \param op_restr On output, the restrictor operator; + !! in many cases it is the transpose of the prolongator. + !! \param info Return code + !! subroutine mld_c_base_aggregator_mat_asb(ag,parms,a,desc_a,ilaggr,nlaggr,ac,& & op_prol,op_restr,info) use psb_base_mod diff --git a/mlprec/mld_c_onelev_mod.f90 b/mlprec/mld_c_onelev_mod.f90 index 6d0c0295..4652bb88 100644 --- a/mlprec/mld_c_onelev_mod.f90 +++ b/mlprec/mld_c_onelev_mod.f90 @@ -62,35 +62,48 @@ module mld_c_onelev_mod & psb_erractionsave, psb_error_handler ! ! - ! Type: mld_Tonelev_type. + ! Type: mld_conelev_type. ! ! It is the data type containing the necessary items for the current ! level (essentially, the smoother, the current-level matrix ! and the restriction and prolongation operators). ! - ! type mld_Tonelev_type - ! class(mld_T_base_smoother_type), allocatable :: sm - ! type(mld_RTml_parms) :: parms - ! type(psb_Tspmat_type) :: ac - ! type(psb_Tesc_type) :: desc_ac - ! type(psb_Tspmat_type), pointer :: base_a => null() - ! type(psb_Tesc_type), pointer :: base_desc => null() - ! type(psb_Tlinmap_type) :: map - ! end type mld_Tonelev_type + ! type mld_conelev_type + ! class(mld_c_base_smoother_type), allocatable :: sm, sm2a + ! class(mld_c_base_smoother_type), pointer :: sm2 => null() + ! class(mld_cmlprec_wrk_type), allocatable :: wrk + ! class(mld_c_base_aggregator_type), allocatable :: aggr + ! type(mld_sml_parms) :: parms + ! type(psb_cspmat_type) :: ac + ! type(psb_cesc_type) :: desc_ac + ! type(psb_cspmat_type), pointer :: base_a => null() + ! type(psb_desc_type), pointer :: base_desc => null() + ! type(psb_clinmap_type) :: map + ! end type mld_conelev_type ! - ! Note that psb_Tpk denotes the kind of the real data type to be chosen + ! Note that s denotes the kind of the real data type to be chosen ! according to single/double precision version of MLD2P4. ! - ! sm - class(mld_T_base_smoother_type), allocatable - ! The current level preconditioner (aka smoother). - ! parms - type(mld_RTml_parms) + ! sm,sm2a - class(mld_c_base_smoother_type), allocatable + ! The current level pre- and post-smooother. + ! sm2 - class(mld_c_base_smoother_type), pointer + ! The current level post-smooother; if sm2a is allocated + ! explicitly, then sm2 => sm2a, otherwise sm2 => sm. + ! wrk - class(mld_cmlprec_wrk_type), allocatable + ! Workspace for application of preconditioner; may be + ! pre-allocated to save time in the application within a + ! Krylov solver. + ! aggr - class(mld_c_base_aggregator_type), allocatable + ! The aggregator object: holds the algorithmic choices and + ! (possibly) additional data for building the aggregation. + ! parms - type(mld_sml_parms) ! The parameters defining the multilevel strategy. ! ac - The local part of the current-level matrix, built by ! coarsening the previous-level matrix. ! desc_ac - type(psb_desc_type). ! The communication descriptor associated to the matrix ! stored in ac. - ! base_a - type(psb_Tspmat_type), pointer. + ! base_a - type(psb_cspmat_type), pointer. ! Pointer (really a pointer!) to the local part of the current ! matrix (so we have a unified treatment of residuals). ! We need this to avoid passing explicitly the current matrix @@ -115,10 +128,14 @@ module mld_c_onelev_mod ! dump - Dump to file object contents ! set - Sets various parameters; when a request is unknown ! it is passed to the smoother object for further processing. - ! check - Sanity checks. - ! sizeof - Total memory occupation in bytes - ! get_nzeros - Number of nonzeros - ! get_wrksz - How many workspace vector does apply_vect need + ! check - Sanity checks. + ! sizeof - Total memory occupation in bytes + ! get_nzeros - Number of nonzeros + ! get_wrksz - How many workspace vector does apply_vect need + ! allocate_wrk - Allocate auxiliary workspace + ! free_wrk - Free auxiliary workspace + ! bld_tprol - Invoke the aggr method to build the tentative prolongator + ! mat_asb - Build the final (possibly smoothed) prolongator and coarse matrix. ! ! type mld_cmlprec_wrk_type diff --git a/mlprec/mld_d_base_aggregator_mod.f90 b/mlprec/mld_d_base_aggregator_mod.f90 index 97d8796a..93700360 100644 --- a/mlprec/mld_d_base_aggregator_mod.f90 +++ b/mlprec/mld_d_base_aggregator_mod.f90 @@ -37,14 +37,7 @@ ! ! ! The aggregator object hosts the aggregation method for building -! the multilevel hierarchy. The basic version is the -! decoupled 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. -! 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. +! the multilevel hierarchy. ! module mld_d_base_aggregator_mod @@ -54,45 +47,37 @@ module mld_d_base_aggregator_mod & psb_ipk_, psb_long_int_k_, psb_desc_type, psb_i_base_vect_type, & & psb_erractionsave, psb_error_handler, psb_success_ ! - ! sm - class(mld_T_base_smoother_type), allocatable - ! The current level preconditioner (aka smoother). - ! parms - type(mld_RTml_parms) - ! The parameters defining the multilevel strategy. - ! ac - The local part of the current-level matrix, built by - ! coarsening the previous-level matrix. - ! desc_ac - type(psb_desc_type). - ! The communication descriptor associated to the matrix - ! stored in ac. - ! base_a - type(psb_Tspmat_type), pointer. - ! Pointer (really a pointer!) to the local part of the current - ! matrix (so we have a unified treatment of residuals). - ! We need this to avoid passing explicitly the current matrix - ! to the routine which applies the preconditioner. - ! base_desc - type(psb_desc_type), pointer. - ! Pointer to the communication descriptor associated to the - ! matrix pointed by base_a. - ! map - Stores the maps (restriction and prolongation) between the - ! vector spaces associated to the index spaces of the previous - ! and current levels. - ! - ! Methods: - ! Most methods follow the encapsulation hierarchy: they take whatever action - ! is appropriate for the current object, then call the corresponding method for - ! the contained object. - ! As an example: the descr() method prints out a description of the - ! level. It starts by invoking the descr() method of the parms object, - ! then calls the descr() method of the smoother object. - ! - ! descr - Prints a description of the object. - ! default - Set default values - ! dump - Dump to file object contents - ! set - Sets various parameters; when a request is unknown - ! it is passed to the smoother object for further processing. - ! check - Sanity checks. - ! sizeof - Total memory occupation in bytes - ! get_nzeros - Number of nonzeros - ! + ! ! + !> \class mld_d_base_aggregator_type + !! + !! It is the data type containing the basic interface definition for + !! building a multigrid hierarchy by aggregation. The base object has no attributes, + !! it is intended to be essentially an abstract type. + !! + !! + !! type mld_d_base_aggregator_type + !! end type + !! + !! + !! Methods: + !! + !! bld_tprol - Build a tentative prolongator + !! + !! mat_asb - Build the final prolongator/restrictor and the + !! coarse matrix ac + !! + !! update_next - Transfer information to the next level; default is + !! to do nothing, i.e. aggregators at different + !! levels are independent. + !! + !! default - Apply defaults + !! set_aggr_type - For aggregator that have internal options. + !! fmt - Return a short string description + !! descr - Print a more detailed description + !! + !! cseti, csetr, csetc - Set internal parameters, if any + ! type mld_d_base_aggregator_type contains @@ -232,7 +217,28 @@ contains return end subroutine mld_d_base_aggregator_set_aggr_type - + + ! + !> Function bld_tprol: + !! \memberof mld_d_base_aggregator_type + !! \brief Build a tentative prolongator. + !! The routine will map the local matrix entries to aggregates. + !! The mapping is store in ILAGGR; for each local row index I, + !! ILAGGR(I) contains the index of the aggregate to which index I + !! will contribute, in global numbering. + !! Many aggregation produce a binary tentative prolongators, but some + !! do not, hence we also need the OP_PROL output. + !! + !! \param ag The input aggregator object + !! \param parms The auxiliary parameters object + !! \param a The local matrix part + !! \param desc_a The descriptor + !! \param ilaggr Output aggregation map + !! \param nlaggr Sizes of ilaggr on all processes + !! \param op_prol The tentative prolongator operator + !! \param info Return code + !! + ! subroutine mld_d_base_aggregator_build_tprol(ag,parms,a,desc_a,ilaggr,nlaggr,op_prol,info) use psb_base_mod implicit none @@ -262,7 +268,25 @@ contains end subroutine mld_d_base_aggregator_build_tprol - + ! + !> Function mat_asb + !! \memberof mld_d_base_aggregator_type + !! \brief Build prolongator/restrictor/coarse matrix. + !! + !! + !! \param ag The input aggregator object + !! \param parms The auxiliary parameters object + !! \param a The local matrix part + !! \param desc_a The descriptor + !! \param ilaggr Aggregation map + !! \param nlaggr Sizes of ilaggr on all processes + !! \param ac On output the coarse matrix + !! \param op_prol On input, the tentative prolongator operator, on output + !! the final prolongator + !! \param op_restr On output, the restrictor operator; + !! in many cases it is the transpose of the prolongator. + !! \param info Return code + !! subroutine mld_d_base_aggregator_mat_asb(ag,parms,a,desc_a,ilaggr,nlaggr,ac,& & op_prol,op_restr,info) use psb_base_mod diff --git a/mlprec/mld_d_onelev_mod.f90 b/mlprec/mld_d_onelev_mod.f90 index e465667b..2a4229cd 100644 --- a/mlprec/mld_d_onelev_mod.f90 +++ b/mlprec/mld_d_onelev_mod.f90 @@ -62,35 +62,48 @@ module mld_d_onelev_mod & psb_erractionsave, psb_error_handler ! ! - ! Type: mld_Tonelev_type. + ! Type: mld_donelev_type. ! ! It is the data type containing the necessary items for the current ! level (essentially, the smoother, the current-level matrix ! and the restriction and prolongation operators). ! - ! type mld_Tonelev_type - ! class(mld_T_base_smoother_type), allocatable :: sm - ! type(mld_RTml_parms) :: parms - ! type(psb_Tspmat_type) :: ac - ! type(psb_Tesc_type) :: desc_ac - ! type(psb_Tspmat_type), pointer :: base_a => null() - ! type(psb_Tesc_type), pointer :: base_desc => null() - ! type(psb_Tlinmap_type) :: map - ! end type mld_Tonelev_type + ! type mld_donelev_type + ! class(mld_d_base_smoother_type), allocatable :: sm, sm2a + ! class(mld_d_base_smoother_type), pointer :: sm2 => null() + ! class(mld_dmlprec_wrk_type), allocatable :: wrk + ! class(mld_d_base_aggregator_type), allocatable :: aggr + ! type(mld_dml_parms) :: parms + ! type(psb_dspmat_type) :: ac + ! type(psb_desc_type) :: desc_ac + ! type(psb_dspmat_type), pointer :: base_a => null() + ! type(psb_desc_type), pointer :: base_desc => null() + ! type(psb_dlinmap_type) :: map + ! end type mld_donelev_type ! - ! Note that psb_Tpk denotes the kind of the real data type to be chosen + ! Note that d denotes the kind of the real data type to be chosen ! according to single/double precision version of MLD2P4. ! - ! sm - class(mld_T_base_smoother_type), allocatable - ! The current level preconditioner (aka smoother). - ! parms - type(mld_RTml_parms) + ! sm,sm2a - class(mld_d_base_smoother_type), allocatable + ! The current level pre- and post-smooother. + ! sm2 - class(mld_d_base_smoother_type), pointer + ! The current level post-smooother; if sm2a is allocated + ! explicitly, then sm2 => sm2a, otherwise sm2 => sm. + ! wrk - class(mld_dmlprec_wrk_type), allocatable + ! Workspace for application of preconditioner; may be + ! pre-allocated to save time in the application within a + ! Krylov solver. + ! aggr - class(mld_d_base_aggregator_type), allocatable + ! The aggregator object: holds the algorithmic choices and + ! (possibly) additional data for building the aggregation. + ! parms - type(mld_dml_parms) ! The parameters defining the multilevel strategy. ! ac - The local part of the current-level matrix, built by ! coarsening the previous-level matrix. ! desc_ac - type(psb_desc_type). ! The communication descriptor associated to the matrix ! stored in ac. - ! base_a - type(psb_Tspmat_type), pointer. + ! base_a - type(psb_dspmat_type), pointer. ! Pointer (really a pointer!) to the local part of the current ! matrix (so we have a unified treatment of residuals). ! We need this to avoid passing explicitly the current matrix @@ -115,10 +128,14 @@ module mld_d_onelev_mod ! dump - Dump to file object contents ! set - Sets various parameters; when a request is unknown ! it is passed to the smoother object for further processing. - ! check - Sanity checks. - ! sizeof - Total memory occupation in bytes - ! get_nzeros - Number of nonzeros - ! get_wrksz - How many workspace vector does apply_vect need + ! check - Sanity checks. + ! sizeof - Total memory occupation in bytes + ! get_nzeros - Number of nonzeros + ! get_wrksz - How many workspace vector does apply_vect need + ! allocate_wrk - Allocate auxiliary workspace + ! free_wrk - Free auxiliary workspace + ! bld_tprol - Invoke the aggr method to build the tentative prolongator + ! mat_asb - Build the final (possibly smoothed) prolongator and coarse matrix. ! ! type mld_dmlprec_wrk_type diff --git a/mlprec/mld_s_base_aggregator_mod.f90 b/mlprec/mld_s_base_aggregator_mod.f90 index 6a180825..20fd2c11 100644 --- a/mlprec/mld_s_base_aggregator_mod.f90 +++ b/mlprec/mld_s_base_aggregator_mod.f90 @@ -37,14 +37,7 @@ ! ! ! The aggregator object hosts the aggregation method for building -! the multilevel hierarchy. The basic version is the -! decoupled 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. -! 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. +! the multilevel hierarchy. ! module mld_s_base_aggregator_mod @@ -54,45 +47,37 @@ module mld_s_base_aggregator_mod & psb_ipk_, psb_long_int_k_, psb_desc_type, psb_i_base_vect_type, & & psb_erractionsave, psb_error_handler, psb_success_ ! - ! sm - class(mld_T_base_smoother_type), allocatable - ! The current level preconditioner (aka smoother). - ! parms - type(mld_RTml_parms) - ! The parameters defining the multilevel strategy. - ! ac - The local part of the current-level matrix, built by - ! coarsening the previous-level matrix. - ! desc_ac - type(psb_desc_type). - ! The communication descriptor associated to the matrix - ! stored in ac. - ! base_a - type(psb_Tspmat_type), pointer. - ! Pointer (really a pointer!) to the local part of the current - ! matrix (so we have a unified treatment of residuals). - ! We need this to avoid passing explicitly the current matrix - ! to the routine which applies the preconditioner. - ! base_desc - type(psb_desc_type), pointer. - ! Pointer to the communication descriptor associated to the - ! matrix pointed by base_a. - ! map - Stores the maps (restriction and prolongation) between the - ! vector spaces associated to the index spaces of the previous - ! and current levels. - ! - ! Methods: - ! Most methods follow the encapsulation hierarchy: they take whatever action - ! is appropriate for the current object, then call the corresponding method for - ! the contained object. - ! As an example: the descr() method prints out a description of the - ! level. It starts by invoking the descr() method of the parms object, - ! then calls the descr() method of the smoother object. - ! - ! descr - Prints a description of the object. - ! default - Set default values - ! dump - Dump to file object contents - ! set - Sets various parameters; when a request is unknown - ! it is passed to the smoother object for further processing. - ! check - Sanity checks. - ! sizeof - Total memory occupation in bytes - ! get_nzeros - Number of nonzeros - ! + ! ! + !> \class mld_s_base_aggregator_type + !! + !! It is the data type containing the basic interface definition for + !! building a multigrid hierarchy by aggregation. The base object has no attributes, + !! it is intended to be essentially an abstract type. + !! + !! + !! type mld_s_base_aggregator_type + !! end type + !! + !! + !! Methods: + !! + !! bld_tprol - Build a tentative prolongator + !! + !! mat_asb - Build the final prolongator/restrictor and the + !! coarse matrix ac + !! + !! update_next - Transfer information to the next level; default is + !! to do nothing, i.e. aggregators at different + !! levels are independent. + !! + !! default - Apply defaults + !! set_aggr_type - For aggregator that have internal options. + !! fmt - Return a short string description + !! descr - Print a more detailed description + !! + !! cseti, csetr, csetc - Set internal parameters, if any + ! type mld_s_base_aggregator_type contains @@ -232,7 +217,28 @@ contains return end subroutine mld_s_base_aggregator_set_aggr_type - + + ! + !> Function bld_tprol: + !! \memberof mld_s_base_aggregator_type + !! \brief Build a tentative prolongator. + !! The routine will map the local matrix entries to aggregates. + !! The mapping is store in ILAGGR; for each local row index I, + !! ILAGGR(I) contains the index of the aggregate to which index I + !! will contribute, in global numbering. + !! Many aggregation produce a binary tentative prolongators, but some + !! do not, hence we also need the OP_PROL output. + !! + !! \param ag The input aggregator object + !! \param parms The auxiliary parameters object + !! \param a The local matrix part + !! \param desc_a The descriptor + !! \param ilaggr Output aggregation map + !! \param nlaggr Sizes of ilaggr on all processes + !! \param op_prol The tentative prolongator operator + !! \param info Return code + !! + ! subroutine mld_s_base_aggregator_build_tprol(ag,parms,a,desc_a,ilaggr,nlaggr,op_prol,info) use psb_base_mod implicit none @@ -262,7 +268,25 @@ contains end subroutine mld_s_base_aggregator_build_tprol - + ! + !> Function mat_asb + !! \memberof mld_s_base_aggregator_type + !! \brief Build prolongator/restrictor/coarse matrix. + !! + !! + !! \param ag The input aggregator object + !! \param parms The auxiliary parameters object + !! \param a The local matrix part + !! \param desc_a The descriptor + !! \param ilaggr Aggregation map + !! \param nlaggr Sizes of ilaggr on all processes + !! \param ac On output the coarse matrix + !! \param op_prol On input, the tentative prolongator operator, on output + !! the final prolongator + !! \param op_restr On output, the restrictor operator; + !! in many cases it is the transpose of the prolongator. + !! \param info Return code + !! subroutine mld_s_base_aggregator_mat_asb(ag,parms,a,desc_a,ilaggr,nlaggr,ac,& & op_prol,op_restr,info) use psb_base_mod diff --git a/mlprec/mld_s_onelev_mod.f90 b/mlprec/mld_s_onelev_mod.f90 index e40ae8fb..ae8435b8 100644 --- a/mlprec/mld_s_onelev_mod.f90 +++ b/mlprec/mld_s_onelev_mod.f90 @@ -62,35 +62,48 @@ module mld_s_onelev_mod & psb_erractionsave, psb_error_handler ! ! - ! Type: mld_Tonelev_type. + ! Type: mld_sonelev_type. ! ! It is the data type containing the necessary items for the current ! level (essentially, the smoother, the current-level matrix ! and the restriction and prolongation operators). ! - ! type mld_Tonelev_type - ! class(mld_T_base_smoother_type), allocatable :: sm - ! type(mld_RTml_parms) :: parms - ! type(psb_Tspmat_type) :: ac - ! type(psb_Tesc_type) :: desc_ac - ! type(psb_Tspmat_type), pointer :: base_a => null() - ! type(psb_Tesc_type), pointer :: base_desc => null() - ! type(psb_Tlinmap_type) :: map - ! end type mld_Tonelev_type + ! type mld_sonelev_type + ! class(mld_s_base_smoother_type), allocatable :: sm, sm2a + ! class(mld_s_base_smoother_type), pointer :: sm2 => null() + ! class(mld_smlprec_wrk_type), allocatable :: wrk + ! class(mld_s_base_aggregator_type), allocatable :: aggr + ! type(mld_sml_parms) :: parms + ! type(psb_sspmat_type) :: ac + ! type(psb_sesc_type) :: desc_ac + ! type(psb_sspmat_type), pointer :: base_a => null() + ! type(psb_desc_type), pointer :: base_desc => null() + ! type(psb_slinmap_type) :: map + ! end type mld_sonelev_type ! - ! Note that psb_Tpk denotes the kind of the real data type to be chosen + ! Note that s denotes the kind of the real data type to be chosen ! according to single/double precision version of MLD2P4. ! - ! sm - class(mld_T_base_smoother_type), allocatable - ! The current level preconditioner (aka smoother). - ! parms - type(mld_RTml_parms) + ! sm,sm2a - class(mld_s_base_smoother_type), allocatable + ! The current level pre- and post-smooother. + ! sm2 - class(mld_s_base_smoother_type), pointer + ! The current level post-smooother; if sm2a is allocated + ! explicitly, then sm2 => sm2a, otherwise sm2 => sm. + ! wrk - class(mld_smlprec_wrk_type), allocatable + ! Workspace for application of preconditioner; may be + ! pre-allocated to save time in the application within a + ! Krylov solver. + ! aggr - class(mld_s_base_aggregator_type), allocatable + ! The aggregator object: holds the algorithmic choices and + ! (possibly) additional data for building the aggregation. + ! parms - type(mld_sml_parms) ! The parameters defining the multilevel strategy. ! ac - The local part of the current-level matrix, built by ! coarsening the previous-level matrix. ! desc_ac - type(psb_desc_type). ! The communication descriptor associated to the matrix ! stored in ac. - ! base_a - type(psb_Tspmat_type), pointer. + ! base_a - type(psb_sspmat_type), pointer. ! Pointer (really a pointer!) to the local part of the current ! matrix (so we have a unified treatment of residuals). ! We need this to avoid passing explicitly the current matrix @@ -115,10 +128,14 @@ module mld_s_onelev_mod ! dump - Dump to file object contents ! set - Sets various parameters; when a request is unknown ! it is passed to the smoother object for further processing. - ! check - Sanity checks. - ! sizeof - Total memory occupation in bytes - ! get_nzeros - Number of nonzeros - ! get_wrksz - How many workspace vector does apply_vect need + ! check - Sanity checks. + ! sizeof - Total memory occupation in bytes + ! get_nzeros - Number of nonzeros + ! get_wrksz - How many workspace vector does apply_vect need + ! allocate_wrk - Allocate auxiliary workspace + ! free_wrk - Free auxiliary workspace + ! bld_tprol - Invoke the aggr method to build the tentative prolongator + ! mat_asb - Build the final (possibly smoothed) prolongator and coarse matrix. ! ! type mld_smlprec_wrk_type diff --git a/mlprec/mld_z_base_aggregator_mod.f90 b/mlprec/mld_z_base_aggregator_mod.f90 index 017b1f36..5f400319 100644 --- a/mlprec/mld_z_base_aggregator_mod.f90 +++ b/mlprec/mld_z_base_aggregator_mod.f90 @@ -37,14 +37,7 @@ ! ! ! The aggregator object hosts the aggregation method for building -! the multilevel hierarchy. The basic version is the -! decoupled 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. -! 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. +! the multilevel hierarchy. ! module mld_z_base_aggregator_mod @@ -54,45 +47,37 @@ module mld_z_base_aggregator_mod & psb_ipk_, psb_long_int_k_, psb_desc_type, psb_i_base_vect_type, & & psb_erractionsave, psb_error_handler, psb_success_ ! - ! sm - class(mld_T_base_smoother_type), allocatable - ! The current level preconditioner (aka smoother). - ! parms - type(mld_RTml_parms) - ! The parameters defining the multilevel strategy. - ! ac - The local part of the current-level matrix, built by - ! coarsening the previous-level matrix. - ! desc_ac - type(psb_desc_type). - ! The communication descriptor associated to the matrix - ! stored in ac. - ! base_a - type(psb_Tspmat_type), pointer. - ! Pointer (really a pointer!) to the local part of the current - ! matrix (so we have a unified treatment of residuals). - ! We need this to avoid passing explicitly the current matrix - ! to the routine which applies the preconditioner. - ! base_desc - type(psb_desc_type), pointer. - ! Pointer to the communication descriptor associated to the - ! matrix pointed by base_a. - ! map - Stores the maps (restriction and prolongation) between the - ! vector spaces associated to the index spaces of the previous - ! and current levels. - ! - ! Methods: - ! Most methods follow the encapsulation hierarchy: they take whatever action - ! is appropriate for the current object, then call the corresponding method for - ! the contained object. - ! As an example: the descr() method prints out a description of the - ! level. It starts by invoking the descr() method of the parms object, - ! then calls the descr() method of the smoother object. - ! - ! descr - Prints a description of the object. - ! default - Set default values - ! dump - Dump to file object contents - ! set - Sets various parameters; when a request is unknown - ! it is passed to the smoother object for further processing. - ! check - Sanity checks. - ! sizeof - Total memory occupation in bytes - ! get_nzeros - Number of nonzeros - ! + ! ! + !> \class mld_z_base_aggregator_type + !! + !! It is the data type containing the basic interface definition for + !! building a multigrid hierarchy by aggregation. The base object has no attributes, + !! it is intended to be essentially an abstract type. + !! + !! + !! type mld_z_base_aggregator_type + !! end type + !! + !! + !! Methods: + !! + !! bld_tprol - Build a tentative prolongator + !! + !! mat_asb - Build the final prolongator/restrictor and the + !! coarse matrix ac + !! + !! update_next - Transfer information to the next level; default is + !! to do nothing, i.e. aggregators at different + !! levels are independent. + !! + !! default - Apply defaults + !! set_aggr_type - For aggregator that have internal options. + !! fmt - Return a short string description + !! descr - Print a more detailed description + !! + !! cseti, csetr, csetc - Set internal parameters, if any + ! type mld_z_base_aggregator_type contains @@ -232,7 +217,28 @@ contains return end subroutine mld_z_base_aggregator_set_aggr_type - + + ! + !> Function bld_tprol: + !! \memberof mld_z_base_aggregator_type + !! \brief Build a tentative prolongator. + !! The routine will map the local matrix entries to aggregates. + !! The mapping is store in ILAGGR; for each local row index I, + !! ILAGGR(I) contains the index of the aggregate to which index I + !! will contribute, in global numbering. + !! Many aggregation produce a binary tentative prolongators, but some + !! do not, hence we also need the OP_PROL output. + !! + !! \param ag The input aggregator object + !! \param parms The auxiliary parameters object + !! \param a The local matrix part + !! \param desc_a The descriptor + !! \param ilaggr Output aggregation map + !! \param nlaggr Sizes of ilaggr on all processes + !! \param op_prol The tentative prolongator operator + !! \param info Return code + !! + ! subroutine mld_z_base_aggregator_build_tprol(ag,parms,a,desc_a,ilaggr,nlaggr,op_prol,info) use psb_base_mod implicit none @@ -262,7 +268,25 @@ contains end subroutine mld_z_base_aggregator_build_tprol - + ! + !> Function mat_asb + !! \memberof mld_z_base_aggregator_type + !! \brief Build prolongator/restrictor/coarse matrix. + !! + !! + !! \param ag The input aggregator object + !! \param parms The auxiliary parameters object + !! \param a The local matrix part + !! \param desc_a The descriptor + !! \param ilaggr Aggregation map + !! \param nlaggr Sizes of ilaggr on all processes + !! \param ac On output the coarse matrix + !! \param op_prol On input, the tentative prolongator operator, on output + !! the final prolongator + !! \param op_restr On output, the restrictor operator; + !! in many cases it is the transpose of the prolongator. + !! \param info Return code + !! subroutine mld_z_base_aggregator_mat_asb(ag,parms,a,desc_a,ilaggr,nlaggr,ac,& & op_prol,op_restr,info) use psb_base_mod diff --git a/mlprec/mld_z_onelev_mod.f90 b/mlprec/mld_z_onelev_mod.f90 index ceaa300e..9074aa5d 100644 --- a/mlprec/mld_z_onelev_mod.f90 +++ b/mlprec/mld_z_onelev_mod.f90 @@ -62,35 +62,48 @@ module mld_z_onelev_mod & psb_erractionsave, psb_error_handler ! ! - ! Type: mld_Tonelev_type. + ! Type: mld_zonelev_type. ! ! It is the data type containing the necessary items for the current ! level (essentially, the smoother, the current-level matrix ! and the restriction and prolongation operators). ! - ! type mld_Tonelev_type - ! class(mld_T_base_smoother_type), allocatable :: sm - ! type(mld_RTml_parms) :: parms - ! type(psb_Tspmat_type) :: ac - ! type(psb_Tesc_type) :: desc_ac - ! type(psb_Tspmat_type), pointer :: base_a => null() - ! type(psb_Tesc_type), pointer :: base_desc => null() - ! type(psb_Tlinmap_type) :: map - ! end type mld_Tonelev_type + ! type mld_zonelev_type + ! class(mld_z_base_smoother_type), allocatable :: sm, sm2a + ! class(mld_z_base_smoother_type), pointer :: sm2 => null() + ! class(mld_zmlprec_wrk_type), allocatable :: wrk + ! class(mld_z_base_aggregator_type), allocatable :: aggr + ! type(mld_dml_parms) :: parms + ! type(psb_zspmat_type) :: ac + ! type(psb_zesc_type) :: desc_ac + ! type(psb_zspmat_type), pointer :: base_a => null() + ! type(psb_desc_type), pointer :: base_desc => null() + ! type(psb_zlinmap_type) :: map + ! end type mld_zonelev_type ! - ! Note that psb_Tpk denotes the kind of the real data type to be chosen + ! Note that d denotes the kind of the real data type to be chosen ! according to single/double precision version of MLD2P4. ! - ! sm - class(mld_T_base_smoother_type), allocatable - ! The current level preconditioner (aka smoother). - ! parms - type(mld_RTml_parms) + ! sm,sm2a - class(mld_z_base_smoother_type), allocatable + ! The current level pre- and post-smooother. + ! sm2 - class(mld_z_base_smoother_type), pointer + ! The current level post-smooother; if sm2a is allocated + ! explicitly, then sm2 => sm2a, otherwise sm2 => sm. + ! wrk - class(mld_zmlprec_wrk_type), allocatable + ! Workspace for application of preconditioner; may be + ! pre-allocated to save time in the application within a + ! Krylov solver. + ! aggr - class(mld_z_base_aggregator_type), allocatable + ! The aggregator object: holds the algorithmic choices and + ! (possibly) additional data for building the aggregation. + ! parms - type(mld_dml_parms) ! The parameters defining the multilevel strategy. ! ac - The local part of the current-level matrix, built by ! coarsening the previous-level matrix. ! desc_ac - type(psb_desc_type). ! The communication descriptor associated to the matrix ! stored in ac. - ! base_a - type(psb_Tspmat_type), pointer. + ! base_a - type(psb_zspmat_type), pointer. ! Pointer (really a pointer!) to the local part of the current ! matrix (so we have a unified treatment of residuals). ! We need this to avoid passing explicitly the current matrix @@ -115,10 +128,14 @@ module mld_z_onelev_mod ! dump - Dump to file object contents ! set - Sets various parameters; when a request is unknown ! it is passed to the smoother object for further processing. - ! check - Sanity checks. - ! sizeof - Total memory occupation in bytes - ! get_nzeros - Number of nonzeros - ! get_wrksz - How many workspace vector does apply_vect need + ! check - Sanity checks. + ! sizeof - Total memory occupation in bytes + ! get_nzeros - Number of nonzeros + ! get_wrksz - How many workspace vector does apply_vect need + ! allocate_wrk - Allocate auxiliary workspace + ! free_wrk - Free auxiliary workspace + ! bld_tprol - Invoke the aggr method to build the tentative prolongator + ! mat_asb - Build the final (possibly smoothed) prolongator and coarse matrix. ! ! type mld_zmlprec_wrk_type