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.
162 lines
5.2 KiB
Fortran
162 lines
5.2 KiB
Fortran
8 years ago
|
!
|
||
|
!
|
||
4 years ago
|
! AMG4PSBLAS version 1.0
|
||
|
! Algebraic Multigrid Package
|
||
8 years ago
|
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||
8 years ago
|
!
|
||
4 years ago
|
! (C) Copyright 2020
|
||
8 years ago
|
!
|
||
7 years ago
|
! Salvatore Filippone
|
||
|
! Pasqua D'Ambra
|
||
4 years ago
|
! Fabio Durastante
|
||
8 years ago
|
!
|
||
|
! 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.
|
||
4 years ago
|
! 3. The name of the AMG4PSBLAS group or the names of its contributors may
|
||
8 years ago
|
! 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
|
||
4 years ago
|
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AMG4PSBLAS GROUP OR ITS CONTRIBUTORS
|
||
8 years ago
|
! 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.
|
||
|
!
|
||
|
!
|
||
4 years ago
|
! File: amg_zprecbld.f90
|
||
17 years ago
|
!
|
||
4 years ago
|
! Subroutine: amg_zprecbld
|
||
17 years ago
|
! Version: complex
|
||
16 years ago
|
! Contains: subroutine init_baseprec_av
|
||
17 years ago
|
!
|
||
|
! This routine builds the preconditioner according to the requirements made by
|
||
4 years ago
|
! the user through the subroutines amg_precinit and amg_precset.
|
||
17 years ago
|
!
|
||
|
!
|
||
|
! Arguments:
|
||
17 years ago
|
! a - type(psb_zspmat_type).
|
||
17 years ago
|
! The sparse matrix structure containing the local part of the
|
||
|
! matrix to be preconditioned.
|
||
17 years ago
|
! desc_a - type(psb_desc_type), input.
|
||
17 years ago
|
! The communication descriptor of a.
|
||
4 years ago
|
! p - type(amg_zprec_type), input/output.
|
||
17 years ago
|
! The preconditioner data structure containing the local part
|
||
|
! of the preconditioner to be built.
|
||
|
! info - integer, output.
|
||
|
! Error code.
|
||
|
!
|
||
4 years ago
|
subroutine amg_zprecbld(a,desc_a,prec,info,amold,vmold,imold)
|
||
18 years ago
|
|
||
14 years ago
|
use psb_base_mod
|
||
4 years ago
|
use amg_z_prec_mod, amg_protect_name => amg_zprecbld
|
||
13 years ago
|
|
||
18 years ago
|
Implicit None
|
||
|
|
||
17 years ago
|
! Arguments
|
||
13 years ago
|
type(psb_zspmat_type),intent(in), target :: a
|
||
12 years ago
|
type(psb_desc_type), intent(inout), target :: desc_a
|
||
4 years ago
|
class(amg_zprec_type),intent(inout), target :: prec
|
||
12 years ago
|
integer(psb_ipk_), intent(out) :: info
|
||
13 years ago
|
class(psb_z_base_sparse_mat), intent(in), optional :: amold
|
||
|
class(psb_z_base_vect_type), intent(in), optional :: vmold
|
||
11 years ago
|
class(psb_i_base_vect_type), intent(in), optional :: imold
|
||
18 years ago
|
|
||
17 years ago
|
! Local Variables
|
||
4 years ago
|
type(amg_zprec_type) :: t_prec
|
||
12 years ago
|
integer(psb_ipk_) :: ictxt, me,np
|
||
12 years ago
|
integer(psb_ipk_) :: err,i,k,err_act, iszv, newsz
|
||
4 years ago
|
integer(psb_ipk_) :: ipv(amg_ifpsz_), val
|
||
12 years ago
|
integer(psb_ipk_) :: int_err(5)
|
||
4 years ago
|
type(amg_dml_parms) :: prm
|
||
12 years ago
|
integer(psb_ipk_) :: debug_level, debug_unit
|
||
|
character(len=20) :: name, ch_err
|
||
18 years ago
|
|
||
15 years ago
|
info=psb_success_
|
||
18 years ago
|
err=0
|
||
|
call psb_erractionsave(err_act)
|
||
7 years ago
|
if (psb_errstatus_fatal()) then
|
||
|
info = psb_err_internal_error_; goto 9999
|
||
|
end if
|
||
17 years ago
|
debug_unit = psb_get_debug_unit()
|
||
|
debug_level = psb_get_debug_level()
|
||
18 years ago
|
|
||
4 years ago
|
name = 'amg_zprecbld'
|
||
15 years ago
|
info = psb_success_
|
||
18 years ago
|
int_err(1) = 0
|
||
14 years ago
|
ictxt = desc_a%get_context()
|
||
18 years ago
|
call psb_info(ictxt, me, np)
|
||
8 years ago
|
prec%ictxt = ictxt
|
||
18 years ago
|
|
||
17 years ago
|
if (debug_level >= psb_debug_outer_) &
|
||
|
& write(debug_unit,*) me,' ',trim(name),&
|
||
14 years ago
|
& 'Entering '
|
||
17 years ago
|
!
|
||
18 years ago
|
|
||
8 years ago
|
if (.not.allocated(prec%precv)) then
|
||
4 years ago
|
!! Error: should have called amg_zprecinit
|
||
17 years ago
|
info=3111
|
||
|
call psb_errpush(info,name)
|
||
17 years ago
|
goto 9999
|
||
18 years ago
|
end if
|
||
17 years ago
|
|
||
18 years ago
|
!
|
||
17 years ago
|
! Check to ensure all procs have the same
|
||
|
!
|
||
16 years ago
|
newsz = -1
|
||
8 years ago
|
iszv = size(prec%precv)
|
||
17 years ago
|
call psb_bcast(ictxt,iszv)
|
||
8 years ago
|
if (iszv /= size(prec%precv)) then
|
||
15 years ago
|
info=psb_err_internal_error_
|
||
16 years ago
|
call psb_errpush(info,name,a_err='Inconsistent size of precv')
|
||
17 years ago
|
goto 9999
|
||
|
end if
|
||
13 years ago
|
|
||
16 years ago
|
if (iszv <= 0) then
|
||
|
! Is this really possible? probably not.
|
||
15 years ago
|
info=psb_err_from_subroutine_
|
||
16 years ago
|
ch_err='size bpv'
|
||
|
call psb_errpush(info,name,a_err=ch_err)
|
||
|
goto 9999
|
||
|
end if
|
||
17 years ago
|
|
||
16 years ago
|
!
|
||
7 years ago
|
! Build the preconditioner
|
||
|
!
|
||
|
call prec%hierarchy_build(a,desc_a,info)
|
||
|
|
||
|
if (info /= psb_success_) then
|
||
|
info=psb_err_internal_error_
|
||
|
call psb_errpush(info,name,a_err='Error from hierarchy build')
|
||
|
goto 9999
|
||
|
end if
|
||
|
|
||
|
call prec%smoothers_build(a,desc_a,info,amold,vmold,imold)
|
||
|
|
||
|
if (info /= psb_success_) then
|
||
|
info=psb_err_internal_error_
|
||
|
call psb_errpush(info,name,a_err='Error from smoothers build')
|
||
|
goto 9999
|
||
16 years ago
|
end if
|
||
7 years ago
|
|
||
8 years ago
|
|
||
18 years ago
|
call psb_erractionrestore(err_act)
|
||
|
return
|
||
|
|
||
10 years ago
|
9999 call psb_error_handler(err_act)
|
||
18 years ago
|
|
||
10 years ago
|
return
|
||
18 years ago
|
|
||
4 years ago
|
end subroutine amg_zprecbld
|