You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
202 lines
8.5 KiB
Fortran
202 lines
8.5 KiB
Fortran
7 years ago
|
!
|
||
|
!
|
||
|
! 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.
|
||
|
!
|
||
6 years ago
|
! Basic (decoupled) aggregation algorithm. Based on the ideas in
|
||
7 years ago
|
! M. Brezina and P. Vanek, A black-box iterative solver based on a
|
||
|
! two-level Schwarz method, Computing, 63 (1999), 233-263.
|
||
6 years ago
|
! P. Vanek, J. Mandel and M. Brezina, Algebraic Multigrid by Smoothed
|
||
|
! Aggregation for Second and Fourth Order Elliptic Problems, Computing, 56
|
||
|
! (1996), 179-196.
|
||
7 years ago
|
!
|
||
4 years ago
|
module amg_d_dec_aggregator_mod
|
||
7 years ago
|
|
||
4 years ago
|
use amg_d_base_aggregator_mod
|
||
|
!> \namespace amg_d_dec_aggregator_mod \class amg_d_dec_aggregator_type
|
||
|
!! \extends amg_d_base_aggregator_mod::amg_d_base_aggregator_type
|
||
6 years ago
|
!!
|
||
4 years ago
|
!! type, extends(amg_d_base_aggregator_type) :: amg_d_dec_aggregator_type
|
||
|
!! procedure(amg_d_soc_map_bld), nopass, pointer :: soc_map_bld => null()
|
||
6 years ago
|
!! end type
|
||
|
!!
|
||
|
!! This is the simplest aggregation method: starting from the
|
||
|
!! strength-of-connection measure for defining the aggregation
|
||
|
!! 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. Vanek, J. Mandel and M. Brezina, Algebraic Multigrid by Smoothed
|
||
|
!! Aggregation for Second and Fourth Order Elliptic Problems, Computing, 56
|
||
|
!! (1996), 179-196.
|
||
|
!!
|
||
|
!! it achieves parallelization by simply acting on the local matrix,
|
||
|
!! i.e. by "decoupling" the subdomains.
|
||
|
!! The data structure hosts a "map_bld" function pointer which allows to
|
||
|
!! choose other ways to measure "strength-of-connection", of which the
|
||
|
!! Vanek-Brezina-Mandel is the default. More details are available in
|
||
|
!!
|
||
|
!! 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.
|
||
|
!!
|
||
6 years ago
|
!! The soc_map_bld method is used inside the implementation of build_tprol
|
||
6 years ago
|
!!
|
||
7 years ago
|
!
|
||
|
!
|
||
4 years ago
|
type, extends(amg_d_base_aggregator_type) :: amg_d_dec_aggregator_type
|
||
|
procedure(amg_d_soc_map_bld), nopass, pointer :: soc_map_bld => null()
|
||
7 years ago
|
|
||
|
contains
|
||
4 years ago
|
procedure, pass(ag) :: bld_tprol => amg_d_dec_aggregator_build_tprol
|
||
|
procedure, pass(ag) :: mat_bld => amg_d_dec_aggregator_mat_bld
|
||
|
procedure, pass(ag) :: mat_asb => amg_d_dec_aggregator_mat_asb
|
||
|
procedure, pass(ag) :: default => amg_d_dec_aggregator_default
|
||
|
procedure, pass(ag) :: set_aggr_type => amg_d_dec_aggregator_set_aggr_type
|
||
|
procedure, pass(ag) :: descr => amg_d_dec_aggregator_descr
|
||
|
procedure, nopass :: fmt => amg_d_dec_aggregator_fmt
|
||
|
end type amg_d_dec_aggregator_type
|
||
7 years ago
|
|
||
|
|
||
4 years ago
|
procedure(amg_d_soc_map_bld) :: amg_d_soc1_map_bld, amg_d_soc2_map_bld
|
||
7 years ago
|
|
||
7 years ago
|
interface
|
||
4 years ago
|
subroutine amg_d_dec_aggregator_build_tprol(ag,parms,ag_data,&
|
||
5 years ago
|
& a,desc_a,ilaggr,nlaggr,t_prol,info)
|
||
4 years ago
|
import :: amg_d_dec_aggregator_type, psb_desc_type, psb_dspmat_type, psb_dpk_, &
|
||
|
& psb_ipk_, psb_lpk_, psb_ldspmat_type, amg_dml_parms, amg_daggr_data
|
||
7 years ago
|
implicit none
|
||
4 years ago
|
class(amg_d_dec_aggregator_type), target, intent(inout) :: ag
|
||
|
type(amg_dml_parms), intent(inout) :: parms
|
||
|
type(amg_daggr_data), intent(in) :: ag_data
|
||
6 years ago
|
type(psb_dspmat_type), intent(inout) :: a
|
||
|
type(psb_desc_type), intent(inout) :: desc_a
|
||
7 years ago
|
integer(psb_lpk_), allocatable, intent(out) :: ilaggr(:),nlaggr(:)
|
||
5 years ago
|
type(psb_ldspmat_type), intent(out) :: t_prol
|
||
7 years ago
|
integer(psb_ipk_), intent(out) :: info
|
||
4 years ago
|
end subroutine amg_d_dec_aggregator_build_tprol
|
||
7 years ago
|
end interface
|
||
|
|
||
|
interface
|
||
4 years ago
|
subroutine amg_d_dec_aggregator_mat_bld(ag,parms,a,desc_a,ilaggr,nlaggr,&
|
||
5 years ago
|
& ac,desc_ac,op_prol,op_restr,t_prol,info)
|
||
4 years ago
|
import :: amg_d_dec_aggregator_type, psb_desc_type, psb_dspmat_type, psb_dpk_, &
|
||
|
& psb_ipk_, psb_lpk_, psb_ldspmat_type, amg_dml_parms
|
||
7 years ago
|
implicit none
|
||
4 years ago
|
class(amg_d_dec_aggregator_type), target, intent(inout) :: ag
|
||
|
type(amg_dml_parms), intent(inout) :: parms
|
||
7 years ago
|
type(psb_dspmat_type), intent(in) :: a
|
||
5 years ago
|
type(psb_desc_type), intent(inout) :: desc_a
|
||
7 years ago
|
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
|
||
5 years ago
|
type(psb_ldspmat_type), intent(inout) :: t_prol
|
||
|
type(psb_dspmat_type), intent(out) :: op_prol, ac,op_restr
|
||
5 years ago
|
type(psb_desc_type), intent(inout) :: desc_ac
|
||
5 years ago
|
integer(psb_ipk_), intent(out) :: info
|
||
4 years ago
|
end subroutine amg_d_dec_aggregator_mat_bld
|
||
7 years ago
|
end interface
|
||
|
|
||
6 years ago
|
interface
|
||
4 years ago
|
subroutine amg_d_dec_aggregator_mat_asb(ag,parms,a,desc_a,&
|
||
6 years ago
|
& ac,desc_ac,op_prol,op_restr,info)
|
||
4 years ago
|
import :: amg_d_dec_aggregator_type, psb_desc_type, psb_dspmat_type, psb_dpk_, &
|
||
|
& psb_ipk_, psb_lpk_, psb_ldspmat_type, amg_dml_parms
|
||
6 years ago
|
implicit none
|
||
4 years ago
|
class(amg_d_dec_aggregator_type), target, intent(inout) :: ag
|
||
|
type(amg_dml_parms), intent(inout) :: parms
|
||
6 years ago
|
type(psb_dspmat_type), intent(in) :: a
|
||
5 years ago
|
type(psb_desc_type), intent(inout) :: desc_a
|
||
5 years ago
|
type(psb_dspmat_type), intent(inout) :: op_prol,ac,op_restr
|
||
6 years ago
|
type(psb_desc_type), intent(inout) :: desc_ac
|
||
|
integer(psb_ipk_), intent(out) :: info
|
||
4 years ago
|
end subroutine amg_d_dec_aggregator_mat_asb
|
||
6 years ago
|
end interface
|
||
7 years ago
|
|
||
|
contains
|
||
|
|
||
4 years ago
|
subroutine amg_d_dec_aggregator_set_aggr_type(ag,parms,info)
|
||
|
use amg_base_prec_type
|
||
7 years ago
|
implicit none
|
||
4 years ago
|
class(amg_d_dec_aggregator_type), intent(inout) :: ag
|
||
|
type(amg_dml_parms), intent(in) :: parms
|
||
7 years ago
|
integer(psb_ipk_), intent(out) :: info
|
||
|
|
||
|
select case(parms%aggr_type)
|
||
4 years ago
|
case (amg_noalg_)
|
||
6 years ago
|
ag%soc_map_bld => null()
|
||
4 years ago
|
case (amg_soc1_)
|
||
|
ag%soc_map_bld => amg_d_soc1_map_bld
|
||
|
case (amg_soc2_)
|
||
|
ag%soc_map_bld => amg_d_soc2_map_bld
|
||
7 years ago
|
case default
|
||
7 years ago
|
write(0,*) 'Unknown aggregation type, defaulting to SOC1'
|
||
4 years ago
|
ag%soc_map_bld => amg_d_soc1_map_bld
|
||
7 years ago
|
end select
|
||
|
|
||
|
return
|
||
4 years ago
|
end subroutine amg_d_dec_aggregator_set_aggr_type
|
||
7 years ago
|
|
||
|
|
||
4 years ago
|
subroutine amg_d_dec_aggregator_default(ag)
|
||
7 years ago
|
implicit none
|
||
4 years ago
|
class(amg_d_dec_aggregator_type), intent(inout) :: ag
|
||
7 years ago
|
|
||
4 years ago
|
call ag%amg_d_base_aggregator_type%default()
|
||
|
ag%soc_map_bld => amg_d_soc1_map_bld
|
||
7 years ago
|
|
||
|
return
|
||
4 years ago
|
end subroutine amg_d_dec_aggregator_default
|
||
7 years ago
|
|
||
4 years ago
|
function amg_d_dec_aggregator_fmt() result(val)
|
||
7 years ago
|
implicit none
|
||
|
character(len=32) :: val
|
||
|
|
||
|
val = "Decoupled aggregation"
|
||
4 years ago
|
end function amg_d_dec_aggregator_fmt
|
||
7 years ago
|
|
||
4 years ago
|
subroutine amg_d_dec_aggregator_descr(ag,parms,iout,info)
|
||
6 years ago
|
implicit none
|
||
4 years ago
|
class(amg_d_dec_aggregator_type), intent(in) :: ag
|
||
|
type(amg_dml_parms), intent(in) :: parms
|
||
6 years ago
|
integer(psb_ipk_), intent(in) :: iout
|
||
|
integer(psb_ipk_), intent(out) :: info
|
||
|
|
||
|
write(iout,*) 'Decoupled Aggregator'
|
||
|
write(iout,*) 'Aggregator object type: ',ag%fmt()
|
||
|
call parms%mldescr(iout,info)
|
||
|
|
||
|
return
|
||
4 years ago
|
end subroutine amg_d_dec_aggregator_descr
|
||
6 years ago
|
|
||
4 years ago
|
end module amg_d_dec_aggregator_mod
|