mirror of
https://github.com/sfilippone/amg4psblas.git
synced 2026-10-06 22:55:12 +00:00
Initial implementation of Richards smoother and MUMPS version finder
This commit is contained in:
Vendored
+1154
File diff suppressed because it is too large
Load Diff
@@ -509,6 +509,7 @@ set(AMG_amgprec_source_files
|
||||
impl/smoother/amg_s_base_smoother_free.f90
|
||||
impl/smoother/amg_d_jac_smoother_clone.f90
|
||||
impl/smoother/amg_d_jac_smoother_apply_vect.f90
|
||||
impl/smoother/amg_d_richards_smoother_impl.f90
|
||||
impl/smoother/amg_c_as_smoother_clear_data.f90
|
||||
impl/smoother/amg_s_poly_smoother_descr.f90
|
||||
impl/smoother/amg_z_as_smoother_cseti.f90
|
||||
@@ -773,6 +774,7 @@ set(AMG_amgprec_source_files
|
||||
amg_prec_mod.f90
|
||||
amg_d_gs_solver.f90
|
||||
amg_d_jac_smoother.f90
|
||||
amg_d_richards_smoother.f90
|
||||
amg_z_symdec_aggregator_mod.f90
|
||||
amg_s_gs_solver.f90
|
||||
amg_ainv_mod.f90
|
||||
|
||||
+2
-2
@@ -8,7 +8,7 @@ FINCLUDES=$(FMFLAG)$(HERE) $(FMFLAG)$(INCDIR) $(PSBLAS_INCLUDES)
|
||||
|
||||
|
||||
DMODOBJS=amg_d_prec_type.o \
|
||||
amg_d_inner_mod.o amg_d_ilu_solver.o amg_d_diag_solver.o amg_d_jac_smoother.o amg_d_as_smoother.o \
|
||||
amg_d_inner_mod.o amg_d_ilu_solver.o amg_d_diag_solver.o amg_d_jac_smoother.o amg_d_as_smoother.o amg_d_richards_smoother.o \
|
||||
amg_d_poly_smoother.o amg_d_poly_coeff_mod.o\
|
||||
amg_d_umf_solver.o amg_d_slu_solver.o amg_d_sludist_solver.o amg_d_id_solver.o\
|
||||
amg_d_base_solver_mod.o amg_d_base_smoother_mod.o amg_d_onelev_mod.o \
|
||||
@@ -159,7 +159,7 @@ amg_d_umf_solver.o amg_d_diag_solver.o amg_d_ilu_solver.o amg_d_jac_solver.o: am
|
||||
|
||||
#amg_d_ilu_fact_mod.o: amg_base_prec_type.o amg_d_base_solver_mod.o
|
||||
#amg_d_ilu_solver.o amg_d_iluk_fact.o: amg_d_ilu_fact_mod.o
|
||||
amg_d_as_smoother.o amg_d_jac_smoother.o: amg_d_base_smoother_mod.o
|
||||
amg_d_as_smoother.o amg_d_jac_smoother.o amg_d_richards_smoother.o: amg_d_base_smoother_mod.o
|
||||
amg_d_jac_smoother.o: amg_d_diag_solver.o
|
||||
amg_dprecinit.o amg_dprecset.o: amg_d_diag_solver.o amg_d_ilu_solver.o \
|
||||
amg_d_umf_solver.o amg_d_as_smoother.o amg_d_jac_smoother.o \
|
||||
|
||||
@@ -216,7 +216,8 @@ module amg_base_prec_type
|
||||
integer(psb_ipk_), parameter :: amg_l1_gs_ = 7
|
||||
integer(psb_ipk_), parameter :: amg_l1_fbgs_ = 8
|
||||
integer(psb_ipk_), parameter :: amg_poly_ = 9
|
||||
integer(psb_ipk_), parameter :: amg_max_prec_ = 9
|
||||
integer(psb_ipk_), parameter :: amg_richardson_ = 10
|
||||
integer(psb_ipk_), parameter :: amg_max_prec_ = 10
|
||||
!
|
||||
! Constants for pre/post signaling. Now only used internally
|
||||
!
|
||||
@@ -229,7 +230,8 @@ module amg_base_prec_type
|
||||
!
|
||||
! Legal values for entry: amg_sub_solve_
|
||||
!
|
||||
integer(psb_ipk_), parameter :: amg_slv_delta_ = amg_max_prec_+1
|
||||
! Keep this fixed so sub-solver numeric IDs remain stable.
|
||||
integer(psb_ipk_), parameter :: amg_slv_delta_ = 10
|
||||
integer(psb_ipk_), parameter :: amg_f_none_ = amg_slv_delta_+0
|
||||
integer(psb_ipk_), parameter :: amg_diag_scale_ = amg_slv_delta_+1
|
||||
integer(psb_ipk_), parameter :: amg_l1_diag_scale_ = amg_slv_delta_+2
|
||||
@@ -409,7 +411,7 @@ module amg_base_prec_type
|
||||
& 'none ','Jacobi ',&
|
||||
& 'L1-Jacobi ','none ','none ',&
|
||||
& 'none ','none ','L1-GS ',&
|
||||
& 'L1-FBGS ','Polynomial ','none ','Point Jacobi ',&
|
||||
& 'L1-FBGS ','Polynomial ', 'Richards ','Point Jacobi ',&
|
||||
& 'L1-Jacobi ','Gauss-Seidel ','ILU(n) ',&
|
||||
& 'MILU(n) ','ILU(t,n) ',&
|
||||
& 'SuperLU ','UMFPACK LU ',&
|
||||
@@ -575,6 +577,8 @@ contains
|
||||
val = amg_as_
|
||||
case('POLY')
|
||||
val = amg_poly_
|
||||
case('RICHARDSON','RICHARDS')
|
||||
val = amg_richardson_
|
||||
case('CHEB_4')
|
||||
val = amg_cheb_4_
|
||||
case('CHEB_4_OPT')
|
||||
@@ -1202,6 +1206,8 @@ contains
|
||||
pr_to_str='BJAC'
|
||||
case(amg_as_)
|
||||
pr_to_str='AS'
|
||||
case(amg_richardson_)
|
||||
pr_to_str='RICHARDS'
|
||||
end select
|
||||
|
||||
end function pr_to_str
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
@CHAVEMUMPS@
|
||||
@CHAVEMUMPSMODULES@
|
||||
@CHAVEMUMPSINCLUDES@
|
||||
@CHAVEMUMPSVERSION@
|
||||
@CHAVEMUMPSVERSIONSTRING@
|
||||
@CXXMATCHBOXBIT@
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,364 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! 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 AMG4PSBLAS group or the names of its contributors may
|
||||
! not be used to endorse or promote products derived from this
|
||||
! software without specific prior 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 AMG4PSBLAS 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.
|
||||
!
|
||||
!
|
||||
!
|
||||
! File: amg_d_richards_smoother.f90
|
||||
!
|
||||
! Module: amg_d_richards_smoother
|
||||
!
|
||||
! This module defines:
|
||||
! the amg_d_richards_smoother_type data structure containing the
|
||||
! smoother for a preconditioned Richards iteration.
|
||||
! The smoother applies the iterative method:
|
||||
! x_{k+1} = x_k + omega * P^{-1} * (b - A * x_k)
|
||||
! where P is a preconditioner (the solver component) acting on the global matrix A.
|
||||
! This allows using distributed solvers like MUMPS on the full system.
|
||||
!
|
||||
module amg_d_richards_smoother
|
||||
|
||||
use amg_d_base_smoother_mod
|
||||
|
||||
type, extends(amg_d_base_smoother_type) :: amg_d_richards_smoother_type
|
||||
! The local solver component is inherited from the
|
||||
! parent type, but acts on the global matrix.
|
||||
! class(amg_d_base_solver_type), allocatable :: sv
|
||||
!
|
||||
type(psb_dspmat_type), pointer :: pa => null()
|
||||
integer(psb_lpk_) :: global_nnz_tot
|
||||
logical :: checkres
|
||||
logical :: printres
|
||||
integer(psb_ipk_) :: checkiter
|
||||
integer(psb_ipk_) :: printiter
|
||||
real(psb_dpk_) :: tol
|
||||
real(psb_dpk_) :: omega
|
||||
contains
|
||||
procedure, pass(sm) :: apply_v => amg_d_richards_smoother_apply_vect
|
||||
procedure, pass(sm) :: apply_a => amg_d_richards_smoother_apply
|
||||
procedure, pass(sm) :: dump => amg_d_richards_smoother_dmp
|
||||
procedure, pass(sm) :: build => amg_d_richards_smoother_bld
|
||||
procedure, pass(sm) :: cnv => amg_d_richards_smoother_cnv
|
||||
procedure, pass(sm) :: clone => amg_d_richards_smoother_clone
|
||||
procedure, pass(sm) :: clone_settings => amg_d_richards_smoother_clone_settings
|
||||
procedure, pass(sm) :: clear_data => amg_d_richards_smoother_clear_data
|
||||
procedure, pass(sm) :: free => d_richards_smoother_free
|
||||
procedure, pass(sm) :: cseti => amg_d_richards_smoother_cseti
|
||||
procedure, pass(sm) :: csetc => amg_d_richards_smoother_csetc
|
||||
procedure, pass(sm) :: csetr => amg_d_richards_smoother_csetr
|
||||
procedure, pass(sm) :: descr => amg_d_richards_smoother_descr
|
||||
procedure, pass(sm) :: sizeof => d_richards_smoother_sizeof
|
||||
procedure, pass(sm) :: default => d_richards_smoother_default
|
||||
procedure, pass(sm) :: get_nzeros => d_richards_smoother_get_nzeros
|
||||
procedure, pass(sm) :: get_wrksz => d_richards_smoother_get_wrksize
|
||||
procedure, nopass :: get_fmt => d_richards_smoother_get_fmt
|
||||
procedure, nopass :: get_id => d_richards_smoother_get_id
|
||||
end type amg_d_richards_smoother_type
|
||||
|
||||
private :: d_richards_smoother_free, &
|
||||
& d_richards_smoother_sizeof, d_richards_smoother_get_nzeros, &
|
||||
& d_richards_smoother_get_fmt, d_richards_smoother_get_id, &
|
||||
& d_richards_smoother_get_wrksize
|
||||
|
||||
interface
|
||||
subroutine amg_d_richards_smoother_apply_vect(alpha,sm,x,beta,y,desc_data,trans,&
|
||||
& sweeps,work,wv,info,init,initu)
|
||||
import :: psb_desc_type, amg_d_richards_smoother_type, psb_d_vect_type, psb_dpk_, &
|
||||
& psb_dspmat_type, psb_d_base_sparse_mat, psb_d_base_vect_type,&
|
||||
& psb_ipk_
|
||||
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(amg_d_richards_smoother_type), intent(inout) :: sm
|
||||
type(psb_d_vect_type),intent(inout) :: x
|
||||
type(psb_d_vect_type),intent(inout) :: y
|
||||
real(psb_dpk_),intent(in) :: alpha,beta
|
||||
character(len=1),intent(in) :: trans
|
||||
integer(psb_ipk_), intent(in) :: sweeps
|
||||
real(psb_dpk_),target, intent(inout) :: work(:)
|
||||
type(psb_d_vect_type),intent(inout) :: wv(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
character, intent(in), optional :: init
|
||||
type(psb_d_vect_type),intent(inout), optional :: initu
|
||||
end subroutine amg_d_richards_smoother_apply_vect
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_richards_smoother_apply(alpha,sm,x,beta,y,desc_data,trans,&
|
||||
& sweeps,work,info,init,initu)
|
||||
import :: psb_desc_type, amg_d_richards_smoother_type, psb_d_vect_type, psb_dpk_, &
|
||||
& psb_dspmat_type, psb_d_base_sparse_mat, psb_d_base_vect_type, &
|
||||
& psb_ipk_
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(amg_d_richards_smoother_type), intent(inout) :: sm
|
||||
real(psb_dpk_),intent(inout) :: x(:)
|
||||
real(psb_dpk_),intent(inout) :: y(:)
|
||||
real(psb_dpk_),intent(in) :: alpha,beta
|
||||
character(len=1),intent(in) :: trans
|
||||
integer(psb_ipk_), intent(in) :: sweeps
|
||||
real(psb_dpk_),target, intent(inout) :: work(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
character, intent(in), optional :: init
|
||||
real(psb_dpk_),intent(inout), optional :: initu(:)
|
||||
end subroutine amg_d_richards_smoother_apply
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_richards_smoother_bld(a,desc_a,sm,info,amold,vmold,imold)
|
||||
import :: psb_desc_type, amg_d_richards_smoother_type, psb_d_vect_type, psb_dpk_, &
|
||||
& psb_dspmat_type, psb_d_base_sparse_mat, psb_d_base_vect_type,&
|
||||
& psb_ipk_, psb_i_base_vect_type
|
||||
type(psb_dspmat_type), intent(inout), target :: a
|
||||
Type(psb_desc_type), Intent(inout) :: desc_a
|
||||
class(amg_d_richards_smoother_type), intent(inout) :: sm
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
class(psb_d_base_sparse_mat), intent(in), optional :: amold
|
||||
class(psb_d_base_vect_type), intent(in), optional :: vmold
|
||||
class(psb_i_base_vect_type), intent(in), optional :: imold
|
||||
end subroutine amg_d_richards_smoother_bld
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_richards_smoother_cnv(sm,info,amold,vmold,imold)
|
||||
import :: amg_d_richards_smoother_type, psb_dpk_, &
|
||||
& psb_d_base_sparse_mat, psb_d_base_vect_type,&
|
||||
& psb_ipk_, psb_i_base_vect_type
|
||||
class(amg_d_richards_smoother_type), intent(inout) :: sm
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
class(psb_d_base_sparse_mat), intent(in), optional :: amold
|
||||
class(psb_d_base_vect_type), intent(in), optional :: vmold
|
||||
class(psb_i_base_vect_type), intent(in), optional :: imold
|
||||
end subroutine amg_d_richards_smoother_cnv
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_richards_smoother_dmp(sm,desc,level,info,prefix,head,smoother,solver,global_num)
|
||||
import :: psb_dspmat_type, psb_d_vect_type, psb_d_base_vect_type, &
|
||||
& psb_dpk_, amg_d_richards_smoother_type, psb_epk_, psb_desc_type, &
|
||||
& psb_ipk_
|
||||
implicit none
|
||||
class(amg_d_richards_smoother_type), intent(in) :: sm
|
||||
type(psb_desc_type), intent(in) :: desc
|
||||
integer(psb_ipk_), intent(in) :: level
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
character(len=*), intent(in), optional :: prefix, head
|
||||
logical, optional, intent(in) :: smoother, solver, global_num
|
||||
end subroutine amg_d_richards_smoother_dmp
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_richards_smoother_clone(sm,smout,info)
|
||||
import :: amg_d_richards_smoother_type, psb_dpk_, &
|
||||
& amg_d_base_smoother_type, psb_ipk_
|
||||
class(amg_d_richards_smoother_type), intent(inout) :: sm
|
||||
class(amg_d_base_smoother_type), allocatable, intent(inout) :: smout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_d_richards_smoother_clone
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_richards_smoother_clone_settings(sm,smout,info)
|
||||
import :: amg_d_richards_smoother_type, psb_dpk_, &
|
||||
& amg_d_base_smoother_type, psb_ipk_
|
||||
class(amg_d_richards_smoother_type), intent(inout) :: sm
|
||||
class(amg_d_base_smoother_type), intent(inout) :: smout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_d_richards_smoother_clone_settings
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_richards_smoother_clear_data(sm,info)
|
||||
import :: amg_d_richards_smoother_type, psb_dpk_, &
|
||||
& amg_d_base_smoother_type, psb_ipk_
|
||||
class(amg_d_richards_smoother_type), intent(inout) :: sm
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_d_richards_smoother_clear_data
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_richards_smoother_descr(sm,info,iout,coarse,prefix)
|
||||
import :: amg_d_richards_smoother_type, psb_ipk_
|
||||
class(amg_d_richards_smoother_type), intent(in) :: sm
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(in), optional :: iout
|
||||
logical, intent(in), optional :: coarse
|
||||
character(len=*), intent(in), optional :: prefix
|
||||
end subroutine amg_d_richards_smoother_descr
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_richards_smoother_cseti(sm,what,val,info,idx)
|
||||
import :: psb_dspmat_type, psb_d_vect_type, psb_d_base_vect_type, &
|
||||
& psb_dpk_, amg_d_richards_smoother_type, psb_epk_, psb_desc_type, psb_ipk_
|
||||
implicit none
|
||||
class(amg_d_richards_smoother_type), intent(inout) :: sm
|
||||
character(len=*), intent(in) :: what
|
||||
integer(psb_ipk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(in), optional :: idx
|
||||
end subroutine amg_d_richards_smoother_cseti
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_richards_smoother_csetc(sm,what,val,info,idx)
|
||||
import :: psb_dspmat_type, psb_d_vect_type, psb_d_base_vect_type, &
|
||||
& psb_dpk_, amg_d_richards_smoother_type, psb_epk_, psb_desc_type, psb_ipk_
|
||||
implicit none
|
||||
class(amg_d_richards_smoother_type), intent(inout) :: sm
|
||||
character(len=*), intent(in) :: what
|
||||
character(len=*), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(in), optional :: idx
|
||||
end subroutine amg_d_richards_smoother_csetc
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_richards_smoother_csetr(sm,what,val,info,idx)
|
||||
import :: psb_dspmat_type, psb_d_vect_type, psb_d_base_vect_type, &
|
||||
& psb_dpk_, amg_d_richards_smoother_type, psb_epk_, psb_desc_type, psb_ipk_
|
||||
implicit none
|
||||
class(amg_d_richards_smoother_type), intent(inout) :: sm
|
||||
character(len=*), intent(in) :: what
|
||||
real(psb_dpk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(in), optional :: idx
|
||||
end subroutine amg_d_richards_smoother_csetr
|
||||
end interface
|
||||
|
||||
contains
|
||||
|
||||
subroutine d_richards_smoother_free(sm,info)
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_richards_smoother_type), intent(inout) :: sm
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='d_richards_smoother_free'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
|
||||
if (allocated(sm%sv)) then
|
||||
call sm%sv%free(info)
|
||||
if (info == psb_success_) deallocate(sm%sv,stat=info)
|
||||
if (info /= psb_success_) then
|
||||
info = psb_err_alloc_dealloc_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
end if
|
||||
sm%pa => null()
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine d_richards_smoother_free
|
||||
|
||||
function d_richards_smoother_sizeof(sm) result(val)
|
||||
implicit none
|
||||
! Arguments
|
||||
class(amg_d_richards_smoother_type), intent(in) :: sm
|
||||
integer(psb_epk_) :: val
|
||||
integer(psb_ipk_) :: i
|
||||
|
||||
val = psb_sizeof_lp
|
||||
if (allocated(sm%sv)) val = val + sm%sv%sizeof()
|
||||
|
||||
return
|
||||
end function d_richards_smoother_sizeof
|
||||
|
||||
subroutine d_richards_smoother_default(sm)
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_richards_smoother_type), intent(inout) :: sm
|
||||
|
||||
!
|
||||
! Default: Richards iteration with omega=1.0 and no residual check
|
||||
!
|
||||
sm%checkres = .false.
|
||||
sm%printres = .false.
|
||||
sm%checkiter = -1
|
||||
sm%printiter = -1
|
||||
sm%tol = 0
|
||||
sm%omega = 1.0d0
|
||||
|
||||
if (allocated(sm%sv)) then
|
||||
call sm%sv%default()
|
||||
end if
|
||||
|
||||
return
|
||||
end subroutine d_richards_smoother_default
|
||||
|
||||
function d_richards_smoother_get_nzeros(sm) result(val)
|
||||
implicit none
|
||||
! Arguments
|
||||
class(amg_d_richards_smoother_type), intent(in) :: sm
|
||||
integer(psb_epk_) :: val
|
||||
integer(psb_ipk_) :: i
|
||||
|
||||
val = 0
|
||||
if (allocated(sm%sv)) val = val + sm%sv%get_nzeros()
|
||||
|
||||
return
|
||||
end function d_richards_smoother_get_nzeros
|
||||
|
||||
function d_richards_smoother_get_wrksize(sm) result(val)
|
||||
implicit none
|
||||
class(amg_d_richards_smoother_type), intent(inout) :: sm
|
||||
integer(psb_ipk_) :: val
|
||||
|
||||
val = 2
|
||||
if (allocated(sm%sv)) val = val + sm%sv%get_wrksz()
|
||||
|
||||
end function d_richards_smoother_get_wrksize
|
||||
|
||||
function d_richards_smoother_get_fmt() result(val)
|
||||
implicit none
|
||||
character(len=32) :: val
|
||||
|
||||
val = "Richards smoother"
|
||||
end function d_richards_smoother_get_fmt
|
||||
|
||||
function d_richards_smoother_get_id() result(val)
|
||||
implicit none
|
||||
integer(psb_ipk_) :: val
|
||||
|
||||
val = amg_richardson_
|
||||
end function d_richards_smoother_get_id
|
||||
|
||||
end module amg_d_richards_smoother
|
||||
@@ -94,6 +94,7 @@ amg_d_jac_smoother_cnv.o \
|
||||
amg_d_jac_smoother_csetc.o \
|
||||
amg_d_jac_smoother_cseti.o \
|
||||
amg_d_jac_smoother_csetr.o \
|
||||
amg_d_richards_smoother_impl.o \
|
||||
amg_d_l1_jac_smoother_bld.o \
|
||||
amg_d_l1_jac_smoother_descr.o \
|
||||
amg_d_l1_jac_smoother_clone.o \
|
||||
|
||||
@@ -0,0 +1,644 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
!
|
||||
subroutine amg_d_richards_smoother_apply_vect(alpha,sm,x,beta,y,desc_data,trans,&
|
||||
& sweeps,work,wv,info,init,initu)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_richards_smoother, amg_protect_name => amg_d_richards_smoother_apply_vect
|
||||
implicit none
|
||||
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(amg_d_richards_smoother_type), intent(inout) :: sm
|
||||
type(psb_d_vect_type), intent(inout) :: x
|
||||
type(psb_d_vect_type), intent(inout) :: y
|
||||
real(psb_dpk_), intent(in) :: alpha, beta
|
||||
character(len=1), intent(in) :: trans
|
||||
integer(psb_ipk_), intent(in) :: sweeps
|
||||
real(psb_dpk_), target, intent(inout) :: work(:)
|
||||
type(psb_d_vect_type), intent(inout) :: wv(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
character, intent(in), optional :: init
|
||||
type(psb_d_vect_type), intent(inout), optional :: initu
|
||||
|
||||
integer(psb_ipk_) :: n_col, err_act, i
|
||||
character :: trans_, init_
|
||||
real(psb_dpk_), pointer :: aux(:)
|
||||
character(len=32) :: name='d_richards_smoother_apply_v'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
|
||||
trans_ = psb_toupper(trans)
|
||||
if ((trans_ /= 'N').and.(trans_ /= 'T').and.(trans_ /= 'C')) then
|
||||
call psb_errpush(psb_err_iarg_invalid_i_,name)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
if (sweeps < 0) then
|
||||
info = psb_err_iarg_neg_
|
||||
call psb_errpush(info,name,i_err=(/itwo,sweeps,izero,izero,izero/))
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
if (.not.allocated(sm%sv)) then
|
||||
info = psb_err_invalid_cd_state_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
if (.not.associated(sm%pa)) then
|
||||
info = psb_err_invalid_cd_state_
|
||||
call psb_errpush(info,name,a_err='matrix pointer not associated')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
if (size(wv) < 3) then
|
||||
info = psb_err_internal_error_
|
||||
call psb_errpush(info,name,a_err='workspace vectors too small')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
init_ = 'Z'
|
||||
if (present(init)) init_ = psb_toupper(init)
|
||||
|
||||
n_col = desc_data%get_local_cols()
|
||||
if (4*n_col <= size(work)) then
|
||||
aux => work(:)
|
||||
else
|
||||
allocate(aux(4*n_col),stat=info)
|
||||
if (info /= psb_success_) then
|
||||
info = psb_err_alloc_request_
|
||||
call psb_errpush(info,name,i_err=(/4*n_col,izero,izero,izero,izero/),&
|
||||
& a_err='real(psb_dpk_)')
|
||||
goto 9999
|
||||
end if
|
||||
end if
|
||||
|
||||
associate(tx => wv(1), ty => wv(2), tz => wv(3))
|
||||
|
||||
select case(init_)
|
||||
case('Z')
|
||||
call psb_geaxpby(dzero,x,dzero,ty,desc_data,info)
|
||||
case('Y')
|
||||
call psb_geaxpby(done,y,dzero,ty,desc_data,info)
|
||||
case('U')
|
||||
if (.not.present(initu)) then
|
||||
info = psb_err_internal_error_
|
||||
call psb_errpush(info,name,a_err='missing initu to smoother_apply_vect')
|
||||
goto 9999
|
||||
end if
|
||||
call psb_geaxpby(done,initu,dzero,ty,desc_data,info)
|
||||
case default
|
||||
info = psb_err_internal_error_
|
||||
call psb_errpush(info,name,a_err='wrong init to smoother_apply_vect')
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
do i = 1, sweeps
|
||||
call psb_geaxpby(done,x,dzero,tx,desc_data,info)
|
||||
call psb_spmm(-done,sm%pa,ty,done,tx,desc_data,info,work=aux,trans=trans_)
|
||||
if (info /= psb_success_) exit
|
||||
|
||||
call sm%sv%apply(done,tx,dzero,tz,desc_data,trans_,aux,wv(4:),info,init='Y')
|
||||
if (info /= psb_success_) exit
|
||||
|
||||
call psb_geaxpby(sm%omega,tz,done,ty,desc_data,info)
|
||||
if (info /= psb_success_) exit
|
||||
end do
|
||||
|
||||
if (info == psb_success_) call psb_geaxpby(alpha,ty,beta,y,desc_data,info)
|
||||
|
||||
end associate
|
||||
|
||||
if (.not.(4*n_col <= size(work))) deallocate(aux)
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
|
||||
end subroutine amg_d_richards_smoother_apply_vect
|
||||
|
||||
|
||||
subroutine amg_d_richards_smoother_apply(alpha,sm,x,beta,y,desc_data,trans,&
|
||||
& sweeps,work,info,init,initu)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_richards_smoother, amg_protect_name => amg_d_richards_smoother_apply
|
||||
implicit none
|
||||
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(amg_d_richards_smoother_type), intent(inout) :: sm
|
||||
real(psb_dpk_), intent(inout) :: x(:)
|
||||
real(psb_dpk_), intent(inout) :: y(:)
|
||||
real(psb_dpk_), intent(in) :: alpha, beta
|
||||
character(len=1), intent(in) :: trans
|
||||
integer(psb_ipk_), intent(in) :: sweeps
|
||||
real(psb_dpk_), target, intent(inout) :: work(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
character, intent(in), optional :: init
|
||||
real(psb_dpk_), intent(inout), optional :: initu(:)
|
||||
|
||||
integer(psb_ipk_) :: n_col, err_act, i
|
||||
character :: trans_, init_
|
||||
real(psb_dpk_), pointer :: aux(:)
|
||||
real(psb_dpk_), allocatable :: tx(:), ty(:), tz(:)
|
||||
character(len=30) :: name='d_richards_smoother_apply'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
|
||||
trans_ = psb_toupper(trans)
|
||||
if ((trans_ /= 'N').and.(trans_ /= 'T').and.(trans_ /= 'C')) then
|
||||
call psb_errpush(psb_err_iarg_invalid_i_,name)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
if (sweeps < 0) then
|
||||
info = psb_err_iarg_neg_
|
||||
call psb_errpush(info,name,i_err=(/itwo,sweeps,izero,izero,izero/))
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
if (.not.allocated(sm%sv)) then
|
||||
info = psb_err_invalid_cd_state_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
if (.not.associated(sm%pa)) then
|
||||
info = psb_err_invalid_cd_state_
|
||||
call psb_errpush(info,name,a_err='matrix pointer not associated')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
n_col = desc_data%get_local_cols()
|
||||
if (4*n_col <= size(work)) then
|
||||
aux => work(:)
|
||||
else
|
||||
allocate(aux(4*n_col),stat=info)
|
||||
if (info /= psb_success_) then
|
||||
info = psb_err_alloc_request_
|
||||
call psb_errpush(info,name,i_err=(/4*n_col,izero,izero,izero,izero/),&
|
||||
& a_err='real(psb_dpk_)')
|
||||
goto 9999
|
||||
end if
|
||||
end if
|
||||
|
||||
allocate(tx(size(x)),ty(size(y)),tz(size(y)),stat=info)
|
||||
if (info /= 0) then
|
||||
info = psb_err_alloc_request_
|
||||
call psb_errpush(info,name,a_err='alloc tx/ty/tz')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
init_ = 'Z'
|
||||
if (present(init)) init_ = psb_toupper(init)
|
||||
|
||||
select case(init_)
|
||||
case('Z')
|
||||
ty(:) = dzero
|
||||
case('Y')
|
||||
ty(:) = y(:)
|
||||
case('U')
|
||||
if (.not.present(initu)) then
|
||||
info = psb_err_internal_error_
|
||||
call psb_errpush(info,name,a_err='missing initu to smoother_apply')
|
||||
goto 9999
|
||||
end if
|
||||
ty(:) = initu(:)
|
||||
case default
|
||||
info = psb_err_internal_error_
|
||||
call psb_errpush(info,name,a_err='wrong init to smoother_apply')
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
do i = 1, sweeps
|
||||
tx(:) = x(:)
|
||||
call psb_spmm(-done,sm%pa,ty,done,tx,desc_data,info,work=aux,trans=trans_)
|
||||
if (info /= psb_success_) exit
|
||||
|
||||
call sm%sv%apply(done,tx,dzero,tz,desc_data,trans_,aux,info,init='Y')
|
||||
if (info /= psb_success_) exit
|
||||
|
||||
ty(:) = ty(:) + sm%omega*tz(:)
|
||||
end do
|
||||
|
||||
if (info == psb_success_) y(:) = beta*y(:) + alpha*ty(:)
|
||||
|
||||
deallocate(tx,ty,tz,stat=info)
|
||||
if (.not.(4*n_col <= size(work))) deallocate(aux)
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
|
||||
end subroutine amg_d_richards_smoother_apply
|
||||
|
||||
|
||||
subroutine amg_d_richards_smoother_bld(a,desc_a,sm,info,amold,vmold,imold)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_richards_smoother, amg_protect_name => amg_d_richards_smoother_bld
|
||||
implicit none
|
||||
|
||||
type(psb_dspmat_type), intent(inout), target :: a
|
||||
type(psb_desc_type), intent(inout) :: desc_a
|
||||
class(amg_d_richards_smoother_type), intent(inout) :: sm
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
class(psb_d_base_sparse_mat), intent(in), optional :: amold
|
||||
class(psb_d_base_vect_type), intent(in), optional :: vmold
|
||||
class(psb_i_base_vect_type), intent(in), optional :: imold
|
||||
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=28) :: name='d_richards_smoother_bld'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
sm%pa => a
|
||||
if (sm%omega == dzero) sm%omega = done
|
||||
|
||||
if (.not.allocated(sm%sv)) then
|
||||
info = psb_err_invalid_cd_state_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
call sm%sv%build(a,desc_a,info,amold=amold,vmold=vmold,imold=imold)
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='solver build')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
|
||||
end subroutine amg_d_richards_smoother_bld
|
||||
|
||||
|
||||
subroutine amg_d_richards_smoother_cnv(sm,info,amold,vmold,imold)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_richards_smoother, amg_protect_name => amg_d_richards_smoother_cnv
|
||||
implicit none
|
||||
|
||||
class(amg_d_richards_smoother_type), intent(inout) :: sm
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
class(psb_d_base_sparse_mat), intent(in), optional :: amold
|
||||
class(psb_d_base_vect_type), intent(in), optional :: vmold
|
||||
class(psb_i_base_vect_type), intent(in), optional :: imold
|
||||
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=28) :: name='d_richards_smoother_cnv'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
if (allocated(sm%sv)) call sm%sv%cnv(info,amold=amold,vmold=vmold,imold=imold)
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='solver cnv')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
|
||||
end subroutine amg_d_richards_smoother_cnv
|
||||
|
||||
|
||||
subroutine amg_d_richards_smoother_dmp(sm,desc,level,info,prefix,head,smoother,solver,global_num)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_richards_smoother, amg_protect_name => amg_d_richards_smoother_dmp
|
||||
implicit none
|
||||
|
||||
class(amg_d_richards_smoother_type), intent(in) :: sm
|
||||
type(psb_desc_type), intent(in) :: desc
|
||||
integer(psb_ipk_), intent(in) :: level
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
character(len=*), intent(in), optional :: prefix, head
|
||||
logical, intent(in), optional :: smoother, solver, global_num
|
||||
|
||||
info = psb_success_
|
||||
if (allocated(sm%sv)) call sm%sv%dump(desc,level,info,solver=solver,prefix=prefix,global_num=global_num)
|
||||
|
||||
end subroutine amg_d_richards_smoother_dmp
|
||||
|
||||
|
||||
subroutine amg_d_richards_smoother_clone(sm,smout,info)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_richards_smoother, amg_protect_name => amg_d_richards_smoother_clone
|
||||
implicit none
|
||||
|
||||
class(amg_d_richards_smoother_type), intent(inout) :: sm
|
||||
class(amg_d_base_smoother_type), allocatable, intent(inout) :: smout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
integer(psb_ipk_) :: err_act
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
if (allocated(smout)) then
|
||||
call smout%free(info)
|
||||
if (info == psb_success_) deallocate(smout, stat=info)
|
||||
end if
|
||||
if (info == psb_success_) allocate(amg_d_richards_smoother_type :: smout, stat=info)
|
||||
if (info /= 0) then
|
||||
info = psb_err_alloc_dealloc_
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
select type(smo => smout)
|
||||
type is (amg_d_richards_smoother_type)
|
||||
smo%global_nnz_tot = sm%global_nnz_tot
|
||||
smo%checkres = sm%checkres
|
||||
smo%printres = sm%printres
|
||||
smo%checkiter = sm%checkiter
|
||||
smo%printiter = sm%printiter
|
||||
smo%tol = sm%tol
|
||||
smo%omega = sm%omega
|
||||
smo%pa => sm%pa
|
||||
if (allocated(sm%sv)) then
|
||||
allocate(smo%sv,mold=sm%sv,stat=info)
|
||||
if (info == psb_success_) call sm%sv%clone(smo%sv,info)
|
||||
end if
|
||||
class default
|
||||
info = psb_err_internal_error_
|
||||
end select
|
||||
|
||||
if (info /= 0) goto 9999
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
|
||||
end subroutine amg_d_richards_smoother_clone
|
||||
|
||||
|
||||
subroutine amg_d_richards_smoother_clone_settings(sm,smout,info)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_richards_smoother, amg_protect_name => amg_d_richards_smoother_clone_settings
|
||||
implicit none
|
||||
|
||||
class(amg_d_richards_smoother_type), intent(inout) :: sm
|
||||
class(amg_d_base_smoother_type), intent(inout) :: smout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=36) :: name='d_richards_smoother_clone_settings'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
|
||||
select type(smout)
|
||||
class is(amg_d_richards_smoother_type)
|
||||
smout%pa => null()
|
||||
smout%global_nnz_tot = 0
|
||||
smout%checkres = sm%checkres
|
||||
smout%printres = sm%printres
|
||||
smout%checkiter = sm%checkiter
|
||||
smout%printiter = sm%printiter
|
||||
smout%tol = sm%tol
|
||||
smout%omega = sm%omega
|
||||
|
||||
if (allocated(smout%sv)) then
|
||||
if (.not.same_type_as(sm%sv,smout%sv)) then
|
||||
call smout%sv%free(info)
|
||||
if (info == 0) deallocate(smout%sv,stat=info)
|
||||
end if
|
||||
end if
|
||||
|
||||
if (info == 0) then
|
||||
if (allocated(smout%sv)) then
|
||||
if (same_type_as(sm%sv,smout%sv)) then
|
||||
call sm%sv%clone_settings(smout%sv,info)
|
||||
else
|
||||
info = psb_err_internal_error_
|
||||
end if
|
||||
else
|
||||
allocate(smout%sv,mold=sm%sv,stat=info)
|
||||
if (info == 0) call sm%sv%clone_settings(smout%sv,info)
|
||||
end if
|
||||
end if
|
||||
class default
|
||||
info = psb_err_internal_error_
|
||||
end select
|
||||
|
||||
if (info /= 0) then
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
|
||||
end subroutine amg_d_richards_smoother_clone_settings
|
||||
|
||||
|
||||
subroutine amg_d_richards_smoother_clear_data(sm,info)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_richards_smoother, amg_protect_name => amg_d_richards_smoother_clear_data
|
||||
implicit none
|
||||
|
||||
class(amg_d_richards_smoother_type), intent(inout) :: sm
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=31) :: name='d_richards_smoother_clear_data'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
info = psb_success_
|
||||
sm%pa => null()
|
||||
sm%global_nnz_tot = 0
|
||||
if ((info == 0).and.allocated(sm%sv)) call sm%sv%clear_data(info)
|
||||
if (info /= 0) then
|
||||
info = psb_err_internal_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
|
||||
end subroutine amg_d_richards_smoother_clear_data
|
||||
|
||||
|
||||
subroutine amg_d_richards_smoother_descr(sm,info,iout,coarse,prefix)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_richards_smoother, amg_protect_name => amg_d_richards_smoother_descr
|
||||
implicit none
|
||||
|
||||
class(amg_d_richards_smoother_type), intent(in) :: sm
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(in), optional :: iout
|
||||
logical, intent(in), optional :: coarse
|
||||
character(len=*), intent(in), optional :: prefix
|
||||
|
||||
integer(psb_ipk_) :: iout_
|
||||
character(1024) :: prefix_
|
||||
|
||||
info = psb_success_
|
||||
iout_ = psb_out_unit
|
||||
if (present(iout)) iout_ = iout
|
||||
prefix_ = ''
|
||||
if (present(prefix)) prefix_ = prefix
|
||||
|
||||
write(iout_,*) trim(prefix_), ' Richardson smoother'
|
||||
write(iout_,*) trim(prefix_), ' Relaxation omega: ', sm%omega
|
||||
if (allocated(sm%sv)) then
|
||||
write(iout_,*) trim(prefix_), ' Preconditioner details:'
|
||||
call sm%sv%descr(info,iout_,coarse=coarse,prefix=prefix)
|
||||
end if
|
||||
|
||||
end subroutine amg_d_richards_smoother_descr
|
||||
|
||||
|
||||
subroutine amg_d_richards_smoother_cseti(sm,what,val,info,idx)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_richards_smoother, amg_protect_name => amg_d_richards_smoother_cseti
|
||||
implicit none
|
||||
|
||||
class(amg_d_richards_smoother_type), intent(inout) :: sm
|
||||
character(len=*), intent(in) :: what
|
||||
integer(psb_ipk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(in), optional :: idx
|
||||
|
||||
integer(psb_ipk_) :: err_act
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select case(psb_toupper(what))
|
||||
case('SMOOTHER_RESIDUAL')
|
||||
sm%checkiter = val
|
||||
case('SMOOTHER_ITRACE')
|
||||
sm%printiter = val
|
||||
case default
|
||||
call sm%amg_d_base_smoother_type%set(what,val,info,idx=idx)
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
|
||||
end subroutine amg_d_richards_smoother_cseti
|
||||
|
||||
|
||||
subroutine amg_d_richards_smoother_csetc(sm,what,val,info,idx)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_richards_smoother, amg_protect_name => amg_d_richards_smoother_csetc
|
||||
implicit none
|
||||
|
||||
class(amg_d_richards_smoother_type), intent(inout) :: sm
|
||||
character(len=*), intent(in) :: what
|
||||
character(len=*), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(in), optional :: idx
|
||||
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=30) :: name='d_richards_smoother_csetc'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select case(psb_toupper(trim(what)))
|
||||
case('SMOOTHER_STOP')
|
||||
select case(psb_toupper(trim(val)))
|
||||
case('T','TRUE')
|
||||
sm%checkres = .true.
|
||||
case('F','FALSE')
|
||||
sm%checkres = .false.
|
||||
end select
|
||||
case('SMOOTHER_TRACE')
|
||||
select case(psb_toupper(trim(val)))
|
||||
case('T','TRUE')
|
||||
sm%printres = .true.
|
||||
case('F','FALSE')
|
||||
sm%printres = .false.
|
||||
end select
|
||||
case default
|
||||
call sm%amg_d_base_smoother_type%set(what,val,info,idx=idx)
|
||||
end select
|
||||
|
||||
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
|
||||
|
||||
end subroutine amg_d_richards_smoother_csetc
|
||||
|
||||
|
||||
subroutine amg_d_richards_smoother_csetr(sm,what,val,info,idx)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_richards_smoother, amg_protect_name => amg_d_richards_smoother_csetr
|
||||
implicit none
|
||||
|
||||
class(amg_d_richards_smoother_type), intent(inout) :: sm
|
||||
character(len=*), intent(in) :: what
|
||||
real(psb_dpk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(in), optional :: idx
|
||||
|
||||
integer(psb_ipk_) :: err_act
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select case(psb_toupper(what))
|
||||
case('SMOOTHER_STOPTOL')
|
||||
sm%tol = val
|
||||
case('RICHARDSON_OMEGA','SMOOTHER_OMEGA','OMEGA')
|
||||
sm%omega = val
|
||||
case default
|
||||
call sm%amg_d_base_smoother_type%set(what,val,info,idx=idx)
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
|
||||
end subroutine amg_d_richards_smoother_csetr
|
||||
+43
-5
@@ -601,7 +601,7 @@ fi
|
||||
###############################################################################
|
||||
# Parachute rules for ar and ranlib ... (could cause problems)
|
||||
###############################################################################
|
||||
AC_PROG_AR
|
||||
AC_CHECK_TOOL([AR],[ar],[ar])
|
||||
AR="${AR} -cr"
|
||||
AC_PROG_RANLIB
|
||||
|
||||
@@ -752,6 +752,10 @@ PAC_CHECK_MUMPS
|
||||
# the problem size fits into 4 bytes, very likely since we
|
||||
# are mostly using MUMPS at coarse level.
|
||||
#
|
||||
amg4psblas_cv_mumps_version="unknown"
|
||||
amg4psblas_cv_mumps_version_num=0
|
||||
CHAVEMUMPSVERSION=""
|
||||
CHAVEMUMPSVERSIONSTRING=""
|
||||
dnl if test "x$amg4psblas_cv_have_mumps" == "xyes" ; then
|
||||
dnl if test "x$pac_cv_psblas_ipk" == "x8" ; then
|
||||
dnl AC_MSG_NOTICE([PSBLAS defines PSB_IPK_ as $pac_cv_psblas_ipk. MUMPS interfacing disabled. ])
|
||||
@@ -761,6 +765,38 @@ dnl amg4psblas_cv_have_mumps=no;
|
||||
dnl fi
|
||||
dnl fi
|
||||
if test "x$amg4psblas_cv_have_mumps" == "xyes" ; then
|
||||
amg_mumps_incdir=`echo "$MUMPS_INCLUDES" | sed -e 's/^-I//'`
|
||||
amg_mumps_header=""
|
||||
for amg_mumps_candidate in \
|
||||
"$amg_mumps_incdir/dmumps_c.h" \
|
||||
"$amg4psblas_cv_mumpsincdir/dmumps_c.h" \
|
||||
"$amg4psblas_cv_mumpsdir/dmumps_c.h" \
|
||||
"$amg4psblas_cv_mumpsdir/include/dmumps_c.h" \
|
||||
"$amg4psblas_cv_mumpsdir/Include/dmumps_c.h"
|
||||
do
|
||||
if test -f "$amg_mumps_candidate" ; then
|
||||
amg_mumps_header="$amg_mumps_candidate"
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test "x$amg_mumps_header" != "x" ; then
|
||||
amg4psblas_cv_mumps_version=`awk '/^#[ \t]*define[ \t]+MUMPS_VERSION[ \t]+/ {v=$0; sub(/^#[ \t]*define[ \t]+MUMPS_VERSION[ \t]+/,"",v); gsub(/"/,"",v); print v; exit}' "$amg_mumps_header"`
|
||||
if test "x$amg4psblas_cv_mumps_version" = "x" ; then
|
||||
amg4psblas_cv_mumps_version=`awk '/part of MUMPS/ {for(i=1;i<=NF;i++) if($i=="MUMPS") {v=$(i+1); sub(/,.*/,"",v); print v; exit}}' "$amg_mumps_header"`
|
||||
fi
|
||||
if test "x$amg4psblas_cv_mumps_version" = "x" ; then
|
||||
amg4psblas_cv_mumps_version="unknown"
|
||||
fi
|
||||
amg4psblas_cv_mumps_version_num=`echo "$amg4psblas_cv_mumps_version" | sed -e 's/[^0-9]//g' -e 's/^0*//'`
|
||||
if test "x$amg4psblas_cv_mumps_version_num" = "x" ; then
|
||||
amg4psblas_cv_mumps_version_num=0
|
||||
fi
|
||||
AC_MSG_NOTICE([Configuring with MUMPS version $amg4psblas_cv_mumps_version (numeric flag $amg4psblas_cv_mumps_version_num)])
|
||||
else
|
||||
AC_MSG_NOTICE([Could not locate dmumps_c.h to extract the MUMPS version.])
|
||||
fi
|
||||
CHAVEMUMPSVERSION="#define AMG_MUMPS_VERSION $amg4psblas_cv_mumps_version_num"
|
||||
CHAVEMUMPSVERSIONSTRING="#define AMG_MUMPS_VERSION_STRING \"$amg4psblas_cv_mumps_version\""
|
||||
if test "x$pac_cv_psblas_lpk" == "x8" ; then
|
||||
AC_MSG_NOTICE([PSBLAS defines PSB_LPK_ as $pac_cv_psblas_lpk. MUMPS interfacing will fail when called in global mode on very large matrices. ])
|
||||
fi
|
||||
@@ -769,14 +805,14 @@ if test "x$amg4psblas_cv_have_mumps" == "xyes" ; then
|
||||
MUMPS_LIBS="${MUMPS_LIBS} -L$amg4psblas_cv_mumpslibdir"
|
||||
fi
|
||||
if test "x$pac_mumps_fmods_ok" == "xyes" ; then
|
||||
FDEFINES="$amg_cv_define_prepend-DAMG_HAVE_MUMPS $amg_cv_define_prepend-DAMG_HAVE_MUMPS_MODULES $MUMPS_MODULES $FDEFINES"
|
||||
MUMPS_FLAGS="-DAMG_HAVE_MUMPS $MUMPS_MODULES"
|
||||
FDEFINES="$amg_cv_define_prepend-DAMG_HAVE_MUMPS $amg_cv_define_prepend-DAMG_HAVE_MUMPS_MODULES $amg_cv_define_prepend-DAMG_MUMPS_VERSION=$amg4psblas_cv_mumps_version_num $MUMPS_MODULES $FDEFINES"
|
||||
MUMPS_FLAGS="-DAMG_HAVE_MUMPS -DAMG_MUMPS_VERSION=$amg4psblas_cv_mumps_version_num $MUMPS_MODULES"
|
||||
CHAVEMUMPS="#define AMG_HAVE_MUMPS"
|
||||
CHAVEMUMPSMODULES="#define AMG_HAVE_MUMPS_MODULES"
|
||||
|
||||
elif test "x$pac_mumps_fincs_ok" == "xyes" ; then
|
||||
FDEFINES="$amg_cv_define_prepend-DAMG_HAVE_MUMPS $amg_cv_define_prepend-DAMG_HAVE_MUMPS_INCLUDES $MUMPS_FINCLUDES $FDEFINES"
|
||||
MUMPS_FLAGS="-DAMG_HAVE_MUMPS $MUMPS_FINCLUDES"
|
||||
FDEFINES="$amg_cv_define_prepend-DAMG_HAVE_MUMPS $amg_cv_define_prepend-DAMG_HAVE_MUMPS_INCLUDES $amg_cv_define_prepend-DAMG_MUMPS_VERSION=$amg4psblas_cv_mumps_version_num $MUMPS_FINCLUDES $FDEFINES"
|
||||
MUMPS_FLAGS="-DAMG_HAVE_MUMPS -DAMG_MUMPS_VERSION=$amg4psblas_cv_mumps_version_num $MUMPS_FINCLUDES"
|
||||
CHAVEMUMPS="#define AMG_HAVE_MUMPS"
|
||||
CHAVEMUMPSINCLUDES="#define AMG_HAVE_MUMPS_INCLUDES"
|
||||
else
|
||||
@@ -869,6 +905,8 @@ AC_SUBST(CSLUDISTVERSION)
|
||||
AC_SUBST(CHAVEMUMPS)
|
||||
AC_SUBST(CHAVEMUMPSMODULES)
|
||||
AC_SUBST(CHAVEMUMPSINCLUDES)
|
||||
AC_SUBST(CHAVEMUMPSVERSION)
|
||||
AC_SUBST(CHAVEMUMPSVERSIONSTRING)
|
||||
AC_SUBST(CXXMATCHBOXBIT)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user