mirror of
https://github.com/sfilippone/amg4psblas.git
synced 2026-10-07 23:16:46 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e06338f7fb | ||
|
|
0c58e1a95c | ||
|
|
c2fd0ac66d | ||
|
|
5387e206b1 | ||
|
|
fc34385341 | ||
|
|
5fbdfb1436 | ||
|
|
1dcb542e4a | ||
|
|
84ea60c94c | ||
|
|
e8b50152fa | ||
|
|
e6894501dd | ||
|
|
975fc6265f | ||
|
|
a97f56d673 | ||
|
|
b1f05482a6 |
@@ -3,9 +3,9 @@ include Make.inc
|
||||
|
||||
all: objs lib
|
||||
|
||||
objs: amgp cbnd
|
||||
objs: libdir amgp cbnd
|
||||
|
||||
lib: libdir objs
|
||||
lib: objs
|
||||
cd amgprec && $(MAKE) lib
|
||||
cd cbind && $(MAKE) lib
|
||||
|
||||
|
||||
+8
-8
@@ -11,7 +11,7 @@ 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_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 \
|
||||
amg_d_gs_solver.o amg_d_mumps_solver.o \
|
||||
amg_d_gs_solver.o amg_d_mumps_solver.o amg_d_jac_solver.o \
|
||||
amg_d_base_aggregator_mod.o \
|
||||
amg_d_dec_aggregator_mod.o amg_d_symdec_aggregator_mod.o \
|
||||
amg_d_ainv_solver.o amg_d_base_ainv_mod.o \
|
||||
@@ -22,7 +22,7 @@ SMODOBJS=amg_s_prec_type.o amg_s_ilu_fact_mod.o \
|
||||
amg_s_inner_mod.o amg_s_ilu_solver.o amg_s_diag_solver.o amg_s_jac_smoother.o amg_s_as_smoother.o \
|
||||
amg_s_slu_solver.o amg_s_id_solver.o\
|
||||
amg_s_base_solver_mod.o amg_s_base_smoother_mod.o amg_s_onelev_mod.o \
|
||||
amg_s_gs_solver.o amg_s_mumps_solver.o \
|
||||
amg_s_gs_solver.o amg_s_mumps_solver.o amg_s_jac_solver.o \
|
||||
amg_s_base_aggregator_mod.o \
|
||||
amg_s_dec_aggregator_mod.o amg_s_symdec_aggregator_mod.o \
|
||||
amg_s_ainv_solver.o amg_s_base_ainv_mod.o \
|
||||
@@ -33,7 +33,7 @@ ZMODOBJS=amg_z_prec_type.o amg_z_ilu_fact_mod.o \
|
||||
amg_z_inner_mod.o amg_z_ilu_solver.o amg_z_diag_solver.o amg_z_jac_smoother.o amg_z_as_smoother.o \
|
||||
amg_z_umf_solver.o amg_z_slu_solver.o amg_z_sludist_solver.o amg_z_id_solver.o\
|
||||
amg_z_base_solver_mod.o amg_z_base_smoother_mod.o amg_z_onelev_mod.o \
|
||||
amg_z_gs_solver.o amg_z_mumps_solver.o \
|
||||
amg_z_gs_solver.o amg_z_mumps_solver.o amg_z_jac_solver.o \
|
||||
amg_z_base_aggregator_mod.o \
|
||||
amg_z_dec_aggregator_mod.o amg_z_symdec_aggregator_mod.o \
|
||||
amg_z_ainv_solver.o amg_z_base_ainv_mod.o \
|
||||
@@ -43,7 +43,7 @@ CMODOBJS=amg_c_prec_type.o amg_c_ilu_fact_mod.o \
|
||||
amg_c_inner_mod.o amg_c_ilu_solver.o amg_c_diag_solver.o amg_c_jac_smoother.o amg_c_as_smoother.o \
|
||||
amg_c_slu_solver.o amg_c_id_solver.o\
|
||||
amg_c_base_solver_mod.o amg_c_base_smoother_mod.o amg_c_onelev_mod.o \
|
||||
amg_c_gs_solver.o amg_c_mumps_solver.o \
|
||||
amg_c_gs_solver.o amg_c_mumps_solver.o amg_c_jac_solver.o \
|
||||
amg_c_base_aggregator_mod.o \
|
||||
amg_c_dec_aggregator_mod.o amg_c_symdec_aggregator_mod.o \
|
||||
amg_c_ainv_solver.o amg_c_base_ainv_mod.o \
|
||||
@@ -155,7 +155,7 @@ amg_z_base_ainv_mod.o: amg_z_base_solver_mod.o amg_base_ainv_mod.o
|
||||
amg_s_base_solver_mod.o amg_d_base_solver_mod.o amg_c_base_solver_mod.o amg_z_base_solver_mod.o: amg_base_prec_type.o
|
||||
|
||||
amg_d_mumps_solver.o amg_d_gs_solver.o amg_d_id_solver.o amg_d_sludist_solver.o amg_d_slu_solver.o \
|
||||
amg_d_umf_solver.o amg_d_diag_solver.o amg_d_ilu_solver.o: amg_d_base_solver_mod.o amg_d_prec_type.o
|
||||
amg_d_umf_solver.o amg_d_diag_solver.o amg_d_ilu_solver.o amg_d_jac_solver.o: amg_d_base_solver_mod.o amg_d_prec_type.o
|
||||
|
||||
#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
|
||||
@@ -166,7 +166,7 @@ amg_dprecinit.o amg_dprecset.o: amg_d_diag_solver.o amg_d_ilu_solver.o \
|
||||
amg_d_id_solver.o amg_d_slu_solver.o amg_d_sludist_solver.o
|
||||
|
||||
amg_s_mumps_solver.o amg_s_gs_solver.o amg_s_id_solver.o amg_s_slu_solver.o \
|
||||
amg_s_diag_solver.o amg_s_ilu_solver.o: amg_s_base_solver_mod.o amg_s_prec_type.o
|
||||
amg_s_diag_solver.o amg_s_ilu_solver.o amg_s_jac_solver.o: amg_s_base_solver_mod.o amg_s_prec_type.o
|
||||
amg_s_ilu_fact_mod.o: amg_base_prec_type.o amg_s_base_solver_mod.o
|
||||
amg_s_ilu_solver.o amg_s_iluk_fact.o: amg_s_ilu_fact_mod.o
|
||||
amg_s_as_smoother.o amg_s_jac_smoother.o: amg_s_base_smoother_mod.o
|
||||
@@ -176,7 +176,7 @@ amg_sprecinit.o amg_sprecset.o: amg_s_diag_solver.o amg_s_ilu_solver.o \
|
||||
amg_s_id_solver.o amg_s_slu_solver.o
|
||||
|
||||
amg_z_mumps_solver.o amg_z_gs_solver.o amg_z_id_solver.o amg_z_sludist_solver.o amg_z_slu_solver.o \
|
||||
amg_z_umf_solver.o amg_z_diag_solver.o amg_z_ilu_solver.o: amg_z_base_solver_mod.o amg_z_prec_type.o
|
||||
amg_z_umf_solver.o amg_z_diag_solver.o amg_z_ilu_solver.o amg_z_jac_solver.o: amg_z_base_solver_mod.o amg_z_prec_type.o
|
||||
amg_z_ilu_fact_mod.o: amg_base_prec_type.o amg_z_base_solver_mod.o
|
||||
amg_z_ilu_solver.o amg_z_iluk_fact.o: amg_z_ilu_fact_mod.o
|
||||
amg_z_as_smoother.o amg_z_jac_smoother.o: amg_z_base_smoother_mod.o
|
||||
@@ -186,7 +186,7 @@ amg_zprecinit.o amg_zprecset.o: amg_z_diag_solver.o amg_z_ilu_solver.o \
|
||||
amg_z_id_solver.o amg_z_slu_solver.o amg_z_sludist_solver.o
|
||||
|
||||
amg_c_mumps_solver.o amg_c_gs_solver.o amg_c_id_solver.o amg_c_sludist_solver.o amg_c_slu_solver.o \
|
||||
amg_c_diag_solver.o amg_c_ilu_solver.o: amg_c_base_solver_mod.o amg_c_prec_type.o
|
||||
amg_c_diag_solver.o amg_c_ilu_solver.o amg_c_jac_solver.o: amg_c_base_solver_mod.o amg_c_prec_type.o
|
||||
amg_c_ilu_fact_mod.o: amg_base_prec_type.o amg_c_base_solver_mod.o
|
||||
amg_c_ilu_solver.o amg_c_iluk_fact.o: amg_c_ilu_fact_mod.o
|
||||
amg_c_as_smoother.o amg_c_jac_smoother.o: amg_c_base_smoother_mod.o
|
||||
|
||||
@@ -0,0 +1,585 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! 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 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_c_jac_solver_mod.f90
|
||||
!
|
||||
! Module: amg_c_jac_solver_mod
|
||||
!
|
||||
! This module defines:
|
||||
! - the amg_c_jac_solver_type data structure containing the ingredients
|
||||
! for a local Jacobi iteration. The iterations are local to a process
|
||||
! (they operate on the block diagonal).
|
||||
!
|
||||
!
|
||||
module amg_c_jac_solver
|
||||
|
||||
use amg_c_base_solver_mod
|
||||
|
||||
type, extends(amg_c_base_solver_type) :: amg_c_jac_solver_type
|
||||
type(psb_cspmat_type) :: a
|
||||
type(psb_c_vect_type), allocatable :: dv
|
||||
complex(psb_spk_), allocatable :: d(:)
|
||||
integer(psb_ipk_) :: sweeps
|
||||
real(psb_spk_) :: eps
|
||||
contains
|
||||
procedure, pass(sv) :: dump => amg_c_jac_solver_dmp
|
||||
procedure, pass(sv) :: check => c_jac_solver_check
|
||||
procedure, pass(sv) :: clone => amg_c_jac_solver_clone
|
||||
procedure, pass(sv) :: clone_settings => amg_c_jac_solver_clone_settings
|
||||
procedure, pass(sv) :: clear_data => amg_c_jac_solver_clear_data
|
||||
procedure, pass(sv) :: build => amg_c_jac_solver_bld
|
||||
procedure, pass(sv) :: cnv => amg_c_jac_solver_cnv
|
||||
procedure, pass(sv) :: apply_v => amg_c_jac_solver_apply_vect
|
||||
procedure, pass(sv) :: apply_a => amg_c_jac_solver_apply
|
||||
procedure, pass(sv) :: free => c_jac_solver_free
|
||||
procedure, pass(sv) :: cseti => c_jac_solver_cseti
|
||||
procedure, pass(sv) :: csetc => c_jac_solver_csetc
|
||||
procedure, pass(sv) :: csetr => c_jac_solver_csetr
|
||||
procedure, pass(sv) :: descr => c_jac_solver_descr
|
||||
procedure, pass(sv) :: default => c_jac_solver_default
|
||||
procedure, pass(sv) :: sizeof => c_jac_solver_sizeof
|
||||
procedure, pass(sv) :: get_nzeros => c_jac_solver_get_nzeros
|
||||
procedure, nopass :: get_wrksz => c_jac_solver_get_wrksize
|
||||
procedure, nopass :: get_fmt => c_jac_solver_get_fmt
|
||||
procedure, nopass :: get_id => c_jac_solver_get_id
|
||||
procedure, nopass :: is_iterative => c_jac_solver_is_iterative
|
||||
end type amg_c_jac_solver_type
|
||||
|
||||
type, extends(amg_c_jac_solver_type) :: amg_c_l1_jac_solver_type
|
||||
contains
|
||||
procedure, pass(sv) :: build => amg_c_l1_jac_solver_bld
|
||||
procedure, pass(sv) :: descr => c_l1_jac_solver_descr
|
||||
procedure, nopass :: get_fmt => c_l1_jac_solver_get_fmt
|
||||
procedure, nopass :: get_id => c_l1_jac_solver_get_id
|
||||
end type amg_c_l1_jac_solver_type
|
||||
|
||||
|
||||
private :: c_jac_solver_bld, c_jac_solver_apply, &
|
||||
& c_jac_solver_free, &
|
||||
& c_jac_solver_descr, c_jac_solver_sizeof, &
|
||||
& c_jac_solver_default, c_jac_solver_dmp, &
|
||||
& c_jac_solver_apply_vect, c_jac_solver_get_nzeros, &
|
||||
& c_jac_solver_get_fmt, c_jac_solver_check,&
|
||||
& c_jac_solver_is_iterative, &
|
||||
& c_jac_solver_get_id, c_jac_solver_get_wrksize
|
||||
|
||||
interface
|
||||
subroutine amg_c_jac_solver_apply_vect(alpha,sv,x,beta,y,desc_data,&
|
||||
& trans,work,wv,info,init,initu)
|
||||
import :: psb_desc_type, amg_c_jac_solver_type, psb_c_vect_type, psb_spk_, &
|
||||
& 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
|
||||
class(amg_c_jac_solver_type), intent(inout) :: sv
|
||||
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(:)
|
||||
type(psb_c_vect_type),intent(inout) :: wv(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
character, intent(in), optional :: init
|
||||
type(psb_c_vect_type),intent(inout), optional :: initu
|
||||
end subroutine amg_c_jac_solver_apply_vect
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_c_jac_solver_apply(alpha,sv,x,beta,y,desc_data,trans,work,info,init,initu)
|
||||
import :: psb_desc_type, amg_c_jac_solver_type, psb_c_vect_type, psb_spk_, &
|
||||
& 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
|
||||
class(amg_c_jac_solver_type), intent(inout) :: sv
|
||||
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
|
||||
character, intent(in), optional :: init
|
||||
complex(psb_spk_),intent(inout), optional :: initu(:)
|
||||
end subroutine amg_c_jac_solver_apply
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_c_jac_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
import :: psb_desc_type, amg_c_jac_solver_type, psb_c_vect_type, psb_spk_, &
|
||||
& 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
|
||||
Type(psb_desc_type), Intent(inout) :: desc_a
|
||||
class(amg_c_jac_solver_type), intent(inout) :: sv
|
||||
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
|
||||
end subroutine amg_c_jac_solver_bld
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_c_l1_jac_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
import :: psb_desc_type, amg_c_l1_jac_solver_type, psb_c_vect_type, psb_spk_, &
|
||||
& 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
|
||||
Type(psb_desc_type), Intent(inout) :: desc_a
|
||||
class(amg_c_l1_jac_solver_type), intent(inout) :: sv
|
||||
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
|
||||
end subroutine amg_c_l1_jac_solver_bld
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_c_jac_solver_cnv(sv,info,amold,vmold,imold)
|
||||
import :: amg_c_jac_solver_type, psb_spk_, &
|
||||
& psb_c_base_sparse_mat, psb_c_base_vect_type,&
|
||||
& psb_ipk_, psb_i_base_vect_type
|
||||
implicit none
|
||||
class(amg_c_jac_solver_type), intent(inout) :: sv
|
||||
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
|
||||
end subroutine amg_c_jac_solver_cnv
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_c_jac_solver_dmp(sv,desc,level,info,prefix,head,solver,global_num)
|
||||
import :: psb_desc_type, amg_c_jac_solver_type, psb_c_vect_type, psb_spk_, &
|
||||
& psb_cspmat_type, psb_c_base_sparse_mat, psb_c_base_vect_type, &
|
||||
& psb_ipk_
|
||||
implicit none
|
||||
class(amg_c_jac_solver_type), intent(in) :: sv
|
||||
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) :: solver, global_num
|
||||
end subroutine amg_c_jac_solver_dmp
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_c_jac_solver_clone(sv,svout,info)
|
||||
import :: psb_desc_type, psb_cspmat_type, psb_c_base_sparse_mat, &
|
||||
& psb_c_vect_type, psb_c_base_vect_type, psb_spk_, &
|
||||
& amg_c_base_solver_type, amg_c_jac_solver_type, psb_ipk_
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_jac_solver_type), intent(inout) :: sv
|
||||
class(amg_c_base_solver_type), allocatable, intent(inout) :: svout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_c_jac_solver_clone
|
||||
end interface
|
||||
|
||||
!!$ interface
|
||||
!!$ subroutine amg_c_l1_jac_solver_clone(sv,svout,info)
|
||||
!!$ import :: psb_desc_type, psb_cspmat_type, psb_c_base_sparse_mat, &
|
||||
!!$ & psb_c_vect_type, psb_c_base_vect_type, psb_spk_, &
|
||||
!!$ & amg_c_base_solver_type, amg_c_l1_jac_solver_type, psb_ipk_
|
||||
!!$ Implicit None
|
||||
!!$
|
||||
!!$ ! Arguments
|
||||
!!$ class(amg_c_l1_jac_solver_type), intent(inout) :: sv
|
||||
!!$ class(amg_c_base_solver_type), allocatable, intent(inout) :: svout
|
||||
!!$ integer(psb_ipk_), intent(out) :: info
|
||||
!!$ end subroutine amg_c_l1_jac_solver_clone
|
||||
!!$ end interface
|
||||
|
||||
interface
|
||||
subroutine amg_c_jac_solver_clone_settings(sv,svout,info)
|
||||
import :: psb_desc_type, psb_cspmat_type, psb_c_base_sparse_mat, &
|
||||
& psb_c_vect_type, psb_c_base_vect_type, psb_spk_, &
|
||||
& amg_c_base_solver_type, amg_c_jac_solver_type, psb_ipk_
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_jac_solver_type), intent(inout) :: sv
|
||||
class(amg_c_base_solver_type), intent(inout) :: svout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_c_jac_solver_clone_settings
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_c_jac_solver_clear_data(sv,info)
|
||||
import :: psb_desc_type, psb_cspmat_type, psb_c_base_sparse_mat, &
|
||||
& psb_c_vect_type, psb_c_base_vect_type, psb_spk_, &
|
||||
& amg_c_jac_solver_type, psb_ipk_
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_jac_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_c_jac_solver_clear_data
|
||||
end interface
|
||||
|
||||
contains
|
||||
|
||||
subroutine c_jac_solver_default(sv)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_jac_solver_type), intent(inout) :: sv
|
||||
|
||||
sv%sweeps = ione
|
||||
sv%eps = dzero
|
||||
|
||||
return
|
||||
end subroutine c_jac_solver_default
|
||||
|
||||
subroutine c_jac_solver_check(sv,info)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_jac_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='c_jac_solver_check'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
|
||||
call amg_check_def(sv%sweeps,&
|
||||
& 'Jacobi 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
|
||||
|
||||
end subroutine c_jac_solver_check
|
||||
|
||||
subroutine c_jac_solver_cseti(sv,what,val,info,idx)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_jac_solver_type), intent(inout) :: sv
|
||||
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
|
||||
character(len=20) :: name='c_jac_solver_cseti'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select case(psb_toupper(what))
|
||||
case('SOLVER_SWEEPS')
|
||||
sv%sweeps = val
|
||||
case default
|
||||
call sv%amg_c_base_solver_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 c_jac_solver_cseti
|
||||
|
||||
subroutine c_jac_solver_csetc(sv,what,val,info,idx)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_jac_solver_type), intent(inout) :: sv
|
||||
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, ival
|
||||
character(len=20) :: name='c_jac_solver_csetc'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
|
||||
call sv%amg_c_base_solver_type%set(what,val,info,idx=idx)
|
||||
|
||||
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 c_jac_solver_csetc
|
||||
|
||||
subroutine c_jac_solver_csetr(sv,what,val,info,idx)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_jac_solver_type), intent(inout) :: sv
|
||||
character(len=*), intent(in) :: what
|
||||
real(psb_spk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(in), optional :: idx
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='c_jac_solver_csetr'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
|
||||
select case(psb_toupper(what))
|
||||
case('SOLVER_EPS')
|
||||
sv%eps = val
|
||||
case default
|
||||
call sv%amg_c_base_solver_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 c_jac_solver_csetr
|
||||
|
||||
subroutine c_jac_solver_free(sv,info)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_jac_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='c_jac_solver_free'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
|
||||
call sv%a%free()
|
||||
if (allocated(sv%dv)) then
|
||||
call sv%dv%free(info)
|
||||
deallocate(sv%dv)
|
||||
end if
|
||||
if (allocated(sv%d)) deallocate(sv%d)
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine c_jac_solver_free
|
||||
|
||||
subroutine c_jac_solver_descr(sv,info,iout,coarse,prefix)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_jac_solver_type), intent(in) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(in), optional :: iout
|
||||
logical, intent(in), optional :: coarse
|
||||
character(len=*), intent(in), optional :: prefix
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20), parameter :: name='amg_c_jac_solver_descr'
|
||||
integer(psb_ipk_) :: iout_
|
||||
character(1024) :: prefix_
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
if (present(iout)) then
|
||||
iout_ = iout
|
||||
else
|
||||
iout_ = psb_out_unit
|
||||
endif
|
||||
if (present(prefix)) then
|
||||
prefix_ = prefix
|
||||
else
|
||||
prefix_ = ""
|
||||
end if
|
||||
|
||||
if (sv%eps<=dzero) then
|
||||
write(iout_,*) trim(prefix_), ' Jacobi iterative solver with ',&
|
||||
& sv%sweeps,' sweeps'
|
||||
else
|
||||
write(iout_,*) trim(prefix_), ' Jacobi 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_jac_solver_descr
|
||||
|
||||
function c_jac_solver_get_nzeros(sv) result(val)
|
||||
|
||||
implicit none
|
||||
! Arguments
|
||||
class(amg_c_jac_solver_type), intent(in) :: sv
|
||||
integer(psb_epk_) :: val
|
||||
integer(psb_ipk_) :: i
|
||||
|
||||
val = 0
|
||||
val = val + sv%a%get_nzeros()
|
||||
val = val + sv%dv%get_nrows()
|
||||
|
||||
return
|
||||
end function c_jac_solver_get_nzeros
|
||||
|
||||
function c_jac_solver_sizeof(sv) result(val)
|
||||
|
||||
implicit none
|
||||
! Arguments
|
||||
class(amg_c_jac_solver_type), intent(in) :: sv
|
||||
integer(psb_epk_) :: val
|
||||
integer(psb_ipk_) :: i
|
||||
|
||||
val = psb_sizeof_ip
|
||||
val = val + sv%a%sizeof()
|
||||
val = val + sv%dv%sizeof()
|
||||
|
||||
return
|
||||
end function c_jac_solver_sizeof
|
||||
|
||||
function c_jac_solver_get_fmt() result(val)
|
||||
implicit none
|
||||
character(len=32) :: val
|
||||
|
||||
val = "Jacobi solver"
|
||||
end function c_jac_solver_get_fmt
|
||||
|
||||
function c_jac_solver_get_id() result(val)
|
||||
implicit none
|
||||
integer(psb_ipk_) :: val
|
||||
|
||||
val = amg_jac_
|
||||
end function c_jac_solver_get_id
|
||||
|
||||
!
|
||||
! If this is true, then the solver needs a starting
|
||||
! guess. Currently only handled in JAC smoother.
|
||||
!
|
||||
function c_jac_solver_is_iterative() result(val)
|
||||
implicit none
|
||||
logical :: val
|
||||
|
||||
val = .true.
|
||||
end function c_jac_solver_is_iterative
|
||||
|
||||
function c_jac_solver_get_wrksize() result(val)
|
||||
implicit none
|
||||
integer(psb_ipk_) :: val
|
||||
|
||||
val = 2
|
||||
end function c_jac_solver_get_wrksize
|
||||
|
||||
subroutine c_l1_jac_solver_descr(sv,info,iout,coarse,prefix)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_l1_jac_solver_type), intent(in) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(in), optional :: iout
|
||||
logical, intent(in), optional :: coarse
|
||||
character(len=*), intent(in), optional :: prefix
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20), parameter :: name='amg_c_l1_jac_solver_descr'
|
||||
integer(psb_ipk_) :: iout_
|
||||
character(1024) :: prefix_
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
if (present(iout)) then
|
||||
iout_ = iout
|
||||
else
|
||||
iout_ = psb_out_unit
|
||||
endif
|
||||
if (present(prefix)) then
|
||||
prefix_ = prefix
|
||||
else
|
||||
prefix_ = ""
|
||||
end if
|
||||
|
||||
if (sv%eps<=dzero) then
|
||||
write(iout_,*) trim(prefix_), ' L1-Jacobi iterative solver with ',&
|
||||
& sv%sweeps,' sweeps'
|
||||
else
|
||||
write(iout_,*) trim(prefix_), ' L1-Jacobi 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_l1_jac_solver_descr
|
||||
|
||||
function c_l1_jac_solver_get_fmt() result(val)
|
||||
implicit none
|
||||
character(len=32) :: val
|
||||
|
||||
val = "L1-Jacobi solver"
|
||||
end function c_l1_jac_solver_get_fmt
|
||||
|
||||
function c_l1_jac_solver_get_id() result(val)
|
||||
implicit none
|
||||
integer(psb_ipk_) :: val
|
||||
|
||||
val = amg_l1_jac_
|
||||
end function c_l1_jac_solver_get_id
|
||||
|
||||
end module amg_c_jac_solver
|
||||
@@ -78,7 +78,8 @@ module amg_c_mumps_solver
|
||||
!
|
||||
! Controls to be set before MUMPS instantiation:
|
||||
!
|
||||
! IPAR(1) : MUMPS_LOC_GLOB 0==amg_local_solver_: LOCAL 1==amg_global_solver_: GLOBAL
|
||||
! IPAR(1) : MUMPS_LOC_GLOB 0==amg_local_solver_: 'LOCAL_SOLVER
|
||||
! 1==amg_global_solver_: 'GLOBAL_SOLVER'
|
||||
! IPAR(2) : MUMPS_PRINT_ERR print verbosity (see MUMPS)
|
||||
! IPAR(3) : MUMPS_SYM 0: non-symmetric 2: symmetric
|
||||
integer(psb_ipk_), dimension(3) :: ipar
|
||||
|
||||
@@ -0,0 +1,585 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! 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 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_jac_solver_mod.f90
|
||||
!
|
||||
! Module: amg_d_jac_solver_mod
|
||||
!
|
||||
! This module defines:
|
||||
! - the amg_d_jac_solver_type data structure containing the ingredients
|
||||
! for a local Jacobi iteration. The iterations are local to a process
|
||||
! (they operate on the block diagonal).
|
||||
!
|
||||
!
|
||||
module amg_d_jac_solver
|
||||
|
||||
use amg_d_base_solver_mod
|
||||
|
||||
type, extends(amg_d_base_solver_type) :: amg_d_jac_solver_type
|
||||
type(psb_dspmat_type) :: a
|
||||
type(psb_d_vect_type), allocatable :: dv
|
||||
real(psb_dpk_), allocatable :: d(:)
|
||||
integer(psb_ipk_) :: sweeps
|
||||
real(psb_dpk_) :: eps
|
||||
contains
|
||||
procedure, pass(sv) :: dump => amg_d_jac_solver_dmp
|
||||
procedure, pass(sv) :: check => d_jac_solver_check
|
||||
procedure, pass(sv) :: clone => amg_d_jac_solver_clone
|
||||
procedure, pass(sv) :: clone_settings => amg_d_jac_solver_clone_settings
|
||||
procedure, pass(sv) :: clear_data => amg_d_jac_solver_clear_data
|
||||
procedure, pass(sv) :: build => amg_d_jac_solver_bld
|
||||
procedure, pass(sv) :: cnv => amg_d_jac_solver_cnv
|
||||
procedure, pass(sv) :: apply_v => amg_d_jac_solver_apply_vect
|
||||
procedure, pass(sv) :: apply_a => amg_d_jac_solver_apply
|
||||
procedure, pass(sv) :: free => d_jac_solver_free
|
||||
procedure, pass(sv) :: cseti => d_jac_solver_cseti
|
||||
procedure, pass(sv) :: csetc => d_jac_solver_csetc
|
||||
procedure, pass(sv) :: csetr => d_jac_solver_csetr
|
||||
procedure, pass(sv) :: descr => d_jac_solver_descr
|
||||
procedure, pass(sv) :: default => d_jac_solver_default
|
||||
procedure, pass(sv) :: sizeof => d_jac_solver_sizeof
|
||||
procedure, pass(sv) :: get_nzeros => d_jac_solver_get_nzeros
|
||||
procedure, nopass :: get_wrksz => d_jac_solver_get_wrksize
|
||||
procedure, nopass :: get_fmt => d_jac_solver_get_fmt
|
||||
procedure, nopass :: get_id => d_jac_solver_get_id
|
||||
procedure, nopass :: is_iterative => d_jac_solver_is_iterative
|
||||
end type amg_d_jac_solver_type
|
||||
|
||||
type, extends(amg_d_jac_solver_type) :: amg_d_l1_jac_solver_type
|
||||
contains
|
||||
procedure, pass(sv) :: build => amg_d_l1_jac_solver_bld
|
||||
procedure, pass(sv) :: descr => d_l1_jac_solver_descr
|
||||
procedure, nopass :: get_fmt => d_l1_jac_solver_get_fmt
|
||||
procedure, nopass :: get_id => d_l1_jac_solver_get_id
|
||||
end type amg_d_l1_jac_solver_type
|
||||
|
||||
|
||||
private :: d_jac_solver_bld, d_jac_solver_apply, &
|
||||
& d_jac_solver_free, &
|
||||
& d_jac_solver_descr, d_jac_solver_sizeof, &
|
||||
& d_jac_solver_default, d_jac_solver_dmp, &
|
||||
& d_jac_solver_apply_vect, d_jac_solver_get_nzeros, &
|
||||
& d_jac_solver_get_fmt, d_jac_solver_check,&
|
||||
& d_jac_solver_is_iterative, &
|
||||
& d_jac_solver_get_id, d_jac_solver_get_wrksize
|
||||
|
||||
interface
|
||||
subroutine amg_d_jac_solver_apply_vect(alpha,sv,x,beta,y,desc_data,&
|
||||
& trans,work,wv,info,init,initu)
|
||||
import :: psb_desc_type, amg_d_jac_solver_type, psb_d_vect_type, psb_dpk_, &
|
||||
& psb_dspmat_type, psb_d_base_sparse_mat, psb_d_base_vect_type, psb_ipk_
|
||||
implicit none
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(amg_d_jac_solver_type), intent(inout) :: sv
|
||||
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
|
||||
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_jac_solver_apply_vect
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_jac_solver_apply(alpha,sv,x,beta,y,desc_data,trans,work,info,init,initu)
|
||||
import :: psb_desc_type, amg_d_jac_solver_type, psb_d_vect_type, psb_dpk_, &
|
||||
& psb_dspmat_type, psb_d_base_sparse_mat, psb_d_base_vect_type, psb_ipk_
|
||||
implicit none
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(amg_d_jac_solver_type), intent(inout) :: sv
|
||||
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
|
||||
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_jac_solver_apply
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_jac_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
import :: psb_desc_type, amg_d_jac_solver_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
|
||||
implicit none
|
||||
type(psb_dspmat_type), intent(in), target :: a
|
||||
Type(psb_desc_type), Intent(inout) :: desc_a
|
||||
class(amg_d_jac_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
type(psb_dspmat_type), intent(in), target, optional :: b
|
||||
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_jac_solver_bld
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_l1_jac_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
import :: psb_desc_type, amg_d_l1_jac_solver_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
|
||||
implicit none
|
||||
type(psb_dspmat_type), intent(in), target :: a
|
||||
Type(psb_desc_type), Intent(inout) :: desc_a
|
||||
class(amg_d_l1_jac_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
type(psb_dspmat_type), intent(in), target, optional :: b
|
||||
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_l1_jac_solver_bld
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_jac_solver_cnv(sv,info,amold,vmold,imold)
|
||||
import :: amg_d_jac_solver_type, psb_dpk_, &
|
||||
& psb_d_base_sparse_mat, psb_d_base_vect_type,&
|
||||
& psb_ipk_, psb_i_base_vect_type
|
||||
implicit none
|
||||
class(amg_d_jac_solver_type), intent(inout) :: sv
|
||||
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_jac_solver_cnv
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_jac_solver_dmp(sv,desc,level,info,prefix,head,solver,global_num)
|
||||
import :: psb_desc_type, amg_d_jac_solver_type, psb_d_vect_type, psb_dpk_, &
|
||||
& psb_dspmat_type, psb_d_base_sparse_mat, psb_d_base_vect_type, &
|
||||
& psb_ipk_
|
||||
implicit none
|
||||
class(amg_d_jac_solver_type), intent(in) :: sv
|
||||
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) :: solver, global_num
|
||||
end subroutine amg_d_jac_solver_dmp
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_jac_solver_clone(sv,svout,info)
|
||||
import :: psb_desc_type, psb_dspmat_type, psb_d_base_sparse_mat, &
|
||||
& psb_d_vect_type, psb_d_base_vect_type, psb_dpk_, &
|
||||
& amg_d_base_solver_type, amg_d_jac_solver_type, psb_ipk_
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_jac_solver_type), intent(inout) :: sv
|
||||
class(amg_d_base_solver_type), allocatable, intent(inout) :: svout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_d_jac_solver_clone
|
||||
end interface
|
||||
|
||||
!!$ interface
|
||||
!!$ subroutine amg_d_l1_jac_solver_clone(sv,svout,info)
|
||||
!!$ import :: psb_desc_type, psb_dspmat_type, psb_d_base_sparse_mat, &
|
||||
!!$ & psb_d_vect_type, psb_d_base_vect_type, psb_dpk_, &
|
||||
!!$ & amg_d_base_solver_type, amg_d_l1_jac_solver_type, psb_ipk_
|
||||
!!$ Implicit None
|
||||
!!$
|
||||
!!$ ! Arguments
|
||||
!!$ class(amg_d_l1_jac_solver_type), intent(inout) :: sv
|
||||
!!$ class(amg_d_base_solver_type), allocatable, intent(inout) :: svout
|
||||
!!$ integer(psb_ipk_), intent(out) :: info
|
||||
!!$ end subroutine amg_d_l1_jac_solver_clone
|
||||
!!$ end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_jac_solver_clone_settings(sv,svout,info)
|
||||
import :: psb_desc_type, psb_dspmat_type, psb_d_base_sparse_mat, &
|
||||
& psb_d_vect_type, psb_d_base_vect_type, psb_dpk_, &
|
||||
& amg_d_base_solver_type, amg_d_jac_solver_type, psb_ipk_
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_jac_solver_type), intent(inout) :: sv
|
||||
class(amg_d_base_solver_type), intent(inout) :: svout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_d_jac_solver_clone_settings
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_jac_solver_clear_data(sv,info)
|
||||
import :: psb_desc_type, psb_dspmat_type, psb_d_base_sparse_mat, &
|
||||
& psb_d_vect_type, psb_d_base_vect_type, psb_dpk_, &
|
||||
& amg_d_jac_solver_type, psb_ipk_
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_jac_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_d_jac_solver_clear_data
|
||||
end interface
|
||||
|
||||
contains
|
||||
|
||||
subroutine d_jac_solver_default(sv)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_jac_solver_type), intent(inout) :: sv
|
||||
|
||||
sv%sweeps = ione
|
||||
sv%eps = dzero
|
||||
|
||||
return
|
||||
end subroutine d_jac_solver_default
|
||||
|
||||
subroutine d_jac_solver_check(sv,info)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_jac_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='d_jac_solver_check'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
|
||||
call amg_check_def(sv%sweeps,&
|
||||
& 'Jacobi 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
|
||||
|
||||
end subroutine d_jac_solver_check
|
||||
|
||||
subroutine d_jac_solver_cseti(sv,what,val,info,idx)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_jac_solver_type), intent(inout) :: sv
|
||||
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
|
||||
character(len=20) :: name='d_jac_solver_cseti'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select case(psb_toupper(what))
|
||||
case('SOLVER_SWEEPS')
|
||||
sv%sweeps = val
|
||||
case default
|
||||
call sv%amg_d_base_solver_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 d_jac_solver_cseti
|
||||
|
||||
subroutine d_jac_solver_csetc(sv,what,val,info,idx)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_jac_solver_type), intent(inout) :: sv
|
||||
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, ival
|
||||
character(len=20) :: name='d_jac_solver_csetc'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
|
||||
call sv%amg_d_base_solver_type%set(what,val,info,idx=idx)
|
||||
|
||||
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 d_jac_solver_csetc
|
||||
|
||||
subroutine d_jac_solver_csetr(sv,what,val,info,idx)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_jac_solver_type), intent(inout) :: sv
|
||||
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
|
||||
character(len=20) :: name='d_jac_solver_csetr'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
|
||||
select case(psb_toupper(what))
|
||||
case('SOLVER_EPS')
|
||||
sv%eps = val
|
||||
case default
|
||||
call sv%amg_d_base_solver_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 d_jac_solver_csetr
|
||||
|
||||
subroutine d_jac_solver_free(sv,info)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_jac_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='d_jac_solver_free'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
|
||||
call sv%a%free()
|
||||
if (allocated(sv%dv)) then
|
||||
call sv%dv%free(info)
|
||||
deallocate(sv%dv)
|
||||
end if
|
||||
if (allocated(sv%d)) deallocate(sv%d)
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine d_jac_solver_free
|
||||
|
||||
subroutine d_jac_solver_descr(sv,info,iout,coarse,prefix)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_jac_solver_type), intent(in) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(in), optional :: iout
|
||||
logical, intent(in), optional :: coarse
|
||||
character(len=*), intent(in), optional :: prefix
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20), parameter :: name='amg_d_jac_solver_descr'
|
||||
integer(psb_ipk_) :: iout_
|
||||
character(1024) :: prefix_
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
if (present(iout)) then
|
||||
iout_ = iout
|
||||
else
|
||||
iout_ = psb_out_unit
|
||||
endif
|
||||
if (present(prefix)) then
|
||||
prefix_ = prefix
|
||||
else
|
||||
prefix_ = ""
|
||||
end if
|
||||
|
||||
if (sv%eps<=dzero) then
|
||||
write(iout_,*) trim(prefix_), ' Jacobi iterative solver with ',&
|
||||
& sv%sweeps,' sweeps'
|
||||
else
|
||||
write(iout_,*) trim(prefix_), ' Jacobi 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 d_jac_solver_descr
|
||||
|
||||
function d_jac_solver_get_nzeros(sv) result(val)
|
||||
|
||||
implicit none
|
||||
! Arguments
|
||||
class(amg_d_jac_solver_type), intent(in) :: sv
|
||||
integer(psb_epk_) :: val
|
||||
integer(psb_ipk_) :: i
|
||||
|
||||
val = 0
|
||||
val = val + sv%a%get_nzeros()
|
||||
val = val + sv%dv%get_nrows()
|
||||
|
||||
return
|
||||
end function d_jac_solver_get_nzeros
|
||||
|
||||
function d_jac_solver_sizeof(sv) result(val)
|
||||
|
||||
implicit none
|
||||
! Arguments
|
||||
class(amg_d_jac_solver_type), intent(in) :: sv
|
||||
integer(psb_epk_) :: val
|
||||
integer(psb_ipk_) :: i
|
||||
|
||||
val = psb_sizeof_ip
|
||||
val = val + sv%a%sizeof()
|
||||
val = val + sv%dv%sizeof()
|
||||
|
||||
return
|
||||
end function d_jac_solver_sizeof
|
||||
|
||||
function d_jac_solver_get_fmt() result(val)
|
||||
implicit none
|
||||
character(len=32) :: val
|
||||
|
||||
val = "Jacobi solver"
|
||||
end function d_jac_solver_get_fmt
|
||||
|
||||
function d_jac_solver_get_id() result(val)
|
||||
implicit none
|
||||
integer(psb_ipk_) :: val
|
||||
|
||||
val = amg_jac_
|
||||
end function d_jac_solver_get_id
|
||||
|
||||
!
|
||||
! If this is true, then the solver needs a starting
|
||||
! guess. Currently only handled in JAC smoother.
|
||||
!
|
||||
function d_jac_solver_is_iterative() result(val)
|
||||
implicit none
|
||||
logical :: val
|
||||
|
||||
val = .true.
|
||||
end function d_jac_solver_is_iterative
|
||||
|
||||
function d_jac_solver_get_wrksize() result(val)
|
||||
implicit none
|
||||
integer(psb_ipk_) :: val
|
||||
|
||||
val = 2
|
||||
end function d_jac_solver_get_wrksize
|
||||
|
||||
subroutine d_l1_jac_solver_descr(sv,info,iout,coarse,prefix)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_l1_jac_solver_type), intent(in) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(in), optional :: iout
|
||||
logical, intent(in), optional :: coarse
|
||||
character(len=*), intent(in), optional :: prefix
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20), parameter :: name='amg_d_l1_jac_solver_descr'
|
||||
integer(psb_ipk_) :: iout_
|
||||
character(1024) :: prefix_
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
if (present(iout)) then
|
||||
iout_ = iout
|
||||
else
|
||||
iout_ = psb_out_unit
|
||||
endif
|
||||
if (present(prefix)) then
|
||||
prefix_ = prefix
|
||||
else
|
||||
prefix_ = ""
|
||||
end if
|
||||
|
||||
if (sv%eps<=dzero) then
|
||||
write(iout_,*) trim(prefix_), ' L1-Jacobi iterative solver with ',&
|
||||
& sv%sweeps,' sweeps'
|
||||
else
|
||||
write(iout_,*) trim(prefix_), ' L1-Jacobi 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 d_l1_jac_solver_descr
|
||||
|
||||
function d_l1_jac_solver_get_fmt() result(val)
|
||||
implicit none
|
||||
character(len=32) :: val
|
||||
|
||||
val = "L1-Jacobi solver"
|
||||
end function d_l1_jac_solver_get_fmt
|
||||
|
||||
function d_l1_jac_solver_get_id() result(val)
|
||||
implicit none
|
||||
integer(psb_ipk_) :: val
|
||||
|
||||
val = amg_l1_jac_
|
||||
end function d_l1_jac_solver_get_id
|
||||
|
||||
end module amg_d_jac_solver
|
||||
@@ -78,7 +78,8 @@ module amg_d_mumps_solver
|
||||
!
|
||||
! Controls to be set before MUMPS instantiation:
|
||||
!
|
||||
! IPAR(1) : MUMPS_LOC_GLOB 0==amg_local_solver_: LOCAL 1==amg_global_solver_: GLOBAL
|
||||
! IPAR(1) : MUMPS_LOC_GLOB 0==amg_local_solver_: 'LOCAL_SOLVER
|
||||
! 1==amg_global_solver_: 'GLOBAL_SOLVER'
|
||||
! IPAR(2) : MUMPS_PRINT_ERR print verbosity (see MUMPS)
|
||||
! IPAR(3) : MUMPS_SYM 0: non-symmetric 2: symmetric
|
||||
integer(psb_ipk_), dimension(3) :: ipar
|
||||
|
||||
@@ -0,0 +1,585 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! 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 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_s_jac_solver_mod.f90
|
||||
!
|
||||
! Module: amg_s_jac_solver_mod
|
||||
!
|
||||
! This module defines:
|
||||
! - the amg_s_jac_solver_type data structure containing the ingredients
|
||||
! for a local Jacobi iteration. The iterations are local to a process
|
||||
! (they operate on the block diagonal).
|
||||
!
|
||||
!
|
||||
module amg_s_jac_solver
|
||||
|
||||
use amg_s_base_solver_mod
|
||||
|
||||
type, extends(amg_s_base_solver_type) :: amg_s_jac_solver_type
|
||||
type(psb_sspmat_type) :: a
|
||||
type(psb_s_vect_type), allocatable :: dv
|
||||
real(psb_spk_), allocatable :: d(:)
|
||||
integer(psb_ipk_) :: sweeps
|
||||
real(psb_spk_) :: eps
|
||||
contains
|
||||
procedure, pass(sv) :: dump => amg_s_jac_solver_dmp
|
||||
procedure, pass(sv) :: check => s_jac_solver_check
|
||||
procedure, pass(sv) :: clone => amg_s_jac_solver_clone
|
||||
procedure, pass(sv) :: clone_settings => amg_s_jac_solver_clone_settings
|
||||
procedure, pass(sv) :: clear_data => amg_s_jac_solver_clear_data
|
||||
procedure, pass(sv) :: build => amg_s_jac_solver_bld
|
||||
procedure, pass(sv) :: cnv => amg_s_jac_solver_cnv
|
||||
procedure, pass(sv) :: apply_v => amg_s_jac_solver_apply_vect
|
||||
procedure, pass(sv) :: apply_a => amg_s_jac_solver_apply
|
||||
procedure, pass(sv) :: free => s_jac_solver_free
|
||||
procedure, pass(sv) :: cseti => s_jac_solver_cseti
|
||||
procedure, pass(sv) :: csetc => s_jac_solver_csetc
|
||||
procedure, pass(sv) :: csetr => s_jac_solver_csetr
|
||||
procedure, pass(sv) :: descr => s_jac_solver_descr
|
||||
procedure, pass(sv) :: default => s_jac_solver_default
|
||||
procedure, pass(sv) :: sizeof => s_jac_solver_sizeof
|
||||
procedure, pass(sv) :: get_nzeros => s_jac_solver_get_nzeros
|
||||
procedure, nopass :: get_wrksz => s_jac_solver_get_wrksize
|
||||
procedure, nopass :: get_fmt => s_jac_solver_get_fmt
|
||||
procedure, nopass :: get_id => s_jac_solver_get_id
|
||||
procedure, nopass :: is_iterative => s_jac_solver_is_iterative
|
||||
end type amg_s_jac_solver_type
|
||||
|
||||
type, extends(amg_s_jac_solver_type) :: amg_s_l1_jac_solver_type
|
||||
contains
|
||||
procedure, pass(sv) :: build => amg_s_l1_jac_solver_bld
|
||||
procedure, pass(sv) :: descr => s_l1_jac_solver_descr
|
||||
procedure, nopass :: get_fmt => s_l1_jac_solver_get_fmt
|
||||
procedure, nopass :: get_id => s_l1_jac_solver_get_id
|
||||
end type amg_s_l1_jac_solver_type
|
||||
|
||||
|
||||
private :: s_jac_solver_bld, s_jac_solver_apply, &
|
||||
& s_jac_solver_free, &
|
||||
& s_jac_solver_descr, s_jac_solver_sizeof, &
|
||||
& s_jac_solver_default, s_jac_solver_dmp, &
|
||||
& s_jac_solver_apply_vect, s_jac_solver_get_nzeros, &
|
||||
& s_jac_solver_get_fmt, s_jac_solver_check,&
|
||||
& s_jac_solver_is_iterative, &
|
||||
& s_jac_solver_get_id, s_jac_solver_get_wrksize
|
||||
|
||||
interface
|
||||
subroutine amg_s_jac_solver_apply_vect(alpha,sv,x,beta,y,desc_data,&
|
||||
& trans,work,wv,info,init,initu)
|
||||
import :: psb_desc_type, amg_s_jac_solver_type, psb_s_vect_type, psb_spk_, &
|
||||
& psb_sspmat_type, psb_s_base_sparse_mat, psb_s_base_vect_type, psb_ipk_
|
||||
implicit none
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(amg_s_jac_solver_type), intent(inout) :: sv
|
||||
type(psb_s_vect_type),intent(inout) :: x
|
||||
type(psb_s_vect_type),intent(inout) :: y
|
||||
real(psb_spk_),intent(in) :: alpha,beta
|
||||
character(len=1),intent(in) :: trans
|
||||
real(psb_spk_),target, intent(inout) :: work(:)
|
||||
type(psb_s_vect_type),intent(inout) :: wv(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
character, intent(in), optional :: init
|
||||
type(psb_s_vect_type),intent(inout), optional :: initu
|
||||
end subroutine amg_s_jac_solver_apply_vect
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_s_jac_solver_apply(alpha,sv,x,beta,y,desc_data,trans,work,info,init,initu)
|
||||
import :: psb_desc_type, amg_s_jac_solver_type, psb_s_vect_type, psb_spk_, &
|
||||
& psb_sspmat_type, psb_s_base_sparse_mat, psb_s_base_vect_type, psb_ipk_
|
||||
implicit none
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(amg_s_jac_solver_type), intent(inout) :: sv
|
||||
real(psb_spk_),intent(inout) :: x(:)
|
||||
real(psb_spk_),intent(inout) :: y(:)
|
||||
real(psb_spk_),intent(in) :: alpha,beta
|
||||
character(len=1),intent(in) :: trans
|
||||
real(psb_spk_),target, intent(inout) :: work(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
character, intent(in), optional :: init
|
||||
real(psb_spk_),intent(inout), optional :: initu(:)
|
||||
end subroutine amg_s_jac_solver_apply
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_s_jac_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
import :: psb_desc_type, amg_s_jac_solver_type, psb_s_vect_type, psb_spk_, &
|
||||
& psb_sspmat_type, psb_s_base_sparse_mat, psb_s_base_vect_type,&
|
||||
& psb_ipk_, psb_i_base_vect_type
|
||||
implicit none
|
||||
type(psb_sspmat_type), intent(in), target :: a
|
||||
Type(psb_desc_type), Intent(inout) :: desc_a
|
||||
class(amg_s_jac_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
type(psb_sspmat_type), intent(in), target, optional :: b
|
||||
class(psb_s_base_sparse_mat), intent(in), optional :: amold
|
||||
class(psb_s_base_vect_type), intent(in), optional :: vmold
|
||||
class(psb_i_base_vect_type), intent(in), optional :: imold
|
||||
end subroutine amg_s_jac_solver_bld
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_s_l1_jac_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
import :: psb_desc_type, amg_s_l1_jac_solver_type, psb_s_vect_type, psb_spk_, &
|
||||
& psb_sspmat_type, psb_s_base_sparse_mat, psb_s_base_vect_type,&
|
||||
& psb_ipk_, psb_i_base_vect_type
|
||||
implicit none
|
||||
type(psb_sspmat_type), intent(in), target :: a
|
||||
Type(psb_desc_type), Intent(inout) :: desc_a
|
||||
class(amg_s_l1_jac_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
type(psb_sspmat_type), intent(in), target, optional :: b
|
||||
class(psb_s_base_sparse_mat), intent(in), optional :: amold
|
||||
class(psb_s_base_vect_type), intent(in), optional :: vmold
|
||||
class(psb_i_base_vect_type), intent(in), optional :: imold
|
||||
end subroutine amg_s_l1_jac_solver_bld
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_s_jac_solver_cnv(sv,info,amold,vmold,imold)
|
||||
import :: amg_s_jac_solver_type, psb_spk_, &
|
||||
& psb_s_base_sparse_mat, psb_s_base_vect_type,&
|
||||
& psb_ipk_, psb_i_base_vect_type
|
||||
implicit none
|
||||
class(amg_s_jac_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
class(psb_s_base_sparse_mat), intent(in), optional :: amold
|
||||
class(psb_s_base_vect_type), intent(in), optional :: vmold
|
||||
class(psb_i_base_vect_type), intent(in), optional :: imold
|
||||
end subroutine amg_s_jac_solver_cnv
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_s_jac_solver_dmp(sv,desc,level,info,prefix,head,solver,global_num)
|
||||
import :: psb_desc_type, amg_s_jac_solver_type, psb_s_vect_type, psb_spk_, &
|
||||
& psb_sspmat_type, psb_s_base_sparse_mat, psb_s_base_vect_type, &
|
||||
& psb_ipk_
|
||||
implicit none
|
||||
class(amg_s_jac_solver_type), intent(in) :: sv
|
||||
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) :: solver, global_num
|
||||
end subroutine amg_s_jac_solver_dmp
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_s_jac_solver_clone(sv,svout,info)
|
||||
import :: psb_desc_type, psb_sspmat_type, psb_s_base_sparse_mat, &
|
||||
& psb_s_vect_type, psb_s_base_vect_type, psb_spk_, &
|
||||
& amg_s_base_solver_type, amg_s_jac_solver_type, psb_ipk_
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_s_jac_solver_type), intent(inout) :: sv
|
||||
class(amg_s_base_solver_type), allocatable, intent(inout) :: svout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_s_jac_solver_clone
|
||||
end interface
|
||||
|
||||
!!$ interface
|
||||
!!$ subroutine amg_s_l1_jac_solver_clone(sv,svout,info)
|
||||
!!$ import :: psb_desc_type, psb_sspmat_type, psb_s_base_sparse_mat, &
|
||||
!!$ & psb_s_vect_type, psb_s_base_vect_type, psb_spk_, &
|
||||
!!$ & amg_s_base_solver_type, amg_s_l1_jac_solver_type, psb_ipk_
|
||||
!!$ Implicit None
|
||||
!!$
|
||||
!!$ ! Arguments
|
||||
!!$ class(amg_s_l1_jac_solver_type), intent(inout) :: sv
|
||||
!!$ class(amg_s_base_solver_type), allocatable, intent(inout) :: svout
|
||||
!!$ integer(psb_ipk_), intent(out) :: info
|
||||
!!$ end subroutine amg_s_l1_jac_solver_clone
|
||||
!!$ end interface
|
||||
|
||||
interface
|
||||
subroutine amg_s_jac_solver_clone_settings(sv,svout,info)
|
||||
import :: psb_desc_type, psb_sspmat_type, psb_s_base_sparse_mat, &
|
||||
& psb_s_vect_type, psb_s_base_vect_type, psb_spk_, &
|
||||
& amg_s_base_solver_type, amg_s_jac_solver_type, psb_ipk_
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_s_jac_solver_type), intent(inout) :: sv
|
||||
class(amg_s_base_solver_type), intent(inout) :: svout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_s_jac_solver_clone_settings
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_s_jac_solver_clear_data(sv,info)
|
||||
import :: psb_desc_type, psb_sspmat_type, psb_s_base_sparse_mat, &
|
||||
& psb_s_vect_type, psb_s_base_vect_type, psb_spk_, &
|
||||
& amg_s_jac_solver_type, psb_ipk_
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_s_jac_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_s_jac_solver_clear_data
|
||||
end interface
|
||||
|
||||
contains
|
||||
|
||||
subroutine s_jac_solver_default(sv)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_s_jac_solver_type), intent(inout) :: sv
|
||||
|
||||
sv%sweeps = ione
|
||||
sv%eps = dzero
|
||||
|
||||
return
|
||||
end subroutine s_jac_solver_default
|
||||
|
||||
subroutine s_jac_solver_check(sv,info)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_s_jac_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='s_jac_solver_check'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
|
||||
call amg_check_def(sv%sweeps,&
|
||||
& 'Jacobi 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
|
||||
|
||||
end subroutine s_jac_solver_check
|
||||
|
||||
subroutine s_jac_solver_cseti(sv,what,val,info,idx)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_s_jac_solver_type), intent(inout) :: sv
|
||||
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
|
||||
character(len=20) :: name='s_jac_solver_cseti'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select case(psb_toupper(what))
|
||||
case('SOLVER_SWEEPS')
|
||||
sv%sweeps = val
|
||||
case default
|
||||
call sv%amg_s_base_solver_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 s_jac_solver_cseti
|
||||
|
||||
subroutine s_jac_solver_csetc(sv,what,val,info,idx)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_s_jac_solver_type), intent(inout) :: sv
|
||||
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, ival
|
||||
character(len=20) :: name='s_jac_solver_csetc'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
|
||||
call sv%amg_s_base_solver_type%set(what,val,info,idx=idx)
|
||||
|
||||
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 s_jac_solver_csetc
|
||||
|
||||
subroutine s_jac_solver_csetr(sv,what,val,info,idx)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_s_jac_solver_type), intent(inout) :: sv
|
||||
character(len=*), intent(in) :: what
|
||||
real(psb_spk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(in), optional :: idx
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='s_jac_solver_csetr'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
|
||||
select case(psb_toupper(what))
|
||||
case('SOLVER_EPS')
|
||||
sv%eps = val
|
||||
case default
|
||||
call sv%amg_s_base_solver_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 s_jac_solver_csetr
|
||||
|
||||
subroutine s_jac_solver_free(sv,info)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_s_jac_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='s_jac_solver_free'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
|
||||
call sv%a%free()
|
||||
if (allocated(sv%dv)) then
|
||||
call sv%dv%free(info)
|
||||
deallocate(sv%dv)
|
||||
end if
|
||||
if (allocated(sv%d)) deallocate(sv%d)
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine s_jac_solver_free
|
||||
|
||||
subroutine s_jac_solver_descr(sv,info,iout,coarse,prefix)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_s_jac_solver_type), intent(in) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(in), optional :: iout
|
||||
logical, intent(in), optional :: coarse
|
||||
character(len=*), intent(in), optional :: prefix
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20), parameter :: name='amg_s_jac_solver_descr'
|
||||
integer(psb_ipk_) :: iout_
|
||||
character(1024) :: prefix_
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
if (present(iout)) then
|
||||
iout_ = iout
|
||||
else
|
||||
iout_ = psb_out_unit
|
||||
endif
|
||||
if (present(prefix)) then
|
||||
prefix_ = prefix
|
||||
else
|
||||
prefix_ = ""
|
||||
end if
|
||||
|
||||
if (sv%eps<=dzero) then
|
||||
write(iout_,*) trim(prefix_), ' Jacobi iterative solver with ',&
|
||||
& sv%sweeps,' sweeps'
|
||||
else
|
||||
write(iout_,*) trim(prefix_), ' Jacobi 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 s_jac_solver_descr
|
||||
|
||||
function s_jac_solver_get_nzeros(sv) result(val)
|
||||
|
||||
implicit none
|
||||
! Arguments
|
||||
class(amg_s_jac_solver_type), intent(in) :: sv
|
||||
integer(psb_epk_) :: val
|
||||
integer(psb_ipk_) :: i
|
||||
|
||||
val = 0
|
||||
val = val + sv%a%get_nzeros()
|
||||
val = val + sv%dv%get_nrows()
|
||||
|
||||
return
|
||||
end function s_jac_solver_get_nzeros
|
||||
|
||||
function s_jac_solver_sizeof(sv) result(val)
|
||||
|
||||
implicit none
|
||||
! Arguments
|
||||
class(amg_s_jac_solver_type), intent(in) :: sv
|
||||
integer(psb_epk_) :: val
|
||||
integer(psb_ipk_) :: i
|
||||
|
||||
val = psb_sizeof_ip
|
||||
val = val + sv%a%sizeof()
|
||||
val = val + sv%dv%sizeof()
|
||||
|
||||
return
|
||||
end function s_jac_solver_sizeof
|
||||
|
||||
function s_jac_solver_get_fmt() result(val)
|
||||
implicit none
|
||||
character(len=32) :: val
|
||||
|
||||
val = "Jacobi solver"
|
||||
end function s_jac_solver_get_fmt
|
||||
|
||||
function s_jac_solver_get_id() result(val)
|
||||
implicit none
|
||||
integer(psb_ipk_) :: val
|
||||
|
||||
val = amg_jac_
|
||||
end function s_jac_solver_get_id
|
||||
|
||||
!
|
||||
! If this is true, then the solver needs a starting
|
||||
! guess. Currently only handled in JAC smoother.
|
||||
!
|
||||
function s_jac_solver_is_iterative() result(val)
|
||||
implicit none
|
||||
logical :: val
|
||||
|
||||
val = .true.
|
||||
end function s_jac_solver_is_iterative
|
||||
|
||||
function s_jac_solver_get_wrksize() result(val)
|
||||
implicit none
|
||||
integer(psb_ipk_) :: val
|
||||
|
||||
val = 2
|
||||
end function s_jac_solver_get_wrksize
|
||||
|
||||
subroutine s_l1_jac_solver_descr(sv,info,iout,coarse,prefix)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_s_l1_jac_solver_type), intent(in) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(in), optional :: iout
|
||||
logical, intent(in), optional :: coarse
|
||||
character(len=*), intent(in), optional :: prefix
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20), parameter :: name='amg_s_l1_jac_solver_descr'
|
||||
integer(psb_ipk_) :: iout_
|
||||
character(1024) :: prefix_
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
if (present(iout)) then
|
||||
iout_ = iout
|
||||
else
|
||||
iout_ = psb_out_unit
|
||||
endif
|
||||
if (present(prefix)) then
|
||||
prefix_ = prefix
|
||||
else
|
||||
prefix_ = ""
|
||||
end if
|
||||
|
||||
if (sv%eps<=dzero) then
|
||||
write(iout_,*) trim(prefix_), ' L1-Jacobi iterative solver with ',&
|
||||
& sv%sweeps,' sweeps'
|
||||
else
|
||||
write(iout_,*) trim(prefix_), ' L1-Jacobi 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 s_l1_jac_solver_descr
|
||||
|
||||
function s_l1_jac_solver_get_fmt() result(val)
|
||||
implicit none
|
||||
character(len=32) :: val
|
||||
|
||||
val = "L1-Jacobi solver"
|
||||
end function s_l1_jac_solver_get_fmt
|
||||
|
||||
function s_l1_jac_solver_get_id() result(val)
|
||||
implicit none
|
||||
integer(psb_ipk_) :: val
|
||||
|
||||
val = amg_l1_jac_
|
||||
end function s_l1_jac_solver_get_id
|
||||
|
||||
end module amg_s_jac_solver
|
||||
@@ -78,7 +78,8 @@ module amg_s_mumps_solver
|
||||
!
|
||||
! Controls to be set before MUMPS instantiation:
|
||||
!
|
||||
! IPAR(1) : MUMPS_LOC_GLOB 0==amg_local_solver_: LOCAL 1==amg_global_solver_: GLOBAL
|
||||
! IPAR(1) : MUMPS_LOC_GLOB 0==amg_local_solver_: 'LOCAL_SOLVER
|
||||
! 1==amg_global_solver_: 'GLOBAL_SOLVER'
|
||||
! IPAR(2) : MUMPS_PRINT_ERR print verbosity (see MUMPS)
|
||||
! IPAR(3) : MUMPS_SYM 0: non-symmetric 2: symmetric
|
||||
integer(psb_ipk_), dimension(3) :: ipar
|
||||
|
||||
@@ -0,0 +1,585 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! 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 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_z_jac_solver_mod.f90
|
||||
!
|
||||
! Module: amg_z_jac_solver_mod
|
||||
!
|
||||
! This module defines:
|
||||
! - the amg_z_jac_solver_type data structure containing the ingredients
|
||||
! for a local Jacobi iteration. The iterations are local to a process
|
||||
! (they operate on the block diagonal).
|
||||
!
|
||||
!
|
||||
module amg_z_jac_solver
|
||||
|
||||
use amg_z_base_solver_mod
|
||||
|
||||
type, extends(amg_z_base_solver_type) :: amg_z_jac_solver_type
|
||||
type(psb_zspmat_type) :: a
|
||||
type(psb_z_vect_type), allocatable :: dv
|
||||
complex(psb_dpk_), allocatable :: d(:)
|
||||
integer(psb_ipk_) :: sweeps
|
||||
real(psb_dpk_) :: eps
|
||||
contains
|
||||
procedure, pass(sv) :: dump => amg_z_jac_solver_dmp
|
||||
procedure, pass(sv) :: check => z_jac_solver_check
|
||||
procedure, pass(sv) :: clone => amg_z_jac_solver_clone
|
||||
procedure, pass(sv) :: clone_settings => amg_z_jac_solver_clone_settings
|
||||
procedure, pass(sv) :: clear_data => amg_z_jac_solver_clear_data
|
||||
procedure, pass(sv) :: build => amg_z_jac_solver_bld
|
||||
procedure, pass(sv) :: cnv => amg_z_jac_solver_cnv
|
||||
procedure, pass(sv) :: apply_v => amg_z_jac_solver_apply_vect
|
||||
procedure, pass(sv) :: apply_a => amg_z_jac_solver_apply
|
||||
procedure, pass(sv) :: free => z_jac_solver_free
|
||||
procedure, pass(sv) :: cseti => z_jac_solver_cseti
|
||||
procedure, pass(sv) :: csetc => z_jac_solver_csetc
|
||||
procedure, pass(sv) :: csetr => z_jac_solver_csetr
|
||||
procedure, pass(sv) :: descr => z_jac_solver_descr
|
||||
procedure, pass(sv) :: default => z_jac_solver_default
|
||||
procedure, pass(sv) :: sizeof => z_jac_solver_sizeof
|
||||
procedure, pass(sv) :: get_nzeros => z_jac_solver_get_nzeros
|
||||
procedure, nopass :: get_wrksz => z_jac_solver_get_wrksize
|
||||
procedure, nopass :: get_fmt => z_jac_solver_get_fmt
|
||||
procedure, nopass :: get_id => z_jac_solver_get_id
|
||||
procedure, nopass :: is_iterative => z_jac_solver_is_iterative
|
||||
end type amg_z_jac_solver_type
|
||||
|
||||
type, extends(amg_z_jac_solver_type) :: amg_z_l1_jac_solver_type
|
||||
contains
|
||||
procedure, pass(sv) :: build => amg_z_l1_jac_solver_bld
|
||||
procedure, pass(sv) :: descr => z_l1_jac_solver_descr
|
||||
procedure, nopass :: get_fmt => z_l1_jac_solver_get_fmt
|
||||
procedure, nopass :: get_id => z_l1_jac_solver_get_id
|
||||
end type amg_z_l1_jac_solver_type
|
||||
|
||||
|
||||
private :: z_jac_solver_bld, z_jac_solver_apply, &
|
||||
& z_jac_solver_free, &
|
||||
& z_jac_solver_descr, z_jac_solver_sizeof, &
|
||||
& z_jac_solver_default, z_jac_solver_dmp, &
|
||||
& z_jac_solver_apply_vect, z_jac_solver_get_nzeros, &
|
||||
& z_jac_solver_get_fmt, z_jac_solver_check,&
|
||||
& z_jac_solver_is_iterative, &
|
||||
& z_jac_solver_get_id, z_jac_solver_get_wrksize
|
||||
|
||||
interface
|
||||
subroutine amg_z_jac_solver_apply_vect(alpha,sv,x,beta,y,desc_data,&
|
||||
& trans,work,wv,info,init,initu)
|
||||
import :: psb_desc_type, amg_z_jac_solver_type, psb_z_vect_type, psb_dpk_, &
|
||||
& psb_zspmat_type, psb_z_base_sparse_mat, psb_z_base_vect_type, psb_ipk_
|
||||
implicit none
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(amg_z_jac_solver_type), intent(inout) :: sv
|
||||
type(psb_z_vect_type),intent(inout) :: x
|
||||
type(psb_z_vect_type),intent(inout) :: y
|
||||
complex(psb_dpk_),intent(in) :: alpha,beta
|
||||
character(len=1),intent(in) :: trans
|
||||
complex(psb_dpk_),target, intent(inout) :: work(:)
|
||||
type(psb_z_vect_type),intent(inout) :: wv(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
character, intent(in), optional :: init
|
||||
type(psb_z_vect_type),intent(inout), optional :: initu
|
||||
end subroutine amg_z_jac_solver_apply_vect
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_z_jac_solver_apply(alpha,sv,x,beta,y,desc_data,trans,work,info,init,initu)
|
||||
import :: psb_desc_type, amg_z_jac_solver_type, psb_z_vect_type, psb_dpk_, &
|
||||
& psb_zspmat_type, psb_z_base_sparse_mat, psb_z_base_vect_type, psb_ipk_
|
||||
implicit none
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(amg_z_jac_solver_type), intent(inout) :: sv
|
||||
complex(psb_dpk_),intent(inout) :: x(:)
|
||||
complex(psb_dpk_),intent(inout) :: y(:)
|
||||
complex(psb_dpk_),intent(in) :: alpha,beta
|
||||
character(len=1),intent(in) :: trans
|
||||
complex(psb_dpk_),target, intent(inout) :: work(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
character, intent(in), optional :: init
|
||||
complex(psb_dpk_),intent(inout), optional :: initu(:)
|
||||
end subroutine amg_z_jac_solver_apply
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_z_jac_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
import :: psb_desc_type, amg_z_jac_solver_type, psb_z_vect_type, psb_dpk_, &
|
||||
& psb_zspmat_type, psb_z_base_sparse_mat, psb_z_base_vect_type,&
|
||||
& psb_ipk_, psb_i_base_vect_type
|
||||
implicit none
|
||||
type(psb_zspmat_type), intent(in), target :: a
|
||||
Type(psb_desc_type), Intent(inout) :: desc_a
|
||||
class(amg_z_jac_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
type(psb_zspmat_type), intent(in), target, optional :: b
|
||||
class(psb_z_base_sparse_mat), intent(in), optional :: amold
|
||||
class(psb_z_base_vect_type), intent(in), optional :: vmold
|
||||
class(psb_i_base_vect_type), intent(in), optional :: imold
|
||||
end subroutine amg_z_jac_solver_bld
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_z_l1_jac_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
import :: psb_desc_type, amg_z_l1_jac_solver_type, psb_z_vect_type, psb_dpk_, &
|
||||
& psb_zspmat_type, psb_z_base_sparse_mat, psb_z_base_vect_type,&
|
||||
& psb_ipk_, psb_i_base_vect_type
|
||||
implicit none
|
||||
type(psb_zspmat_type), intent(in), target :: a
|
||||
Type(psb_desc_type), Intent(inout) :: desc_a
|
||||
class(amg_z_l1_jac_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
type(psb_zspmat_type), intent(in), target, optional :: b
|
||||
class(psb_z_base_sparse_mat), intent(in), optional :: amold
|
||||
class(psb_z_base_vect_type), intent(in), optional :: vmold
|
||||
class(psb_i_base_vect_type), intent(in), optional :: imold
|
||||
end subroutine amg_z_l1_jac_solver_bld
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_z_jac_solver_cnv(sv,info,amold,vmold,imold)
|
||||
import :: amg_z_jac_solver_type, psb_dpk_, &
|
||||
& psb_z_base_sparse_mat, psb_z_base_vect_type,&
|
||||
& psb_ipk_, psb_i_base_vect_type
|
||||
implicit none
|
||||
class(amg_z_jac_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
class(psb_z_base_sparse_mat), intent(in), optional :: amold
|
||||
class(psb_z_base_vect_type), intent(in), optional :: vmold
|
||||
class(psb_i_base_vect_type), intent(in), optional :: imold
|
||||
end subroutine amg_z_jac_solver_cnv
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_z_jac_solver_dmp(sv,desc,level,info,prefix,head,solver,global_num)
|
||||
import :: psb_desc_type, amg_z_jac_solver_type, psb_z_vect_type, psb_dpk_, &
|
||||
& psb_zspmat_type, psb_z_base_sparse_mat, psb_z_base_vect_type, &
|
||||
& psb_ipk_
|
||||
implicit none
|
||||
class(amg_z_jac_solver_type), intent(in) :: sv
|
||||
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) :: solver, global_num
|
||||
end subroutine amg_z_jac_solver_dmp
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_z_jac_solver_clone(sv,svout,info)
|
||||
import :: psb_desc_type, psb_zspmat_type, psb_z_base_sparse_mat, &
|
||||
& psb_z_vect_type, psb_z_base_vect_type, psb_dpk_, &
|
||||
& amg_z_base_solver_type, amg_z_jac_solver_type, psb_ipk_
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_z_jac_solver_type), intent(inout) :: sv
|
||||
class(amg_z_base_solver_type), allocatable, intent(inout) :: svout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_z_jac_solver_clone
|
||||
end interface
|
||||
|
||||
!!$ interface
|
||||
!!$ subroutine amg_z_l1_jac_solver_clone(sv,svout,info)
|
||||
!!$ import :: psb_desc_type, psb_zspmat_type, psb_z_base_sparse_mat, &
|
||||
!!$ & psb_z_vect_type, psb_z_base_vect_type, psb_dpk_, &
|
||||
!!$ & amg_z_base_solver_type, amg_z_l1_jac_solver_type, psb_ipk_
|
||||
!!$ Implicit None
|
||||
!!$
|
||||
!!$ ! Arguments
|
||||
!!$ class(amg_z_l1_jac_solver_type), intent(inout) :: sv
|
||||
!!$ class(amg_z_base_solver_type), allocatable, intent(inout) :: svout
|
||||
!!$ integer(psb_ipk_), intent(out) :: info
|
||||
!!$ end subroutine amg_z_l1_jac_solver_clone
|
||||
!!$ end interface
|
||||
|
||||
interface
|
||||
subroutine amg_z_jac_solver_clone_settings(sv,svout,info)
|
||||
import :: psb_desc_type, psb_zspmat_type, psb_z_base_sparse_mat, &
|
||||
& psb_z_vect_type, psb_z_base_vect_type, psb_dpk_, &
|
||||
& amg_z_base_solver_type, amg_z_jac_solver_type, psb_ipk_
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_z_jac_solver_type), intent(inout) :: sv
|
||||
class(amg_z_base_solver_type), intent(inout) :: svout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_z_jac_solver_clone_settings
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_z_jac_solver_clear_data(sv,info)
|
||||
import :: psb_desc_type, psb_zspmat_type, psb_z_base_sparse_mat, &
|
||||
& psb_z_vect_type, psb_z_base_vect_type, psb_dpk_, &
|
||||
& amg_z_jac_solver_type, psb_ipk_
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_z_jac_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_z_jac_solver_clear_data
|
||||
end interface
|
||||
|
||||
contains
|
||||
|
||||
subroutine z_jac_solver_default(sv)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_z_jac_solver_type), intent(inout) :: sv
|
||||
|
||||
sv%sweeps = ione
|
||||
sv%eps = dzero
|
||||
|
||||
return
|
||||
end subroutine z_jac_solver_default
|
||||
|
||||
subroutine z_jac_solver_check(sv,info)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_z_jac_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='z_jac_solver_check'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
|
||||
call amg_check_def(sv%sweeps,&
|
||||
& 'Jacobi 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
|
||||
|
||||
end subroutine z_jac_solver_check
|
||||
|
||||
subroutine z_jac_solver_cseti(sv,what,val,info,idx)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_z_jac_solver_type), intent(inout) :: sv
|
||||
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
|
||||
character(len=20) :: name='z_jac_solver_cseti'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select case(psb_toupper(what))
|
||||
case('SOLVER_SWEEPS')
|
||||
sv%sweeps = val
|
||||
case default
|
||||
call sv%amg_z_base_solver_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 z_jac_solver_cseti
|
||||
|
||||
subroutine z_jac_solver_csetc(sv,what,val,info,idx)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_z_jac_solver_type), intent(inout) :: sv
|
||||
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, ival
|
||||
character(len=20) :: name='z_jac_solver_csetc'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
|
||||
call sv%amg_z_base_solver_type%set(what,val,info,idx=idx)
|
||||
|
||||
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 z_jac_solver_csetc
|
||||
|
||||
subroutine z_jac_solver_csetr(sv,what,val,info,idx)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_z_jac_solver_type), intent(inout) :: sv
|
||||
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
|
||||
character(len=20) :: name='z_jac_solver_csetr'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
|
||||
select case(psb_toupper(what))
|
||||
case('SOLVER_EPS')
|
||||
sv%eps = val
|
||||
case default
|
||||
call sv%amg_z_base_solver_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 z_jac_solver_csetr
|
||||
|
||||
subroutine z_jac_solver_free(sv,info)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_z_jac_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='z_jac_solver_free'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
|
||||
call sv%a%free()
|
||||
if (allocated(sv%dv)) then
|
||||
call sv%dv%free(info)
|
||||
deallocate(sv%dv)
|
||||
end if
|
||||
if (allocated(sv%d)) deallocate(sv%d)
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine z_jac_solver_free
|
||||
|
||||
subroutine z_jac_solver_descr(sv,info,iout,coarse,prefix)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_z_jac_solver_type), intent(in) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(in), optional :: iout
|
||||
logical, intent(in), optional :: coarse
|
||||
character(len=*), intent(in), optional :: prefix
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20), parameter :: name='amg_z_jac_solver_descr'
|
||||
integer(psb_ipk_) :: iout_
|
||||
character(1024) :: prefix_
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
if (present(iout)) then
|
||||
iout_ = iout
|
||||
else
|
||||
iout_ = psb_out_unit
|
||||
endif
|
||||
if (present(prefix)) then
|
||||
prefix_ = prefix
|
||||
else
|
||||
prefix_ = ""
|
||||
end if
|
||||
|
||||
if (sv%eps<=dzero) then
|
||||
write(iout_,*) trim(prefix_), ' Jacobi iterative solver with ',&
|
||||
& sv%sweeps,' sweeps'
|
||||
else
|
||||
write(iout_,*) trim(prefix_), ' Jacobi 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 z_jac_solver_descr
|
||||
|
||||
function z_jac_solver_get_nzeros(sv) result(val)
|
||||
|
||||
implicit none
|
||||
! Arguments
|
||||
class(amg_z_jac_solver_type), intent(in) :: sv
|
||||
integer(psb_epk_) :: val
|
||||
integer(psb_ipk_) :: i
|
||||
|
||||
val = 0
|
||||
val = val + sv%a%get_nzeros()
|
||||
val = val + sv%dv%get_nrows()
|
||||
|
||||
return
|
||||
end function z_jac_solver_get_nzeros
|
||||
|
||||
function z_jac_solver_sizeof(sv) result(val)
|
||||
|
||||
implicit none
|
||||
! Arguments
|
||||
class(amg_z_jac_solver_type), intent(in) :: sv
|
||||
integer(psb_epk_) :: val
|
||||
integer(psb_ipk_) :: i
|
||||
|
||||
val = psb_sizeof_ip
|
||||
val = val + sv%a%sizeof()
|
||||
val = val + sv%dv%sizeof()
|
||||
|
||||
return
|
||||
end function z_jac_solver_sizeof
|
||||
|
||||
function z_jac_solver_get_fmt() result(val)
|
||||
implicit none
|
||||
character(len=32) :: val
|
||||
|
||||
val = "Jacobi solver"
|
||||
end function z_jac_solver_get_fmt
|
||||
|
||||
function z_jac_solver_get_id() result(val)
|
||||
implicit none
|
||||
integer(psb_ipk_) :: val
|
||||
|
||||
val = amg_jac_
|
||||
end function z_jac_solver_get_id
|
||||
|
||||
!
|
||||
! If this is true, then the solver needs a starting
|
||||
! guess. Currently only handled in JAC smoother.
|
||||
!
|
||||
function z_jac_solver_is_iterative() result(val)
|
||||
implicit none
|
||||
logical :: val
|
||||
|
||||
val = .true.
|
||||
end function z_jac_solver_is_iterative
|
||||
|
||||
function z_jac_solver_get_wrksize() result(val)
|
||||
implicit none
|
||||
integer(psb_ipk_) :: val
|
||||
|
||||
val = 2
|
||||
end function z_jac_solver_get_wrksize
|
||||
|
||||
subroutine z_l1_jac_solver_descr(sv,info,iout,coarse,prefix)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_z_l1_jac_solver_type), intent(in) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(in), optional :: iout
|
||||
logical, intent(in), optional :: coarse
|
||||
character(len=*), intent(in), optional :: prefix
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20), parameter :: name='amg_z_l1_jac_solver_descr'
|
||||
integer(psb_ipk_) :: iout_
|
||||
character(1024) :: prefix_
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
if (present(iout)) then
|
||||
iout_ = iout
|
||||
else
|
||||
iout_ = psb_out_unit
|
||||
endif
|
||||
if (present(prefix)) then
|
||||
prefix_ = prefix
|
||||
else
|
||||
prefix_ = ""
|
||||
end if
|
||||
|
||||
if (sv%eps<=dzero) then
|
||||
write(iout_,*) trim(prefix_), ' L1-Jacobi iterative solver with ',&
|
||||
& sv%sweeps,' sweeps'
|
||||
else
|
||||
write(iout_,*) trim(prefix_), ' L1-Jacobi 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 z_l1_jac_solver_descr
|
||||
|
||||
function z_l1_jac_solver_get_fmt() result(val)
|
||||
implicit none
|
||||
character(len=32) :: val
|
||||
|
||||
val = "L1-Jacobi solver"
|
||||
end function z_l1_jac_solver_get_fmt
|
||||
|
||||
function z_l1_jac_solver_get_id() result(val)
|
||||
implicit none
|
||||
integer(psb_ipk_) :: val
|
||||
|
||||
val = amg_l1_jac_
|
||||
end function z_l1_jac_solver_get_id
|
||||
|
||||
end module amg_z_jac_solver
|
||||
@@ -78,7 +78,8 @@ module amg_z_mumps_solver
|
||||
!
|
||||
! Controls to be set before MUMPS instantiation:
|
||||
!
|
||||
! IPAR(1) : MUMPS_LOC_GLOB 0==amg_local_solver_: LOCAL 1==amg_global_solver_: GLOBAL
|
||||
! IPAR(1) : MUMPS_LOC_GLOB 0==amg_local_solver_: 'LOCAL_SOLVER
|
||||
! 1==amg_global_solver_: 'GLOBAL_SOLVER'
|
||||
! IPAR(2) : MUMPS_PRINT_ERR print verbosity (see MUMPS)
|
||||
! IPAR(3) : MUMPS_SYM 0: non-symmetric 2: symmetric
|
||||
integer(psb_ipk_), dimension(3) :: ipar
|
||||
|
||||
@@ -42,7 +42,6 @@
|
||||
#include <stdlib.h>
|
||||
#if !defined(SERIAL_MPI)
|
||||
#include <mpi.h>
|
||||
#endif
|
||||
|
||||
#include "MatchBoxPC.h"
|
||||
#ifdef __cplusplus
|
||||
@@ -127,3 +126,4 @@ void sMatchBoxPC(MilanLongInt NLVer, MilanLongInt NLEdge,
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -78,6 +78,8 @@ const int BundleTag = 9; // Predefined tag
|
||||
|
||||
static vector<MilanLongInt> DEFAULT_VECTOR;
|
||||
|
||||
#if !defined(SERIAL_MPI)
|
||||
|
||||
// MPI type map
|
||||
template <typename T>
|
||||
MPI_Datatype TypeMap();
|
||||
@@ -89,6 +91,7 @@ template <>
|
||||
inline MPI_Datatype TypeMap<double>() { return MPI_DOUBLE; }
|
||||
template <>
|
||||
inline MPI_Datatype TypeMap<float>() { return MPI_FLOAT; }
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "MatchBoxPC.h"
|
||||
|
||||
// TODO comment
|
||||
#if !defined(SERIAL_MPI)
|
||||
|
||||
void clean(MilanLongInt NLVer,
|
||||
MilanInt myRank,
|
||||
@@ -89,3 +90,4 @@ void clean(MilanLongInt NLVer,
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
* @param edgeLocWeight
|
||||
* @return
|
||||
*/
|
||||
#if !defined(SERIAL_MPI)
|
||||
|
||||
MilanLongInt firstComputeCandidateMate(MilanLongInt adj1,
|
||||
MilanLongInt adj2,
|
||||
MilanLongInt *verLocInd,
|
||||
@@ -71,3 +73,4 @@ MilanLongInt computeCandidateMate(MilanLongInt adj1,
|
||||
|
||||
return w;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "MatchBoxPC.h"
|
||||
#if !defined(SERIAL_MPI)
|
||||
|
||||
void PARALLEL_COMPUTE_CANDIDATE_MATE_B(MilanLongInt NLVer,
|
||||
MilanLongInt *verLocPtr,
|
||||
@@ -25,3 +26,4 @@ void PARALLEL_COMPUTE_CANDIDATE_MATE_B(MilanLongInt NLVer,
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "MatchBoxPC.h"
|
||||
#if !defined(SERIAL_MPI)
|
||||
|
||||
void PARALLEL_PROCESS_EXPOSED_VERTEX_B(MilanLongInt NLVer,
|
||||
MilanLongInt *candidateMate,
|
||||
@@ -193,3 +194,4 @@ void PARALLEL_PROCESS_EXPOSED_VERTEX_B(MilanLongInt NLVer,
|
||||
|
||||
} // End of parallel region
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "MatchBoxPC.h"
|
||||
|
||||
#if !defined(SERIAL_MPI)
|
||||
void processMatchedVertices(
|
||||
MilanLongInt NLVer,
|
||||
vector<MilanLongInt> &UChunkBeingProcessed,
|
||||
@@ -292,3 +293,4 @@ void processMatchedVertices(
|
||||
#endif
|
||||
} // End of parallel region
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "MatchBoxPC.h"
|
||||
//#define DEBUG_HANG_
|
||||
#if !defined(SERIAL_MPI)
|
||||
void processMatchedVerticesAndSendMessages(
|
||||
MilanLongInt NLVer,
|
||||
vector<MilanLongInt> &UChunkBeingProcessed,
|
||||
@@ -306,3 +307,4 @@ void processMatchedVerticesAndSendMessages(
|
||||
cout << myRank<<" Done sending messages"<<endl;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "MatchBoxPC.h"
|
||||
//#define DEBUG_HANG_
|
||||
#if !defined(SERIAL_MPI)
|
||||
|
||||
void processMessages(
|
||||
MilanLongInt NLVer,
|
||||
@@ -313,3 +314,4 @@ void processMessages(
|
||||
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "MatchBoxPC.h"
|
||||
|
||||
#if !defined(SERIAL_MPI)
|
||||
void sendBundledMessages(MilanLongInt *numGhostEdges,
|
||||
MilanInt *BufferSize,
|
||||
MilanLongInt *Buffer,
|
||||
@@ -207,3 +207,4 @@ void sendBundledMessages(MilanLongInt *numGhostEdges,
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -84,6 +84,7 @@ subroutine amg_ccprecseti(p,what,val,info,ilev,ilmax,pos,idx)
|
||||
use amg_c_diag_solver
|
||||
use amg_c_l1_diag_solver
|
||||
use amg_c_ilu_solver
|
||||
use amg_c_jac_solver
|
||||
use amg_c_id_solver
|
||||
use amg_c_gs_solver
|
||||
use amg_c_ainv_solver
|
||||
@@ -308,6 +309,7 @@ subroutine amg_ccprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
|
||||
use amg_c_diag_solver
|
||||
use amg_c_l1_diag_solver
|
||||
use amg_c_ilu_solver
|
||||
use amg_c_jac_solver
|
||||
use amg_c_id_solver
|
||||
use amg_c_gs_solver
|
||||
use amg_c_ainv_solver
|
||||
|
||||
@@ -84,6 +84,7 @@ subroutine amg_dcprecseti(p,what,val,info,ilev,ilmax,pos,idx)
|
||||
use amg_d_diag_solver
|
||||
use amg_d_l1_diag_solver
|
||||
use amg_d_ilu_solver
|
||||
use amg_d_jac_solver
|
||||
use amg_d_id_solver
|
||||
use amg_d_gs_solver
|
||||
use amg_d_ainv_solver
|
||||
@@ -314,6 +315,7 @@ subroutine amg_dcprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
|
||||
use amg_d_diag_solver
|
||||
use amg_d_l1_diag_solver
|
||||
use amg_d_ilu_solver
|
||||
use amg_d_jac_solver
|
||||
use amg_d_id_solver
|
||||
use amg_d_gs_solver
|
||||
use amg_d_ainv_solver
|
||||
|
||||
@@ -84,6 +84,7 @@ subroutine amg_scprecseti(p,what,val,info,ilev,ilmax,pos,idx)
|
||||
use amg_s_diag_solver
|
||||
use amg_s_l1_diag_solver
|
||||
use amg_s_ilu_solver
|
||||
use amg_s_jac_solver
|
||||
use amg_s_id_solver
|
||||
use amg_s_gs_solver
|
||||
use amg_s_ainv_solver
|
||||
@@ -308,6 +309,7 @@ subroutine amg_scprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
|
||||
use amg_s_diag_solver
|
||||
use amg_s_l1_diag_solver
|
||||
use amg_s_ilu_solver
|
||||
use amg_s_jac_solver
|
||||
use amg_s_id_solver
|
||||
use amg_s_gs_solver
|
||||
use amg_s_ainv_solver
|
||||
|
||||
@@ -84,6 +84,7 @@ subroutine amg_zcprecseti(p,what,val,info,ilev,ilmax,pos,idx)
|
||||
use amg_z_diag_solver
|
||||
use amg_z_l1_diag_solver
|
||||
use amg_z_ilu_solver
|
||||
use amg_z_jac_solver
|
||||
use amg_z_id_solver
|
||||
use amg_z_gs_solver
|
||||
use amg_z_ainv_solver
|
||||
@@ -314,6 +315,7 @@ subroutine amg_zcprecsetc(p,what,string,info,ilev,ilmax,pos,idx)
|
||||
use amg_z_diag_solver
|
||||
use amg_z_l1_diag_solver
|
||||
use amg_z_ilu_solver
|
||||
use amg_z_jac_solver
|
||||
use amg_z_id_solver
|
||||
use amg_z_gs_solver
|
||||
use amg_z_ainv_solver
|
||||
|
||||
@@ -42,10 +42,13 @@ subroutine amg_c_base_onelev_csetc(lv,what,val,info,pos,idx)
|
||||
use amg_c_base_aggregator_mod
|
||||
use amg_c_dec_aggregator_mod
|
||||
use amg_c_symdec_aggregator_mod
|
||||
#if !defined(SERIAL_MPI)
|
||||
#endif
|
||||
use amg_c_jac_smoother
|
||||
use amg_c_as_smoother
|
||||
use amg_c_diag_solver
|
||||
use amg_c_l1_diag_solver
|
||||
use amg_c_jac_solver
|
||||
use amg_c_ilu_solver
|
||||
use amg_c_id_solver
|
||||
use amg_c_gs_solver
|
||||
@@ -78,6 +81,8 @@ subroutine amg_c_base_onelev_csetc(lv,what,val,info,pos,idx)
|
||||
type(amg_c_as_smoother_type) :: amg_c_as_smoother_mold
|
||||
type(amg_c_diag_solver_type) :: amg_c_diag_solver_mold
|
||||
type(amg_c_l1_diag_solver_type) :: amg_c_l1_diag_solver_mold
|
||||
type(amg_c_jac_solver_type) :: amg_c_jac_solver_mold
|
||||
type(amg_c_l1_jac_solver_type) :: amg_c_l1_jac_solver_mold
|
||||
type(amg_c_ilu_solver_type) :: amg_c_ilu_solver_mold
|
||||
type(amg_c_id_solver_type) :: amg_c_id_solver_mold
|
||||
type(amg_c_gs_solver_type) :: amg_c_gs_solver_mold
|
||||
@@ -188,8 +193,13 @@ subroutine amg_c_base_onelev_csetc(lv,what,val,info,pos,idx)
|
||||
case ('DIAG')
|
||||
call lv%set(amg_c_diag_solver_mold,info,pos=pos)
|
||||
|
||||
case ('JACOBI')
|
||||
call lv%set(amg_c_jac_solver_mold,info,pos=pos)
|
||||
|
||||
case ('L1-DIAG')
|
||||
call lv%set(amg_c_l1_diag_solver_mold,info,pos=pos)
|
||||
case ('L1-JACOBI')
|
||||
call lv%set(amg_c_l1_jac_solver_mold,info,pos=pos)
|
||||
|
||||
case ('GS','FGS','FWGS')
|
||||
call lv%set(amg_c_gs_solver_mold,info,pos=pos)
|
||||
@@ -238,17 +248,27 @@ subroutine amg_c_base_onelev_csetc(lv,what,val,info,pos,idx)
|
||||
if (info == 0) deallocate(lv%aggr,stat=info)
|
||||
if (info /= 0) then
|
||||
info = psb_err_internal_error_
|
||||
call psb_errpush(info,name,a_err='aggregator deallocation?')
|
||||
goto 9999
|
||||
return
|
||||
end if
|
||||
end if
|
||||
|
||||
select case(val)
|
||||
case('DEC')
|
||||
case('DEC','DECOUPLED')
|
||||
allocate(amg_c_dec_aggregator_type :: lv%aggr, stat=info)
|
||||
case('SYMDEC')
|
||||
allocate(amg_c_symdec_aggregator_type :: lv%aggr, stat=info)
|
||||
case default
|
||||
#if !defined(SERIAL_MPI)
|
||||
#endif
|
||||
case default
|
||||
info = psb_err_internal_error_
|
||||
#if !defined(SERIAL_MPI)
|
||||
call psb_errpush(info,name,a_err='Unsupported PAR_AGGR_ALG')
|
||||
#else
|
||||
call psb_errpush(info,name,a_err='PAR_AGGR_ALG unsupported (SERIAL_MPI on)')
|
||||
#endif
|
||||
goto 9999
|
||||
end select
|
||||
if (info == psb_success_) call lv%aggr%default()
|
||||
|
||||
|
||||
@@ -42,11 +42,14 @@ subroutine amg_d_base_onelev_csetc(lv,what,val,info,pos,idx)
|
||||
use amg_d_base_aggregator_mod
|
||||
use amg_d_dec_aggregator_mod
|
||||
use amg_d_symdec_aggregator_mod
|
||||
#if !defined(SERIAL_MPI)
|
||||
use amg_d_parmatch_aggregator_mod
|
||||
#endif
|
||||
use amg_d_jac_smoother
|
||||
use amg_d_as_smoother
|
||||
use amg_d_diag_solver
|
||||
use amg_d_l1_diag_solver
|
||||
use amg_d_jac_solver
|
||||
use amg_d_ilu_solver
|
||||
use amg_d_id_solver
|
||||
use amg_d_gs_solver
|
||||
@@ -85,6 +88,8 @@ subroutine amg_d_base_onelev_csetc(lv,what,val,info,pos,idx)
|
||||
type(amg_d_as_smoother_type) :: amg_d_as_smoother_mold
|
||||
type(amg_d_diag_solver_type) :: amg_d_diag_solver_mold
|
||||
type(amg_d_l1_diag_solver_type) :: amg_d_l1_diag_solver_mold
|
||||
type(amg_d_jac_solver_type) :: amg_d_jac_solver_mold
|
||||
type(amg_d_l1_jac_solver_type) :: amg_d_l1_jac_solver_mold
|
||||
type(amg_d_ilu_solver_type) :: amg_d_ilu_solver_mold
|
||||
type(amg_d_id_solver_type) :: amg_d_id_solver_mold
|
||||
type(amg_d_gs_solver_type) :: amg_d_gs_solver_mold
|
||||
@@ -201,8 +206,13 @@ subroutine amg_d_base_onelev_csetc(lv,what,val,info,pos,idx)
|
||||
case ('DIAG')
|
||||
call lv%set(amg_d_diag_solver_mold,info,pos=pos)
|
||||
|
||||
case ('JACOBI')
|
||||
call lv%set(amg_d_jac_solver_mold,info,pos=pos)
|
||||
|
||||
case ('L1-DIAG')
|
||||
call lv%set(amg_d_l1_diag_solver_mold,info,pos=pos)
|
||||
case ('L1-JACOBI')
|
||||
call lv%set(amg_d_l1_jac_solver_mold,info,pos=pos)
|
||||
|
||||
case ('GS','FGS','FWGS')
|
||||
call lv%set(amg_d_gs_solver_mold,info,pos=pos)
|
||||
@@ -259,19 +269,29 @@ subroutine amg_d_base_onelev_csetc(lv,what,val,info,pos,idx)
|
||||
if (info == 0) deallocate(lv%aggr,stat=info)
|
||||
if (info /= 0) then
|
||||
info = psb_err_internal_error_
|
||||
call psb_errpush(info,name,a_err='aggregator deallocation?')
|
||||
goto 9999
|
||||
return
|
||||
end if
|
||||
end if
|
||||
|
||||
select case(val)
|
||||
case('DEC')
|
||||
case('DEC','DECOUPLED')
|
||||
allocate(amg_d_dec_aggregator_type :: lv%aggr, stat=info)
|
||||
case('SYMDEC')
|
||||
allocate(amg_d_symdec_aggregator_type :: lv%aggr, stat=info)
|
||||
#if !defined(SERIAL_MPI)
|
||||
case('COUP','COUPLED')
|
||||
allocate(amg_d_parmatch_aggregator_type :: lv%aggr, stat=info)
|
||||
case default
|
||||
#endif
|
||||
case default
|
||||
info = psb_err_internal_error_
|
||||
#if !defined(SERIAL_MPI)
|
||||
call psb_errpush(info,name,a_err='Unsupported PAR_AGGR_ALG')
|
||||
#else
|
||||
call psb_errpush(info,name,a_err='PAR_AGGR_ALG unsupported (SERIAL_MPI on)')
|
||||
#endif
|
||||
goto 9999
|
||||
end select
|
||||
if (info == psb_success_) call lv%aggr%default()
|
||||
|
||||
|
||||
@@ -42,11 +42,14 @@ subroutine amg_s_base_onelev_csetc(lv,what,val,info,pos,idx)
|
||||
use amg_s_base_aggregator_mod
|
||||
use amg_s_dec_aggregator_mod
|
||||
use amg_s_symdec_aggregator_mod
|
||||
#if !defined(SERIAL_MPI)
|
||||
use amg_s_parmatch_aggregator_mod
|
||||
#endif
|
||||
use amg_s_jac_smoother
|
||||
use amg_s_as_smoother
|
||||
use amg_s_diag_solver
|
||||
use amg_s_l1_diag_solver
|
||||
use amg_s_jac_solver
|
||||
use amg_s_ilu_solver
|
||||
use amg_s_id_solver
|
||||
use amg_s_gs_solver
|
||||
@@ -79,6 +82,8 @@ subroutine amg_s_base_onelev_csetc(lv,what,val,info,pos,idx)
|
||||
type(amg_s_as_smoother_type) :: amg_s_as_smoother_mold
|
||||
type(amg_s_diag_solver_type) :: amg_s_diag_solver_mold
|
||||
type(amg_s_l1_diag_solver_type) :: amg_s_l1_diag_solver_mold
|
||||
type(amg_s_jac_solver_type) :: amg_s_jac_solver_mold
|
||||
type(amg_s_l1_jac_solver_type) :: amg_s_l1_jac_solver_mold
|
||||
type(amg_s_ilu_solver_type) :: amg_s_ilu_solver_mold
|
||||
type(amg_s_id_solver_type) :: amg_s_id_solver_mold
|
||||
type(amg_s_gs_solver_type) :: amg_s_gs_solver_mold
|
||||
@@ -189,8 +194,13 @@ subroutine amg_s_base_onelev_csetc(lv,what,val,info,pos,idx)
|
||||
case ('DIAG')
|
||||
call lv%set(amg_s_diag_solver_mold,info,pos=pos)
|
||||
|
||||
case ('JACOBI')
|
||||
call lv%set(amg_s_jac_solver_mold,info,pos=pos)
|
||||
|
||||
case ('L1-DIAG')
|
||||
call lv%set(amg_s_l1_diag_solver_mold,info,pos=pos)
|
||||
case ('L1-JACOBI')
|
||||
call lv%set(amg_s_l1_jac_solver_mold,info,pos=pos)
|
||||
|
||||
case ('GS','FGS','FWGS')
|
||||
call lv%set(amg_s_gs_solver_mold,info,pos=pos)
|
||||
@@ -239,19 +249,29 @@ subroutine amg_s_base_onelev_csetc(lv,what,val,info,pos,idx)
|
||||
if (info == 0) deallocate(lv%aggr,stat=info)
|
||||
if (info /= 0) then
|
||||
info = psb_err_internal_error_
|
||||
call psb_errpush(info,name,a_err='aggregator deallocation?')
|
||||
goto 9999
|
||||
return
|
||||
end if
|
||||
end if
|
||||
|
||||
select case(val)
|
||||
case('DEC')
|
||||
case('DEC','DECOUPLED')
|
||||
allocate(amg_s_dec_aggregator_type :: lv%aggr, stat=info)
|
||||
case('SYMDEC')
|
||||
allocate(amg_s_symdec_aggregator_type :: lv%aggr, stat=info)
|
||||
#if !defined(SERIAL_MPI)
|
||||
case('COUP','COUPLED')
|
||||
allocate(amg_s_parmatch_aggregator_type :: lv%aggr, stat=info)
|
||||
case default
|
||||
#endif
|
||||
case default
|
||||
info = psb_err_internal_error_
|
||||
#if !defined(SERIAL_MPI)
|
||||
call psb_errpush(info,name,a_err='Unsupported PAR_AGGR_ALG')
|
||||
#else
|
||||
call psb_errpush(info,name,a_err='PAR_AGGR_ALG unsupported (SERIAL_MPI on)')
|
||||
#endif
|
||||
goto 9999
|
||||
end select
|
||||
if (info == psb_success_) call lv%aggr%default()
|
||||
|
||||
|
||||
@@ -42,10 +42,13 @@ subroutine amg_z_base_onelev_csetc(lv,what,val,info,pos,idx)
|
||||
use amg_z_base_aggregator_mod
|
||||
use amg_z_dec_aggregator_mod
|
||||
use amg_z_symdec_aggregator_mod
|
||||
#if !defined(SERIAL_MPI)
|
||||
#endif
|
||||
use amg_z_jac_smoother
|
||||
use amg_z_as_smoother
|
||||
use amg_z_diag_solver
|
||||
use amg_z_l1_diag_solver
|
||||
use amg_z_jac_solver
|
||||
use amg_z_ilu_solver
|
||||
use amg_z_id_solver
|
||||
use amg_z_gs_solver
|
||||
@@ -84,6 +87,8 @@ subroutine amg_z_base_onelev_csetc(lv,what,val,info,pos,idx)
|
||||
type(amg_z_as_smoother_type) :: amg_z_as_smoother_mold
|
||||
type(amg_z_diag_solver_type) :: amg_z_diag_solver_mold
|
||||
type(amg_z_l1_diag_solver_type) :: amg_z_l1_diag_solver_mold
|
||||
type(amg_z_jac_solver_type) :: amg_z_jac_solver_mold
|
||||
type(amg_z_l1_jac_solver_type) :: amg_z_l1_jac_solver_mold
|
||||
type(amg_z_ilu_solver_type) :: amg_z_ilu_solver_mold
|
||||
type(amg_z_id_solver_type) :: amg_z_id_solver_mold
|
||||
type(amg_z_gs_solver_type) :: amg_z_gs_solver_mold
|
||||
@@ -200,8 +205,13 @@ subroutine amg_z_base_onelev_csetc(lv,what,val,info,pos,idx)
|
||||
case ('DIAG')
|
||||
call lv%set(amg_z_diag_solver_mold,info,pos=pos)
|
||||
|
||||
case ('JACOBI')
|
||||
call lv%set(amg_z_jac_solver_mold,info,pos=pos)
|
||||
|
||||
case ('L1-DIAG')
|
||||
call lv%set(amg_z_l1_diag_solver_mold,info,pos=pos)
|
||||
case ('L1-JACOBI')
|
||||
call lv%set(amg_z_l1_jac_solver_mold,info,pos=pos)
|
||||
|
||||
case ('GS','FGS','FWGS')
|
||||
call lv%set(amg_z_gs_solver_mold,info,pos=pos)
|
||||
@@ -258,17 +268,27 @@ subroutine amg_z_base_onelev_csetc(lv,what,val,info,pos,idx)
|
||||
if (info == 0) deallocate(lv%aggr,stat=info)
|
||||
if (info /= 0) then
|
||||
info = psb_err_internal_error_
|
||||
call psb_errpush(info,name,a_err='aggregator deallocation?')
|
||||
goto 9999
|
||||
return
|
||||
end if
|
||||
end if
|
||||
|
||||
select case(val)
|
||||
case('DEC')
|
||||
case('DEC','DECOUPLED')
|
||||
allocate(amg_z_dec_aggregator_type :: lv%aggr, stat=info)
|
||||
case('SYMDEC')
|
||||
allocate(amg_z_symdec_aggregator_type :: lv%aggr, stat=info)
|
||||
case default
|
||||
#if !defined(SERIAL_MPI)
|
||||
#endif
|
||||
case default
|
||||
info = psb_err_internal_error_
|
||||
#if !defined(SERIAL_MPI)
|
||||
call psb_errpush(info,name,a_err='Unsupported PAR_AGGR_ALG')
|
||||
#else
|
||||
call psb_errpush(info,name,a_err='PAR_AGGR_ALG unsupported (SERIAL_MPI on)')
|
||||
#endif
|
||||
goto 9999
|
||||
end select
|
||||
if (info == psb_success_) call lv%aggr%default()
|
||||
|
||||
|
||||
@@ -302,7 +302,43 @@ amg_z_invk_solver_clone.o \
|
||||
amg_z_invk_solver_clone_settings.o \
|
||||
amg_z_invk_solver_cseti.o \
|
||||
amg_z_invk_solver_descr.o \
|
||||
amg_z_krm_solver_impl.o
|
||||
amg_z_krm_solver_impl.o \
|
||||
amg_c_jac_solver_clone_settings.o \
|
||||
amg_c_jac_solver_clear_data.o \
|
||||
amg_c_jac_solver_cnv.o \
|
||||
amg_c_jac_solver_clone.o \
|
||||
amg_c_jac_solver_dmp.o \
|
||||
amg_c_jac_solver_apply_vect.o \
|
||||
amg_c_jac_solver_apply.o \
|
||||
amg_c_jac_solver_bld.o \
|
||||
amg_c_l1_jac_solver_bld.o \
|
||||
amg_z_jac_solver_clone_settings.o \
|
||||
amg_z_jac_solver_clear_data.o \
|
||||
amg_z_jac_solver_cnv.o \
|
||||
amg_z_jac_solver_clone.o \
|
||||
amg_z_jac_solver_dmp.o \
|
||||
amg_z_jac_solver_apply_vect.o \
|
||||
amg_z_jac_solver_apply.o \
|
||||
amg_z_jac_solver_bld.o \
|
||||
amg_z_l1_jac_solver_bld.o \
|
||||
amg_s_jac_solver_clone_settings.o \
|
||||
amg_s_jac_solver_clear_data.o \
|
||||
amg_s_jac_solver_cnv.o \
|
||||
amg_s_jac_solver_clone.o \
|
||||
amg_s_jac_solver_dmp.o \
|
||||
amg_s_jac_solver_apply_vect.o \
|
||||
amg_s_jac_solver_apply.o \
|
||||
amg_s_jac_solver_bld.o \
|
||||
amg_s_l1_jac_solver_bld.o \
|
||||
amg_d_jac_solver_clone_settings.o \
|
||||
amg_d_jac_solver_clear_data.o \
|
||||
amg_d_jac_solver_cnv.o \
|
||||
amg_d_jac_solver_clone.o \
|
||||
amg_d_jac_solver_dmp.o \
|
||||
amg_d_jac_solver_apply_vect.o \
|
||||
amg_d_jac_solver_apply.o \
|
||||
amg_d_jac_solver_bld.o \
|
||||
amg_d_l1_jac_solver_bld.o
|
||||
|
||||
LIBNAME=libamg_prec.a
|
||||
|
||||
|
||||
@@ -47,7 +47,6 @@ subroutine amg_c_base_ainv_solver_cnv(sv,info,amold,vmold,imold)
|
||||
class(psb_i_base_vect_type), intent(in), optional :: imold
|
||||
|
||||
!local
|
||||
integer(psb_ipk_) :: i, j, il1, iln, lname, lev
|
||||
integer(psb_ipk_) :: iam, np
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
character(len=80) :: prefix_
|
||||
|
||||
@@ -132,8 +132,7 @@ subroutine amg_c_l1_diag_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
class(psb_i_base_vect_type), intent(in), optional :: imold
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: n_row,n_col, nrow_a, nztota
|
||||
complex(psb_spk_), pointer :: ww(:), aux(:), tx(:),ty(:)
|
||||
complex(psb_spk_), allocatable :: tdb(:)
|
||||
complex(psb_spk_), allocatable :: tdb(:), tx(:), ty(:)
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: np, me, i, err_act, debug_unit, debug_level
|
||||
character(len=20) :: name='c_l1_diag_solver_bld', ch_err
|
||||
@@ -151,12 +150,15 @@ subroutine amg_c_l1_diag_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
n_row = desc_a%get_local_rows()
|
||||
nrow_a = a%get_nrows()
|
||||
|
||||
tx = a%get_diag(info)
|
||||
sv%d = a%arwsum(info)
|
||||
sv%d(:) = sv%d(:) - abs(tx(:)) + tx(:)
|
||||
if (info == psb_success_) call psb_realloc(n_row,sv%d,info)
|
||||
if (present(b)) then
|
||||
tdb=b%arwsum(info)
|
||||
ty =b%get_diag(info)
|
||||
if (size(tdb)+nrow_a > n_row) call psb_realloc(nrow_a+size(tdb),sv%d,info)
|
||||
if (info == psb_success_) sv%d(nrow_a+1:nrow_a+size(tdb)) = tdb(:)
|
||||
if (info == psb_success_) sv%d(nrow_a+1:nrow_a+size(tdb)) = tdb(:) - abs(ty(:)) + ty(:)
|
||||
end if
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='arwsum')
|
||||
|
||||
@@ -0,0 +1,352 @@
|
||||
!
|
||||
!
|
||||
! 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 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_c_jac_solver_apply(alpha,sv,x,beta,y,desc_data,trans,&
|
||||
& work,info,init,initu)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_c_diag_solver
|
||||
use psb_base_krylov_conv_mod, only : log_conv
|
||||
use amg_c_jac_solver, amg_protect_name => amg_c_jac_solver_apply
|
||||
implicit none
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(amg_c_jac_solver_type), intent(inout) :: sv
|
||||
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
|
||||
character, intent(in), optional :: init
|
||||
complex(psb_spk_),intent(inout), optional :: initu(:)
|
||||
!
|
||||
integer(psb_ipk_) :: n_row,n_col, sweeps
|
||||
complex(psb_spk_), pointer :: aux(:)
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: np, me, i, err_act
|
||||
character :: trans_, init_
|
||||
real(psb_dpk_) :: res, resdenum
|
||||
character(len=20) :: name='c_jac_solver_apply_v'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
info = psb_success_
|
||||
ctxt = desc_data%get_context()
|
||||
call psb_info(ctxt,me,np)
|
||||
|
||||
|
||||
if (present(init)) then
|
||||
init_ = psb_toupper(init)
|
||||
else
|
||||
init_='Z'
|
||||
end if
|
||||
|
||||
trans_ = psb_toupper(trans)
|
||||
select case(trans_)
|
||||
case('N')
|
||||
case('T','C')
|
||||
case default
|
||||
call psb_errpush(psb_err_iarg_invalid_i_,name)
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
|
||||
|
||||
n_row = desc_data%get_local_rows()
|
||||
n_col = desc_data%get_local_cols()
|
||||
sweeps = sv%sweeps
|
||||
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='complex(psb_spk_)')
|
||||
goto 9999
|
||||
end if
|
||||
endif
|
||||
|
||||
if (sweeps >= 0) then
|
||||
!
|
||||
! This means we are dealing with a pure Jacobi smoother/solver.
|
||||
!
|
||||
associate(tx => aux(1:n_col), ty => aux(n_col+1:2*n_col))
|
||||
select case (init_)
|
||||
case('Z')
|
||||
|
||||
call inner_mlt(n_row,cone,sv%dv%v%v,x,czero,ty,trans=trans_)
|
||||
|
||||
case('Y')
|
||||
call psb_geaxpby(cone,x,czero,tx,desc_data,info)
|
||||
call psb_geaxpby(cone,y,czero,ty,desc_data,info)
|
||||
call psb_spmm(-cone,sv%a,ty,cone,tx,desc_data,info,&
|
||||
& work=aux,trans=trans_, doswap=.false.)
|
||||
call inner_mlt(n_row,cone,sv%dv%v%v,tx,czero,ty,trans=trans_)
|
||||
|
||||
case('U')
|
||||
if (.not.present(initu)) then
|
||||
call psb_errpush(psb_err_internal_error_,name,&
|
||||
& a_err='missing initu to smoother_apply')
|
||||
goto 9999
|
||||
end if
|
||||
call psb_geaxpby(cone,x,czero,tx,desc_data,info)
|
||||
call psb_geaxpby(cone,initu,czero,ty,desc_data,info)
|
||||
call psb_spmm(-cone,sv%a,ty,cone,tx,desc_data,info,&
|
||||
& work=aux,trans=trans_, doswap=.false.)
|
||||
call inner_mlt(n_row,cone,sv%dv%v%v,tx,czero,ty,trans=trans_)
|
||||
|
||||
case default
|
||||
call psb_errpush(psb_err_internal_error_,name,&
|
||||
& a_err='wrong init to smoother_apply')
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
do i=1, sweeps-1
|
||||
!
|
||||
! Compute Y(j+1) = Y(j)+ D^(-1)*(X-A*Y(j)),
|
||||
! where is the diagonal and A the matrix.
|
||||
!
|
||||
call psb_geaxpby(cone,x,czero,tx,desc_data,info)
|
||||
call psb_spmm(-cone,sv%a,ty,cone,tx,desc_data,info,&
|
||||
& work=aux,trans=trans_, doswap=.false.)
|
||||
if (info /= psb_success_) exit
|
||||
call inner_mlt(n_row,cone,sv%dv%v%v,tx,cone,ty,trans=trans_)
|
||||
if (info /= psb_success_) exit
|
||||
end do
|
||||
|
||||
if (info == psb_success_) call psb_geaxpby(alpha,ty,beta,y,desc_data,info)
|
||||
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name,&
|
||||
& a_err='subsolve with Jacobi sweeps > 1')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
|
||||
end associate
|
||||
|
||||
|
||||
else
|
||||
|
||||
info = psb_err_iarg_neg_
|
||||
call psb_errpush(info,name,&
|
||||
& i_err=(/itwo,sweeps,izero,izero,izero/))
|
||||
goto 9999
|
||||
|
||||
end if
|
||||
|
||||
if (.not.(4*n_col <= size(work))) then
|
||||
deallocate(aux)
|
||||
endif
|
||||
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
|
||||
return
|
||||
contains
|
||||
subroutine inner_mlt(n_row,alpha,d,x,beta,y,trans)
|
||||
implicit none
|
||||
integer(psb_ipk_),intent(in) :: n_row
|
||||
complex(psb_spk_), intent(inout) :: d(:)
|
||||
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
|
||||
|
||||
integer(psb_ipk_) :: i
|
||||
|
||||
if (trans_ == 'C') then
|
||||
if (beta == czero) then
|
||||
|
||||
if (alpha == czero) then
|
||||
y(1:n_row) = czero
|
||||
else if (alpha == cone) then
|
||||
do i=1, n_row
|
||||
y(i) = conjg(d(i)) * x(i)
|
||||
end do
|
||||
else if (alpha == -cone) then
|
||||
do i=1, n_row
|
||||
y(i) = -conjg(d(i)) * x(i)
|
||||
end do
|
||||
else
|
||||
do i=1, n_row
|
||||
y(i) = alpha * conjg(d(i)) * x(i)
|
||||
end do
|
||||
end if
|
||||
|
||||
else if (beta == cone) then
|
||||
|
||||
if (alpha == czero) then
|
||||
!y(1:n_row) = czero
|
||||
else if (alpha == cone) then
|
||||
do i=1, n_row
|
||||
y(i) = conjg(d(i)) * x(i) + y(i)
|
||||
end do
|
||||
else if (alpha == -cone) then
|
||||
do i=1, n_row
|
||||
y(i) = -conjg(d(i)) * x(i) + y(i)
|
||||
end do
|
||||
else
|
||||
do i=1, n_row
|
||||
y(i) = alpha * conjg(d(i)) * x(i) + y(i)
|
||||
end do
|
||||
end if
|
||||
|
||||
else if (beta == -cone) then
|
||||
|
||||
if (alpha == czero) then
|
||||
y(1:n_row) = -y(1:n_row)
|
||||
else if (alpha == cone) then
|
||||
do i=1, n_row
|
||||
y(i) = conjg(d(i)) * x(i) - y(i)
|
||||
end do
|
||||
else if (alpha == -cone) then
|
||||
do i=1, n_row
|
||||
y(i) = -conjg(d(i)) * x(i) - y(i)
|
||||
end do
|
||||
else
|
||||
do i=1, n_row
|
||||
y(i) = alpha * conjg(d(i)) * x(i) - y(i)
|
||||
end do
|
||||
end if
|
||||
|
||||
else
|
||||
|
||||
if (alpha == czero) then
|
||||
y(1:n_row) = beta *y(1:n_row)
|
||||
else if (alpha == cone) then
|
||||
do i=1, n_row
|
||||
y(i) = conjg(d(i)) * x(i) + beta*y(i)
|
||||
end do
|
||||
else if (alpha == -cone) then
|
||||
do i=1, n_row
|
||||
y(i) = -conjg(d(i)) * x(i) + beta*y(i)
|
||||
end do
|
||||
else
|
||||
do i=1, n_row
|
||||
y(i) = alpha * conjg(d(i)) * x(i) + beta*y(i)
|
||||
end do
|
||||
end if
|
||||
|
||||
end if
|
||||
|
||||
else if (trans_ /= 'C') then
|
||||
|
||||
if (beta == czero) then
|
||||
|
||||
if (alpha == czero) then
|
||||
y(1:n_row) = czero
|
||||
else if (alpha == cone) then
|
||||
do i=1, n_row
|
||||
y(i) = d(i) * x(i)
|
||||
end do
|
||||
else if (alpha == -cone) then
|
||||
do i=1, n_row
|
||||
y(i) = -d(i) * x(i)
|
||||
end do
|
||||
else
|
||||
do i=1, n_row
|
||||
y(i) = alpha * d(i) * x(i)
|
||||
end do
|
||||
end if
|
||||
|
||||
else if (beta == cone) then
|
||||
|
||||
if (alpha == czero) then
|
||||
!y(1:n_row) = czero
|
||||
else if (alpha == cone) then
|
||||
do i=1, n_row
|
||||
y(i) = d(i) * x(i) + y(i)
|
||||
end do
|
||||
else if (alpha == -cone) then
|
||||
do i=1, n_row
|
||||
y(i) = -d(i) * x(i) + y(i)
|
||||
end do
|
||||
else
|
||||
do i=1, n_row
|
||||
y(i) = alpha * d(i) * x(i) + y(i)
|
||||
end do
|
||||
end if
|
||||
|
||||
else if (beta == -cone) then
|
||||
|
||||
if (alpha == czero) then
|
||||
y(1:n_row) = -y(1:n_row)
|
||||
else if (alpha == cone) then
|
||||
do i=1, n_row
|
||||
y(i) = d(i) * x(i) - y(i)
|
||||
end do
|
||||
else if (alpha == -cone) then
|
||||
do i=1, n_row
|
||||
y(i) = -d(i) * x(i) - y(i)
|
||||
end do
|
||||
else
|
||||
do i=1, n_row
|
||||
y(i) = alpha * d(i) * x(i) - y(i)
|
||||
end do
|
||||
end if
|
||||
|
||||
else
|
||||
|
||||
if (alpha == czero) then
|
||||
y(1:n_row) = beta *y(1:n_row)
|
||||
else if (alpha == cone) then
|
||||
do i=1, n_row
|
||||
y(i) = d(i) * x(i) + beta*y(i)
|
||||
end do
|
||||
else if (alpha == -cone) then
|
||||
do i=1, n_row
|
||||
y(i) = -d(i) * x(i) + beta*y(i)
|
||||
end do
|
||||
else
|
||||
do i=1, n_row
|
||||
y(i) = alpha * d(i) * x(i) + beta*y(i)
|
||||
end do
|
||||
end if
|
||||
|
||||
end if
|
||||
|
||||
end if
|
||||
|
||||
end subroutine inner_mlt
|
||||
end subroutine amg_c_jac_solver_apply
|
||||
@@ -0,0 +1,190 @@
|
||||
!
|
||||
!
|
||||
! 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 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_c_jac_solver_apply_vect(alpha,sv,x,beta,y,desc_data,trans,&
|
||||
& work,wv,info,init,initu)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_c_diag_solver
|
||||
use psb_base_krylov_conv_mod, only : log_conv
|
||||
use amg_c_jac_solver, amg_protect_name => amg_c_jac_solver_apply_vect
|
||||
implicit none
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(amg_c_jac_solver_type), intent(inout) :: sv
|
||||
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(:)
|
||||
type(psb_c_vect_type),intent(inout) :: wv(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
character, intent(in), optional :: init
|
||||
type(psb_c_vect_type),intent(inout), optional :: initu
|
||||
!
|
||||
integer(psb_ipk_) :: n_row,n_col, sweeps
|
||||
type(psb_c_vect_type) :: tx, ty, r
|
||||
complex(psb_spk_), pointer :: aux(:)
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: np, me, i, err_act
|
||||
character :: trans_, init_
|
||||
real(psb_dpk_) :: res, resdenum
|
||||
character(len=20) :: name='c_jac_solver_apply_v'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
info = psb_success_
|
||||
ctxt = desc_data%get_context()
|
||||
call psb_info(ctxt,me,np)
|
||||
|
||||
|
||||
if (present(init)) then
|
||||
init_ = psb_toupper(init)
|
||||
else
|
||||
init_='Z'
|
||||
end if
|
||||
|
||||
trans_ = psb_toupper(trans)
|
||||
select case(trans_)
|
||||
case('N')
|
||||
case('T','C')
|
||||
case default
|
||||
call psb_errpush(psb_err_iarg_invalid_i_,name)
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
|
||||
|
||||
n_row = desc_data%get_local_rows()
|
||||
n_col = desc_data%get_local_cols()
|
||||
sweeps = sv%sweeps
|
||||
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='complex(psb_spk_)')
|
||||
goto 9999
|
||||
end if
|
||||
endif
|
||||
|
||||
if (sweeps >= 0) then
|
||||
!
|
||||
! This means we are dealing with a pure Jacobi smoother/solver.
|
||||
!
|
||||
associate(tx => wv(1), ty => wv(2))
|
||||
select case (init_)
|
||||
case('Z')
|
||||
|
||||
call ty%mlt(cone,sv%dv,x,czero,info,conjgx=trans_)
|
||||
|
||||
case('Y')
|
||||
call psb_geaxpby(cone,x,czero,tx,desc_data,info)
|
||||
call psb_geaxpby(cone,y,czero,ty,desc_data,info)
|
||||
call psb_spmm(-cone,sv%a,ty,cone,tx,desc_data,info,&
|
||||
& work=aux,trans=trans_, doswap=.false.)
|
||||
call ty%mlt(cone,sv%dv,tx,czero,info,conjgx=trans_)
|
||||
|
||||
case('U')
|
||||
if (.not.present(initu)) then
|
||||
call psb_errpush(psb_err_internal_error_,name,&
|
||||
& a_err='missing initu to smoother_apply')
|
||||
goto 9999
|
||||
end if
|
||||
call psb_geaxpby(cone,x,czero,tx,desc_data,info)
|
||||
call psb_geaxpby(cone,initu,czero,ty,desc_data,info)
|
||||
call psb_spmm(-cone,sv%a,ty,cone,tx,desc_data,info,&
|
||||
& work=aux,trans=trans_, doswap=.false.)
|
||||
call ty%mlt(cone,sv%dv,tx,czero,info,conjgx=trans_)
|
||||
|
||||
case default
|
||||
call psb_errpush(psb_err_internal_error_,name,&
|
||||
& a_err='wrong init to smoother_apply')
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
do i=1, sweeps-1
|
||||
!
|
||||
! Compute Y(j+1) = Y(j)+ D^(-1)*(X-A*Y(j)),
|
||||
! where is the diagonal and A the matrix.
|
||||
!
|
||||
call psb_geaxpby(cone,x,czero,tx,desc_data,info)
|
||||
call psb_spmm(-cone,sv%a,ty,cone,tx,desc_data,info,&
|
||||
& work=aux,trans=trans_, doswap=.false.)
|
||||
if (info /= psb_success_) exit
|
||||
call ty%mlt(cone,sv%dv,tx,cone,info,conjgx=trans_)
|
||||
if (info /= psb_success_) exit
|
||||
end do
|
||||
|
||||
|
||||
if (info == psb_success_) call psb_geaxpby(alpha,ty,beta,y,desc_data,info)
|
||||
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name,&
|
||||
& a_err='subsolve with Jacobi sweeps > 1')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
|
||||
end associate
|
||||
|
||||
|
||||
else
|
||||
|
||||
info = psb_err_iarg_neg_
|
||||
call psb_errpush(info,name,&
|
||||
& i_err=(/itwo,sweeps,izero,izero,izero/))
|
||||
goto 9999
|
||||
|
||||
end if
|
||||
|
||||
if (.not.(4*n_col <= size(work))) then
|
||||
deallocate(aux)
|
||||
endif
|
||||
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine amg_c_jac_solver_apply_vect
|
||||
@@ -0,0 +1,125 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! 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 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_c_jac_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_c_jac_solver, amg_protect_name => amg_c_jac_solver_bld
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
type(psb_cspmat_type), intent(in), target :: a
|
||||
Type(psb_desc_type), Intent(inout) :: desc_a
|
||||
class(amg_c_jac_solver_type), intent(inout) :: sv
|
||||
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
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: n_row,n_col, nrow_a, nztota
|
||||
complex(psb_spk_), pointer :: ww(:), aux(:), tx(:),ty(:)
|
||||
complex(psb_spk_), allocatable :: tdb(:)
|
||||
type(psb_c_csr_sparse_mat) :: tcsr
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: np, me, i, err_act, debug_unit, debug_level
|
||||
character(len=20) :: name='c_jac_solver_bld', ch_err
|
||||
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
ctxt = desc_a%get_context()
|
||||
call psb_info(ctxt, me, np)
|
||||
if (debug_level >= psb_debug_outer_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),' start'
|
||||
|
||||
|
||||
n_row = desc_a%get_local_rows()
|
||||
nrow_a = a%get_nrows()
|
||||
if (present(b)) then
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
call a%cp_to(tcsr)
|
||||
call sv%a%mv_from(tcsr)
|
||||
if (present(amold)) call sv%a%cscnv(info,mold=amold)
|
||||
|
||||
sv%d = a%get_diag(info)
|
||||
if (info == psb_success_) call psb_realloc(n_row,sv%d,info)
|
||||
if (present(b)) then
|
||||
tdb=b%get_diag(info)
|
||||
if (size(tdb)+nrow_a > n_row) call psb_realloc(nrow_a+size(tdb),sv%d,info)
|
||||
if (info == psb_success_) sv%d(nrow_a+1:nrow_a+size(tdb)) = tdb(:)
|
||||
end if
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='get_diag')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
do i=1,n_row
|
||||
if (sv%d(i) == czero) then
|
||||
sv%d(i) = cone
|
||||
else
|
||||
sv%d(i) = cone/sv%d(i)
|
||||
end if
|
||||
end do
|
||||
allocate(sv%dv,stat=info)
|
||||
if (info == psb_success_) then
|
||||
call sv%dv%bld(sv%d)
|
||||
if (present(vmold)) call sv%dv%cnv(vmold)
|
||||
call sv%dv%sync()
|
||||
else
|
||||
call psb_errpush(psb_err_from_subroutine_,name,&
|
||||
& a_err='Allocate sv%dv')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
if (debug_level >= psb_debug_outer_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),' end'
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
|
||||
return
|
||||
end subroutine amg_c_jac_solver_bld
|
||||
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! 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 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_c_jac_solver_clear_data(sv,info)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_c_jac_solver, amg_protect_name => amg_c_jac_solver_clear_data
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_jac_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: err_act
|
||||
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
call sv%a%free()
|
||||
call sv%dv%free(info)
|
||||
if ((info==0).and.allocated(sv%d)) deallocate(sv%d,stat=info)
|
||||
if (info /= 0) goto 9999
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
|
||||
return
|
||||
end subroutine amg_c_jac_solver_clear_data
|
||||
@@ -0,0 +1,88 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! 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 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_c_jac_solver_clone(sv,svout,info)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_c_jac_solver, amg_protect_name => amg_c_jac_solver_clone
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_jac_solver_type), intent(inout) :: sv
|
||||
class(amg_c_base_solver_type), allocatable, intent(inout) :: svout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: err_act
|
||||
|
||||
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
if (allocated(svout)) then
|
||||
call svout%free(info)
|
||||
if (info == psb_success_) deallocate(svout, stat=info)
|
||||
end if
|
||||
if (info == psb_success_) &
|
||||
& allocate(svout, mold=sv, stat=info)
|
||||
if (info /= 0) then
|
||||
info = psb_err_alloc_dealloc_
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
select type(svo => svout)
|
||||
class is (amg_c_jac_solver_type)
|
||||
svo%sweeps = sv%sweeps
|
||||
svo%eps = sv%eps
|
||||
if (info == psb_success_) &
|
||||
& call sv%a%clone(svo%a,info)
|
||||
if (info == psb_success_) &
|
||||
& call sv%dv%clone(svo%dv,info)
|
||||
svo%d = sv%d
|
||||
|
||||
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_c_jac_solver_clone
|
||||
@@ -0,0 +1,69 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! 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 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_c_jac_solver_clone_settings(sv,svout,info)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_c_jac_solver, amg_protect_name => amg_c_jac_solver_clone_settings
|
||||
Implicit None
|
||||
! Arguments
|
||||
class(amg_c_jac_solver_type), intent(inout) :: sv
|
||||
class(amg_c_base_solver_type), intent(inout) :: svout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='c_jac_solver_clone_settings'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select type(svout)
|
||||
class is(amg_c_jac_solver_type)
|
||||
svout%sweeps = sv%sweeps
|
||||
svout%eps = sv%eps
|
||||
|
||||
class default
|
||||
info = psb_err_internal_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
|
||||
return
|
||||
end subroutine amg_c_jac_solver_clone_settings
|
||||
@@ -0,0 +1,72 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! 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 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_c_jac_solver_cnv(sv,info,amold,vmold,imold)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_c_jac_solver, amg_protect_name => amg_c_jac_solver_cnv
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_jac_solver_type), intent(inout) :: sv
|
||||
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
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: err_act, debug_unit, debug_level
|
||||
character(len=20) :: name='c_jac_solver_cnv', ch_err
|
||||
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
|
||||
if (present(amold)) call sv%a%cscnv(info,mold=amold)
|
||||
if ((info==0).and.present(vmold)) call sv%dv%cnv(mold=vmold)
|
||||
|
||||
if (debug_level >= psb_debug_outer_) &
|
||||
& write(debug_unit,*) trim(name),' end'
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
|
||||
return
|
||||
end subroutine amg_c_jac_solver_cnv
|
||||
@@ -0,0 +1,107 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! 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 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_c_jac_solver_dmp(sv,desc,level,info,prefix,head,solver,global_num)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_c_jac_solver, amg_protect_name => amg_c_jac_solver_dmp
|
||||
implicit none
|
||||
class(amg_c_jac_solver_type), intent(in) :: sv
|
||||
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) :: solver, global_num
|
||||
integer(psb_ipk_) :: i, j, il1, iln, lname, lev
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: iam, np
|
||||
character(len=80) :: prefix_
|
||||
character(len=120) :: fname ! len should be at least 20 more than
|
||||
logical :: solver_, global_num_
|
||||
integer(psb_lpk_), allocatable :: iv(:)
|
||||
! len of prefix_
|
||||
|
||||
info = 0
|
||||
|
||||
ctxt = desc%get_context()
|
||||
call psb_info(ctxt,iam,np)
|
||||
|
||||
if (present(solver)) then
|
||||
solver_ = solver
|
||||
else
|
||||
solver_ = .false.
|
||||
end if
|
||||
if (present(global_num)) then
|
||||
global_num_ = global_num
|
||||
else
|
||||
global_num_ = .false.
|
||||
end if
|
||||
|
||||
|
||||
if (solver_) then
|
||||
if (present(prefix)) then
|
||||
prefix_ = trim(prefix(1:min(len(prefix),len(prefix_))))
|
||||
else
|
||||
prefix_ = "dump_slv_c"
|
||||
end if
|
||||
lname = len_trim(prefix_)
|
||||
fname = trim(prefix_)
|
||||
write(fname(lname+1:lname+5),'(a,i3.3)') '_p',iam
|
||||
lname = lname + 5
|
||||
|
||||
if (global_num_) then
|
||||
iv = desc%get_global_indices(owned=.false.)
|
||||
|
||||
write(fname(lname+1:),'(a,i3.3,a)')'_l',level,'_nd.mtx'
|
||||
if (sv%a%is_asb()) &
|
||||
& call sv%a%print(fname,head=head,iv=iv)
|
||||
write(fname(lname+1:),'(a,i3.3,a)')'_l',level,'_diag.mtx'
|
||||
if (allocated(sv%dv)) &
|
||||
& call psb_geprt(fname,sv%dv%v%v,head=head)
|
||||
|
||||
else
|
||||
|
||||
write(fname(lname+1:),'(a,i3.3,a)')'_l',level,'_nd.mtx'
|
||||
if (sv%a%is_asb()) &
|
||||
& call sv%a%print(fname,head=head)
|
||||
write(fname(lname+1:),'(a,i3.3,a)')'_l',level,'_diag.mtx'
|
||||
if (allocated(sv%dv)) &
|
||||
& call psb_geprt(fname,sv%dv%v%v,head=head)
|
||||
end if
|
||||
end if
|
||||
|
||||
end subroutine amg_c_jac_solver_dmp
|
||||
@@ -0,0 +1,128 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! 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 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_c_l1_jac_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_c_jac_solver, amg_protect_name => amg_c_l1_jac_solver_bld
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
type(psb_cspmat_type), intent(in), target :: a
|
||||
Type(psb_desc_type), Intent(inout) :: desc_a
|
||||
class(amg_c_l1_jac_solver_type), intent(inout) :: sv
|
||||
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
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: n_row,n_col, nrow_a, nztota
|
||||
complex(psb_spk_), allocatable :: tdb(:), tx(:),ty(:)
|
||||
type(psb_c_csr_sparse_mat) :: tcsr
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: np, me, i, err_act, debug_unit, debug_level
|
||||
character(len=20) :: name='c_l1_jac_solver_bld', ch_err
|
||||
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
ctxt = desc_a%get_context()
|
||||
call psb_info(ctxt, me, np)
|
||||
if (debug_level >= psb_debug_outer_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),' start'
|
||||
|
||||
|
||||
n_row = desc_a%get_local_rows()
|
||||
nrow_a = a%get_nrows()
|
||||
if (present(b)) then
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
call a%cp_to(tcsr)
|
||||
call sv%a%mv_from(tcsr)
|
||||
if (present(amold)) call sv%a%cscnv(info,mold=amold)
|
||||
|
||||
tx = a%get_diag(info)
|
||||
sv%d = a%arwsum(info)
|
||||
sv%d(:) = sv%d(:) - abs(tx(:)) + tx(:)
|
||||
if (info == psb_success_) call psb_realloc(n_row,sv%d,info)
|
||||
if (present(b)) then
|
||||
tdb=b%arwsum(info)
|
||||
ty =b%get_diag(info)
|
||||
if (size(tdb)+nrow_a > n_row) call psb_realloc(nrow_a+size(tdb),sv%d,info)
|
||||
if (info == psb_success_) sv%d(nrow_a+1:nrow_a+size(tdb)) = tdb(:) - abs(ty(:)) + ty(:)
|
||||
end if
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='get_diag')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
do i=1,n_row
|
||||
if (sv%d(i) == czero) then
|
||||
sv%d(i) = cone
|
||||
else
|
||||
sv%d(i) = cone/sv%d(i)
|
||||
end if
|
||||
end do
|
||||
allocate(sv%dv,stat=info)
|
||||
if (info == psb_success_) then
|
||||
call sv%dv%bld(sv%d)
|
||||
if (present(vmold)) call sv%dv%cnv(vmold)
|
||||
call sv%dv%sync()
|
||||
else
|
||||
call psb_errpush(psb_err_from_subroutine_,name,&
|
||||
& a_err='Allocate sv%dv')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
if (debug_level >= psb_debug_outer_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),' end'
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
|
||||
return
|
||||
end subroutine amg_c_l1_jac_solver_bld
|
||||
|
||||
|
||||
@@ -47,7 +47,6 @@ subroutine amg_d_base_ainv_solver_cnv(sv,info,amold,vmold,imold)
|
||||
class(psb_i_base_vect_type), intent(in), optional :: imold
|
||||
|
||||
!local
|
||||
integer(psb_ipk_) :: i, j, il1, iln, lname, lev
|
||||
integer(psb_ipk_) :: iam, np
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
character(len=80) :: prefix_
|
||||
|
||||
@@ -132,8 +132,7 @@ subroutine amg_d_l1_diag_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
class(psb_i_base_vect_type), intent(in), optional :: imold
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: n_row,n_col, nrow_a, nztota
|
||||
real(psb_dpk_), pointer :: ww(:), aux(:), tx(:),ty(:)
|
||||
real(psb_dpk_), allocatable :: tdb(:)
|
||||
real(psb_dpk_), allocatable :: tdb(:), tx(:), ty(:)
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: np, me, i, err_act, debug_unit, debug_level
|
||||
character(len=20) :: name='d_l1_diag_solver_bld', ch_err
|
||||
@@ -151,12 +150,15 @@ subroutine amg_d_l1_diag_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
n_row = desc_a%get_local_rows()
|
||||
nrow_a = a%get_nrows()
|
||||
|
||||
tx = a%get_diag(info)
|
||||
sv%d = a%arwsum(info)
|
||||
sv%d(:) = sv%d(:) - abs(tx(:)) + tx(:)
|
||||
if (info == psb_success_) call psb_realloc(n_row,sv%d,info)
|
||||
if (present(b)) then
|
||||
tdb=b%arwsum(info)
|
||||
ty =b%get_diag(info)
|
||||
if (size(tdb)+nrow_a > n_row) call psb_realloc(nrow_a+size(tdb),sv%d,info)
|
||||
if (info == psb_success_) sv%d(nrow_a+1:nrow_a+size(tdb)) = tdb(:)
|
||||
if (info == psb_success_) sv%d(nrow_a+1:nrow_a+size(tdb)) = tdb(:) - abs(ty(:)) + ty(:)
|
||||
end if
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='arwsum')
|
||||
|
||||
@@ -0,0 +1,352 @@
|
||||
!
|
||||
!
|
||||
! 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 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_d_jac_solver_apply(alpha,sv,x,beta,y,desc_data,trans,&
|
||||
& work,info,init,initu)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_diag_solver
|
||||
use psb_base_krylov_conv_mod, only : log_conv
|
||||
use amg_d_jac_solver, amg_protect_name => amg_d_jac_solver_apply
|
||||
implicit none
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(amg_d_jac_solver_type), intent(inout) :: sv
|
||||
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
|
||||
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_row,n_col, sweeps
|
||||
real(psb_dpk_), pointer :: aux(:)
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: np, me, i, err_act
|
||||
character :: trans_, init_
|
||||
real(psb_dpk_) :: res, resdenum
|
||||
character(len=20) :: name='d_jac_solver_apply_v'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
info = psb_success_
|
||||
ctxt = desc_data%get_context()
|
||||
call psb_info(ctxt,me,np)
|
||||
|
||||
|
||||
if (present(init)) then
|
||||
init_ = psb_toupper(init)
|
||||
else
|
||||
init_='Z'
|
||||
end if
|
||||
|
||||
trans_ = psb_toupper(trans)
|
||||
select case(trans_)
|
||||
case('N')
|
||||
case('T','C')
|
||||
case default
|
||||
call psb_errpush(psb_err_iarg_invalid_i_,name)
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
|
||||
|
||||
n_row = desc_data%get_local_rows()
|
||||
n_col = desc_data%get_local_cols()
|
||||
sweeps = sv%sweeps
|
||||
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
|
||||
endif
|
||||
|
||||
if (sweeps >= 0) then
|
||||
!
|
||||
! This means we are dealing with a pure Jacobi smoother/solver.
|
||||
!
|
||||
associate(tx => aux(1:n_col), ty => aux(n_col+1:2*n_col))
|
||||
select case (init_)
|
||||
case('Z')
|
||||
|
||||
call inner_mlt(n_row,done,sv%dv%v%v,x,dzero,ty,trans=trans_)
|
||||
|
||||
case('Y')
|
||||
call psb_geaxpby(done,x,dzero,tx,desc_data,info)
|
||||
call psb_geaxpby(done,y,dzero,ty,desc_data,info)
|
||||
call psb_spmm(-done,sv%a,ty,done,tx,desc_data,info,&
|
||||
& work=aux,trans=trans_, doswap=.false.)
|
||||
call inner_mlt(n_row,done,sv%dv%v%v,tx,dzero,ty,trans=trans_)
|
||||
|
||||
case('U')
|
||||
if (.not.present(initu)) then
|
||||
call psb_errpush(psb_err_internal_error_,name,&
|
||||
& a_err='missing initu to smoother_apply')
|
||||
goto 9999
|
||||
end if
|
||||
call psb_geaxpby(done,x,dzero,tx,desc_data,info)
|
||||
call psb_geaxpby(done,initu,dzero,ty,desc_data,info)
|
||||
call psb_spmm(-done,sv%a,ty,done,tx,desc_data,info,&
|
||||
& work=aux,trans=trans_, doswap=.false.)
|
||||
call inner_mlt(n_row,done,sv%dv%v%v,tx,dzero,ty,trans=trans_)
|
||||
|
||||
case default
|
||||
call psb_errpush(psb_err_internal_error_,name,&
|
||||
& a_err='wrong init to smoother_apply')
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
do i=1, sweeps-1
|
||||
!
|
||||
! Compute Y(j+1) = Y(j)+ D^(-1)*(X-A*Y(j)),
|
||||
! where is the diagonal and A the matrix.
|
||||
!
|
||||
call psb_geaxpby(done,x,dzero,tx,desc_data,info)
|
||||
call psb_spmm(-done,sv%a,ty,done,tx,desc_data,info,&
|
||||
& work=aux,trans=trans_, doswap=.false.)
|
||||
if (info /= psb_success_) exit
|
||||
call inner_mlt(n_row,done,sv%dv%v%v,tx,done,ty,trans=trans_)
|
||||
if (info /= psb_success_) exit
|
||||
end do
|
||||
|
||||
if (info == psb_success_) call psb_geaxpby(alpha,ty,beta,y,desc_data,info)
|
||||
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name,&
|
||||
& a_err='subsolve with Jacobi sweeps > 1')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
|
||||
end associate
|
||||
|
||||
|
||||
else
|
||||
|
||||
info = psb_err_iarg_neg_
|
||||
call psb_errpush(info,name,&
|
||||
& i_err=(/itwo,sweeps,izero,izero,izero/))
|
||||
goto 9999
|
||||
|
||||
end if
|
||||
|
||||
if (.not.(4*n_col <= size(work))) then
|
||||
deallocate(aux)
|
||||
endif
|
||||
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
|
||||
return
|
||||
contains
|
||||
subroutine inner_mlt(n_row,alpha,d,x,beta,y,trans)
|
||||
implicit none
|
||||
integer(psb_ipk_),intent(in) :: n_row
|
||||
real(psb_dpk_), intent(inout) :: d(:)
|
||||
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_) :: i
|
||||
|
||||
if (trans_ == 'C') then
|
||||
if (beta == dzero) then
|
||||
|
||||
if (alpha == dzero) then
|
||||
y(1:n_row) = dzero
|
||||
else if (alpha == done) then
|
||||
do i=1, n_row
|
||||
y(i) = (d(i)) * x(i)
|
||||
end do
|
||||
else if (alpha == -done) then
|
||||
do i=1, n_row
|
||||
y(i) = -(d(i)) * x(i)
|
||||
end do
|
||||
else
|
||||
do i=1, n_row
|
||||
y(i) = alpha * (d(i)) * x(i)
|
||||
end do
|
||||
end if
|
||||
|
||||
else if (beta == done) then
|
||||
|
||||
if (alpha == dzero) then
|
||||
!y(1:n_row) = dzero
|
||||
else if (alpha == done) then
|
||||
do i=1, n_row
|
||||
y(i) = (d(i)) * x(i) + y(i)
|
||||
end do
|
||||
else if (alpha == -done) then
|
||||
do i=1, n_row
|
||||
y(i) = -(d(i)) * x(i) + y(i)
|
||||
end do
|
||||
else
|
||||
do i=1, n_row
|
||||
y(i) = alpha * (d(i)) * x(i) + y(i)
|
||||
end do
|
||||
end if
|
||||
|
||||
else if (beta == -done) then
|
||||
|
||||
if (alpha == dzero) then
|
||||
y(1:n_row) = -y(1:n_row)
|
||||
else if (alpha == done) then
|
||||
do i=1, n_row
|
||||
y(i) = (d(i)) * x(i) - y(i)
|
||||
end do
|
||||
else if (alpha == -done) then
|
||||
do i=1, n_row
|
||||
y(i) = -(d(i)) * x(i) - y(i)
|
||||
end do
|
||||
else
|
||||
do i=1, n_row
|
||||
y(i) = alpha * (d(i)) * x(i) - y(i)
|
||||
end do
|
||||
end if
|
||||
|
||||
else
|
||||
|
||||
if (alpha == dzero) then
|
||||
y(1:n_row) = beta *y(1:n_row)
|
||||
else if (alpha == done) then
|
||||
do i=1, n_row
|
||||
y(i) = (d(i)) * x(i) + beta*y(i)
|
||||
end do
|
||||
else if (alpha == -done) then
|
||||
do i=1, n_row
|
||||
y(i) = -(d(i)) * x(i) + beta*y(i)
|
||||
end do
|
||||
else
|
||||
do i=1, n_row
|
||||
y(i) = alpha * (d(i)) * x(i) + beta*y(i)
|
||||
end do
|
||||
end if
|
||||
|
||||
end if
|
||||
|
||||
else if (trans_ /= 'C') then
|
||||
|
||||
if (beta == dzero) then
|
||||
|
||||
if (alpha == dzero) then
|
||||
y(1:n_row) = dzero
|
||||
else if (alpha == done) then
|
||||
do i=1, n_row
|
||||
y(i) = d(i) * x(i)
|
||||
end do
|
||||
else if (alpha == -done) then
|
||||
do i=1, n_row
|
||||
y(i) = -d(i) * x(i)
|
||||
end do
|
||||
else
|
||||
do i=1, n_row
|
||||
y(i) = alpha * d(i) * x(i)
|
||||
end do
|
||||
end if
|
||||
|
||||
else if (beta == done) then
|
||||
|
||||
if (alpha == dzero) then
|
||||
!y(1:n_row) = dzero
|
||||
else if (alpha == done) then
|
||||
do i=1, n_row
|
||||
y(i) = d(i) * x(i) + y(i)
|
||||
end do
|
||||
else if (alpha == -done) then
|
||||
do i=1, n_row
|
||||
y(i) = -d(i) * x(i) + y(i)
|
||||
end do
|
||||
else
|
||||
do i=1, n_row
|
||||
y(i) = alpha * d(i) * x(i) + y(i)
|
||||
end do
|
||||
end if
|
||||
|
||||
else if (beta == -done) then
|
||||
|
||||
if (alpha == dzero) then
|
||||
y(1:n_row) = -y(1:n_row)
|
||||
else if (alpha == done) then
|
||||
do i=1, n_row
|
||||
y(i) = d(i) * x(i) - y(i)
|
||||
end do
|
||||
else if (alpha == -done) then
|
||||
do i=1, n_row
|
||||
y(i) = -d(i) * x(i) - y(i)
|
||||
end do
|
||||
else
|
||||
do i=1, n_row
|
||||
y(i) = alpha * d(i) * x(i) - y(i)
|
||||
end do
|
||||
end if
|
||||
|
||||
else
|
||||
|
||||
if (alpha == dzero) then
|
||||
y(1:n_row) = beta *y(1:n_row)
|
||||
else if (alpha == done) then
|
||||
do i=1, n_row
|
||||
y(i) = d(i) * x(i) + beta*y(i)
|
||||
end do
|
||||
else if (alpha == -done) then
|
||||
do i=1, n_row
|
||||
y(i) = -d(i) * x(i) + beta*y(i)
|
||||
end do
|
||||
else
|
||||
do i=1, n_row
|
||||
y(i) = alpha * d(i) * x(i) + beta*y(i)
|
||||
end do
|
||||
end if
|
||||
|
||||
end if
|
||||
|
||||
end if
|
||||
|
||||
end subroutine inner_mlt
|
||||
end subroutine amg_d_jac_solver_apply
|
||||
@@ -0,0 +1,190 @@
|
||||
!
|
||||
!
|
||||
! 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 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_d_jac_solver_apply_vect(alpha,sv,x,beta,y,desc_data,trans,&
|
||||
& work,wv,info,init,initu)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_diag_solver
|
||||
use psb_base_krylov_conv_mod, only : log_conv
|
||||
use amg_d_jac_solver, amg_protect_name => amg_d_jac_solver_apply_vect
|
||||
implicit none
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(amg_d_jac_solver_type), intent(inout) :: sv
|
||||
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
|
||||
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_row,n_col, sweeps
|
||||
type(psb_d_vect_type) :: tx, ty, r
|
||||
real(psb_dpk_), pointer :: aux(:)
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: np, me, i, err_act
|
||||
character :: trans_, init_
|
||||
real(psb_dpk_) :: res, resdenum
|
||||
character(len=20) :: name='d_jac_solver_apply_v'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
info = psb_success_
|
||||
ctxt = desc_data%get_context()
|
||||
call psb_info(ctxt,me,np)
|
||||
|
||||
|
||||
if (present(init)) then
|
||||
init_ = psb_toupper(init)
|
||||
else
|
||||
init_='Z'
|
||||
end if
|
||||
|
||||
trans_ = psb_toupper(trans)
|
||||
select case(trans_)
|
||||
case('N')
|
||||
case('T','C')
|
||||
case default
|
||||
call psb_errpush(psb_err_iarg_invalid_i_,name)
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
|
||||
|
||||
n_row = desc_data%get_local_rows()
|
||||
n_col = desc_data%get_local_cols()
|
||||
sweeps = sv%sweeps
|
||||
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
|
||||
endif
|
||||
|
||||
if (sweeps >= 0) then
|
||||
!
|
||||
! This means we are dealing with a pure Jacobi smoother/solver.
|
||||
!
|
||||
associate(tx => wv(1), ty => wv(2))
|
||||
select case (init_)
|
||||
case('Z')
|
||||
|
||||
call ty%mlt(done,sv%dv,x,dzero,info,conjgx=trans_)
|
||||
|
||||
case('Y')
|
||||
call psb_geaxpby(done,x,dzero,tx,desc_data,info)
|
||||
call psb_geaxpby(done,y,dzero,ty,desc_data,info)
|
||||
call psb_spmm(-done,sv%a,ty,done,tx,desc_data,info,&
|
||||
& work=aux,trans=trans_, doswap=.false.)
|
||||
call ty%mlt(done,sv%dv,tx,dzero,info,conjgx=trans_)
|
||||
|
||||
case('U')
|
||||
if (.not.present(initu)) then
|
||||
call psb_errpush(psb_err_internal_error_,name,&
|
||||
& a_err='missing initu to smoother_apply')
|
||||
goto 9999
|
||||
end if
|
||||
call psb_geaxpby(done,x,dzero,tx,desc_data,info)
|
||||
call psb_geaxpby(done,initu,dzero,ty,desc_data,info)
|
||||
call psb_spmm(-done,sv%a,ty,done,tx,desc_data,info,&
|
||||
& work=aux,trans=trans_, doswap=.false.)
|
||||
call ty%mlt(done,sv%dv,tx,dzero,info,conjgx=trans_)
|
||||
|
||||
case default
|
||||
call psb_errpush(psb_err_internal_error_,name,&
|
||||
& a_err='wrong init to smoother_apply')
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
do i=1, sweeps-1
|
||||
!
|
||||
! Compute Y(j+1) = Y(j)+ D^(-1)*(X-A*Y(j)),
|
||||
! where is the diagonal and A the matrix.
|
||||
!
|
||||
call psb_geaxpby(done,x,dzero,tx,desc_data,info)
|
||||
call psb_spmm(-done,sv%a,ty,done,tx,desc_data,info,&
|
||||
& work=aux,trans=trans_, doswap=.false.)
|
||||
if (info /= psb_success_) exit
|
||||
call ty%mlt(done,sv%dv,tx,done,info,conjgx=trans_)
|
||||
if (info /= psb_success_) exit
|
||||
end do
|
||||
|
||||
|
||||
if (info == psb_success_) call psb_geaxpby(alpha,ty,beta,y,desc_data,info)
|
||||
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name,&
|
||||
& a_err='subsolve with Jacobi sweeps > 1')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
|
||||
end associate
|
||||
|
||||
|
||||
else
|
||||
|
||||
info = psb_err_iarg_neg_
|
||||
call psb_errpush(info,name,&
|
||||
& i_err=(/itwo,sweeps,izero,izero,izero/))
|
||||
goto 9999
|
||||
|
||||
end if
|
||||
|
||||
if (.not.(4*n_col <= size(work))) then
|
||||
deallocate(aux)
|
||||
endif
|
||||
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine amg_d_jac_solver_apply_vect
|
||||
@@ -0,0 +1,125 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! 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 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_d_jac_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_jac_solver, amg_protect_name => amg_d_jac_solver_bld
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
type(psb_dspmat_type), intent(in), target :: a
|
||||
Type(psb_desc_type), Intent(inout) :: desc_a
|
||||
class(amg_d_jac_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
type(psb_dspmat_type), intent(in), target, optional :: b
|
||||
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
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: n_row,n_col, nrow_a, nztota
|
||||
real(psb_dpk_), pointer :: ww(:), aux(:), tx(:),ty(:)
|
||||
real(psb_dpk_), allocatable :: tdb(:)
|
||||
type(psb_d_csr_sparse_mat) :: tcsr
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: np, me, i, err_act, debug_unit, debug_level
|
||||
character(len=20) :: name='d_jac_solver_bld', ch_err
|
||||
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
ctxt = desc_a%get_context()
|
||||
call psb_info(ctxt, me, np)
|
||||
if (debug_level >= psb_debug_outer_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),' start'
|
||||
|
||||
|
||||
n_row = desc_a%get_local_rows()
|
||||
nrow_a = a%get_nrows()
|
||||
if (present(b)) then
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
call a%cp_to(tcsr)
|
||||
call sv%a%mv_from(tcsr)
|
||||
if (present(amold)) call sv%a%cscnv(info,mold=amold)
|
||||
|
||||
sv%d = a%get_diag(info)
|
||||
if (info == psb_success_) call psb_realloc(n_row,sv%d,info)
|
||||
if (present(b)) then
|
||||
tdb=b%get_diag(info)
|
||||
if (size(tdb)+nrow_a > n_row) call psb_realloc(nrow_a+size(tdb),sv%d,info)
|
||||
if (info == psb_success_) sv%d(nrow_a+1:nrow_a+size(tdb)) = tdb(:)
|
||||
end if
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='get_diag')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
do i=1,n_row
|
||||
if (sv%d(i) == dzero) then
|
||||
sv%d(i) = done
|
||||
else
|
||||
sv%d(i) = done/sv%d(i)
|
||||
end if
|
||||
end do
|
||||
allocate(sv%dv,stat=info)
|
||||
if (info == psb_success_) then
|
||||
call sv%dv%bld(sv%d)
|
||||
if (present(vmold)) call sv%dv%cnv(vmold)
|
||||
call sv%dv%sync()
|
||||
else
|
||||
call psb_errpush(psb_err_from_subroutine_,name,&
|
||||
& a_err='Allocate sv%dv')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
if (debug_level >= psb_debug_outer_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),' end'
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
|
||||
return
|
||||
end subroutine amg_d_jac_solver_bld
|
||||
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! 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 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_d_jac_solver_clear_data(sv,info)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_jac_solver, amg_protect_name => amg_d_jac_solver_clear_data
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_jac_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: err_act
|
||||
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
call sv%a%free()
|
||||
call sv%dv%free(info)
|
||||
if ((info==0).and.allocated(sv%d)) deallocate(sv%d,stat=info)
|
||||
if (info /= 0) goto 9999
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
|
||||
return
|
||||
end subroutine amg_d_jac_solver_clear_data
|
||||
@@ -0,0 +1,88 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! 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 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_d_jac_solver_clone(sv,svout,info)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_jac_solver, amg_protect_name => amg_d_jac_solver_clone
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_jac_solver_type), intent(inout) :: sv
|
||||
class(amg_d_base_solver_type), allocatable, intent(inout) :: svout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: err_act
|
||||
|
||||
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
if (allocated(svout)) then
|
||||
call svout%free(info)
|
||||
if (info == psb_success_) deallocate(svout, stat=info)
|
||||
end if
|
||||
if (info == psb_success_) &
|
||||
& allocate(svout, mold=sv, stat=info)
|
||||
if (info /= 0) then
|
||||
info = psb_err_alloc_dealloc_
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
select type(svo => svout)
|
||||
class is (amg_d_jac_solver_type)
|
||||
svo%sweeps = sv%sweeps
|
||||
svo%eps = sv%eps
|
||||
if (info == psb_success_) &
|
||||
& call sv%a%clone(svo%a,info)
|
||||
if (info == psb_success_) &
|
||||
& call sv%dv%clone(svo%dv,info)
|
||||
svo%d = sv%d
|
||||
|
||||
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_jac_solver_clone
|
||||
@@ -0,0 +1,69 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! 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 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_d_jac_solver_clone_settings(sv,svout,info)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_jac_solver, amg_protect_name => amg_d_jac_solver_clone_settings
|
||||
Implicit None
|
||||
! Arguments
|
||||
class(amg_d_jac_solver_type), intent(inout) :: sv
|
||||
class(amg_d_base_solver_type), intent(inout) :: svout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='d_jac_solver_clone_settings'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select type(svout)
|
||||
class is(amg_d_jac_solver_type)
|
||||
svout%sweeps = sv%sweeps
|
||||
svout%eps = sv%eps
|
||||
|
||||
class default
|
||||
info = psb_err_internal_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
|
||||
return
|
||||
end subroutine amg_d_jac_solver_clone_settings
|
||||
@@ -0,0 +1,72 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! 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 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_d_jac_solver_cnv(sv,info,amold,vmold,imold)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_jac_solver, amg_protect_name => amg_d_jac_solver_cnv
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_jac_solver_type), intent(inout) :: sv
|
||||
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
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: err_act, debug_unit, debug_level
|
||||
character(len=20) :: name='d_jac_solver_cnv', ch_err
|
||||
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
|
||||
if (present(amold)) call sv%a%cscnv(info,mold=amold)
|
||||
if ((info==0).and.present(vmold)) call sv%dv%cnv(mold=vmold)
|
||||
|
||||
if (debug_level >= psb_debug_outer_) &
|
||||
& write(debug_unit,*) trim(name),' end'
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
|
||||
return
|
||||
end subroutine amg_d_jac_solver_cnv
|
||||
@@ -0,0 +1,107 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! 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 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_d_jac_solver_dmp(sv,desc,level,info,prefix,head,solver,global_num)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_jac_solver, amg_protect_name => amg_d_jac_solver_dmp
|
||||
implicit none
|
||||
class(amg_d_jac_solver_type), intent(in) :: sv
|
||||
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) :: solver, global_num
|
||||
integer(psb_ipk_) :: i, j, il1, iln, lname, lev
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: iam, np
|
||||
character(len=80) :: prefix_
|
||||
character(len=120) :: fname ! len should be at least 20 more than
|
||||
logical :: solver_, global_num_
|
||||
integer(psb_lpk_), allocatable :: iv(:)
|
||||
! len of prefix_
|
||||
|
||||
info = 0
|
||||
|
||||
ctxt = desc%get_context()
|
||||
call psb_info(ctxt,iam,np)
|
||||
|
||||
if (present(solver)) then
|
||||
solver_ = solver
|
||||
else
|
||||
solver_ = .false.
|
||||
end if
|
||||
if (present(global_num)) then
|
||||
global_num_ = global_num
|
||||
else
|
||||
global_num_ = .false.
|
||||
end if
|
||||
|
||||
|
||||
if (solver_) then
|
||||
if (present(prefix)) then
|
||||
prefix_ = trim(prefix(1:min(len(prefix),len(prefix_))))
|
||||
else
|
||||
prefix_ = "dump_slv_d"
|
||||
end if
|
||||
lname = len_trim(prefix_)
|
||||
fname = trim(prefix_)
|
||||
write(fname(lname+1:lname+5),'(a,i3.3)') '_p',iam
|
||||
lname = lname + 5
|
||||
|
||||
if (global_num_) then
|
||||
iv = desc%get_global_indices(owned=.false.)
|
||||
|
||||
write(fname(lname+1:),'(a,i3.3,a)')'_l',level,'_nd.mtx'
|
||||
if (sv%a%is_asb()) &
|
||||
& call sv%a%print(fname,head=head,iv=iv)
|
||||
write(fname(lname+1:),'(a,i3.3,a)')'_l',level,'_diag.mtx'
|
||||
if (allocated(sv%dv)) &
|
||||
& call psb_geprt(fname,sv%dv%v%v,head=head)
|
||||
|
||||
else
|
||||
|
||||
write(fname(lname+1:),'(a,i3.3,a)')'_l',level,'_nd.mtx'
|
||||
if (sv%a%is_asb()) &
|
||||
& call sv%a%print(fname,head=head)
|
||||
write(fname(lname+1:),'(a,i3.3,a)')'_l',level,'_diag.mtx'
|
||||
if (allocated(sv%dv)) &
|
||||
& call psb_geprt(fname,sv%dv%v%v,head=head)
|
||||
end if
|
||||
end if
|
||||
|
||||
end subroutine amg_d_jac_solver_dmp
|
||||
@@ -0,0 +1,128 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! 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 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_d_l1_jac_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_jac_solver, amg_protect_name => amg_d_l1_jac_solver_bld
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
type(psb_dspmat_type), intent(in), target :: a
|
||||
Type(psb_desc_type), Intent(inout) :: desc_a
|
||||
class(amg_d_l1_jac_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
type(psb_dspmat_type), intent(in), target, optional :: b
|
||||
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
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: n_row,n_col, nrow_a, nztota
|
||||
real(psb_dpk_), allocatable :: tdb(:), tx(:),ty(:)
|
||||
type(psb_d_csr_sparse_mat) :: tcsr
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: np, me, i, err_act, debug_unit, debug_level
|
||||
character(len=20) :: name='d_l1_jac_solver_bld', ch_err
|
||||
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
ctxt = desc_a%get_context()
|
||||
call psb_info(ctxt, me, np)
|
||||
if (debug_level >= psb_debug_outer_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),' start'
|
||||
|
||||
|
||||
n_row = desc_a%get_local_rows()
|
||||
nrow_a = a%get_nrows()
|
||||
if (present(b)) then
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
call a%cp_to(tcsr)
|
||||
call sv%a%mv_from(tcsr)
|
||||
if (present(amold)) call sv%a%cscnv(info,mold=amold)
|
||||
|
||||
tx = a%get_diag(info)
|
||||
sv%d = a%arwsum(info)
|
||||
sv%d(:) = sv%d(:) - abs(tx(:)) + tx(:)
|
||||
if (info == psb_success_) call psb_realloc(n_row,sv%d,info)
|
||||
if (present(b)) then
|
||||
tdb=b%arwsum(info)
|
||||
ty =b%get_diag(info)
|
||||
if (size(tdb)+nrow_a > n_row) call psb_realloc(nrow_a+size(tdb),sv%d,info)
|
||||
if (info == psb_success_) sv%d(nrow_a+1:nrow_a+size(tdb)) = tdb(:) - abs(ty(:)) + ty(:)
|
||||
end if
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='get_diag')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
do i=1,n_row
|
||||
if (sv%d(i) == dzero) then
|
||||
sv%d(i) = done
|
||||
else
|
||||
sv%d(i) = done/sv%d(i)
|
||||
end if
|
||||
end do
|
||||
allocate(sv%dv,stat=info)
|
||||
if (info == psb_success_) then
|
||||
call sv%dv%bld(sv%d)
|
||||
if (present(vmold)) call sv%dv%cnv(vmold)
|
||||
call sv%dv%sync()
|
||||
else
|
||||
call psb_errpush(psb_err_from_subroutine_,name,&
|
||||
& a_err='Allocate sv%dv')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
if (debug_level >= psb_debug_outer_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),' end'
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
|
||||
return
|
||||
end subroutine amg_d_l1_jac_solver_bld
|
||||
|
||||
|
||||
@@ -47,7 +47,6 @@ subroutine amg_s_base_ainv_solver_cnv(sv,info,amold,vmold,imold)
|
||||
class(psb_i_base_vect_type), intent(in), optional :: imold
|
||||
|
||||
!local
|
||||
integer(psb_ipk_) :: i, j, il1, iln, lname, lev
|
||||
integer(psb_ipk_) :: iam, np
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
character(len=80) :: prefix_
|
||||
|
||||
@@ -132,8 +132,7 @@ subroutine amg_s_l1_diag_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
class(psb_i_base_vect_type), intent(in), optional :: imold
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: n_row,n_col, nrow_a, nztota
|
||||
real(psb_spk_), pointer :: ww(:), aux(:), tx(:),ty(:)
|
||||
real(psb_spk_), allocatable :: tdb(:)
|
||||
real(psb_spk_), allocatable :: tdb(:), tx(:), ty(:)
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: np, me, i, err_act, debug_unit, debug_level
|
||||
character(len=20) :: name='s_l1_diag_solver_bld', ch_err
|
||||
@@ -151,12 +150,15 @@ subroutine amg_s_l1_diag_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
n_row = desc_a%get_local_rows()
|
||||
nrow_a = a%get_nrows()
|
||||
|
||||
tx = a%get_diag(info)
|
||||
sv%d = a%arwsum(info)
|
||||
sv%d(:) = sv%d(:) - abs(tx(:)) + tx(:)
|
||||
if (info == psb_success_) call psb_realloc(n_row,sv%d,info)
|
||||
if (present(b)) then
|
||||
tdb=b%arwsum(info)
|
||||
ty =b%get_diag(info)
|
||||
if (size(tdb)+nrow_a > n_row) call psb_realloc(nrow_a+size(tdb),sv%d,info)
|
||||
if (info == psb_success_) sv%d(nrow_a+1:nrow_a+size(tdb)) = tdb(:)
|
||||
if (info == psb_success_) sv%d(nrow_a+1:nrow_a+size(tdb)) = tdb(:) - abs(ty(:)) + ty(:)
|
||||
end if
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='arwsum')
|
||||
|
||||
@@ -0,0 +1,352 @@
|
||||
!
|
||||
!
|
||||
! 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 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_s_jac_solver_apply(alpha,sv,x,beta,y,desc_data,trans,&
|
||||
& work,info,init,initu)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_s_diag_solver
|
||||
use psb_base_krylov_conv_mod, only : log_conv
|
||||
use amg_s_jac_solver, amg_protect_name => amg_s_jac_solver_apply
|
||||
implicit none
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(amg_s_jac_solver_type), intent(inout) :: sv
|
||||
real(psb_spk_),intent(inout) :: x(:)
|
||||
real(psb_spk_),intent(inout) :: y(:)
|
||||
real(psb_spk_),intent(in) :: alpha,beta
|
||||
character(len=1),intent(in) :: trans
|
||||
real(psb_spk_),target, intent(inout) :: work(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
character, intent(in), optional :: init
|
||||
real(psb_spk_),intent(inout), optional :: initu(:)
|
||||
!
|
||||
integer(psb_ipk_) :: n_row,n_col, sweeps
|
||||
real(psb_spk_), pointer :: aux(:)
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: np, me, i, err_act
|
||||
character :: trans_, init_
|
||||
real(psb_dpk_) :: res, resdenum
|
||||
character(len=20) :: name='s_jac_solver_apply_v'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
info = psb_success_
|
||||
ctxt = desc_data%get_context()
|
||||
call psb_info(ctxt,me,np)
|
||||
|
||||
|
||||
if (present(init)) then
|
||||
init_ = psb_toupper(init)
|
||||
else
|
||||
init_='Z'
|
||||
end if
|
||||
|
||||
trans_ = psb_toupper(trans)
|
||||
select case(trans_)
|
||||
case('N')
|
||||
case('T','C')
|
||||
case default
|
||||
call psb_errpush(psb_err_iarg_invalid_i_,name)
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
|
||||
|
||||
n_row = desc_data%get_local_rows()
|
||||
n_col = desc_data%get_local_cols()
|
||||
sweeps = sv%sweeps
|
||||
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_spk_)')
|
||||
goto 9999
|
||||
end if
|
||||
endif
|
||||
|
||||
if (sweeps >= 0) then
|
||||
!
|
||||
! This means we are dealing with a pure Jacobi smoother/solver.
|
||||
!
|
||||
associate(tx => aux(1:n_col), ty => aux(n_col+1:2*n_col))
|
||||
select case (init_)
|
||||
case('Z')
|
||||
|
||||
call inner_mlt(n_row,sone,sv%dv%v%v,x,szero,ty,trans=trans_)
|
||||
|
||||
case('Y')
|
||||
call psb_geaxpby(sone,x,szero,tx,desc_data,info)
|
||||
call psb_geaxpby(sone,y,szero,ty,desc_data,info)
|
||||
call psb_spmm(-sone,sv%a,ty,sone,tx,desc_data,info,&
|
||||
& work=aux,trans=trans_, doswap=.false.)
|
||||
call inner_mlt(n_row,sone,sv%dv%v%v,tx,szero,ty,trans=trans_)
|
||||
|
||||
case('U')
|
||||
if (.not.present(initu)) then
|
||||
call psb_errpush(psb_err_internal_error_,name,&
|
||||
& a_err='missing initu to smoother_apply')
|
||||
goto 9999
|
||||
end if
|
||||
call psb_geaxpby(sone,x,szero,tx,desc_data,info)
|
||||
call psb_geaxpby(sone,initu,szero,ty,desc_data,info)
|
||||
call psb_spmm(-sone,sv%a,ty,sone,tx,desc_data,info,&
|
||||
& work=aux,trans=trans_, doswap=.false.)
|
||||
call inner_mlt(n_row,sone,sv%dv%v%v,tx,szero,ty,trans=trans_)
|
||||
|
||||
case default
|
||||
call psb_errpush(psb_err_internal_error_,name,&
|
||||
& a_err='wrong init to smoother_apply')
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
do i=1, sweeps-1
|
||||
!
|
||||
! Compute Y(j+1) = Y(j)+ D^(-1)*(X-A*Y(j)),
|
||||
! where is the diagonal and A the matrix.
|
||||
!
|
||||
call psb_geaxpby(sone,x,szero,tx,desc_data,info)
|
||||
call psb_spmm(-sone,sv%a,ty,sone,tx,desc_data,info,&
|
||||
& work=aux,trans=trans_, doswap=.false.)
|
||||
if (info /= psb_success_) exit
|
||||
call inner_mlt(n_row,sone,sv%dv%v%v,tx,sone,ty,trans=trans_)
|
||||
if (info /= psb_success_) exit
|
||||
end do
|
||||
|
||||
if (info == psb_success_) call psb_geaxpby(alpha,ty,beta,y,desc_data,info)
|
||||
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name,&
|
||||
& a_err='subsolve with Jacobi sweeps > 1')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
|
||||
end associate
|
||||
|
||||
|
||||
else
|
||||
|
||||
info = psb_err_iarg_neg_
|
||||
call psb_errpush(info,name,&
|
||||
& i_err=(/itwo,sweeps,izero,izero,izero/))
|
||||
goto 9999
|
||||
|
||||
end if
|
||||
|
||||
if (.not.(4*n_col <= size(work))) then
|
||||
deallocate(aux)
|
||||
endif
|
||||
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
|
||||
return
|
||||
contains
|
||||
subroutine inner_mlt(n_row,alpha,d,x,beta,y,trans)
|
||||
implicit none
|
||||
integer(psb_ipk_),intent(in) :: n_row
|
||||
real(psb_spk_), intent(inout) :: d(:)
|
||||
real(psb_spk_),intent(inout) :: x(:)
|
||||
real(psb_spk_),intent(inout) :: y(:)
|
||||
real(psb_spk_),intent(in) :: alpha,beta
|
||||
character(len=1),intent(in) :: trans
|
||||
|
||||
integer(psb_ipk_) :: i
|
||||
|
||||
if (trans_ == 'C') then
|
||||
if (beta == szero) then
|
||||
|
||||
if (alpha == szero) then
|
||||
y(1:n_row) = szero
|
||||
else if (alpha == sone) then
|
||||
do i=1, n_row
|
||||
y(i) = (d(i)) * x(i)
|
||||
end do
|
||||
else if (alpha == -sone) then
|
||||
do i=1, n_row
|
||||
y(i) = -(d(i)) * x(i)
|
||||
end do
|
||||
else
|
||||
do i=1, n_row
|
||||
y(i) = alpha * (d(i)) * x(i)
|
||||
end do
|
||||
end if
|
||||
|
||||
else if (beta == sone) then
|
||||
|
||||
if (alpha == szero) then
|
||||
!y(1:n_row) = szero
|
||||
else if (alpha == sone) then
|
||||
do i=1, n_row
|
||||
y(i) = (d(i)) * x(i) + y(i)
|
||||
end do
|
||||
else if (alpha == -sone) then
|
||||
do i=1, n_row
|
||||
y(i) = -(d(i)) * x(i) + y(i)
|
||||
end do
|
||||
else
|
||||
do i=1, n_row
|
||||
y(i) = alpha * (d(i)) * x(i) + y(i)
|
||||
end do
|
||||
end if
|
||||
|
||||
else if (beta == -sone) then
|
||||
|
||||
if (alpha == szero) then
|
||||
y(1:n_row) = -y(1:n_row)
|
||||
else if (alpha == sone) then
|
||||
do i=1, n_row
|
||||
y(i) = (d(i)) * x(i) - y(i)
|
||||
end do
|
||||
else if (alpha == -sone) then
|
||||
do i=1, n_row
|
||||
y(i) = -(d(i)) * x(i) - y(i)
|
||||
end do
|
||||
else
|
||||
do i=1, n_row
|
||||
y(i) = alpha * (d(i)) * x(i) - y(i)
|
||||
end do
|
||||
end if
|
||||
|
||||
else
|
||||
|
||||
if (alpha == szero) then
|
||||
y(1:n_row) = beta *y(1:n_row)
|
||||
else if (alpha == sone) then
|
||||
do i=1, n_row
|
||||
y(i) = (d(i)) * x(i) + beta*y(i)
|
||||
end do
|
||||
else if (alpha == -sone) then
|
||||
do i=1, n_row
|
||||
y(i) = -(d(i)) * x(i) + beta*y(i)
|
||||
end do
|
||||
else
|
||||
do i=1, n_row
|
||||
y(i) = alpha * (d(i)) * x(i) + beta*y(i)
|
||||
end do
|
||||
end if
|
||||
|
||||
end if
|
||||
|
||||
else if (trans_ /= 'C') then
|
||||
|
||||
if (beta == szero) then
|
||||
|
||||
if (alpha == szero) then
|
||||
y(1:n_row) = szero
|
||||
else if (alpha == sone) then
|
||||
do i=1, n_row
|
||||
y(i) = d(i) * x(i)
|
||||
end do
|
||||
else if (alpha == -sone) then
|
||||
do i=1, n_row
|
||||
y(i) = -d(i) * x(i)
|
||||
end do
|
||||
else
|
||||
do i=1, n_row
|
||||
y(i) = alpha * d(i) * x(i)
|
||||
end do
|
||||
end if
|
||||
|
||||
else if (beta == sone) then
|
||||
|
||||
if (alpha == szero) then
|
||||
!y(1:n_row) = szero
|
||||
else if (alpha == sone) then
|
||||
do i=1, n_row
|
||||
y(i) = d(i) * x(i) + y(i)
|
||||
end do
|
||||
else if (alpha == -sone) then
|
||||
do i=1, n_row
|
||||
y(i) = -d(i) * x(i) + y(i)
|
||||
end do
|
||||
else
|
||||
do i=1, n_row
|
||||
y(i) = alpha * d(i) * x(i) + y(i)
|
||||
end do
|
||||
end if
|
||||
|
||||
else if (beta == -sone) then
|
||||
|
||||
if (alpha == szero) then
|
||||
y(1:n_row) = -y(1:n_row)
|
||||
else if (alpha == sone) then
|
||||
do i=1, n_row
|
||||
y(i) = d(i) * x(i) - y(i)
|
||||
end do
|
||||
else if (alpha == -sone) then
|
||||
do i=1, n_row
|
||||
y(i) = -d(i) * x(i) - y(i)
|
||||
end do
|
||||
else
|
||||
do i=1, n_row
|
||||
y(i) = alpha * d(i) * x(i) - y(i)
|
||||
end do
|
||||
end if
|
||||
|
||||
else
|
||||
|
||||
if (alpha == szero) then
|
||||
y(1:n_row) = beta *y(1:n_row)
|
||||
else if (alpha == sone) then
|
||||
do i=1, n_row
|
||||
y(i) = d(i) * x(i) + beta*y(i)
|
||||
end do
|
||||
else if (alpha == -sone) then
|
||||
do i=1, n_row
|
||||
y(i) = -d(i) * x(i) + beta*y(i)
|
||||
end do
|
||||
else
|
||||
do i=1, n_row
|
||||
y(i) = alpha * d(i) * x(i) + beta*y(i)
|
||||
end do
|
||||
end if
|
||||
|
||||
end if
|
||||
|
||||
end if
|
||||
|
||||
end subroutine inner_mlt
|
||||
end subroutine amg_s_jac_solver_apply
|
||||
@@ -0,0 +1,190 @@
|
||||
!
|
||||
!
|
||||
! 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 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_s_jac_solver_apply_vect(alpha,sv,x,beta,y,desc_data,trans,&
|
||||
& work,wv,info,init,initu)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_s_diag_solver
|
||||
use psb_base_krylov_conv_mod, only : log_conv
|
||||
use amg_s_jac_solver, amg_protect_name => amg_s_jac_solver_apply_vect
|
||||
implicit none
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(amg_s_jac_solver_type), intent(inout) :: sv
|
||||
type(psb_s_vect_type),intent(inout) :: x
|
||||
type(psb_s_vect_type),intent(inout) :: y
|
||||
real(psb_spk_),intent(in) :: alpha,beta
|
||||
character(len=1),intent(in) :: trans
|
||||
real(psb_spk_),target, intent(inout) :: work(:)
|
||||
type(psb_s_vect_type),intent(inout) :: wv(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
character, intent(in), optional :: init
|
||||
type(psb_s_vect_type),intent(inout), optional :: initu
|
||||
!
|
||||
integer(psb_ipk_) :: n_row,n_col, sweeps
|
||||
type(psb_s_vect_type) :: tx, ty, r
|
||||
real(psb_spk_), pointer :: aux(:)
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: np, me, i, err_act
|
||||
character :: trans_, init_
|
||||
real(psb_dpk_) :: res, resdenum
|
||||
character(len=20) :: name='s_jac_solver_apply_v'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
info = psb_success_
|
||||
ctxt = desc_data%get_context()
|
||||
call psb_info(ctxt,me,np)
|
||||
|
||||
|
||||
if (present(init)) then
|
||||
init_ = psb_toupper(init)
|
||||
else
|
||||
init_='Z'
|
||||
end if
|
||||
|
||||
trans_ = psb_toupper(trans)
|
||||
select case(trans_)
|
||||
case('N')
|
||||
case('T','C')
|
||||
case default
|
||||
call psb_errpush(psb_err_iarg_invalid_i_,name)
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
|
||||
|
||||
n_row = desc_data%get_local_rows()
|
||||
n_col = desc_data%get_local_cols()
|
||||
sweeps = sv%sweeps
|
||||
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_spk_)')
|
||||
goto 9999
|
||||
end if
|
||||
endif
|
||||
|
||||
if (sweeps >= 0) then
|
||||
!
|
||||
! This means we are dealing with a pure Jacobi smoother/solver.
|
||||
!
|
||||
associate(tx => wv(1), ty => wv(2))
|
||||
select case (init_)
|
||||
case('Z')
|
||||
|
||||
call ty%mlt(sone,sv%dv,x,szero,info,conjgx=trans_)
|
||||
|
||||
case('Y')
|
||||
call psb_geaxpby(sone,x,szero,tx,desc_data,info)
|
||||
call psb_geaxpby(sone,y,szero,ty,desc_data,info)
|
||||
call psb_spmm(-sone,sv%a,ty,sone,tx,desc_data,info,&
|
||||
& work=aux,trans=trans_, doswap=.false.)
|
||||
call ty%mlt(sone,sv%dv,tx,szero,info,conjgx=trans_)
|
||||
|
||||
case('U')
|
||||
if (.not.present(initu)) then
|
||||
call psb_errpush(psb_err_internal_error_,name,&
|
||||
& a_err='missing initu to smoother_apply')
|
||||
goto 9999
|
||||
end if
|
||||
call psb_geaxpby(sone,x,szero,tx,desc_data,info)
|
||||
call psb_geaxpby(sone,initu,szero,ty,desc_data,info)
|
||||
call psb_spmm(-sone,sv%a,ty,sone,tx,desc_data,info,&
|
||||
& work=aux,trans=trans_, doswap=.false.)
|
||||
call ty%mlt(sone,sv%dv,tx,szero,info,conjgx=trans_)
|
||||
|
||||
case default
|
||||
call psb_errpush(psb_err_internal_error_,name,&
|
||||
& a_err='wrong init to smoother_apply')
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
do i=1, sweeps-1
|
||||
!
|
||||
! Compute Y(j+1) = Y(j)+ D^(-1)*(X-A*Y(j)),
|
||||
! where is the diagonal and A the matrix.
|
||||
!
|
||||
call psb_geaxpby(sone,x,szero,tx,desc_data,info)
|
||||
call psb_spmm(-sone,sv%a,ty,sone,tx,desc_data,info,&
|
||||
& work=aux,trans=trans_, doswap=.false.)
|
||||
if (info /= psb_success_) exit
|
||||
call ty%mlt(sone,sv%dv,tx,sone,info,conjgx=trans_)
|
||||
if (info /= psb_success_) exit
|
||||
end do
|
||||
|
||||
|
||||
if (info == psb_success_) call psb_geaxpby(alpha,ty,beta,y,desc_data,info)
|
||||
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name,&
|
||||
& a_err='subsolve with Jacobi sweeps > 1')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
|
||||
end associate
|
||||
|
||||
|
||||
else
|
||||
|
||||
info = psb_err_iarg_neg_
|
||||
call psb_errpush(info,name,&
|
||||
& i_err=(/itwo,sweeps,izero,izero,izero/))
|
||||
goto 9999
|
||||
|
||||
end if
|
||||
|
||||
if (.not.(4*n_col <= size(work))) then
|
||||
deallocate(aux)
|
||||
endif
|
||||
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine amg_s_jac_solver_apply_vect
|
||||
@@ -0,0 +1,125 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! 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 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_s_jac_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_s_jac_solver, amg_protect_name => amg_s_jac_solver_bld
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
type(psb_sspmat_type), intent(in), target :: a
|
||||
Type(psb_desc_type), Intent(inout) :: desc_a
|
||||
class(amg_s_jac_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
type(psb_sspmat_type), intent(in), target, optional :: b
|
||||
class(psb_s_base_sparse_mat), intent(in), optional :: amold
|
||||
class(psb_s_base_vect_type), intent(in), optional :: vmold
|
||||
class(psb_i_base_vect_type), intent(in), optional :: imold
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: n_row,n_col, nrow_a, nztota
|
||||
real(psb_spk_), pointer :: ww(:), aux(:), tx(:),ty(:)
|
||||
real(psb_spk_), allocatable :: tdb(:)
|
||||
type(psb_s_csr_sparse_mat) :: tcsr
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: np, me, i, err_act, debug_unit, debug_level
|
||||
character(len=20) :: name='s_jac_solver_bld', ch_err
|
||||
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
ctxt = desc_a%get_context()
|
||||
call psb_info(ctxt, me, np)
|
||||
if (debug_level >= psb_debug_outer_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),' start'
|
||||
|
||||
|
||||
n_row = desc_a%get_local_rows()
|
||||
nrow_a = a%get_nrows()
|
||||
if (present(b)) then
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
call a%cp_to(tcsr)
|
||||
call sv%a%mv_from(tcsr)
|
||||
if (present(amold)) call sv%a%cscnv(info,mold=amold)
|
||||
|
||||
sv%d = a%get_diag(info)
|
||||
if (info == psb_success_) call psb_realloc(n_row,sv%d,info)
|
||||
if (present(b)) then
|
||||
tdb=b%get_diag(info)
|
||||
if (size(tdb)+nrow_a > n_row) call psb_realloc(nrow_a+size(tdb),sv%d,info)
|
||||
if (info == psb_success_) sv%d(nrow_a+1:nrow_a+size(tdb)) = tdb(:)
|
||||
end if
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='get_diag')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
do i=1,n_row
|
||||
if (sv%d(i) == szero) then
|
||||
sv%d(i) = sone
|
||||
else
|
||||
sv%d(i) = sone/sv%d(i)
|
||||
end if
|
||||
end do
|
||||
allocate(sv%dv,stat=info)
|
||||
if (info == psb_success_) then
|
||||
call sv%dv%bld(sv%d)
|
||||
if (present(vmold)) call sv%dv%cnv(vmold)
|
||||
call sv%dv%sync()
|
||||
else
|
||||
call psb_errpush(psb_err_from_subroutine_,name,&
|
||||
& a_err='Allocate sv%dv')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
if (debug_level >= psb_debug_outer_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),' end'
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
|
||||
return
|
||||
end subroutine amg_s_jac_solver_bld
|
||||
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! 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 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_s_jac_solver_clear_data(sv,info)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_s_jac_solver, amg_protect_name => amg_s_jac_solver_clear_data
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_s_jac_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: err_act
|
||||
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
call sv%a%free()
|
||||
call sv%dv%free(info)
|
||||
if ((info==0).and.allocated(sv%d)) deallocate(sv%d,stat=info)
|
||||
if (info /= 0) goto 9999
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
|
||||
return
|
||||
end subroutine amg_s_jac_solver_clear_data
|
||||
@@ -0,0 +1,88 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! 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 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_s_jac_solver_clone(sv,svout,info)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_s_jac_solver, amg_protect_name => amg_s_jac_solver_clone
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_s_jac_solver_type), intent(inout) :: sv
|
||||
class(amg_s_base_solver_type), allocatable, intent(inout) :: svout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: err_act
|
||||
|
||||
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
if (allocated(svout)) then
|
||||
call svout%free(info)
|
||||
if (info == psb_success_) deallocate(svout, stat=info)
|
||||
end if
|
||||
if (info == psb_success_) &
|
||||
& allocate(svout, mold=sv, stat=info)
|
||||
if (info /= 0) then
|
||||
info = psb_err_alloc_dealloc_
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
select type(svo => svout)
|
||||
class is (amg_s_jac_solver_type)
|
||||
svo%sweeps = sv%sweeps
|
||||
svo%eps = sv%eps
|
||||
if (info == psb_success_) &
|
||||
& call sv%a%clone(svo%a,info)
|
||||
if (info == psb_success_) &
|
||||
& call sv%dv%clone(svo%dv,info)
|
||||
svo%d = sv%d
|
||||
|
||||
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_s_jac_solver_clone
|
||||
@@ -0,0 +1,69 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! 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 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_s_jac_solver_clone_settings(sv,svout,info)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_s_jac_solver, amg_protect_name => amg_s_jac_solver_clone_settings
|
||||
Implicit None
|
||||
! Arguments
|
||||
class(amg_s_jac_solver_type), intent(inout) :: sv
|
||||
class(amg_s_base_solver_type), intent(inout) :: svout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='s_jac_solver_clone_settings'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select type(svout)
|
||||
class is(amg_s_jac_solver_type)
|
||||
svout%sweeps = sv%sweeps
|
||||
svout%eps = sv%eps
|
||||
|
||||
class default
|
||||
info = psb_err_internal_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
|
||||
return
|
||||
end subroutine amg_s_jac_solver_clone_settings
|
||||
@@ -0,0 +1,72 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! 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 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_s_jac_solver_cnv(sv,info,amold,vmold,imold)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_s_jac_solver, amg_protect_name => amg_s_jac_solver_cnv
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_s_jac_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
class(psb_s_base_sparse_mat), intent(in), optional :: amold
|
||||
class(psb_s_base_vect_type), intent(in), optional :: vmold
|
||||
class(psb_i_base_vect_type), intent(in), optional :: imold
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: err_act, debug_unit, debug_level
|
||||
character(len=20) :: name='s_jac_solver_cnv', ch_err
|
||||
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
|
||||
if (present(amold)) call sv%a%cscnv(info,mold=amold)
|
||||
if ((info==0).and.present(vmold)) call sv%dv%cnv(mold=vmold)
|
||||
|
||||
if (debug_level >= psb_debug_outer_) &
|
||||
& write(debug_unit,*) trim(name),' end'
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
|
||||
return
|
||||
end subroutine amg_s_jac_solver_cnv
|
||||
@@ -0,0 +1,107 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! 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 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_s_jac_solver_dmp(sv,desc,level,info,prefix,head,solver,global_num)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_s_jac_solver, amg_protect_name => amg_s_jac_solver_dmp
|
||||
implicit none
|
||||
class(amg_s_jac_solver_type), intent(in) :: sv
|
||||
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) :: solver, global_num
|
||||
integer(psb_ipk_) :: i, j, il1, iln, lname, lev
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: iam, np
|
||||
character(len=80) :: prefix_
|
||||
character(len=120) :: fname ! len should be at least 20 more than
|
||||
logical :: solver_, global_num_
|
||||
integer(psb_lpk_), allocatable :: iv(:)
|
||||
! len of prefix_
|
||||
|
||||
info = 0
|
||||
|
||||
ctxt = desc%get_context()
|
||||
call psb_info(ctxt,iam,np)
|
||||
|
||||
if (present(solver)) then
|
||||
solver_ = solver
|
||||
else
|
||||
solver_ = .false.
|
||||
end if
|
||||
if (present(global_num)) then
|
||||
global_num_ = global_num
|
||||
else
|
||||
global_num_ = .false.
|
||||
end if
|
||||
|
||||
|
||||
if (solver_) then
|
||||
if (present(prefix)) then
|
||||
prefix_ = trim(prefix(1:min(len(prefix),len(prefix_))))
|
||||
else
|
||||
prefix_ = "dump_slv_s"
|
||||
end if
|
||||
lname = len_trim(prefix_)
|
||||
fname = trim(prefix_)
|
||||
write(fname(lname+1:lname+5),'(a,i3.3)') '_p',iam
|
||||
lname = lname + 5
|
||||
|
||||
if (global_num_) then
|
||||
iv = desc%get_global_indices(owned=.false.)
|
||||
|
||||
write(fname(lname+1:),'(a,i3.3,a)')'_l',level,'_nd.mtx'
|
||||
if (sv%a%is_asb()) &
|
||||
& call sv%a%print(fname,head=head,iv=iv)
|
||||
write(fname(lname+1:),'(a,i3.3,a)')'_l',level,'_diag.mtx'
|
||||
if (allocated(sv%dv)) &
|
||||
& call psb_geprt(fname,sv%dv%v%v,head=head)
|
||||
|
||||
else
|
||||
|
||||
write(fname(lname+1:),'(a,i3.3,a)')'_l',level,'_nd.mtx'
|
||||
if (sv%a%is_asb()) &
|
||||
& call sv%a%print(fname,head=head)
|
||||
write(fname(lname+1:),'(a,i3.3,a)')'_l',level,'_diag.mtx'
|
||||
if (allocated(sv%dv)) &
|
||||
& call psb_geprt(fname,sv%dv%v%v,head=head)
|
||||
end if
|
||||
end if
|
||||
|
||||
end subroutine amg_s_jac_solver_dmp
|
||||
@@ -0,0 +1,128 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! 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 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_s_l1_jac_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_s_jac_solver, amg_protect_name => amg_s_l1_jac_solver_bld
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
type(psb_sspmat_type), intent(in), target :: a
|
||||
Type(psb_desc_type), Intent(inout) :: desc_a
|
||||
class(amg_s_l1_jac_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
type(psb_sspmat_type), intent(in), target, optional :: b
|
||||
class(psb_s_base_sparse_mat), intent(in), optional :: amold
|
||||
class(psb_s_base_vect_type), intent(in), optional :: vmold
|
||||
class(psb_i_base_vect_type), intent(in), optional :: imold
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: n_row,n_col, nrow_a, nztota
|
||||
real(psb_spk_), allocatable :: tdb(:), tx(:),ty(:)
|
||||
type(psb_s_csr_sparse_mat) :: tcsr
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: np, me, i, err_act, debug_unit, debug_level
|
||||
character(len=20) :: name='s_l1_jac_solver_bld', ch_err
|
||||
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
ctxt = desc_a%get_context()
|
||||
call psb_info(ctxt, me, np)
|
||||
if (debug_level >= psb_debug_outer_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),' start'
|
||||
|
||||
|
||||
n_row = desc_a%get_local_rows()
|
||||
nrow_a = a%get_nrows()
|
||||
if (present(b)) then
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
call a%cp_to(tcsr)
|
||||
call sv%a%mv_from(tcsr)
|
||||
if (present(amold)) call sv%a%cscnv(info,mold=amold)
|
||||
|
||||
tx = a%get_diag(info)
|
||||
sv%d = a%arwsum(info)
|
||||
sv%d(:) = sv%d(:) - abs(tx(:)) + tx(:)
|
||||
if (info == psb_success_) call psb_realloc(n_row,sv%d,info)
|
||||
if (present(b)) then
|
||||
tdb=b%arwsum(info)
|
||||
ty =b%get_diag(info)
|
||||
if (size(tdb)+nrow_a > n_row) call psb_realloc(nrow_a+size(tdb),sv%d,info)
|
||||
if (info == psb_success_) sv%d(nrow_a+1:nrow_a+size(tdb)) = tdb(:) - abs(ty(:)) + ty(:)
|
||||
end if
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='get_diag')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
do i=1,n_row
|
||||
if (sv%d(i) == szero) then
|
||||
sv%d(i) = sone
|
||||
else
|
||||
sv%d(i) = sone/sv%d(i)
|
||||
end if
|
||||
end do
|
||||
allocate(sv%dv,stat=info)
|
||||
if (info == psb_success_) then
|
||||
call sv%dv%bld(sv%d)
|
||||
if (present(vmold)) call sv%dv%cnv(vmold)
|
||||
call sv%dv%sync()
|
||||
else
|
||||
call psb_errpush(psb_err_from_subroutine_,name,&
|
||||
& a_err='Allocate sv%dv')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
if (debug_level >= psb_debug_outer_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),' end'
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
|
||||
return
|
||||
end subroutine amg_s_l1_jac_solver_bld
|
||||
|
||||
|
||||
@@ -47,7 +47,6 @@ subroutine amg_z_base_ainv_solver_cnv(sv,info,amold,vmold,imold)
|
||||
class(psb_i_base_vect_type), intent(in), optional :: imold
|
||||
|
||||
!local
|
||||
integer(psb_ipk_) :: i, j, il1, iln, lname, lev
|
||||
integer(psb_ipk_) :: iam, np
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
character(len=80) :: prefix_
|
||||
|
||||
@@ -132,8 +132,7 @@ subroutine amg_z_l1_diag_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
class(psb_i_base_vect_type), intent(in), optional :: imold
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: n_row,n_col, nrow_a, nztota
|
||||
complex(psb_dpk_), pointer :: ww(:), aux(:), tx(:),ty(:)
|
||||
complex(psb_dpk_), allocatable :: tdb(:)
|
||||
complex(psb_dpk_), allocatable :: tdb(:), tx(:), ty(:)
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: np, me, i, err_act, debug_unit, debug_level
|
||||
character(len=20) :: name='z_l1_diag_solver_bld', ch_err
|
||||
@@ -151,12 +150,15 @@ subroutine amg_z_l1_diag_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
n_row = desc_a%get_local_rows()
|
||||
nrow_a = a%get_nrows()
|
||||
|
||||
tx = a%get_diag(info)
|
||||
sv%d = a%arwsum(info)
|
||||
sv%d(:) = sv%d(:) - abs(tx(:)) + tx(:)
|
||||
if (info == psb_success_) call psb_realloc(n_row,sv%d,info)
|
||||
if (present(b)) then
|
||||
tdb=b%arwsum(info)
|
||||
ty =b%get_diag(info)
|
||||
if (size(tdb)+nrow_a > n_row) call psb_realloc(nrow_a+size(tdb),sv%d,info)
|
||||
if (info == psb_success_) sv%d(nrow_a+1:nrow_a+size(tdb)) = tdb(:)
|
||||
if (info == psb_success_) sv%d(nrow_a+1:nrow_a+size(tdb)) = tdb(:) - abs(ty(:)) + ty(:)
|
||||
end if
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='arwsum')
|
||||
|
||||
@@ -0,0 +1,352 @@
|
||||
!
|
||||
!
|
||||
! 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 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_z_jac_solver_apply(alpha,sv,x,beta,y,desc_data,trans,&
|
||||
& work,info,init,initu)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_z_diag_solver
|
||||
use psb_base_krylov_conv_mod, only : log_conv
|
||||
use amg_z_jac_solver, amg_protect_name => amg_z_jac_solver_apply
|
||||
implicit none
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(amg_z_jac_solver_type), intent(inout) :: sv
|
||||
complex(psb_dpk_),intent(inout) :: x(:)
|
||||
complex(psb_dpk_),intent(inout) :: y(:)
|
||||
complex(psb_dpk_),intent(in) :: alpha,beta
|
||||
character(len=1),intent(in) :: trans
|
||||
complex(psb_dpk_),target, intent(inout) :: work(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
character, intent(in), optional :: init
|
||||
complex(psb_dpk_),intent(inout), optional :: initu(:)
|
||||
!
|
||||
integer(psb_ipk_) :: n_row,n_col, sweeps
|
||||
complex(psb_dpk_), pointer :: aux(:)
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: np, me, i, err_act
|
||||
character :: trans_, init_
|
||||
real(psb_dpk_) :: res, resdenum
|
||||
character(len=20) :: name='z_jac_solver_apply_v'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
info = psb_success_
|
||||
ctxt = desc_data%get_context()
|
||||
call psb_info(ctxt,me,np)
|
||||
|
||||
|
||||
if (present(init)) then
|
||||
init_ = psb_toupper(init)
|
||||
else
|
||||
init_='Z'
|
||||
end if
|
||||
|
||||
trans_ = psb_toupper(trans)
|
||||
select case(trans_)
|
||||
case('N')
|
||||
case('T','C')
|
||||
case default
|
||||
call psb_errpush(psb_err_iarg_invalid_i_,name)
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
|
||||
|
||||
n_row = desc_data%get_local_rows()
|
||||
n_col = desc_data%get_local_cols()
|
||||
sweeps = sv%sweeps
|
||||
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='complex(psb_dpk_)')
|
||||
goto 9999
|
||||
end if
|
||||
endif
|
||||
|
||||
if (sweeps >= 0) then
|
||||
!
|
||||
! This means we are dealing with a pure Jacobi smoother/solver.
|
||||
!
|
||||
associate(tx => aux(1:n_col), ty => aux(n_col+1:2*n_col))
|
||||
select case (init_)
|
||||
case('Z')
|
||||
|
||||
call inner_mlt(n_row,zone,sv%dv%v%v,x,zzero,ty,trans=trans_)
|
||||
|
||||
case('Y')
|
||||
call psb_geaxpby(zone,x,zzero,tx,desc_data,info)
|
||||
call psb_geaxpby(zone,y,zzero,ty,desc_data,info)
|
||||
call psb_spmm(-zone,sv%a,ty,zone,tx,desc_data,info,&
|
||||
& work=aux,trans=trans_, doswap=.false.)
|
||||
call inner_mlt(n_row,zone,sv%dv%v%v,tx,zzero,ty,trans=trans_)
|
||||
|
||||
case('U')
|
||||
if (.not.present(initu)) then
|
||||
call psb_errpush(psb_err_internal_error_,name,&
|
||||
& a_err='missing initu to smoother_apply')
|
||||
goto 9999
|
||||
end if
|
||||
call psb_geaxpby(zone,x,zzero,tx,desc_data,info)
|
||||
call psb_geaxpby(zone,initu,zzero,ty,desc_data,info)
|
||||
call psb_spmm(-zone,sv%a,ty,zone,tx,desc_data,info,&
|
||||
& work=aux,trans=trans_, doswap=.false.)
|
||||
call inner_mlt(n_row,zone,sv%dv%v%v,tx,zzero,ty,trans=trans_)
|
||||
|
||||
case default
|
||||
call psb_errpush(psb_err_internal_error_,name,&
|
||||
& a_err='wrong init to smoother_apply')
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
do i=1, sweeps-1
|
||||
!
|
||||
! Compute Y(j+1) = Y(j)+ D^(-1)*(X-A*Y(j)),
|
||||
! where is the diagonal and A the matrix.
|
||||
!
|
||||
call psb_geaxpby(zone,x,zzero,tx,desc_data,info)
|
||||
call psb_spmm(-zone,sv%a,ty,zone,tx,desc_data,info,&
|
||||
& work=aux,trans=trans_, doswap=.false.)
|
||||
if (info /= psb_success_) exit
|
||||
call inner_mlt(n_row,zone,sv%dv%v%v,tx,zone,ty,trans=trans_)
|
||||
if (info /= psb_success_) exit
|
||||
end do
|
||||
|
||||
if (info == psb_success_) call psb_geaxpby(alpha,ty,beta,y,desc_data,info)
|
||||
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name,&
|
||||
& a_err='subsolve with Jacobi sweeps > 1')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
|
||||
end associate
|
||||
|
||||
|
||||
else
|
||||
|
||||
info = psb_err_iarg_neg_
|
||||
call psb_errpush(info,name,&
|
||||
& i_err=(/itwo,sweeps,izero,izero,izero/))
|
||||
goto 9999
|
||||
|
||||
end if
|
||||
|
||||
if (.not.(4*n_col <= size(work))) then
|
||||
deallocate(aux)
|
||||
endif
|
||||
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
|
||||
return
|
||||
contains
|
||||
subroutine inner_mlt(n_row,alpha,d,x,beta,y,trans)
|
||||
implicit none
|
||||
integer(psb_ipk_),intent(in) :: n_row
|
||||
complex(psb_dpk_), intent(inout) :: d(:)
|
||||
complex(psb_dpk_),intent(inout) :: x(:)
|
||||
complex(psb_dpk_),intent(inout) :: y(:)
|
||||
complex(psb_dpk_),intent(in) :: alpha,beta
|
||||
character(len=1),intent(in) :: trans
|
||||
|
||||
integer(psb_ipk_) :: i
|
||||
|
||||
if (trans_ == 'C') then
|
||||
if (beta == zzero) then
|
||||
|
||||
if (alpha == zzero) then
|
||||
y(1:n_row) = zzero
|
||||
else if (alpha == zone) then
|
||||
do i=1, n_row
|
||||
y(i) = conjg(d(i)) * x(i)
|
||||
end do
|
||||
else if (alpha == -zone) then
|
||||
do i=1, n_row
|
||||
y(i) = -conjg(d(i)) * x(i)
|
||||
end do
|
||||
else
|
||||
do i=1, n_row
|
||||
y(i) = alpha * conjg(d(i)) * x(i)
|
||||
end do
|
||||
end if
|
||||
|
||||
else if (beta == zone) then
|
||||
|
||||
if (alpha == zzero) then
|
||||
!y(1:n_row) = zzero
|
||||
else if (alpha == zone) then
|
||||
do i=1, n_row
|
||||
y(i) = conjg(d(i)) * x(i) + y(i)
|
||||
end do
|
||||
else if (alpha == -zone) then
|
||||
do i=1, n_row
|
||||
y(i) = -conjg(d(i)) * x(i) + y(i)
|
||||
end do
|
||||
else
|
||||
do i=1, n_row
|
||||
y(i) = alpha * conjg(d(i)) * x(i) + y(i)
|
||||
end do
|
||||
end if
|
||||
|
||||
else if (beta == -zone) then
|
||||
|
||||
if (alpha == zzero) then
|
||||
y(1:n_row) = -y(1:n_row)
|
||||
else if (alpha == zone) then
|
||||
do i=1, n_row
|
||||
y(i) = conjg(d(i)) * x(i) - y(i)
|
||||
end do
|
||||
else if (alpha == -zone) then
|
||||
do i=1, n_row
|
||||
y(i) = -conjg(d(i)) * x(i) - y(i)
|
||||
end do
|
||||
else
|
||||
do i=1, n_row
|
||||
y(i) = alpha * conjg(d(i)) * x(i) - y(i)
|
||||
end do
|
||||
end if
|
||||
|
||||
else
|
||||
|
||||
if (alpha == zzero) then
|
||||
y(1:n_row) = beta *y(1:n_row)
|
||||
else if (alpha == zone) then
|
||||
do i=1, n_row
|
||||
y(i) = conjg(d(i)) * x(i) + beta*y(i)
|
||||
end do
|
||||
else if (alpha == -zone) then
|
||||
do i=1, n_row
|
||||
y(i) = -conjg(d(i)) * x(i) + beta*y(i)
|
||||
end do
|
||||
else
|
||||
do i=1, n_row
|
||||
y(i) = alpha * conjg(d(i)) * x(i) + beta*y(i)
|
||||
end do
|
||||
end if
|
||||
|
||||
end if
|
||||
|
||||
else if (trans_ /= 'C') then
|
||||
|
||||
if (beta == zzero) then
|
||||
|
||||
if (alpha == zzero) then
|
||||
y(1:n_row) = zzero
|
||||
else if (alpha == zone) then
|
||||
do i=1, n_row
|
||||
y(i) = d(i) * x(i)
|
||||
end do
|
||||
else if (alpha == -zone) then
|
||||
do i=1, n_row
|
||||
y(i) = -d(i) * x(i)
|
||||
end do
|
||||
else
|
||||
do i=1, n_row
|
||||
y(i) = alpha * d(i) * x(i)
|
||||
end do
|
||||
end if
|
||||
|
||||
else if (beta == zone) then
|
||||
|
||||
if (alpha == zzero) then
|
||||
!y(1:n_row) = zzero
|
||||
else if (alpha == zone) then
|
||||
do i=1, n_row
|
||||
y(i) = d(i) * x(i) + y(i)
|
||||
end do
|
||||
else if (alpha == -zone) then
|
||||
do i=1, n_row
|
||||
y(i) = -d(i) * x(i) + y(i)
|
||||
end do
|
||||
else
|
||||
do i=1, n_row
|
||||
y(i) = alpha * d(i) * x(i) + y(i)
|
||||
end do
|
||||
end if
|
||||
|
||||
else if (beta == -zone) then
|
||||
|
||||
if (alpha == zzero) then
|
||||
y(1:n_row) = -y(1:n_row)
|
||||
else if (alpha == zone) then
|
||||
do i=1, n_row
|
||||
y(i) = d(i) * x(i) - y(i)
|
||||
end do
|
||||
else if (alpha == -zone) then
|
||||
do i=1, n_row
|
||||
y(i) = -d(i) * x(i) - y(i)
|
||||
end do
|
||||
else
|
||||
do i=1, n_row
|
||||
y(i) = alpha * d(i) * x(i) - y(i)
|
||||
end do
|
||||
end if
|
||||
|
||||
else
|
||||
|
||||
if (alpha == zzero) then
|
||||
y(1:n_row) = beta *y(1:n_row)
|
||||
else if (alpha == zone) then
|
||||
do i=1, n_row
|
||||
y(i) = d(i) * x(i) + beta*y(i)
|
||||
end do
|
||||
else if (alpha == -zone) then
|
||||
do i=1, n_row
|
||||
y(i) = -d(i) * x(i) + beta*y(i)
|
||||
end do
|
||||
else
|
||||
do i=1, n_row
|
||||
y(i) = alpha * d(i) * x(i) + beta*y(i)
|
||||
end do
|
||||
end if
|
||||
|
||||
end if
|
||||
|
||||
end if
|
||||
|
||||
end subroutine inner_mlt
|
||||
end subroutine amg_z_jac_solver_apply
|
||||
@@ -0,0 +1,190 @@
|
||||
!
|
||||
!
|
||||
! 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 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_z_jac_solver_apply_vect(alpha,sv,x,beta,y,desc_data,trans,&
|
||||
& work,wv,info,init,initu)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_z_diag_solver
|
||||
use psb_base_krylov_conv_mod, only : log_conv
|
||||
use amg_z_jac_solver, amg_protect_name => amg_z_jac_solver_apply_vect
|
||||
implicit none
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(amg_z_jac_solver_type), intent(inout) :: sv
|
||||
type(psb_z_vect_type),intent(inout) :: x
|
||||
type(psb_z_vect_type),intent(inout) :: y
|
||||
complex(psb_dpk_),intent(in) :: alpha,beta
|
||||
character(len=1),intent(in) :: trans
|
||||
complex(psb_dpk_),target, intent(inout) :: work(:)
|
||||
type(psb_z_vect_type),intent(inout) :: wv(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
character, intent(in), optional :: init
|
||||
type(psb_z_vect_type),intent(inout), optional :: initu
|
||||
!
|
||||
integer(psb_ipk_) :: n_row,n_col, sweeps
|
||||
type(psb_z_vect_type) :: tx, ty, r
|
||||
complex(psb_dpk_), pointer :: aux(:)
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: np, me, i, err_act
|
||||
character :: trans_, init_
|
||||
real(psb_dpk_) :: res, resdenum
|
||||
character(len=20) :: name='z_jac_solver_apply_v'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
info = psb_success_
|
||||
ctxt = desc_data%get_context()
|
||||
call psb_info(ctxt,me,np)
|
||||
|
||||
|
||||
if (present(init)) then
|
||||
init_ = psb_toupper(init)
|
||||
else
|
||||
init_='Z'
|
||||
end if
|
||||
|
||||
trans_ = psb_toupper(trans)
|
||||
select case(trans_)
|
||||
case('N')
|
||||
case('T','C')
|
||||
case default
|
||||
call psb_errpush(psb_err_iarg_invalid_i_,name)
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
|
||||
|
||||
n_row = desc_data%get_local_rows()
|
||||
n_col = desc_data%get_local_cols()
|
||||
sweeps = sv%sweeps
|
||||
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='complex(psb_dpk_)')
|
||||
goto 9999
|
||||
end if
|
||||
endif
|
||||
|
||||
if (sweeps >= 0) then
|
||||
!
|
||||
! This means we are dealing with a pure Jacobi smoother/solver.
|
||||
!
|
||||
associate(tx => wv(1), ty => wv(2))
|
||||
select case (init_)
|
||||
case('Z')
|
||||
|
||||
call ty%mlt(zone,sv%dv,x,zzero,info,conjgx=trans_)
|
||||
|
||||
case('Y')
|
||||
call psb_geaxpby(zone,x,zzero,tx,desc_data,info)
|
||||
call psb_geaxpby(zone,y,zzero,ty,desc_data,info)
|
||||
call psb_spmm(-zone,sv%a,ty,zone,tx,desc_data,info,&
|
||||
& work=aux,trans=trans_, doswap=.false.)
|
||||
call ty%mlt(zone,sv%dv,tx,zzero,info,conjgx=trans_)
|
||||
|
||||
case('U')
|
||||
if (.not.present(initu)) then
|
||||
call psb_errpush(psb_err_internal_error_,name,&
|
||||
& a_err='missing initu to smoother_apply')
|
||||
goto 9999
|
||||
end if
|
||||
call psb_geaxpby(zone,x,zzero,tx,desc_data,info)
|
||||
call psb_geaxpby(zone,initu,zzero,ty,desc_data,info)
|
||||
call psb_spmm(-zone,sv%a,ty,zone,tx,desc_data,info,&
|
||||
& work=aux,trans=trans_, doswap=.false.)
|
||||
call ty%mlt(zone,sv%dv,tx,zzero,info,conjgx=trans_)
|
||||
|
||||
case default
|
||||
call psb_errpush(psb_err_internal_error_,name,&
|
||||
& a_err='wrong init to smoother_apply')
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
do i=1, sweeps-1
|
||||
!
|
||||
! Compute Y(j+1) = Y(j)+ D^(-1)*(X-A*Y(j)),
|
||||
! where is the diagonal and A the matrix.
|
||||
!
|
||||
call psb_geaxpby(zone,x,zzero,tx,desc_data,info)
|
||||
call psb_spmm(-zone,sv%a,ty,zone,tx,desc_data,info,&
|
||||
& work=aux,trans=trans_, doswap=.false.)
|
||||
if (info /= psb_success_) exit
|
||||
call ty%mlt(zone,sv%dv,tx,zone,info,conjgx=trans_)
|
||||
if (info /= psb_success_) exit
|
||||
end do
|
||||
|
||||
|
||||
if (info == psb_success_) call psb_geaxpby(alpha,ty,beta,y,desc_data,info)
|
||||
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name,&
|
||||
& a_err='subsolve with Jacobi sweeps > 1')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
|
||||
end associate
|
||||
|
||||
|
||||
else
|
||||
|
||||
info = psb_err_iarg_neg_
|
||||
call psb_errpush(info,name,&
|
||||
& i_err=(/itwo,sweeps,izero,izero,izero/))
|
||||
goto 9999
|
||||
|
||||
end if
|
||||
|
||||
if (.not.(4*n_col <= size(work))) then
|
||||
deallocate(aux)
|
||||
endif
|
||||
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine amg_z_jac_solver_apply_vect
|
||||
@@ -0,0 +1,125 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! 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 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_z_jac_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_z_jac_solver, amg_protect_name => amg_z_jac_solver_bld
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
type(psb_zspmat_type), intent(in), target :: a
|
||||
Type(psb_desc_type), Intent(inout) :: desc_a
|
||||
class(amg_z_jac_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
type(psb_zspmat_type), intent(in), target, optional :: b
|
||||
class(psb_z_base_sparse_mat), intent(in), optional :: amold
|
||||
class(psb_z_base_vect_type), intent(in), optional :: vmold
|
||||
class(psb_i_base_vect_type), intent(in), optional :: imold
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: n_row,n_col, nrow_a, nztota
|
||||
complex(psb_dpk_), pointer :: ww(:), aux(:), tx(:),ty(:)
|
||||
complex(psb_dpk_), allocatable :: tdb(:)
|
||||
type(psb_z_csr_sparse_mat) :: tcsr
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: np, me, i, err_act, debug_unit, debug_level
|
||||
character(len=20) :: name='z_jac_solver_bld', ch_err
|
||||
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
ctxt = desc_a%get_context()
|
||||
call psb_info(ctxt, me, np)
|
||||
if (debug_level >= psb_debug_outer_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),' start'
|
||||
|
||||
|
||||
n_row = desc_a%get_local_rows()
|
||||
nrow_a = a%get_nrows()
|
||||
if (present(b)) then
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
call a%cp_to(tcsr)
|
||||
call sv%a%mv_from(tcsr)
|
||||
if (present(amold)) call sv%a%cscnv(info,mold=amold)
|
||||
|
||||
sv%d = a%get_diag(info)
|
||||
if (info == psb_success_) call psb_realloc(n_row,sv%d,info)
|
||||
if (present(b)) then
|
||||
tdb=b%get_diag(info)
|
||||
if (size(tdb)+nrow_a > n_row) call psb_realloc(nrow_a+size(tdb),sv%d,info)
|
||||
if (info == psb_success_) sv%d(nrow_a+1:nrow_a+size(tdb)) = tdb(:)
|
||||
end if
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='get_diag')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
do i=1,n_row
|
||||
if (sv%d(i) == zzero) then
|
||||
sv%d(i) = zone
|
||||
else
|
||||
sv%d(i) = zone/sv%d(i)
|
||||
end if
|
||||
end do
|
||||
allocate(sv%dv,stat=info)
|
||||
if (info == psb_success_) then
|
||||
call sv%dv%bld(sv%d)
|
||||
if (present(vmold)) call sv%dv%cnv(vmold)
|
||||
call sv%dv%sync()
|
||||
else
|
||||
call psb_errpush(psb_err_from_subroutine_,name,&
|
||||
& a_err='Allocate sv%dv')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
if (debug_level >= psb_debug_outer_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),' end'
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
|
||||
return
|
||||
end subroutine amg_z_jac_solver_bld
|
||||
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! 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 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_z_jac_solver_clear_data(sv,info)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_z_jac_solver, amg_protect_name => amg_z_jac_solver_clear_data
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_z_jac_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: err_act
|
||||
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
call sv%a%free()
|
||||
call sv%dv%free(info)
|
||||
if ((info==0).and.allocated(sv%d)) deallocate(sv%d,stat=info)
|
||||
if (info /= 0) goto 9999
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
|
||||
return
|
||||
end subroutine amg_z_jac_solver_clear_data
|
||||
@@ -0,0 +1,88 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! 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 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_z_jac_solver_clone(sv,svout,info)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_z_jac_solver, amg_protect_name => amg_z_jac_solver_clone
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_z_jac_solver_type), intent(inout) :: sv
|
||||
class(amg_z_base_solver_type), allocatable, intent(inout) :: svout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: err_act
|
||||
|
||||
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
if (allocated(svout)) then
|
||||
call svout%free(info)
|
||||
if (info == psb_success_) deallocate(svout, stat=info)
|
||||
end if
|
||||
if (info == psb_success_) &
|
||||
& allocate(svout, mold=sv, stat=info)
|
||||
if (info /= 0) then
|
||||
info = psb_err_alloc_dealloc_
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
select type(svo => svout)
|
||||
class is (amg_z_jac_solver_type)
|
||||
svo%sweeps = sv%sweeps
|
||||
svo%eps = sv%eps
|
||||
if (info == psb_success_) &
|
||||
& call sv%a%clone(svo%a,info)
|
||||
if (info == psb_success_) &
|
||||
& call sv%dv%clone(svo%dv,info)
|
||||
svo%d = sv%d
|
||||
|
||||
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_z_jac_solver_clone
|
||||
@@ -0,0 +1,69 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! 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 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_z_jac_solver_clone_settings(sv,svout,info)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_z_jac_solver, amg_protect_name => amg_z_jac_solver_clone_settings
|
||||
Implicit None
|
||||
! Arguments
|
||||
class(amg_z_jac_solver_type), intent(inout) :: sv
|
||||
class(amg_z_base_solver_type), intent(inout) :: svout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='z_jac_solver_clone_settings'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select type(svout)
|
||||
class is(amg_z_jac_solver_type)
|
||||
svout%sweeps = sv%sweeps
|
||||
svout%eps = sv%eps
|
||||
|
||||
class default
|
||||
info = psb_err_internal_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
|
||||
return
|
||||
end subroutine amg_z_jac_solver_clone_settings
|
||||
@@ -0,0 +1,72 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! 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 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_z_jac_solver_cnv(sv,info,amold,vmold,imold)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_z_jac_solver, amg_protect_name => amg_z_jac_solver_cnv
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_z_jac_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
class(psb_z_base_sparse_mat), intent(in), optional :: amold
|
||||
class(psb_z_base_vect_type), intent(in), optional :: vmold
|
||||
class(psb_i_base_vect_type), intent(in), optional :: imold
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: err_act, debug_unit, debug_level
|
||||
character(len=20) :: name='z_jac_solver_cnv', ch_err
|
||||
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
|
||||
if (present(amold)) call sv%a%cscnv(info,mold=amold)
|
||||
if ((info==0).and.present(vmold)) call sv%dv%cnv(mold=vmold)
|
||||
|
||||
if (debug_level >= psb_debug_outer_) &
|
||||
& write(debug_unit,*) trim(name),' end'
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
|
||||
return
|
||||
end subroutine amg_z_jac_solver_cnv
|
||||
@@ -0,0 +1,107 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! 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 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_z_jac_solver_dmp(sv,desc,level,info,prefix,head,solver,global_num)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_z_jac_solver, amg_protect_name => amg_z_jac_solver_dmp
|
||||
implicit none
|
||||
class(amg_z_jac_solver_type), intent(in) :: sv
|
||||
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) :: solver, global_num
|
||||
integer(psb_ipk_) :: i, j, il1, iln, lname, lev
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: iam, np
|
||||
character(len=80) :: prefix_
|
||||
character(len=120) :: fname ! len should be at least 20 more than
|
||||
logical :: solver_, global_num_
|
||||
integer(psb_lpk_), allocatable :: iv(:)
|
||||
! len of prefix_
|
||||
|
||||
info = 0
|
||||
|
||||
ctxt = desc%get_context()
|
||||
call psb_info(ctxt,iam,np)
|
||||
|
||||
if (present(solver)) then
|
||||
solver_ = solver
|
||||
else
|
||||
solver_ = .false.
|
||||
end if
|
||||
if (present(global_num)) then
|
||||
global_num_ = global_num
|
||||
else
|
||||
global_num_ = .false.
|
||||
end if
|
||||
|
||||
|
||||
if (solver_) then
|
||||
if (present(prefix)) then
|
||||
prefix_ = trim(prefix(1:min(len(prefix),len(prefix_))))
|
||||
else
|
||||
prefix_ = "dump_slv_z"
|
||||
end if
|
||||
lname = len_trim(prefix_)
|
||||
fname = trim(prefix_)
|
||||
write(fname(lname+1:lname+5),'(a,i3.3)') '_p',iam
|
||||
lname = lname + 5
|
||||
|
||||
if (global_num_) then
|
||||
iv = desc%get_global_indices(owned=.false.)
|
||||
|
||||
write(fname(lname+1:),'(a,i3.3,a)')'_l',level,'_nd.mtx'
|
||||
if (sv%a%is_asb()) &
|
||||
& call sv%a%print(fname,head=head,iv=iv)
|
||||
write(fname(lname+1:),'(a,i3.3,a)')'_l',level,'_diag.mtx'
|
||||
if (allocated(sv%dv)) &
|
||||
& call psb_geprt(fname,sv%dv%v%v,head=head)
|
||||
|
||||
else
|
||||
|
||||
write(fname(lname+1:),'(a,i3.3,a)')'_l',level,'_nd.mtx'
|
||||
if (sv%a%is_asb()) &
|
||||
& call sv%a%print(fname,head=head)
|
||||
write(fname(lname+1:),'(a,i3.3,a)')'_l',level,'_diag.mtx'
|
||||
if (allocated(sv%dv)) &
|
||||
& call psb_geprt(fname,sv%dv%v%v,head=head)
|
||||
end if
|
||||
end if
|
||||
|
||||
end subroutine amg_z_jac_solver_dmp
|
||||
@@ -0,0 +1,128 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! 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 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.
|
||||
!
|
||||
!
|
||||
subroutine amg_z_l1_jac_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_z_jac_solver, amg_protect_name => amg_z_l1_jac_solver_bld
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
type(psb_zspmat_type), intent(in), target :: a
|
||||
Type(psb_desc_type), Intent(inout) :: desc_a
|
||||
class(amg_z_l1_jac_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
type(psb_zspmat_type), intent(in), target, optional :: b
|
||||
class(psb_z_base_sparse_mat), intent(in), optional :: amold
|
||||
class(psb_z_base_vect_type), intent(in), optional :: vmold
|
||||
class(psb_i_base_vect_type), intent(in), optional :: imold
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: n_row,n_col, nrow_a, nztota
|
||||
complex(psb_dpk_), allocatable :: tdb(:), tx(:),ty(:)
|
||||
type(psb_z_csr_sparse_mat) :: tcsr
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: np, me, i, err_act, debug_unit, debug_level
|
||||
character(len=20) :: name='z_l1_jac_solver_bld', ch_err
|
||||
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
ctxt = desc_a%get_context()
|
||||
call psb_info(ctxt, me, np)
|
||||
if (debug_level >= psb_debug_outer_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),' start'
|
||||
|
||||
|
||||
n_row = desc_a%get_local_rows()
|
||||
nrow_a = a%get_nrows()
|
||||
if (present(b)) then
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
call a%cp_to(tcsr)
|
||||
call sv%a%mv_from(tcsr)
|
||||
if (present(amold)) call sv%a%cscnv(info,mold=amold)
|
||||
|
||||
tx = a%get_diag(info)
|
||||
sv%d = a%arwsum(info)
|
||||
sv%d(:) = sv%d(:) - abs(tx(:)) + tx(:)
|
||||
if (info == psb_success_) call psb_realloc(n_row,sv%d,info)
|
||||
if (present(b)) then
|
||||
tdb=b%arwsum(info)
|
||||
ty =b%get_diag(info)
|
||||
if (size(tdb)+nrow_a > n_row) call psb_realloc(nrow_a+size(tdb),sv%d,info)
|
||||
if (info == psb_success_) sv%d(nrow_a+1:nrow_a+size(tdb)) = tdb(:) - abs(ty(:)) + ty(:)
|
||||
end if
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='get_diag')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
do i=1,n_row
|
||||
if (sv%d(i) == zzero) then
|
||||
sv%d(i) = zone
|
||||
else
|
||||
sv%d(i) = zone/sv%d(i)
|
||||
end if
|
||||
end do
|
||||
allocate(sv%dv,stat=info)
|
||||
if (info == psb_success_) then
|
||||
call sv%dv%bld(sv%d)
|
||||
if (present(vmold)) call sv%dv%cnv(vmold)
|
||||
call sv%dv%sync()
|
||||
else
|
||||
call psb_errpush(psb_err_from_subroutine_,name,&
|
||||
& a_err='Allocate sv%dv')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
if (debug_level >= psb_debug_outer_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),' end'
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
|
||||
return
|
||||
end subroutine amg_z_l1_jac_solver_bld
|
||||
|
||||
|
||||
@@ -380,6 +380,8 @@ program amg_cf_sample
|
||||
case ('BJAC')
|
||||
call prec%set('smoother_sweeps', p_choice%jsweeps, info)
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
if (psb_toupper(p_choice%solve)=='MUMPS') &
|
||||
& call prec%set('mumps_loc_glob','local_solver',info)
|
||||
call prec%set('sub_fillin', p_choice%fill, info)
|
||||
call prec%set('sub_iluthrs', p_choice%thr, info)
|
||||
|
||||
@@ -389,6 +391,8 @@ program amg_cf_sample
|
||||
call prec%set('sub_restr', p_choice%restr, info)
|
||||
call prec%set('sub_prol', p_choice%prol, info)
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
if (psb_toupper(p_choice%solve)=='MUMPS') &
|
||||
& call prec%set('mumps_loc_glob','local_solver',info)
|
||||
call prec%set('sub_fillin', p_choice%fill, info)
|
||||
call prec%set('sub_iluthrs', p_choice%thr, info)
|
||||
|
||||
@@ -428,6 +432,8 @@ program amg_cf_sample
|
||||
call prec%set('sub_restr', p_choice%restr, info)
|
||||
call prec%set('sub_prol', p_choice%prol, info)
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
if (psb_toupper(p_choice%solve)=='MUMPS') &
|
||||
& call prec%set('mumps_loc_glob','local_solver',info)
|
||||
call prec%set('sub_fillin', p_choice%fill, info)
|
||||
call prec%set('sub_iluthrs', p_choice%thr, info)
|
||||
end select
|
||||
@@ -443,6 +449,8 @@ program amg_cf_sample
|
||||
call prec%set('sub_restr', p_choice%restr2, info,pos='post')
|
||||
call prec%set('sub_prol', p_choice%prol2, info,pos='post')
|
||||
call prec%set('sub_solve', p_choice%solve2, info,pos='post')
|
||||
if (psb_toupper(p_choice%solve2)=='MUMPS') &
|
||||
& call prec%set('mumps_loc_glob','local_solver',info)
|
||||
call prec%set('sub_fillin', p_choice%fill2, info,pos='post')
|
||||
call prec%set('sub_iluthrs', p_choice%thr2, info,pos='post')
|
||||
end select
|
||||
@@ -586,7 +594,7 @@ program amg_cf_sample
|
||||
call psb_gefree(b_col,desc_a,info)
|
||||
call psb_gefree(x_col,desc_a,info)
|
||||
call psb_gefree(r_col,desc_a,info)
|
||||
call psb_gefree(ref_col,desc_a,info)
|
||||
if (have_ref) call psb_gefree(ref_col,desc_a,info)
|
||||
call psb_spfree(a, desc_a,info)
|
||||
call prec%free(info)
|
||||
call psb_cdfree(desc_a,info)
|
||||
|
||||
@@ -380,6 +380,8 @@ program amg_df_sample
|
||||
case ('BJAC')
|
||||
call prec%set('smoother_sweeps', p_choice%jsweeps, info)
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
if (psb_toupper(p_choice%solve)=='MUMPS') &
|
||||
& call prec%set('mumps_loc_glob','local_solver',info)
|
||||
call prec%set('sub_fillin', p_choice%fill, info)
|
||||
call prec%set('sub_iluthrs', p_choice%thr, info)
|
||||
|
||||
@@ -389,6 +391,8 @@ program amg_df_sample
|
||||
call prec%set('sub_restr', p_choice%restr, info)
|
||||
call prec%set('sub_prol', p_choice%prol, info)
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
if (psb_toupper(p_choice%solve)=='MUMPS') &
|
||||
& call prec%set('mumps_loc_glob','local_solver',info)
|
||||
call prec%set('sub_fillin', p_choice%fill, info)
|
||||
call prec%set('sub_iluthrs', p_choice%thr, info)
|
||||
|
||||
@@ -428,6 +432,8 @@ program amg_df_sample
|
||||
call prec%set('sub_restr', p_choice%restr, info)
|
||||
call prec%set('sub_prol', p_choice%prol, info)
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
if (psb_toupper(p_choice%solve)=='MUMPS') &
|
||||
& call prec%set('mumps_loc_glob','local_solver',info)
|
||||
call prec%set('sub_fillin', p_choice%fill, info)
|
||||
call prec%set('sub_iluthrs', p_choice%thr, info)
|
||||
end select
|
||||
@@ -443,6 +449,8 @@ program amg_df_sample
|
||||
call prec%set('sub_restr', p_choice%restr2, info,pos='post')
|
||||
call prec%set('sub_prol', p_choice%prol2, info,pos='post')
|
||||
call prec%set('sub_solve', p_choice%solve2, info,pos='post')
|
||||
if (psb_toupper(p_choice%solve2)=='MUMPS') &
|
||||
& call prec%set('mumps_loc_glob','local_solver',info)
|
||||
call prec%set('sub_fillin', p_choice%fill2, info,pos='post')
|
||||
call prec%set('sub_iluthrs', p_choice%thr2, info,pos='post')
|
||||
end select
|
||||
@@ -586,7 +594,7 @@ program amg_df_sample
|
||||
call psb_gefree(b_col,desc_a,info)
|
||||
call psb_gefree(x_col,desc_a,info)
|
||||
call psb_gefree(r_col,desc_a,info)
|
||||
call psb_gefree(ref_col,desc_a,info)
|
||||
if (have_ref) call psb_gefree(ref_col,desc_a,info)
|
||||
call psb_spfree(a, desc_a,info)
|
||||
call prec%free(info)
|
||||
call psb_cdfree(desc_a,info)
|
||||
|
||||
@@ -380,6 +380,8 @@ program amg_sf_sample
|
||||
case ('BJAC')
|
||||
call prec%set('smoother_sweeps', p_choice%jsweeps, info)
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
if (psb_toupper(p_choice%solve)=='MUMPS') &
|
||||
& call prec%set('mumps_loc_glob','local_solver',info)
|
||||
call prec%set('sub_fillin', p_choice%fill, info)
|
||||
call prec%set('sub_iluthrs', p_choice%thr, info)
|
||||
|
||||
@@ -389,6 +391,8 @@ program amg_sf_sample
|
||||
call prec%set('sub_restr', p_choice%restr, info)
|
||||
call prec%set('sub_prol', p_choice%prol, info)
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
if (psb_toupper(p_choice%solve)=='MUMPS') &
|
||||
& call prec%set('mumps_loc_glob','local_solver',info)
|
||||
call prec%set('sub_fillin', p_choice%fill, info)
|
||||
call prec%set('sub_iluthrs', p_choice%thr, info)
|
||||
|
||||
@@ -428,6 +432,8 @@ program amg_sf_sample
|
||||
call prec%set('sub_restr', p_choice%restr, info)
|
||||
call prec%set('sub_prol', p_choice%prol, info)
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
if (psb_toupper(p_choice%solve)=='MUMPS') &
|
||||
& call prec%set('mumps_loc_glob','local_solver',info)
|
||||
call prec%set('sub_fillin', p_choice%fill, info)
|
||||
call prec%set('sub_iluthrs', p_choice%thr, info)
|
||||
end select
|
||||
@@ -443,6 +449,8 @@ program amg_sf_sample
|
||||
call prec%set('sub_restr', p_choice%restr2, info,pos='post')
|
||||
call prec%set('sub_prol', p_choice%prol2, info,pos='post')
|
||||
call prec%set('sub_solve', p_choice%solve2, info,pos='post')
|
||||
if (psb_toupper(p_choice%solve2)=='MUMPS') &
|
||||
& call prec%set('mumps_loc_glob','local_solver',info)
|
||||
call prec%set('sub_fillin', p_choice%fill2, info,pos='post')
|
||||
call prec%set('sub_iluthrs', p_choice%thr2, info,pos='post')
|
||||
end select
|
||||
@@ -586,7 +594,7 @@ program amg_sf_sample
|
||||
call psb_gefree(b_col,desc_a,info)
|
||||
call psb_gefree(x_col,desc_a,info)
|
||||
call psb_gefree(r_col,desc_a,info)
|
||||
call psb_gefree(ref_col,desc_a,info)
|
||||
if (have_ref) call psb_gefree(ref_col,desc_a,info)
|
||||
call psb_spfree(a, desc_a,info)
|
||||
call prec%free(info)
|
||||
call psb_cdfree(desc_a,info)
|
||||
|
||||
@@ -380,6 +380,8 @@ program amg_zf_sample
|
||||
case ('BJAC')
|
||||
call prec%set('smoother_sweeps', p_choice%jsweeps, info)
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
if (psb_toupper(p_choice%solve)=='MUMPS') &
|
||||
& call prec%set('mumps_loc_glob','local_solver',info)
|
||||
call prec%set('sub_fillin', p_choice%fill, info)
|
||||
call prec%set('sub_iluthrs', p_choice%thr, info)
|
||||
|
||||
@@ -389,6 +391,8 @@ program amg_zf_sample
|
||||
call prec%set('sub_restr', p_choice%restr, info)
|
||||
call prec%set('sub_prol', p_choice%prol, info)
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
if (psb_toupper(p_choice%solve)=='MUMPS') &
|
||||
& call prec%set('mumps_loc_glob','local_solver',info)
|
||||
call prec%set('sub_fillin', p_choice%fill, info)
|
||||
call prec%set('sub_iluthrs', p_choice%thr, info)
|
||||
|
||||
@@ -428,6 +432,8 @@ program amg_zf_sample
|
||||
call prec%set('sub_restr', p_choice%restr, info)
|
||||
call prec%set('sub_prol', p_choice%prol, info)
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
if (psb_toupper(p_choice%solve)=='MUMPS') &
|
||||
& call prec%set('mumps_loc_glob','local_solver',info)
|
||||
call prec%set('sub_fillin', p_choice%fill, info)
|
||||
call prec%set('sub_iluthrs', p_choice%thr, info)
|
||||
end select
|
||||
@@ -443,6 +449,8 @@ program amg_zf_sample
|
||||
call prec%set('sub_restr', p_choice%restr2, info,pos='post')
|
||||
call prec%set('sub_prol', p_choice%prol2, info,pos='post')
|
||||
call prec%set('sub_solve', p_choice%solve2, info,pos='post')
|
||||
if (psb_toupper(p_choice%solve2)=='MUMPS') &
|
||||
& call prec%set('mumps_loc_glob','local_solver',info)
|
||||
call prec%set('sub_fillin', p_choice%fill2, info,pos='post')
|
||||
call prec%set('sub_iluthrs', p_choice%thr2, info,pos='post')
|
||||
end select
|
||||
@@ -586,7 +594,7 @@ program amg_zf_sample
|
||||
call psb_gefree(b_col,desc_a,info)
|
||||
call psb_gefree(x_col,desc_a,info)
|
||||
call psb_gefree(r_col,desc_a,info)
|
||||
call psb_gefree(ref_col,desc_a,info)
|
||||
if (have_ref) call psb_gefree(ref_col,desc_a,info)
|
||||
call psb_spfree(a, desc_a,info)
|
||||
call prec%free(info)
|
||||
call psb_cdfree(desc_a,info)
|
||||
|
||||
@@ -5,7 +5,7 @@ NONE ! Initial guess
|
||||
amg_sol.mtx ! Reference solution
|
||||
MM ! File format: MatrixMarket or Harwell-Boeing
|
||||
CSR ! Storage format: CSR COO JAD
|
||||
GRAPH ! PART (partition method): BLOCK GRAPH
|
||||
GRAPH ! PART (partition method): BLOCK GRAPH
|
||||
CG ! Iterative method: BiCGSTAB BiCGSTABL BiCG CG CGS FCG GCR RGMRES
|
||||
2 ! ISTOPC
|
||||
00500 ! ITMAX
|
||||
|
||||
@@ -8,23 +8,27 @@ FINCLUDES=$(FMFLAG). $(FMFLAG)$(AMGMODDIR) $(FMFLAG)$(AMGINCDIR) $(PSBLAS_INCLUD
|
||||
|
||||
LINKOPT=
|
||||
EXEDIR=./runs
|
||||
DGEN2D=amg_d_pde2d_base_mod.o amg_d_pde2d_exp_mod.o amg_d_pde2d_gauss_mod.o amg_d_pde2d_box_mod.o
|
||||
DGEN3D=amg_d_pde3d_base_mod.o amg_d_pde3d_exp_mod.o amg_d_pde3d_gauss_mod.o amg_d_pde3d_box_mod.o
|
||||
SGEN2D=amg_s_pde2d_base_mod.o amg_s_pde2d_exp_mod.o amg_s_pde2d_gauss_mod.o amg_s_pde2d_box_mod.o
|
||||
SGEN3D=amg_s_pde3d_base_mod.o amg_s_pde3d_exp_mod.o amg_s_pde3d_gauss_mod.o amg_s_pde3d_box_mod.o
|
||||
|
||||
all: amg_s_pde3d amg_d_pde3d amg_s_pde2d amg_d_pde2d
|
||||
|
||||
amg_d_pde3d: amg_d_pde3d.o amg_d_genpde_mod.o amg_d_pde3d_base_mod.o amg_d_pde3d_exp_mod.o amg_d_pde3d_gauss_mod.o data_input.o
|
||||
$(FLINK) $(LINKOPT) amg_d_pde3d.o amg_d_genpde_mod.o amg_d_pde3d_base_mod.o amg_d_pde3d_exp_mod.o amg_d_pde3d_gauss_mod.o data_input.o -o amg_d_pde3d $(AMG_LIBS) $(PSBLAS_LIBS) $(LDLIBS)
|
||||
amg_d_pde3d: amg_d_pde3d.o amg_d_genpde_mod.o $(DGEN3D) data_input.o
|
||||
$(FLINK) $(LINKOPT) amg_d_pde3d.o amg_d_genpde_mod.o $(DGEN3D) data_input.o -o amg_d_pde3d $(AMG_LIBS) $(PSBLAS_LIBS) $(LDLIBS)
|
||||
/bin/mv amg_d_pde3d $(EXEDIR)
|
||||
|
||||
amg_s_pde3d: amg_s_pde3d.o amg_s_genpde_mod.o amg_s_pde3d_base_mod.o amg_s_pde3d_exp_mod.o amg_s_pde3d_gauss_mod.o data_input.o
|
||||
$(FLINK) $(LINKOPT) amg_s_pde3d.o amg_s_genpde_mod.o amg_s_pde3d_base_mod.o amg_s_pde3d_exp_mod.o amg_s_pde3d_gauss_mod.o data_input.o -o amg_s_pde3d $(AMG_LIBS) $(PSBLAS_LIBS) $(LDLIBS)
|
||||
amg_s_pde3d: amg_s_pde3d.o amg_s_genpde_mod.o $(SGEN3D) data_input.o
|
||||
$(FLINK) $(LINKOPT) amg_s_pde3d.o amg_s_genpde_mod.o $(SGEN3D) data_input.o -o amg_s_pde3d $(AMG_LIBS) $(PSBLAS_LIBS) $(LDLIBS)
|
||||
/bin/mv amg_s_pde3d $(EXEDIR)
|
||||
|
||||
amg_d_pde2d: amg_d_pde2d.o amg_d_genpde_mod.o amg_d_pde2d_base_mod.o amg_d_pde2d_exp_mod.o amg_d_pde2d_box_mod.o data_input.o
|
||||
$(FLINK) $(LINKOPT) amg_d_pde2d.o amg_d_genpde_mod.o amg_d_pde2d_base_mod.o amg_d_pde2d_exp_mod.o amg_d_pde2d_box_mod.o data_input.o -o amg_d_pde2d $(AMG_LIBS) $(PSBLAS_LIBS) $(LDLIBS)
|
||||
amg_d_pde2d: amg_d_pde2d.o amg_d_genpde_mod.o $(DGEN2D) data_input.o
|
||||
$(FLINK) $(LINKOPT) amg_d_pde2d.o amg_d_genpde_mod.o $(DGEN2D) data_input.o -o amg_d_pde2d $(AMG_LIBS) $(PSBLAS_LIBS) $(LDLIBS)
|
||||
/bin/mv amg_d_pde2d $(EXEDIR)
|
||||
|
||||
amg_s_pde2d: amg_s_pde2d.o amg_s_genpde_mod.o amg_s_pde2d_base_mod.o amg_s_pde2d_exp_mod.o amg_s_pde2d_box_mod.o data_input.o
|
||||
$(FLINK) $(LINKOPT) amg_s_pde2d.o amg_s_genpde_mod.o amg_s_pde2d_base_mod.o amg_s_pde2d_exp_mod.o amg_s_pde2d_box_mod.o data_input.o -o amg_s_pde2d $(AMG_LIBS) $(PSBLAS_LIBS) $(LDLIBS)
|
||||
amg_s_pde2d: amg_s_pde2d.o amg_s_genpde_mod.o $(SGEN2D) data_input.o
|
||||
$(FLINK) $(LINKOPT) amg_s_pde2d.o amg_s_genpde_mod.o $(SGEN2D) data_input.o -o amg_s_pde2d $(AMG_LIBS) $(PSBLAS_LIBS) $(LDLIBS)
|
||||
/bin/mv amg_s_pde2d $(EXEDIR)
|
||||
|
||||
amg_d_pde3d_rebld: amg_d_pde3d_rebld.o data_input.o
|
||||
@@ -33,10 +37,10 @@ amg_d_pde3d_rebld: amg_d_pde3d_rebld.o data_input.o
|
||||
|
||||
amg_d_pde3d.o amg_s_pde3d.o amg_d_pde2d.o amg_s_pde2d.o: data_input.o
|
||||
|
||||
amg_d_pde3d.o: amg_d_genpde_mod.o amg_d_pde3d_base_mod.o amg_d_pde3d_exp_mod.o amg_d_pde3d_gauss_mod.o
|
||||
amg_s_pde3d.o: amg_s_genpde_mod.o amg_s_pde3d_base_mod.o amg_s_pde3d_exp_mod.o amg_s_pde3d_gauss_mod.o
|
||||
amg_d_pde2d.o: amg_d_genpde_mod.o amg_d_pde2d_base_mod.o amg_d_pde2d_exp_mod.o amg_d_pde2d_box_mod.o
|
||||
amg_s_pde2d.o: amg_s_genpde_mod.o amg_s_pde2d_base_mod.o amg_s_pde2d_exp_mod.o amg_s_pde2d_box_mod.o
|
||||
amg_d_pde3d.o: amg_d_genpde_mod.o $(DGEN3D)
|
||||
amg_s_pde3d.o: amg_s_genpde_mod.o $(SGEN3D)
|
||||
amg_d_pde2d.o: amg_d_genpde_mod.o $(DGEN2D)
|
||||
amg_s_pde2d.o: amg_s_genpde_mod.o $(SGEN2D)
|
||||
|
||||
check: all
|
||||
cd runs && ./amg_d_pde2d <amg_pde2d.inp && ./amg_s_pde2d<amg_pde2d.inp
|
||||
|
||||
@@ -72,6 +72,7 @@ program amg_d_pde2d
|
||||
use amg_d_pde2d_base_mod
|
||||
use amg_d_pde2d_exp_mod
|
||||
use amg_d_pde2d_box_mod
|
||||
use amg_d_pde2d_gauss_mod
|
||||
use amg_d_genpde_mod
|
||||
#if defined(OPENMP)
|
||||
use omp_lib
|
||||
@@ -124,16 +125,16 @@ program amg_d_pde2d
|
||||
integer(psb_ipk_) :: outer_sweeps ! number of outer sweeps: sweeps for 1-level,
|
||||
! AMG cycles for ML
|
||||
! general AMG data
|
||||
character(len=16) :: mlcycle ! AMG cycle type
|
||||
character(len=32) :: mlcycle ! AMG cycle type
|
||||
integer(psb_ipk_) :: maxlevs ! maximum number of levels in AMG preconditioner
|
||||
|
||||
! AMG aggregation
|
||||
character(len=16) :: aggr_prol ! aggregation type: SMOOTHED, NONSMOOTHED
|
||||
character(len=16) :: par_aggr_alg ! parallel aggregation algorithm: DEC, SYMDEC
|
||||
character(len=16) :: aggr_type ! Type of aggregation SOC1, SOC2, MATCHBOXP
|
||||
character(len=32) :: aggr_prol ! aggregation type: SMOOTHED, NONSMOOTHED
|
||||
character(len=32) :: par_aggr_alg ! parallel aggregation algorithm: DEC, SYMDEC
|
||||
character(len=32) :: aggr_type ! Type of aggregation SOC1, SOC2, MATCHBOXP
|
||||
integer(psb_ipk_) :: aggr_size ! Requested size of the aggregates for MATCHBOXP
|
||||
character(len=16) :: aggr_ord ! ordering for aggregation: NATURAL, DEGREE
|
||||
character(len=16) :: aggr_filter ! filtering: FILTER, NO_FILTER
|
||||
character(len=32) :: aggr_ord ! ordering for aggregation: NATURAL, DEGREE
|
||||
character(len=32) :: aggr_filter ! filtering: FILTER, NO_FILTER
|
||||
real(psb_dpk_) :: mncrratio ! minimum aggregation ratio
|
||||
real(psb_dpk_), allocatable :: athresv(:) ! smoothed aggregation threshold vector
|
||||
integer(psb_ipk_) :: thrvsz ! size of threshold vector
|
||||
@@ -141,37 +142,39 @@ program amg_d_pde2d
|
||||
integer(psb_ipk_) :: csizepp ! minimum size of coarsest matrix per process
|
||||
|
||||
! AMG smoother or pre-smoother; also 1-lev preconditioner
|
||||
character(len=16) :: smther ! (pre-)smoother type: BJAC, AS
|
||||
integer(psb_ipk_) :: jsweeps ! (pre-)smoother / 1-lev prec. sweeps
|
||||
integer(psb_ipk_) :: novr ! number of overlap layers
|
||||
character(len=16) :: restr ! restriction over application of AS
|
||||
character(len=16) :: prol ! prolongation over application of AS
|
||||
character(len=16) :: solve ! local subsolver type: ILU, MILU, ILUT,
|
||||
! UMF, MUMPS, SLU, FWGS, BWGS, JAC
|
||||
character(len=16) :: variant ! AINV variant: LLK, etc
|
||||
integer(psb_ipk_) :: fill ! fill-in for incomplete LU factorization
|
||||
integer(psb_ipk_) :: invfill ! Inverse fill-in for INVK
|
||||
real(psb_dpk_) :: thr ! threshold for ILUT factorization
|
||||
character(len=32) :: smther ! (pre-)smoother type: BJAC, AS
|
||||
integer(psb_ipk_) :: jsweeps ! (pre-)smoother / 1-lev prec. sweeps
|
||||
integer(psb_ipk_) :: novr ! number of overlap layers
|
||||
character(len=32) :: restr ! restriction over application of AS
|
||||
character(len=32) :: prol ! prolongation over application of AS
|
||||
character(len=32) :: solve ! local subsolver type: ILU, MILU, ILUT,
|
||||
! UMF, MUMPS, SLU, FWGS, BWGS, JAC
|
||||
integer(psb_ipk_) :: ssweeps ! inner solver sweeps
|
||||
character(len=32) :: variant ! AINV variant: LLK, etc
|
||||
integer(psb_ipk_) :: fill ! fill-in for incomplete LU factorization
|
||||
integer(psb_ipk_) :: invfill ! Inverse fill-in for INVK
|
||||
real(psb_dpk_) :: thr ! threshold for ILUT factorization
|
||||
|
||||
! AMG post-smoother; ignored by 1-lev preconditioner
|
||||
character(len=16) :: smther2 ! post-smoother type: BJAC, AS
|
||||
integer(psb_ipk_) :: jsweeps2 ! post-smoother sweeps
|
||||
integer(psb_ipk_) :: novr2 ! number of overlap layers
|
||||
character(len=16) :: restr2 ! restriction over application of AS
|
||||
character(len=16) :: prol2 ! prolongation over application of AS
|
||||
character(len=16) :: solve2 ! local subsolver type: ILU, MILU, ILUT,
|
||||
! UMF, MUMPS, SLU, FWGS, BWGS, JAC
|
||||
character(len=16) :: variant2 ! AINV variant: LLK, etc
|
||||
integer(psb_ipk_) :: fill2 ! fill-in for incomplete LU factorization
|
||||
integer(psb_ipk_) :: invfill2 ! Inverse fill-in for INVK
|
||||
real(psb_dpk_) :: thr2 ! threshold for ILUT factorization
|
||||
character(len=32) :: smther2 ! post-smoother type: BJAC, AS
|
||||
integer(psb_ipk_) :: jsweeps2 ! post-smoother sweeps
|
||||
integer(psb_ipk_) :: novr2 ! number of overlap layers
|
||||
character(len=32) :: restr2 ! restriction over application of AS
|
||||
character(len=32) :: prol2 ! prolongation over application of AS
|
||||
character(len=32) :: solve2 ! local subsolver type: ILU, MILU, ILUT,
|
||||
! UMF, MUMPS, SLU, FWGS, BWGS, JAC
|
||||
integer(psb_ipk_) :: ssweeps2 ! inner solver sweeps
|
||||
character(len=32) :: variant2 ! AINV variant: LLK, etc
|
||||
integer(psb_ipk_) :: fill2 ! fill-in for incomplete LU factorization
|
||||
integer(psb_ipk_) :: invfill2 ! Inverse fill-in for INVK
|
||||
real(psb_dpk_) :: thr2 ! threshold for ILUT factorization
|
||||
|
||||
! coarsest-level solver
|
||||
character(len=16) :: cmat ! coarsest matrix layout: REPL, DIST
|
||||
character(len=16) :: csolve ! coarsest-lev solver: BJAC, SLUDIST (distr.
|
||||
character(len=32) :: cmat ! coarsest matrix layout: REPL, DIST
|
||||
character(len=32) :: csolve ! coarsest-lev solver: BJAC, SLUDIST (distr.
|
||||
! mat.); UMF, MUMPS, SLU, ILU, ILUT, MILU
|
||||
! (repl. mat.)
|
||||
character(len=16) :: csbsolve ! coarsest-lev local subsolver: ILU, ILUT,
|
||||
character(len=32) :: csbsolve ! coarsest-lev local subsolver: ILU, ILUT,
|
||||
! MILU, UMF, MUMPS, SLU
|
||||
integer(psb_ipk_) :: cfill ! fill-in for incomplete LU factorization
|
||||
real(psb_dpk_) :: cthres ! threshold for ILUT factorization
|
||||
@@ -239,13 +242,16 @@ program amg_d_pde2d
|
||||
select case(psb_toupper(trim(pdecoeff)))
|
||||
case("CONST")
|
||||
call amg_gen_pde2d(ctxt,idim,a,b,x,desc_a,afmt,&
|
||||
& a1,a2,b1,b2,c,g,info)
|
||||
& a1_base,a2_base,b1_base,b2_base,c_base,g_base,info)
|
||||
case("EXP")
|
||||
call amg_gen_pde2d(ctxt,idim,a,b,x,desc_a,afmt,&
|
||||
& a1_exp,a2_exp,b1_exp,b2_exp,c_exp,g_exp,info)
|
||||
case("BOX")
|
||||
call amg_gen_pde2d(ctxt,idim,a,b,x,desc_a,afmt,&
|
||||
& a1_box,a2_box,b1_box,b2_box,c_box,g_box,info)
|
||||
case("GAUSS")
|
||||
call amg_gen_pde2d(ctxt,idim,a,b,x,desc_a,afmt,&
|
||||
& a1_gauss,a2_gauss,b1_gauss,b2_gauss,c_gauss,g_gauss,info)
|
||||
case default
|
||||
info=psb_err_from_subroutine_
|
||||
ch_err='amg_gen_pdecoeff'
|
||||
@@ -282,6 +288,9 @@ program amg_d_pde2d
|
||||
case ('BJAC')
|
||||
call prec%set('smoother_sweeps', p_choice%jsweeps, info)
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
call prec%set('solver_sweeps', p_choice%ssweeps, info)
|
||||
if (psb_toupper(p_choice%solve)=='MUMPS') &
|
||||
& call prec%set('mumps_loc_glob','local_solver',info)
|
||||
call prec%set('sub_fillin', p_choice%fill, info)
|
||||
call prec%set('sub_iluthrs', p_choice%thr, info)
|
||||
|
||||
@@ -291,6 +300,9 @@ program amg_d_pde2d
|
||||
call prec%set('sub_restr', p_choice%restr, info)
|
||||
call prec%set('sub_prol', p_choice%prol, info)
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
call prec%set('solver_sweeps', p_choice%ssweeps, info)
|
||||
if (psb_toupper(p_choice%solve)=='MUMPS') &
|
||||
& call prec%set('mumps_loc_glob','local_solver',info)
|
||||
call prec%set('sub_fillin', p_choice%fill, info)
|
||||
call prec%set('sub_iluthrs', p_choice%thr, info)
|
||||
|
||||
@@ -342,8 +354,10 @@ program amg_d_pde2d
|
||||
call prec%set('ainv_alg', p_choice%variant, info)
|
||||
case default
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
if (psb_toupper(p_choice%solve)=='MUMPS') &
|
||||
& call prec%set('mumps_loc_glob','local_solver',info)
|
||||
end select
|
||||
|
||||
call prec%set('solver_sweeps', p_choice%ssweeps, info)
|
||||
call prec%set('sub_fillin', p_choice%fill, info)
|
||||
call prec%set('inv_fillin', p_choice%invfill, info)
|
||||
call prec%set('sub_iluthrs', p_choice%thr, info)
|
||||
@@ -369,8 +383,10 @@ program amg_d_pde2d
|
||||
call prec%set('ainv_alg', p_choice%variant2, info)
|
||||
case default
|
||||
call prec%set('sub_solve', p_choice%solve2, info, pos='post')
|
||||
if (psb_toupper(p_choice%solve2)=='MUMPS') &
|
||||
& call prec%set('mumps_loc_glob','local_solver',info)
|
||||
end select
|
||||
|
||||
call prec%set('solver_sweeps', p_choice%ssweeps2, info,pos='post')
|
||||
call prec%set('sub_fillin', p_choice%fill2, info,pos='post')
|
||||
call prec%set('inv_fillin', p_choice%invfill2, info,pos='post')
|
||||
call prec%set('sub_iluthrs', p_choice%thr2, info,pos='post')
|
||||
@@ -569,6 +585,7 @@ contains
|
||||
call read_data(prec%restr,inp_unit) ! restriction over application of AS
|
||||
call read_data(prec%prol,inp_unit) ! prolongation over application of AS
|
||||
call read_data(prec%solve,inp_unit) ! local subsolver
|
||||
call read_data(prec%ssweeps,inp_unit) ! inner solver sweeps
|
||||
call read_data(prec%variant,inp_unit) ! AINV variant
|
||||
call read_data(prec%fill,inp_unit) ! fill-in for incomplete LU
|
||||
call read_data(prec%invfill,inp_unit) !Inverse fill-in for INVK
|
||||
@@ -580,6 +597,7 @@ contains
|
||||
call read_data(prec%restr2,inp_unit) ! restriction over application of AS
|
||||
call read_data(prec%prol2,inp_unit) ! prolongation over application of AS
|
||||
call read_data(prec%solve2,inp_unit) ! local subsolver
|
||||
call read_data(prec%ssweeps2,inp_unit) ! inner solver sweeps
|
||||
call read_data(prec%variant2,inp_unit) ! AINV variant
|
||||
call read_data(prec%fill2,inp_unit) ! fill-in for incomplete LU
|
||||
call read_data(prec%invfill2,inp_unit) !Inverse fill-in for INVK
|
||||
@@ -649,6 +667,7 @@ contains
|
||||
call psb_bcast(ctxt,prec%restr)
|
||||
call psb_bcast(ctxt,prec%prol)
|
||||
call psb_bcast(ctxt,prec%solve)
|
||||
call psb_bcast(ctxt,prec%ssweeps)
|
||||
call psb_bcast(ctxt,prec%variant)
|
||||
call psb_bcast(ctxt,prec%fill)
|
||||
call psb_bcast(ctxt,prec%invfill)
|
||||
@@ -660,6 +679,7 @@ contains
|
||||
call psb_bcast(ctxt,prec%restr2)
|
||||
call psb_bcast(ctxt,prec%prol2)
|
||||
call psb_bcast(ctxt,prec%solve2)
|
||||
call psb_bcast(ctxt,prec%ssweeps2)
|
||||
call psb_bcast(ctxt,prec%variant2)
|
||||
call psb_bcast(ctxt,prec%fill2)
|
||||
call psb_bcast(ctxt,prec%invfill2)
|
||||
|
||||
@@ -38,52 +38,52 @@ module amg_d_pde2d_base_mod
|
||||
use psb_base_mod, only : psb_dpk_, dzero, done
|
||||
real(psb_dpk_), save, private :: epsilon=done/80
|
||||
contains
|
||||
subroutine pde_set_parm(dat)
|
||||
subroutine pde_set_parm2d_base(dat)
|
||||
real(psb_dpk_), intent(in) :: dat
|
||||
epsilon = dat
|
||||
end subroutine pde_set_parm
|
||||
end subroutine pde_set_parm2d_base
|
||||
!
|
||||
! functions parametrizing the differential equation
|
||||
!
|
||||
function b1(x,y)
|
||||
use psb_base_mod, only : psb_dpk_, dzero, done
|
||||
real(psb_dpk_) :: b1
|
||||
function b1_base(x,y)
|
||||
implicit none
|
||||
real(psb_dpk_) :: b1_base
|
||||
real(psb_dpk_), intent(in) :: x,y
|
||||
b1 = dzero/1.414_psb_dpk_
|
||||
end function b1
|
||||
function b2(x,y)
|
||||
use psb_base_mod, only : psb_dpk_, dzero, done
|
||||
real(psb_dpk_) :: b2
|
||||
b1_base = dzero/1.414_psb_dpk_
|
||||
end function b1_base
|
||||
function b2_base(x,y)
|
||||
implicit none
|
||||
real(psb_dpk_) :: b2_base
|
||||
real(psb_dpk_), intent(in) :: x,y
|
||||
b2 = dzero/1.414_psb_dpk_
|
||||
end function b2
|
||||
function c(x,y)
|
||||
use psb_base_mod, only : psb_dpk_, dzero, done
|
||||
real(psb_dpk_) :: c
|
||||
b2_base = dzero/1.414_psb_dpk_
|
||||
end function b2_base
|
||||
function c_base(x,y)
|
||||
implicit none
|
||||
real(psb_dpk_) :: c_base
|
||||
real(psb_dpk_), intent(in) :: x,y
|
||||
c = dzero
|
||||
end function c
|
||||
function a1(x,y)
|
||||
use psb_base_mod, only : psb_dpk_, dzero, done
|
||||
real(psb_dpk_) :: a1
|
||||
c_base = dzero
|
||||
end function c_base
|
||||
function a1_base(x,y)
|
||||
implicit none
|
||||
real(psb_dpk_) :: a1_base
|
||||
real(psb_dpk_), intent(in) :: x,y
|
||||
a1=done*epsilon
|
||||
end function a1
|
||||
function a2(x,y)
|
||||
use psb_base_mod, only : psb_dpk_, dzero, done
|
||||
real(psb_dpk_) :: a2
|
||||
a1_base=done*epsilon
|
||||
end function a1_base
|
||||
function a2_base(x,y)
|
||||
implicit none
|
||||
real(psb_dpk_) :: a2_base
|
||||
real(psb_dpk_), intent(in) :: x,y
|
||||
a2=done*epsilon
|
||||
end function a2
|
||||
function g(x,y)
|
||||
use psb_base_mod, only : psb_dpk_, dzero, done
|
||||
real(psb_dpk_) :: g
|
||||
a2_base=done*epsilon
|
||||
end function a2_base
|
||||
function g_base(x,y)
|
||||
implicit none
|
||||
real(psb_dpk_) :: g_base
|
||||
real(psb_dpk_), intent(in) :: x,y
|
||||
g = dzero
|
||||
g_base = dzero
|
||||
if (x == done) then
|
||||
g = done
|
||||
g_base = done
|
||||
else if (x == dzero) then
|
||||
g = done
|
||||
g_base = done
|
||||
end if
|
||||
end function g
|
||||
end function g_base
|
||||
end module amg_d_pde2d_base_mod
|
||||
|
||||
@@ -38,45 +38,45 @@ module amg_d_pde2d_box_mod
|
||||
use psb_base_mod, only : psb_dpk_, dzero, done
|
||||
real(psb_dpk_), save, private :: epsilon=done/80
|
||||
contains
|
||||
subroutine pde_set_parm(dat)
|
||||
subroutine pde_set_parm2d_box(dat)
|
||||
real(psb_dpk_), intent(in) :: dat
|
||||
epsilon = dat
|
||||
end subroutine pde_set_parm
|
||||
end subroutine pde_set_parm2d_box
|
||||
!
|
||||
! functions parametrizing the differential equation
|
||||
!
|
||||
function b1_box(x,y)
|
||||
use psb_base_mod, only : psb_dpk_, dzero, done
|
||||
implicit none
|
||||
real(psb_dpk_) :: b1_box
|
||||
real(psb_dpk_), intent(in) :: x,y
|
||||
b1_box = done/1.414_psb_dpk_
|
||||
end function b1_box
|
||||
function b2_box(x,y)
|
||||
use psb_base_mod, only : psb_dpk_, dzero, done
|
||||
implicit none
|
||||
real(psb_dpk_) :: b2_box
|
||||
real(psb_dpk_), intent(in) :: x,y
|
||||
b2_box = done/1.414_psb_dpk_
|
||||
end function b2_box
|
||||
function c_box(x,y)
|
||||
use psb_base_mod, only : psb_dpk_, dzero, done
|
||||
implicit none
|
||||
real(psb_dpk_) :: c_box
|
||||
real(psb_dpk_), intent(in) :: x,y
|
||||
c_box = dzero
|
||||
end function c_box
|
||||
function a1_box(x,y)
|
||||
use psb_base_mod, only : psb_dpk_, dzero, done
|
||||
implicit none
|
||||
real(psb_dpk_) :: a1_box
|
||||
real(psb_dpk_), intent(in) :: x,y
|
||||
a1_box=done*epsilon
|
||||
end function a1_box
|
||||
function a2_box(x,y)
|
||||
use psb_base_mod, only : psb_dpk_, dzero, done
|
||||
implicit none
|
||||
real(psb_dpk_) :: a2_box
|
||||
real(psb_dpk_), intent(in) :: x,y
|
||||
a2_box=done*epsilon
|
||||
end function a2_box
|
||||
function g_box(x,y)
|
||||
use psb_base_mod, only : psb_dpk_, dzero, done
|
||||
implicit none
|
||||
real(psb_dpk_) :: g_box
|
||||
real(psb_dpk_), intent(in) :: x,y
|
||||
g_box = dzero
|
||||
|
||||
@@ -38,45 +38,45 @@ module amg_d_pde2d_exp_mod
|
||||
use psb_base_mod, only : psb_dpk_, done, dzero
|
||||
real(psb_dpk_), save, private :: epsilon=done/80
|
||||
contains
|
||||
subroutine pde_set_parm(dat)
|
||||
subroutine pde_set_parm2d_exp(dat)
|
||||
real(psb_dpk_), intent(in) :: dat
|
||||
epsilon = dat
|
||||
end subroutine pde_set_parm
|
||||
end subroutine pde_set_parm2d_exp
|
||||
!
|
||||
! functions parametrizing the differential equation
|
||||
!
|
||||
function b1_exp(x,y)
|
||||
use psb_base_mod, only : psb_dpk_, done, dzero
|
||||
implicit none
|
||||
real(psb_dpk_) :: b1_exp
|
||||
real(psb_dpk_), intent(in) :: x,y
|
||||
b1_exp = dzero
|
||||
end function b1_exp
|
||||
function b2_exp(x,y)
|
||||
use psb_base_mod, only : psb_dpk_, done, dzero
|
||||
implicit none
|
||||
real(psb_dpk_) :: b2_exp
|
||||
real(psb_dpk_), intent(in) :: x,y
|
||||
b2_exp = dzero
|
||||
end function b2_exp
|
||||
function c_exp(x,y)
|
||||
use psb_base_mod, only : psb_dpk_, done, dzero
|
||||
implicit none
|
||||
real(psb_dpk_) :: c_exp
|
||||
real(psb_dpk_), intent(in) :: x,y
|
||||
c_exp = dzero
|
||||
end function c_exp
|
||||
function a1_exp(x,y)
|
||||
use psb_base_mod, only : psb_dpk_, done, dzero
|
||||
implicit none
|
||||
real(psb_dpk_) :: a1_exp
|
||||
real(psb_dpk_), intent(in) :: x,y
|
||||
a1=done*epsilon*exp(-(x+y))
|
||||
a1_exp=done*epsilon*exp(-(x+y))
|
||||
end function a1_exp
|
||||
function a2_exp(x,y)
|
||||
use psb_base_mod, only : psb_dpk_, done, dzero
|
||||
implicit none
|
||||
real(psb_dpk_) :: a2_exp
|
||||
real(psb_dpk_), intent(in) :: x,y
|
||||
a2=done*epsilon*exp(-(x+y))
|
||||
a2_exp=done*epsilon*exp(-(x+y))
|
||||
end function a2_exp
|
||||
function g_exp(x,y)
|
||||
use psb_base_mod, only : psb_dpk_, done, dzero
|
||||
implicit none
|
||||
real(psb_dpk_) :: g_exp
|
||||
real(psb_dpk_), intent(in) :: x,y
|
||||
g_exp = dzero
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! 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 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.
|
||||
!
|
||||
module amg_d_pde2d_gauss_mod
|
||||
use psb_base_mod, only : psb_dpk_, done, dzero
|
||||
real(psb_dpk_), save, private :: epsilon=done/80
|
||||
contains
|
||||
subroutine pde_set_parm2d_gauss(dat)
|
||||
real(psb_dpk_), intent(in) :: dat
|
||||
epsilon = dat
|
||||
end subroutine pde_set_parm2d_gauss
|
||||
!
|
||||
! functions parametrizing the differential equation
|
||||
!
|
||||
function b1_gauss(x,y)
|
||||
implicit none
|
||||
real(psb_dpk_) :: b1_gauss
|
||||
real(psb_dpk_), intent(in) :: x,y
|
||||
b1_gauss=done/sqrt(3.0_psb_dpk_)-2*x*exp(-(x**2+y**2))
|
||||
end function b1_gauss
|
||||
function b2_gauss(x,y)
|
||||
implicit none
|
||||
real(psb_dpk_) :: b2_gauss
|
||||
real(psb_dpk_), intent(in) :: x,y
|
||||
b2_gauss=done/sqrt(3.0_psb_dpk_)-2*y*exp(-(x**2+y**2))
|
||||
end function b2_gauss
|
||||
function c_gauss(x,y)
|
||||
implicit none
|
||||
real(psb_dpk_) :: c_gauss
|
||||
real(psb_dpk_), intent(in) :: x,y
|
||||
c_gauss=dzero
|
||||
end function c_gauss
|
||||
function a1_gauss(x,y)
|
||||
implicit none
|
||||
real(psb_dpk_) :: a1_gauss
|
||||
real(psb_dpk_), intent(in) :: x,y
|
||||
a1_gauss=epsilon*exp(-(x**2+y**2))
|
||||
end function a1_gauss
|
||||
function a2_gauss(x,y)
|
||||
implicit none
|
||||
real(psb_dpk_) :: a2_gauss
|
||||
real(psb_dpk_), intent(in) :: x,y
|
||||
a2_gauss=epsilon*exp(-(x**2+y**2))
|
||||
end function a2_gauss
|
||||
function g_gauss(x,y)
|
||||
implicit none
|
||||
real(psb_dpk_) :: g_gauss
|
||||
real(psb_dpk_), intent(in) :: x,y
|
||||
g_gauss = dzero
|
||||
if (x == done) then
|
||||
g_gauss = done
|
||||
else if (x == dzero) then
|
||||
g_gauss = done
|
||||
end if
|
||||
end function g_gauss
|
||||
end module amg_d_pde2d_gauss_mod
|
||||
@@ -72,6 +72,7 @@ program amg_d_pde3d
|
||||
use data_input
|
||||
use amg_d_pde3d_base_mod
|
||||
use amg_d_pde3d_exp_mod
|
||||
use amg_d_pde3d_box_mod
|
||||
use amg_d_pde3d_gauss_mod
|
||||
use amg_d_genpde_mod
|
||||
#if defined(OPENMP)
|
||||
@@ -125,63 +126,65 @@ program amg_d_pde3d
|
||||
integer(psb_ipk_) :: outer_sweeps ! number of outer sweeps: sweeps for 1-level,
|
||||
! AMG cycles for ML
|
||||
! general AMG data
|
||||
character(len=16) :: mlcycle ! AMG cycle type
|
||||
integer(psb_ipk_) :: maxlevs ! maximum number of levels in AMG preconditioner
|
||||
character(len=32) :: mlcycle ! AMG cycle type
|
||||
integer(psb_ipk_) :: maxlevs ! maximum number of levels in AMG preconditioner
|
||||
|
||||
! AMG aggregation
|
||||
character(len=16) :: aggr_prol ! aggregation type: SMOOTHED, NONSMOOTHED
|
||||
character(len=16) :: par_aggr_alg ! parallel aggregation algorithm: DEC, SYMDEC
|
||||
character(len=16) :: aggr_type ! Type of aggregation SOC1, SOC2, MATCHBOXP
|
||||
integer(psb_ipk_) :: aggr_size ! Requested size of the aggregates for MATCHBOXP
|
||||
character(len=16) :: aggr_ord ! ordering for aggregation: NATURAL, DEGREE
|
||||
character(len=16) :: aggr_filter ! filtering: FILTER, NO_FILTER
|
||||
real(psb_dpk_) :: mncrratio ! minimum aggregation ratio
|
||||
character(len=32) :: aggr_prol ! aggregation type: SMOOTHED, NONSMOOTHED
|
||||
character(len=32) :: par_aggr_alg ! parallel aggregation algorithm: DEC, SYMDEC
|
||||
character(len=32) :: aggr_type ! Type of aggregation SOC1, SOC2, MATCHBOXP
|
||||
integer(psb_ipk_) :: aggr_size ! Requested size of the aggregates for MATCHBOXP
|
||||
character(len=32) :: aggr_ord ! ordering for aggregation: NATURAL, DEGREE
|
||||
character(len=32) :: aggr_filter ! filtering: FILTER, NO_FILTER
|
||||
real(psb_dpk_) :: mncrratio ! minimum aggregation ratio
|
||||
real(psb_dpk_), allocatable :: athresv(:) ! smoothed aggregation threshold vector
|
||||
integer(psb_ipk_) :: thrvsz ! size of threshold vector
|
||||
real(psb_dpk_) :: athres ! smoothed aggregation threshold
|
||||
integer(psb_ipk_) :: csizepp ! minimum size of coarsest matrix per process
|
||||
integer(psb_ipk_) :: thrvsz ! size of threshold vector
|
||||
real(psb_dpk_) :: athres ! smoothed aggregation threshold
|
||||
integer(psb_ipk_) :: csizepp ! minimum size of coarsest matrix per process
|
||||
|
||||
! AMG smoother or pre-smoother; also 1-lev preconditioner
|
||||
character(len=16) :: smther ! (pre-)smoother type: BJAC, AS
|
||||
integer(psb_ipk_) :: jsweeps ! (pre-)smoother / 1-lev prec. sweeps
|
||||
integer(psb_ipk_) :: novr ! number of overlap layers
|
||||
character(len=16) :: restr ! restriction over application of AS
|
||||
character(len=16) :: prol ! prolongation over application of AS
|
||||
character(len=16) :: solve ! local subsolver type: ILU, MILU, ILUT,
|
||||
! UMF, MUMPS, SLU, FWGS, BWGS, JAC
|
||||
character(len=16) :: variant ! AINV variant: LLK, etc
|
||||
integer(psb_ipk_) :: fill ! fill-in for incomplete LU factorization
|
||||
integer(psb_ipk_) :: invfill ! Inverse fill-in for INVK
|
||||
real(psb_dpk_) :: thr ! threshold for ILUT factorization
|
||||
character(len=32) :: smther ! (pre-)smoother type: BJAC, AS
|
||||
integer(psb_ipk_) :: jsweeps ! (pre-)smoother / 1-lev prec. sweeps
|
||||
integer(psb_ipk_) :: novr ! number of overlap layers
|
||||
character(len=32) :: restr ! restriction over application of AS
|
||||
character(len=32) :: prol ! prolongation over application of AS
|
||||
character(len=32) :: solve ! local subsolver type: ILU, MILU, ILUT,
|
||||
! UMF, MUMPS, SLU, FWGS, BWGS, JAC
|
||||
integer(psb_ipk_) :: ssweeps ! inner solver sweeps
|
||||
character(len=32) :: variant ! AINV variant: LLK, etc
|
||||
integer(psb_ipk_) :: fill ! fill-in for incomplete LU factorization
|
||||
integer(psb_ipk_) :: invfill ! Inverse fill-in for INVK
|
||||
real(psb_dpk_) :: thr ! threshold for ILUT factorization
|
||||
|
||||
! AMG post-smoother; ignored by 1-lev preconditioner
|
||||
character(len=16) :: smther2 ! post-smoother type: BJAC, AS
|
||||
integer(psb_ipk_) :: jsweeps2 ! post-smoother sweeps
|
||||
integer(psb_ipk_) :: novr2 ! number of overlap layers
|
||||
character(len=16) :: restr2 ! restriction over application of AS
|
||||
character(len=16) :: prol2 ! prolongation over application of AS
|
||||
character(len=16) :: solve2 ! local subsolver type: ILU, MILU, ILUT,
|
||||
! UMF, MUMPS, SLU, FWGS, BWGS, JAC
|
||||
character(len=16) :: variant2 ! AINV variant: LLK, etc
|
||||
integer(psb_ipk_) :: fill2 ! fill-in for incomplete LU factorization
|
||||
integer(psb_ipk_) :: invfill2 ! Inverse fill-in for INVK
|
||||
real(psb_dpk_) :: thr2 ! threshold for ILUT factorization
|
||||
character(len=32) :: smther2 ! post-smoother type: BJAC, AS
|
||||
integer(psb_ipk_) :: jsweeps2 ! post-smoother sweeps
|
||||
integer(psb_ipk_) :: novr2 ! number of overlap layers
|
||||
character(len=32) :: restr2 ! restriction over application of AS
|
||||
character(len=32) :: prol2 ! prolongation over application of AS
|
||||
character(len=32) :: solve2 ! local subsolver type: ILU, MILU, ILUT,
|
||||
! UMF, MUMPS, SLU, FWGS, BWGS, JAC
|
||||
integer(psb_ipk_) :: ssweeps2 ! inner solver sweeps
|
||||
character(len=32) :: variant2 ! AINV variant: LLK, etc
|
||||
integer(psb_ipk_) :: fill2 ! fill-in for incomplete LU factorization
|
||||
integer(psb_ipk_) :: invfill2 ! Inverse fill-in for INVK
|
||||
real(psb_dpk_) :: thr2 ! threshold for ILUT factorization
|
||||
|
||||
! coarsest-level solver
|
||||
character(len=16) :: cmat ! coarsest matrix layout: REPL, DIST
|
||||
character(len=16) :: csolve ! coarsest-lev solver: BJAC, SLUDIST (distr.
|
||||
! mat.); UMF, MUMPS, SLU, ILU, ILUT, MILU
|
||||
! (repl. mat.)
|
||||
character(len=16) :: csbsolve ! coarsest-lev local subsolver: ILU, ILUT,
|
||||
! MILU, UMF, MUMPS, SLU
|
||||
integer(psb_ipk_) :: cfill ! fill-in for incomplete LU factorization
|
||||
real(psb_dpk_) :: cthres ! threshold for ILUT factorization
|
||||
integer(psb_ipk_) :: cjswp ! sweeps for GS or JAC coarsest-lev subsolver
|
||||
character(len=32) :: cmat ! coarsest matrix layout: REPL, DIST
|
||||
character(len=32) :: csolve ! coarsest-lev solver: BJAC, SLUDIST (distr.
|
||||
! mat.); UMF, MUMPS, SLU, ILU, ILUT, MILU
|
||||
! (repl. mat.)
|
||||
character(len=32) :: csbsolve ! coarsest-lev local subsolver: ILU, ILUT,
|
||||
! MILU, UMF, MUMPS, SLU
|
||||
integer(psb_ipk_) :: cfill ! fill-in for incomplete LU factorization
|
||||
real(psb_dpk_) :: cthres ! threshold for ILUT factorization
|
||||
integer(psb_ipk_) :: cjswp ! sweeps for GS or JAC coarsest-lev subsolver
|
||||
|
||||
! Dump data
|
||||
logical :: dump = .false.
|
||||
integer(psb_ipk_) :: dlmin ! Minimum level to dump
|
||||
integer(psb_ipk_) :: dlmax ! Maximum level to dump
|
||||
integer(psb_ipk_) :: dlmin ! Minimum level to dump
|
||||
integer(psb_ipk_) :: dlmax ! Maximum level to dump
|
||||
logical :: dump_ac = .false.
|
||||
logical :: dump_rp = .false.
|
||||
logical :: dump_tprol = .false.
|
||||
@@ -241,10 +244,13 @@ program amg_d_pde3d
|
||||
select case(psb_toupper(trim(pdecoeff)))
|
||||
case("CONST")
|
||||
call amg_gen_pde3d(ctxt,idim,a,b,x,desc_a,afmt,&
|
||||
& a1,a2,a3,b1,b2,b3,c,g,info)
|
||||
& a1_base,a2_base,a3_base,b1_base,b2_base,b3_base,c_base,g_base,info)
|
||||
case("EXP")
|
||||
call amg_gen_pde3d(ctxt,idim,a,b,x,desc_a,afmt,&
|
||||
& a1_exp,a2_exp,a3_exp,b1_exp,b2_exp,b3_exp,c_exp,g_exp,info)
|
||||
case("BOX")
|
||||
call amg_gen_pde3d(ctxt,idim,a,b,x,desc_a,afmt,&
|
||||
& a1_box,a2_box,a3_box,b1_box,b2_box,b3_box,c_box,g_box,info)
|
||||
case("GAUSS")
|
||||
call amg_gen_pde3d(ctxt,idim,a,b,x,desc_a,afmt,&
|
||||
& a1_gauss,a2_gauss,a3_gauss,b1_gauss,b2_gauss,b3_gauss,c_gauss,g_gauss,info)
|
||||
@@ -286,6 +292,9 @@ program amg_d_pde3d
|
||||
case ('BJAC')
|
||||
call prec%set('smoother_sweeps', p_choice%jsweeps, info)
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
call prec%set('solver_sweeps', p_choice%ssweeps, info)
|
||||
if (psb_toupper(p_choice%solve)=='MUMPS') &
|
||||
& call prec%set('mumps_loc_glob','local_solver',info)
|
||||
call prec%set('sub_fillin', p_choice%fill, info)
|
||||
call prec%set('sub_iluthrs', p_choice%thr, info)
|
||||
|
||||
@@ -295,6 +304,9 @@ program amg_d_pde3d
|
||||
call prec%set('sub_restr', p_choice%restr, info)
|
||||
call prec%set('sub_prol', p_choice%prol, info)
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
call prec%set('solver_sweeps', p_choice%ssweeps, info)
|
||||
if (psb_toupper(p_choice%solve)=='MUMPS') &
|
||||
& call prec%set('mumps_loc_glob','local_solver',info)
|
||||
call prec%set('sub_fillin', p_choice%fill, info)
|
||||
call prec%set('sub_iluthrs', p_choice%thr, info)
|
||||
|
||||
@@ -346,8 +358,10 @@ program amg_d_pde3d
|
||||
call prec%set('ainv_alg', p_choice%variant, info)
|
||||
case default
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
if (psb_toupper(p_choice%solve)=='MUMPS') &
|
||||
& call prec%set('mumps_loc_glob','local_solver',info)
|
||||
end select
|
||||
|
||||
call prec%set('solver_sweeps', p_choice%ssweeps, info)
|
||||
call prec%set('sub_fillin', p_choice%fill, info)
|
||||
call prec%set('inv_fillin', p_choice%invfill, info)
|
||||
call prec%set('sub_iluthrs', p_choice%thr, info)
|
||||
@@ -373,8 +387,10 @@ program amg_d_pde3d
|
||||
call prec%set('ainv_alg', p_choice%variant2, info)
|
||||
case default
|
||||
call prec%set('sub_solve', p_choice%solve2, info, pos='post')
|
||||
if (psb_toupper(p_choice%solve2)=='MUMPS') &
|
||||
& call prec%set('mumps_loc_glob','local_solver',info)
|
||||
end select
|
||||
|
||||
call prec%set('solver_sweeps', p_choice%ssweeps2, info,pos='post')
|
||||
call prec%set('sub_fillin', p_choice%fill2, info,pos='post')
|
||||
call prec%set('inv_fillin', p_choice%invfill2, info,pos='post')
|
||||
call prec%set('sub_iluthrs', p_choice%thr2, info,pos='post')
|
||||
@@ -492,7 +508,7 @@ program amg_d_pde3d
|
||||
write(psb_out_unit,'("Storage format for DESC_A : ",a )') desc_a%get_fmt()
|
||||
|
||||
end if
|
||||
call psb_print_timers(ctxt)
|
||||
|
||||
!
|
||||
! cleanup storage and exit
|
||||
!
|
||||
@@ -573,6 +589,7 @@ contains
|
||||
call read_data(prec%restr,inp_unit) ! restriction over application of AS
|
||||
call read_data(prec%prol,inp_unit) ! prolongation over application of AS
|
||||
call read_data(prec%solve,inp_unit) ! local subsolver
|
||||
call read_data(prec%ssweeps,inp_unit) ! inner solver sweeps
|
||||
call read_data(prec%variant,inp_unit) ! AINV variant
|
||||
call read_data(prec%fill,inp_unit) ! fill-in for incomplete LU
|
||||
call read_data(prec%invfill,inp_unit) !Inverse fill-in for INVK
|
||||
@@ -584,6 +601,7 @@ contains
|
||||
call read_data(prec%restr2,inp_unit) ! restriction over application of AS
|
||||
call read_data(prec%prol2,inp_unit) ! prolongation over application of AS
|
||||
call read_data(prec%solve2,inp_unit) ! local subsolver
|
||||
call read_data(prec%ssweeps2,inp_unit) ! inner solver sweeps
|
||||
call read_data(prec%variant2,inp_unit) ! AINV variant
|
||||
call read_data(prec%fill2,inp_unit) ! fill-in for incomplete LU
|
||||
call read_data(prec%invfill2,inp_unit) !Inverse fill-in for INVK
|
||||
@@ -653,6 +671,7 @@ contains
|
||||
call psb_bcast(ctxt,prec%restr)
|
||||
call psb_bcast(ctxt,prec%prol)
|
||||
call psb_bcast(ctxt,prec%solve)
|
||||
call psb_bcast(ctxt,prec%ssweeps)
|
||||
call psb_bcast(ctxt,prec%variant)
|
||||
call psb_bcast(ctxt,prec%fill)
|
||||
call psb_bcast(ctxt,prec%invfill)
|
||||
@@ -664,6 +683,7 @@ contains
|
||||
call psb_bcast(ctxt,prec%restr2)
|
||||
call psb_bcast(ctxt,prec%prol2)
|
||||
call psb_bcast(ctxt,prec%solve2)
|
||||
call psb_bcast(ctxt,prec%ssweeps2)
|
||||
call psb_bcast(ctxt,prec%variant2)
|
||||
call psb_bcast(ctxt,prec%fill2)
|
||||
call psb_bcast(ctxt,prec%invfill2)
|
||||
|
||||
@@ -35,67 +35,67 @@
|
||||
! POSSIBILITY OF SUCH DAMAGE.
|
||||
!
|
||||
module amg_d_pde3d_base_mod
|
||||
use psb_base_mod, only : psb_dpk_, done
|
||||
use psb_base_mod, only : psb_dpk_, done, dzero
|
||||
real(psb_dpk_), save, private :: epsilon=done/80
|
||||
contains
|
||||
subroutine pde_set_parm(dat)
|
||||
subroutine pde_set_parm3d_base(dat)
|
||||
real(psb_dpk_), intent(in) :: dat
|
||||
epsilon = dat
|
||||
end subroutine pde_set_parm
|
||||
end subroutine pde_set_parm3d_base
|
||||
!
|
||||
! functions parametrizing the differential equation
|
||||
!
|
||||
function b1(x,y,z)
|
||||
use psb_base_mod, only : psb_dpk_, done
|
||||
real(psb_dpk_) :: b1
|
||||
function b1_base(x,y,z)
|
||||
implicit none
|
||||
real(psb_dpk_) :: b1_base
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
b1=done/sqrt(3.0_psb_dpk_)
|
||||
end function b1
|
||||
function b2(x,y,z)
|
||||
use psb_base_mod, only : psb_dpk_, done
|
||||
real(psb_dpk_) :: b2
|
||||
b1_base=dzero/sqrt(3.0_psb_dpk_)
|
||||
end function b1_base
|
||||
function b2_base(x,y,z)
|
||||
implicit none
|
||||
real(psb_dpk_) :: b2_base
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
b2=done/sqrt(3.0_psb_dpk_)
|
||||
end function b2
|
||||
function b3(x,y,z)
|
||||
use psb_base_mod, only : psb_dpk_, done
|
||||
real(psb_dpk_) :: b3
|
||||
b2_base=dzero/sqrt(3.0_psb_dpk_)
|
||||
end function b2_base
|
||||
function b3_base(x,y,z)
|
||||
implicit none
|
||||
real(psb_dpk_) :: b3_base
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
b3=done/sqrt(3.0_psb_dpk_)
|
||||
end function b3
|
||||
function c(x,y,z)
|
||||
use psb_base_mod, only : psb_dpk_, dzero, done
|
||||
real(psb_dpk_) :: c
|
||||
b3_base=dzero/sqrt(3.0_psb_dpk_)
|
||||
end function b3_base
|
||||
function c_base(x,y,z)
|
||||
implicit none
|
||||
real(psb_dpk_) :: c_base
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
c=dzero
|
||||
end function c
|
||||
function a1(x,y,z)
|
||||
use psb_base_mod, only : psb_dpk_
|
||||
real(psb_dpk_) :: a1
|
||||
c_base=dzero
|
||||
end function c_base
|
||||
function a1_base(x,y,z)
|
||||
implicit none
|
||||
real(psb_dpk_) :: a1_base
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
a1=epsilon
|
||||
end function a1
|
||||
function a2(x,y,z)
|
||||
use psb_base_mod, only : psb_dpk_
|
||||
real(psb_dpk_) :: a2
|
||||
a1_base=epsilon
|
||||
end function a1_base
|
||||
function a2_base(x,y,z)
|
||||
implicit none
|
||||
real(psb_dpk_) :: a2_base
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
a2=epsilon
|
||||
end function a2
|
||||
function a3(x,y,z)
|
||||
use psb_base_mod, only : psb_dpk_
|
||||
real(psb_dpk_) :: a3
|
||||
a2_base=epsilon
|
||||
end function a2_base
|
||||
function a3_base(x,y,z)
|
||||
implicit none
|
||||
real(psb_dpk_) :: a3_base
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
a3=epsilon
|
||||
end function a3
|
||||
function g(x,y,z)
|
||||
use psb_base_mod, only : psb_dpk_, done, dzero
|
||||
real(psb_dpk_) :: g
|
||||
a3_base=epsilon
|
||||
end function a3_base
|
||||
function g_base(x,y,z)
|
||||
implicit none
|
||||
real(psb_dpk_) :: g_base
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
g = dzero
|
||||
g_base = dzero
|
||||
if (x == done) then
|
||||
g = done
|
||||
g_base = done
|
||||
else if (x == dzero) then
|
||||
g = done
|
||||
g_base = done
|
||||
end if
|
||||
end function g
|
||||
end function g_base
|
||||
end module amg_d_pde3d_base_mod
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! 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 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.
|
||||
!
|
||||
module amg_d_pde3d_box_mod
|
||||
use psb_base_mod, only : psb_dpk_, done, dzero
|
||||
real(psb_dpk_), save, private :: epsilon=done/80
|
||||
contains
|
||||
subroutine pde_set_parm3d_box(dat)
|
||||
real(psb_dpk_), intent(in) :: dat
|
||||
epsilon = dat
|
||||
end subroutine pde_set_parm3d_box
|
||||
!
|
||||
! functions parametrizing the differential equation
|
||||
!
|
||||
function b1_box(x,y,z)
|
||||
implicit none
|
||||
real(psb_dpk_) :: b1_box
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
b1_box=done/sqrt(3.0_psb_dpk_)
|
||||
end function b1_box
|
||||
function b2_box(x,y,z)
|
||||
implicit none
|
||||
real(psb_dpk_) :: b2_box
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
b2_box=done/sqrt(3.0_psb_dpk_)
|
||||
end function b2_box
|
||||
function b3_box(x,y,z)
|
||||
implicit none
|
||||
real(psb_dpk_) :: b3_box
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
b3_box=done/sqrt(3.0_psb_dpk_)
|
||||
end function b3_box
|
||||
function c_box(x,y,z)
|
||||
implicit none
|
||||
real(psb_dpk_) :: c_box
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
c_box=dzero
|
||||
end function c_box
|
||||
function a1_box(x,y,z)
|
||||
implicit none
|
||||
real(psb_dpk_) :: a1_box
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
a1_box=epsilon
|
||||
end function a1_box
|
||||
function a2_box(x,y,z)
|
||||
implicit none
|
||||
real(psb_dpk_) :: a2_box
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
a2_box=epsilon
|
||||
end function a2_box
|
||||
function a3_box(x,y,z)
|
||||
implicit none
|
||||
real(psb_dpk_) :: a3_box
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
a3_box=epsilon
|
||||
end function a3_box
|
||||
function g_box(x,y,z)
|
||||
implicit none
|
||||
real(psb_dpk_) :: g_box
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
g_box= dzero
|
||||
if (x == done) then
|
||||
g_box = done
|
||||
else if (x == dzero) then
|
||||
g_box = done
|
||||
end if
|
||||
end function g_box
|
||||
end module amg_d_pde3d_box_mod
|
||||
@@ -35,60 +35,60 @@
|
||||
! POSSIBILITY OF SUCH DAMAGE.
|
||||
!
|
||||
module amg_d_pde3d_exp_mod
|
||||
use psb_base_mod, only : psb_dpk_, done
|
||||
use psb_base_mod, only : psb_dpk_, done, dzero
|
||||
real(psb_dpk_), save, private :: epsilon=done/160
|
||||
contains
|
||||
subroutine pde_set_parm(dat)
|
||||
subroutine pde_set_parm3d_exp(dat)
|
||||
real(psb_dpk_), intent(in) :: dat
|
||||
epsilon = dat
|
||||
end subroutine pde_set_parm
|
||||
end subroutine pde_set_parm3d_exp
|
||||
!
|
||||
! functions parametrizing the differential equation
|
||||
!
|
||||
function b1_exp(x,y,z)
|
||||
use psb_base_mod, only : psb_dpk_, dzero
|
||||
implicit none
|
||||
real(psb_dpk_) :: b1_exp
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
b1_exp=dzero/sqrt(3.0_psb_dpk_)
|
||||
end function b1_exp
|
||||
function b2_exp(x,y,z)
|
||||
use psb_base_mod, only : psb_dpk_, dzero
|
||||
implicit none
|
||||
real(psb_dpk_) :: b2_exp
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
b2_exp=dzero/sqrt(3.0_psb_dpk_)
|
||||
end function b2_exp
|
||||
function b3_exp(x,y,z)
|
||||
use psb_base_mod, only : psb_dpk_, dzero
|
||||
implicit none
|
||||
real(psb_dpk_) :: b3_exp
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
b3_exp=dzero/sqrt(3.0_psb_dpk_)
|
||||
end function b3_exp
|
||||
function c_exp(x,y,z)
|
||||
use psb_base_mod, only : psb_dpk_, dzero
|
||||
implicit none
|
||||
real(psb_dpk_) :: c_exp
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
c_exp=dzero
|
||||
end function c_exp
|
||||
function a1_exp(x,y,z)
|
||||
use psb_base_mod, only : psb_dpk_
|
||||
implicit none
|
||||
real(psb_dpk_) :: a1_exp
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
a1_exp=epsilon*exp(-(x+y+z))
|
||||
end function a1_exp
|
||||
function a2_exp(x,y,z)
|
||||
use psb_base_mod, only : psb_dpk_
|
||||
implicit none
|
||||
real(psb_dpk_) :: a2_exp
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
a2_exp=epsilon*exp(-(x+y+z))
|
||||
end function a2_exp
|
||||
function a3_exp(x,y,z)
|
||||
use psb_base_mod, only : psb_dpk_
|
||||
implicit none
|
||||
real(psb_dpk_) :: a3_exp
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
a3_exp=epsilon*exp(-(x+y+z))
|
||||
end function a3_exp
|
||||
function g_exp(x,y,z)
|
||||
use psb_base_mod, only : psb_dpk_, done, dzero
|
||||
implicit none
|
||||
real(psb_dpk_) :: g_exp
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
g_exp = dzero
|
||||
|
||||
@@ -35,60 +35,60 @@
|
||||
! POSSIBILITY OF SUCH DAMAGE.
|
||||
!
|
||||
module amg_d_pde3d_gauss_mod
|
||||
use psb_base_mod, only : psb_dpk_, done
|
||||
use psb_base_mod, only : psb_dpk_, done, dzero
|
||||
real(psb_dpk_), save, private :: epsilon=done/80
|
||||
contains
|
||||
subroutine pde_set_parm(dat)
|
||||
subroutine pde_set_parm3d_gauss(dat)
|
||||
real(psb_dpk_), intent(in) :: dat
|
||||
epsilon = dat
|
||||
end subroutine pde_set_parm
|
||||
end subroutine pde_set_parm3d_gauss
|
||||
!
|
||||
! functions parametrizing the differential equation
|
||||
!
|
||||
function b1_gauss(x,y,z)
|
||||
use psb_base_mod, only : psb_dpk_, done
|
||||
implicit none
|
||||
real(psb_dpk_) :: b1_gauss
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
b1_gauss=done/sqrt(3.0_psb_dpk_)-2*x*exp(-(x**2+y**2+z**2))
|
||||
end function b1_gauss
|
||||
function b2_gauss(x,y,z)
|
||||
use psb_base_mod, only : psb_dpk_, done
|
||||
implicit none
|
||||
real(psb_dpk_) :: b2_gauss
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
b2_gauss=done/sqrt(3.0_psb_dpk_)-2*y*exp(-(x**2+y**2+z**2))
|
||||
end function b2_gauss
|
||||
function b3_gauss(x,y,z)
|
||||
use psb_base_mod, only : psb_dpk_, done
|
||||
implicit none
|
||||
real(psb_dpk_) :: b3_gauss
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
b3_gauss=done/sqrt(3.0_psb_dpk_)-2*z*exp(-(x**2+y**2+z**2))
|
||||
end function b3_gauss
|
||||
function c_gauss(x,y,z)
|
||||
use psb_base_mod, only : psb_dpk_, dzero
|
||||
implicit none
|
||||
real(psb_dpk_) :: c_gauss
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
c=dzero
|
||||
c_gauss=dzero
|
||||
end function c_gauss
|
||||
function a1_gauss(x,y,z)
|
||||
use psb_base_mod, only : psb_dpk_
|
||||
implicit none
|
||||
real(psb_dpk_) :: a1_gauss
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
a1_gauss=epsilon*exp(-(x**2+y**2+z**2))
|
||||
end function a1_gauss
|
||||
function a2_gauss(x,y,z)
|
||||
use psb_base_mod, only : psb_dpk_
|
||||
implicit none
|
||||
real(psb_dpk_) :: a2_gauss
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
a2_gauss=epsilon*exp(-(x**2+y**2+z**2))
|
||||
end function a2_gauss
|
||||
function a3_gauss(x,y,z)
|
||||
use psb_base_mod, only : psb_dpk_
|
||||
implicit none
|
||||
real(psb_dpk_) :: a3_gauss
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
a3_gauss=epsilon*exp(-(x**2+y**2+z**2))
|
||||
end function a3_gauss
|
||||
function g_gauss(x,y,z)
|
||||
use psb_base_mod, only : psb_dpk_, done, dzero
|
||||
implicit none
|
||||
real(psb_dpk_) :: g_gauss
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
g_gauss = dzero
|
||||
|
||||
@@ -72,6 +72,7 @@ program amg_s_pde2d
|
||||
use amg_s_pde2d_base_mod
|
||||
use amg_s_pde2d_exp_mod
|
||||
use amg_s_pde2d_box_mod
|
||||
use amg_s_pde2d_gauss_mod
|
||||
use amg_s_genpde_mod
|
||||
#if defined(OPENMP)
|
||||
use omp_lib
|
||||
@@ -124,16 +125,16 @@ program amg_s_pde2d
|
||||
integer(psb_ipk_) :: outer_sweeps ! number of outer sweeps: sweeps for 1-level,
|
||||
! AMG cycles for ML
|
||||
! general AMG data
|
||||
character(len=16) :: mlcycle ! AMG cycle type
|
||||
character(len=32) :: mlcycle ! AMG cycle type
|
||||
integer(psb_ipk_) :: maxlevs ! maximum number of levels in AMG preconditioner
|
||||
|
||||
! AMG aggregation
|
||||
character(len=16) :: aggr_prol ! aggregation type: SMOOTHED, NONSMOOTHED
|
||||
character(len=16) :: par_aggr_alg ! parallel aggregation algorithm: DEC, SYMDEC
|
||||
character(len=16) :: aggr_type ! Type of aggregation SOC1, SOC2, MATCHBOXP
|
||||
character(len=32) :: aggr_prol ! aggregation type: SMOOTHED, NONSMOOTHED
|
||||
character(len=32) :: par_aggr_alg ! parallel aggregation algorithm: DEC, SYMDEC
|
||||
character(len=32) :: aggr_type ! Type of aggregation SOC1, SOC2, MATCHBOXP
|
||||
integer(psb_ipk_) :: aggr_size ! Requested size of the aggregates for MATCHBOXP
|
||||
character(len=16) :: aggr_ord ! ordering for aggregation: NATURAL, DEGREE
|
||||
character(len=16) :: aggr_filter ! filtering: FILTER, NO_FILTER
|
||||
character(len=32) :: aggr_ord ! ordering for aggregation: NATURAL, DEGREE
|
||||
character(len=32) :: aggr_filter ! filtering: FILTER, NO_FILTER
|
||||
real(psb_spk_) :: mncrratio ! minimum aggregation ratio
|
||||
real(psb_spk_), allocatable :: athresv(:) ! smoothed aggregation threshold vector
|
||||
integer(psb_ipk_) :: thrvsz ! size of threshold vector
|
||||
@@ -141,37 +142,39 @@ program amg_s_pde2d
|
||||
integer(psb_ipk_) :: csizepp ! minimum size of coarsest matrix per process
|
||||
|
||||
! AMG smoother or pre-smoother; also 1-lev preconditioner
|
||||
character(len=16) :: smther ! (pre-)smoother type: BJAC, AS
|
||||
integer(psb_ipk_) :: jsweeps ! (pre-)smoother / 1-lev prec. sweeps
|
||||
integer(psb_ipk_) :: novr ! number of overlap layers
|
||||
character(len=16) :: restr ! restriction over application of AS
|
||||
character(len=16) :: prol ! prolongation over application of AS
|
||||
character(len=16) :: solve ! local subsolver type: ILU, MILU, ILUT,
|
||||
! UMF, MUMPS, SLU, FWGS, BWGS, JAC
|
||||
character(len=16) :: variant ! AINV variant: LLK, etc
|
||||
integer(psb_ipk_) :: fill ! fill-in for incomplete LU factorization
|
||||
integer(psb_ipk_) :: invfill ! Inverse fill-in for INVK
|
||||
real(psb_spk_) :: thr ! threshold for ILUT factorization
|
||||
character(len=32) :: smther ! (pre-)smoother type: BJAC, AS
|
||||
integer(psb_ipk_) :: jsweeps ! (pre-)smoother / 1-lev prec. sweeps
|
||||
integer(psb_ipk_) :: novr ! number of overlap layers
|
||||
character(len=32) :: restr ! restriction over application of AS
|
||||
character(len=32) :: prol ! prolongation over application of AS
|
||||
character(len=32) :: solve ! local subsolver type: ILU, MILU, ILUT,
|
||||
! UMF, MUMPS, SLU, FWGS, BWGS, JAC
|
||||
integer(psb_ipk_) :: ssweeps ! inner solver sweeps
|
||||
character(len=32) :: variant ! AINV variant: LLK, etc
|
||||
integer(psb_ipk_) :: fill ! fill-in for incomplete LU factorization
|
||||
integer(psb_ipk_) :: invfill ! Inverse fill-in for INVK
|
||||
real(psb_spk_) :: thr ! threshold for ILUT factorization
|
||||
|
||||
! AMG post-smoother; ignored by 1-lev preconditioner
|
||||
character(len=16) :: smther2 ! post-smoother type: BJAC, AS
|
||||
integer(psb_ipk_) :: jsweeps2 ! post-smoother sweeps
|
||||
integer(psb_ipk_) :: novr2 ! number of overlap layers
|
||||
character(len=16) :: restr2 ! restriction over application of AS
|
||||
character(len=16) :: prol2 ! prolongation over application of AS
|
||||
character(len=16) :: solve2 ! local subsolver type: ILU, MILU, ILUT,
|
||||
! UMF, MUMPS, SLU, FWGS, BWGS, JAC
|
||||
character(len=16) :: variant2 ! AINV variant: LLK, etc
|
||||
integer(psb_ipk_) :: fill2 ! fill-in for incomplete LU factorization
|
||||
integer(psb_ipk_) :: invfill2 ! Inverse fill-in for INVK
|
||||
real(psb_spk_) :: thr2 ! threshold for ILUT factorization
|
||||
character(len=32) :: smther2 ! post-smoother type: BJAC, AS
|
||||
integer(psb_ipk_) :: jsweeps2 ! post-smoother sweeps
|
||||
integer(psb_ipk_) :: novr2 ! number of overlap layers
|
||||
character(len=32) :: restr2 ! restriction over application of AS
|
||||
character(len=32) :: prol2 ! prolongation over application of AS
|
||||
character(len=32) :: solve2 ! local subsolver type: ILU, MILU, ILUT,
|
||||
! UMF, MUMPS, SLU, FWGS, BWGS, JAC
|
||||
integer(psb_ipk_) :: ssweeps2 ! inner solver sweeps
|
||||
character(len=32) :: variant2 ! AINV variant: LLK, etc
|
||||
integer(psb_ipk_) :: fill2 ! fill-in for incomplete LU factorization
|
||||
integer(psb_ipk_) :: invfill2 ! Inverse fill-in for INVK
|
||||
real(psb_spk_) :: thr2 ! threshold for ILUT factorization
|
||||
|
||||
! coarsest-level solver
|
||||
character(len=16) :: cmat ! coarsest matrix layout: REPL, DIST
|
||||
character(len=16) :: csolve ! coarsest-lev solver: BJAC, SLUDIST (distr.
|
||||
character(len=32) :: cmat ! coarsest matrix layout: REPL, DIST
|
||||
character(len=32) :: csolve ! coarsest-lev solver: BJAC, SLUDIST (distr.
|
||||
! mat.); UMF, MUMPS, SLU, ILU, ILUT, MILU
|
||||
! (repl. mat.)
|
||||
character(len=16) :: csbsolve ! coarsest-lev local subsolver: ILU, ILUT,
|
||||
character(len=32) :: csbsolve ! coarsest-lev local subsolver: ILU, ILUT,
|
||||
! MILU, UMF, MUMPS, SLU
|
||||
integer(psb_ipk_) :: cfill ! fill-in for incomplete LU factorization
|
||||
real(psb_spk_) :: cthres ! threshold for ILUT factorization
|
||||
@@ -239,13 +242,16 @@ program amg_s_pde2d
|
||||
select case(psb_toupper(trim(pdecoeff)))
|
||||
case("CONST")
|
||||
call amg_gen_pde2d(ctxt,idim,a,b,x,desc_a,afmt,&
|
||||
& a1,a2,b1,b2,c,g,info)
|
||||
& a1_base,a2_base,b1_base,b2_base,c_base,g_base,info)
|
||||
case("EXP")
|
||||
call amg_gen_pde2d(ctxt,idim,a,b,x,desc_a,afmt,&
|
||||
& a1_exp,a2_exp,b1_exp,b2_exp,c_exp,g_exp,info)
|
||||
case("BOX")
|
||||
call amg_gen_pde2d(ctxt,idim,a,b,x,desc_a,afmt,&
|
||||
& a1_box,a2_box,b1_box,b2_box,c_box,g_box,info)
|
||||
case("GAUSS")
|
||||
call amg_gen_pde2d(ctxt,idim,a,b,x,desc_a,afmt,&
|
||||
& a1_gauss,a2_gauss,b1_gauss,b2_gauss,c_gauss,g_gauss,info)
|
||||
case default
|
||||
info=psb_err_from_subroutine_
|
||||
ch_err='amg_gen_pdecoeff'
|
||||
@@ -282,6 +288,9 @@ program amg_s_pde2d
|
||||
case ('BJAC')
|
||||
call prec%set('smoother_sweeps', p_choice%jsweeps, info)
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
call prec%set('solver_sweeps', p_choice%ssweeps, info)
|
||||
if (psb_toupper(p_choice%solve)=='MUMPS') &
|
||||
& call prec%set('mumps_loc_glob','local_solver',info)
|
||||
call prec%set('sub_fillin', p_choice%fill, info)
|
||||
call prec%set('sub_iluthrs', p_choice%thr, info)
|
||||
|
||||
@@ -291,6 +300,9 @@ program amg_s_pde2d
|
||||
call prec%set('sub_restr', p_choice%restr, info)
|
||||
call prec%set('sub_prol', p_choice%prol, info)
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
call prec%set('solver_sweeps', p_choice%ssweeps, info)
|
||||
if (psb_toupper(p_choice%solve)=='MUMPS') &
|
||||
& call prec%set('mumps_loc_glob','local_solver',info)
|
||||
call prec%set('sub_fillin', p_choice%fill, info)
|
||||
call prec%set('sub_iluthrs', p_choice%thr, info)
|
||||
|
||||
@@ -342,8 +354,10 @@ program amg_s_pde2d
|
||||
call prec%set('ainv_alg', p_choice%variant, info)
|
||||
case default
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
if (psb_toupper(p_choice%solve)=='MUMPS') &
|
||||
& call prec%set('mumps_loc_glob','local_solver',info)
|
||||
end select
|
||||
|
||||
call prec%set('solver_sweeps', p_choice%ssweeps, info)
|
||||
call prec%set('sub_fillin', p_choice%fill, info)
|
||||
call prec%set('inv_fillin', p_choice%invfill, info)
|
||||
call prec%set('sub_iluthrs', p_choice%thr, info)
|
||||
@@ -369,8 +383,10 @@ program amg_s_pde2d
|
||||
call prec%set('ainv_alg', p_choice%variant2, info)
|
||||
case default
|
||||
call prec%set('sub_solve', p_choice%solve2, info, pos='post')
|
||||
if (psb_toupper(p_choice%solve2)=='MUMPS') &
|
||||
& call prec%set('mumps_loc_glob','local_solver',info)
|
||||
end select
|
||||
|
||||
call prec%set('solver_sweeps', p_choice%ssweeps2, info,pos='post')
|
||||
call prec%set('sub_fillin', p_choice%fill2, info,pos='post')
|
||||
call prec%set('inv_fillin', p_choice%invfill2, info,pos='post')
|
||||
call prec%set('sub_iluthrs', p_choice%thr2, info,pos='post')
|
||||
@@ -569,6 +585,7 @@ contains
|
||||
call read_data(prec%restr,inp_unit) ! restriction over application of AS
|
||||
call read_data(prec%prol,inp_unit) ! prolongation over application of AS
|
||||
call read_data(prec%solve,inp_unit) ! local subsolver
|
||||
call read_data(prec%ssweeps,inp_unit) ! inner solver sweeps
|
||||
call read_data(prec%variant,inp_unit) ! AINV variant
|
||||
call read_data(prec%fill,inp_unit) ! fill-in for incomplete LU
|
||||
call read_data(prec%invfill,inp_unit) !Inverse fill-in for INVK
|
||||
@@ -580,6 +597,7 @@ contains
|
||||
call read_data(prec%restr2,inp_unit) ! restriction over application of AS
|
||||
call read_data(prec%prol2,inp_unit) ! prolongation over application of AS
|
||||
call read_data(prec%solve2,inp_unit) ! local subsolver
|
||||
call read_data(prec%ssweeps2,inp_unit) ! inner solver sweeps
|
||||
call read_data(prec%variant2,inp_unit) ! AINV variant
|
||||
call read_data(prec%fill2,inp_unit) ! fill-in for incomplete LU
|
||||
call read_data(prec%invfill2,inp_unit) !Inverse fill-in for INVK
|
||||
@@ -649,6 +667,7 @@ contains
|
||||
call psb_bcast(ctxt,prec%restr)
|
||||
call psb_bcast(ctxt,prec%prol)
|
||||
call psb_bcast(ctxt,prec%solve)
|
||||
call psb_bcast(ctxt,prec%ssweeps)
|
||||
call psb_bcast(ctxt,prec%variant)
|
||||
call psb_bcast(ctxt,prec%fill)
|
||||
call psb_bcast(ctxt,prec%invfill)
|
||||
@@ -660,6 +679,7 @@ contains
|
||||
call psb_bcast(ctxt,prec%restr2)
|
||||
call psb_bcast(ctxt,prec%prol2)
|
||||
call psb_bcast(ctxt,prec%solve2)
|
||||
call psb_bcast(ctxt,prec%ssweeps2)
|
||||
call psb_bcast(ctxt,prec%variant2)
|
||||
call psb_bcast(ctxt,prec%fill2)
|
||||
call psb_bcast(ctxt,prec%invfill2)
|
||||
|
||||
@@ -38,52 +38,52 @@ module amg_s_pde2d_base_mod
|
||||
use psb_base_mod, only : psb_spk_, szero, sone
|
||||
real(psb_spk_), save, private :: epsilon=sone/80
|
||||
contains
|
||||
subroutine pde_set_parm(dat)
|
||||
subroutine pde_set_parm2d_base(dat)
|
||||
real(psb_spk_), intent(in) :: dat
|
||||
epsilon = dat
|
||||
end subroutine pde_set_parm
|
||||
end subroutine pde_set_parm2d_base
|
||||
!
|
||||
! functions parametrizing the differential equation
|
||||
!
|
||||
function b1(x,y)
|
||||
use psb_base_mod, only : psb_spk_, szero, sone
|
||||
real(psb_spk_) :: b1
|
||||
function b1_base(x,y)
|
||||
implicit none
|
||||
real(psb_spk_) :: b1_base
|
||||
real(psb_spk_), intent(in) :: x,y
|
||||
b1 = szero/1.414_psb_spk_
|
||||
end function b1
|
||||
function b2(x,y)
|
||||
use psb_base_mod, only : psb_spk_, szero, sone
|
||||
real(psb_spk_) :: b2
|
||||
b1_base = szero/1.414_psb_spk_
|
||||
end function b1_base
|
||||
function b2_base(x,y)
|
||||
implicit none
|
||||
real(psb_spk_) :: b2_base
|
||||
real(psb_spk_), intent(in) :: x,y
|
||||
b2 = szero/1.414_psb_spk_
|
||||
end function b2
|
||||
function c(x,y)
|
||||
use psb_base_mod, only : psb_spk_, szero, sone
|
||||
real(psb_spk_) :: c
|
||||
b2_base = szero/1.414_psb_spk_
|
||||
end function b2_base
|
||||
function c_base(x,y)
|
||||
implicit none
|
||||
real(psb_spk_) :: c_base
|
||||
real(psb_spk_), intent(in) :: x,y
|
||||
c = szero
|
||||
end function c
|
||||
function a1(x,y)
|
||||
use psb_base_mod, only : psb_spk_, szero, sone
|
||||
real(psb_spk_) :: a1
|
||||
c_base = szero
|
||||
end function c_base
|
||||
function a1_base(x,y)
|
||||
implicit none
|
||||
real(psb_spk_) :: a1_base
|
||||
real(psb_spk_), intent(in) :: x,y
|
||||
a1=sone*epsilon
|
||||
end function a1
|
||||
function a2(x,y)
|
||||
use psb_base_mod, only : psb_spk_, szero, sone
|
||||
real(psb_spk_) :: a2
|
||||
a1_base=sone*epsilon
|
||||
end function a1_base
|
||||
function a2_base(x,y)
|
||||
implicit none
|
||||
real(psb_spk_) :: a2_base
|
||||
real(psb_spk_), intent(in) :: x,y
|
||||
a2=sone*epsilon
|
||||
end function a2
|
||||
function g(x,y)
|
||||
use psb_base_mod, only : psb_spk_, szero, sone
|
||||
real(psb_spk_) :: g
|
||||
a2_base=sone*epsilon
|
||||
end function a2_base
|
||||
function g_base(x,y)
|
||||
implicit none
|
||||
real(psb_spk_) :: g_base
|
||||
real(psb_spk_), intent(in) :: x,y
|
||||
g = szero
|
||||
g_base = szero
|
||||
if (x == sone) then
|
||||
g = sone
|
||||
g_base = sone
|
||||
else if (x == szero) then
|
||||
g = sone
|
||||
g_base = sone
|
||||
end if
|
||||
end function g
|
||||
end function g_base
|
||||
end module amg_s_pde2d_base_mod
|
||||
|
||||
@@ -38,45 +38,45 @@ module amg_s_pde2d_box_mod
|
||||
use psb_base_mod, only : psb_spk_, szero, sone
|
||||
real(psb_spk_), save, private :: epsilon=sone/80
|
||||
contains
|
||||
subroutine pde_set_parm(dat)
|
||||
subroutine pde_set_parm2d_box(dat)
|
||||
real(psb_spk_), intent(in) :: dat
|
||||
epsilon = dat
|
||||
end subroutine pde_set_parm
|
||||
end subroutine pde_set_parm2d_box
|
||||
!
|
||||
! functions parametrizing the differential equation
|
||||
!
|
||||
function b1_box(x,y)
|
||||
use psb_base_mod, only : psb_spk_, szero, sone
|
||||
implicit none
|
||||
real(psb_spk_) :: b1_box
|
||||
real(psb_spk_), intent(in) :: x,y
|
||||
b1_box = sone/1.414_psb_spk_
|
||||
end function b1_box
|
||||
function b2_box(x,y)
|
||||
use psb_base_mod, only : psb_spk_, szero, sone
|
||||
implicit none
|
||||
real(psb_spk_) :: b2_box
|
||||
real(psb_spk_), intent(in) :: x,y
|
||||
b2_box = sone/1.414_psb_spk_
|
||||
end function b2_box
|
||||
function c_box(x,y)
|
||||
use psb_base_mod, only : psb_spk_, szero, sone
|
||||
implicit none
|
||||
real(psb_spk_) :: c_box
|
||||
real(psb_spk_), intent(in) :: x,y
|
||||
c_box = szero
|
||||
end function c_box
|
||||
function a1_box(x,y)
|
||||
use psb_base_mod, only : psb_spk_, szero, sone
|
||||
implicit none
|
||||
real(psb_spk_) :: a1_box
|
||||
real(psb_spk_), intent(in) :: x,y
|
||||
a1_box=sone*epsilon
|
||||
end function a1_box
|
||||
function a2_box(x,y)
|
||||
use psb_base_mod, only : psb_spk_, szero, sone
|
||||
implicit none
|
||||
real(psb_spk_) :: a2_box
|
||||
real(psb_spk_), intent(in) :: x,y
|
||||
a2_box=sone*epsilon
|
||||
end function a2_box
|
||||
function g_box(x,y)
|
||||
use psb_base_mod, only : psb_spk_, szero, sone
|
||||
implicit none
|
||||
real(psb_spk_) :: g_box
|
||||
real(psb_spk_), intent(in) :: x,y
|
||||
g_box = szero
|
||||
|
||||
@@ -38,45 +38,45 @@ module amg_s_pde2d_exp_mod
|
||||
use psb_base_mod, only : psb_spk_, sone, szero
|
||||
real(psb_spk_), save, private :: epsilon=sone/80
|
||||
contains
|
||||
subroutine pde_set_parm(dat)
|
||||
subroutine pde_set_parm2d_exp(dat)
|
||||
real(psb_spk_), intent(in) :: dat
|
||||
epsilon = dat
|
||||
end subroutine pde_set_parm
|
||||
end subroutine pde_set_parm2d_exp
|
||||
!
|
||||
! functions parametrizing the differential equation
|
||||
!
|
||||
function b1_exp(x,y)
|
||||
use psb_base_mod, only : psb_spk_, sone, szero
|
||||
implicit none
|
||||
real(psb_spk_) :: b1_exp
|
||||
real(psb_spk_), intent(in) :: x,y
|
||||
b1_exp = szero
|
||||
end function b1_exp
|
||||
function b2_exp(x,y)
|
||||
use psb_base_mod, only : psb_spk_, sone, szero
|
||||
implicit none
|
||||
real(psb_spk_) :: b2_exp
|
||||
real(psb_spk_), intent(in) :: x,y
|
||||
b2_exp = szero
|
||||
end function b2_exp
|
||||
function c_exp(x,y)
|
||||
use psb_base_mod, only : psb_spk_, sone, szero
|
||||
implicit none
|
||||
real(psb_spk_) :: c_exp
|
||||
real(psb_spk_), intent(in) :: x,y
|
||||
c_exp = szero
|
||||
end function c_exp
|
||||
function a1_exp(x,y)
|
||||
use psb_base_mod, only : psb_spk_, sone, szero
|
||||
implicit none
|
||||
real(psb_spk_) :: a1_exp
|
||||
real(psb_spk_), intent(in) :: x,y
|
||||
a1=sone*epsilon*exp(-(x+y))
|
||||
a1_exp=sone*epsilon*exp(-(x+y))
|
||||
end function a1_exp
|
||||
function a2_exp(x,y)
|
||||
use psb_base_mod, only : psb_spk_, sone, szero
|
||||
implicit none
|
||||
real(psb_spk_) :: a2_exp
|
||||
real(psb_spk_), intent(in) :: x,y
|
||||
a2=sone*epsilon*exp(-(x+y))
|
||||
a2_exp=sone*epsilon*exp(-(x+y))
|
||||
end function a2_exp
|
||||
function g_exp(x,y)
|
||||
use psb_base_mod, only : psb_spk_, sone, szero
|
||||
implicit none
|
||||
real(psb_spk_) :: g_exp
|
||||
real(psb_spk_), intent(in) :: x,y
|
||||
g_exp = szero
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! 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 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.
|
||||
!
|
||||
module amg_s_pde2d_gauss_mod
|
||||
use psb_base_mod, only : psb_spk_, sone, szero
|
||||
real(psb_spk_), save, private :: epsilon=sone/80
|
||||
contains
|
||||
subroutine pde_set_parm2d_gauss(dat)
|
||||
real(psb_spk_), intent(in) :: dat
|
||||
epsilon = dat
|
||||
end subroutine pde_set_parm2d_gauss
|
||||
!
|
||||
! functions parametrizing the differential equation
|
||||
!
|
||||
function b1_gauss(x,y)
|
||||
implicit none
|
||||
real(psb_spk_) :: b1_gauss
|
||||
real(psb_spk_), intent(in) :: x,y
|
||||
b1_gauss=sone/sqrt(3.0_psb_spk_)-2*x*exp(-(x**2+y**2))
|
||||
end function b1_gauss
|
||||
function b2_gauss(x,y)
|
||||
implicit none
|
||||
real(psb_spk_) :: b2_gauss
|
||||
real(psb_spk_), intent(in) :: x,y
|
||||
b2_gauss=sone/sqrt(3.0_psb_spk_)-2*y*exp(-(x**2+y**2))
|
||||
end function b2_gauss
|
||||
function c_gauss(x,y)
|
||||
implicit none
|
||||
real(psb_spk_) :: c_gauss
|
||||
real(psb_spk_), intent(in) :: x,y
|
||||
c_gauss=szero
|
||||
end function c_gauss
|
||||
function a1_gauss(x,y)
|
||||
implicit none
|
||||
real(psb_spk_) :: a1_gauss
|
||||
real(psb_spk_), intent(in) :: x,y
|
||||
a1_gauss=epsilon*exp(-(x**2+y**2))
|
||||
end function a1_gauss
|
||||
function a2_gauss(x,y)
|
||||
implicit none
|
||||
real(psb_spk_) :: a2_gauss
|
||||
real(psb_spk_), intent(in) :: x,y
|
||||
a2_gauss=epsilon*exp(-(x**2+y**2))
|
||||
end function a2_gauss
|
||||
function g_gauss(x,y)
|
||||
implicit none
|
||||
real(psb_spk_) :: g_gauss
|
||||
real(psb_spk_), intent(in) :: x,y
|
||||
g_gauss = szero
|
||||
if (x == sone) then
|
||||
g_gauss = sone
|
||||
else if (x == szero) then
|
||||
g_gauss = sone
|
||||
end if
|
||||
end function g_gauss
|
||||
end module amg_s_pde2d_gauss_mod
|
||||
@@ -72,6 +72,7 @@ program amg_s_pde3d
|
||||
use data_input
|
||||
use amg_s_pde3d_base_mod
|
||||
use amg_s_pde3d_exp_mod
|
||||
use amg_s_pde3d_box_mod
|
||||
use amg_s_pde3d_gauss_mod
|
||||
use amg_s_genpde_mod
|
||||
#if defined(OPENMP)
|
||||
@@ -125,63 +126,65 @@ program amg_s_pde3d
|
||||
integer(psb_ipk_) :: outer_sweeps ! number of outer sweeps: sweeps for 1-level,
|
||||
! AMG cycles for ML
|
||||
! general AMG data
|
||||
character(len=16) :: mlcycle ! AMG cycle type
|
||||
integer(psb_ipk_) :: maxlevs ! maximum number of levels in AMG preconditioner
|
||||
character(len=32) :: mlcycle ! AMG cycle type
|
||||
integer(psb_ipk_) :: maxlevs ! maximum number of levels in AMG preconditioner
|
||||
|
||||
! AMG aggregation
|
||||
character(len=16) :: aggr_prol ! aggregation type: SMOOTHED, NONSMOOTHED
|
||||
character(len=16) :: par_aggr_alg ! parallel aggregation algorithm: DEC, SYMDEC
|
||||
character(len=16) :: aggr_type ! Type of aggregation SOC1, SOC2, MATCHBOXP
|
||||
integer(psb_ipk_) :: aggr_size ! Requested size of the aggregates for MATCHBOXP
|
||||
character(len=16) :: aggr_ord ! ordering for aggregation: NATURAL, DEGREE
|
||||
character(len=16) :: aggr_filter ! filtering: FILTER, NO_FILTER
|
||||
real(psb_spk_) :: mncrratio ! minimum aggregation ratio
|
||||
character(len=32) :: aggr_prol ! aggregation type: SMOOTHED, NONSMOOTHED
|
||||
character(len=32) :: par_aggr_alg ! parallel aggregation algorithm: DEC, SYMDEC
|
||||
character(len=32) :: aggr_type ! Type of aggregation SOC1, SOC2, MATCHBOXP
|
||||
integer(psb_ipk_) :: aggr_size ! Requested size of the aggregates for MATCHBOXP
|
||||
character(len=32) :: aggr_ord ! ordering for aggregation: NATURAL, DEGREE
|
||||
character(len=32) :: aggr_filter ! filtering: FILTER, NO_FILTER
|
||||
real(psb_spk_) :: mncrratio ! minimum aggregation ratio
|
||||
real(psb_spk_), allocatable :: athresv(:) ! smoothed aggregation threshold vector
|
||||
integer(psb_ipk_) :: thrvsz ! size of threshold vector
|
||||
real(psb_spk_) :: athres ! smoothed aggregation threshold
|
||||
integer(psb_ipk_) :: csizepp ! minimum size of coarsest matrix per process
|
||||
integer(psb_ipk_) :: thrvsz ! size of threshold vector
|
||||
real(psb_spk_) :: athres ! smoothed aggregation threshold
|
||||
integer(psb_ipk_) :: csizepp ! minimum size of coarsest matrix per process
|
||||
|
||||
! AMG smoother or pre-smoother; also 1-lev preconditioner
|
||||
character(len=16) :: smther ! (pre-)smoother type: BJAC, AS
|
||||
integer(psb_ipk_) :: jsweeps ! (pre-)smoother / 1-lev prec. sweeps
|
||||
integer(psb_ipk_) :: novr ! number of overlap layers
|
||||
character(len=16) :: restr ! restriction over application of AS
|
||||
character(len=16) :: prol ! prolongation over application of AS
|
||||
character(len=16) :: solve ! local subsolver type: ILU, MILU, ILUT,
|
||||
! UMF, MUMPS, SLU, FWGS, BWGS, JAC
|
||||
character(len=16) :: variant ! AINV variant: LLK, etc
|
||||
integer(psb_ipk_) :: fill ! fill-in for incomplete LU factorization
|
||||
integer(psb_ipk_) :: invfill ! Inverse fill-in for INVK
|
||||
real(psb_spk_) :: thr ! threshold for ILUT factorization
|
||||
character(len=32) :: smther ! (pre-)smoother type: BJAC, AS
|
||||
integer(psb_ipk_) :: jsweeps ! (pre-)smoother / 1-lev prec. sweeps
|
||||
integer(psb_ipk_) :: novr ! number of overlap layers
|
||||
character(len=32) :: restr ! restriction over application of AS
|
||||
character(len=32) :: prol ! prolongation over application of AS
|
||||
character(len=32) :: solve ! local subsolver type: ILU, MILU, ILUT,
|
||||
! UMF, MUMPS, SLU, FWGS, BWGS, JAC
|
||||
integer(psb_ipk_) :: ssweeps ! inner solver sweeps
|
||||
character(len=32) :: variant ! AINV variant: LLK, etc
|
||||
integer(psb_ipk_) :: fill ! fill-in for incomplete LU factorization
|
||||
integer(psb_ipk_) :: invfill ! Inverse fill-in for INVK
|
||||
real(psb_spk_) :: thr ! threshold for ILUT factorization
|
||||
|
||||
! AMG post-smoother; ignored by 1-lev preconditioner
|
||||
character(len=16) :: smther2 ! post-smoother type: BJAC, AS
|
||||
integer(psb_ipk_) :: jsweeps2 ! post-smoother sweeps
|
||||
integer(psb_ipk_) :: novr2 ! number of overlap layers
|
||||
character(len=16) :: restr2 ! restriction over application of AS
|
||||
character(len=16) :: prol2 ! prolongation over application of AS
|
||||
character(len=16) :: solve2 ! local subsolver type: ILU, MILU, ILUT,
|
||||
! UMF, MUMPS, SLU, FWGS, BWGS, JAC
|
||||
character(len=16) :: variant2 ! AINV variant: LLK, etc
|
||||
integer(psb_ipk_) :: fill2 ! fill-in for incomplete LU factorization
|
||||
integer(psb_ipk_) :: invfill2 ! Inverse fill-in for INVK
|
||||
real(psb_spk_) :: thr2 ! threshold for ILUT factorization
|
||||
character(len=32) :: smther2 ! post-smoother type: BJAC, AS
|
||||
integer(psb_ipk_) :: jsweeps2 ! post-smoother sweeps
|
||||
integer(psb_ipk_) :: novr2 ! number of overlap layers
|
||||
character(len=32) :: restr2 ! restriction over application of AS
|
||||
character(len=32) :: prol2 ! prolongation over application of AS
|
||||
character(len=32) :: solve2 ! local subsolver type: ILU, MILU, ILUT,
|
||||
! UMF, MUMPS, SLU, FWGS, BWGS, JAC
|
||||
integer(psb_ipk_) :: ssweeps2 ! inner solver sweeps
|
||||
character(len=32) :: variant2 ! AINV variant: LLK, etc
|
||||
integer(psb_ipk_) :: fill2 ! fill-in for incomplete LU factorization
|
||||
integer(psb_ipk_) :: invfill2 ! Inverse fill-in for INVK
|
||||
real(psb_spk_) :: thr2 ! threshold for ILUT factorization
|
||||
|
||||
! coarsest-level solver
|
||||
character(len=16) :: cmat ! coarsest matrix layout: REPL, DIST
|
||||
character(len=16) :: csolve ! coarsest-lev solver: BJAC, SLUDIST (distr.
|
||||
! mat.); UMF, MUMPS, SLU, ILU, ILUT, MILU
|
||||
! (repl. mat.)
|
||||
character(len=16) :: csbsolve ! coarsest-lev local subsolver: ILU, ILUT,
|
||||
! MILU, UMF, MUMPS, SLU
|
||||
integer(psb_ipk_) :: cfill ! fill-in for incomplete LU factorization
|
||||
real(psb_spk_) :: cthres ! threshold for ILUT factorization
|
||||
integer(psb_ipk_) :: cjswp ! sweeps for GS or JAC coarsest-lev subsolver
|
||||
character(len=32) :: cmat ! coarsest matrix layout: REPL, DIST
|
||||
character(len=32) :: csolve ! coarsest-lev solver: BJAC, SLUDIST (distr.
|
||||
! mat.); UMF, MUMPS, SLU, ILU, ILUT, MILU
|
||||
! (repl. mat.)
|
||||
character(len=32) :: csbsolve ! coarsest-lev local subsolver: ILU, ILUT,
|
||||
! MILU, UMF, MUMPS, SLU
|
||||
integer(psb_ipk_) :: cfill ! fill-in for incomplete LU factorization
|
||||
real(psb_spk_) :: cthres ! threshold for ILUT factorization
|
||||
integer(psb_ipk_) :: cjswp ! sweeps for GS or JAC coarsest-lev subsolver
|
||||
|
||||
! Dump data
|
||||
logical :: dump = .false.
|
||||
integer(psb_ipk_) :: dlmin ! Minimum level to dump
|
||||
integer(psb_ipk_) :: dlmax ! Maximum level to dump
|
||||
integer(psb_ipk_) :: dlmin ! Minimum level to dump
|
||||
integer(psb_ipk_) :: dlmax ! Maximum level to dump
|
||||
logical :: dump_ac = .false.
|
||||
logical :: dump_rp = .false.
|
||||
logical :: dump_tprol = .false.
|
||||
@@ -241,10 +244,13 @@ program amg_s_pde3d
|
||||
select case(psb_toupper(trim(pdecoeff)))
|
||||
case("CONST")
|
||||
call amg_gen_pde3d(ctxt,idim,a,b,x,desc_a,afmt,&
|
||||
& a1,a2,a3,b1,b2,b3,c,g,info)
|
||||
& a1_base,a2_base,a3_base,b1_base,b2_base,b3_base,c_base,g_base,info)
|
||||
case("EXP")
|
||||
call amg_gen_pde3d(ctxt,idim,a,b,x,desc_a,afmt,&
|
||||
& a1_exp,a2_exp,a3_exp,b1_exp,b2_exp,b3_exp,c_exp,g_exp,info)
|
||||
case("BOX")
|
||||
call amg_gen_pde3d(ctxt,idim,a,b,x,desc_a,afmt,&
|
||||
& a1_box,a2_box,a3_box,b1_box,b2_box,b3_box,c_box,g_box,info)
|
||||
case("GAUSS")
|
||||
call amg_gen_pde3d(ctxt,idim,a,b,x,desc_a,afmt,&
|
||||
& a1_gauss,a2_gauss,a3_gauss,b1_gauss,b2_gauss,b3_gauss,c_gauss,g_gauss,info)
|
||||
@@ -286,6 +292,9 @@ program amg_s_pde3d
|
||||
case ('BJAC')
|
||||
call prec%set('smoother_sweeps', p_choice%jsweeps, info)
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
call prec%set('solver_sweeps', p_choice%ssweeps, info)
|
||||
if (psb_toupper(p_choice%solve)=='MUMPS') &
|
||||
& call prec%set('mumps_loc_glob','local_solver',info)
|
||||
call prec%set('sub_fillin', p_choice%fill, info)
|
||||
call prec%set('sub_iluthrs', p_choice%thr, info)
|
||||
|
||||
@@ -295,6 +304,9 @@ program amg_s_pde3d
|
||||
call prec%set('sub_restr', p_choice%restr, info)
|
||||
call prec%set('sub_prol', p_choice%prol, info)
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
call prec%set('solver_sweeps', p_choice%ssweeps, info)
|
||||
if (psb_toupper(p_choice%solve)=='MUMPS') &
|
||||
& call prec%set('mumps_loc_glob','local_solver',info)
|
||||
call prec%set('sub_fillin', p_choice%fill, info)
|
||||
call prec%set('sub_iluthrs', p_choice%thr, info)
|
||||
|
||||
@@ -346,8 +358,10 @@ program amg_s_pde3d
|
||||
call prec%set('ainv_alg', p_choice%variant, info)
|
||||
case default
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
if (psb_toupper(p_choice%solve)=='MUMPS') &
|
||||
& call prec%set('mumps_loc_glob','local_solver',info)
|
||||
end select
|
||||
|
||||
call prec%set('solver_sweeps', p_choice%ssweeps, info)
|
||||
call prec%set('sub_fillin', p_choice%fill, info)
|
||||
call prec%set('inv_fillin', p_choice%invfill, info)
|
||||
call prec%set('sub_iluthrs', p_choice%thr, info)
|
||||
@@ -373,8 +387,10 @@ program amg_s_pde3d
|
||||
call prec%set('ainv_alg', p_choice%variant2, info)
|
||||
case default
|
||||
call prec%set('sub_solve', p_choice%solve2, info, pos='post')
|
||||
if (psb_toupper(p_choice%solve2)=='MUMPS') &
|
||||
& call prec%set('mumps_loc_glob','local_solver',info)
|
||||
end select
|
||||
|
||||
call prec%set('solver_sweeps', p_choice%ssweeps2, info,pos='post')
|
||||
call prec%set('sub_fillin', p_choice%fill2, info,pos='post')
|
||||
call prec%set('inv_fillin', p_choice%invfill2, info,pos='post')
|
||||
call prec%set('sub_iluthrs', p_choice%thr2, info,pos='post')
|
||||
@@ -492,7 +508,7 @@ program amg_s_pde3d
|
||||
write(psb_out_unit,'("Storage format for DESC_A : ",a )') desc_a%get_fmt()
|
||||
|
||||
end if
|
||||
call psb_print_timers(ctxt)
|
||||
|
||||
!
|
||||
! cleanup storage and exit
|
||||
!
|
||||
@@ -573,6 +589,7 @@ contains
|
||||
call read_data(prec%restr,inp_unit) ! restriction over application of AS
|
||||
call read_data(prec%prol,inp_unit) ! prolongation over application of AS
|
||||
call read_data(prec%solve,inp_unit) ! local subsolver
|
||||
call read_data(prec%ssweeps,inp_unit) ! inner solver sweeps
|
||||
call read_data(prec%variant,inp_unit) ! AINV variant
|
||||
call read_data(prec%fill,inp_unit) ! fill-in for incomplete LU
|
||||
call read_data(prec%invfill,inp_unit) !Inverse fill-in for INVK
|
||||
@@ -584,6 +601,7 @@ contains
|
||||
call read_data(prec%restr2,inp_unit) ! restriction over application of AS
|
||||
call read_data(prec%prol2,inp_unit) ! prolongation over application of AS
|
||||
call read_data(prec%solve2,inp_unit) ! local subsolver
|
||||
call read_data(prec%ssweeps2,inp_unit) ! inner solver sweeps
|
||||
call read_data(prec%variant2,inp_unit) ! AINV variant
|
||||
call read_data(prec%fill2,inp_unit) ! fill-in for incomplete LU
|
||||
call read_data(prec%invfill2,inp_unit) !Inverse fill-in for INVK
|
||||
@@ -653,6 +671,7 @@ contains
|
||||
call psb_bcast(ctxt,prec%restr)
|
||||
call psb_bcast(ctxt,prec%prol)
|
||||
call psb_bcast(ctxt,prec%solve)
|
||||
call psb_bcast(ctxt,prec%ssweeps)
|
||||
call psb_bcast(ctxt,prec%variant)
|
||||
call psb_bcast(ctxt,prec%fill)
|
||||
call psb_bcast(ctxt,prec%invfill)
|
||||
@@ -664,6 +683,7 @@ contains
|
||||
call psb_bcast(ctxt,prec%restr2)
|
||||
call psb_bcast(ctxt,prec%prol2)
|
||||
call psb_bcast(ctxt,prec%solve2)
|
||||
call psb_bcast(ctxt,prec%ssweeps2)
|
||||
call psb_bcast(ctxt,prec%variant2)
|
||||
call psb_bcast(ctxt,prec%fill2)
|
||||
call psb_bcast(ctxt,prec%invfill2)
|
||||
|
||||
@@ -35,67 +35,67 @@
|
||||
! POSSIBILITY OF SUCH DAMAGE.
|
||||
!
|
||||
module amg_s_pde3d_base_mod
|
||||
use psb_base_mod, only : psb_spk_, sone
|
||||
use psb_base_mod, only : psb_spk_, sone, szero
|
||||
real(psb_spk_), save, private :: epsilon=sone/80
|
||||
contains
|
||||
subroutine pde_set_parm(dat)
|
||||
subroutine pde_set_parm3d_base(dat)
|
||||
real(psb_spk_), intent(in) :: dat
|
||||
epsilon = dat
|
||||
end subroutine pde_set_parm
|
||||
end subroutine pde_set_parm3d_base
|
||||
!
|
||||
! functions parametrizing the differential equation
|
||||
!
|
||||
function b1(x,y,z)
|
||||
use psb_base_mod, only : psb_spk_, sone
|
||||
real(psb_spk_) :: b1
|
||||
function b1_base(x,y,z)
|
||||
implicit none
|
||||
real(psb_spk_) :: b1_base
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
b1=sone/sqrt(3.0_psb_spk_)
|
||||
end function b1
|
||||
function b2(x,y,z)
|
||||
use psb_base_mod, only : psb_spk_, sone
|
||||
real(psb_spk_) :: b2
|
||||
b1_base=szero/sqrt(3.0_psb_spk_)
|
||||
end function b1_base
|
||||
function b2_base(x,y,z)
|
||||
implicit none
|
||||
real(psb_spk_) :: b2_base
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
b2=sone/sqrt(3.0_psb_spk_)
|
||||
end function b2
|
||||
function b3(x,y,z)
|
||||
use psb_base_mod, only : psb_spk_, sone
|
||||
real(psb_spk_) :: b3
|
||||
b2_base=szero/sqrt(3.0_psb_spk_)
|
||||
end function b2_base
|
||||
function b3_base(x,y,z)
|
||||
implicit none
|
||||
real(psb_spk_) :: b3_base
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
b3=sone/sqrt(3.0_psb_spk_)
|
||||
end function b3
|
||||
function c(x,y,z)
|
||||
use psb_base_mod, only : psb_spk_, szero, sone
|
||||
real(psb_spk_) :: c
|
||||
b3_base=szero/sqrt(3.0_psb_spk_)
|
||||
end function b3_base
|
||||
function c_base(x,y,z)
|
||||
implicit none
|
||||
real(psb_spk_) :: c_base
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
c=szero
|
||||
end function c
|
||||
function a1(x,y,z)
|
||||
use psb_base_mod, only : psb_spk_
|
||||
real(psb_spk_) :: a1
|
||||
c_base=szero
|
||||
end function c_base
|
||||
function a1_base(x,y,z)
|
||||
implicit none
|
||||
real(psb_spk_) :: a1_base
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
a1=epsilon
|
||||
end function a1
|
||||
function a2(x,y,z)
|
||||
use psb_base_mod, only : psb_spk_
|
||||
real(psb_spk_) :: a2
|
||||
a1_base=epsilon
|
||||
end function a1_base
|
||||
function a2_base(x,y,z)
|
||||
implicit none
|
||||
real(psb_spk_) :: a2_base
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
a2=epsilon
|
||||
end function a2
|
||||
function a3(x,y,z)
|
||||
use psb_base_mod, only : psb_spk_
|
||||
real(psb_spk_) :: a3
|
||||
a2_base=epsilon
|
||||
end function a2_base
|
||||
function a3_base(x,y,z)
|
||||
implicit none
|
||||
real(psb_spk_) :: a3_base
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
a3=epsilon
|
||||
end function a3
|
||||
function g(x,y,z)
|
||||
use psb_base_mod, only : psb_spk_, sone, szero
|
||||
real(psb_spk_) :: g
|
||||
a3_base=epsilon
|
||||
end function a3_base
|
||||
function g_base(x,y,z)
|
||||
implicit none
|
||||
real(psb_spk_) :: g_base
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
g = szero
|
||||
g_base = szero
|
||||
if (x == sone) then
|
||||
g = sone
|
||||
g_base = sone
|
||||
else if (x == szero) then
|
||||
g = sone
|
||||
g_base = sone
|
||||
end if
|
||||
end function g
|
||||
end function g_base
|
||||
end module amg_s_pde3d_base_mod
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! 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 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.
|
||||
!
|
||||
module amg_s_pde3d_box_mod
|
||||
use psb_base_mod, only : psb_spk_, sone, szero
|
||||
real(psb_spk_), save, private :: epsilon=sone/80
|
||||
contains
|
||||
subroutine pde_set_parm3d_box(dat)
|
||||
real(psb_spk_), intent(in) :: dat
|
||||
epsilon = dat
|
||||
end subroutine pde_set_parm3d_box
|
||||
!
|
||||
! functions parametrizing the differential equation
|
||||
!
|
||||
function b1_box(x,y,z)
|
||||
implicit none
|
||||
real(psb_spk_) :: b1_box
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
b1_box=sone/sqrt(3.0_psb_spk_)
|
||||
end function b1_box
|
||||
function b2_box(x,y,z)
|
||||
implicit none
|
||||
real(psb_spk_) :: b2_box
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
b2_box=sone/sqrt(3.0_psb_spk_)
|
||||
end function b2_box
|
||||
function b3_box(x,y,z)
|
||||
implicit none
|
||||
real(psb_spk_) :: b3_box
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
b3_box=sone/sqrt(3.0_psb_spk_)
|
||||
end function b3_box
|
||||
function c_box(x,y,z)
|
||||
implicit none
|
||||
real(psb_spk_) :: c_box
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
c_box=szero
|
||||
end function c_box
|
||||
function a1_box(x,y,z)
|
||||
implicit none
|
||||
real(psb_spk_) :: a1_box
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
a1_box=epsilon
|
||||
end function a1_box
|
||||
function a2_box(x,y,z)
|
||||
implicit none
|
||||
real(psb_spk_) :: a2_box
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
a2_box=epsilon
|
||||
end function a2_box
|
||||
function a3_box(x,y,z)
|
||||
implicit none
|
||||
real(psb_spk_) :: a3_box
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
a3_box=epsilon
|
||||
end function a3_box
|
||||
function g_box(x,y,z)
|
||||
implicit none
|
||||
real(psb_spk_) :: g_box
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
g_box= szero
|
||||
if (x == sone) then
|
||||
g_box = sone
|
||||
else if (x == szero) then
|
||||
g_box = sone
|
||||
end if
|
||||
end function g_box
|
||||
end module amg_s_pde3d_box_mod
|
||||
@@ -35,60 +35,60 @@
|
||||
! POSSIBILITY OF SUCH DAMAGE.
|
||||
!
|
||||
module amg_s_pde3d_exp_mod
|
||||
use psb_base_mod, only : psb_spk_, sone
|
||||
use psb_base_mod, only : psb_spk_, sone, szero
|
||||
real(psb_spk_), save, private :: epsilon=sone/160
|
||||
contains
|
||||
subroutine pde_set_parm(dat)
|
||||
subroutine pde_set_parm3d_exp(dat)
|
||||
real(psb_spk_), intent(in) :: dat
|
||||
epsilon = dat
|
||||
end subroutine pde_set_parm
|
||||
end subroutine pde_set_parm3d_exp
|
||||
!
|
||||
! functions parametrizing the differential equation
|
||||
!
|
||||
function b1_exp(x,y,z)
|
||||
use psb_base_mod, only : psb_spk_, szero
|
||||
implicit none
|
||||
real(psb_spk_) :: b1_exp
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
b1_exp=szero/sqrt(3.0_psb_spk_)
|
||||
end function b1_exp
|
||||
function b2_exp(x,y,z)
|
||||
use psb_base_mod, only : psb_spk_, szero
|
||||
implicit none
|
||||
real(psb_spk_) :: b2_exp
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
b2_exp=szero/sqrt(3.0_psb_spk_)
|
||||
end function b2_exp
|
||||
function b3_exp(x,y,z)
|
||||
use psb_base_mod, only : psb_spk_, szero
|
||||
implicit none
|
||||
real(psb_spk_) :: b3_exp
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
b3_exp=szero/sqrt(3.0_psb_spk_)
|
||||
end function b3_exp
|
||||
function c_exp(x,y,z)
|
||||
use psb_base_mod, only : psb_spk_, szero
|
||||
implicit none
|
||||
real(psb_spk_) :: c_exp
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
c_exp=szero
|
||||
end function c_exp
|
||||
function a1_exp(x,y,z)
|
||||
use psb_base_mod, only : psb_spk_
|
||||
implicit none
|
||||
real(psb_spk_) :: a1_exp
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
a1_exp=epsilon*exp(-(x+y+z))
|
||||
end function a1_exp
|
||||
function a2_exp(x,y,z)
|
||||
use psb_base_mod, only : psb_spk_
|
||||
implicit none
|
||||
real(psb_spk_) :: a2_exp
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
a2_exp=epsilon*exp(-(x+y+z))
|
||||
end function a2_exp
|
||||
function a3_exp(x,y,z)
|
||||
use psb_base_mod, only : psb_spk_
|
||||
implicit none
|
||||
real(psb_spk_) :: a3_exp
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
a3_exp=epsilon*exp(-(x+y+z))
|
||||
end function a3_exp
|
||||
function g_exp(x,y,z)
|
||||
use psb_base_mod, only : psb_spk_, sone, szero
|
||||
implicit none
|
||||
real(psb_spk_) :: g_exp
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
g_exp = szero
|
||||
|
||||
@@ -35,60 +35,60 @@
|
||||
! POSSIBILITY OF SUCH DAMAGE.
|
||||
!
|
||||
module amg_s_pde3d_gauss_mod
|
||||
use psb_base_mod, only : psb_spk_, sone
|
||||
use psb_base_mod, only : psb_spk_, sone, szero
|
||||
real(psb_spk_), save, private :: epsilon=sone/80
|
||||
contains
|
||||
subroutine pde_set_parm(dat)
|
||||
subroutine pde_set_parm3d_gauss(dat)
|
||||
real(psb_spk_), intent(in) :: dat
|
||||
epsilon = dat
|
||||
end subroutine pde_set_parm
|
||||
end subroutine pde_set_parm3d_gauss
|
||||
!
|
||||
! functions parametrizing the differential equation
|
||||
!
|
||||
function b1_gauss(x,y,z)
|
||||
use psb_base_mod, only : psb_spk_, sone
|
||||
implicit none
|
||||
real(psb_spk_) :: b1_gauss
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
b1_gauss=sone/sqrt(3.0_psb_spk_)-2*x*exp(-(x**2+y**2+z**2))
|
||||
end function b1_gauss
|
||||
function b2_gauss(x,y,z)
|
||||
use psb_base_mod, only : psb_spk_, sone
|
||||
implicit none
|
||||
real(psb_spk_) :: b2_gauss
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
b2_gauss=sone/sqrt(3.0_psb_spk_)-2*y*exp(-(x**2+y**2+z**2))
|
||||
end function b2_gauss
|
||||
function b3_gauss(x,y,z)
|
||||
use psb_base_mod, only : psb_spk_, sone
|
||||
implicit none
|
||||
real(psb_spk_) :: b3_gauss
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
b3_gauss=sone/sqrt(3.0_psb_spk_)-2*z*exp(-(x**2+y**2+z**2))
|
||||
end function b3_gauss
|
||||
function c_gauss(x,y,z)
|
||||
use psb_base_mod, only : psb_spk_, szero
|
||||
implicit none
|
||||
real(psb_spk_) :: c_gauss
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
c=szero
|
||||
c_gauss=szero
|
||||
end function c_gauss
|
||||
function a1_gauss(x,y,z)
|
||||
use psb_base_mod, only : psb_spk_
|
||||
implicit none
|
||||
real(psb_spk_) :: a1_gauss
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
a1_gauss=epsilon*exp(-(x**2+y**2+z**2))
|
||||
end function a1_gauss
|
||||
function a2_gauss(x,y,z)
|
||||
use psb_base_mod, only : psb_spk_
|
||||
implicit none
|
||||
real(psb_spk_) :: a2_gauss
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
a2_gauss=epsilon*exp(-(x**2+y**2+z**2))
|
||||
end function a2_gauss
|
||||
function a3_gauss(x,y,z)
|
||||
use psb_base_mod, only : psb_spk_
|
||||
implicit none
|
||||
real(psb_spk_) :: a3_gauss
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
a3_gauss=epsilon*exp(-(x**2+y**2+z**2))
|
||||
end function a3_gauss
|
||||
function g_gauss(x,y,z)
|
||||
use psb_base_mod, only : psb_spk_, sone, szero
|
||||
implicit none
|
||||
real(psb_spk_) :: g_gauss
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
g_gauss = szero
|
||||
|
||||
@@ -18,6 +18,7 @@ BJAC ! Smoother type JACOBI FBGS GS BWGS BJAC AS. For 1-l
|
||||
HALO ! AS restriction operator: NONE HALO
|
||||
NONE ! AS prolongation operator: NONE SUM AVG
|
||||
ILU ! Subdomain solver for BJAC/AS: JACOBI GS BGS ILU ILUT MILU MUMPS SLU UMF
|
||||
8 ! Inner solver sweeps (GS and JACOBI)
|
||||
LLK ! AINV variant, ignored otherwise
|
||||
0 ! Fill level P for ILU(P) and ILU(T,P)
|
||||
1 ! Inverse Fill level P for INVK
|
||||
@@ -29,6 +30,7 @@ NONE ! Second (post) smoother, ignored if NONE
|
||||
HALO ! AS restriction operator: NONE HALO
|
||||
NONE ! AS prolongation operator: NONE SUM AVG
|
||||
ILU ! Subdomain solver for BJAC/AS: JACOBI GS BGS ILU ILUT MILU MUMPS SLU UMF
|
||||
8 ! Inner solver sweeps (GS and JACOBI)
|
||||
LLK ! AINV variant, ignored otherwise
|
||||
0 ! Fill level P for ILU(P) and ILU(T,P)
|
||||
8 ! Inverse Fill level P for INVK
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user