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.
589 lines
21 KiB
Fortran
589 lines
21 KiB
Fortran
8 years ago
|
!
|
||
|
!
|
||
7 years ago
|
! MLD2P4 version 2.2
|
||
8 years ago
|
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||
8 years ago
|
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||
8 years ago
|
!
|
||
7 years ago
|
! (C) Copyright 2008-2018
|
||
8 years ago
|
!
|
||
7 years ago
|
! Salvatore Filippone
|
||
|
! Pasqua D'Ambra
|
||
|
! Daniela di Serafino
|
||
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.
|
||
|
! 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.
|
||
|
!
|
||
|
!
|
||
9 years ago
|
!
|
||
|
!
|
||
4 years ago
|
! File: amg_c_gs_solver_mod.f90
|
||
9 years ago
|
!
|
||
4 years ago
|
! Module: amg_c_gs_solver_mod
|
||
9 years ago
|
!
|
||
8 years ago
|
! This module defines:
|
||
4 years ago
|
! - the amg_c_gs_solver_type data structure containing the ingredients
|
||
8 years ago
|
! for a local Gauss-Seidel iteration. We provide Forward GS (FWGS) and
|
||
|
! backward GS (BWGS). The iterations are local to a process (they operate
|
||
|
! on the block diagonal). Combined with a Jacobi smoother will generate a
|
||
|
! hybrid-Gauss-Seidel solver, i.e. Gauss-Seidel within each process, Jacobi
|
||
5 years ago
|
! among the processes.
|
||
|
! With two objects as pre- and post-smoothers it is possible to build a
|
||
|
! Forward-Backward smoother, suitable for symmetric iterations.
|
||
9 years ago
|
!
|
||
4 years ago
|
module amg_c_gs_solver
|
||
9 years ago
|
|
||
4 years ago
|
use amg_c_base_solver_mod
|
||
9 years ago
|
|
||
4 years ago
|
type, extends(amg_c_base_solver_type) :: amg_c_gs_solver_type
|
||
9 years ago
|
type(psb_cspmat_type) :: l, u
|
||
|
integer(psb_ipk_) :: sweeps
|
||
|
real(psb_spk_) :: eps
|
||
|
contains
|
||
4 years ago
|
procedure, pass(sv) :: dump => amg_c_gs_solver_dmp
|
||
6 years ago
|
procedure, pass(sv) :: check => c_gs_solver_check
|
||
4 years ago
|
procedure, pass(sv) :: clone => amg_c_gs_solver_clone
|
||
|
procedure, pass(sv) :: clone_settings => amg_c_gs_solver_clone_settings
|
||
|
procedure, pass(sv) :: clear_data => amg_c_gs_solver_clear_data
|
||
|
procedure, pass(sv) :: build => amg_c_gs_solver_bld
|
||
|
procedure, pass(sv) :: cnv => amg_c_gs_solver_cnv
|
||
|
procedure, pass(sv) :: apply_v => amg_c_gs_solver_apply_vect
|
||
|
procedure, pass(sv) :: apply_a => amg_c_gs_solver_apply
|
||
8 years ago
|
procedure, pass(sv) :: free => c_gs_solver_free
|
||
|
procedure, pass(sv) :: cseti => c_gs_solver_cseti
|
||
|
procedure, pass(sv) :: csetc => c_gs_solver_csetc
|
||
|
procedure, pass(sv) :: csetr => c_gs_solver_csetr
|
||
|
procedure, pass(sv) :: descr => c_gs_solver_descr
|
||
|
procedure, pass(sv) :: default => c_gs_solver_default
|
||
|
procedure, pass(sv) :: sizeof => c_gs_solver_sizeof
|
||
|
procedure, pass(sv) :: get_nzeros => c_gs_solver_get_nzeros
|
||
7 years ago
|
procedure, nopass :: get_wrksz => c_gs_solver_get_wrksize
|
||
8 years ago
|
procedure, nopass :: get_fmt => c_gs_solver_get_fmt
|
||
|
procedure, nopass :: get_id => c_gs_solver_get_id
|
||
|
procedure, nopass :: is_iterative => c_gs_solver_is_iterative
|
||
4 years ago
|
end type amg_c_gs_solver_type
|
||
9 years ago
|
|
||
4 years ago
|
type, extends(amg_c_gs_solver_type) :: amg_c_bwgs_solver_type
|
||
9 years ago
|
contains
|
||
4 years ago
|
procedure, pass(sv) :: build => amg_c_bwgs_solver_bld
|
||
|
procedure, pass(sv) :: apply_v => amg_c_bwgs_solver_apply_vect
|
||
|
procedure, pass(sv) :: apply_a => amg_c_bwgs_solver_apply
|
||
9 years ago
|
procedure, nopass :: get_fmt => c_bwgs_solver_get_fmt
|
||
8 years ago
|
procedure, nopass :: get_id => c_bwgs_solver_get_id
|
||
9 years ago
|
procedure, pass(sv) :: descr => c_bwgs_solver_descr
|
||
4 years ago
|
end type amg_c_bwgs_solver_type
|
||
9 years ago
|
|
||
9 years ago
|
|
||
9 years ago
|
private :: c_gs_solver_bld, c_gs_solver_apply, &
|
||
6 years ago
|
& c_gs_solver_free, &
|
||
9 years ago
|
& c_gs_solver_descr, c_gs_solver_sizeof, &
|
||
|
& c_gs_solver_default, c_gs_solver_dmp, &
|
||
|
& c_gs_solver_apply_vect, c_gs_solver_get_nzeros, &
|
||
|
& c_gs_solver_get_fmt, c_gs_solver_check,&
|
||
|
& c_gs_solver_is_iterative, &
|
||
8 years ago
|
& c_bwgs_solver_get_fmt, c_bwgs_solver_descr, &
|
||
7 years ago
|
& c_gs_solver_get_id, c_bwgs_solver_get_id, c_gs_solver_get_wrksize
|
||
9 years ago
|
|
||
|
interface
|
||
4 years ago
|
subroutine amg_c_gs_solver_apply_vect(alpha,sv,x,beta,y,desc_data,&
|
||
7 years ago
|
& trans,work,wv,info,init,initu)
|
||
4 years ago
|
import :: psb_desc_type, amg_c_gs_solver_type, psb_c_vect_type, psb_spk_, &
|
||
9 years ago
|
& psb_cspmat_type, psb_c_base_sparse_mat, psb_c_base_vect_type, psb_ipk_
|
||
|
implicit none
|
||
|
type(psb_desc_type), intent(in) :: desc_data
|
||
4 years ago
|
class(amg_c_gs_solver_type), intent(inout) :: sv
|
||
9 years ago
|
type(psb_c_vect_type),intent(inout) :: x
|
||
|
type(psb_c_vect_type),intent(inout) :: y
|
||
|
complex(psb_spk_),intent(in) :: alpha,beta
|
||
|
character(len=1),intent(in) :: trans
|
||
|
complex(psb_spk_),target, intent(inout) :: work(:)
|
||
7 years ago
|
type(psb_c_vect_type),intent(inout) :: wv(:)
|
||
9 years ago
|
integer(psb_ipk_), intent(out) :: info
|
||
9 years ago
|
character, intent(in), optional :: init
|
||
|
type(psb_c_vect_type),intent(inout), optional :: initu
|
||
4 years ago
|
end subroutine amg_c_gs_solver_apply_vect
|
||
|
subroutine amg_c_bwgs_solver_apply_vect(alpha,sv,x,beta,y,desc_data,&
|
||
7 years ago
|
& trans,work,wv,info,init,initu)
|
||
4 years ago
|
import :: psb_desc_type, amg_c_bwgs_solver_type, psb_c_vect_type, psb_spk_, &
|
||
9 years ago
|
& psb_cspmat_type, psb_c_base_sparse_mat, psb_c_base_vect_type, psb_ipk_
|
||
|
implicit none
|
||
|
type(psb_desc_type), intent(in) :: desc_data
|
||
4 years ago
|
class(amg_c_bwgs_solver_type), intent(inout) :: sv
|
||
9 years ago
|
type(psb_c_vect_type),intent(inout) :: x
|
||
|
type(psb_c_vect_type),intent(inout) :: y
|
||
|
complex(psb_spk_),intent(in) :: alpha,beta
|
||
|
character(len=1),intent(in) :: trans
|
||
|
complex(psb_spk_),target, intent(inout) :: work(:)
|
||
7 years ago
|
type(psb_c_vect_type),intent(inout) :: wv(:)
|
||
9 years ago
|
integer(psb_ipk_), intent(out) :: info
|
||
9 years ago
|
character, intent(in), optional :: init
|
||
|
type(psb_c_vect_type),intent(inout), optional :: initu
|
||
4 years ago
|
end subroutine amg_c_bwgs_solver_apply_vect
|
||
9 years ago
|
end interface
|
||
|
|
||
|
interface
|
||
4 years ago
|
subroutine amg_c_gs_solver_apply(alpha,sv,x,beta,y,desc_data,trans,work,info,init,initu)
|
||
|
import :: psb_desc_type, amg_c_gs_solver_type, psb_c_vect_type, psb_spk_, &
|
||
9 years ago
|
& psb_cspmat_type, psb_c_base_sparse_mat, psb_c_base_vect_type, psb_ipk_
|
||
|
implicit none
|
||
|
type(psb_desc_type), intent(in) :: desc_data
|
||
4 years ago
|
class(amg_c_gs_solver_type), intent(inout) :: sv
|
||
9 years ago
|
complex(psb_spk_),intent(inout) :: x(:)
|
||
|
complex(psb_spk_),intent(inout) :: y(:)
|
||
|
complex(psb_spk_),intent(in) :: alpha,beta
|
||
|
character(len=1),intent(in) :: trans
|
||
|
complex(psb_spk_),target, intent(inout) :: work(:)
|
||
|
integer(psb_ipk_), intent(out) :: info
|
||
9 years ago
|
character, intent(in), optional :: init
|
||
|
complex(psb_spk_),intent(inout), optional :: initu(:)
|
||
4 years ago
|
end subroutine amg_c_gs_solver_apply
|
||
|
subroutine amg_c_bwgs_solver_apply(alpha,sv,x,beta,y,desc_data,&
|
||
9 years ago
|
& trans,work,info,init,initu)
|
||
4 years ago
|
import :: psb_desc_type, amg_c_bwgs_solver_type, psb_c_vect_type, psb_spk_, &
|
||
9 years ago
|
& psb_cspmat_type, psb_c_base_sparse_mat, psb_c_base_vect_type, psb_ipk_
|
||
|
implicit none
|
||
|
type(psb_desc_type), intent(in) :: desc_data
|
||
4 years ago
|
class(amg_c_bwgs_solver_type), intent(inout) :: sv
|
||
9 years ago
|
complex(psb_spk_),intent(inout) :: x(:)
|
||
|
complex(psb_spk_),intent(inout) :: y(:)
|
||
|
complex(psb_spk_),intent(in) :: alpha,beta
|
||
|
character(len=1),intent(in) :: trans
|
||
|
complex(psb_spk_),target, intent(inout) :: work(:)
|
||
|
integer(psb_ipk_), intent(out) :: info
|
||
9 years ago
|
character, intent(in), optional :: init
|
||
|
complex(psb_spk_),intent(inout), optional :: initu(:)
|
||
4 years ago
|
end subroutine amg_c_bwgs_solver_apply
|
||
9 years ago
|
end interface
|
||
|
|
||
|
interface
|
||
4 years ago
|
subroutine amg_c_gs_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||
|
import :: psb_desc_type, amg_c_gs_solver_type, psb_c_vect_type, psb_spk_, &
|
||
9 years ago
|
& psb_cspmat_type, psb_c_base_sparse_mat, psb_c_base_vect_type,&
|
||
|
& psb_ipk_, psb_i_base_vect_type
|
||
|
implicit none
|
||
|
type(psb_cspmat_type), intent(in), target :: a
|
||
6 years ago
|
Type(psb_desc_type), Intent(inout) :: desc_a
|
||
4 years ago
|
class(amg_c_gs_solver_type), intent(inout) :: sv
|
||
9 years ago
|
integer(psb_ipk_), intent(out) :: info
|
||
|
type(psb_cspmat_type), intent(in), target, optional :: b
|
||
|
class(psb_c_base_sparse_mat), intent(in), optional :: amold
|
||
|
class(psb_c_base_vect_type), intent(in), optional :: vmold
|
||
|
class(psb_i_base_vect_type), intent(in), optional :: imold
|
||
4 years ago
|
end subroutine amg_c_gs_solver_bld
|
||
|
subroutine amg_c_bwgs_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||
|
import :: psb_desc_type, amg_c_bwgs_solver_type, psb_c_vect_type, psb_spk_, &
|
||
9 years ago
|
& psb_cspmat_type, psb_c_base_sparse_mat, psb_c_base_vect_type,&
|
||
|
& psb_ipk_, psb_i_base_vect_type
|
||
|
implicit none
|
||
|
type(psb_cspmat_type), intent(in), target :: a
|
||
6 years ago
|
Type(psb_desc_type), Intent(inout) :: desc_a
|
||
4 years ago
|
class(amg_c_bwgs_solver_type), intent(inout) :: sv
|
||
9 years ago
|
integer(psb_ipk_), intent(out) :: info
|
||
|
type(psb_cspmat_type), intent(in), target, optional :: b
|
||
|
class(psb_c_base_sparse_mat), intent(in), optional :: amold
|
||
|
class(psb_c_base_vect_type), intent(in), optional :: vmold
|
||
|
class(psb_i_base_vect_type), intent(in), optional :: imold
|
||
4 years ago
|
end subroutine amg_c_bwgs_solver_bld
|
||
9 years ago
|
end interface
|
||
|
|
||
|
interface
|
||
4 years ago
|
subroutine amg_c_gs_solver_cnv(sv,info,amold,vmold,imold)
|
||
|
import :: amg_c_gs_solver_type, psb_spk_, &
|
||
9 years ago
|
& psb_c_base_sparse_mat, psb_c_base_vect_type,&
|
||
|
& psb_ipk_, psb_i_base_vect_type
|
||
|
implicit none
|
||
4 years ago
|
class(amg_c_gs_solver_type), intent(inout) :: sv
|
||
9 years ago
|
integer(psb_ipk_), intent(out) :: info
|
||
|
class(psb_c_base_sparse_mat), intent(in), optional :: amold
|
||
|
class(psb_c_base_vect_type), intent(in), optional :: vmold
|
||
|
class(psb_i_base_vect_type), intent(in), optional :: imold
|
||
4 years ago
|
end subroutine amg_c_gs_solver_cnv
|
||
9 years ago
|
end interface
|
||
|
|
||
|
interface
|
||
4 years ago
|
subroutine amg_c_gs_solver_dmp(sv,desc,level,info,prefix,head,solver,global_num)
|
||
|
import :: psb_desc_type, amg_c_gs_solver_type, psb_c_vect_type, psb_spk_, &
|
||
9 years ago
|
& psb_cspmat_type, psb_c_base_sparse_mat, psb_c_base_vect_type, &
|
||
|
& psb_ipk_
|
||
|
implicit none
|
||
4 years ago
|
class(amg_c_gs_solver_type), intent(in) :: sv
|
||
5 years ago
|
type(psb_desc_type), intent(in) :: desc
|
||
9 years ago
|
integer(psb_ipk_), intent(in) :: level
|
||
|
integer(psb_ipk_), intent(out) :: info
|
||
|
character(len=*), intent(in), optional :: prefix, head
|
||
5 years ago
|
logical, optional, intent(in) :: solver, global_num
|
||
4 years ago
|
end subroutine amg_c_gs_solver_dmp
|
||
9 years ago
|
end interface
|
||
|
|
||
|
interface
|
||
4 years ago
|
subroutine amg_c_gs_solver_clone(sv,svout,info)
|
||
9 years ago
|
import :: psb_desc_type, psb_cspmat_type, psb_c_base_sparse_mat, &
|
||
|
& psb_c_vect_type, psb_c_base_vect_type, psb_spk_, &
|
||
4 years ago
|
& amg_c_base_solver_type, amg_c_gs_solver_type, psb_ipk_
|
||
9 years ago
|
Implicit None
|
||
|
|
||
|
! Arguments
|
||
4 years ago
|
class(amg_c_gs_solver_type), intent(inout) :: sv
|
||
|
class(amg_c_base_solver_type), allocatable, intent(inout) :: svout
|
||
9 years ago
|
integer(psb_ipk_), intent(out) :: info
|
||
4 years ago
|
end subroutine amg_c_gs_solver_clone
|
||
9 years ago
|
end interface
|
||
|
|
||
5 years ago
|
interface
|
||
4 years ago
|
subroutine amg_c_gs_solver_clone_settings(sv,svout,info)
|
||
5 years ago
|
import :: psb_desc_type, psb_cspmat_type, psb_c_base_sparse_mat, &
|
||
|
& psb_c_vect_type, psb_c_base_vect_type, psb_spk_, &
|
||
4 years ago
|
& amg_c_base_solver_type, amg_c_gs_solver_type, psb_ipk_
|
||
5 years ago
|
Implicit None
|
||
|
|
||
|
! Arguments
|
||
4 years ago
|
class(amg_c_gs_solver_type), intent(inout) :: sv
|
||
|
class(amg_c_base_solver_type), intent(inout) :: svout
|
||
5 years ago
|
integer(psb_ipk_), intent(out) :: info
|
||
4 years ago
|
end subroutine amg_c_gs_solver_clone_settings
|
||
5 years ago
|
end interface
|
||
|
|
||
|
interface
|
||
4 years ago
|
subroutine amg_c_gs_solver_clear_data(sv,info)
|
||
5 years ago
|
import :: psb_desc_type, psb_cspmat_type, psb_c_base_sparse_mat, &
|
||
|
& psb_c_vect_type, psb_c_base_vect_type, psb_spk_, &
|
||
4 years ago
|
& amg_c_gs_solver_type, psb_ipk_
|
||
5 years ago
|
Implicit None
|
||
|
|
||
|
! Arguments
|
||
4 years ago
|
class(amg_c_gs_solver_type), intent(inout) :: sv
|
||
5 years ago
|
integer(psb_ipk_), intent(out) :: info
|
||
4 years ago
|
end subroutine amg_c_gs_solver_clear_data
|
||
5 years ago
|
end interface
|
||
|
|
||
9 years ago
|
contains
|
||
|
|
||
8 years ago
|
subroutine c_gs_solver_default(sv)
|
||
9 years ago
|
|
||
|
Implicit None
|
||
|
|
||
|
! Arguments
|
||
4 years ago
|
class(amg_c_gs_solver_type), intent(inout) :: sv
|
||
9 years ago
|
|
||
|
sv%sweeps = ione
|
||
|
sv%eps = dzero
|
||
|
|
||
|
return
|
||
8 years ago
|
end subroutine c_gs_solver_default
|
||
9 years ago
|
|
||
8 years ago
|
subroutine c_gs_solver_check(sv,info)
|
||
9 years ago
|
|
||
|
Implicit None
|
||
|
|
||
|
! Arguments
|
||
4 years ago
|
class(amg_c_gs_solver_type), intent(inout) :: sv
|
||
9 years ago
|
integer(psb_ipk_), intent(out) :: info
|
||
|
integer(psb_ipk_) :: err_act
|
||
8 years ago
|
character(len=20) :: name='c_gs_solver_check'
|
||
9 years ago
|
|
||
|
call psb_erractionsave(err_act)
|
||
|
info = psb_success_
|
||
|
|
||
4 years ago
|
call amg_check_def(sv%sweeps,&
|
||
9 years ago
|
& 'GS Sweeps',ione,is_int_positive)
|
||
|
|
||
|
if (info /= psb_success_) goto 9999
|
||
|
|
||
|
call psb_erractionrestore(err_act)
|
||
|
return
|
||
|
|
||
|
9999 call psb_error_handler(err_act)
|
||
|
return
|
||
|
|
||
8 years ago
|
end subroutine c_gs_solver_check
|
||
9 years ago
|
|
||
6 years ago
|
subroutine c_gs_solver_cseti(sv,what,val,info,idx)
|
||
9 years ago
|
|
||
|
Implicit None
|
||
|
|
||
|
! Arguments
|
||
4 years ago
|
class(amg_c_gs_solver_type), intent(inout) :: sv
|
||
9 years ago
|
character(len=*), intent(in) :: what
|
||
|
integer(psb_ipk_), intent(in) :: val
|
||
|
integer(psb_ipk_), intent(out) :: info
|
||
6 years ago
|
integer(psb_ipk_), intent(in), optional :: idx
|
||
9 years ago
|
integer(psb_ipk_) :: err_act
|
||
8 years ago
|
character(len=20) :: name='c_gs_solver_cseti'
|
||
9 years ago
|
|
||
|
info = psb_success_
|
||
|
call psb_erractionsave(err_act)
|
||
|
|
||
|
select case(psb_toupper(what))
|
||
|
case('SOLVER_SWEEPS')
|
||
|
sv%sweeps = val
|
||
|
case default
|
||
4 years ago
|
call sv%amg_c_base_solver_type%set(what,val,info,idx=idx)
|
||
9 years ago
|
end select
|
||
|
|
||
|
call psb_erractionrestore(err_act)
|
||
|
return
|
||
|
|
||
|
9999 call psb_error_handler(err_act)
|
||
|
return
|
||
8 years ago
|
end subroutine c_gs_solver_cseti
|
||
9 years ago
|
|
||
6 years ago
|
subroutine c_gs_solver_csetc(sv,what,val,info,idx)
|
||
9 years ago
|
|
||
|
Implicit None
|
||
|
|
||
|
! Arguments
|
||
4 years ago
|
class(amg_c_gs_solver_type), intent(inout) :: sv
|
||
9 years ago
|
character(len=*), intent(in) :: what
|
||
|
character(len=*), intent(in) :: val
|
||
|
integer(psb_ipk_), intent(out) :: info
|
||
6 years ago
|
integer(psb_ipk_), intent(in), optional :: idx
|
||
9 years ago
|
integer(psb_ipk_) :: err_act, ival
|
||
8 years ago
|
character(len=20) :: name='c_gs_solver_csetc'
|
||
9 years ago
|
|
||
|
info = psb_success_
|
||
|
call psb_erractionsave(err_act)
|
||
|
|
||
|
|
||
4 years ago
|
call sv%amg_c_base_solver_type%set(what,val,info,idx=idx)
|
||
5 years ago
|
|
||
9 years ago
|
if (info /= psb_success_) then
|
||
|
info = psb_err_from_subroutine_
|
||
|
call psb_errpush(info, name)
|
||
|
goto 9999
|
||
|
end if
|
||
|
|
||
|
call psb_erractionrestore(err_act)
|
||
|
return
|
||
|
|
||
|
9999 call psb_error_handler(err_act)
|
||
|
return
|
||
8 years ago
|
end subroutine c_gs_solver_csetc
|
||
9 years ago
|
|
||
6 years ago
|
subroutine c_gs_solver_csetr(sv,what,val,info,idx)
|
||
9 years ago
|
|
||
|
Implicit None
|
||
|
|
||
|
! Arguments
|
||
4 years ago
|
class(amg_c_gs_solver_type), intent(inout) :: sv
|
||
9 years ago
|
character(len=*), intent(in) :: what
|
||
|
real(psb_spk_), intent(in) :: val
|
||
|
integer(psb_ipk_), intent(out) :: info
|
||
6 years ago
|
integer(psb_ipk_), intent(in), optional :: idx
|
||
9 years ago
|
integer(psb_ipk_) :: err_act
|
||
8 years ago
|
character(len=20) :: name='c_gs_solver_csetr'
|
||
9 years ago
|
|
||
|
call psb_erractionsave(err_act)
|
||
|
info = psb_success_
|
||
|
|
||
|
select case(psb_toupper(what))
|
||
|
case('SOLVER_EPS')
|
||
|
sv%eps = val
|
||
|
case default
|
||
4 years ago
|
call sv%amg_c_base_solver_type%set(what,val,info,idx=idx)
|
||
9 years ago
|
end select
|
||
|
|
||
|
|
||
|
call psb_erractionrestore(err_act)
|
||
|
return
|
||
|
|
||
|
9999 call psb_error_handler(err_act)
|
||
|
return
|
||
8 years ago
|
end subroutine c_gs_solver_csetr
|
||
9 years ago
|
|
||
8 years ago
|
subroutine c_gs_solver_free(sv,info)
|
||
9 years ago
|
|
||
|
Implicit None
|
||
|
|
||
|
! Arguments
|
||
4 years ago
|
class(amg_c_gs_solver_type), intent(inout) :: sv
|
||
9 years ago
|
integer(psb_ipk_), intent(out) :: info
|
||
|
integer(psb_ipk_) :: err_act
|
||
8 years ago
|
character(len=20) :: name='c_gs_solver_free'
|
||
9 years ago
|
|
||
|
call psb_erractionsave(err_act)
|
||
|
info = psb_success_
|
||
|
|
||
|
call sv%l%free()
|
||
|
call sv%u%free()
|
||
|
|
||
|
call psb_erractionrestore(err_act)
|
||
|
return
|
||
|
|
||
|
9999 call psb_error_handler(err_act)
|
||
|
return
|
||
8 years ago
|
end subroutine c_gs_solver_free
|
||
9 years ago
|
|
||
8 years ago
|
subroutine c_gs_solver_descr(sv,info,iout,coarse)
|
||
9 years ago
|
|
||
|
Implicit None
|
||
|
|
||
|
! Arguments
|
||
4 years ago
|
class(amg_c_gs_solver_type), intent(in) :: sv
|
||
9 years ago
|
integer(psb_ipk_), intent(out) :: info
|
||
|
integer(psb_ipk_), intent(in), optional :: iout
|
||
|
logical, intent(in), optional :: coarse
|
||
|
|
||
|
! Local variables
|
||
|
integer(psb_ipk_) :: err_act
|
||
4 years ago
|
character(len=20), parameter :: name='amg_c_gs_solver_descr'
|
||
9 years ago
|
integer(psb_ipk_) :: iout_
|
||
|
|
||
|
call psb_erractionsave(err_act)
|
||
|
info = psb_success_
|
||
|
if (present(iout)) then
|
||
|
iout_ = iout
|
||
|
else
|
||
8 years ago
|
iout_ = psb_out_unit
|
||
9 years ago
|
endif
|
||
|
|
||
|
if (sv%eps<=dzero) then
|
||
9 years ago
|
write(iout_,*) ' Forward Gauss-Seidel iterative solver with ',&
|
||
9 years ago
|
& sv%sweeps,' sweeps'
|
||
|
else
|
||
9 years ago
|
write(iout_,*) ' Forward Gauss-Seidel iterative solver with tolerance',&
|
||
9 years ago
|
& sv%eps,' and maxit', sv%sweeps
|
||
|
end if
|
||
|
|
||
|
call psb_erractionrestore(err_act)
|
||
|
return
|
||
|
|
||
|
9999 call psb_error_handler(err_act)
|
||
|
return
|
||
8 years ago
|
end subroutine c_gs_solver_descr
|
||
9 years ago
|
|
||
8 years ago
|
function c_gs_solver_get_nzeros(sv) result(val)
|
||
9 years ago
|
|
||
|
implicit none
|
||
|
! Arguments
|
||
4 years ago
|
class(amg_c_gs_solver_type), intent(in) :: sv
|
||
7 years ago
|
integer(psb_epk_) :: val
|
||
9 years ago
|
integer(psb_ipk_) :: i
|
||
|
|
||
|
val = 0
|
||
|
val = val + sv%l%get_nzeros()
|
||
|
val = val + sv%u%get_nzeros()
|
||
|
|
||
|
return
|
||
8 years ago
|
end function c_gs_solver_get_nzeros
|
||
9 years ago
|
|
||
8 years ago
|
function c_gs_solver_sizeof(sv) result(val)
|
||
9 years ago
|
|
||
|
implicit none
|
||
|
! Arguments
|
||
4 years ago
|
class(amg_c_gs_solver_type), intent(in) :: sv
|
||
7 years ago
|
integer(psb_epk_) :: val
|
||
9 years ago
|
integer(psb_ipk_) :: i
|
||
|
|
||
7 years ago
|
val = psb_sizeof_ip
|
||
9 years ago
|
val = val + sv%l%sizeof()
|
||
|
val = val + sv%u%sizeof()
|
||
|
|
||
|
return
|
||
8 years ago
|
end function c_gs_solver_sizeof
|
||
9 years ago
|
|
||
8 years ago
|
function c_gs_solver_get_fmt() result(val)
|
||
9 years ago
|
implicit none
|
||
|
character(len=32) :: val
|
||
|
|
||
9 years ago
|
val = "Forward Gauss-Seidel solver"
|
||
8 years ago
|
end function c_gs_solver_get_fmt
|
||
|
|
||
|
function c_gs_solver_get_id() result(val)
|
||
|
implicit none
|
||
|
integer(psb_ipk_) :: val
|
||
9 years ago
|
|
||
4 years ago
|
val = amg_gs_
|
||
8 years ago
|
end function c_gs_solver_get_id
|
||
9 years ago
|
|
||
|
!
|
||
|
! If this is true, then the solver needs a starting
|
||
|
! guess. Currently only handled in JAC smoother.
|
||
|
!
|
||
8 years ago
|
function c_gs_solver_is_iterative() result(val)
|
||
9 years ago
|
implicit none
|
||
|
logical :: val
|
||
|
|
||
|
val = .true.
|
||
8 years ago
|
end function c_gs_solver_is_iterative
|
||
9 years ago
|
|
||
|
subroutine c_bwgs_solver_descr(sv,info,iout,coarse)
|
||
|
|
||
|
Implicit None
|
||
|
|
||
|
! Arguments
|
||
4 years ago
|
class(amg_c_bwgs_solver_type), intent(in) :: sv
|
||
9 years ago
|
integer(psb_ipk_), intent(out) :: info
|
||
|
integer(psb_ipk_), intent(in), optional :: iout
|
||
|
logical, intent(in), optional :: coarse
|
||
|
|
||
|
! Local variables
|
||
|
integer(psb_ipk_) :: err_act
|
||
4 years ago
|
character(len=20), parameter :: name='amg_c_bwgs_solver_descr'
|
||
9 years ago
|
integer(psb_ipk_) :: iout_
|
||
|
|
||
|
call psb_erractionsave(err_act)
|
||
|
info = psb_success_
|
||
|
if (present(iout)) then
|
||
|
iout_ = iout
|
||
|
else
|
||
8 years ago
|
iout_ = psb_out_unit
|
||
9 years ago
|
endif
|
||
|
|
||
|
if (sv%eps<=dzero) then
|
||
|
write(iout_,*) ' Backward Gauss-Seidel iterative solver with ',&
|
||
|
& sv%sweeps,' sweeps'
|
||
|
else
|
||
|
write(iout_,*) ' Backward Gauss-Seidel iterative solver with tolerance',&
|
||
|
& sv%eps,' and maxit', sv%sweeps
|
||
|
end if
|
||
|
|
||
|
call psb_erractionrestore(err_act)
|
||
|
return
|
||
|
|
||
|
9999 call psb_error_handler(err_act)
|
||
|
return
|
||
|
end subroutine c_bwgs_solver_descr
|
||
|
|
||
|
function c_bwgs_solver_get_fmt() result(val)
|
||
|
implicit none
|
||
|
character(len=32) :: val
|
||
|
|
||
|
val = "Backward Gauss-Seidel solver"
|
||
|
end function c_bwgs_solver_get_fmt
|
||
9 years ago
|
|
||
8 years ago
|
function c_bwgs_solver_get_id() result(val)
|
||
|
implicit none
|
||
|
integer(psb_ipk_) :: val
|
||
|
|
||
4 years ago
|
val = amg_bwgs_
|
||
8 years ago
|
end function c_bwgs_solver_get_id
|
||
|
|
||
7 years ago
|
function c_gs_solver_get_wrksize() result(val)
|
||
|
implicit none
|
||
|
integer(psb_ipk_) :: val
|
||
|
|
||
|
val = 2
|
||
|
end function c_gs_solver_get_wrksize
|
||
|
|
||
4 years ago
|
end module amg_c_gs_solver
|