diff --git a/mlprec/Makefile b/mlprec/Makefile index 5de506ee..f683e3e4 100644 --- a/mlprec/Makefile +++ b/mlprec/Makefile @@ -13,7 +13,7 @@ DMODOBJS=mld_d_prec_type.o mld_d_ilu_fact_mod.o \ mld_d_base_solver_mod.o mld_d_base_smoother_mod.o mld_d_onelev_mod.o \ mld_d_gs_solver.o mld_d_mumps_solver.o \ mld_d_base_aggregator_mod.o mld_d_hybrid_aggregator_mod.o \ - mld_d_symdec_aggregator_mod.o + mld_d_dec_aggregator_mod.o mld_d_symdec_aggregator_mod.o #mld_d_bcmatch_aggregator_mod.o SMODOBJS=mld_s_prec_type.o mld_s_ilu_fact_mod.o \ @@ -22,7 +22,7 @@ SMODOBJS=mld_s_prec_type.o mld_s_ilu_fact_mod.o \ mld_s_base_solver_mod.o mld_s_base_smoother_mod.o mld_s_onelev_mod.o \ mld_s_gs_solver.o mld_s_mumps_solver.o \ mld_s_base_aggregator_mod.o mld_s_hybrid_aggregator_mod.o \ - mld_s_symdec_aggregator_mod.o + mld_s_dec_aggregator_mod.o mld_s_symdec_aggregator_mod.o ZMODOBJS=mld_z_prec_type.o mld_z_ilu_fact_mod.o \ mld_z_inner_mod.o mld_z_ilu_solver.o mld_z_diag_solver.o mld_z_jac_smoother.o mld_z_as_smoother.o \ @@ -30,7 +30,7 @@ ZMODOBJS=mld_z_prec_type.o mld_z_ilu_fact_mod.o \ mld_z_base_solver_mod.o mld_z_base_smoother_mod.o mld_z_onelev_mod.o \ mld_z_gs_solver.o mld_z_mumps_solver.o \ mld_z_base_aggregator_mod.o mld_z_hybrid_aggregator_mod.o \ - mld_z_symdec_aggregator_mod.o + mld_z_dec_aggregator_mod.o mld_z_symdec_aggregator_mod.o CMODOBJS=mld_c_prec_type.o mld_c_ilu_fact_mod.o \ mld_c_inner_mod.o mld_c_ilu_solver.o mld_c_diag_solver.o mld_c_jac_smoother.o mld_c_as_smoother.o \ @@ -38,7 +38,7 @@ CMODOBJS=mld_c_prec_type.o mld_c_ilu_fact_mod.o \ mld_c_base_solver_mod.o mld_c_base_smoother_mod.o mld_c_onelev_mod.o \ mld_c_gs_solver.o mld_c_mumps_solver.o \ mld_c_base_aggregator_mod.o mld_c_hybrid_aggregator_mod.o \ - mld_c_symdec_aggregator_mod.o + mld_c_dec_aggregator_mod.o mld_c_symdec_aggregator_mod.o @@ -93,22 +93,26 @@ mld_d_prec_type.o: mld_d_onelev_mod.o mld_c_prec_type.o: mld_c_onelev_mod.o mld_z_prec_type.o: mld_z_onelev_mod.o -mld_s_onelev_mod.o: mld_s_base_smoother_mod.o mld_s_base_aggregator_mod.o -mld_d_onelev_mod.o: mld_d_base_smoother_mod.o mld_d_base_aggregator_mod.o -mld_c_onelev_mod.o: mld_c_base_smoother_mod.o mld_c_base_aggregator_mod.o -mld_z_onelev_mod.o: mld_z_base_smoother_mod.o mld_z_base_aggregator_mod.o +mld_s_onelev_mod.o: mld_s_base_smoother_mod.o mld_s_dec_aggregator_mod.o +mld_d_onelev_mod.o: mld_d_base_smoother_mod.o mld_d_dec_aggregator_mod.o +mld_c_onelev_mod.o: mld_c_base_smoother_mod.o mld_c_dec_aggregator_mod.o +mld_z_onelev_mod.o: mld_z_base_smoother_mod.o mld_z_dec_aggregator_mod.o mld_s_base_aggregator_mod.o: mld_base_prec_type.o -mld_s_hybrid_aggregator_mod.o mld_s_symdec_aggregator_mod.o: mld_s_base_aggregator_mod.o +mld_s_hybrid_aggregator_mod.o mld_s_dec_aggregator_mod.o: mld_s_base_aggregator_mod.o +mld_s_symdec_aggregator_mod.o: mld_s_dec_aggregator_mod.o mld_d_base_aggregator_mod.o: mld_base_prec_type.o -mld_d_bcmatch_aggregator_mod.o mld_d_hybrid_aggregator_mod.o mld_d_symdec_aggregator_mod.o: mld_d_base_aggregator_mod.o +mld_d_hybrid_aggregator_mod.o mld_d_dec_aggregator_mod.o: mld_d_base_aggregator_mod.o +mld_d_symdec_aggregator_mod.o: mld_d_dec_aggregator_mod.o mld_c_base_aggregator_mod.o: mld_base_prec_type.o -mld_c_hybrid_aggregator_mod.o mld_c_symdec_aggregator_mod.o: mld_c_base_aggregator_mod.o +mld_c_hybrid_aggregator_mod.o mld_c_dec_aggregator_mod.o: mld_c_base_aggregator_mod.o +mld_c_symdec_aggregator_mod.o: mld_c_dec_aggregator_mod.o mld_z_base_aggregator_mod.o: mld_base_prec_type.o -mld_z_hybrid_aggregator_mod.o mld_z_symdec_aggregator_mod.o: mld_z_base_aggregator_mod.o +mld_z_hybrid_aggregator_mod.o mld_z_dec_aggregator_mod.o: mld_z_base_aggregator_mod.o +mld_z_symdec_aggregator_mod.o: mld_z_dec_aggregator_mod.o mld_s_base_smoother_mod.o: mld_s_base_solver_mod.o mld_d_base_smoother_mod.o: mld_d_base_solver_mod.o diff --git a/mlprec/mld_c_base_aggregator_mod.f90 b/mlprec/mld_c_base_aggregator_mod.f90 index 4576af81..85d16d4d 100644 --- a/mlprec/mld_c_base_aggregator_mod.f90 +++ b/mlprec/mld_c_base_aggregator_mod.f90 @@ -168,7 +168,7 @@ contains integer(psb_ipk_), intent(in) :: iout integer(psb_ipk_), intent(out) :: info - call parms%mldescr(iout,info,aggr_name=ag%fmt()) + call parms%mldescr(iout,info) return end subroutine mld_c_base_aggregator_descr diff --git a/mlprec/mld_c_dec_aggregator_mod.f90 b/mlprec/mld_c_dec_aggregator_mod.f90 new file mode 100644 index 00000000..8c6df140 --- /dev/null +++ b/mlprec/mld_c_dec_aggregator_mod.f90 @@ -0,0 +1,143 @@ +! +! +! 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. +! +! +! +! +! The aggregator object hosts the aggregation method for building +! the multilevel hierarchy. +! +! 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. +! +module mld_c_dec_aggregator_mod + + use mld_c_base_aggregator_mod + ! + ! 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 + ! + ! + type, extends(mld_c_base_aggregator_type) :: mld_c_dec_aggregator_type + + contains + procedure, pass(ag) :: tprol => mld_c_dec_aggregator_build_tprol + procedure, pass(ag) :: mat_asb => mld_c_dec_aggregator_mat_asb + procedure, nopass :: fmt => mld_c_dec_aggregator_fmt + end type mld_c_dec_aggregator_type + + + interface + subroutine mld_c_dec_aggregator_build_tprol(ag,parms,a,desc_a,ilaggr,nlaggr,op_prol,info) + import :: mld_c_dec_aggregator_type, psb_desc_type, psb_cspmat_type, psb_spk_, & + & psb_ipk_, psb_long_int_k_, mld_sml_parms + 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_), allocatable, intent(out) :: ilaggr(:),nlaggr(:) + type(psb_cspmat_type), intent(out) :: op_prol + integer(psb_ipk_), intent(out) :: info + end subroutine mld_c_dec_aggregator_build_tprol + end interface + + interface + subroutine mld_c_dec_aggregator_mat_asb(ag,parms,a,desc_a,ilaggr,nlaggr,ac,& + & op_prol,op_restr,info) + import :: mld_c_dec_aggregator_type, psb_desc_type, psb_cspmat_type, psb_spk_, & + & psb_ipk_, psb_long_int_k_, mld_sml_parms + 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 + end subroutine mld_c_dec_aggregator_mat_asb + end interface + + +contains + + function mld_c_dec_aggregator_fmt() result(val) + implicit none + character(len=32) :: val + + val = "Decoupled aggregation" + end function mld_c_dec_aggregator_fmt + +end module mld_c_dec_aggregator_mod diff --git a/mlprec/mld_c_onelev_mod.f90 b/mlprec/mld_c_onelev_mod.f90 index db9a64cc..8ddbed4e 100644 --- a/mlprec/mld_c_onelev_mod.f90 +++ b/mlprec/mld_c_onelev_mod.f90 @@ -55,7 +55,7 @@ module mld_c_onelev_mod use mld_base_prec_type use mld_c_base_smoother_mod - use mld_c_base_aggregator_mod + use mld_c_dec_aggregator_mod use psb_base_mod, only : psb_cspmat_type, psb_c_vect_type, & & psb_c_base_vect_type, psb_clinmap_type, psb_spk_, & & psb_ipk_, psb_long_int_k_, psb_desc_type, psb_i_base_vect_type, & diff --git a/mlprec/mld_d_base_aggregator_mod.f90 b/mlprec/mld_d_base_aggregator_mod.f90 index 85dc972e..f89b636a 100644 --- a/mlprec/mld_d_base_aggregator_mod.f90 +++ b/mlprec/mld_d_base_aggregator_mod.f90 @@ -168,7 +168,7 @@ contains integer(psb_ipk_), intent(in) :: iout integer(psb_ipk_), intent(out) :: info - call parms%mldescr(iout,info,aggr_name=ag%fmt()) + call parms%mldescr(iout,info) return end subroutine mld_d_base_aggregator_descr diff --git a/mlprec/mld_d_dec_aggregator_mod.f90 b/mlprec/mld_d_dec_aggregator_mod.f90 new file mode 100644 index 00000000..ec25f574 --- /dev/null +++ b/mlprec/mld_d_dec_aggregator_mod.f90 @@ -0,0 +1,143 @@ +! +! +! 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. +! +! +! +! +! The aggregator object hosts the aggregation method for building +! the multilevel hierarchy. +! +! 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. +! +module mld_d_dec_aggregator_mod + + use mld_d_base_aggregator_mod + ! + ! 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 + ! + ! + type, extends(mld_d_base_aggregator_type) :: mld_d_dec_aggregator_type + + contains + procedure, pass(ag) :: tprol => mld_d_dec_aggregator_build_tprol + procedure, pass(ag) :: mat_asb => mld_d_dec_aggregator_mat_asb + procedure, nopass :: fmt => mld_d_dec_aggregator_fmt + end type mld_d_dec_aggregator_type + + + interface + subroutine mld_d_dec_aggregator_build_tprol(ag,parms,a,desc_a,ilaggr,nlaggr,op_prol,info) + import :: mld_d_dec_aggregator_type, psb_desc_type, psb_dspmat_type, psb_dpk_, & + & psb_ipk_, psb_long_int_k_, mld_dml_parms + 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_), allocatable, intent(out) :: ilaggr(:),nlaggr(:) + type(psb_dspmat_type), intent(out) :: op_prol + integer(psb_ipk_), intent(out) :: info + end subroutine mld_d_dec_aggregator_build_tprol + end interface + + interface + subroutine mld_d_dec_aggregator_mat_asb(ag,parms,a,desc_a,ilaggr,nlaggr,ac,& + & op_prol,op_restr,info) + import :: mld_d_dec_aggregator_type, psb_desc_type, psb_dspmat_type, psb_dpk_, & + & psb_ipk_, psb_long_int_k_, mld_dml_parms + 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 + end subroutine mld_d_dec_aggregator_mat_asb + end interface + + +contains + + function mld_d_dec_aggregator_fmt() result(val) + implicit none + character(len=32) :: val + + val = "Decoupled aggregation" + end function mld_d_dec_aggregator_fmt + +end module mld_d_dec_aggregator_mod diff --git a/mlprec/mld_d_onelev_mod.f90 b/mlprec/mld_d_onelev_mod.f90 index c8e7630d..a109e6eb 100644 --- a/mlprec/mld_d_onelev_mod.f90 +++ b/mlprec/mld_d_onelev_mod.f90 @@ -55,7 +55,7 @@ module mld_d_onelev_mod use mld_base_prec_type use mld_d_base_smoother_mod - use mld_d_base_aggregator_mod + use mld_d_dec_aggregator_mod use psb_base_mod, only : psb_dspmat_type, psb_d_vect_type, & & psb_d_base_vect_type, psb_dlinmap_type, psb_dpk_, & & psb_ipk_, psb_long_int_k_, psb_desc_type, psb_i_base_vect_type, & diff --git a/mlprec/mld_s_base_aggregator_mod.f90 b/mlprec/mld_s_base_aggregator_mod.f90 index 4b7a5fd4..6128df62 100644 --- a/mlprec/mld_s_base_aggregator_mod.f90 +++ b/mlprec/mld_s_base_aggregator_mod.f90 @@ -168,7 +168,7 @@ contains integer(psb_ipk_), intent(in) :: iout integer(psb_ipk_), intent(out) :: info - call parms%mldescr(iout,info,aggr_name=ag%fmt()) + call parms%mldescr(iout,info) return end subroutine mld_s_base_aggregator_descr diff --git a/mlprec/mld_s_dec_aggregator_mod.f90 b/mlprec/mld_s_dec_aggregator_mod.f90 new file mode 100644 index 00000000..63cdd6ea --- /dev/null +++ b/mlprec/mld_s_dec_aggregator_mod.f90 @@ -0,0 +1,143 @@ +! +! +! 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. +! +! +! +! +! The aggregator object hosts the aggregation method for building +! the multilevel hierarchy. +! +! 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. +! +module mld_s_dec_aggregator_mod + + use mld_s_base_aggregator_mod + ! + ! 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 + ! + ! + type, extends(mld_s_base_aggregator_type) :: mld_s_dec_aggregator_type + + contains + procedure, pass(ag) :: tprol => mld_s_dec_aggregator_build_tprol + procedure, pass(ag) :: mat_asb => mld_s_dec_aggregator_mat_asb + procedure, nopass :: fmt => mld_s_dec_aggregator_fmt + end type mld_s_dec_aggregator_type + + + interface + subroutine mld_s_dec_aggregator_build_tprol(ag,parms,a,desc_a,ilaggr,nlaggr,op_prol,info) + import :: mld_s_dec_aggregator_type, psb_desc_type, psb_sspmat_type, psb_spk_, & + & psb_ipk_, psb_long_int_k_, mld_sml_parms + 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_), allocatable, intent(out) :: ilaggr(:),nlaggr(:) + type(psb_sspmat_type), intent(out) :: op_prol + integer(psb_ipk_), intent(out) :: info + end subroutine mld_s_dec_aggregator_build_tprol + end interface + + interface + subroutine mld_s_dec_aggregator_mat_asb(ag,parms,a,desc_a,ilaggr,nlaggr,ac,& + & op_prol,op_restr,info) + import :: mld_s_dec_aggregator_type, psb_desc_type, psb_sspmat_type, psb_spk_, & + & psb_ipk_, psb_long_int_k_, mld_sml_parms + 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 + end subroutine mld_s_dec_aggregator_mat_asb + end interface + + +contains + + function mld_s_dec_aggregator_fmt() result(val) + implicit none + character(len=32) :: val + + val = "Decoupled aggregation" + end function mld_s_dec_aggregator_fmt + +end module mld_s_dec_aggregator_mod diff --git a/mlprec/mld_s_onelev_mod.f90 b/mlprec/mld_s_onelev_mod.f90 index a3bf3cb5..e1c7bd01 100644 --- a/mlprec/mld_s_onelev_mod.f90 +++ b/mlprec/mld_s_onelev_mod.f90 @@ -55,7 +55,7 @@ module mld_s_onelev_mod use mld_base_prec_type use mld_s_base_smoother_mod - use mld_s_base_aggregator_mod + use mld_s_dec_aggregator_mod use psb_base_mod, only : psb_sspmat_type, psb_s_vect_type, & & psb_s_base_vect_type, psb_slinmap_type, psb_spk_, & & psb_ipk_, psb_long_int_k_, psb_desc_type, psb_i_base_vect_type, & diff --git a/mlprec/mld_z_base_aggregator_mod.f90 b/mlprec/mld_z_base_aggregator_mod.f90 index e737c7df..e76f4561 100644 --- a/mlprec/mld_z_base_aggregator_mod.f90 +++ b/mlprec/mld_z_base_aggregator_mod.f90 @@ -168,7 +168,7 @@ contains integer(psb_ipk_), intent(in) :: iout integer(psb_ipk_), intent(out) :: info - call parms%mldescr(iout,info,aggr_name=ag%fmt()) + call parms%mldescr(iout,info) return end subroutine mld_z_base_aggregator_descr diff --git a/mlprec/mld_z_dec_aggregator_mod.f90 b/mlprec/mld_z_dec_aggregator_mod.f90 new file mode 100644 index 00000000..61f9bcbd --- /dev/null +++ b/mlprec/mld_z_dec_aggregator_mod.f90 @@ -0,0 +1,143 @@ +! +! +! 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. +! +! +! +! +! The aggregator object hosts the aggregation method for building +! the multilevel hierarchy. +! +! 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. +! +module mld_z_dec_aggregator_mod + + use mld_z_base_aggregator_mod + ! + ! 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 + ! + ! + type, extends(mld_z_base_aggregator_type) :: mld_z_dec_aggregator_type + + contains + procedure, pass(ag) :: tprol => mld_z_dec_aggregator_build_tprol + procedure, pass(ag) :: mat_asb => mld_z_dec_aggregator_mat_asb + procedure, nopass :: fmt => mld_z_dec_aggregator_fmt + end type mld_z_dec_aggregator_type + + + interface + subroutine mld_z_dec_aggregator_build_tprol(ag,parms,a,desc_a,ilaggr,nlaggr,op_prol,info) + import :: mld_z_dec_aggregator_type, psb_desc_type, psb_zspmat_type, psb_dpk_, & + & psb_ipk_, psb_long_int_k_, mld_dml_parms + 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_), allocatable, intent(out) :: ilaggr(:),nlaggr(:) + type(psb_zspmat_type), intent(out) :: op_prol + integer(psb_ipk_), intent(out) :: info + end subroutine mld_z_dec_aggregator_build_tprol + end interface + + interface + subroutine mld_z_dec_aggregator_mat_asb(ag,parms,a,desc_a,ilaggr,nlaggr,ac,& + & op_prol,op_restr,info) + import :: mld_z_dec_aggregator_type, psb_desc_type, psb_zspmat_type, psb_dpk_, & + & psb_ipk_, psb_long_int_k_, mld_dml_parms + 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 + end subroutine mld_z_dec_aggregator_mat_asb + end interface + + +contains + + function mld_z_dec_aggregator_fmt() result(val) + implicit none + character(len=32) :: val + + val = "Decoupled aggregation" + end function mld_z_dec_aggregator_fmt + +end module mld_z_dec_aggregator_mod diff --git a/mlprec/mld_z_onelev_mod.f90 b/mlprec/mld_z_onelev_mod.f90 index 5256cc6f..bfc59dde 100644 --- a/mlprec/mld_z_onelev_mod.f90 +++ b/mlprec/mld_z_onelev_mod.f90 @@ -55,7 +55,7 @@ module mld_z_onelev_mod use mld_base_prec_type use mld_z_base_smoother_mod - use mld_z_base_aggregator_mod + use mld_z_dec_aggregator_mod use psb_base_mod, only : psb_zspmat_type, psb_z_vect_type, & & psb_z_base_vect_type, psb_zlinmap_type, psb_dpk_, & & psb_ipk_, psb_long_int_k_, psb_desc_type, psb_i_base_vect_type, &