mirror of
https://github.com/sfilippone/amg4psblas.git
synced 2026-10-06 14:44:55 +00:00
Merge branch 'new-context' into remap-coarse
# Conflicts: # amgprec/amg_c_prec_type.f90 # amgprec/amg_d_prec_type.f90 # amgprec/amg_s_prec_type.f90 # amgprec/amg_z_prec_type.f90
This commit is contained in:
+49
-15
@@ -13,7 +13,9 @@ DMODOBJS=amg_d_prec_type.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_base_aggregator_mod.o \
|
||||
amg_d_dec_aggregator_mod.o amg_d_symdec_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 \
|
||||
amg_d_invk_solver.o amg_d_invt_solver.o
|
||||
#amg_d_bcmatch_aggregator_mod.o
|
||||
|
||||
SMODOBJS=amg_s_prec_type.o amg_s_ilu_fact_mod.o \
|
||||
@@ -22,7 +24,9 @@ SMODOBJS=amg_s_prec_type.o amg_s_ilu_fact_mod.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_base_aggregator_mod.o \
|
||||
amg_s_dec_aggregator_mod.o amg_s_symdec_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 \
|
||||
amg_s_invk_solver.o amg_s_invt_solver.o
|
||||
|
||||
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 \
|
||||
@@ -30,7 +34,9 @@ ZMODOBJS=amg_z_prec_type.o amg_z_ilu_fact_mod.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_base_aggregator_mod.o \
|
||||
amg_z_dec_aggregator_mod.o amg_z_symdec_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 \
|
||||
amg_z_invk_solver.o amg_z_invt_solver.o
|
||||
|
||||
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 \
|
||||
@@ -38,16 +44,19 @@ CMODOBJS=amg_c_prec_type.o amg_c_ilu_fact_mod.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_base_aggregator_mod.o \
|
||||
amg_c_dec_aggregator_mod.o amg_c_symdec_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 \
|
||||
amg_c_invk_solver.o amg_c_invt_solver.o
|
||||
|
||||
|
||||
|
||||
MODOBJS=amg_base_prec_type.o amg_prec_type.o amg_prec_mod.o \
|
||||
amg_s_prec_mod.o amg_d_prec_mod.o amg_c_prec_mod.o amg_z_prec_mod.o \
|
||||
$(SMODOBJS) $(DMODOBJS) $(CMODOBJS) $(ZMODOBJS)
|
||||
amg_base_ainv_mod.o amg_ainv_mod.o\
|
||||
$(SMODOBJS) $(DMODOBJS) $(CMODOBJS) $(ZMODOBJS)
|
||||
|
||||
|
||||
OBJS=$(MODOBJS)
|
||||
OBJS=$(MODOBJS)
|
||||
|
||||
LOCAL_MODS=$(MODOBJS:.o=$(.mod))
|
||||
LIBNAME=libamg_prec.a
|
||||
@@ -67,9 +76,9 @@ lib: $(OBJS) impld
|
||||
|
||||
$(MODOBJS): $(PSBLAS_MODDIR)/$(BASEMODNAME)$(.mod)
|
||||
|
||||
amg_base_prec_type.o: amg_const.h
|
||||
amg_base_prec_type.o: amg_const.h
|
||||
amg_s_prec_type.o amg_d_prec_type.o amg_c_prec_type.o amg_z_prec_type.o : amg_base_prec_type.o
|
||||
amg_prec_type.o: amg_s_prec_type.o amg_d_prec_type.o amg_c_prec_type.o amg_z_prec_type.o
|
||||
amg_prec_type.o: amg_s_prec_type.o amg_d_prec_type.o amg_c_prec_type.o amg_z_prec_type.o
|
||||
amg_prec_mod.o: amg_prec_type.o amg_s_prec_mod.o amg_d_prec_mod.o amg_c_prec_mod.o amg_z_prec_mod.o
|
||||
|
||||
$(SINNEROBJS) $(SOUTEROBJS): $(SMODOBJS)
|
||||
@@ -82,10 +91,10 @@ amg_d_inner_mod.o: amg_d_prec_type.o
|
||||
amg_c_inner_mod.o: amg_c_prec_type.o
|
||||
amg_z_inner_mod.o: amg_z_prec_type.o
|
||||
|
||||
amg_s_prec_mod.o: $(SMODOBJS)
|
||||
amg_d_prec_mod.o: $(DMODOBJS)
|
||||
amg_c_prec_mod.o: $(CMODOBJS)
|
||||
amg_z_prec_mod.o: $(ZMODOBJS)
|
||||
amg_s_prec_mod.o: $(SMODOBJS)
|
||||
amg_d_prec_mod.o: $(DMODOBJS)
|
||||
amg_c_prec_mod.o: $(CMODOBJS)
|
||||
amg_z_prec_mod.o: $(ZMODOBJS)
|
||||
|
||||
|
||||
amg_s_prec_type.o: amg_s_onelev_mod.o
|
||||
@@ -119,6 +128,14 @@ amg_d_base_smoother_mod.o: amg_d_base_solver_mod.o
|
||||
amg_c_base_smoother_mod.o: amg_c_base_solver_mod.o
|
||||
amg_z_base_smoother_mod.o: amg_z_base_solver_mod.o
|
||||
|
||||
amg_s_ainv_solver.o: amg_s_base_ainv_mod.o
|
||||
amg_c_ainv_solver.o: amg_c_base_ainv_mod.o
|
||||
amg_d_ainv_solver.o: amg_d_base_ainv_mod.o
|
||||
amg_z_ainv_solver.o: amg_z_base_ainv_mod.o
|
||||
amg_s_base_ainv_mod.o: amg_s_base_solver_mod.o amg_base_ainv_mod.o
|
||||
amg_c_base_ainv_mod.o: amg_c_base_solver_mod.o amg_base_ainv_mod.o
|
||||
amg_d_base_ainv_mod.o: amg_d_base_solver_mod.o amg_base_ainv_mod.o
|
||||
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
|
||||
|
||||
@@ -141,11 +158,11 @@ amg_s_as_smoother.o amg_s_jac_smoother.o: amg_s_base_smoother_mod.o
|
||||
amg_s_jac_smoother.o: amg_s_diag_solver.o
|
||||
amg_sprecinit.o amg_sprecset.o: amg_s_diag_solver.o amg_s_ilu_solver.o \
|
||||
amg_s_as_smoother.o amg_s_jac_smoother.o \
|
||||
amg_s_id_solver.o amg_s_slu_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_ilu_fact_mod.o: amg_base_prec_type.o amg_z_base_solver_mod.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
|
||||
amg_z_jac_smoother.o: amg_z_diag_solver.o
|
||||
@@ -163,7 +180,24 @@ amg_cprecinit.o amg_cprecset.o: amg_c_diag_solver.o amg_c_ilu_solver.o \
|
||||
amg_c_as_smoother.o amg_c_jac_smoother.o \
|
||||
amg_c_id_solver.o amg_c_slu_solver.o amg_c_sludist_solver.o
|
||||
|
||||
|
||||
amg_base_ainv_mod.o: amg_base_prec_type.o
|
||||
amg_s_base_ainv_mod.o amg_d_base_ainv_mod.o amg_c_base_ainv_mod.o amg_z_base_ainv_mod.o: amg_base_ainv_mod.o
|
||||
amg_s_ainv_solver.o: amg_base_ainv_mod.o amg_s_base_ainv_mod.o
|
||||
amg_d_ainv_solver.o: amg_base_ainv_mod.o amg_d_base_ainv_mod.o
|
||||
amg_c_ainv_solver.o: amg_base_ainv_mod.o amg_c_base_ainv_mod.o
|
||||
amg_z_ainv_solver.o: amg_base_ainv_mod.o amg_z_base_ainv_mod.o
|
||||
amg_s_invk_solver.o: amg_base_ainv_mod.o amg_s_base_ainv_mod.o
|
||||
amg_d_invk_solver.o: amg_base_ainv_mod.o amg_d_base_ainv_mod.o
|
||||
amg_c_invk_solver.o: amg_base_ainv_mod.o amg_c_base_ainv_mod.o
|
||||
amg_z_invk_solver.o: amg_base_ainv_mod.o amg_z_base_ainv_mod.o
|
||||
amg_s_invt_solver.o: amg_base_ainv_mod.o amg_s_base_ainv_mod.o
|
||||
amg_d_invt_solver.o: amg_base_ainv_mod.o amg_d_base_ainv_mod.o
|
||||
amg_c_invt_solver.o: amg_base_ainv_mod.o amg_c_base_ainv_mod.o
|
||||
amg_z_invt_solver.o: amg_base_ainv_mod.o amg_z_base_ainv_mod.o
|
||||
amg_ainv_mod.o: amg_s_ainv_solver.o amg_d_ainv_solver.o amg_c_ainv_solver.o \
|
||||
amg_z_ainv_solver.o amg_s_invk_solver.o amg_d_invk_solver.o amg_c_invk_solver.o \
|
||||
amg_z_invk_solver.o amg_s_invt_solver.o amg_d_invt_solver.o amg_c_invt_solver.o \
|
||||
amg_z_invt_solver.o
|
||||
|
||||
veryclean: clean
|
||||
/bin/rm -f $(LIBNAME)
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_ainv_mod
|
||||
use amg_d_ainv_solver
|
||||
use amg_d_invk_solver
|
||||
use amg_d_invt_solver
|
||||
use amg_s_ainv_solver
|
||||
use amg_s_invk_solver
|
||||
use amg_s_invt_solver
|
||||
use amg_c_ainv_solver
|
||||
use amg_c_invk_solver
|
||||
use amg_c_invt_solver
|
||||
use amg_c_ainv_solver
|
||||
use amg_c_invk_solver
|
||||
use amg_c_invt_solver
|
||||
end module amg_ainv_mod
|
||||
@@ -0,0 +1,64 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_base_ainv_mod
|
||||
|
||||
use amg_base_prec_type
|
||||
use psb_prec_const_mod, only : psb_inv_fillin_, psb_inv_thresh_
|
||||
|
||||
integer, parameter :: amg_inv_fillin_ = psb_inv_fillin_
|
||||
integer, parameter :: amg_ainv_alg_ = amg_inv_fillin_ + 1
|
||||
integer, parameter :: amg_inv_thresh_ = psb_inv_thresh_
|
||||
#if 0
|
||||
integer, parameter :: amg_ainv_orth1_ = amg_inv_thresh_ + 1
|
||||
integer, parameter :: amg_ainv_orth2_ = amg_ainv_orth1_ + 1
|
||||
integer, parameter :: amg_ainv_orth3_ = amg_ainv_orth2_ + 1
|
||||
integer, parameter :: amg_ainv_orth4_ = amg_ainv_orth3_ + 1
|
||||
integer, parameter :: amg_ainv_llk_ = amg_ainv_orth4_ + 1
|
||||
#else
|
||||
integer, parameter :: amg_ainv_llk_ = amg_inv_thresh_ + 1
|
||||
#endif
|
||||
integer, parameter :: amg_ainv_s_llk_ = amg_ainv_llk_ + 1
|
||||
integer, parameter :: amg_ainv_s_ft_llk_ = amg_ainv_s_llk_ + 1
|
||||
integer, parameter :: amg_ainv_llk_noth_ = amg_ainv_s_ft_llk_ + 1
|
||||
integer, parameter :: amg_ainv_mlk_ = amg_ainv_llk_noth_ + 1
|
||||
integer, parameter :: amg_ainv_lmx_ = amg_ainv_mlk_
|
||||
#if defined(HAVE_TUMA_SAINV)
|
||||
integer, parameter :: amg_ainv_s_tuma_ = amg_ainv_lmx_ + 1
|
||||
integer, parameter :: amg_ainv_l_tuma_ = amg_ainv_s_tuma_ + 1
|
||||
#endif
|
||||
|
||||
|
||||
end module amg_base_ainv_mod
|
||||
@@ -0,0 +1,321 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_c_ainv_solver
|
||||
|
||||
use amg_c_base_ainv_mod
|
||||
use psb_base_mod, only : psb_d_vect_type
|
||||
|
||||
type, extends(amg_c_base_ainv_solver_type) :: amg_c_ainv_solver_type
|
||||
!
|
||||
! Compute an approximate factorization
|
||||
! A^-1 = Z D^-1 W^T
|
||||
! Note that here W is going to be transposed explicitly,
|
||||
! so that the component w will in the end contain W^T.
|
||||
!
|
||||
integer(psb_ipk_) :: alg, fill_in
|
||||
real(psb_spk_) :: thresh
|
||||
contains
|
||||
procedure, pass(sv) :: check => amg_c_ainv_solver_check
|
||||
procedure, pass(sv) :: build => amg_c_ainv_solver_bld
|
||||
procedure, pass(sv) :: clone => amg_c_ainv_solver_clone
|
||||
procedure, pass(sv) :: cseti => amg_c_ainv_solver_cseti
|
||||
procedure, pass(sv) :: csetc => amg_c_ainv_solver_csetc
|
||||
procedure, pass(sv) :: csetr => amg_c_ainv_solver_csetr
|
||||
procedure, pass(sv) :: seti => amg_c_ainv_solver_seti
|
||||
procedure, pass(sv) :: setc => amg_c_ainv_solver_setc
|
||||
procedure, pass(sv) :: setr => amg_c_ainv_solver_setr
|
||||
generic, public :: set => seti, setr, setc
|
||||
procedure, pass(sv) :: descr => amg_c_ainv_solver_descr
|
||||
procedure, pass(sv) :: default => c_ainv_solver_default
|
||||
procedure, nopass :: stringval => c_ainv_stringval
|
||||
procedure, nopass :: algname => c_ainv_algname
|
||||
end type amg_c_ainv_solver_type
|
||||
|
||||
|
||||
private :: c_ainv_stringval, c_ainv_solver_default, &
|
||||
& c_ainv_algname
|
||||
|
||||
interface
|
||||
subroutine amg_c_ainv_solver_clone(sv,svout,info)
|
||||
import :: psb_desc_type, psb_cspmat_type, psb_c_base_sparse_mat, &
|
||||
& amg_c_base_solver_type, psb_dpk_, amg_c_ainv_solver_type, psb_ipk_
|
||||
Implicit None
|
||||
class(amg_c_ainv_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_ainv_solver_clone
|
||||
end interface
|
||||
|
||||
|
||||
interface
|
||||
subroutine amg_c_ainv_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
import :: psb_desc_type, psb_cspmat_type, psb_c_base_sparse_mat, &
|
||||
& psb_d_vect_type, psb_c_base_vect_type, psb_dpk_,&
|
||||
& amg_c_ainv_solver_type, psb_i_base_vect_type, psb_ipk_
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
type(psb_cspmat_type), intent(in), target :: a
|
||||
Type(psb_desc_type), Intent(inout) :: desc_a
|
||||
class(amg_c_ainv_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_ainv_solver_bld
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_c_ainv_solver_check(sv,info)
|
||||
import :: psb_dpk_, amg_c_ainv_solver_type, psb_ipk_
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_ainv_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_c_ainv_solver_check
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_c_ainv_solver_cseti(sv,what,val,info,idx)
|
||||
import :: psb_desc_type, psb_cspmat_type, psb_c_base_sparse_mat, psb_ipk_,&
|
||||
& psb_d_vect_type, psb_c_base_vect_type, psb_dpk_, amg_c_ainv_solver_type
|
||||
Implicit None
|
||||
! Arguments
|
||||
class(amg_c_ainv_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
|
||||
end subroutine amg_c_ainv_solver_cseti
|
||||
end interface
|
||||
|
||||
|
||||
interface
|
||||
subroutine amg_c_ainv_solver_csetc(sv,what,val,info,idx)
|
||||
import :: psb_desc_type, psb_cspmat_type, psb_c_base_sparse_mat, psb_ipk_,&
|
||||
& psb_d_vect_type, psb_c_base_vect_type, psb_dpk_, amg_c_ainv_solver_type
|
||||
Implicit None
|
||||
! Arguments
|
||||
class(amg_c_ainv_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
|
||||
end subroutine amg_c_ainv_solver_csetc
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_c_ainv_solver_csetr(sv,what,val,info,idx)
|
||||
import :: psb_desc_type, psb_cspmat_type, psb_c_base_sparse_mat, psb_ipk_,&
|
||||
& psb_d_vect_type, psb_c_base_vect_type, psb_spk_, amg_c_ainv_solver_type
|
||||
Implicit None
|
||||
! Arguments
|
||||
class(amg_c_ainv_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
|
||||
end subroutine amg_c_ainv_solver_csetr
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_c_ainv_solver_setc(sv,what,val,info)
|
||||
import :: amg_c_ainv_solver_type, psb_ipk_
|
||||
Implicit none
|
||||
! Arguments
|
||||
class(amg_c_ainv_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(in) :: what
|
||||
character(len=*), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_c_ainv_solver_setc
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_c_ainv_solver_seti(sv,what,val,info)
|
||||
import :: amg_c_ainv_solver_type, psb_ipk_
|
||||
Implicit none
|
||||
! Arguments
|
||||
class(amg_c_ainv_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(in) :: what
|
||||
integer(psb_ipk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_c_ainv_solver_seti
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_c_ainv_solver_setr(sv,what,val,info)
|
||||
import :: amg_c_ainv_solver_type, psb_ipk_, psb_spk_
|
||||
Implicit none
|
||||
! Arguments
|
||||
class(amg_c_ainv_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(in) :: what
|
||||
real(psb_spk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_c_ainv_solver_setr
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_c_ainv_solver_descr(sv,info,iout,coarse)
|
||||
import :: psb_dpk_, amg_c_ainv_solver_type, psb_ipk_
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_ainv_solver_type), intent(in) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(in), optional :: iout
|
||||
logical, intent(in), optional :: coarse
|
||||
|
||||
end subroutine amg_c_ainv_solver_descr
|
||||
end interface
|
||||
|
||||
interface amg_ainv_bld
|
||||
subroutine amg_c_ainv_bld(a,alg,fillin,thresh,wmat,d,zmat,desc,info,blck,iscale)
|
||||
import :: psb_desc_type, psb_cspmat_type, psb_c_base_sparse_mat, &
|
||||
& psb_d_vect_type, psb_c_base_vect_type, psb_spk_, psb_ipk_
|
||||
implicit none
|
||||
type(psb_cspmat_type), intent(in), target :: a
|
||||
integer(psb_ipk_), intent(in) :: fillin,alg
|
||||
real(psb_spk_), intent(in) :: thresh
|
||||
type(psb_cspmat_type), intent(inout) :: wmat, zmat
|
||||
complex(psb_spk_), allocatable :: d(:)
|
||||
Type(psb_desc_type), Intent(inout) :: desc
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
type(psb_cspmat_type), intent(in), optional :: blck
|
||||
integer(psb_ipk_), intent(in), optional :: iscale
|
||||
end subroutine amg_c_ainv_bld
|
||||
end interface
|
||||
|
||||
|
||||
contains
|
||||
|
||||
subroutine c_ainv_solver_default(sv)
|
||||
|
||||
use psb_base_mod
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_ainv_solver_type), intent(inout) :: sv
|
||||
|
||||
sv%alg = amg_ainv_llk_
|
||||
sv%fill_in = 0
|
||||
sv%thresh = dzero
|
||||
|
||||
return
|
||||
end subroutine c_ainv_solver_default
|
||||
|
||||
function is_positive_nz_min(ip) result(res)
|
||||
implicit none
|
||||
integer(psb_ipk_), intent(in) :: ip
|
||||
logical :: res
|
||||
|
||||
res = (ip >= 1)
|
||||
return
|
||||
end function is_positive_nz_min
|
||||
|
||||
|
||||
function c_ainv_stringval(string) result(val)
|
||||
use psb_base_mod, only : psb_ipk_,psb_toupper
|
||||
implicit none
|
||||
! Arguments
|
||||
character(len=*), intent(in) :: string
|
||||
integer(psb_ipk_) :: val
|
||||
character(len=*), parameter :: name='d_ainv_stringval'
|
||||
|
||||
select case(psb_toupper(trim(string)))
|
||||
case('LLK')
|
||||
val = amg_ainv_llk_
|
||||
case('STAB-LLK')
|
||||
val = amg_ainv_s_ft_llk_
|
||||
case('SYM-LLK')
|
||||
val = amg_ainv_s_llk_
|
||||
case('MLK')
|
||||
val = amg_ainv_mlk_
|
||||
#if defined(HAVE_TUMA_SAINV)
|
||||
case('SAINV-TUMA')
|
||||
val = amg_ainv_s_tuma_
|
||||
case('LAINV-TUMA')
|
||||
val = amg_ainv_l_tuma_
|
||||
#endif
|
||||
case default
|
||||
val = amg_stringval(string)
|
||||
end select
|
||||
end function c_ainv_stringval
|
||||
|
||||
|
||||
function c_ainv_algname(ialg) result(val)
|
||||
integer(psb_ipk_), intent(in) :: ialg
|
||||
character(len=40) :: val
|
||||
|
||||
character(len=*), parameter :: mlkname = 'Left-looking, list merge '
|
||||
character(len=*), parameter :: llkname = 'Left-looking '
|
||||
character(len=*), parameter :: stabllkname = 'Stabilized Left-looking '
|
||||
character(len=*), parameter :: sllkname = 'Symmetric Left-looking '
|
||||
character(len=*), parameter :: sainvname = 'SAINV (Benzi & Tuma) '
|
||||
character(len=*), parameter :: lainvname = 'LAINV (Benzi & Tuma) '
|
||||
character(len=*), parameter :: defname = 'Unknown alg variant '
|
||||
|
||||
select case (ialg)
|
||||
case(amg_ainv_mlk_)
|
||||
val = mlkname
|
||||
case(amg_ainv_llk_)
|
||||
val = llkname
|
||||
case(amg_ainv_s_llk_)
|
||||
val = sllkname
|
||||
case(amg_ainv_s_ft_llk_)
|
||||
val = stabllkname
|
||||
#if defined(HAVE_TUMA_SAINV)
|
||||
case(amg_ainv_s_tuma_ )
|
||||
val = sainvname
|
||||
case(amg_ainv_l_tuma_ )
|
||||
val = lainvname
|
||||
#endif
|
||||
case default
|
||||
val = defname
|
||||
end select
|
||||
|
||||
end function c_ainv_algname
|
||||
|
||||
end module amg_c_ainv_solver
|
||||
@@ -0,0 +1,199 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_c_base_ainv_mod
|
||||
|
||||
use amg_base_ainv_mod
|
||||
use amg_c_base_solver_mod
|
||||
use psb_c_ainv_tools_mod
|
||||
use psb_base_mod, only : psb_c_vect_type, psb_spk_, psb_epk_
|
||||
|
||||
|
||||
|
||||
type, extends(amg_c_base_solver_type) :: amg_c_base_ainv_solver_type
|
||||
!
|
||||
! Compute an approximate factorization
|
||||
! A^-1 = Z D^-1 W^T
|
||||
! Note that here W is going to be transposed explicitly,
|
||||
! so that the component w will in the end contain W^T.
|
||||
!
|
||||
type(psb_cspmat_type) :: w, z
|
||||
type(psb_c_vect_type) :: dv
|
||||
complex(psb_spk_), allocatable :: d(:)
|
||||
|
||||
contains
|
||||
procedure, pass(sv) :: cnv => amg_c_base_ainv_solver_cnv
|
||||
procedure, pass(sv) :: dump => amg_c_base_ainv_solver_dmp
|
||||
procedure, pass(sv) :: apply_v => amg_c_base_ainv_solver_apply_vect
|
||||
procedure, pass(sv) :: apply_a => amg_c_base_ainv_solver_apply
|
||||
procedure, pass(sv) :: free => amg_c_base_ainv_solver_free
|
||||
procedure, pass(sv) :: sizeof => c_base_ainv_solver_sizeof
|
||||
procedure, pass(sv) :: get_nzeros => c_base_ainv_get_nzeros
|
||||
procedure, nopass :: get_wrksz => c_base_ainv_get_wrksize
|
||||
procedure, pass(sv) :: update_a => amg_c_base_ainv_update_a
|
||||
generic, public :: update => update_a
|
||||
end type amg_c_base_ainv_solver_type
|
||||
|
||||
private :: c_base_ainv_solver_sizeof, &
|
||||
& c_base_ainv_get_nzeros, c_base_ainv_get_wrksize
|
||||
|
||||
|
||||
interface
|
||||
subroutine amg_c_base_ainv_solver_cnv(sv,info,amold,vmold,imold)
|
||||
import :: psb_c_base_sparse_mat, psb_c_base_vect_type, psb_spk_, &
|
||||
& amg_c_base_ainv_solver_type, psb_ipk_, psb_i_base_vect_type
|
||||
Implicit None
|
||||
! Arguments
|
||||
class(amg_c_base_ainv_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_base_ainv_solver_cnv
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_c_base_ainv_update_a(sv,x,desc_data,info)
|
||||
import :: psb_desc_type, psb_spk_,amg_c_base_ainv_solver_type, psb_c_vect_type, psb_ipk_
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(amg_c_base_ainv_solver_type), intent(inout) :: sv
|
||||
complex(psb_spk_),intent(in) :: x(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_c_base_ainv_update_a
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_c_base_ainv_solver_apply(alpha,sv,x,beta,y,desc_data,&
|
||||
& trans,work,info,init,initu)
|
||||
import :: psb_desc_type, psb_spk_,amg_c_base_ainv_solver_type, psb_ipk_
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(amg_c_base_ainv_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_base_ainv_solver_apply
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_c_base_ainv_solver_apply_vect(alpha,sv,x,beta,y,desc_data,&
|
||||
& trans,work,wv,info,init,initu)
|
||||
import :: psb_desc_type, psb_spk_,amg_c_base_ainv_solver_type, psb_c_vect_type, psb_ipk_
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(amg_c_base_ainv_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_base_ainv_solver_apply_vect
|
||||
end interface
|
||||
|
||||
|
||||
interface
|
||||
subroutine amg_c_base_ainv_solver_free(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_base_ainv_solver_type, psb_ipk_
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_base_ainv_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_c_base_ainv_solver_free
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_c_base_ainv_solver_dmp(sv,desc,level,info,prefix,head,solver,global_num)
|
||||
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_ainv_solver_type, psb_ipk_
|
||||
|
||||
implicit none
|
||||
class(amg_c_base_ainv_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_base_ainv_solver_dmp
|
||||
end interface
|
||||
|
||||
contains
|
||||
|
||||
function c_base_ainv_get_nzeros(sv) result(val)
|
||||
implicit none
|
||||
! Arguments
|
||||
class(amg_c_base_ainv_solver_type), intent(in) :: sv
|
||||
integer(psb_epk_) :: val
|
||||
integer :: i
|
||||
|
||||
val = 0
|
||||
val = val + sv%dv%get_nrows()
|
||||
val = val + sv%w%get_nzeros()
|
||||
val = val + sv%z%get_nzeros()
|
||||
|
||||
return
|
||||
end function c_base_ainv_get_nzeros
|
||||
|
||||
function c_base_ainv_solver_sizeof(sv) result(val)
|
||||
implicit none
|
||||
! Arguments
|
||||
class(amg_c_base_ainv_solver_type), intent(in) :: sv
|
||||
integer(psb_epk_) :: val
|
||||
integer :: i
|
||||
|
||||
val = 2*psb_sizeof_ip + psb_sizeof_dp
|
||||
val = val + sv%dv%sizeof()
|
||||
val = val + sv%w%sizeof()
|
||||
val = val + sv%z%sizeof()
|
||||
|
||||
return
|
||||
end function c_base_ainv_solver_sizeof
|
||||
|
||||
function c_base_ainv_get_wrksize() result(val)
|
||||
implicit none
|
||||
integer(psb_ipk_) :: val
|
||||
|
||||
val = 2
|
||||
end function c_base_ainv_get_wrksize
|
||||
|
||||
end module amg_c_base_ainv_mod
|
||||
@@ -0,0 +1,168 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_c_invk_solver
|
||||
|
||||
use amg_c_base_solver_mod
|
||||
use amg_c_base_ainv_mod
|
||||
use psb_base_mod, only : psb_c_vect_type
|
||||
|
||||
type, extends(amg_c_base_ainv_solver_type) :: amg_c_invk_solver_type
|
||||
integer(psb_ipk_) :: fill_in, inv_fill
|
||||
contains
|
||||
procedure, pass(sv) :: check => amg_c_invk_solver_check
|
||||
procedure, pass(sv) :: clone => amg_c_invk_solver_clone
|
||||
procedure, pass(sv) :: build => amg_c_invk_solver_bld
|
||||
procedure, pass(sv) :: cseti => amg_c_invk_solver_cseti
|
||||
procedure, pass(sv) :: seti => amg_c_invk_solver_seti
|
||||
generic, public :: set => seti
|
||||
procedure, pass(sv) :: descr => amg_c_invk_solver_descr
|
||||
procedure, pass(sv) :: default => c_invk_solver_default
|
||||
end type amg_c_invk_solver_type
|
||||
|
||||
|
||||
private :: c_invk_solver_default
|
||||
|
||||
|
||||
interface
|
||||
subroutine amg_c_invk_solver_clone(sv,svout,info)
|
||||
import :: psb_desc_type, psb_cspmat_type, psb_c_base_sparse_mat, &
|
||||
& amg_c_base_solver_type, psb_spk_, amg_c_invk_solver_type, psb_ipk_
|
||||
Implicit None
|
||||
class(amg_c_invk_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_invk_solver_clone
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_c_invk_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
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_invk_solver_type, psb_i_base_vect_type, psb_ipk_
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
type(psb_cspmat_type), intent(in), target :: a
|
||||
Type(psb_desc_type), Intent(inout) :: desc_a
|
||||
class(amg_c_invk_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_invk_solver_bld
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_c_invk_solver_check(sv,info)
|
||||
import :: psb_spk_, amg_c_invk_solver_type, psb_ipk_
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_invk_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_c_invk_solver_check
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_c_invk_solver_cseti(sv,what,val,info,idx)
|
||||
import :: psb_desc_type, psb_cspmat_type, psb_c_base_sparse_mat, &
|
||||
& psb_ipk_, psb_c_vect_type, psb_c_base_vect_type, psb_spk_, &
|
||||
& amg_c_invk_solver_type
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_invk_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
|
||||
end subroutine amg_c_invk_solver_cseti
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_c_invk_solver_descr(sv,info,iout,coarse)
|
||||
import :: psb_spk_, amg_c_invk_solver_type, psb_ipk_
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_invk_solver_type), intent(in) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(in), optional :: iout
|
||||
logical, intent(in), optional :: coarse
|
||||
|
||||
end subroutine amg_c_invk_solver_descr
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_c_invk_solver_seti(sv,what,val,info)
|
||||
import :: amg_c_invk_solver_type, psb_ipk_
|
||||
Implicit none
|
||||
! Arguments
|
||||
class(amg_c_invk_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(in) :: what
|
||||
integer(psb_ipk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_c_invk_solver_seti
|
||||
end interface
|
||||
|
||||
contains
|
||||
|
||||
subroutine c_invk_solver_default(sv)
|
||||
|
||||
!use psb_base_mod
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_invk_solver_type), intent(inout) :: sv
|
||||
|
||||
sv%fill_in = 0
|
||||
sv%inv_fill = 0
|
||||
|
||||
return
|
||||
end subroutine c_invk_solver_default
|
||||
|
||||
end module amg_c_invk_solver
|
||||
@@ -0,0 +1,194 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_c_invt_solver
|
||||
|
||||
use amg_c_base_solver_mod
|
||||
use amg_c_base_ainv_mod
|
||||
use psb_base_mod, only : psb_c_vect_type
|
||||
|
||||
type, extends(amg_c_base_ainv_solver_type) :: amg_c_invt_solver_type
|
||||
integer(psb_ipk_) :: fill_in, inv_fill
|
||||
real(psb_spk_) :: thresh, inv_thresh
|
||||
contains
|
||||
procedure, pass(sv) :: check => amg_c_invt_solver_check
|
||||
procedure, pass(sv) :: clone => amg_c_invt_solver_clone
|
||||
procedure, pass(sv) :: build => amg_c_invt_solver_bld
|
||||
procedure, pass(sv) :: cseti => amg_c_invt_solver_cseti
|
||||
procedure, pass(sv) :: csetr => amg_c_invt_solver_csetr
|
||||
procedure, pass(sv) :: seti => amg_c_invt_solver_seti
|
||||
procedure, pass(sv) :: setr => amg_c_invt_solver_setr
|
||||
generic, public :: set => seti, setr
|
||||
procedure, pass(sv) :: descr => amg_c_invt_solver_descr
|
||||
procedure, pass(sv) :: default => c_invt_solver_default
|
||||
end type amg_c_invt_solver_type
|
||||
|
||||
private :: c_invt_solver_default
|
||||
|
||||
|
||||
interface
|
||||
subroutine amg_c_invt_solver_clone(sv,svout,info)
|
||||
import :: psb_desc_type, psb_cspmat_type, psb_c_base_sparse_mat, &
|
||||
& amg_c_base_solver_type, psb_spk_, amg_c_invt_solver_type, psb_ipk_
|
||||
Implicit None
|
||||
class(amg_c_invt_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_invt_solver_clone
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_c_invt_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
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_invt_solver_type, psb_i_base_vect_type, psb_ipk_
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
type(psb_cspmat_type), intent(in), target :: a
|
||||
Type(psb_desc_type), Intent(inout) :: desc_a
|
||||
class(amg_c_invt_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_invt_solver_bld
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_c_invt_solver_check(sv,info)
|
||||
import :: amg_c_invt_solver_type, psb_ipk_
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_invt_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_c_invt_solver_check
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_c_invt_solver_cseti(sv,what,val,info,idx)
|
||||
import :: psb_desc_type, psb_cspmat_type, psb_c_base_sparse_mat, psb_ipk_,&
|
||||
& psb_c_vect_type, psb_c_base_vect_type, psb_spk_, amg_c_invt_solver_type
|
||||
Implicit None
|
||||
! Arguments
|
||||
class(amg_c_invt_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
|
||||
end subroutine amg_c_invt_solver_cseti
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_c_invt_solver_csetr(sv,what,val,info,idx)
|
||||
import :: psb_desc_type, psb_cspmat_type, psb_c_base_sparse_mat, psb_ipk_,&
|
||||
& psb_c_vect_type, psb_c_base_vect_type, psb_spk_, amg_c_invt_solver_type
|
||||
Implicit None
|
||||
! Arguments
|
||||
class(amg_c_invt_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
|
||||
end subroutine amg_c_invt_solver_csetr
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_c_invt_solver_descr(sv,info,iout,coarse)
|
||||
import :: psb_spk_, amg_c_invt_solver_type, psb_ipk_
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_invt_solver_type), intent(in) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(in), optional :: iout
|
||||
logical, intent(in), optional :: coarse
|
||||
|
||||
end subroutine amg_c_invt_solver_descr
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_c_invt_solver_setr(sv,what,val,info)
|
||||
import :: amg_c_invt_solver_type, psb_spk_, psb_ipk_
|
||||
Implicit none
|
||||
! Arguments
|
||||
class(amg_c_invt_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(in) :: what
|
||||
real(psb_spk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_c_invt_solver_setr
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_c_invt_solver_seti(sv,what,val,info)
|
||||
import :: amg_c_invt_solver_type, psb_ipk_
|
||||
Implicit none
|
||||
! Arguments
|
||||
class(amg_c_invt_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(in) :: what
|
||||
integer(psb_ipk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine
|
||||
end interface
|
||||
|
||||
contains
|
||||
|
||||
subroutine c_invt_solver_default(sv)
|
||||
|
||||
!use psb_base_mod
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_invt_solver_type), intent(inout) :: sv
|
||||
|
||||
sv%fill_in = 0
|
||||
sv%inv_fill = 0
|
||||
sv%thresh = szero
|
||||
sv%inv_thresh = szero
|
||||
|
||||
return
|
||||
end subroutine c_invt_solver_default
|
||||
|
||||
end module amg_c_invt_solver
|
||||
+19
-16
@@ -1,15 +1,15 @@
|
||||
!
|
||||
!
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! 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:
|
||||
@@ -21,7 +21,7 @@
|
||||
! 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
|
||||
@@ -33,8 +33,8 @@
|
||||
! 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_prec_mod.f90
|
||||
!
|
||||
! Module: amg_c_prec_mod
|
||||
@@ -52,6 +52,9 @@ module amg_c_prec_mod
|
||||
use amg_c_l1_diag_solver
|
||||
use amg_c_ilu_solver
|
||||
use amg_c_gs_solver
|
||||
use amg_c_ainv_solver
|
||||
use amg_c_invk_solver
|
||||
use amg_c_invt_solver
|
||||
|
||||
interface amg_precset
|
||||
module procedure amg_c_iprecsetsm, amg_c_iprecsetsv, &
|
||||
@@ -78,7 +81,7 @@ module amg_c_prec_mod
|
||||
! !$ character, intent(in), optional :: upd
|
||||
end subroutine amg_c_extprol_bld
|
||||
end interface amg_extprol_bld
|
||||
|
||||
|
||||
contains
|
||||
|
||||
subroutine amg_c_iprecsetsm(p,val,info,pos)
|
||||
@@ -108,7 +111,7 @@ contains
|
||||
|
||||
subroutine amg_c_cprecseti(p,what,val,info,pos)
|
||||
type(amg_cprec_type), intent(inout) :: p
|
||||
character(len=*), intent(in) :: what
|
||||
character(len=*), intent(in) :: what
|
||||
integer(psb_ipk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
character(len=*), optional, intent(in) :: pos
|
||||
@@ -118,7 +121,7 @@ contains
|
||||
|
||||
subroutine amg_c_cprecsetr(p,what,val,info,pos)
|
||||
type(amg_cprec_type), intent(inout) :: p
|
||||
character(len=*), intent(in) :: what
|
||||
character(len=*), intent(in) :: what
|
||||
real(psb_spk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
character(len=*), optional, intent(in) :: pos
|
||||
@@ -128,7 +131,7 @@ contains
|
||||
|
||||
subroutine amg_c_cprecsetc(p,what,val,info,pos)
|
||||
type(amg_cprec_type), intent(inout) :: p
|
||||
character(len=*), intent(in) :: what
|
||||
character(len=*), intent(in) :: what
|
||||
character(len=*), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
character(len=*), optional, intent(in) :: pos
|
||||
|
||||
+144
-145
@@ -1,15 +1,15 @@
|
||||
!
|
||||
!
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! 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:
|
||||
@@ -21,7 +21,7 @@
|
||||
! 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
|
||||
@@ -33,21 +33,21 @@
|
||||
! 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_prec_type.f90
|
||||
!
|
||||
! Module: amg_c_prec_type
|
||||
!
|
||||
! This module defines:
|
||||
! This module defines:
|
||||
! - the amg_c_prec_type data structure containing the preconditioner and related
|
||||
! data structures;
|
||||
!
|
||||
! It contains routines for
|
||||
! - Building and applying;
|
||||
! - Building and applying;
|
||||
! - checking if the preconditioner is correctly defined;
|
||||
! - printing a description of the preconditioner;
|
||||
! - deallocating the preconditioner data structure.
|
||||
! - deallocating the preconditioner data structure.
|
||||
!
|
||||
|
||||
module amg_c_prec_type
|
||||
@@ -70,25 +70,25 @@ module amg_c_prec_type
|
||||
! It consists of an array of 'one-level' intermediate data structures
|
||||
! of type amg_conelev_type, each containing the information needed to apply
|
||||
! the smoothing and the coarse-space correction at a generic level. RT is the
|
||||
! real data type, i.e. S for both S and C, and D for both D and Z.
|
||||
! real data type, i.e. S for both S and C, and D for both D and Z.
|
||||
!
|
||||
! type amg_cprec_type
|
||||
! type(amg_conelev_type), allocatable :: precv(:)
|
||||
! type(amg_conelev_type), allocatable :: precv(:)
|
||||
! end type amg_cprec_type
|
||||
!
|
||||
!
|
||||
! Note that the levels are numbered in increasing order starting from
|
||||
! the level 1 as the finest one, and the number of levels is given by
|
||||
! size(precv(:)) which is the id of the coarsest level.
|
||||
! size(precv(:)) which is the id of the coarsest level.
|
||||
! In the multigrid literature many authors number the levels in the opposite
|
||||
! order, with level 0 being the id of the coarsest level.
|
||||
!
|
||||
!
|
||||
integer, parameter, private :: wv_size_=4
|
||||
|
||||
|
||||
type, extends(psb_cprec_type) :: amg_cprec_type
|
||||
type(amg_saggr_data) :: ag_data
|
||||
!
|
||||
! Number of outer sweeps. Sometimes 2 V-cycles may be better than 1 W-cycle.
|
||||
! Number of outer sweeps. Sometimes 2 V-cycles may be better than 1 W-cycle.
|
||||
!
|
||||
integer(psb_ipk_) :: outer_sweeps = 1
|
||||
!
|
||||
@@ -97,11 +97,11 @@ module amg_c_prec_type
|
||||
! to keep track against what is put later in the multilevel array
|
||||
!
|
||||
integer(psb_ipk_) :: coarse_solver = -1
|
||||
|
||||
|
||||
!
|
||||
! The multilevel hierarchy
|
||||
!
|
||||
type(amg_c_onelev_type), allocatable :: precv(:)
|
||||
type(amg_c_onelev_type), allocatable :: precv(:)
|
||||
contains
|
||||
procedure, pass(prec) :: psb_c_apply2_vect => amg_c_apply2_vect
|
||||
procedure, pass(prec) :: psb_c_apply1_vect => amg_c_apply1_vect
|
||||
@@ -157,7 +157,7 @@ module amg_c_prec_type
|
||||
interface amg_precdescr
|
||||
subroutine amg_cfile_prec_descr(prec,iout,root)
|
||||
import :: amg_cprec_type, psb_ipk_
|
||||
implicit none
|
||||
implicit none
|
||||
! Arguments
|
||||
class(amg_cprec_type), intent(in) :: prec
|
||||
integer(psb_ipk_), intent(in), optional :: iout
|
||||
@@ -211,7 +211,7 @@ module amg_c_prec_type
|
||||
end subroutine amg_cprecaply1
|
||||
end interface
|
||||
|
||||
interface
|
||||
interface
|
||||
subroutine amg_cprecsetsm(prec,val,info,ilev,ilmax,pos)
|
||||
import :: psb_cspmat_type, psb_desc_type, psb_spk_, &
|
||||
& amg_cprec_type, amg_c_base_smoother_type, psb_ipk_
|
||||
@@ -243,7 +243,7 @@ module amg_c_prec_type
|
||||
import :: psb_cspmat_type, psb_desc_type, psb_spk_, &
|
||||
& amg_cprec_type, psb_ipk_
|
||||
class(amg_cprec_type), intent(inout) :: prec
|
||||
character(len=*), intent(in) :: what
|
||||
character(len=*), intent(in) :: what
|
||||
integer(psb_ipk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: ilev,ilmax,idx
|
||||
@@ -253,7 +253,7 @@ module amg_c_prec_type
|
||||
import :: psb_cspmat_type, psb_desc_type, psb_spk_, &
|
||||
& amg_cprec_type, psb_ipk_
|
||||
class(amg_cprec_type), intent(inout) :: prec
|
||||
character(len=*), intent(in) :: what
|
||||
character(len=*), intent(in) :: what
|
||||
real(psb_spk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: ilev,ilmax,idx
|
||||
@@ -263,7 +263,7 @@ module amg_c_prec_type
|
||||
import :: psb_cspmat_type, psb_desc_type, psb_spk_, &
|
||||
& amg_cprec_type, psb_ipk_
|
||||
class(amg_cprec_type), intent(inout) :: prec
|
||||
character(len=*), intent(in) :: what
|
||||
character(len=*), intent(in) :: what
|
||||
character(len=*), intent(in) :: string
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: ilev,ilmax,idx
|
||||
@@ -341,28 +341,28 @@ module amg_c_prec_type
|
||||
! character, intent(in),optional :: upd
|
||||
end subroutine amg_c_smoothers_bld
|
||||
end interface amg_smoothers_bld
|
||||
|
||||
|
||||
contains
|
||||
!
|
||||
! Function returning a pointer to the smoother
|
||||
!
|
||||
function amg_c_get_smootherp(prec,ilev) result(val)
|
||||
implicit none
|
||||
implicit none
|
||||
class(amg_cprec_type), target, intent(in) :: prec
|
||||
integer(psb_ipk_), optional :: ilev
|
||||
class(amg_c_base_smoother_type), pointer :: val
|
||||
integer(psb_ipk_) :: ilev_
|
||||
|
||||
|
||||
val => null()
|
||||
if (present(ilev)) then
|
||||
if (present(ilev)) then
|
||||
ilev_ = ilev
|
||||
else
|
||||
! What is a good default?
|
||||
! What is a good default?
|
||||
ilev_ = 1
|
||||
end if
|
||||
if (allocated(prec%precv)) then
|
||||
if ((1<=ilev_).and.(ilev_<=size(prec%precv))) then
|
||||
if (allocated(prec%precv(ilev_)%sm)) then
|
||||
if (allocated(prec%precv)) then
|
||||
if ((1<=ilev_).and.(ilev_<=size(prec%precv))) then
|
||||
if (allocated(prec%precv(ilev_)%sm)) then
|
||||
val => prec%precv(ilev_)%sm
|
||||
end if
|
||||
end if
|
||||
@@ -372,23 +372,23 @@ contains
|
||||
! Function returning a pointer to the solver
|
||||
!
|
||||
function amg_c_get_solverp(prec,ilev) result(val)
|
||||
implicit none
|
||||
implicit none
|
||||
class(amg_cprec_type), target, intent(in) :: prec
|
||||
integer(psb_ipk_), optional :: ilev
|
||||
class(amg_c_base_solver_type), pointer :: val
|
||||
integer(psb_ipk_) :: ilev_
|
||||
|
||||
|
||||
val => null()
|
||||
if (present(ilev)) then
|
||||
if (present(ilev)) then
|
||||
ilev_ = ilev
|
||||
else
|
||||
! What is a good default?
|
||||
! What is a good default?
|
||||
ilev_ = 1
|
||||
end if
|
||||
if (allocated(prec%precv)) then
|
||||
if ((1<=ilev_).and.(ilev_<=size(prec%precv))) then
|
||||
if (allocated(prec%precv(ilev_)%sm)) then
|
||||
if (allocated(prec%precv(ilev_)%sm%sv)) then
|
||||
if (allocated(prec%precv)) then
|
||||
if ((1<=ilev_).and.(ilev_<=size(prec%precv))) then
|
||||
if (allocated(prec%precv(ilev_)%sm)) then
|
||||
if (allocated(prec%precv(ilev_)%sm%sv)) then
|
||||
val => prec%precv(ilev_)%sm%sv
|
||||
end if
|
||||
end if
|
||||
@@ -399,25 +399,25 @@ contains
|
||||
! Function returning the size of the precv(:) array
|
||||
!
|
||||
function amg_c_get_nlevs(prec) result(val)
|
||||
implicit none
|
||||
implicit none
|
||||
class(amg_cprec_type), intent(in) :: prec
|
||||
integer(psb_ipk_) :: val
|
||||
val = 0
|
||||
if (allocated(prec%precv)) then
|
||||
if (allocated(prec%precv)) then
|
||||
val = size(prec%precv)
|
||||
end if
|
||||
end function amg_c_get_nlevs
|
||||
!
|
||||
! Function returning the size of the amg_prec_type data structure
|
||||
! in bytes or in number of nonzeros of the operator(s) involved.
|
||||
! in bytes or in number of nonzeros of the operator(s) involved.
|
||||
!
|
||||
function amg_c_get_nzeros(prec) result(val)
|
||||
implicit none
|
||||
implicit none
|
||||
class(amg_cprec_type), intent(in) :: prec
|
||||
integer(psb_epk_) :: val
|
||||
integer(psb_ipk_) :: i
|
||||
val = 0
|
||||
if (allocated(prec%precv)) then
|
||||
if (allocated(prec%precv)) then
|
||||
do i=1, size(prec%precv)
|
||||
val = val + prec%precv(i)%get_nzeros()
|
||||
end do
|
||||
@@ -425,13 +425,13 @@ contains
|
||||
end function amg_c_get_nzeros
|
||||
|
||||
function amg_cprec_sizeof(prec) result(val)
|
||||
implicit none
|
||||
implicit none
|
||||
class(amg_cprec_type), intent(in) :: prec
|
||||
integer(psb_epk_) :: val
|
||||
integer(psb_ipk_) :: i
|
||||
val = 0
|
||||
val = val + psb_sizeof_ip
|
||||
if (allocated(prec%precv)) then
|
||||
if (allocated(prec%precv)) then
|
||||
do i=1, size(prec%precv)
|
||||
val = val + prec%precv(i)%sizeof()
|
||||
end do
|
||||
@@ -444,40 +444,40 @@ contains
|
||||
! various level to the nonzeroes at the fine level
|
||||
! (original matrix)
|
||||
!
|
||||
|
||||
|
||||
function amg_c_get_compl(prec) result(val)
|
||||
implicit none
|
||||
implicit none
|
||||
class(amg_cprec_type), intent(in) :: prec
|
||||
complex(psb_spk_) :: val
|
||||
|
||||
|
||||
val = prec%ag_data%op_complexity
|
||||
|
||||
end function amg_c_get_compl
|
||||
|
||||
subroutine amg_c_cmp_compl(prec)
|
||||
|
||||
implicit none
|
||||
subroutine amg_c_cmp_compl(prec)
|
||||
|
||||
implicit none
|
||||
class(amg_cprec_type), intent(inout) :: prec
|
||||
|
||||
|
||||
real(psb_spk_) :: num, den, nmin
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: il
|
||||
integer(psb_ipk_) :: il
|
||||
|
||||
num = -sone
|
||||
den = sone
|
||||
ctxt = prec%ctxt
|
||||
if (allocated(prec%precv)) then
|
||||
if (allocated(prec%precv)) then
|
||||
il = 1
|
||||
num = prec%precv(il)%base_a%get_nzeros()
|
||||
if (num >= szero) then
|
||||
den = num
|
||||
den = num
|
||||
do il=2,size(prec%precv)
|
||||
num = num + max(0,prec%precv(il)%base_a%get_nzeros())
|
||||
end do
|
||||
end if
|
||||
end if
|
||||
nmin = num
|
||||
call psb_min(ctxt,nmin)
|
||||
call psb_min(ctxt,nmin)
|
||||
if (nmin < szero) then
|
||||
num = szero
|
||||
den = sone
|
||||
@@ -487,25 +487,25 @@ contains
|
||||
end if
|
||||
prec%ag_data%op_complexity = num/den
|
||||
end subroutine amg_c_cmp_compl
|
||||
|
||||
|
||||
!
|
||||
! Average coarsening ratio
|
||||
!
|
||||
|
||||
|
||||
function amg_c_get_avg_cr(prec) result(val)
|
||||
implicit none
|
||||
implicit none
|
||||
class(amg_cprec_type), intent(in) :: prec
|
||||
complex(psb_spk_) :: val
|
||||
|
||||
|
||||
val = prec%ag_data%avg_cr
|
||||
|
||||
end function amg_c_get_avg_cr
|
||||
|
||||
subroutine amg_c_cmp_avg_cr(prec)
|
||||
|
||||
implicit none
|
||||
subroutine amg_c_cmp_avg_cr(prec)
|
||||
|
||||
implicit none
|
||||
class(amg_cprec_type), intent(inout) :: prec
|
||||
|
||||
|
||||
real(psb_spk_) :: avgcr
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: il, nl, iam, np
|
||||
@@ -519,12 +519,12 @@ contains
|
||||
do il=2,nl
|
||||
avgcr = avgcr + max(szero,prec%precv(il)%szratio)
|
||||
end do
|
||||
avgcr = avgcr / (nl-1)
|
||||
avgcr = avgcr / (nl-1)
|
||||
end if
|
||||
call psb_sum(ctxt,avgcr)
|
||||
call psb_sum(ctxt,avgcr)
|
||||
prec%ag_data%avg_cr = avgcr/np
|
||||
end subroutine amg_c_cmp_avg_cr
|
||||
|
||||
|
||||
!
|
||||
! Subroutines: amg_Tprec_free
|
||||
! Version: complex
|
||||
@@ -538,74 +538,74 @@ contains
|
||||
! error code.
|
||||
!
|
||||
subroutine amg_cprecfree(p,info)
|
||||
|
||||
|
||||
implicit none
|
||||
|
||||
|
||||
! Arguments
|
||||
type(amg_cprec_type), intent(inout) :: p
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: me,err_act,i
|
||||
character(len=20) :: name
|
||||
|
||||
|
||||
info=psb_success_
|
||||
name = 'amg_cprecfree'
|
||||
call psb_erractionsave(err_act)
|
||||
if (psb_errstatus_fatal()) then
|
||||
info = psb_err_internal_error_; return
|
||||
end if
|
||||
|
||||
|
||||
me=-1
|
||||
|
||||
|
||||
call p%free(info)
|
||||
|
||||
|
||||
|
||||
return
|
||||
|
||||
|
||||
end subroutine amg_cprecfree
|
||||
|
||||
subroutine amg_c_prec_free(prec,info)
|
||||
|
||||
|
||||
implicit none
|
||||
|
||||
|
||||
! Arguments
|
||||
class(amg_cprec_type), intent(inout) :: prec
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: me,err_act,i
|
||||
character(len=20) :: name
|
||||
|
||||
|
||||
info=psb_success_
|
||||
name = 'amg_cprecfree'
|
||||
call psb_erractionsave(err_act)
|
||||
if (psb_errstatus_fatal()) then
|
||||
info = psb_err_internal_error_; goto 9999
|
||||
end if
|
||||
|
||||
|
||||
me=-1
|
||||
if (allocated(prec%precv)) then
|
||||
do i=1,size(prec%precv)
|
||||
if (allocated(prec%precv)) then
|
||||
do i=1,size(prec%precv)
|
||||
call prec%precv(i)%free(info)
|
||||
end do
|
||||
deallocate(prec%precv,stat=info)
|
||||
end if
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
|
||||
|
||||
end subroutine amg_c_prec_free
|
||||
|
||||
|
||||
|
||||
|
||||
!
|
||||
! Top level methods.
|
||||
! Top level methods.
|
||||
!
|
||||
subroutine amg_c_apply2_vect(prec,x,y,desc_data,info,trans,work)
|
||||
implicit none
|
||||
implicit none
|
||||
type(psb_desc_type),intent(in) :: desc_data
|
||||
class(amg_cprec_type), intent(inout) :: prec
|
||||
type(psb_c_vect_type),intent(inout) :: x
|
||||
@@ -618,13 +618,13 @@ contains
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select type(prec)
|
||||
select type(prec)
|
||||
type is (amg_cprec_type)
|
||||
call amg_precapply(prec,x,y,desc_data,info,trans,work)
|
||||
class default
|
||||
info = psb_err_missing_override_method_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
@@ -636,7 +636,7 @@ contains
|
||||
end subroutine amg_c_apply2_vect
|
||||
|
||||
subroutine amg_c_apply1_vect(prec,x,desc_data,info,trans,work)
|
||||
implicit none
|
||||
implicit none
|
||||
type(psb_desc_type),intent(in) :: desc_data
|
||||
class(amg_cprec_type), intent(inout) :: prec
|
||||
type(psb_c_vect_type),intent(inout) :: x
|
||||
@@ -648,13 +648,13 @@ contains
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select type(prec)
|
||||
select type(prec)
|
||||
type is (amg_cprec_type)
|
||||
call amg_precapply(prec,x,desc_data,info,trans,work)
|
||||
class default
|
||||
info = psb_err_missing_override_method_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
@@ -667,7 +667,7 @@ contains
|
||||
|
||||
|
||||
subroutine amg_c_apply2v(prec,x,y,desc_data,info,trans,work)
|
||||
implicit none
|
||||
implicit none
|
||||
type(psb_desc_type),intent(in) :: desc_data
|
||||
class(amg_cprec_type), intent(inout) :: prec
|
||||
complex(psb_spk_),intent(inout) :: x(:)
|
||||
@@ -680,13 +680,13 @@ contains
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select type(prec)
|
||||
select type(prec)
|
||||
type is (amg_cprec_type)
|
||||
call amg_precapply(prec,x,y,desc_data,info,trans,work)
|
||||
class default
|
||||
info = psb_err_missing_override_method_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
@@ -698,7 +698,7 @@ contains
|
||||
end subroutine amg_c_apply2v
|
||||
|
||||
subroutine amg_c_apply1v(prec,x,desc_data,info,trans)
|
||||
implicit none
|
||||
implicit none
|
||||
type(psb_desc_type),intent(in) :: desc_data
|
||||
class(amg_cprec_type), intent(inout) :: prec
|
||||
complex(psb_spk_),intent(inout) :: x(:)
|
||||
@@ -709,13 +709,13 @@ contains
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select type(prec)
|
||||
select type(prec)
|
||||
type is (amg_cprec_type)
|
||||
call amg_precapply(prec,x,desc_data,info,trans)
|
||||
class default
|
||||
info = psb_err_missing_override_method_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
@@ -730,8 +730,8 @@ contains
|
||||
subroutine amg_c_dump(prec,info,istart,iend,iproc,prefix,head,&
|
||||
& ac,rp,smoother,solver,tprol,&
|
||||
& global_num)
|
||||
|
||||
implicit none
|
||||
|
||||
implicit none
|
||||
class(amg_cprec_type), intent(in) :: prec
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(in), optional :: istart, iend, iproc
|
||||
@@ -742,27 +742,26 @@ contains
|
||||
integer(psb_ipk_) :: iam, np, iproc_
|
||||
character(len=80) :: prefix_
|
||||
character(len=120) :: fname ! len should be at least 20 more than
|
||||
! len of prefix_
|
||||
! len of prefix_
|
||||
|
||||
info = 0
|
||||
ctxt = prec%ctxt
|
||||
call psb_info(ctxt,iam,np)
|
||||
|
||||
iln = size(prec%precv)
|
||||
if (present(istart)) then
|
||||
if (present(istart)) then
|
||||
il1 = max(1,istart)
|
||||
else
|
||||
il1 = min(2,iln)
|
||||
end if
|
||||
if (present(iend)) then
|
||||
if (present(iend)) then
|
||||
iln = min(iln, iend)
|
||||
end if
|
||||
iproc_ = -1
|
||||
if (present(iproc)) then
|
||||
if (present(iproc)) then
|
||||
iproc_ = iproc
|
||||
end if
|
||||
|
||||
if ((iproc_ == -1).or.(iproc_==iam)) then
|
||||
if ((iproc_ == -1).or.(iproc_==iam)) then
|
||||
do lev=il1, iln
|
||||
call prec%precv(lev)%dump(lev,info,prefix=prefix,head=head,&
|
||||
& ac=ac,smoother=smoother,solver=solver,rp=rp,tprol=tprol, &
|
||||
@@ -773,7 +772,7 @@ contains
|
||||
|
||||
subroutine amg_c_cnv(prec,info,amold,vmold,imold)
|
||||
|
||||
implicit none
|
||||
implicit none
|
||||
class(amg_cprec_type), intent(inout) :: prec
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
class(psb_c_base_sparse_mat), intent(in), optional :: amold
|
||||
@@ -781,7 +780,7 @@ contains
|
||||
class(psb_i_base_vect_type), intent(in), optional :: imold
|
||||
|
||||
integer(psb_ipk_) :: i
|
||||
|
||||
|
||||
info = psb_success_
|
||||
if (allocated(prec%precv)) then
|
||||
do i=1,size(prec%precv)
|
||||
@@ -789,24 +788,24 @@ contains
|
||||
& call prec%precv(i)%cnv(info,amold=amold,vmold=vmold,imold=imold)
|
||||
end do
|
||||
end if
|
||||
|
||||
|
||||
end subroutine amg_c_cnv
|
||||
|
||||
subroutine amg_c_clone(prec,precout,info)
|
||||
|
||||
implicit none
|
||||
implicit none
|
||||
class(amg_cprec_type), intent(inout) :: prec
|
||||
class(psb_cprec_type), intent(inout) :: precout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
|
||||
call precout%free(info)
|
||||
if (info == 0) call amg_c_inner_clone(prec,precout,info)
|
||||
if (info == 0) call amg_c_inner_clone(prec,precout,info)
|
||||
|
||||
end subroutine amg_c_clone
|
||||
|
||||
subroutine amg_c_inner_clone(prec,precout,info)
|
||||
|
||||
implicit none
|
||||
implicit none
|
||||
class(amg_cprec_type), intent(inout) :: prec
|
||||
class(psb_cprec_type), target, intent(inout) :: precout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
@@ -821,17 +820,17 @@ contains
|
||||
pout%ctxt = prec%ctxt
|
||||
pout%ag_data = prec%ag_data
|
||||
pout%outer_sweeps = prec%outer_sweeps
|
||||
if (allocated(prec%precv)) then
|
||||
ln = size(prec%precv)
|
||||
if (allocated(prec%precv)) then
|
||||
ln = size(prec%precv)
|
||||
allocate(pout%precv(ln),stat=info)
|
||||
if (info /= psb_success_) goto 9999
|
||||
if (ln >= 1) then
|
||||
if (ln >= 1) then
|
||||
call prec%precv(1)%clone(pout%precv(1),info)
|
||||
end if
|
||||
do lev=2, ln
|
||||
if (info /= psb_success_) exit
|
||||
call prec%precv(lev)%clone(pout%precv(lev),info)
|
||||
if (info == psb_success_) then
|
||||
if (info == psb_success_) then
|
||||
pout%precv(lev)%base_a => pout%precv(lev)%ac
|
||||
pout%precv(lev)%base_desc => pout%precv(lev)%desc_ac
|
||||
pout%precv(lev)%linmap%p_desc_U => pout%precv(lev-1)%base_desc
|
||||
@@ -842,7 +841,7 @@ contains
|
||||
if (allocated(prec%precv(1)%wrk)) &
|
||||
& call pout%allocate_wrk(info,vmold=prec%precv(1)%wrk%vx2l%v)
|
||||
|
||||
class default
|
||||
class default
|
||||
write(0,*) 'Error: wrong out type'
|
||||
info = psb_err_invalid_input_
|
||||
end select
|
||||
@@ -854,14 +853,14 @@ contains
|
||||
implicit none
|
||||
class(amg_cprec_type), intent(inout) :: prec
|
||||
class(amg_cprec_type), intent(inout), target :: b
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_) :: i
|
||||
|
||||
if (same_type_as(prec,b)) then
|
||||
if (allocated(b%precv)) then
|
||||
|
||||
if (same_type_as(prec,b)) then
|
||||
if (allocated(b%precv)) then
|
||||
! This might not be required if FINAL procedures are available.
|
||||
call b%free(info)
|
||||
if (info /= psb_success_) then
|
||||
if (info /= psb_success_) then
|
||||
!?????
|
||||
!!$ return
|
||||
endif
|
||||
@@ -869,7 +868,7 @@ contains
|
||||
b%ctxt = prec%ctxt
|
||||
b%ag_data = prec%ag_data
|
||||
b%outer_sweeps = prec%outer_sweeps
|
||||
|
||||
|
||||
call move_alloc(prec%precv,b%precv)
|
||||
! Fix the pointers except on level 1.
|
||||
do i=2, size(b%precv)
|
||||
@@ -878,7 +877,7 @@ contains
|
||||
b%precv(i)%linmap%p_desc_U => b%precv(i-1)%base_desc
|
||||
b%precv(i)%linmap%p_desc_V => b%precv(i)%base_desc
|
||||
end do
|
||||
|
||||
|
||||
else
|
||||
write(0,*) 'Warning: PREC%move_alloc onto different type?'
|
||||
info = psb_err_internal_error_
|
||||
@@ -888,7 +887,7 @@ contains
|
||||
subroutine amg_c_allocate_wrk(prec,info,vmold,desc)
|
||||
use psb_base_mod
|
||||
implicit none
|
||||
|
||||
|
||||
! Arguments
|
||||
class(amg_cprec_type), intent(inout) :: prec
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
@@ -896,37 +895,37 @@ contains
|
||||
!
|
||||
! In MLD the DESC optional argument is ignored, since
|
||||
! the necessary info is contained in the various entries of the
|
||||
! PRECV component.
|
||||
! PRECV component.
|
||||
type(psb_desc_type), intent(in), optional :: desc
|
||||
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: me,err_act,i,j,level,nlev, nc2l
|
||||
character(len=20) :: name
|
||||
|
||||
|
||||
info=psb_success_
|
||||
name = 'amg_c_allocate_wrk'
|
||||
call psb_erractionsave(err_act)
|
||||
if (psb_errstatus_fatal()) then
|
||||
info = psb_err_internal_error_; goto 9999
|
||||
end if
|
||||
nlev = size(prec%precv)
|
||||
nlev = size(prec%precv)
|
||||
level = 1
|
||||
do level = 1, nlev
|
||||
call prec%precv(level)%allocate_wrk(info,vmold=vmold)
|
||||
if (psb_errstatus_fatal()) then
|
||||
if (psb_errstatus_fatal()) then
|
||||
nc2l = prec%precv(level)%base_desc%get_local_cols()
|
||||
info=psb_err_alloc_request_
|
||||
call psb_errpush(info,name,i_err=(/2*nc2l/), a_err='complex(psb_spk_)')
|
||||
goto 9999
|
||||
goto 9999
|
||||
end if
|
||||
end do
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
|
||||
|
||||
end subroutine amg_c_allocate_wrk
|
||||
|
||||
subroutine amg_c_free_wrk(prec,info)
|
||||
@@ -948,13 +947,13 @@ contains
|
||||
info = psb_err_internal_error_; goto 9999
|
||||
end if
|
||||
|
||||
if (allocated(prec%precv)) then
|
||||
nlev = size(prec%precv)
|
||||
if (allocated(prec%precv)) then
|
||||
nlev = size(prec%precv)
|
||||
do level = 1, nlev
|
||||
call prec%precv(level)%free_wrk(info)
|
||||
end do
|
||||
end if
|
||||
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
@@ -966,7 +965,7 @@ contains
|
||||
function amg_c_is_allocated_wrk(prec) result(res)
|
||||
use psb_base_mod
|
||||
implicit none
|
||||
|
||||
|
||||
! Arguments
|
||||
class(amg_cprec_type), intent(in) :: prec
|
||||
logical :: res
|
||||
@@ -974,7 +973,7 @@ contains
|
||||
res = .false.
|
||||
if (.not.allocated(prec%precv)) return
|
||||
res = allocated(prec%precv(1)%wrk)
|
||||
|
||||
|
||||
end function amg_c_is_allocated_wrk
|
||||
|
||||
end module amg_c_prec_type
|
||||
|
||||
@@ -0,0 +1,321 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_ainv_solver
|
||||
|
||||
use amg_d_base_ainv_mod
|
||||
use psb_base_mod, only : psb_d_vect_type
|
||||
|
||||
type, extends(amg_d_base_ainv_solver_type) :: amg_d_ainv_solver_type
|
||||
!
|
||||
! Compute an approximate factorization
|
||||
! A^-1 = Z D^-1 W^T
|
||||
! Note that here W is going to be transposed explicitly,
|
||||
! so that the component w will in the end contain W^T.
|
||||
!
|
||||
integer(psb_ipk_) :: alg, fill_in
|
||||
real(psb_dpk_) :: thresh
|
||||
contains
|
||||
procedure, pass(sv) :: check => amg_d_ainv_solver_check
|
||||
procedure, pass(sv) :: build => amg_d_ainv_solver_bld
|
||||
procedure, pass(sv) :: clone => amg_d_ainv_solver_clone
|
||||
procedure, pass(sv) :: cseti => amg_d_ainv_solver_cseti
|
||||
procedure, pass(sv) :: csetc => amg_d_ainv_solver_csetc
|
||||
procedure, pass(sv) :: csetr => amg_d_ainv_solver_csetr
|
||||
procedure, pass(sv) :: seti => amg_d_ainv_solver_seti
|
||||
procedure, pass(sv) :: setc => amg_d_ainv_solver_setc
|
||||
procedure, pass(sv) :: setr => amg_d_ainv_solver_setr
|
||||
generic, public :: set => seti, setr, setc
|
||||
procedure, pass(sv) :: descr => amg_d_ainv_solver_descr
|
||||
procedure, pass(sv) :: default => d_ainv_solver_default
|
||||
procedure, nopass :: stringval => d_ainv_stringval
|
||||
procedure, nopass :: algname => d_ainv_algname
|
||||
end type amg_d_ainv_solver_type
|
||||
|
||||
|
||||
private :: d_ainv_stringval, d_ainv_solver_default, &
|
||||
& d_ainv_algname
|
||||
|
||||
interface
|
||||
subroutine amg_d_ainv_solver_clone(sv,svout,info)
|
||||
import :: psb_desc_type, psb_dspmat_type, psb_d_base_sparse_mat, &
|
||||
& amg_d_base_solver_type, psb_dpk_, amg_d_ainv_solver_type, psb_ipk_
|
||||
Implicit None
|
||||
class(amg_d_ainv_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_ainv_solver_clone
|
||||
end interface
|
||||
|
||||
|
||||
interface
|
||||
subroutine amg_d_ainv_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
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_ainv_solver_type, psb_i_base_vect_type, psb_ipk_
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
type(psb_dspmat_type), intent(in), target :: a
|
||||
Type(psb_desc_type), Intent(inout) :: desc_a
|
||||
class(amg_d_ainv_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_ainv_solver_bld
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_ainv_solver_check(sv,info)
|
||||
import :: psb_dpk_, amg_d_ainv_solver_type, psb_ipk_
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_ainv_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_d_ainv_solver_check
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_ainv_solver_cseti(sv,what,val,info,idx)
|
||||
import :: psb_desc_type, psb_dspmat_type, psb_d_base_sparse_mat, psb_ipk_,&
|
||||
& psb_d_vect_type, psb_d_base_vect_type, psb_dpk_, amg_d_ainv_solver_type
|
||||
Implicit None
|
||||
! Arguments
|
||||
class(amg_d_ainv_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
|
||||
end subroutine amg_d_ainv_solver_cseti
|
||||
end interface
|
||||
|
||||
|
||||
interface
|
||||
subroutine amg_d_ainv_solver_csetc(sv,what,val,info,idx)
|
||||
import :: psb_desc_type, psb_dspmat_type, psb_d_base_sparse_mat, psb_ipk_,&
|
||||
& psb_d_vect_type, psb_d_base_vect_type, psb_dpk_, amg_d_ainv_solver_type
|
||||
Implicit None
|
||||
! Arguments
|
||||
class(amg_d_ainv_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
|
||||
end subroutine amg_d_ainv_solver_csetc
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_ainv_solver_csetr(sv,what,val,info,idx)
|
||||
import :: psb_desc_type, psb_dspmat_type, psb_d_base_sparse_mat, psb_ipk_,&
|
||||
& psb_d_vect_type, psb_d_base_vect_type, psb_dpk_, amg_d_ainv_solver_type
|
||||
Implicit None
|
||||
! Arguments
|
||||
class(amg_d_ainv_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
|
||||
end subroutine amg_d_ainv_solver_csetr
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_ainv_solver_setc(sv,what,val,info)
|
||||
import :: amg_d_ainv_solver_type, psb_ipk_
|
||||
Implicit none
|
||||
! Arguments
|
||||
class(amg_d_ainv_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(in) :: what
|
||||
character(len=*), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_d_ainv_solver_setc
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_ainv_solver_seti(sv,what,val,info)
|
||||
import :: amg_d_ainv_solver_type, psb_ipk_
|
||||
Implicit none
|
||||
! Arguments
|
||||
class(amg_d_ainv_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(in) :: what
|
||||
integer(psb_ipk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_d_ainv_solver_seti
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_ainv_solver_setr(sv,what,val,info)
|
||||
import :: amg_d_ainv_solver_type, psb_ipk_, psb_dpk_
|
||||
Implicit none
|
||||
! Arguments
|
||||
class(amg_d_ainv_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(in) :: what
|
||||
real(psb_dpk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_d_ainv_solver_setr
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_ainv_solver_descr(sv,info,iout,coarse)
|
||||
import :: psb_dpk_, amg_d_ainv_solver_type, psb_ipk_
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_ainv_solver_type), intent(in) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(in), optional :: iout
|
||||
logical, intent(in), optional :: coarse
|
||||
|
||||
end subroutine amg_d_ainv_solver_descr
|
||||
end interface
|
||||
|
||||
interface amg_ainv_bld
|
||||
subroutine amg_d_ainv_bld(a,alg,fillin,thresh,wmat,d,zmat,desc,info,blck,iscale)
|
||||
import :: psb_desc_type, psb_dspmat_type, psb_d_base_sparse_mat, &
|
||||
& psb_d_vect_type, psb_d_base_vect_type, psb_dpk_, psb_ipk_
|
||||
implicit none
|
||||
type(psb_dspmat_type), intent(in), target :: a
|
||||
integer(psb_ipk_), intent(in) :: fillin,alg
|
||||
real(psb_dpk_), intent(in) :: thresh
|
||||
type(psb_dspmat_type), intent(inout) :: wmat, zmat
|
||||
real(psb_dpk_), allocatable :: d(:)
|
||||
Type(psb_desc_type), Intent(inout) :: desc
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
type(psb_dspmat_type), intent(in), optional :: blck
|
||||
integer(psb_ipk_), intent(in), optional :: iscale
|
||||
end subroutine amg_d_ainv_bld
|
||||
end interface
|
||||
|
||||
|
||||
contains
|
||||
|
||||
subroutine d_ainv_solver_default(sv)
|
||||
|
||||
use psb_base_mod
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_ainv_solver_type), intent(inout) :: sv
|
||||
|
||||
sv%alg = amg_ainv_llk_
|
||||
sv%fill_in = 0
|
||||
sv%thresh = dzero
|
||||
|
||||
return
|
||||
end subroutine d_ainv_solver_default
|
||||
|
||||
function is_positive_nz_min(ip) result(res)
|
||||
implicit none
|
||||
integer(psb_ipk_), intent(in) :: ip
|
||||
logical :: res
|
||||
|
||||
res = (ip >= 1)
|
||||
return
|
||||
end function is_positive_nz_min
|
||||
|
||||
|
||||
function d_ainv_stringval(string) result(val)
|
||||
use psb_base_mod, only : psb_ipk_,psb_toupper
|
||||
implicit none
|
||||
! Arguments
|
||||
character(len=*), intent(in) :: string
|
||||
integer(psb_ipk_) :: val
|
||||
character(len=*), parameter :: name='d_ainv_stringval'
|
||||
|
||||
select case(psb_toupper(trim(string)))
|
||||
case('LLK')
|
||||
val = amg_ainv_llk_
|
||||
case('STAB-LLK')
|
||||
val = amg_ainv_s_ft_llk_
|
||||
case('SYM-LLK')
|
||||
val = amg_ainv_s_llk_
|
||||
case('MLK')
|
||||
val = amg_ainv_mlk_
|
||||
#if defined(HAVE_TUMA_SAINV)
|
||||
case('SAINV-TUMA')
|
||||
val = amg_ainv_s_tuma_
|
||||
case('LAINV-TUMA')
|
||||
val = amg_ainv_l_tuma_
|
||||
#endif
|
||||
case default
|
||||
val = amg_stringval(string)
|
||||
end select
|
||||
end function d_ainv_stringval
|
||||
|
||||
|
||||
function d_ainv_algname(ialg) result(val)
|
||||
integer(psb_ipk_), intent(in) :: ialg
|
||||
character(len=40) :: val
|
||||
|
||||
character(len=*), parameter :: mlkname = 'Left-looking, list merge '
|
||||
character(len=*), parameter :: llkname = 'Left-looking '
|
||||
character(len=*), parameter :: stabllkname = 'Stabilized Left-looking '
|
||||
character(len=*), parameter :: sllkname = 'Symmetric Left-looking '
|
||||
character(len=*), parameter :: sainvname = 'SAINV (Benzi & Tuma) '
|
||||
character(len=*), parameter :: lainvname = 'LAINV (Benzi & Tuma) '
|
||||
character(len=*), parameter :: defname = 'Unknown alg variant '
|
||||
|
||||
select case (ialg)
|
||||
case(amg_ainv_mlk_)
|
||||
val = mlkname
|
||||
case(amg_ainv_llk_)
|
||||
val = llkname
|
||||
case(amg_ainv_s_llk_)
|
||||
val = sllkname
|
||||
case(amg_ainv_s_ft_llk_)
|
||||
val = stabllkname
|
||||
#if defined(HAVE_TUMA_SAINV)
|
||||
case(amg_ainv_s_tuma_ )
|
||||
val = sainvname
|
||||
case(amg_ainv_l_tuma_ )
|
||||
val = lainvname
|
||||
#endif
|
||||
case default
|
||||
val = defname
|
||||
end select
|
||||
|
||||
end function d_ainv_algname
|
||||
|
||||
end module amg_d_ainv_solver
|
||||
@@ -0,0 +1,199 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_base_ainv_mod
|
||||
|
||||
use amg_base_ainv_mod
|
||||
use amg_d_base_solver_mod
|
||||
use psb_d_ainv_tools_mod
|
||||
use psb_base_mod, only : psb_d_vect_type, psb_dpk_, psb_epk_
|
||||
|
||||
|
||||
|
||||
type, extends(amg_d_base_solver_type) :: amg_d_base_ainv_solver_type
|
||||
!
|
||||
! Compute an approximate factorization
|
||||
! A^-1 = Z D^-1 W^T
|
||||
! Note that here W is going to be transposed explicitly,
|
||||
! so that the component w will in the end contain W^T.
|
||||
!
|
||||
type(psb_dspmat_type) :: w, z
|
||||
type(psb_d_vect_type) :: dv
|
||||
real(psb_dpk_), allocatable :: d(:)
|
||||
|
||||
contains
|
||||
procedure, pass(sv) :: cnv => amg_d_base_ainv_solver_cnv
|
||||
procedure, pass(sv) :: dump => amg_d_base_ainv_solver_dmp
|
||||
procedure, pass(sv) :: apply_v => amg_d_base_ainv_solver_apply_vect
|
||||
procedure, pass(sv) :: apply_a => amg_d_base_ainv_solver_apply
|
||||
procedure, pass(sv) :: free => amg_d_base_ainv_solver_free
|
||||
procedure, pass(sv) :: sizeof => d_base_ainv_solver_sizeof
|
||||
procedure, pass(sv) :: get_nzeros => d_base_ainv_get_nzeros
|
||||
procedure, nopass :: get_wrksz => d_base_ainv_get_wrksize
|
||||
procedure, pass(sv) :: update_a => amg_d_base_ainv_update_a
|
||||
generic, public :: update => update_a
|
||||
end type amg_d_base_ainv_solver_type
|
||||
|
||||
private :: d_base_ainv_solver_sizeof, &
|
||||
& d_base_ainv_get_nzeros, d_base_ainv_get_wrksize
|
||||
|
||||
|
||||
interface
|
||||
subroutine amg_d_base_ainv_solver_cnv(sv,info,amold,vmold,imold)
|
||||
import :: psb_d_base_sparse_mat, psb_d_base_vect_type, psb_dpk_, &
|
||||
& amg_d_base_ainv_solver_type, psb_ipk_, psb_i_base_vect_type
|
||||
Implicit None
|
||||
! Arguments
|
||||
class(amg_d_base_ainv_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_base_ainv_solver_cnv
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_base_ainv_update_a(sv,x,desc_data,info)
|
||||
import :: psb_desc_type, psb_dpk_,amg_d_base_ainv_solver_type, psb_d_vect_type, psb_ipk_
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(amg_d_base_ainv_solver_type), intent(inout) :: sv
|
||||
real(psb_dpk_),intent(in) :: x(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_d_base_ainv_update_a
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_base_ainv_solver_apply(alpha,sv,x,beta,y,desc_data,&
|
||||
& trans,work,info,init,initu)
|
||||
import :: psb_desc_type, psb_dpk_,amg_d_base_ainv_solver_type, psb_ipk_
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(amg_d_base_ainv_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_base_ainv_solver_apply
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_base_ainv_solver_apply_vect(alpha,sv,x,beta,y,desc_data,&
|
||||
& trans,work,wv,info,init,initu)
|
||||
import :: psb_desc_type, psb_dpk_,amg_d_base_ainv_solver_type, psb_d_vect_type, psb_ipk_
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(amg_d_base_ainv_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_base_ainv_solver_apply_vect
|
||||
end interface
|
||||
|
||||
|
||||
interface
|
||||
subroutine amg_d_base_ainv_solver_free(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_base_ainv_solver_type, psb_ipk_
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_base_ainv_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_d_base_ainv_solver_free
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_base_ainv_solver_dmp(sv,desc,level,info,prefix,head,solver,global_num)
|
||||
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_ainv_solver_type, psb_ipk_
|
||||
|
||||
implicit none
|
||||
class(amg_d_base_ainv_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_base_ainv_solver_dmp
|
||||
end interface
|
||||
|
||||
contains
|
||||
|
||||
function d_base_ainv_get_nzeros(sv) result(val)
|
||||
implicit none
|
||||
! Arguments
|
||||
class(amg_d_base_ainv_solver_type), intent(in) :: sv
|
||||
integer(psb_epk_) :: val
|
||||
integer :: i
|
||||
|
||||
val = 0
|
||||
val = val + sv%dv%get_nrows()
|
||||
val = val + sv%w%get_nzeros()
|
||||
val = val + sv%z%get_nzeros()
|
||||
|
||||
return
|
||||
end function d_base_ainv_get_nzeros
|
||||
|
||||
function d_base_ainv_solver_sizeof(sv) result(val)
|
||||
implicit none
|
||||
! Arguments
|
||||
class(amg_d_base_ainv_solver_type), intent(in) :: sv
|
||||
integer(psb_epk_) :: val
|
||||
integer :: i
|
||||
|
||||
val = 2*psb_sizeof_ip + psb_sizeof_dp
|
||||
val = val + sv%dv%sizeof()
|
||||
val = val + sv%w%sizeof()
|
||||
val = val + sv%z%sizeof()
|
||||
|
||||
return
|
||||
end function d_base_ainv_solver_sizeof
|
||||
|
||||
function d_base_ainv_get_wrksize() result(val)
|
||||
implicit none
|
||||
integer(psb_ipk_) :: val
|
||||
|
||||
val = 2
|
||||
end function d_base_ainv_get_wrksize
|
||||
|
||||
end module amg_d_base_ainv_mod
|
||||
@@ -0,0 +1,168 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_invk_solver
|
||||
|
||||
use amg_d_base_solver_mod
|
||||
use amg_d_base_ainv_mod
|
||||
use psb_base_mod, only : psb_d_vect_type
|
||||
|
||||
type, extends(amg_d_base_ainv_solver_type) :: amg_d_invk_solver_type
|
||||
integer(psb_ipk_) :: fill_in, inv_fill
|
||||
contains
|
||||
procedure, pass(sv) :: check => amg_d_invk_solver_check
|
||||
procedure, pass(sv) :: clone => amg_d_invk_solver_clone
|
||||
procedure, pass(sv) :: build => amg_d_invk_solver_bld
|
||||
procedure, pass(sv) :: cseti => amg_d_invk_solver_cseti
|
||||
procedure, pass(sv) :: seti => amg_d_invk_solver_seti
|
||||
generic, public :: set => seti
|
||||
procedure, pass(sv) :: descr => amg_d_invk_solver_descr
|
||||
procedure, pass(sv) :: default => d_invk_solver_default
|
||||
end type amg_d_invk_solver_type
|
||||
|
||||
|
||||
private :: d_invk_solver_default
|
||||
|
||||
|
||||
interface
|
||||
subroutine amg_d_invk_solver_clone(sv,svout,info)
|
||||
import :: psb_desc_type, psb_dspmat_type, psb_d_base_sparse_mat, &
|
||||
& amg_d_base_solver_type, psb_dpk_, amg_d_invk_solver_type, psb_ipk_
|
||||
Implicit None
|
||||
class(amg_d_invk_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_invk_solver_clone
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_invk_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
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_invk_solver_type, psb_i_base_vect_type, psb_ipk_
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
type(psb_dspmat_type), intent(in), target :: a
|
||||
Type(psb_desc_type), Intent(inout) :: desc_a
|
||||
class(amg_d_invk_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_invk_solver_bld
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_invk_solver_check(sv,info)
|
||||
import :: psb_dpk_, amg_d_invk_solver_type, psb_ipk_
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_invk_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_d_invk_solver_check
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_invk_solver_cseti(sv,what,val,info,idx)
|
||||
import :: psb_desc_type, psb_dspmat_type, psb_d_base_sparse_mat, &
|
||||
& psb_ipk_, psb_d_vect_type, psb_d_base_vect_type, psb_dpk_, &
|
||||
& amg_d_invk_solver_type
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_invk_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
|
||||
end subroutine amg_d_invk_solver_cseti
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_invk_solver_descr(sv,info,iout,coarse)
|
||||
import :: psb_dpk_, amg_d_invk_solver_type, psb_ipk_
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_invk_solver_type), intent(in) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(in), optional :: iout
|
||||
logical, intent(in), optional :: coarse
|
||||
|
||||
end subroutine amg_d_invk_solver_descr
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_invk_solver_seti(sv,what,val,info)
|
||||
import :: amg_d_invk_solver_type, psb_ipk_
|
||||
Implicit none
|
||||
! Arguments
|
||||
class(amg_d_invk_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(in) :: what
|
||||
integer(psb_ipk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_d_invk_solver_seti
|
||||
end interface
|
||||
|
||||
contains
|
||||
|
||||
subroutine d_invk_solver_default(sv)
|
||||
|
||||
!use psb_base_mod
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_invk_solver_type), intent(inout) :: sv
|
||||
|
||||
sv%fill_in = 0
|
||||
sv%inv_fill = 0
|
||||
|
||||
return
|
||||
end subroutine d_invk_solver_default
|
||||
|
||||
end module amg_d_invk_solver
|
||||
@@ -0,0 +1,194 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_invt_solver
|
||||
|
||||
use amg_d_base_solver_mod
|
||||
use amg_d_base_ainv_mod
|
||||
use psb_base_mod, only : psb_d_vect_type
|
||||
|
||||
type, extends(amg_d_base_ainv_solver_type) :: amg_d_invt_solver_type
|
||||
integer(psb_ipk_) :: fill_in, inv_fill
|
||||
real(psb_dpk_) :: thresh, inv_thresh
|
||||
contains
|
||||
procedure, pass(sv) :: check => amg_d_invt_solver_check
|
||||
procedure, pass(sv) :: clone => amg_d_invt_solver_clone
|
||||
procedure, pass(sv) :: build => amg_d_invt_solver_bld
|
||||
procedure, pass(sv) :: cseti => amg_d_invt_solver_cseti
|
||||
procedure, pass(sv) :: csetr => amg_d_invt_solver_csetr
|
||||
procedure, pass(sv) :: seti => amg_d_invt_solver_seti
|
||||
procedure, pass(sv) :: setr => amg_d_invt_solver_setr
|
||||
generic, public :: set => seti, setr
|
||||
procedure, pass(sv) :: descr => amg_d_invt_solver_descr
|
||||
procedure, pass(sv) :: default => d_invt_solver_default
|
||||
end type amg_d_invt_solver_type
|
||||
|
||||
private :: d_invt_solver_default
|
||||
|
||||
|
||||
interface
|
||||
subroutine amg_d_invt_solver_clone(sv,svout,info)
|
||||
import :: psb_desc_type, psb_dspmat_type, psb_d_base_sparse_mat, &
|
||||
& amg_d_base_solver_type, psb_dpk_, amg_d_invt_solver_type, psb_ipk_
|
||||
Implicit None
|
||||
class(amg_d_invt_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_invt_solver_clone
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_invt_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
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_invt_solver_type, psb_i_base_vect_type, psb_ipk_
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
type(psb_dspmat_type), intent(in), target :: a
|
||||
Type(psb_desc_type), Intent(inout) :: desc_a
|
||||
class(amg_d_invt_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_invt_solver_bld
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_invt_solver_check(sv,info)
|
||||
import :: amg_d_invt_solver_type, psb_ipk_
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_invt_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_d_invt_solver_check
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_invt_solver_cseti(sv,what,val,info,idx)
|
||||
import :: psb_desc_type, psb_dspmat_type, psb_d_base_sparse_mat, psb_ipk_,&
|
||||
& psb_d_vect_type, psb_d_base_vect_type, psb_dpk_, amg_d_invt_solver_type
|
||||
Implicit None
|
||||
! Arguments
|
||||
class(amg_d_invt_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
|
||||
end subroutine amg_d_invt_solver_cseti
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_invt_solver_csetr(sv,what,val,info,idx)
|
||||
import :: psb_desc_type, psb_dspmat_type, psb_d_base_sparse_mat, psb_ipk_,&
|
||||
& psb_d_vect_type, psb_d_base_vect_type, psb_dpk_, amg_d_invt_solver_type
|
||||
Implicit None
|
||||
! Arguments
|
||||
class(amg_d_invt_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
|
||||
end subroutine amg_d_invt_solver_csetr
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_invt_solver_descr(sv,info,iout,coarse)
|
||||
import :: psb_dpk_, amg_d_invt_solver_type, psb_ipk_
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_invt_solver_type), intent(in) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(in), optional :: iout
|
||||
logical, intent(in), optional :: coarse
|
||||
|
||||
end subroutine amg_d_invt_solver_descr
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_invt_solver_setr(sv,what,val,info)
|
||||
import :: amg_d_invt_solver_type, psb_dpk_, psb_ipk_
|
||||
Implicit none
|
||||
! Arguments
|
||||
class(amg_d_invt_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(in) :: what
|
||||
real(psb_dpk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_d_invt_solver_setr
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_d_invt_solver_seti(sv,what,val,info)
|
||||
import :: amg_d_invt_solver_type, psb_ipk_
|
||||
Implicit none
|
||||
! Arguments
|
||||
class(amg_d_invt_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(in) :: what
|
||||
integer(psb_ipk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine
|
||||
end interface
|
||||
|
||||
contains
|
||||
|
||||
subroutine d_invt_solver_default(sv)
|
||||
|
||||
!use psb_base_mod
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_invt_solver_type), intent(inout) :: sv
|
||||
|
||||
sv%fill_in = 0
|
||||
sv%inv_fill = 0
|
||||
sv%thresh = dzero
|
||||
sv%inv_thresh = dzero
|
||||
|
||||
return
|
||||
end subroutine d_invt_solver_default
|
||||
|
||||
end module amg_d_invt_solver
|
||||
+19
-16
@@ -1,15 +1,15 @@
|
||||
!
|
||||
!
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! 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:
|
||||
@@ -21,7 +21,7 @@
|
||||
! 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
|
||||
@@ -33,8 +33,8 @@
|
||||
! 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_prec_mod.f90
|
||||
!
|
||||
! Module: amg_d_prec_mod
|
||||
@@ -52,6 +52,9 @@ module amg_d_prec_mod
|
||||
use amg_d_l1_diag_solver
|
||||
use amg_d_ilu_solver
|
||||
use amg_d_gs_solver
|
||||
use amg_d_ainv_solver
|
||||
use amg_d_invk_solver
|
||||
use amg_d_invt_solver
|
||||
|
||||
interface amg_precset
|
||||
module procedure amg_d_iprecsetsm, amg_d_iprecsetsv, &
|
||||
@@ -78,7 +81,7 @@ module amg_d_prec_mod
|
||||
! !$ character, intent(in), optional :: upd
|
||||
end subroutine amg_d_extprol_bld
|
||||
end interface amg_extprol_bld
|
||||
|
||||
|
||||
contains
|
||||
|
||||
subroutine amg_d_iprecsetsm(p,val,info,pos)
|
||||
@@ -108,7 +111,7 @@ contains
|
||||
|
||||
subroutine amg_d_cprecseti(p,what,val,info,pos)
|
||||
type(amg_dprec_type), intent(inout) :: p
|
||||
character(len=*), intent(in) :: what
|
||||
character(len=*), intent(in) :: what
|
||||
integer(psb_ipk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
character(len=*), optional, intent(in) :: pos
|
||||
@@ -118,7 +121,7 @@ contains
|
||||
|
||||
subroutine amg_d_cprecsetr(p,what,val,info,pos)
|
||||
type(amg_dprec_type), intent(inout) :: p
|
||||
character(len=*), intent(in) :: what
|
||||
character(len=*), intent(in) :: what
|
||||
real(psb_dpk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
character(len=*), optional, intent(in) :: pos
|
||||
@@ -128,7 +131,7 @@ contains
|
||||
|
||||
subroutine amg_d_cprecsetc(p,what,val,info,pos)
|
||||
type(amg_dprec_type), intent(inout) :: p
|
||||
character(len=*), intent(in) :: what
|
||||
character(len=*), intent(in) :: what
|
||||
character(len=*), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
character(len=*), optional, intent(in) :: pos
|
||||
|
||||
+144
-145
@@ -1,15 +1,15 @@
|
||||
!
|
||||
!
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! 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:
|
||||
@@ -21,7 +21,7 @@
|
||||
! 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
|
||||
@@ -33,21 +33,21 @@
|
||||
! 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_prec_type.f90
|
||||
!
|
||||
! Module: amg_d_prec_type
|
||||
!
|
||||
! This module defines:
|
||||
! This module defines:
|
||||
! - the amg_d_prec_type data structure containing the preconditioner and related
|
||||
! data structures;
|
||||
!
|
||||
! It contains routines for
|
||||
! - Building and applying;
|
||||
! - Building and applying;
|
||||
! - checking if the preconditioner is correctly defined;
|
||||
! - printing a description of the preconditioner;
|
||||
! - deallocating the preconditioner data structure.
|
||||
! - deallocating the preconditioner data structure.
|
||||
!
|
||||
|
||||
module amg_d_prec_type
|
||||
@@ -70,25 +70,25 @@ module amg_d_prec_type
|
||||
! It consists of an array of 'one-level' intermediate data structures
|
||||
! of type amg_donelev_type, each containing the information needed to apply
|
||||
! the smoothing and the coarse-space correction at a generic level. RT is the
|
||||
! real data type, i.e. S for both S and C, and D for both D and Z.
|
||||
! real data type, i.e. S for both S and C, and D for both D and Z.
|
||||
!
|
||||
! type amg_dprec_type
|
||||
! type(amg_donelev_type), allocatable :: precv(:)
|
||||
! type(amg_donelev_type), allocatable :: precv(:)
|
||||
! end type amg_dprec_type
|
||||
!
|
||||
!
|
||||
! Note that the levels are numbered in increasing order starting from
|
||||
! the level 1 as the finest one, and the number of levels is given by
|
||||
! size(precv(:)) which is the id of the coarsest level.
|
||||
! size(precv(:)) which is the id of the coarsest level.
|
||||
! In the multigrid literature many authors number the levels in the opposite
|
||||
! order, with level 0 being the id of the coarsest level.
|
||||
!
|
||||
!
|
||||
integer, parameter, private :: wv_size_=4
|
||||
|
||||
|
||||
type, extends(psb_dprec_type) :: amg_dprec_type
|
||||
type(amg_daggr_data) :: ag_data
|
||||
!
|
||||
! Number of outer sweeps. Sometimes 2 V-cycles may be better than 1 W-cycle.
|
||||
! Number of outer sweeps. Sometimes 2 V-cycles may be better than 1 W-cycle.
|
||||
!
|
||||
integer(psb_ipk_) :: outer_sweeps = 1
|
||||
!
|
||||
@@ -97,11 +97,11 @@ module amg_d_prec_type
|
||||
! to keep track against what is put later in the multilevel array
|
||||
!
|
||||
integer(psb_ipk_) :: coarse_solver = -1
|
||||
|
||||
|
||||
!
|
||||
! The multilevel hierarchy
|
||||
!
|
||||
type(amg_d_onelev_type), allocatable :: precv(:)
|
||||
type(amg_d_onelev_type), allocatable :: precv(:)
|
||||
contains
|
||||
procedure, pass(prec) :: psb_d_apply2_vect => amg_d_apply2_vect
|
||||
procedure, pass(prec) :: psb_d_apply1_vect => amg_d_apply1_vect
|
||||
@@ -157,7 +157,7 @@ module amg_d_prec_type
|
||||
interface amg_precdescr
|
||||
subroutine amg_dfile_prec_descr(prec,iout,root)
|
||||
import :: amg_dprec_type, psb_ipk_
|
||||
implicit none
|
||||
implicit none
|
||||
! Arguments
|
||||
class(amg_dprec_type), intent(in) :: prec
|
||||
integer(psb_ipk_), intent(in), optional :: iout
|
||||
@@ -211,7 +211,7 @@ module amg_d_prec_type
|
||||
end subroutine amg_dprecaply1
|
||||
end interface
|
||||
|
||||
interface
|
||||
interface
|
||||
subroutine amg_dprecsetsm(prec,val,info,ilev,ilmax,pos)
|
||||
import :: psb_dspmat_type, psb_desc_type, psb_dpk_, &
|
||||
& amg_dprec_type, amg_d_base_smoother_type, psb_ipk_
|
||||
@@ -243,7 +243,7 @@ module amg_d_prec_type
|
||||
import :: psb_dspmat_type, psb_desc_type, psb_dpk_, &
|
||||
& amg_dprec_type, psb_ipk_
|
||||
class(amg_dprec_type), intent(inout) :: prec
|
||||
character(len=*), intent(in) :: what
|
||||
character(len=*), intent(in) :: what
|
||||
integer(psb_ipk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: ilev,ilmax,idx
|
||||
@@ -253,7 +253,7 @@ module amg_d_prec_type
|
||||
import :: psb_dspmat_type, psb_desc_type, psb_dpk_, &
|
||||
& amg_dprec_type, psb_ipk_
|
||||
class(amg_dprec_type), intent(inout) :: prec
|
||||
character(len=*), intent(in) :: what
|
||||
character(len=*), intent(in) :: what
|
||||
real(psb_dpk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: ilev,ilmax,idx
|
||||
@@ -263,7 +263,7 @@ module amg_d_prec_type
|
||||
import :: psb_dspmat_type, psb_desc_type, psb_dpk_, &
|
||||
& amg_dprec_type, psb_ipk_
|
||||
class(amg_dprec_type), intent(inout) :: prec
|
||||
character(len=*), intent(in) :: what
|
||||
character(len=*), intent(in) :: what
|
||||
character(len=*), intent(in) :: string
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: ilev,ilmax,idx
|
||||
@@ -341,28 +341,28 @@ module amg_d_prec_type
|
||||
! character, intent(in),optional :: upd
|
||||
end subroutine amg_d_smoothers_bld
|
||||
end interface amg_smoothers_bld
|
||||
|
||||
|
||||
contains
|
||||
!
|
||||
! Function returning a pointer to the smoother
|
||||
!
|
||||
function amg_d_get_smootherp(prec,ilev) result(val)
|
||||
implicit none
|
||||
implicit none
|
||||
class(amg_dprec_type), target, intent(in) :: prec
|
||||
integer(psb_ipk_), optional :: ilev
|
||||
class(amg_d_base_smoother_type), pointer :: val
|
||||
integer(psb_ipk_) :: ilev_
|
||||
|
||||
|
||||
val => null()
|
||||
if (present(ilev)) then
|
||||
if (present(ilev)) then
|
||||
ilev_ = ilev
|
||||
else
|
||||
! What is a good default?
|
||||
! What is a good default?
|
||||
ilev_ = 1
|
||||
end if
|
||||
if (allocated(prec%precv)) then
|
||||
if ((1<=ilev_).and.(ilev_<=size(prec%precv))) then
|
||||
if (allocated(prec%precv(ilev_)%sm)) then
|
||||
if (allocated(prec%precv)) then
|
||||
if ((1<=ilev_).and.(ilev_<=size(prec%precv))) then
|
||||
if (allocated(prec%precv(ilev_)%sm)) then
|
||||
val => prec%precv(ilev_)%sm
|
||||
end if
|
||||
end if
|
||||
@@ -372,23 +372,23 @@ contains
|
||||
! Function returning a pointer to the solver
|
||||
!
|
||||
function amg_d_get_solverp(prec,ilev) result(val)
|
||||
implicit none
|
||||
implicit none
|
||||
class(amg_dprec_type), target, intent(in) :: prec
|
||||
integer(psb_ipk_), optional :: ilev
|
||||
class(amg_d_base_solver_type), pointer :: val
|
||||
integer(psb_ipk_) :: ilev_
|
||||
|
||||
|
||||
val => null()
|
||||
if (present(ilev)) then
|
||||
if (present(ilev)) then
|
||||
ilev_ = ilev
|
||||
else
|
||||
! What is a good default?
|
||||
! What is a good default?
|
||||
ilev_ = 1
|
||||
end if
|
||||
if (allocated(prec%precv)) then
|
||||
if ((1<=ilev_).and.(ilev_<=size(prec%precv))) then
|
||||
if (allocated(prec%precv(ilev_)%sm)) then
|
||||
if (allocated(prec%precv(ilev_)%sm%sv)) then
|
||||
if (allocated(prec%precv)) then
|
||||
if ((1<=ilev_).and.(ilev_<=size(prec%precv))) then
|
||||
if (allocated(prec%precv(ilev_)%sm)) then
|
||||
if (allocated(prec%precv(ilev_)%sm%sv)) then
|
||||
val => prec%precv(ilev_)%sm%sv
|
||||
end if
|
||||
end if
|
||||
@@ -399,25 +399,25 @@ contains
|
||||
! Function returning the size of the precv(:) array
|
||||
!
|
||||
function amg_d_get_nlevs(prec) result(val)
|
||||
implicit none
|
||||
implicit none
|
||||
class(amg_dprec_type), intent(in) :: prec
|
||||
integer(psb_ipk_) :: val
|
||||
val = 0
|
||||
if (allocated(prec%precv)) then
|
||||
if (allocated(prec%precv)) then
|
||||
val = size(prec%precv)
|
||||
end if
|
||||
end function amg_d_get_nlevs
|
||||
!
|
||||
! Function returning the size of the amg_prec_type data structure
|
||||
! in bytes or in number of nonzeros of the operator(s) involved.
|
||||
! in bytes or in number of nonzeros of the operator(s) involved.
|
||||
!
|
||||
function amg_d_get_nzeros(prec) result(val)
|
||||
implicit none
|
||||
implicit none
|
||||
class(amg_dprec_type), intent(in) :: prec
|
||||
integer(psb_epk_) :: val
|
||||
integer(psb_ipk_) :: i
|
||||
val = 0
|
||||
if (allocated(prec%precv)) then
|
||||
if (allocated(prec%precv)) then
|
||||
do i=1, size(prec%precv)
|
||||
val = val + prec%precv(i)%get_nzeros()
|
||||
end do
|
||||
@@ -425,13 +425,13 @@ contains
|
||||
end function amg_d_get_nzeros
|
||||
|
||||
function amg_dprec_sizeof(prec) result(val)
|
||||
implicit none
|
||||
implicit none
|
||||
class(amg_dprec_type), intent(in) :: prec
|
||||
integer(psb_epk_) :: val
|
||||
integer(psb_ipk_) :: i
|
||||
val = 0
|
||||
val = val + psb_sizeof_ip
|
||||
if (allocated(prec%precv)) then
|
||||
if (allocated(prec%precv)) then
|
||||
do i=1, size(prec%precv)
|
||||
val = val + prec%precv(i)%sizeof()
|
||||
end do
|
||||
@@ -444,40 +444,40 @@ contains
|
||||
! various level to the nonzeroes at the fine level
|
||||
! (original matrix)
|
||||
!
|
||||
|
||||
|
||||
function amg_d_get_compl(prec) result(val)
|
||||
implicit none
|
||||
implicit none
|
||||
class(amg_dprec_type), intent(in) :: prec
|
||||
real(psb_dpk_) :: val
|
||||
|
||||
|
||||
val = prec%ag_data%op_complexity
|
||||
|
||||
end function amg_d_get_compl
|
||||
|
||||
subroutine amg_d_cmp_compl(prec)
|
||||
|
||||
implicit none
|
||||
subroutine amg_d_cmp_compl(prec)
|
||||
|
||||
implicit none
|
||||
class(amg_dprec_type), intent(inout) :: prec
|
||||
|
||||
|
||||
real(psb_dpk_) :: num, den, nmin
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: il
|
||||
integer(psb_ipk_) :: il
|
||||
|
||||
num = -done
|
||||
den = done
|
||||
ctxt = prec%ctxt
|
||||
if (allocated(prec%precv)) then
|
||||
if (allocated(prec%precv)) then
|
||||
il = 1
|
||||
num = prec%precv(il)%base_a%get_nzeros()
|
||||
if (num >= dzero) then
|
||||
den = num
|
||||
den = num
|
||||
do il=2,size(prec%precv)
|
||||
num = num + max(0,prec%precv(il)%base_a%get_nzeros())
|
||||
end do
|
||||
end if
|
||||
end if
|
||||
nmin = num
|
||||
call psb_min(ctxt,nmin)
|
||||
call psb_min(ctxt,nmin)
|
||||
if (nmin < dzero) then
|
||||
num = dzero
|
||||
den = done
|
||||
@@ -487,25 +487,25 @@ contains
|
||||
end if
|
||||
prec%ag_data%op_complexity = num/den
|
||||
end subroutine amg_d_cmp_compl
|
||||
|
||||
|
||||
!
|
||||
! Average coarsening ratio
|
||||
!
|
||||
|
||||
|
||||
function amg_d_get_avg_cr(prec) result(val)
|
||||
implicit none
|
||||
implicit none
|
||||
class(amg_dprec_type), intent(in) :: prec
|
||||
real(psb_dpk_) :: val
|
||||
|
||||
|
||||
val = prec%ag_data%avg_cr
|
||||
|
||||
end function amg_d_get_avg_cr
|
||||
|
||||
subroutine amg_d_cmp_avg_cr(prec)
|
||||
|
||||
implicit none
|
||||
subroutine amg_d_cmp_avg_cr(prec)
|
||||
|
||||
implicit none
|
||||
class(amg_dprec_type), intent(inout) :: prec
|
||||
|
||||
|
||||
real(psb_dpk_) :: avgcr
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: il, nl, iam, np
|
||||
@@ -519,12 +519,12 @@ contains
|
||||
do il=2,nl
|
||||
avgcr = avgcr + max(dzero,prec%precv(il)%szratio)
|
||||
end do
|
||||
avgcr = avgcr / (nl-1)
|
||||
avgcr = avgcr / (nl-1)
|
||||
end if
|
||||
call psb_sum(ctxt,avgcr)
|
||||
call psb_sum(ctxt,avgcr)
|
||||
prec%ag_data%avg_cr = avgcr/np
|
||||
end subroutine amg_d_cmp_avg_cr
|
||||
|
||||
|
||||
!
|
||||
! Subroutines: amg_Tprec_free
|
||||
! Version: real
|
||||
@@ -538,74 +538,74 @@ contains
|
||||
! error code.
|
||||
!
|
||||
subroutine amg_dprecfree(p,info)
|
||||
|
||||
|
||||
implicit none
|
||||
|
||||
|
||||
! Arguments
|
||||
type(amg_dprec_type), intent(inout) :: p
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: me,err_act,i
|
||||
character(len=20) :: name
|
||||
|
||||
|
||||
info=psb_success_
|
||||
name = 'amg_dprecfree'
|
||||
call psb_erractionsave(err_act)
|
||||
if (psb_errstatus_fatal()) then
|
||||
info = psb_err_internal_error_; return
|
||||
end if
|
||||
|
||||
|
||||
me=-1
|
||||
|
||||
|
||||
call p%free(info)
|
||||
|
||||
|
||||
|
||||
return
|
||||
|
||||
|
||||
end subroutine amg_dprecfree
|
||||
|
||||
subroutine amg_d_prec_free(prec,info)
|
||||
|
||||
|
||||
implicit none
|
||||
|
||||
|
||||
! Arguments
|
||||
class(amg_dprec_type), intent(inout) :: prec
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: me,err_act,i
|
||||
character(len=20) :: name
|
||||
|
||||
|
||||
info=psb_success_
|
||||
name = 'amg_dprecfree'
|
||||
call psb_erractionsave(err_act)
|
||||
if (psb_errstatus_fatal()) then
|
||||
info = psb_err_internal_error_; goto 9999
|
||||
end if
|
||||
|
||||
|
||||
me=-1
|
||||
if (allocated(prec%precv)) then
|
||||
do i=1,size(prec%precv)
|
||||
if (allocated(prec%precv)) then
|
||||
do i=1,size(prec%precv)
|
||||
call prec%precv(i)%free(info)
|
||||
end do
|
||||
deallocate(prec%precv,stat=info)
|
||||
end if
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
|
||||
|
||||
end subroutine amg_d_prec_free
|
||||
|
||||
|
||||
|
||||
|
||||
!
|
||||
! Top level methods.
|
||||
! Top level methods.
|
||||
!
|
||||
subroutine amg_d_apply2_vect(prec,x,y,desc_data,info,trans,work)
|
||||
implicit none
|
||||
implicit none
|
||||
type(psb_desc_type),intent(in) :: desc_data
|
||||
class(amg_dprec_type), intent(inout) :: prec
|
||||
type(psb_d_vect_type),intent(inout) :: x
|
||||
@@ -618,13 +618,13 @@ contains
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select type(prec)
|
||||
select type(prec)
|
||||
type is (amg_dprec_type)
|
||||
call amg_precapply(prec,x,y,desc_data,info,trans,work)
|
||||
class default
|
||||
info = psb_err_missing_override_method_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
@@ -636,7 +636,7 @@ contains
|
||||
end subroutine amg_d_apply2_vect
|
||||
|
||||
subroutine amg_d_apply1_vect(prec,x,desc_data,info,trans,work)
|
||||
implicit none
|
||||
implicit none
|
||||
type(psb_desc_type),intent(in) :: desc_data
|
||||
class(amg_dprec_type), intent(inout) :: prec
|
||||
type(psb_d_vect_type),intent(inout) :: x
|
||||
@@ -648,13 +648,13 @@ contains
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select type(prec)
|
||||
select type(prec)
|
||||
type is (amg_dprec_type)
|
||||
call amg_precapply(prec,x,desc_data,info,trans,work)
|
||||
class default
|
||||
info = psb_err_missing_override_method_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
@@ -667,7 +667,7 @@ contains
|
||||
|
||||
|
||||
subroutine amg_d_apply2v(prec,x,y,desc_data,info,trans,work)
|
||||
implicit none
|
||||
implicit none
|
||||
type(psb_desc_type),intent(in) :: desc_data
|
||||
class(amg_dprec_type), intent(inout) :: prec
|
||||
real(psb_dpk_),intent(inout) :: x(:)
|
||||
@@ -680,13 +680,13 @@ contains
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select type(prec)
|
||||
select type(prec)
|
||||
type is (amg_dprec_type)
|
||||
call amg_precapply(prec,x,y,desc_data,info,trans,work)
|
||||
class default
|
||||
info = psb_err_missing_override_method_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
@@ -698,7 +698,7 @@ contains
|
||||
end subroutine amg_d_apply2v
|
||||
|
||||
subroutine amg_d_apply1v(prec,x,desc_data,info,trans)
|
||||
implicit none
|
||||
implicit none
|
||||
type(psb_desc_type),intent(in) :: desc_data
|
||||
class(amg_dprec_type), intent(inout) :: prec
|
||||
real(psb_dpk_),intent(inout) :: x(:)
|
||||
@@ -709,13 +709,13 @@ contains
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select type(prec)
|
||||
select type(prec)
|
||||
type is (amg_dprec_type)
|
||||
call amg_precapply(prec,x,desc_data,info,trans)
|
||||
class default
|
||||
info = psb_err_missing_override_method_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
@@ -730,8 +730,8 @@ contains
|
||||
subroutine amg_d_dump(prec,info,istart,iend,iproc,prefix,head,&
|
||||
& ac,rp,smoother,solver,tprol,&
|
||||
& global_num)
|
||||
|
||||
implicit none
|
||||
|
||||
implicit none
|
||||
class(amg_dprec_type), intent(in) :: prec
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(in), optional :: istart, iend, iproc
|
||||
@@ -742,27 +742,26 @@ contains
|
||||
integer(psb_ipk_) :: iam, np, iproc_
|
||||
character(len=80) :: prefix_
|
||||
character(len=120) :: fname ! len should be at least 20 more than
|
||||
! len of prefix_
|
||||
! len of prefix_
|
||||
|
||||
info = 0
|
||||
ctxt = prec%ctxt
|
||||
call psb_info(ctxt,iam,np)
|
||||
|
||||
iln = size(prec%precv)
|
||||
if (present(istart)) then
|
||||
if (present(istart)) then
|
||||
il1 = max(1,istart)
|
||||
else
|
||||
il1 = min(2,iln)
|
||||
end if
|
||||
if (present(iend)) then
|
||||
if (present(iend)) then
|
||||
iln = min(iln, iend)
|
||||
end if
|
||||
iproc_ = -1
|
||||
if (present(iproc)) then
|
||||
if (present(iproc)) then
|
||||
iproc_ = iproc
|
||||
end if
|
||||
|
||||
if ((iproc_ == -1).or.(iproc_==iam)) then
|
||||
if ((iproc_ == -1).or.(iproc_==iam)) then
|
||||
do lev=il1, iln
|
||||
call prec%precv(lev)%dump(lev,info,prefix=prefix,head=head,&
|
||||
& ac=ac,smoother=smoother,solver=solver,rp=rp,tprol=tprol, &
|
||||
@@ -773,7 +772,7 @@ contains
|
||||
|
||||
subroutine amg_d_cnv(prec,info,amold,vmold,imold)
|
||||
|
||||
implicit none
|
||||
implicit none
|
||||
class(amg_dprec_type), intent(inout) :: prec
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
class(psb_d_base_sparse_mat), intent(in), optional :: amold
|
||||
@@ -781,7 +780,7 @@ contains
|
||||
class(psb_i_base_vect_type), intent(in), optional :: imold
|
||||
|
||||
integer(psb_ipk_) :: i
|
||||
|
||||
|
||||
info = psb_success_
|
||||
if (allocated(prec%precv)) then
|
||||
do i=1,size(prec%precv)
|
||||
@@ -789,24 +788,24 @@ contains
|
||||
& call prec%precv(i)%cnv(info,amold=amold,vmold=vmold,imold=imold)
|
||||
end do
|
||||
end if
|
||||
|
||||
|
||||
end subroutine amg_d_cnv
|
||||
|
||||
subroutine amg_d_clone(prec,precout,info)
|
||||
|
||||
implicit none
|
||||
implicit none
|
||||
class(amg_dprec_type), intent(inout) :: prec
|
||||
class(psb_dprec_type), intent(inout) :: precout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
|
||||
call precout%free(info)
|
||||
if (info == 0) call amg_d_inner_clone(prec,precout,info)
|
||||
if (info == 0) call amg_d_inner_clone(prec,precout,info)
|
||||
|
||||
end subroutine amg_d_clone
|
||||
|
||||
subroutine amg_d_inner_clone(prec,precout,info)
|
||||
|
||||
implicit none
|
||||
implicit none
|
||||
class(amg_dprec_type), intent(inout) :: prec
|
||||
class(psb_dprec_type), target, intent(inout) :: precout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
@@ -821,17 +820,17 @@ contains
|
||||
pout%ctxt = prec%ctxt
|
||||
pout%ag_data = prec%ag_data
|
||||
pout%outer_sweeps = prec%outer_sweeps
|
||||
if (allocated(prec%precv)) then
|
||||
ln = size(prec%precv)
|
||||
if (allocated(prec%precv)) then
|
||||
ln = size(prec%precv)
|
||||
allocate(pout%precv(ln),stat=info)
|
||||
if (info /= psb_success_) goto 9999
|
||||
if (ln >= 1) then
|
||||
if (ln >= 1) then
|
||||
call prec%precv(1)%clone(pout%precv(1),info)
|
||||
end if
|
||||
do lev=2, ln
|
||||
if (info /= psb_success_) exit
|
||||
call prec%precv(lev)%clone(pout%precv(lev),info)
|
||||
if (info == psb_success_) then
|
||||
if (info == psb_success_) then
|
||||
pout%precv(lev)%base_a => pout%precv(lev)%ac
|
||||
pout%precv(lev)%base_desc => pout%precv(lev)%desc_ac
|
||||
pout%precv(lev)%linmap%p_desc_U => pout%precv(lev-1)%base_desc
|
||||
@@ -842,7 +841,7 @@ contains
|
||||
if (allocated(prec%precv(1)%wrk)) &
|
||||
& call pout%allocate_wrk(info,vmold=prec%precv(1)%wrk%vx2l%v)
|
||||
|
||||
class default
|
||||
class default
|
||||
write(0,*) 'Error: wrong out type'
|
||||
info = psb_err_invalid_input_
|
||||
end select
|
||||
@@ -854,14 +853,14 @@ contains
|
||||
implicit none
|
||||
class(amg_dprec_type), intent(inout) :: prec
|
||||
class(amg_dprec_type), intent(inout), target :: b
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_) :: i
|
||||
|
||||
if (same_type_as(prec,b)) then
|
||||
if (allocated(b%precv)) then
|
||||
|
||||
if (same_type_as(prec,b)) then
|
||||
if (allocated(b%precv)) then
|
||||
! This might not be required if FINAL procedures are available.
|
||||
call b%free(info)
|
||||
if (info /= psb_success_) then
|
||||
if (info /= psb_success_) then
|
||||
!?????
|
||||
!!$ return
|
||||
endif
|
||||
@@ -869,7 +868,7 @@ contains
|
||||
b%ctxt = prec%ctxt
|
||||
b%ag_data = prec%ag_data
|
||||
b%outer_sweeps = prec%outer_sweeps
|
||||
|
||||
|
||||
call move_alloc(prec%precv,b%precv)
|
||||
! Fix the pointers except on level 1.
|
||||
do i=2, size(b%precv)
|
||||
@@ -878,7 +877,7 @@ contains
|
||||
b%precv(i)%linmap%p_desc_U => b%precv(i-1)%base_desc
|
||||
b%precv(i)%linmap%p_desc_V => b%precv(i)%base_desc
|
||||
end do
|
||||
|
||||
|
||||
else
|
||||
write(0,*) 'Warning: PREC%move_alloc onto different type?'
|
||||
info = psb_err_internal_error_
|
||||
@@ -888,7 +887,7 @@ contains
|
||||
subroutine amg_d_allocate_wrk(prec,info,vmold,desc)
|
||||
use psb_base_mod
|
||||
implicit none
|
||||
|
||||
|
||||
! Arguments
|
||||
class(amg_dprec_type), intent(inout) :: prec
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
@@ -896,37 +895,37 @@ contains
|
||||
!
|
||||
! In MLD the DESC optional argument is ignored, since
|
||||
! the necessary info is contained in the various entries of the
|
||||
! PRECV component.
|
||||
! PRECV component.
|
||||
type(psb_desc_type), intent(in), optional :: desc
|
||||
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: me,err_act,i,j,level,nlev, nc2l
|
||||
character(len=20) :: name
|
||||
|
||||
|
||||
info=psb_success_
|
||||
name = 'amg_d_allocate_wrk'
|
||||
call psb_erractionsave(err_act)
|
||||
if (psb_errstatus_fatal()) then
|
||||
info = psb_err_internal_error_; goto 9999
|
||||
end if
|
||||
nlev = size(prec%precv)
|
||||
nlev = size(prec%precv)
|
||||
level = 1
|
||||
do level = 1, nlev
|
||||
call prec%precv(level)%allocate_wrk(info,vmold=vmold)
|
||||
if (psb_errstatus_fatal()) then
|
||||
if (psb_errstatus_fatal()) then
|
||||
nc2l = prec%precv(level)%base_desc%get_local_cols()
|
||||
info=psb_err_alloc_request_
|
||||
call psb_errpush(info,name,i_err=(/2*nc2l/), a_err='real(psb_dpk_)')
|
||||
goto 9999
|
||||
goto 9999
|
||||
end if
|
||||
end do
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
|
||||
|
||||
end subroutine amg_d_allocate_wrk
|
||||
|
||||
subroutine amg_d_free_wrk(prec,info)
|
||||
@@ -948,13 +947,13 @@ contains
|
||||
info = psb_err_internal_error_; goto 9999
|
||||
end if
|
||||
|
||||
if (allocated(prec%precv)) then
|
||||
nlev = size(prec%precv)
|
||||
if (allocated(prec%precv)) then
|
||||
nlev = size(prec%precv)
|
||||
do level = 1, nlev
|
||||
call prec%precv(level)%free_wrk(info)
|
||||
end do
|
||||
end if
|
||||
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
@@ -966,7 +965,7 @@ contains
|
||||
function amg_d_is_allocated_wrk(prec) result(res)
|
||||
use psb_base_mod
|
||||
implicit none
|
||||
|
||||
|
||||
! Arguments
|
||||
class(amg_dprec_type), intent(in) :: prec
|
||||
logical :: res
|
||||
@@ -974,7 +973,7 @@ contains
|
||||
res = .false.
|
||||
if (.not.allocated(prec%precv)) return
|
||||
res = allocated(prec%precv(1)%wrk)
|
||||
|
||||
|
||||
end function amg_d_is_allocated_wrk
|
||||
|
||||
end module amg_d_prec_type
|
||||
|
||||
@@ -0,0 +1,321 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_ainv_solver
|
||||
|
||||
use amg_s_base_ainv_mod
|
||||
use psb_base_mod, only : psb_d_vect_type
|
||||
|
||||
type, extends(amg_s_base_ainv_solver_type) :: amg_s_ainv_solver_type
|
||||
!
|
||||
! Compute an approximate factorization
|
||||
! A^-1 = Z D^-1 W^T
|
||||
! Note that here W is going to be transposed explicitly,
|
||||
! so that the component w will in the end contain W^T.
|
||||
!
|
||||
integer(psb_ipk_) :: alg, fill_in
|
||||
real(psb_spk_) :: thresh
|
||||
contains
|
||||
procedure, pass(sv) :: check => amg_s_ainv_solver_check
|
||||
procedure, pass(sv) :: build => amg_s_ainv_solver_bld
|
||||
procedure, pass(sv) :: clone => amg_s_ainv_solver_clone
|
||||
procedure, pass(sv) :: cseti => amg_s_ainv_solver_cseti
|
||||
procedure, pass(sv) :: csetc => amg_s_ainv_solver_csetc
|
||||
procedure, pass(sv) :: csetr => amg_s_ainv_solver_csetr
|
||||
procedure, pass(sv) :: seti => amg_s_ainv_solver_seti
|
||||
procedure, pass(sv) :: setc => amg_s_ainv_solver_setc
|
||||
procedure, pass(sv) :: setr => amg_s_ainv_solver_setr
|
||||
generic, public :: set => seti, setr, setc
|
||||
procedure, pass(sv) :: descr => amg_s_ainv_solver_descr
|
||||
procedure, pass(sv) :: default => s_ainv_solver_default
|
||||
procedure, nopass :: stringval => s_ainv_stringval
|
||||
procedure, nopass :: algname => s_ainv_algname
|
||||
end type amg_s_ainv_solver_type
|
||||
|
||||
|
||||
private :: s_ainv_stringval, s_ainv_solver_default, &
|
||||
& s_ainv_algname
|
||||
|
||||
interface
|
||||
subroutine amg_s_ainv_solver_clone(sv,svout,info)
|
||||
import :: psb_desc_type, psb_sspmat_type, psb_s_base_sparse_mat, &
|
||||
& amg_s_base_solver_type, psb_dpk_, amg_s_ainv_solver_type, psb_ipk_
|
||||
Implicit None
|
||||
class(amg_s_ainv_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_ainv_solver_clone
|
||||
end interface
|
||||
|
||||
|
||||
interface
|
||||
subroutine amg_s_ainv_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
import :: psb_desc_type, psb_sspmat_type, psb_s_base_sparse_mat, &
|
||||
& psb_d_vect_type, psb_s_base_vect_type, psb_dpk_,&
|
||||
& amg_s_ainv_solver_type, psb_i_base_vect_type, psb_ipk_
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
type(psb_sspmat_type), intent(in), target :: a
|
||||
Type(psb_desc_type), Intent(inout) :: desc_a
|
||||
class(amg_s_ainv_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_ainv_solver_bld
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_s_ainv_solver_check(sv,info)
|
||||
import :: psb_dpk_, amg_s_ainv_solver_type, psb_ipk_
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_s_ainv_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_s_ainv_solver_check
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_s_ainv_solver_cseti(sv,what,val,info,idx)
|
||||
import :: psb_desc_type, psb_sspmat_type, psb_s_base_sparse_mat, psb_ipk_,&
|
||||
& psb_d_vect_type, psb_s_base_vect_type, psb_dpk_, amg_s_ainv_solver_type
|
||||
Implicit None
|
||||
! Arguments
|
||||
class(amg_s_ainv_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
|
||||
end subroutine amg_s_ainv_solver_cseti
|
||||
end interface
|
||||
|
||||
|
||||
interface
|
||||
subroutine amg_s_ainv_solver_csetc(sv,what,val,info,idx)
|
||||
import :: psb_desc_type, psb_sspmat_type, psb_s_base_sparse_mat, psb_ipk_,&
|
||||
& psb_d_vect_type, psb_s_base_vect_type, psb_dpk_, amg_s_ainv_solver_type
|
||||
Implicit None
|
||||
! Arguments
|
||||
class(amg_s_ainv_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
|
||||
end subroutine amg_s_ainv_solver_csetc
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_s_ainv_solver_csetr(sv,what,val,info,idx)
|
||||
import :: psb_desc_type, psb_sspmat_type, psb_s_base_sparse_mat, psb_ipk_,&
|
||||
& psb_d_vect_type, psb_s_base_vect_type, psb_spk_, amg_s_ainv_solver_type
|
||||
Implicit None
|
||||
! Arguments
|
||||
class(amg_s_ainv_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
|
||||
end subroutine amg_s_ainv_solver_csetr
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_s_ainv_solver_setc(sv,what,val,info)
|
||||
import :: amg_s_ainv_solver_type, psb_ipk_
|
||||
Implicit none
|
||||
! Arguments
|
||||
class(amg_s_ainv_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(in) :: what
|
||||
character(len=*), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_s_ainv_solver_setc
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_s_ainv_solver_seti(sv,what,val,info)
|
||||
import :: amg_s_ainv_solver_type, psb_ipk_
|
||||
Implicit none
|
||||
! Arguments
|
||||
class(amg_s_ainv_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(in) :: what
|
||||
integer(psb_ipk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_s_ainv_solver_seti
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_s_ainv_solver_setr(sv,what,val,info)
|
||||
import :: amg_s_ainv_solver_type, psb_ipk_, psb_spk_
|
||||
Implicit none
|
||||
! Arguments
|
||||
class(amg_s_ainv_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(in) :: what
|
||||
real(psb_spk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_s_ainv_solver_setr
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_s_ainv_solver_descr(sv,info,iout,coarse)
|
||||
import :: psb_dpk_, amg_s_ainv_solver_type, psb_ipk_
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_s_ainv_solver_type), intent(in) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(in), optional :: iout
|
||||
logical, intent(in), optional :: coarse
|
||||
|
||||
end subroutine amg_s_ainv_solver_descr
|
||||
end interface
|
||||
|
||||
interface amg_ainv_bld
|
||||
subroutine amg_s_ainv_bld(a,alg,fillin,thresh,wmat,d,zmat,desc,info,blck,iscale)
|
||||
import :: psb_desc_type, psb_sspmat_type, psb_s_base_sparse_mat, &
|
||||
& psb_d_vect_type, psb_s_base_vect_type, psb_spk_, psb_ipk_
|
||||
implicit none
|
||||
type(psb_sspmat_type), intent(in), target :: a
|
||||
integer(psb_ipk_), intent(in) :: fillin,alg
|
||||
real(psb_spk_), intent(in) :: thresh
|
||||
type(psb_sspmat_type), intent(inout) :: wmat, zmat
|
||||
real(psb_spk_), allocatable :: d(:)
|
||||
Type(psb_desc_type), Intent(inout) :: desc
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
type(psb_sspmat_type), intent(in), optional :: blck
|
||||
integer(psb_ipk_), intent(in), optional :: iscale
|
||||
end subroutine amg_s_ainv_bld
|
||||
end interface
|
||||
|
||||
|
||||
contains
|
||||
|
||||
subroutine s_ainv_solver_default(sv)
|
||||
|
||||
use psb_base_mod
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_s_ainv_solver_type), intent(inout) :: sv
|
||||
|
||||
sv%alg = amg_ainv_llk_
|
||||
sv%fill_in = 0
|
||||
sv%thresh = dzero
|
||||
|
||||
return
|
||||
end subroutine s_ainv_solver_default
|
||||
|
||||
function is_positive_nz_min(ip) result(res)
|
||||
implicit none
|
||||
integer(psb_ipk_), intent(in) :: ip
|
||||
logical :: res
|
||||
|
||||
res = (ip >= 1)
|
||||
return
|
||||
end function is_positive_nz_min
|
||||
|
||||
|
||||
function s_ainv_stringval(string) result(val)
|
||||
use psb_base_mod, only : psb_ipk_,psb_toupper
|
||||
implicit none
|
||||
! Arguments
|
||||
character(len=*), intent(in) :: string
|
||||
integer(psb_ipk_) :: val
|
||||
character(len=*), parameter :: name='d_ainv_stringval'
|
||||
|
||||
select case(psb_toupper(trim(string)))
|
||||
case('LLK')
|
||||
val = amg_ainv_llk_
|
||||
case('STAB-LLK')
|
||||
val = amg_ainv_s_ft_llk_
|
||||
case('SYM-LLK')
|
||||
val = amg_ainv_s_llk_
|
||||
case('MLK')
|
||||
val = amg_ainv_mlk_
|
||||
#if defined(HAVE_TUMA_SAINV)
|
||||
case('SAINV-TUMA')
|
||||
val = amg_ainv_s_tuma_
|
||||
case('LAINV-TUMA')
|
||||
val = amg_ainv_l_tuma_
|
||||
#endif
|
||||
case default
|
||||
val = amg_stringval(string)
|
||||
end select
|
||||
end function s_ainv_stringval
|
||||
|
||||
|
||||
function s_ainv_algname(ialg) result(val)
|
||||
integer(psb_ipk_), intent(in) :: ialg
|
||||
character(len=40) :: val
|
||||
|
||||
character(len=*), parameter :: mlkname = 'Left-looking, list merge '
|
||||
character(len=*), parameter :: llkname = 'Left-looking '
|
||||
character(len=*), parameter :: stabllkname = 'Stabilized Left-looking '
|
||||
character(len=*), parameter :: sllkname = 'Symmetric Left-looking '
|
||||
character(len=*), parameter :: sainvname = 'SAINV (Benzi & Tuma) '
|
||||
character(len=*), parameter :: lainvname = 'LAINV (Benzi & Tuma) '
|
||||
character(len=*), parameter :: defname = 'Unknown alg variant '
|
||||
|
||||
select case (ialg)
|
||||
case(amg_ainv_mlk_)
|
||||
val = mlkname
|
||||
case(amg_ainv_llk_)
|
||||
val = llkname
|
||||
case(amg_ainv_s_llk_)
|
||||
val = sllkname
|
||||
case(amg_ainv_s_ft_llk_)
|
||||
val = stabllkname
|
||||
#if defined(HAVE_TUMA_SAINV)
|
||||
case(amg_ainv_s_tuma_ )
|
||||
val = sainvname
|
||||
case(amg_ainv_l_tuma_ )
|
||||
val = lainvname
|
||||
#endif
|
||||
case default
|
||||
val = defname
|
||||
end select
|
||||
|
||||
end function s_ainv_algname
|
||||
|
||||
end module amg_s_ainv_solver
|
||||
@@ -0,0 +1,199 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_base_ainv_mod
|
||||
|
||||
use amg_base_ainv_mod
|
||||
use amg_s_base_solver_mod
|
||||
use psb_s_ainv_tools_mod
|
||||
use psb_base_mod, only : psb_s_vect_type, psb_spk_, psb_epk_
|
||||
|
||||
|
||||
|
||||
type, extends(amg_s_base_solver_type) :: amg_s_base_ainv_solver_type
|
||||
!
|
||||
! Compute an approximate factorization
|
||||
! A^-1 = Z D^-1 W^T
|
||||
! Note that here W is going to be transposed explicitly,
|
||||
! so that the component w will in the end contain W^T.
|
||||
!
|
||||
type(psb_sspmat_type) :: w, z
|
||||
type(psb_s_vect_type) :: dv
|
||||
real(psb_spk_), allocatable :: d(:)
|
||||
|
||||
contains
|
||||
procedure, pass(sv) :: cnv => amg_s_base_ainv_solver_cnv
|
||||
procedure, pass(sv) :: dump => amg_s_base_ainv_solver_dmp
|
||||
procedure, pass(sv) :: apply_v => amg_s_base_ainv_solver_apply_vect
|
||||
procedure, pass(sv) :: apply_a => amg_s_base_ainv_solver_apply
|
||||
procedure, pass(sv) :: free => amg_s_base_ainv_solver_free
|
||||
procedure, pass(sv) :: sizeof => s_base_ainv_solver_sizeof
|
||||
procedure, pass(sv) :: get_nzeros => s_base_ainv_get_nzeros
|
||||
procedure, nopass :: get_wrksz => s_base_ainv_get_wrksize
|
||||
procedure, pass(sv) :: update_a => amg_s_base_ainv_update_a
|
||||
generic, public :: update => update_a
|
||||
end type amg_s_base_ainv_solver_type
|
||||
|
||||
private :: s_base_ainv_solver_sizeof, &
|
||||
& s_base_ainv_get_nzeros, s_base_ainv_get_wrksize
|
||||
|
||||
|
||||
interface
|
||||
subroutine amg_s_base_ainv_solver_cnv(sv,info,amold,vmold,imold)
|
||||
import :: psb_s_base_sparse_mat, psb_s_base_vect_type, psb_spk_, &
|
||||
& amg_s_base_ainv_solver_type, psb_ipk_, psb_i_base_vect_type
|
||||
Implicit None
|
||||
! Arguments
|
||||
class(amg_s_base_ainv_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_base_ainv_solver_cnv
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_s_base_ainv_update_a(sv,x,desc_data,info)
|
||||
import :: psb_desc_type, psb_spk_,amg_s_base_ainv_solver_type, psb_s_vect_type, psb_ipk_
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(amg_s_base_ainv_solver_type), intent(inout) :: sv
|
||||
real(psb_spk_),intent(in) :: x(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_s_base_ainv_update_a
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_s_base_ainv_solver_apply(alpha,sv,x,beta,y,desc_data,&
|
||||
& trans,work,info,init,initu)
|
||||
import :: psb_desc_type, psb_spk_,amg_s_base_ainv_solver_type, psb_ipk_
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(amg_s_base_ainv_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_base_ainv_solver_apply
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_s_base_ainv_solver_apply_vect(alpha,sv,x,beta,y,desc_data,&
|
||||
& trans,work,wv,info,init,initu)
|
||||
import :: psb_desc_type, psb_spk_,amg_s_base_ainv_solver_type, psb_s_vect_type, psb_ipk_
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(amg_s_base_ainv_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_base_ainv_solver_apply_vect
|
||||
end interface
|
||||
|
||||
|
||||
interface
|
||||
subroutine amg_s_base_ainv_solver_free(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_base_ainv_solver_type, psb_ipk_
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_s_base_ainv_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_s_base_ainv_solver_free
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_s_base_ainv_solver_dmp(sv,desc,level,info,prefix,head,solver,global_num)
|
||||
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_ainv_solver_type, psb_ipk_
|
||||
|
||||
implicit none
|
||||
class(amg_s_base_ainv_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_base_ainv_solver_dmp
|
||||
end interface
|
||||
|
||||
contains
|
||||
|
||||
function s_base_ainv_get_nzeros(sv) result(val)
|
||||
implicit none
|
||||
! Arguments
|
||||
class(amg_s_base_ainv_solver_type), intent(in) :: sv
|
||||
integer(psb_epk_) :: val
|
||||
integer :: i
|
||||
|
||||
val = 0
|
||||
val = val + sv%dv%get_nrows()
|
||||
val = val + sv%w%get_nzeros()
|
||||
val = val + sv%z%get_nzeros()
|
||||
|
||||
return
|
||||
end function s_base_ainv_get_nzeros
|
||||
|
||||
function s_base_ainv_solver_sizeof(sv) result(val)
|
||||
implicit none
|
||||
! Arguments
|
||||
class(amg_s_base_ainv_solver_type), intent(in) :: sv
|
||||
integer(psb_epk_) :: val
|
||||
integer :: i
|
||||
|
||||
val = 2*psb_sizeof_ip + psb_sizeof_dp
|
||||
val = val + sv%dv%sizeof()
|
||||
val = val + sv%w%sizeof()
|
||||
val = val + sv%z%sizeof()
|
||||
|
||||
return
|
||||
end function s_base_ainv_solver_sizeof
|
||||
|
||||
function s_base_ainv_get_wrksize() result(val)
|
||||
implicit none
|
||||
integer(psb_ipk_) :: val
|
||||
|
||||
val = 2
|
||||
end function s_base_ainv_get_wrksize
|
||||
|
||||
end module amg_s_base_ainv_mod
|
||||
@@ -0,0 +1,168 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_invk_solver
|
||||
|
||||
use amg_s_base_solver_mod
|
||||
use amg_s_base_ainv_mod
|
||||
use psb_base_mod, only : psb_s_vect_type
|
||||
|
||||
type, extends(amg_s_base_ainv_solver_type) :: amg_s_invk_solver_type
|
||||
integer(psb_ipk_) :: fill_in, inv_fill
|
||||
contains
|
||||
procedure, pass(sv) :: check => amg_s_invk_solver_check
|
||||
procedure, pass(sv) :: clone => amg_s_invk_solver_clone
|
||||
procedure, pass(sv) :: build => amg_s_invk_solver_bld
|
||||
procedure, pass(sv) :: cseti => amg_s_invk_solver_cseti
|
||||
procedure, pass(sv) :: seti => amg_s_invk_solver_seti
|
||||
generic, public :: set => seti
|
||||
procedure, pass(sv) :: descr => amg_s_invk_solver_descr
|
||||
procedure, pass(sv) :: default => s_invk_solver_default
|
||||
end type amg_s_invk_solver_type
|
||||
|
||||
|
||||
private :: s_invk_solver_default
|
||||
|
||||
|
||||
interface
|
||||
subroutine amg_s_invk_solver_clone(sv,svout,info)
|
||||
import :: psb_desc_type, psb_sspmat_type, psb_s_base_sparse_mat, &
|
||||
& amg_s_base_solver_type, psb_spk_, amg_s_invk_solver_type, psb_ipk_
|
||||
Implicit None
|
||||
class(amg_s_invk_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_invk_solver_clone
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_s_invk_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
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_invk_solver_type, psb_i_base_vect_type, psb_ipk_
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
type(psb_sspmat_type), intent(in), target :: a
|
||||
Type(psb_desc_type), Intent(inout) :: desc_a
|
||||
class(amg_s_invk_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_invk_solver_bld
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_s_invk_solver_check(sv,info)
|
||||
import :: psb_spk_, amg_s_invk_solver_type, psb_ipk_
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_s_invk_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_s_invk_solver_check
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_s_invk_solver_cseti(sv,what,val,info,idx)
|
||||
import :: psb_desc_type, psb_sspmat_type, psb_s_base_sparse_mat, &
|
||||
& psb_ipk_, psb_s_vect_type, psb_s_base_vect_type, psb_spk_, &
|
||||
& amg_s_invk_solver_type
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_s_invk_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
|
||||
end subroutine amg_s_invk_solver_cseti
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_s_invk_solver_descr(sv,info,iout,coarse)
|
||||
import :: psb_spk_, amg_s_invk_solver_type, psb_ipk_
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_s_invk_solver_type), intent(in) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(in), optional :: iout
|
||||
logical, intent(in), optional :: coarse
|
||||
|
||||
end subroutine amg_s_invk_solver_descr
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_s_invk_solver_seti(sv,what,val,info)
|
||||
import :: amg_s_invk_solver_type, psb_ipk_
|
||||
Implicit none
|
||||
! Arguments
|
||||
class(amg_s_invk_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(in) :: what
|
||||
integer(psb_ipk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_s_invk_solver_seti
|
||||
end interface
|
||||
|
||||
contains
|
||||
|
||||
subroutine s_invk_solver_default(sv)
|
||||
|
||||
!use psb_base_mod
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_s_invk_solver_type), intent(inout) :: sv
|
||||
|
||||
sv%fill_in = 0
|
||||
sv%inv_fill = 0
|
||||
|
||||
return
|
||||
end subroutine s_invk_solver_default
|
||||
|
||||
end module amg_s_invk_solver
|
||||
@@ -0,0 +1,194 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_invt_solver
|
||||
|
||||
use amg_s_base_solver_mod
|
||||
use amg_s_base_ainv_mod
|
||||
use psb_base_mod, only : psb_s_vect_type
|
||||
|
||||
type, extends(amg_s_base_ainv_solver_type) :: amg_s_invt_solver_type
|
||||
integer(psb_ipk_) :: fill_in, inv_fill
|
||||
real(psb_spk_) :: thresh, inv_thresh
|
||||
contains
|
||||
procedure, pass(sv) :: check => amg_s_invt_solver_check
|
||||
procedure, pass(sv) :: clone => amg_s_invt_solver_clone
|
||||
procedure, pass(sv) :: build => amg_s_invt_solver_bld
|
||||
procedure, pass(sv) :: cseti => amg_s_invt_solver_cseti
|
||||
procedure, pass(sv) :: csetr => amg_s_invt_solver_csetr
|
||||
procedure, pass(sv) :: seti => amg_s_invt_solver_seti
|
||||
procedure, pass(sv) :: setr => amg_s_invt_solver_setr
|
||||
generic, public :: set => seti, setr
|
||||
procedure, pass(sv) :: descr => amg_s_invt_solver_descr
|
||||
procedure, pass(sv) :: default => s_invt_solver_default
|
||||
end type amg_s_invt_solver_type
|
||||
|
||||
private :: s_invt_solver_default
|
||||
|
||||
|
||||
interface
|
||||
subroutine amg_s_invt_solver_clone(sv,svout,info)
|
||||
import :: psb_desc_type, psb_sspmat_type, psb_s_base_sparse_mat, &
|
||||
& amg_s_base_solver_type, psb_spk_, amg_s_invt_solver_type, psb_ipk_
|
||||
Implicit None
|
||||
class(amg_s_invt_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_invt_solver_clone
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_s_invt_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
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_invt_solver_type, psb_i_base_vect_type, psb_ipk_
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
type(psb_sspmat_type), intent(in), target :: a
|
||||
Type(psb_desc_type), Intent(inout) :: desc_a
|
||||
class(amg_s_invt_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_invt_solver_bld
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_s_invt_solver_check(sv,info)
|
||||
import :: amg_s_invt_solver_type, psb_ipk_
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_s_invt_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_s_invt_solver_check
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_s_invt_solver_cseti(sv,what,val,info,idx)
|
||||
import :: psb_desc_type, psb_sspmat_type, psb_s_base_sparse_mat, psb_ipk_,&
|
||||
& psb_s_vect_type, psb_s_base_vect_type, psb_spk_, amg_s_invt_solver_type
|
||||
Implicit None
|
||||
! Arguments
|
||||
class(amg_s_invt_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
|
||||
end subroutine amg_s_invt_solver_cseti
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_s_invt_solver_csetr(sv,what,val,info,idx)
|
||||
import :: psb_desc_type, psb_sspmat_type, psb_s_base_sparse_mat, psb_ipk_,&
|
||||
& psb_s_vect_type, psb_s_base_vect_type, psb_spk_, amg_s_invt_solver_type
|
||||
Implicit None
|
||||
! Arguments
|
||||
class(amg_s_invt_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
|
||||
end subroutine amg_s_invt_solver_csetr
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_s_invt_solver_descr(sv,info,iout,coarse)
|
||||
import :: psb_spk_, amg_s_invt_solver_type, psb_ipk_
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_s_invt_solver_type), intent(in) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(in), optional :: iout
|
||||
logical, intent(in), optional :: coarse
|
||||
|
||||
end subroutine amg_s_invt_solver_descr
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_s_invt_solver_setr(sv,what,val,info)
|
||||
import :: amg_s_invt_solver_type, psb_spk_, psb_ipk_
|
||||
Implicit none
|
||||
! Arguments
|
||||
class(amg_s_invt_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(in) :: what
|
||||
real(psb_spk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_s_invt_solver_setr
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_s_invt_solver_seti(sv,what,val,info)
|
||||
import :: amg_s_invt_solver_type, psb_ipk_
|
||||
Implicit none
|
||||
! Arguments
|
||||
class(amg_s_invt_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(in) :: what
|
||||
integer(psb_ipk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine
|
||||
end interface
|
||||
|
||||
contains
|
||||
|
||||
subroutine s_invt_solver_default(sv)
|
||||
|
||||
!use psb_base_mod
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_s_invt_solver_type), intent(inout) :: sv
|
||||
|
||||
sv%fill_in = 0
|
||||
sv%inv_fill = 0
|
||||
sv%thresh = szero
|
||||
sv%inv_thresh = szero
|
||||
|
||||
return
|
||||
end subroutine s_invt_solver_default
|
||||
|
||||
end module amg_s_invt_solver
|
||||
+19
-16
@@ -1,15 +1,15 @@
|
||||
!
|
||||
!
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! 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:
|
||||
@@ -21,7 +21,7 @@
|
||||
! 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
|
||||
@@ -33,8 +33,8 @@
|
||||
! 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_prec_mod.f90
|
||||
!
|
||||
! Module: amg_s_prec_mod
|
||||
@@ -52,6 +52,9 @@ module amg_s_prec_mod
|
||||
use amg_s_l1_diag_solver
|
||||
use amg_s_ilu_solver
|
||||
use amg_s_gs_solver
|
||||
use amg_s_ainv_solver
|
||||
use amg_s_invk_solver
|
||||
use amg_s_invt_solver
|
||||
|
||||
interface amg_precset
|
||||
module procedure amg_s_iprecsetsm, amg_s_iprecsetsv, &
|
||||
@@ -78,7 +81,7 @@ module amg_s_prec_mod
|
||||
! !$ character, intent(in), optional :: upd
|
||||
end subroutine amg_s_extprol_bld
|
||||
end interface amg_extprol_bld
|
||||
|
||||
|
||||
contains
|
||||
|
||||
subroutine amg_s_iprecsetsm(p,val,info,pos)
|
||||
@@ -108,7 +111,7 @@ contains
|
||||
|
||||
subroutine amg_s_cprecseti(p,what,val,info,pos)
|
||||
type(amg_sprec_type), intent(inout) :: p
|
||||
character(len=*), intent(in) :: what
|
||||
character(len=*), intent(in) :: what
|
||||
integer(psb_ipk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
character(len=*), optional, intent(in) :: pos
|
||||
@@ -118,7 +121,7 @@ contains
|
||||
|
||||
subroutine amg_s_cprecsetr(p,what,val,info,pos)
|
||||
type(amg_sprec_type), intent(inout) :: p
|
||||
character(len=*), intent(in) :: what
|
||||
character(len=*), intent(in) :: what
|
||||
real(psb_spk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
character(len=*), optional, intent(in) :: pos
|
||||
@@ -128,7 +131,7 @@ contains
|
||||
|
||||
subroutine amg_s_cprecsetc(p,what,val,info,pos)
|
||||
type(amg_sprec_type), intent(inout) :: p
|
||||
character(len=*), intent(in) :: what
|
||||
character(len=*), intent(in) :: what
|
||||
character(len=*), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
character(len=*), optional, intent(in) :: pos
|
||||
|
||||
+144
-145
@@ -1,15 +1,15 @@
|
||||
!
|
||||
!
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! 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:
|
||||
@@ -21,7 +21,7 @@
|
||||
! 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
|
||||
@@ -33,21 +33,21 @@
|
||||
! 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_prec_type.f90
|
||||
!
|
||||
! Module: amg_s_prec_type
|
||||
!
|
||||
! This module defines:
|
||||
! This module defines:
|
||||
! - the amg_s_prec_type data structure containing the preconditioner and related
|
||||
! data structures;
|
||||
!
|
||||
! It contains routines for
|
||||
! - Building and applying;
|
||||
! - Building and applying;
|
||||
! - checking if the preconditioner is correctly defined;
|
||||
! - printing a description of the preconditioner;
|
||||
! - deallocating the preconditioner data structure.
|
||||
! - deallocating the preconditioner data structure.
|
||||
!
|
||||
|
||||
module amg_s_prec_type
|
||||
@@ -70,25 +70,25 @@ module amg_s_prec_type
|
||||
! It consists of an array of 'one-level' intermediate data structures
|
||||
! of type amg_sonelev_type, each containing the information needed to apply
|
||||
! the smoothing and the coarse-space correction at a generic level. RT is the
|
||||
! real data type, i.e. S for both S and C, and D for both D and Z.
|
||||
! real data type, i.e. S for both S and C, and D for both D and Z.
|
||||
!
|
||||
! type amg_sprec_type
|
||||
! type(amg_sonelev_type), allocatable :: precv(:)
|
||||
! type(amg_sonelev_type), allocatable :: precv(:)
|
||||
! end type amg_sprec_type
|
||||
!
|
||||
!
|
||||
! Note that the levels are numbered in increasing order starting from
|
||||
! the level 1 as the finest one, and the number of levels is given by
|
||||
! size(precv(:)) which is the id of the coarsest level.
|
||||
! size(precv(:)) which is the id of the coarsest level.
|
||||
! In the multigrid literature many authors number the levels in the opposite
|
||||
! order, with level 0 being the id of the coarsest level.
|
||||
!
|
||||
!
|
||||
integer, parameter, private :: wv_size_=4
|
||||
|
||||
|
||||
type, extends(psb_sprec_type) :: amg_sprec_type
|
||||
type(amg_saggr_data) :: ag_data
|
||||
!
|
||||
! Number of outer sweeps. Sometimes 2 V-cycles may be better than 1 W-cycle.
|
||||
! Number of outer sweeps. Sometimes 2 V-cycles may be better than 1 W-cycle.
|
||||
!
|
||||
integer(psb_ipk_) :: outer_sweeps = 1
|
||||
!
|
||||
@@ -97,11 +97,11 @@ module amg_s_prec_type
|
||||
! to keep track against what is put later in the multilevel array
|
||||
!
|
||||
integer(psb_ipk_) :: coarse_solver = -1
|
||||
|
||||
|
||||
!
|
||||
! The multilevel hierarchy
|
||||
!
|
||||
type(amg_s_onelev_type), allocatable :: precv(:)
|
||||
type(amg_s_onelev_type), allocatable :: precv(:)
|
||||
contains
|
||||
procedure, pass(prec) :: psb_s_apply2_vect => amg_s_apply2_vect
|
||||
procedure, pass(prec) :: psb_s_apply1_vect => amg_s_apply1_vect
|
||||
@@ -157,7 +157,7 @@ module amg_s_prec_type
|
||||
interface amg_precdescr
|
||||
subroutine amg_sfile_prec_descr(prec,iout,root)
|
||||
import :: amg_sprec_type, psb_ipk_
|
||||
implicit none
|
||||
implicit none
|
||||
! Arguments
|
||||
class(amg_sprec_type), intent(in) :: prec
|
||||
integer(psb_ipk_), intent(in), optional :: iout
|
||||
@@ -211,7 +211,7 @@ module amg_s_prec_type
|
||||
end subroutine amg_sprecaply1
|
||||
end interface
|
||||
|
||||
interface
|
||||
interface
|
||||
subroutine amg_sprecsetsm(prec,val,info,ilev,ilmax,pos)
|
||||
import :: psb_sspmat_type, psb_desc_type, psb_spk_, &
|
||||
& amg_sprec_type, amg_s_base_smoother_type, psb_ipk_
|
||||
@@ -243,7 +243,7 @@ module amg_s_prec_type
|
||||
import :: psb_sspmat_type, psb_desc_type, psb_spk_, &
|
||||
& amg_sprec_type, psb_ipk_
|
||||
class(amg_sprec_type), intent(inout) :: prec
|
||||
character(len=*), intent(in) :: what
|
||||
character(len=*), intent(in) :: what
|
||||
integer(psb_ipk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: ilev,ilmax,idx
|
||||
@@ -253,7 +253,7 @@ module amg_s_prec_type
|
||||
import :: psb_sspmat_type, psb_desc_type, psb_spk_, &
|
||||
& amg_sprec_type, psb_ipk_
|
||||
class(amg_sprec_type), intent(inout) :: prec
|
||||
character(len=*), intent(in) :: what
|
||||
character(len=*), intent(in) :: what
|
||||
real(psb_spk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: ilev,ilmax,idx
|
||||
@@ -263,7 +263,7 @@ module amg_s_prec_type
|
||||
import :: psb_sspmat_type, psb_desc_type, psb_spk_, &
|
||||
& amg_sprec_type, psb_ipk_
|
||||
class(amg_sprec_type), intent(inout) :: prec
|
||||
character(len=*), intent(in) :: what
|
||||
character(len=*), intent(in) :: what
|
||||
character(len=*), intent(in) :: string
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: ilev,ilmax,idx
|
||||
@@ -341,28 +341,28 @@ module amg_s_prec_type
|
||||
! character, intent(in),optional :: upd
|
||||
end subroutine amg_s_smoothers_bld
|
||||
end interface amg_smoothers_bld
|
||||
|
||||
|
||||
contains
|
||||
!
|
||||
! Function returning a pointer to the smoother
|
||||
!
|
||||
function amg_s_get_smootherp(prec,ilev) result(val)
|
||||
implicit none
|
||||
implicit none
|
||||
class(amg_sprec_type), target, intent(in) :: prec
|
||||
integer(psb_ipk_), optional :: ilev
|
||||
class(amg_s_base_smoother_type), pointer :: val
|
||||
integer(psb_ipk_) :: ilev_
|
||||
|
||||
|
||||
val => null()
|
||||
if (present(ilev)) then
|
||||
if (present(ilev)) then
|
||||
ilev_ = ilev
|
||||
else
|
||||
! What is a good default?
|
||||
! What is a good default?
|
||||
ilev_ = 1
|
||||
end if
|
||||
if (allocated(prec%precv)) then
|
||||
if ((1<=ilev_).and.(ilev_<=size(prec%precv))) then
|
||||
if (allocated(prec%precv(ilev_)%sm)) then
|
||||
if (allocated(prec%precv)) then
|
||||
if ((1<=ilev_).and.(ilev_<=size(prec%precv))) then
|
||||
if (allocated(prec%precv(ilev_)%sm)) then
|
||||
val => prec%precv(ilev_)%sm
|
||||
end if
|
||||
end if
|
||||
@@ -372,23 +372,23 @@ contains
|
||||
! Function returning a pointer to the solver
|
||||
!
|
||||
function amg_s_get_solverp(prec,ilev) result(val)
|
||||
implicit none
|
||||
implicit none
|
||||
class(amg_sprec_type), target, intent(in) :: prec
|
||||
integer(psb_ipk_), optional :: ilev
|
||||
class(amg_s_base_solver_type), pointer :: val
|
||||
integer(psb_ipk_) :: ilev_
|
||||
|
||||
|
||||
val => null()
|
||||
if (present(ilev)) then
|
||||
if (present(ilev)) then
|
||||
ilev_ = ilev
|
||||
else
|
||||
! What is a good default?
|
||||
! What is a good default?
|
||||
ilev_ = 1
|
||||
end if
|
||||
if (allocated(prec%precv)) then
|
||||
if ((1<=ilev_).and.(ilev_<=size(prec%precv))) then
|
||||
if (allocated(prec%precv(ilev_)%sm)) then
|
||||
if (allocated(prec%precv(ilev_)%sm%sv)) then
|
||||
if (allocated(prec%precv)) then
|
||||
if ((1<=ilev_).and.(ilev_<=size(prec%precv))) then
|
||||
if (allocated(prec%precv(ilev_)%sm)) then
|
||||
if (allocated(prec%precv(ilev_)%sm%sv)) then
|
||||
val => prec%precv(ilev_)%sm%sv
|
||||
end if
|
||||
end if
|
||||
@@ -399,25 +399,25 @@ contains
|
||||
! Function returning the size of the precv(:) array
|
||||
!
|
||||
function amg_s_get_nlevs(prec) result(val)
|
||||
implicit none
|
||||
implicit none
|
||||
class(amg_sprec_type), intent(in) :: prec
|
||||
integer(psb_ipk_) :: val
|
||||
val = 0
|
||||
if (allocated(prec%precv)) then
|
||||
if (allocated(prec%precv)) then
|
||||
val = size(prec%precv)
|
||||
end if
|
||||
end function amg_s_get_nlevs
|
||||
!
|
||||
! Function returning the size of the amg_prec_type data structure
|
||||
! in bytes or in number of nonzeros of the operator(s) involved.
|
||||
! in bytes or in number of nonzeros of the operator(s) involved.
|
||||
!
|
||||
function amg_s_get_nzeros(prec) result(val)
|
||||
implicit none
|
||||
implicit none
|
||||
class(amg_sprec_type), intent(in) :: prec
|
||||
integer(psb_epk_) :: val
|
||||
integer(psb_ipk_) :: i
|
||||
val = 0
|
||||
if (allocated(prec%precv)) then
|
||||
if (allocated(prec%precv)) then
|
||||
do i=1, size(prec%precv)
|
||||
val = val + prec%precv(i)%get_nzeros()
|
||||
end do
|
||||
@@ -425,13 +425,13 @@ contains
|
||||
end function amg_s_get_nzeros
|
||||
|
||||
function amg_sprec_sizeof(prec) result(val)
|
||||
implicit none
|
||||
implicit none
|
||||
class(amg_sprec_type), intent(in) :: prec
|
||||
integer(psb_epk_) :: val
|
||||
integer(psb_ipk_) :: i
|
||||
val = 0
|
||||
val = val + psb_sizeof_ip
|
||||
if (allocated(prec%precv)) then
|
||||
if (allocated(prec%precv)) then
|
||||
do i=1, size(prec%precv)
|
||||
val = val + prec%precv(i)%sizeof()
|
||||
end do
|
||||
@@ -444,40 +444,40 @@ contains
|
||||
! various level to the nonzeroes at the fine level
|
||||
! (original matrix)
|
||||
!
|
||||
|
||||
|
||||
function amg_s_get_compl(prec) result(val)
|
||||
implicit none
|
||||
implicit none
|
||||
class(amg_sprec_type), intent(in) :: prec
|
||||
real(psb_spk_) :: val
|
||||
|
||||
|
||||
val = prec%ag_data%op_complexity
|
||||
|
||||
end function amg_s_get_compl
|
||||
|
||||
subroutine amg_s_cmp_compl(prec)
|
||||
|
||||
implicit none
|
||||
subroutine amg_s_cmp_compl(prec)
|
||||
|
||||
implicit none
|
||||
class(amg_sprec_type), intent(inout) :: prec
|
||||
|
||||
|
||||
real(psb_spk_) :: num, den, nmin
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: il
|
||||
integer(psb_ipk_) :: il
|
||||
|
||||
num = -sone
|
||||
den = sone
|
||||
ctxt = prec%ctxt
|
||||
if (allocated(prec%precv)) then
|
||||
if (allocated(prec%precv)) then
|
||||
il = 1
|
||||
num = prec%precv(il)%base_a%get_nzeros()
|
||||
if (num >= szero) then
|
||||
den = num
|
||||
den = num
|
||||
do il=2,size(prec%precv)
|
||||
num = num + max(0,prec%precv(il)%base_a%get_nzeros())
|
||||
end do
|
||||
end if
|
||||
end if
|
||||
nmin = num
|
||||
call psb_min(ctxt,nmin)
|
||||
call psb_min(ctxt,nmin)
|
||||
if (nmin < szero) then
|
||||
num = szero
|
||||
den = sone
|
||||
@@ -487,25 +487,25 @@ contains
|
||||
end if
|
||||
prec%ag_data%op_complexity = num/den
|
||||
end subroutine amg_s_cmp_compl
|
||||
|
||||
|
||||
!
|
||||
! Average coarsening ratio
|
||||
!
|
||||
|
||||
|
||||
function amg_s_get_avg_cr(prec) result(val)
|
||||
implicit none
|
||||
implicit none
|
||||
class(amg_sprec_type), intent(in) :: prec
|
||||
real(psb_spk_) :: val
|
||||
|
||||
|
||||
val = prec%ag_data%avg_cr
|
||||
|
||||
end function amg_s_get_avg_cr
|
||||
|
||||
subroutine amg_s_cmp_avg_cr(prec)
|
||||
|
||||
implicit none
|
||||
subroutine amg_s_cmp_avg_cr(prec)
|
||||
|
||||
implicit none
|
||||
class(amg_sprec_type), intent(inout) :: prec
|
||||
|
||||
|
||||
real(psb_spk_) :: avgcr
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: il, nl, iam, np
|
||||
@@ -519,12 +519,12 @@ contains
|
||||
do il=2,nl
|
||||
avgcr = avgcr + max(szero,prec%precv(il)%szratio)
|
||||
end do
|
||||
avgcr = avgcr / (nl-1)
|
||||
avgcr = avgcr / (nl-1)
|
||||
end if
|
||||
call psb_sum(ctxt,avgcr)
|
||||
call psb_sum(ctxt,avgcr)
|
||||
prec%ag_data%avg_cr = avgcr/np
|
||||
end subroutine amg_s_cmp_avg_cr
|
||||
|
||||
|
||||
!
|
||||
! Subroutines: amg_Tprec_free
|
||||
! Version: real
|
||||
@@ -538,74 +538,74 @@ contains
|
||||
! error code.
|
||||
!
|
||||
subroutine amg_sprecfree(p,info)
|
||||
|
||||
|
||||
implicit none
|
||||
|
||||
|
||||
! Arguments
|
||||
type(amg_sprec_type), intent(inout) :: p
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: me,err_act,i
|
||||
character(len=20) :: name
|
||||
|
||||
|
||||
info=psb_success_
|
||||
name = 'amg_sprecfree'
|
||||
call psb_erractionsave(err_act)
|
||||
if (psb_errstatus_fatal()) then
|
||||
info = psb_err_internal_error_; return
|
||||
end if
|
||||
|
||||
|
||||
me=-1
|
||||
|
||||
|
||||
call p%free(info)
|
||||
|
||||
|
||||
|
||||
return
|
||||
|
||||
|
||||
end subroutine amg_sprecfree
|
||||
|
||||
subroutine amg_s_prec_free(prec,info)
|
||||
|
||||
|
||||
implicit none
|
||||
|
||||
|
||||
! Arguments
|
||||
class(amg_sprec_type), intent(inout) :: prec
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: me,err_act,i
|
||||
character(len=20) :: name
|
||||
|
||||
|
||||
info=psb_success_
|
||||
name = 'amg_sprecfree'
|
||||
call psb_erractionsave(err_act)
|
||||
if (psb_errstatus_fatal()) then
|
||||
info = psb_err_internal_error_; goto 9999
|
||||
end if
|
||||
|
||||
|
||||
me=-1
|
||||
if (allocated(prec%precv)) then
|
||||
do i=1,size(prec%precv)
|
||||
if (allocated(prec%precv)) then
|
||||
do i=1,size(prec%precv)
|
||||
call prec%precv(i)%free(info)
|
||||
end do
|
||||
deallocate(prec%precv,stat=info)
|
||||
end if
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
|
||||
|
||||
end subroutine amg_s_prec_free
|
||||
|
||||
|
||||
|
||||
|
||||
!
|
||||
! Top level methods.
|
||||
! Top level methods.
|
||||
!
|
||||
subroutine amg_s_apply2_vect(prec,x,y,desc_data,info,trans,work)
|
||||
implicit none
|
||||
implicit none
|
||||
type(psb_desc_type),intent(in) :: desc_data
|
||||
class(amg_sprec_type), intent(inout) :: prec
|
||||
type(psb_s_vect_type),intent(inout) :: x
|
||||
@@ -618,13 +618,13 @@ contains
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select type(prec)
|
||||
select type(prec)
|
||||
type is (amg_sprec_type)
|
||||
call amg_precapply(prec,x,y,desc_data,info,trans,work)
|
||||
class default
|
||||
info = psb_err_missing_override_method_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
@@ -636,7 +636,7 @@ contains
|
||||
end subroutine amg_s_apply2_vect
|
||||
|
||||
subroutine amg_s_apply1_vect(prec,x,desc_data,info,trans,work)
|
||||
implicit none
|
||||
implicit none
|
||||
type(psb_desc_type),intent(in) :: desc_data
|
||||
class(amg_sprec_type), intent(inout) :: prec
|
||||
type(psb_s_vect_type),intent(inout) :: x
|
||||
@@ -648,13 +648,13 @@ contains
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select type(prec)
|
||||
select type(prec)
|
||||
type is (amg_sprec_type)
|
||||
call amg_precapply(prec,x,desc_data,info,trans,work)
|
||||
class default
|
||||
info = psb_err_missing_override_method_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
@@ -667,7 +667,7 @@ contains
|
||||
|
||||
|
||||
subroutine amg_s_apply2v(prec,x,y,desc_data,info,trans,work)
|
||||
implicit none
|
||||
implicit none
|
||||
type(psb_desc_type),intent(in) :: desc_data
|
||||
class(amg_sprec_type), intent(inout) :: prec
|
||||
real(psb_spk_),intent(inout) :: x(:)
|
||||
@@ -680,13 +680,13 @@ contains
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select type(prec)
|
||||
select type(prec)
|
||||
type is (amg_sprec_type)
|
||||
call amg_precapply(prec,x,y,desc_data,info,trans,work)
|
||||
class default
|
||||
info = psb_err_missing_override_method_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
@@ -698,7 +698,7 @@ contains
|
||||
end subroutine amg_s_apply2v
|
||||
|
||||
subroutine amg_s_apply1v(prec,x,desc_data,info,trans)
|
||||
implicit none
|
||||
implicit none
|
||||
type(psb_desc_type),intent(in) :: desc_data
|
||||
class(amg_sprec_type), intent(inout) :: prec
|
||||
real(psb_spk_),intent(inout) :: x(:)
|
||||
@@ -709,13 +709,13 @@ contains
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select type(prec)
|
||||
select type(prec)
|
||||
type is (amg_sprec_type)
|
||||
call amg_precapply(prec,x,desc_data,info,trans)
|
||||
class default
|
||||
info = psb_err_missing_override_method_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
@@ -730,8 +730,8 @@ contains
|
||||
subroutine amg_s_dump(prec,info,istart,iend,iproc,prefix,head,&
|
||||
& ac,rp,smoother,solver,tprol,&
|
||||
& global_num)
|
||||
|
||||
implicit none
|
||||
|
||||
implicit none
|
||||
class(amg_sprec_type), intent(in) :: prec
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(in), optional :: istart, iend, iproc
|
||||
@@ -742,27 +742,26 @@ contains
|
||||
integer(psb_ipk_) :: iam, np, iproc_
|
||||
character(len=80) :: prefix_
|
||||
character(len=120) :: fname ! len should be at least 20 more than
|
||||
! len of prefix_
|
||||
! len of prefix_
|
||||
|
||||
info = 0
|
||||
ctxt = prec%ctxt
|
||||
call psb_info(ctxt,iam,np)
|
||||
|
||||
iln = size(prec%precv)
|
||||
if (present(istart)) then
|
||||
if (present(istart)) then
|
||||
il1 = max(1,istart)
|
||||
else
|
||||
il1 = min(2,iln)
|
||||
end if
|
||||
if (present(iend)) then
|
||||
if (present(iend)) then
|
||||
iln = min(iln, iend)
|
||||
end if
|
||||
iproc_ = -1
|
||||
if (present(iproc)) then
|
||||
if (present(iproc)) then
|
||||
iproc_ = iproc
|
||||
end if
|
||||
|
||||
if ((iproc_ == -1).or.(iproc_==iam)) then
|
||||
if ((iproc_ == -1).or.(iproc_==iam)) then
|
||||
do lev=il1, iln
|
||||
call prec%precv(lev)%dump(lev,info,prefix=prefix,head=head,&
|
||||
& ac=ac,smoother=smoother,solver=solver,rp=rp,tprol=tprol, &
|
||||
@@ -773,7 +772,7 @@ contains
|
||||
|
||||
subroutine amg_s_cnv(prec,info,amold,vmold,imold)
|
||||
|
||||
implicit none
|
||||
implicit none
|
||||
class(amg_sprec_type), intent(inout) :: prec
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
class(psb_s_base_sparse_mat), intent(in), optional :: amold
|
||||
@@ -781,7 +780,7 @@ contains
|
||||
class(psb_i_base_vect_type), intent(in), optional :: imold
|
||||
|
||||
integer(psb_ipk_) :: i
|
||||
|
||||
|
||||
info = psb_success_
|
||||
if (allocated(prec%precv)) then
|
||||
do i=1,size(prec%precv)
|
||||
@@ -789,24 +788,24 @@ contains
|
||||
& call prec%precv(i)%cnv(info,amold=amold,vmold=vmold,imold=imold)
|
||||
end do
|
||||
end if
|
||||
|
||||
|
||||
end subroutine amg_s_cnv
|
||||
|
||||
subroutine amg_s_clone(prec,precout,info)
|
||||
|
||||
implicit none
|
||||
implicit none
|
||||
class(amg_sprec_type), intent(inout) :: prec
|
||||
class(psb_sprec_type), intent(inout) :: precout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
|
||||
call precout%free(info)
|
||||
if (info == 0) call amg_s_inner_clone(prec,precout,info)
|
||||
if (info == 0) call amg_s_inner_clone(prec,precout,info)
|
||||
|
||||
end subroutine amg_s_clone
|
||||
|
||||
subroutine amg_s_inner_clone(prec,precout,info)
|
||||
|
||||
implicit none
|
||||
implicit none
|
||||
class(amg_sprec_type), intent(inout) :: prec
|
||||
class(psb_sprec_type), target, intent(inout) :: precout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
@@ -821,17 +820,17 @@ contains
|
||||
pout%ctxt = prec%ctxt
|
||||
pout%ag_data = prec%ag_data
|
||||
pout%outer_sweeps = prec%outer_sweeps
|
||||
if (allocated(prec%precv)) then
|
||||
ln = size(prec%precv)
|
||||
if (allocated(prec%precv)) then
|
||||
ln = size(prec%precv)
|
||||
allocate(pout%precv(ln),stat=info)
|
||||
if (info /= psb_success_) goto 9999
|
||||
if (ln >= 1) then
|
||||
if (ln >= 1) then
|
||||
call prec%precv(1)%clone(pout%precv(1),info)
|
||||
end if
|
||||
do lev=2, ln
|
||||
if (info /= psb_success_) exit
|
||||
call prec%precv(lev)%clone(pout%precv(lev),info)
|
||||
if (info == psb_success_) then
|
||||
if (info == psb_success_) then
|
||||
pout%precv(lev)%base_a => pout%precv(lev)%ac
|
||||
pout%precv(lev)%base_desc => pout%precv(lev)%desc_ac
|
||||
pout%precv(lev)%linmap%p_desc_U => pout%precv(lev-1)%base_desc
|
||||
@@ -842,7 +841,7 @@ contains
|
||||
if (allocated(prec%precv(1)%wrk)) &
|
||||
& call pout%allocate_wrk(info,vmold=prec%precv(1)%wrk%vx2l%v)
|
||||
|
||||
class default
|
||||
class default
|
||||
write(0,*) 'Error: wrong out type'
|
||||
info = psb_err_invalid_input_
|
||||
end select
|
||||
@@ -854,14 +853,14 @@ contains
|
||||
implicit none
|
||||
class(amg_sprec_type), intent(inout) :: prec
|
||||
class(amg_sprec_type), intent(inout), target :: b
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_) :: i
|
||||
|
||||
if (same_type_as(prec,b)) then
|
||||
if (allocated(b%precv)) then
|
||||
|
||||
if (same_type_as(prec,b)) then
|
||||
if (allocated(b%precv)) then
|
||||
! This might not be required if FINAL procedures are available.
|
||||
call b%free(info)
|
||||
if (info /= psb_success_) then
|
||||
if (info /= psb_success_) then
|
||||
!?????
|
||||
!!$ return
|
||||
endif
|
||||
@@ -869,7 +868,7 @@ contains
|
||||
b%ctxt = prec%ctxt
|
||||
b%ag_data = prec%ag_data
|
||||
b%outer_sweeps = prec%outer_sweeps
|
||||
|
||||
|
||||
call move_alloc(prec%precv,b%precv)
|
||||
! Fix the pointers except on level 1.
|
||||
do i=2, size(b%precv)
|
||||
@@ -878,7 +877,7 @@ contains
|
||||
b%precv(i)%linmap%p_desc_U => b%precv(i-1)%base_desc
|
||||
b%precv(i)%linmap%p_desc_V => b%precv(i)%base_desc
|
||||
end do
|
||||
|
||||
|
||||
else
|
||||
write(0,*) 'Warning: PREC%move_alloc onto different type?'
|
||||
info = psb_err_internal_error_
|
||||
@@ -888,7 +887,7 @@ contains
|
||||
subroutine amg_s_allocate_wrk(prec,info,vmold,desc)
|
||||
use psb_base_mod
|
||||
implicit none
|
||||
|
||||
|
||||
! Arguments
|
||||
class(amg_sprec_type), intent(inout) :: prec
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
@@ -896,37 +895,37 @@ contains
|
||||
!
|
||||
! In MLD the DESC optional argument is ignored, since
|
||||
! the necessary info is contained in the various entries of the
|
||||
! PRECV component.
|
||||
! PRECV component.
|
||||
type(psb_desc_type), intent(in), optional :: desc
|
||||
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: me,err_act,i,j,level,nlev, nc2l
|
||||
character(len=20) :: name
|
||||
|
||||
|
||||
info=psb_success_
|
||||
name = 'amg_s_allocate_wrk'
|
||||
call psb_erractionsave(err_act)
|
||||
if (psb_errstatus_fatal()) then
|
||||
info = psb_err_internal_error_; goto 9999
|
||||
end if
|
||||
nlev = size(prec%precv)
|
||||
nlev = size(prec%precv)
|
||||
level = 1
|
||||
do level = 1, nlev
|
||||
call prec%precv(level)%allocate_wrk(info,vmold=vmold)
|
||||
if (psb_errstatus_fatal()) then
|
||||
if (psb_errstatus_fatal()) then
|
||||
nc2l = prec%precv(level)%base_desc%get_local_cols()
|
||||
info=psb_err_alloc_request_
|
||||
call psb_errpush(info,name,i_err=(/2*nc2l/), a_err='real(psb_spk_)')
|
||||
goto 9999
|
||||
goto 9999
|
||||
end if
|
||||
end do
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
|
||||
|
||||
end subroutine amg_s_allocate_wrk
|
||||
|
||||
subroutine amg_s_free_wrk(prec,info)
|
||||
@@ -948,13 +947,13 @@ contains
|
||||
info = psb_err_internal_error_; goto 9999
|
||||
end if
|
||||
|
||||
if (allocated(prec%precv)) then
|
||||
nlev = size(prec%precv)
|
||||
if (allocated(prec%precv)) then
|
||||
nlev = size(prec%precv)
|
||||
do level = 1, nlev
|
||||
call prec%precv(level)%free_wrk(info)
|
||||
end do
|
||||
end if
|
||||
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
@@ -966,7 +965,7 @@ contains
|
||||
function amg_s_is_allocated_wrk(prec) result(res)
|
||||
use psb_base_mod
|
||||
implicit none
|
||||
|
||||
|
||||
! Arguments
|
||||
class(amg_sprec_type), intent(in) :: prec
|
||||
logical :: res
|
||||
@@ -974,7 +973,7 @@ contains
|
||||
res = .false.
|
||||
if (.not.allocated(prec%precv)) return
|
||||
res = allocated(prec%precv(1)%wrk)
|
||||
|
||||
|
||||
end function amg_s_is_allocated_wrk
|
||||
|
||||
end module amg_s_prec_type
|
||||
|
||||
@@ -0,0 +1,321 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_z_ainv_solver
|
||||
|
||||
use amg_z_base_ainv_mod
|
||||
use psb_base_mod, only : psb_d_vect_type
|
||||
|
||||
type, extends(amg_z_base_ainv_solver_type) :: amg_z_ainv_solver_type
|
||||
!
|
||||
! Compute an approximate factorization
|
||||
! A^-1 = Z D^-1 W^T
|
||||
! Note that here W is going to be transposed explicitly,
|
||||
! so that the component w will in the end contain W^T.
|
||||
!
|
||||
integer(psb_ipk_) :: alg, fill_in
|
||||
real(psb_dpk_) :: thresh
|
||||
contains
|
||||
procedure, pass(sv) :: check => amg_z_ainv_solver_check
|
||||
procedure, pass(sv) :: build => amg_z_ainv_solver_bld
|
||||
procedure, pass(sv) :: clone => amg_z_ainv_solver_clone
|
||||
procedure, pass(sv) :: cseti => amg_z_ainv_solver_cseti
|
||||
procedure, pass(sv) :: csetc => amg_z_ainv_solver_csetc
|
||||
procedure, pass(sv) :: csetr => amg_z_ainv_solver_csetr
|
||||
procedure, pass(sv) :: seti => amg_z_ainv_solver_seti
|
||||
procedure, pass(sv) :: setc => amg_z_ainv_solver_setc
|
||||
procedure, pass(sv) :: setr => amg_z_ainv_solver_setr
|
||||
generic, public :: set => seti, setr, setc
|
||||
procedure, pass(sv) :: descr => amg_z_ainv_solver_descr
|
||||
procedure, pass(sv) :: default => z_ainv_solver_default
|
||||
procedure, nopass :: stringval => z_ainv_stringval
|
||||
procedure, nopass :: algname => z_ainv_algname
|
||||
end type amg_z_ainv_solver_type
|
||||
|
||||
|
||||
private :: z_ainv_stringval, z_ainv_solver_default, &
|
||||
& z_ainv_algname
|
||||
|
||||
interface
|
||||
subroutine amg_z_ainv_solver_clone(sv,svout,info)
|
||||
import :: psb_desc_type, psb_zspmat_type, psb_z_base_sparse_mat, &
|
||||
& amg_z_base_solver_type, psb_dpk_, amg_z_ainv_solver_type, psb_ipk_
|
||||
Implicit None
|
||||
class(amg_z_ainv_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_ainv_solver_clone
|
||||
end interface
|
||||
|
||||
|
||||
interface
|
||||
subroutine amg_z_ainv_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
import :: psb_desc_type, psb_zspmat_type, psb_z_base_sparse_mat, &
|
||||
& psb_d_vect_type, psb_z_base_vect_type, psb_dpk_,&
|
||||
& amg_z_ainv_solver_type, psb_i_base_vect_type, psb_ipk_
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
type(psb_zspmat_type), intent(in), target :: a
|
||||
Type(psb_desc_type), Intent(inout) :: desc_a
|
||||
class(amg_z_ainv_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_ainv_solver_bld
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_z_ainv_solver_check(sv,info)
|
||||
import :: psb_dpk_, amg_z_ainv_solver_type, psb_ipk_
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_z_ainv_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_z_ainv_solver_check
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_z_ainv_solver_cseti(sv,what,val,info,idx)
|
||||
import :: psb_desc_type, psb_zspmat_type, psb_z_base_sparse_mat, psb_ipk_,&
|
||||
& psb_d_vect_type, psb_z_base_vect_type, psb_dpk_, amg_z_ainv_solver_type
|
||||
Implicit None
|
||||
! Arguments
|
||||
class(amg_z_ainv_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
|
||||
end subroutine amg_z_ainv_solver_cseti
|
||||
end interface
|
||||
|
||||
|
||||
interface
|
||||
subroutine amg_z_ainv_solver_csetc(sv,what,val,info,idx)
|
||||
import :: psb_desc_type, psb_zspmat_type, psb_z_base_sparse_mat, psb_ipk_,&
|
||||
& psb_d_vect_type, psb_z_base_vect_type, psb_dpk_, amg_z_ainv_solver_type
|
||||
Implicit None
|
||||
! Arguments
|
||||
class(amg_z_ainv_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
|
||||
end subroutine amg_z_ainv_solver_csetc
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_z_ainv_solver_csetr(sv,what,val,info,idx)
|
||||
import :: psb_desc_type, psb_zspmat_type, psb_z_base_sparse_mat, psb_ipk_,&
|
||||
& psb_d_vect_type, psb_z_base_vect_type, psb_dpk_, amg_z_ainv_solver_type
|
||||
Implicit None
|
||||
! Arguments
|
||||
class(amg_z_ainv_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
|
||||
end subroutine amg_z_ainv_solver_csetr
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_z_ainv_solver_setc(sv,what,val,info)
|
||||
import :: amg_z_ainv_solver_type, psb_ipk_
|
||||
Implicit none
|
||||
! Arguments
|
||||
class(amg_z_ainv_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(in) :: what
|
||||
character(len=*), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_z_ainv_solver_setc
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_z_ainv_solver_seti(sv,what,val,info)
|
||||
import :: amg_z_ainv_solver_type, psb_ipk_
|
||||
Implicit none
|
||||
! Arguments
|
||||
class(amg_z_ainv_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(in) :: what
|
||||
integer(psb_ipk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_z_ainv_solver_seti
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_z_ainv_solver_setr(sv,what,val,info)
|
||||
import :: amg_z_ainv_solver_type, psb_ipk_, psb_dpk_
|
||||
Implicit none
|
||||
! Arguments
|
||||
class(amg_z_ainv_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(in) :: what
|
||||
real(psb_dpk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_z_ainv_solver_setr
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_z_ainv_solver_descr(sv,info,iout,coarse)
|
||||
import :: psb_dpk_, amg_z_ainv_solver_type, psb_ipk_
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_z_ainv_solver_type), intent(in) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(in), optional :: iout
|
||||
logical, intent(in), optional :: coarse
|
||||
|
||||
end subroutine amg_z_ainv_solver_descr
|
||||
end interface
|
||||
|
||||
interface amg_ainv_bld
|
||||
subroutine amg_z_ainv_bld(a,alg,fillin,thresh,wmat,d,zmat,desc,info,blck,iscale)
|
||||
import :: psb_desc_type, psb_zspmat_type, psb_z_base_sparse_mat, &
|
||||
& psb_d_vect_type, psb_z_base_vect_type, psb_dpk_, psb_ipk_
|
||||
implicit none
|
||||
type(psb_zspmat_type), intent(in), target :: a
|
||||
integer(psb_ipk_), intent(in) :: fillin,alg
|
||||
real(psb_dpk_), intent(in) :: thresh
|
||||
type(psb_zspmat_type), intent(inout) :: wmat, zmat
|
||||
complex(psb_dpk_), allocatable :: d(:)
|
||||
Type(psb_desc_type), Intent(inout) :: desc
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
type(psb_zspmat_type), intent(in), optional :: blck
|
||||
integer(psb_ipk_), intent(in), optional :: iscale
|
||||
end subroutine amg_z_ainv_bld
|
||||
end interface
|
||||
|
||||
|
||||
contains
|
||||
|
||||
subroutine z_ainv_solver_default(sv)
|
||||
|
||||
use psb_base_mod
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_z_ainv_solver_type), intent(inout) :: sv
|
||||
|
||||
sv%alg = amg_ainv_llk_
|
||||
sv%fill_in = 0
|
||||
sv%thresh = dzero
|
||||
|
||||
return
|
||||
end subroutine z_ainv_solver_default
|
||||
|
||||
function is_positive_nz_min(ip) result(res)
|
||||
implicit none
|
||||
integer(psb_ipk_), intent(in) :: ip
|
||||
logical :: res
|
||||
|
||||
res = (ip >= 1)
|
||||
return
|
||||
end function is_positive_nz_min
|
||||
|
||||
|
||||
function z_ainv_stringval(string) result(val)
|
||||
use psb_base_mod, only : psb_ipk_,psb_toupper
|
||||
implicit none
|
||||
! Arguments
|
||||
character(len=*), intent(in) :: string
|
||||
integer(psb_ipk_) :: val
|
||||
character(len=*), parameter :: name='d_ainv_stringval'
|
||||
|
||||
select case(psb_toupper(trim(string)))
|
||||
case('LLK')
|
||||
val = amg_ainv_llk_
|
||||
case('STAB-LLK')
|
||||
val = amg_ainv_s_ft_llk_
|
||||
case('SYM-LLK')
|
||||
val = amg_ainv_s_llk_
|
||||
case('MLK')
|
||||
val = amg_ainv_mlk_
|
||||
#if defined(HAVE_TUMA_SAINV)
|
||||
case('SAINV-TUMA')
|
||||
val = amg_ainv_s_tuma_
|
||||
case('LAINV-TUMA')
|
||||
val = amg_ainv_l_tuma_
|
||||
#endif
|
||||
case default
|
||||
val = amg_stringval(string)
|
||||
end select
|
||||
end function z_ainv_stringval
|
||||
|
||||
|
||||
function z_ainv_algname(ialg) result(val)
|
||||
integer(psb_ipk_), intent(in) :: ialg
|
||||
character(len=40) :: val
|
||||
|
||||
character(len=*), parameter :: mlkname = 'Left-looking, list merge '
|
||||
character(len=*), parameter :: llkname = 'Left-looking '
|
||||
character(len=*), parameter :: stabllkname = 'Stabilized Left-looking '
|
||||
character(len=*), parameter :: sllkname = 'Symmetric Left-looking '
|
||||
character(len=*), parameter :: sainvname = 'SAINV (Benzi & Tuma) '
|
||||
character(len=*), parameter :: lainvname = 'LAINV (Benzi & Tuma) '
|
||||
character(len=*), parameter :: defname = 'Unknown alg variant '
|
||||
|
||||
select case (ialg)
|
||||
case(amg_ainv_mlk_)
|
||||
val = mlkname
|
||||
case(amg_ainv_llk_)
|
||||
val = llkname
|
||||
case(amg_ainv_s_llk_)
|
||||
val = sllkname
|
||||
case(amg_ainv_s_ft_llk_)
|
||||
val = stabllkname
|
||||
#if defined(HAVE_TUMA_SAINV)
|
||||
case(amg_ainv_s_tuma_ )
|
||||
val = sainvname
|
||||
case(amg_ainv_l_tuma_ )
|
||||
val = lainvname
|
||||
#endif
|
||||
case default
|
||||
val = defname
|
||||
end select
|
||||
|
||||
end function z_ainv_algname
|
||||
|
||||
end module amg_z_ainv_solver
|
||||
@@ -0,0 +1,199 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_z_base_ainv_mod
|
||||
|
||||
use amg_base_ainv_mod
|
||||
use amg_z_base_solver_mod
|
||||
use psb_z_ainv_tools_mod
|
||||
use psb_base_mod, only : psb_z_vect_type, psb_dpk_, psb_epk_
|
||||
|
||||
|
||||
|
||||
type, extends(amg_z_base_solver_type) :: amg_z_base_ainv_solver_type
|
||||
!
|
||||
! Compute an approximate factorization
|
||||
! A^-1 = Z D^-1 W^T
|
||||
! Note that here W is going to be transposed explicitly,
|
||||
! so that the component w will in the end contain W^T.
|
||||
!
|
||||
type(psb_zspmat_type) :: w, z
|
||||
type(psb_z_vect_type) :: dv
|
||||
complex(psb_dpk_), allocatable :: d(:)
|
||||
|
||||
contains
|
||||
procedure, pass(sv) :: cnv => amg_z_base_ainv_solver_cnv
|
||||
procedure, pass(sv) :: dump => amg_z_base_ainv_solver_dmp
|
||||
procedure, pass(sv) :: apply_v => amg_z_base_ainv_solver_apply_vect
|
||||
procedure, pass(sv) :: apply_a => amg_z_base_ainv_solver_apply
|
||||
procedure, pass(sv) :: free => amg_z_base_ainv_solver_free
|
||||
procedure, pass(sv) :: sizeof => z_base_ainv_solver_sizeof
|
||||
procedure, pass(sv) :: get_nzeros => z_base_ainv_get_nzeros
|
||||
procedure, nopass :: get_wrksz => z_base_ainv_get_wrksize
|
||||
procedure, pass(sv) :: update_a => amg_z_base_ainv_update_a
|
||||
generic, public :: update => update_a
|
||||
end type amg_z_base_ainv_solver_type
|
||||
|
||||
private :: z_base_ainv_solver_sizeof, &
|
||||
& z_base_ainv_get_nzeros, z_base_ainv_get_wrksize
|
||||
|
||||
|
||||
interface
|
||||
subroutine amg_z_base_ainv_solver_cnv(sv,info,amold,vmold,imold)
|
||||
import :: psb_z_base_sparse_mat, psb_z_base_vect_type, psb_dpk_, &
|
||||
& amg_z_base_ainv_solver_type, psb_ipk_, psb_i_base_vect_type
|
||||
Implicit None
|
||||
! Arguments
|
||||
class(amg_z_base_ainv_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_base_ainv_solver_cnv
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_z_base_ainv_update_a(sv,x,desc_data,info)
|
||||
import :: psb_desc_type, psb_dpk_,amg_z_base_ainv_solver_type, psb_z_vect_type, psb_ipk_
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(amg_z_base_ainv_solver_type), intent(inout) :: sv
|
||||
complex(psb_dpk_),intent(in) :: x(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_z_base_ainv_update_a
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_z_base_ainv_solver_apply(alpha,sv,x,beta,y,desc_data,&
|
||||
& trans,work,info,init,initu)
|
||||
import :: psb_desc_type, psb_dpk_,amg_z_base_ainv_solver_type, psb_ipk_
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(amg_z_base_ainv_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_base_ainv_solver_apply
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_z_base_ainv_solver_apply_vect(alpha,sv,x,beta,y,desc_data,&
|
||||
& trans,work,wv,info,init,initu)
|
||||
import :: psb_desc_type, psb_dpk_,amg_z_base_ainv_solver_type, psb_z_vect_type, psb_ipk_
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(amg_z_base_ainv_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_base_ainv_solver_apply_vect
|
||||
end interface
|
||||
|
||||
|
||||
interface
|
||||
subroutine amg_z_base_ainv_solver_free(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_base_ainv_solver_type, psb_ipk_
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_z_base_ainv_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_z_base_ainv_solver_free
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_z_base_ainv_solver_dmp(sv,desc,level,info,prefix,head,solver,global_num)
|
||||
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_ainv_solver_type, psb_ipk_
|
||||
|
||||
implicit none
|
||||
class(amg_z_base_ainv_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_base_ainv_solver_dmp
|
||||
end interface
|
||||
|
||||
contains
|
||||
|
||||
function z_base_ainv_get_nzeros(sv) result(val)
|
||||
implicit none
|
||||
! Arguments
|
||||
class(amg_z_base_ainv_solver_type), intent(in) :: sv
|
||||
integer(psb_epk_) :: val
|
||||
integer :: i
|
||||
|
||||
val = 0
|
||||
val = val + sv%dv%get_nrows()
|
||||
val = val + sv%w%get_nzeros()
|
||||
val = val + sv%z%get_nzeros()
|
||||
|
||||
return
|
||||
end function z_base_ainv_get_nzeros
|
||||
|
||||
function z_base_ainv_solver_sizeof(sv) result(val)
|
||||
implicit none
|
||||
! Arguments
|
||||
class(amg_z_base_ainv_solver_type), intent(in) :: sv
|
||||
integer(psb_epk_) :: val
|
||||
integer :: i
|
||||
|
||||
val = 2*psb_sizeof_ip + psb_sizeof_dp
|
||||
val = val + sv%dv%sizeof()
|
||||
val = val + sv%w%sizeof()
|
||||
val = val + sv%z%sizeof()
|
||||
|
||||
return
|
||||
end function z_base_ainv_solver_sizeof
|
||||
|
||||
function z_base_ainv_get_wrksize() result(val)
|
||||
implicit none
|
||||
integer(psb_ipk_) :: val
|
||||
|
||||
val = 2
|
||||
end function z_base_ainv_get_wrksize
|
||||
|
||||
end module amg_z_base_ainv_mod
|
||||
@@ -0,0 +1,168 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_z_invk_solver
|
||||
|
||||
use amg_z_base_solver_mod
|
||||
use amg_z_base_ainv_mod
|
||||
use psb_base_mod, only : psb_z_vect_type
|
||||
|
||||
type, extends(amg_z_base_ainv_solver_type) :: amg_z_invk_solver_type
|
||||
integer(psb_ipk_) :: fill_in, inv_fill
|
||||
contains
|
||||
procedure, pass(sv) :: check => amg_z_invk_solver_check
|
||||
procedure, pass(sv) :: clone => amg_z_invk_solver_clone
|
||||
procedure, pass(sv) :: build => amg_z_invk_solver_bld
|
||||
procedure, pass(sv) :: cseti => amg_z_invk_solver_cseti
|
||||
procedure, pass(sv) :: seti => amg_z_invk_solver_seti
|
||||
generic, public :: set => seti
|
||||
procedure, pass(sv) :: descr => amg_z_invk_solver_descr
|
||||
procedure, pass(sv) :: default => z_invk_solver_default
|
||||
end type amg_z_invk_solver_type
|
||||
|
||||
|
||||
private :: z_invk_solver_default
|
||||
|
||||
|
||||
interface
|
||||
subroutine amg_z_invk_solver_clone(sv,svout,info)
|
||||
import :: psb_desc_type, psb_zspmat_type, psb_z_base_sparse_mat, &
|
||||
& amg_z_base_solver_type, psb_dpk_, amg_z_invk_solver_type, psb_ipk_
|
||||
Implicit None
|
||||
class(amg_z_invk_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_invk_solver_clone
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_z_invk_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
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_invk_solver_type, psb_i_base_vect_type, psb_ipk_
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
type(psb_zspmat_type), intent(in), target :: a
|
||||
Type(psb_desc_type), Intent(inout) :: desc_a
|
||||
class(amg_z_invk_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_invk_solver_bld
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_z_invk_solver_check(sv,info)
|
||||
import :: psb_dpk_, amg_z_invk_solver_type, psb_ipk_
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_z_invk_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_z_invk_solver_check
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_z_invk_solver_cseti(sv,what,val,info,idx)
|
||||
import :: psb_desc_type, psb_zspmat_type, psb_z_base_sparse_mat, &
|
||||
& psb_ipk_, psb_z_vect_type, psb_z_base_vect_type, psb_dpk_, &
|
||||
& amg_z_invk_solver_type
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_z_invk_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
|
||||
end subroutine amg_z_invk_solver_cseti
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_z_invk_solver_descr(sv,info,iout,coarse)
|
||||
import :: psb_dpk_, amg_z_invk_solver_type, psb_ipk_
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_z_invk_solver_type), intent(in) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(in), optional :: iout
|
||||
logical, intent(in), optional :: coarse
|
||||
|
||||
end subroutine amg_z_invk_solver_descr
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_z_invk_solver_seti(sv,what,val,info)
|
||||
import :: amg_z_invk_solver_type, psb_ipk_
|
||||
Implicit none
|
||||
! Arguments
|
||||
class(amg_z_invk_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(in) :: what
|
||||
integer(psb_ipk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_z_invk_solver_seti
|
||||
end interface
|
||||
|
||||
contains
|
||||
|
||||
subroutine z_invk_solver_default(sv)
|
||||
|
||||
!use psb_base_mod
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_z_invk_solver_type), intent(inout) :: sv
|
||||
|
||||
sv%fill_in = 0
|
||||
sv%inv_fill = 0
|
||||
|
||||
return
|
||||
end subroutine z_invk_solver_default
|
||||
|
||||
end module amg_z_invk_solver
|
||||
@@ -0,0 +1,194 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_z_invt_solver
|
||||
|
||||
use amg_z_base_solver_mod
|
||||
use amg_z_base_ainv_mod
|
||||
use psb_base_mod, only : psb_z_vect_type
|
||||
|
||||
type, extends(amg_z_base_ainv_solver_type) :: amg_z_invt_solver_type
|
||||
integer(psb_ipk_) :: fill_in, inv_fill
|
||||
real(psb_dpk_) :: thresh, inv_thresh
|
||||
contains
|
||||
procedure, pass(sv) :: check => amg_z_invt_solver_check
|
||||
procedure, pass(sv) :: clone => amg_z_invt_solver_clone
|
||||
procedure, pass(sv) :: build => amg_z_invt_solver_bld
|
||||
procedure, pass(sv) :: cseti => amg_z_invt_solver_cseti
|
||||
procedure, pass(sv) :: csetr => amg_z_invt_solver_csetr
|
||||
procedure, pass(sv) :: seti => amg_z_invt_solver_seti
|
||||
procedure, pass(sv) :: setr => amg_z_invt_solver_setr
|
||||
generic, public :: set => seti, setr
|
||||
procedure, pass(sv) :: descr => amg_z_invt_solver_descr
|
||||
procedure, pass(sv) :: default => z_invt_solver_default
|
||||
end type amg_z_invt_solver_type
|
||||
|
||||
private :: z_invt_solver_default
|
||||
|
||||
|
||||
interface
|
||||
subroutine amg_z_invt_solver_clone(sv,svout,info)
|
||||
import :: psb_desc_type, psb_zspmat_type, psb_z_base_sparse_mat, &
|
||||
& amg_z_base_solver_type, psb_dpk_, amg_z_invt_solver_type, psb_ipk_
|
||||
Implicit None
|
||||
class(amg_z_invt_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_invt_solver_clone
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_z_invt_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
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_invt_solver_type, psb_i_base_vect_type, psb_ipk_
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
type(psb_zspmat_type), intent(in), target :: a
|
||||
Type(psb_desc_type), Intent(inout) :: desc_a
|
||||
class(amg_z_invt_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_invt_solver_bld
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_z_invt_solver_check(sv,info)
|
||||
import :: amg_z_invt_solver_type, psb_ipk_
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_z_invt_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_z_invt_solver_check
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_z_invt_solver_cseti(sv,what,val,info,idx)
|
||||
import :: psb_desc_type, psb_zspmat_type, psb_z_base_sparse_mat, psb_ipk_,&
|
||||
& psb_z_vect_type, psb_z_base_vect_type, psb_dpk_, amg_z_invt_solver_type
|
||||
Implicit None
|
||||
! Arguments
|
||||
class(amg_z_invt_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
|
||||
end subroutine amg_z_invt_solver_cseti
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_z_invt_solver_csetr(sv,what,val,info,idx)
|
||||
import :: psb_desc_type, psb_zspmat_type, psb_z_base_sparse_mat, psb_ipk_,&
|
||||
& psb_z_vect_type, psb_z_base_vect_type, psb_dpk_, amg_z_invt_solver_type
|
||||
Implicit None
|
||||
! Arguments
|
||||
class(amg_z_invt_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
|
||||
end subroutine amg_z_invt_solver_csetr
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_z_invt_solver_descr(sv,info,iout,coarse)
|
||||
import :: psb_dpk_, amg_z_invt_solver_type, psb_ipk_
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_z_invt_solver_type), intent(in) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(in), optional :: iout
|
||||
logical, intent(in), optional :: coarse
|
||||
|
||||
end subroutine amg_z_invt_solver_descr
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_z_invt_solver_setr(sv,what,val,info)
|
||||
import :: amg_z_invt_solver_type, psb_dpk_, psb_ipk_
|
||||
Implicit none
|
||||
! Arguments
|
||||
class(amg_z_invt_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(in) :: what
|
||||
real(psb_dpk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine amg_z_invt_solver_setr
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine amg_z_invt_solver_seti(sv,what,val,info)
|
||||
import :: amg_z_invt_solver_type, psb_ipk_
|
||||
Implicit none
|
||||
! Arguments
|
||||
class(amg_z_invt_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(in) :: what
|
||||
integer(psb_ipk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine
|
||||
end interface
|
||||
|
||||
contains
|
||||
|
||||
subroutine z_invt_solver_default(sv)
|
||||
|
||||
!use psb_base_mod
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_z_invt_solver_type), intent(inout) :: sv
|
||||
|
||||
sv%fill_in = 0
|
||||
sv%inv_fill = 0
|
||||
sv%thresh = dzero
|
||||
sv%inv_thresh = dzero
|
||||
|
||||
return
|
||||
end subroutine z_invt_solver_default
|
||||
|
||||
end module amg_z_invt_solver
|
||||
+19
-16
@@ -1,15 +1,15 @@
|
||||
!
|
||||
!
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! 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:
|
||||
@@ -21,7 +21,7 @@
|
||||
! 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
|
||||
@@ -33,8 +33,8 @@
|
||||
! 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_prec_mod.f90
|
||||
!
|
||||
! Module: amg_z_prec_mod
|
||||
@@ -52,6 +52,9 @@ module amg_z_prec_mod
|
||||
use amg_z_l1_diag_solver
|
||||
use amg_z_ilu_solver
|
||||
use amg_z_gs_solver
|
||||
use amg_z_ainv_solver
|
||||
use amg_z_invk_solver
|
||||
use amg_z_invt_solver
|
||||
|
||||
interface amg_precset
|
||||
module procedure amg_z_iprecsetsm, amg_z_iprecsetsv, &
|
||||
@@ -78,7 +81,7 @@ module amg_z_prec_mod
|
||||
! !$ character, intent(in), optional :: upd
|
||||
end subroutine amg_z_extprol_bld
|
||||
end interface amg_extprol_bld
|
||||
|
||||
|
||||
contains
|
||||
|
||||
subroutine amg_z_iprecsetsm(p,val,info,pos)
|
||||
@@ -108,7 +111,7 @@ contains
|
||||
|
||||
subroutine amg_z_cprecseti(p,what,val,info,pos)
|
||||
type(amg_zprec_type), intent(inout) :: p
|
||||
character(len=*), intent(in) :: what
|
||||
character(len=*), intent(in) :: what
|
||||
integer(psb_ipk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
character(len=*), optional, intent(in) :: pos
|
||||
@@ -118,7 +121,7 @@ contains
|
||||
|
||||
subroutine amg_z_cprecsetr(p,what,val,info,pos)
|
||||
type(amg_zprec_type), intent(inout) :: p
|
||||
character(len=*), intent(in) :: what
|
||||
character(len=*), intent(in) :: what
|
||||
real(psb_dpk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
character(len=*), optional, intent(in) :: pos
|
||||
@@ -128,7 +131,7 @@ contains
|
||||
|
||||
subroutine amg_z_cprecsetc(p,what,val,info,pos)
|
||||
type(amg_zprec_type), intent(inout) :: p
|
||||
character(len=*), intent(in) :: what
|
||||
character(len=*), intent(in) :: what
|
||||
character(len=*), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
character(len=*), optional, intent(in) :: pos
|
||||
|
||||
+144
-145
@@ -1,15 +1,15 @@
|
||||
!
|
||||
!
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! 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:
|
||||
@@ -21,7 +21,7 @@
|
||||
! 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
|
||||
@@ -33,21 +33,21 @@
|
||||
! 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_prec_type.f90
|
||||
!
|
||||
! Module: amg_z_prec_type
|
||||
!
|
||||
! This module defines:
|
||||
! This module defines:
|
||||
! - the amg_z_prec_type data structure containing the preconditioner and related
|
||||
! data structures;
|
||||
!
|
||||
! It contains routines for
|
||||
! - Building and applying;
|
||||
! - Building and applying;
|
||||
! - checking if the preconditioner is correctly defined;
|
||||
! - printing a description of the preconditioner;
|
||||
! - deallocating the preconditioner data structure.
|
||||
! - deallocating the preconditioner data structure.
|
||||
!
|
||||
|
||||
module amg_z_prec_type
|
||||
@@ -70,25 +70,25 @@ module amg_z_prec_type
|
||||
! It consists of an array of 'one-level' intermediate data structures
|
||||
! of type amg_zonelev_type, each containing the information needed to apply
|
||||
! the smoothing and the coarse-space correction at a generic level. RT is the
|
||||
! real data type, i.e. S for both S and C, and D for both D and Z.
|
||||
! real data type, i.e. S for both S and C, and D for both D and Z.
|
||||
!
|
||||
! type amg_zprec_type
|
||||
! type(amg_zonelev_type), allocatable :: precv(:)
|
||||
! type(amg_zonelev_type), allocatable :: precv(:)
|
||||
! end type amg_zprec_type
|
||||
!
|
||||
!
|
||||
! Note that the levels are numbered in increasing order starting from
|
||||
! the level 1 as the finest one, and the number of levels is given by
|
||||
! size(precv(:)) which is the id of the coarsest level.
|
||||
! size(precv(:)) which is the id of the coarsest level.
|
||||
! In the multigrid literature many authors number the levels in the opposite
|
||||
! order, with level 0 being the id of the coarsest level.
|
||||
!
|
||||
!
|
||||
integer, parameter, private :: wv_size_=4
|
||||
|
||||
|
||||
type, extends(psb_zprec_type) :: amg_zprec_type
|
||||
type(amg_daggr_data) :: ag_data
|
||||
!
|
||||
! Number of outer sweeps. Sometimes 2 V-cycles may be better than 1 W-cycle.
|
||||
! Number of outer sweeps. Sometimes 2 V-cycles may be better than 1 W-cycle.
|
||||
!
|
||||
integer(psb_ipk_) :: outer_sweeps = 1
|
||||
!
|
||||
@@ -97,11 +97,11 @@ module amg_z_prec_type
|
||||
! to keep track against what is put later in the multilevel array
|
||||
!
|
||||
integer(psb_ipk_) :: coarse_solver = -1
|
||||
|
||||
|
||||
!
|
||||
! The multilevel hierarchy
|
||||
!
|
||||
type(amg_z_onelev_type), allocatable :: precv(:)
|
||||
type(amg_z_onelev_type), allocatable :: precv(:)
|
||||
contains
|
||||
procedure, pass(prec) :: psb_z_apply2_vect => amg_z_apply2_vect
|
||||
procedure, pass(prec) :: psb_z_apply1_vect => amg_z_apply1_vect
|
||||
@@ -157,7 +157,7 @@ module amg_z_prec_type
|
||||
interface amg_precdescr
|
||||
subroutine amg_zfile_prec_descr(prec,iout,root)
|
||||
import :: amg_zprec_type, psb_ipk_
|
||||
implicit none
|
||||
implicit none
|
||||
! Arguments
|
||||
class(amg_zprec_type), intent(in) :: prec
|
||||
integer(psb_ipk_), intent(in), optional :: iout
|
||||
@@ -211,7 +211,7 @@ module amg_z_prec_type
|
||||
end subroutine amg_zprecaply1
|
||||
end interface
|
||||
|
||||
interface
|
||||
interface
|
||||
subroutine amg_zprecsetsm(prec,val,info,ilev,ilmax,pos)
|
||||
import :: psb_zspmat_type, psb_desc_type, psb_dpk_, &
|
||||
& amg_zprec_type, amg_z_base_smoother_type, psb_ipk_
|
||||
@@ -243,7 +243,7 @@ module amg_z_prec_type
|
||||
import :: psb_zspmat_type, psb_desc_type, psb_dpk_, &
|
||||
& amg_zprec_type, psb_ipk_
|
||||
class(amg_zprec_type), intent(inout) :: prec
|
||||
character(len=*), intent(in) :: what
|
||||
character(len=*), intent(in) :: what
|
||||
integer(psb_ipk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: ilev,ilmax,idx
|
||||
@@ -253,7 +253,7 @@ module amg_z_prec_type
|
||||
import :: psb_zspmat_type, psb_desc_type, psb_dpk_, &
|
||||
& amg_zprec_type, psb_ipk_
|
||||
class(amg_zprec_type), intent(inout) :: prec
|
||||
character(len=*), intent(in) :: what
|
||||
character(len=*), intent(in) :: what
|
||||
real(psb_dpk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: ilev,ilmax,idx
|
||||
@@ -263,7 +263,7 @@ module amg_z_prec_type
|
||||
import :: psb_zspmat_type, psb_desc_type, psb_dpk_, &
|
||||
& amg_zprec_type, psb_ipk_
|
||||
class(amg_zprec_type), intent(inout) :: prec
|
||||
character(len=*), intent(in) :: what
|
||||
character(len=*), intent(in) :: what
|
||||
character(len=*), intent(in) :: string
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: ilev,ilmax,idx
|
||||
@@ -341,28 +341,28 @@ module amg_z_prec_type
|
||||
! character, intent(in),optional :: upd
|
||||
end subroutine amg_z_smoothers_bld
|
||||
end interface amg_smoothers_bld
|
||||
|
||||
|
||||
contains
|
||||
!
|
||||
! Function returning a pointer to the smoother
|
||||
!
|
||||
function amg_z_get_smootherp(prec,ilev) result(val)
|
||||
implicit none
|
||||
implicit none
|
||||
class(amg_zprec_type), target, intent(in) :: prec
|
||||
integer(psb_ipk_), optional :: ilev
|
||||
class(amg_z_base_smoother_type), pointer :: val
|
||||
integer(psb_ipk_) :: ilev_
|
||||
|
||||
|
||||
val => null()
|
||||
if (present(ilev)) then
|
||||
if (present(ilev)) then
|
||||
ilev_ = ilev
|
||||
else
|
||||
! What is a good default?
|
||||
! What is a good default?
|
||||
ilev_ = 1
|
||||
end if
|
||||
if (allocated(prec%precv)) then
|
||||
if ((1<=ilev_).and.(ilev_<=size(prec%precv))) then
|
||||
if (allocated(prec%precv(ilev_)%sm)) then
|
||||
if (allocated(prec%precv)) then
|
||||
if ((1<=ilev_).and.(ilev_<=size(prec%precv))) then
|
||||
if (allocated(prec%precv(ilev_)%sm)) then
|
||||
val => prec%precv(ilev_)%sm
|
||||
end if
|
||||
end if
|
||||
@@ -372,23 +372,23 @@ contains
|
||||
! Function returning a pointer to the solver
|
||||
!
|
||||
function amg_z_get_solverp(prec,ilev) result(val)
|
||||
implicit none
|
||||
implicit none
|
||||
class(amg_zprec_type), target, intent(in) :: prec
|
||||
integer(psb_ipk_), optional :: ilev
|
||||
class(amg_z_base_solver_type), pointer :: val
|
||||
integer(psb_ipk_) :: ilev_
|
||||
|
||||
|
||||
val => null()
|
||||
if (present(ilev)) then
|
||||
if (present(ilev)) then
|
||||
ilev_ = ilev
|
||||
else
|
||||
! What is a good default?
|
||||
! What is a good default?
|
||||
ilev_ = 1
|
||||
end if
|
||||
if (allocated(prec%precv)) then
|
||||
if ((1<=ilev_).and.(ilev_<=size(prec%precv))) then
|
||||
if (allocated(prec%precv(ilev_)%sm)) then
|
||||
if (allocated(prec%precv(ilev_)%sm%sv)) then
|
||||
if (allocated(prec%precv)) then
|
||||
if ((1<=ilev_).and.(ilev_<=size(prec%precv))) then
|
||||
if (allocated(prec%precv(ilev_)%sm)) then
|
||||
if (allocated(prec%precv(ilev_)%sm%sv)) then
|
||||
val => prec%precv(ilev_)%sm%sv
|
||||
end if
|
||||
end if
|
||||
@@ -399,25 +399,25 @@ contains
|
||||
! Function returning the size of the precv(:) array
|
||||
!
|
||||
function amg_z_get_nlevs(prec) result(val)
|
||||
implicit none
|
||||
implicit none
|
||||
class(amg_zprec_type), intent(in) :: prec
|
||||
integer(psb_ipk_) :: val
|
||||
val = 0
|
||||
if (allocated(prec%precv)) then
|
||||
if (allocated(prec%precv)) then
|
||||
val = size(prec%precv)
|
||||
end if
|
||||
end function amg_z_get_nlevs
|
||||
!
|
||||
! Function returning the size of the amg_prec_type data structure
|
||||
! in bytes or in number of nonzeros of the operator(s) involved.
|
||||
! in bytes or in number of nonzeros of the operator(s) involved.
|
||||
!
|
||||
function amg_z_get_nzeros(prec) result(val)
|
||||
implicit none
|
||||
implicit none
|
||||
class(amg_zprec_type), intent(in) :: prec
|
||||
integer(psb_epk_) :: val
|
||||
integer(psb_ipk_) :: i
|
||||
val = 0
|
||||
if (allocated(prec%precv)) then
|
||||
if (allocated(prec%precv)) then
|
||||
do i=1, size(prec%precv)
|
||||
val = val + prec%precv(i)%get_nzeros()
|
||||
end do
|
||||
@@ -425,13 +425,13 @@ contains
|
||||
end function amg_z_get_nzeros
|
||||
|
||||
function amg_zprec_sizeof(prec) result(val)
|
||||
implicit none
|
||||
implicit none
|
||||
class(amg_zprec_type), intent(in) :: prec
|
||||
integer(psb_epk_) :: val
|
||||
integer(psb_ipk_) :: i
|
||||
val = 0
|
||||
val = val + psb_sizeof_ip
|
||||
if (allocated(prec%precv)) then
|
||||
if (allocated(prec%precv)) then
|
||||
do i=1, size(prec%precv)
|
||||
val = val + prec%precv(i)%sizeof()
|
||||
end do
|
||||
@@ -444,40 +444,40 @@ contains
|
||||
! various level to the nonzeroes at the fine level
|
||||
! (original matrix)
|
||||
!
|
||||
|
||||
|
||||
function amg_z_get_compl(prec) result(val)
|
||||
implicit none
|
||||
implicit none
|
||||
class(amg_zprec_type), intent(in) :: prec
|
||||
complex(psb_dpk_) :: val
|
||||
|
||||
|
||||
val = prec%ag_data%op_complexity
|
||||
|
||||
end function amg_z_get_compl
|
||||
|
||||
subroutine amg_z_cmp_compl(prec)
|
||||
|
||||
implicit none
|
||||
subroutine amg_z_cmp_compl(prec)
|
||||
|
||||
implicit none
|
||||
class(amg_zprec_type), intent(inout) :: prec
|
||||
|
||||
|
||||
real(psb_dpk_) :: num, den, nmin
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: il
|
||||
integer(psb_ipk_) :: il
|
||||
|
||||
num = -done
|
||||
den = done
|
||||
ctxt = prec%ctxt
|
||||
if (allocated(prec%precv)) then
|
||||
if (allocated(prec%precv)) then
|
||||
il = 1
|
||||
num = prec%precv(il)%base_a%get_nzeros()
|
||||
if (num >= dzero) then
|
||||
den = num
|
||||
den = num
|
||||
do il=2,size(prec%precv)
|
||||
num = num + max(0,prec%precv(il)%base_a%get_nzeros())
|
||||
end do
|
||||
end if
|
||||
end if
|
||||
nmin = num
|
||||
call psb_min(ctxt,nmin)
|
||||
call psb_min(ctxt,nmin)
|
||||
if (nmin < dzero) then
|
||||
num = dzero
|
||||
den = done
|
||||
@@ -487,25 +487,25 @@ contains
|
||||
end if
|
||||
prec%ag_data%op_complexity = num/den
|
||||
end subroutine amg_z_cmp_compl
|
||||
|
||||
|
||||
!
|
||||
! Average coarsening ratio
|
||||
!
|
||||
|
||||
|
||||
function amg_z_get_avg_cr(prec) result(val)
|
||||
implicit none
|
||||
implicit none
|
||||
class(amg_zprec_type), intent(in) :: prec
|
||||
complex(psb_dpk_) :: val
|
||||
|
||||
|
||||
val = prec%ag_data%avg_cr
|
||||
|
||||
end function amg_z_get_avg_cr
|
||||
|
||||
subroutine amg_z_cmp_avg_cr(prec)
|
||||
|
||||
implicit none
|
||||
subroutine amg_z_cmp_avg_cr(prec)
|
||||
|
||||
implicit none
|
||||
class(amg_zprec_type), intent(inout) :: prec
|
||||
|
||||
|
||||
real(psb_dpk_) :: avgcr
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: il, nl, iam, np
|
||||
@@ -519,12 +519,12 @@ contains
|
||||
do il=2,nl
|
||||
avgcr = avgcr + max(dzero,prec%precv(il)%szratio)
|
||||
end do
|
||||
avgcr = avgcr / (nl-1)
|
||||
avgcr = avgcr / (nl-1)
|
||||
end if
|
||||
call psb_sum(ctxt,avgcr)
|
||||
call psb_sum(ctxt,avgcr)
|
||||
prec%ag_data%avg_cr = avgcr/np
|
||||
end subroutine amg_z_cmp_avg_cr
|
||||
|
||||
|
||||
!
|
||||
! Subroutines: amg_Tprec_free
|
||||
! Version: complex
|
||||
@@ -538,74 +538,74 @@ contains
|
||||
! error code.
|
||||
!
|
||||
subroutine amg_zprecfree(p,info)
|
||||
|
||||
|
||||
implicit none
|
||||
|
||||
|
||||
! Arguments
|
||||
type(amg_zprec_type), intent(inout) :: p
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: me,err_act,i
|
||||
character(len=20) :: name
|
||||
|
||||
|
||||
info=psb_success_
|
||||
name = 'amg_zprecfree'
|
||||
call psb_erractionsave(err_act)
|
||||
if (psb_errstatus_fatal()) then
|
||||
info = psb_err_internal_error_; return
|
||||
end if
|
||||
|
||||
|
||||
me=-1
|
||||
|
||||
|
||||
call p%free(info)
|
||||
|
||||
|
||||
|
||||
return
|
||||
|
||||
|
||||
end subroutine amg_zprecfree
|
||||
|
||||
subroutine amg_z_prec_free(prec,info)
|
||||
|
||||
|
||||
implicit none
|
||||
|
||||
|
||||
! Arguments
|
||||
class(amg_zprec_type), intent(inout) :: prec
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: me,err_act,i
|
||||
character(len=20) :: name
|
||||
|
||||
|
||||
info=psb_success_
|
||||
name = 'amg_zprecfree'
|
||||
call psb_erractionsave(err_act)
|
||||
if (psb_errstatus_fatal()) then
|
||||
info = psb_err_internal_error_; goto 9999
|
||||
end if
|
||||
|
||||
|
||||
me=-1
|
||||
if (allocated(prec%precv)) then
|
||||
do i=1,size(prec%precv)
|
||||
if (allocated(prec%precv)) then
|
||||
do i=1,size(prec%precv)
|
||||
call prec%precv(i)%free(info)
|
||||
end do
|
||||
deallocate(prec%precv,stat=info)
|
||||
end if
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
|
||||
|
||||
end subroutine amg_z_prec_free
|
||||
|
||||
|
||||
|
||||
|
||||
!
|
||||
! Top level methods.
|
||||
! Top level methods.
|
||||
!
|
||||
subroutine amg_z_apply2_vect(prec,x,y,desc_data,info,trans,work)
|
||||
implicit none
|
||||
implicit none
|
||||
type(psb_desc_type),intent(in) :: desc_data
|
||||
class(amg_zprec_type), intent(inout) :: prec
|
||||
type(psb_z_vect_type),intent(inout) :: x
|
||||
@@ -618,13 +618,13 @@ contains
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select type(prec)
|
||||
select type(prec)
|
||||
type is (amg_zprec_type)
|
||||
call amg_precapply(prec,x,y,desc_data,info,trans,work)
|
||||
class default
|
||||
info = psb_err_missing_override_method_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
@@ -636,7 +636,7 @@ contains
|
||||
end subroutine amg_z_apply2_vect
|
||||
|
||||
subroutine amg_z_apply1_vect(prec,x,desc_data,info,trans,work)
|
||||
implicit none
|
||||
implicit none
|
||||
type(psb_desc_type),intent(in) :: desc_data
|
||||
class(amg_zprec_type), intent(inout) :: prec
|
||||
type(psb_z_vect_type),intent(inout) :: x
|
||||
@@ -648,13 +648,13 @@ contains
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select type(prec)
|
||||
select type(prec)
|
||||
type is (amg_zprec_type)
|
||||
call amg_precapply(prec,x,desc_data,info,trans,work)
|
||||
class default
|
||||
info = psb_err_missing_override_method_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
@@ -667,7 +667,7 @@ contains
|
||||
|
||||
|
||||
subroutine amg_z_apply2v(prec,x,y,desc_data,info,trans,work)
|
||||
implicit none
|
||||
implicit none
|
||||
type(psb_desc_type),intent(in) :: desc_data
|
||||
class(amg_zprec_type), intent(inout) :: prec
|
||||
complex(psb_dpk_),intent(inout) :: x(:)
|
||||
@@ -680,13 +680,13 @@ contains
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select type(prec)
|
||||
select type(prec)
|
||||
type is (amg_zprec_type)
|
||||
call amg_precapply(prec,x,y,desc_data,info,trans,work)
|
||||
class default
|
||||
info = psb_err_missing_override_method_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
@@ -698,7 +698,7 @@ contains
|
||||
end subroutine amg_z_apply2v
|
||||
|
||||
subroutine amg_z_apply1v(prec,x,desc_data,info,trans)
|
||||
implicit none
|
||||
implicit none
|
||||
type(psb_desc_type),intent(in) :: desc_data
|
||||
class(amg_zprec_type), intent(inout) :: prec
|
||||
complex(psb_dpk_),intent(inout) :: x(:)
|
||||
@@ -709,13 +709,13 @@ contains
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select type(prec)
|
||||
select type(prec)
|
||||
type is (amg_zprec_type)
|
||||
call amg_precapply(prec,x,desc_data,info,trans)
|
||||
class default
|
||||
info = psb_err_missing_override_method_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
@@ -730,8 +730,8 @@ contains
|
||||
subroutine amg_z_dump(prec,info,istart,iend,iproc,prefix,head,&
|
||||
& ac,rp,smoother,solver,tprol,&
|
||||
& global_num)
|
||||
|
||||
implicit none
|
||||
|
||||
implicit none
|
||||
class(amg_zprec_type), intent(in) :: prec
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(in), optional :: istart, iend, iproc
|
||||
@@ -742,27 +742,26 @@ contains
|
||||
integer(psb_ipk_) :: iam, np, iproc_
|
||||
character(len=80) :: prefix_
|
||||
character(len=120) :: fname ! len should be at least 20 more than
|
||||
! len of prefix_
|
||||
! len of prefix_
|
||||
|
||||
info = 0
|
||||
ctxt = prec%ctxt
|
||||
call psb_info(ctxt,iam,np)
|
||||
|
||||
iln = size(prec%precv)
|
||||
if (present(istart)) then
|
||||
if (present(istart)) then
|
||||
il1 = max(1,istart)
|
||||
else
|
||||
il1 = min(2,iln)
|
||||
end if
|
||||
if (present(iend)) then
|
||||
if (present(iend)) then
|
||||
iln = min(iln, iend)
|
||||
end if
|
||||
iproc_ = -1
|
||||
if (present(iproc)) then
|
||||
if (present(iproc)) then
|
||||
iproc_ = iproc
|
||||
end if
|
||||
|
||||
if ((iproc_ == -1).or.(iproc_==iam)) then
|
||||
if ((iproc_ == -1).or.(iproc_==iam)) then
|
||||
do lev=il1, iln
|
||||
call prec%precv(lev)%dump(lev,info,prefix=prefix,head=head,&
|
||||
& ac=ac,smoother=smoother,solver=solver,rp=rp,tprol=tprol, &
|
||||
@@ -773,7 +772,7 @@ contains
|
||||
|
||||
subroutine amg_z_cnv(prec,info,amold,vmold,imold)
|
||||
|
||||
implicit none
|
||||
implicit none
|
||||
class(amg_zprec_type), intent(inout) :: prec
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
class(psb_z_base_sparse_mat), intent(in), optional :: amold
|
||||
@@ -781,7 +780,7 @@ contains
|
||||
class(psb_i_base_vect_type), intent(in), optional :: imold
|
||||
|
||||
integer(psb_ipk_) :: i
|
||||
|
||||
|
||||
info = psb_success_
|
||||
if (allocated(prec%precv)) then
|
||||
do i=1,size(prec%precv)
|
||||
@@ -789,24 +788,24 @@ contains
|
||||
& call prec%precv(i)%cnv(info,amold=amold,vmold=vmold,imold=imold)
|
||||
end do
|
||||
end if
|
||||
|
||||
|
||||
end subroutine amg_z_cnv
|
||||
|
||||
subroutine amg_z_clone(prec,precout,info)
|
||||
|
||||
implicit none
|
||||
implicit none
|
||||
class(amg_zprec_type), intent(inout) :: prec
|
||||
class(psb_zprec_type), intent(inout) :: precout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
|
||||
call precout%free(info)
|
||||
if (info == 0) call amg_z_inner_clone(prec,precout,info)
|
||||
if (info == 0) call amg_z_inner_clone(prec,precout,info)
|
||||
|
||||
end subroutine amg_z_clone
|
||||
|
||||
subroutine amg_z_inner_clone(prec,precout,info)
|
||||
|
||||
implicit none
|
||||
implicit none
|
||||
class(amg_zprec_type), intent(inout) :: prec
|
||||
class(psb_zprec_type), target, intent(inout) :: precout
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
@@ -821,17 +820,17 @@ contains
|
||||
pout%ctxt = prec%ctxt
|
||||
pout%ag_data = prec%ag_data
|
||||
pout%outer_sweeps = prec%outer_sweeps
|
||||
if (allocated(prec%precv)) then
|
||||
ln = size(prec%precv)
|
||||
if (allocated(prec%precv)) then
|
||||
ln = size(prec%precv)
|
||||
allocate(pout%precv(ln),stat=info)
|
||||
if (info /= psb_success_) goto 9999
|
||||
if (ln >= 1) then
|
||||
if (ln >= 1) then
|
||||
call prec%precv(1)%clone(pout%precv(1),info)
|
||||
end if
|
||||
do lev=2, ln
|
||||
if (info /= psb_success_) exit
|
||||
call prec%precv(lev)%clone(pout%precv(lev),info)
|
||||
if (info == psb_success_) then
|
||||
if (info == psb_success_) then
|
||||
pout%precv(lev)%base_a => pout%precv(lev)%ac
|
||||
pout%precv(lev)%base_desc => pout%precv(lev)%desc_ac
|
||||
pout%precv(lev)%linmap%p_desc_U => pout%precv(lev-1)%base_desc
|
||||
@@ -842,7 +841,7 @@ contains
|
||||
if (allocated(prec%precv(1)%wrk)) &
|
||||
& call pout%allocate_wrk(info,vmold=prec%precv(1)%wrk%vx2l%v)
|
||||
|
||||
class default
|
||||
class default
|
||||
write(0,*) 'Error: wrong out type'
|
||||
info = psb_err_invalid_input_
|
||||
end select
|
||||
@@ -854,14 +853,14 @@ contains
|
||||
implicit none
|
||||
class(amg_zprec_type), intent(inout) :: prec
|
||||
class(amg_zprec_type), intent(inout), target :: b
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_) :: i
|
||||
|
||||
if (same_type_as(prec,b)) then
|
||||
if (allocated(b%precv)) then
|
||||
|
||||
if (same_type_as(prec,b)) then
|
||||
if (allocated(b%precv)) then
|
||||
! This might not be required if FINAL procedures are available.
|
||||
call b%free(info)
|
||||
if (info /= psb_success_) then
|
||||
if (info /= psb_success_) then
|
||||
!?????
|
||||
!!$ return
|
||||
endif
|
||||
@@ -869,7 +868,7 @@ contains
|
||||
b%ctxt = prec%ctxt
|
||||
b%ag_data = prec%ag_data
|
||||
b%outer_sweeps = prec%outer_sweeps
|
||||
|
||||
|
||||
call move_alloc(prec%precv,b%precv)
|
||||
! Fix the pointers except on level 1.
|
||||
do i=2, size(b%precv)
|
||||
@@ -878,7 +877,7 @@ contains
|
||||
b%precv(i)%linmap%p_desc_U => b%precv(i-1)%base_desc
|
||||
b%precv(i)%linmap%p_desc_V => b%precv(i)%base_desc
|
||||
end do
|
||||
|
||||
|
||||
else
|
||||
write(0,*) 'Warning: PREC%move_alloc onto different type?'
|
||||
info = psb_err_internal_error_
|
||||
@@ -888,7 +887,7 @@ contains
|
||||
subroutine amg_z_allocate_wrk(prec,info,vmold,desc)
|
||||
use psb_base_mod
|
||||
implicit none
|
||||
|
||||
|
||||
! Arguments
|
||||
class(amg_zprec_type), intent(inout) :: prec
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
@@ -896,37 +895,37 @@ contains
|
||||
!
|
||||
! In MLD the DESC optional argument is ignored, since
|
||||
! the necessary info is contained in the various entries of the
|
||||
! PRECV component.
|
||||
! PRECV component.
|
||||
type(psb_desc_type), intent(in), optional :: desc
|
||||
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: me,err_act,i,j,level,nlev, nc2l
|
||||
character(len=20) :: name
|
||||
|
||||
|
||||
info=psb_success_
|
||||
name = 'amg_z_allocate_wrk'
|
||||
call psb_erractionsave(err_act)
|
||||
if (psb_errstatus_fatal()) then
|
||||
info = psb_err_internal_error_; goto 9999
|
||||
end if
|
||||
nlev = size(prec%precv)
|
||||
nlev = size(prec%precv)
|
||||
level = 1
|
||||
do level = 1, nlev
|
||||
call prec%precv(level)%allocate_wrk(info,vmold=vmold)
|
||||
if (psb_errstatus_fatal()) then
|
||||
if (psb_errstatus_fatal()) then
|
||||
nc2l = prec%precv(level)%base_desc%get_local_cols()
|
||||
info=psb_err_alloc_request_
|
||||
call psb_errpush(info,name,i_err=(/2*nc2l/), a_err='complex(psb_dpk_)')
|
||||
goto 9999
|
||||
goto 9999
|
||||
end if
|
||||
end do
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
|
||||
|
||||
end subroutine amg_z_allocate_wrk
|
||||
|
||||
subroutine amg_z_free_wrk(prec,info)
|
||||
@@ -948,13 +947,13 @@ contains
|
||||
info = psb_err_internal_error_; goto 9999
|
||||
end if
|
||||
|
||||
if (allocated(prec%precv)) then
|
||||
nlev = size(prec%precv)
|
||||
if (allocated(prec%precv)) then
|
||||
nlev = size(prec%precv)
|
||||
do level = 1, nlev
|
||||
call prec%precv(level)%free_wrk(info)
|
||||
end do
|
||||
end if
|
||||
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
@@ -966,7 +965,7 @@ contains
|
||||
function amg_z_is_allocated_wrk(prec) result(res)
|
||||
use psb_base_mod
|
||||
implicit none
|
||||
|
||||
|
||||
! Arguments
|
||||
class(amg_zprec_type), intent(in) :: prec
|
||||
logical :: res
|
||||
@@ -974,7 +973,7 @@ contains
|
||||
res = .false.
|
||||
if (.not.allocated(prec%precv)) return
|
||||
res = allocated(prec%precv(1)%wrk)
|
||||
|
||||
|
||||
end function amg_z_is_allocated_wrk
|
||||
|
||||
end module amg_z_prec_type
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
include ../../../Make.inc
|
||||
LIBDIR=../../../lib
|
||||
INCDIR=../../../include
|
||||
MODDIR=../../../modules
|
||||
MODDIR=../../../modules
|
||||
HERE=../..
|
||||
FINCLUDES=$(FMFLAG)$(HERE) $(FMFLAG)$(MODDIR) $(FMFLAG)$(INCDIR) $(PSBLAS_INCLUDES)
|
||||
|
||||
@@ -191,15 +191,124 @@ amg_z_ilu_solver_dmp.o \
|
||||
amg_z_mumps_solver_apply.o \
|
||||
amg_z_mumps_solver_apply_vect.o \
|
||||
amg_z_mumps_solver_bld.o \
|
||||
|
||||
amg_s_ainv_solver_bld.o \
|
||||
amg_s_ainv_solver_check.o \
|
||||
amg_s_ainv_solver_clone.o \
|
||||
amg_s_ainv_solver_csetc.o \
|
||||
amg_s_ainv_solver_cseti.o \
|
||||
amg_s_ainv_solver_csetr.o \
|
||||
amg_s_ainv_solver_descr.o \
|
||||
amg_s_ainv_solver_setc.o \
|
||||
amg_s_ainv_solver_seti.o \
|
||||
amg_s_ainv_solver_setr.o \
|
||||
amg_d_ainv_solver_bld.o \
|
||||
amg_d_ainv_solver_check.o \
|
||||
amg_d_ainv_solver_clone.o \
|
||||
amg_d_ainv_solver_csetc.o \
|
||||
amg_d_ainv_solver_cseti.o \
|
||||
amg_d_ainv_solver_csetr.o \
|
||||
amg_d_ainv_solver_descr.o \
|
||||
amg_d_ainv_solver_setc.o \
|
||||
amg_d_ainv_solver_seti.o \
|
||||
amg_d_ainv_solver_setr.o \
|
||||
amg_c_ainv_solver_bld.o \
|
||||
amg_c_ainv_solver_check.o \
|
||||
amg_c_ainv_solver_clone.o \
|
||||
amg_c_ainv_solver_csetc.o \
|
||||
amg_c_ainv_solver_cseti.o \
|
||||
amg_c_ainv_solver_csetr.o \
|
||||
amg_c_ainv_solver_descr.o \
|
||||
amg_c_ainv_solver_setc.o \
|
||||
amg_c_ainv_solver_seti.o \
|
||||
amg_c_ainv_solver_setr.o \
|
||||
amg_s_base_ainv_solver_apply_vect.o \
|
||||
amg_s_base_ainv_solver_apply.o \
|
||||
amg_s_base_ainv_solver_cnv.o \
|
||||
amg_s_base_ainv_solver_dmp.o \
|
||||
amg_s_base_ainv_solver_free.o \
|
||||
amg_s_base_ainv_update_a.o \
|
||||
amg_d_base_ainv_solver_apply_vect.o \
|
||||
amg_d_base_ainv_solver_apply.o \
|
||||
amg_d_base_ainv_solver_cnv.o \
|
||||
amg_d_base_ainv_solver_dmp.o \
|
||||
amg_d_base_ainv_solver_free.o \
|
||||
amg_d_base_ainv_update_a.o \
|
||||
amg_c_base_ainv_solver_apply_vect.o \
|
||||
amg_c_base_ainv_solver_apply.o \
|
||||
amg_c_base_ainv_solver_cnv.o \
|
||||
amg_c_base_ainv_solver_dmp.o \
|
||||
amg_c_base_ainv_solver_free.o \
|
||||
amg_c_base_ainv_update_a.o \
|
||||
amg_z_base_ainv_solver_apply_vect.o \
|
||||
amg_z_base_ainv_solver_apply.o \
|
||||
amg_z_base_ainv_solver_cnv.o \
|
||||
amg_z_base_ainv_solver_dmp.o \
|
||||
amg_z_base_ainv_solver_free.o \
|
||||
amg_z_base_ainv_update_a.o \
|
||||
amg_d_invt_solver_bld.o \
|
||||
amg_d_invt_solver_check.o \
|
||||
amg_d_invt_solver_clone.o \
|
||||
amg_d_invt_solver_cseti.o \
|
||||
amg_d_invt_solver_csetr.o \
|
||||
amg_d_invt_solver_descr.o \
|
||||
amg_d_invt_solver_seti.o \
|
||||
amg_d_invt_solver_setr.o \
|
||||
amg_d_invk_solver_bld.o \
|
||||
amg_d_invk_solver_check.o \
|
||||
amg_d_invk_solver_clone.o \
|
||||
amg_d_invk_solver_cseti.o \
|
||||
amg_d_invk_solver_descr.o \
|
||||
amg_d_invk_solver_seti.o \
|
||||
amg_s_invt_solver_bld.o \
|
||||
amg_s_invt_solver_check.o \
|
||||
amg_s_invt_solver_clone.o \
|
||||
amg_s_invt_solver_cseti.o \
|
||||
amg_s_invt_solver_csetr.o \
|
||||
amg_s_invt_solver_descr.o \
|
||||
amg_s_invt_solver_seti.o \
|
||||
amg_s_invt_solver_setr.o \
|
||||
amg_s_invk_solver_bld.o \
|
||||
amg_s_invk_solver_check.o \
|
||||
amg_s_invk_solver_clone.o \
|
||||
amg_s_invk_solver_cseti.o \
|
||||
amg_s_invk_solver_descr.o \
|
||||
amg_s_invk_solver_seti.o \
|
||||
amg_c_invt_solver_bld.o \
|
||||
amg_c_invt_solver_check.o \
|
||||
amg_c_invt_solver_clone.o \
|
||||
amg_c_invt_solver_cseti.o \
|
||||
amg_c_invt_solver_csetr.o \
|
||||
amg_c_invt_solver_descr.o \
|
||||
amg_c_invt_solver_seti.o \
|
||||
amg_c_invt_solver_setr.o \
|
||||
amg_c_invk_solver_bld.o \
|
||||
amg_c_invk_solver_check.o \
|
||||
amg_c_invk_solver_clone.o \
|
||||
amg_c_invk_solver_cseti.o \
|
||||
amg_c_invk_solver_descr.o \
|
||||
amg_c_invk_solver_seti.o \
|
||||
amg_z_invt_solver_bld.o \
|
||||
amg_z_invt_solver_check.o \
|
||||
amg_z_invt_solver_clone.o \
|
||||
amg_z_invt_solver_cseti.o \
|
||||
amg_z_invt_solver_csetr.o \
|
||||
amg_z_invt_solver_descr.o \
|
||||
amg_z_invt_solver_seti.o \
|
||||
amg_z_invt_solver_setr.o \
|
||||
amg_z_invk_solver_bld.o \
|
||||
amg_z_invk_solver_check.o \
|
||||
amg_z_invk_solver_clone.o \
|
||||
amg_z_invk_solver_cseti.o \
|
||||
amg_z_invk_solver_descr.o \
|
||||
amg_z_invk_solver_seti.o
|
||||
|
||||
LIBNAME=libamg_prec.a
|
||||
|
||||
lib: $(OBJS)
|
||||
lib: $(OBJS)
|
||||
$(AR) $(HERE)/$(LIBNAME) $(OBJS)
|
||||
$(RANLIB) $(HERE)/$(LIBNAME)
|
||||
|
||||
mpobjs:
|
||||
mpobjs:
|
||||
(make $(MPFOBJS) FC="$(MPFC)" FCOPT="$(FCOPT)")
|
||||
(make $(MPCOBJS) CC="$(MPCC)" CCOPT="$(CCOPT)")
|
||||
|
||||
@@ -208,4 +317,3 @@ veryclean: clean
|
||||
|
||||
clean:
|
||||
/bin/rm -f $(OBJS) $(LOCAL_MODS)
|
||||
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_ainv_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
|
||||
|
||||
use psb_base_mod
|
||||
use psb_c_ainv_fact_mod
|
||||
use amg_c_ainv_solver, amg_protect_name => amg_c_ainv_solver_bld
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
type(psb_cspmat_type), intent(in), target :: a
|
||||
Type(psb_desc_type), Intent(inout) :: desc_a
|
||||
class(amg_c_ainv_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(:)
|
||||
integer(psb_ipk_) :: np,me,i, err_act, debug_unit, debug_level
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
character(len=20) :: name='amg_c_ainv_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'
|
||||
|
||||
call psb_c_ainv_bld(a,sv%alg,sv%fill_in,sv%thresh,&
|
||||
& sv%w,sv%d,sv%z,desc_a,info,b,iscale=amg_ilu_scale_maxval_)
|
||||
|
||||
if ((info == psb_success_) .and.present(amold)) then
|
||||
call sv%w%set_asb()
|
||||
call sv%w%trim()
|
||||
call sv%z%set_asb()
|
||||
call sv%z%trim()
|
||||
call sv%w%cscnv(info,mold=amold)
|
||||
if (info == psb_success_) &
|
||||
& call sv%z%cscnv(info,mold=amold)
|
||||
end if
|
||||
|
||||
if (info == psb_success_) &
|
||||
& call sv%dv%bld(sv%d,mold=vmold)
|
||||
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_internal_error_,name)
|
||||
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_ainv_solver_bld
|
||||
@@ -0,0 +1,65 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_ainv_solver_check(sv,info)
|
||||
|
||||
|
||||
use psb_base_mod
|
||||
use amg_c_ainv_solver, amg_protect_name => amg_c_ainv_solver_check
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_ainv_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
!
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='amg_c_ainv_solver_check'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
|
||||
call amg_check_def(sv%fill_in,&
|
||||
& 'Nzmin',ione,is_positive_nz_min)
|
||||
call amg_check_def(sv%thresh,&
|
||||
& 'Eps',szero,is_legal_s_fact_thrs)
|
||||
|
||||
if (info /= psb_success_) goto 9999
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_c_ainv_solver_check
|
||||
@@ -0,0 +1,91 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.0)
|
||||
!
|
||||
! (C) Copyright 2008,2009,2010,2010,2012
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
! Alfredo Buttari CNRS-IRIT, Toulouse
|
||||
! Pasqua D'Ambra ICAR-CNR, Naples
|
||||
! Daniela di Serafino Second University of Naples
|
||||
!
|
||||
! 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_ainv_solver_clone(sv,svout,info)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_c_ainv_solver, amg_protect_name => amg_c_ainv_solver_clone
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_ainv_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(amg_c_ainv_solver_type :: svout, stat=info)
|
||||
if (info /= 0) then
|
||||
info = psb_err_alloc_dealloc_
|
||||
goto 9999
|
||||
end if
|
||||
select type(svo => svout)
|
||||
type is (amg_c_ainv_solver_type)
|
||||
svo%alg = sv%alg
|
||||
svo%fill_in = sv%fill_in
|
||||
svo%thresh = sv%thresh
|
||||
call psb_safe_ab_cpy(sv%d,svo%d,info)
|
||||
if (info == psb_success_) &
|
||||
& call sv%dv%clone(svo%dv,info)
|
||||
if (info == psb_success_) &
|
||||
& call sv%w%clone(svo%w,info)
|
||||
if (info == psb_success_) &
|
||||
& call sv%z%clone(svo%z,info)
|
||||
|
||||
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_ainv_solver_clone
|
||||
@@ -0,0 +1,79 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_ainv_solver_csetc(sv,what,val,info,idx)
|
||||
|
||||
|
||||
use psb_base_mod
|
||||
use amg_c_ainv_solver, amg_protect_name => amg_c_ainv_solver_csetc
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_ainv_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='amg_c_ainv_solver_setc'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
!!$ select case(psb_toupper(trim(what)))
|
||||
!!$ case('AINV_ALG')
|
||||
!!$ sv%alg = sv%stringval(val)
|
||||
!!$ case default
|
||||
!!$ call sv%mld_d_base_solver_type%set(what,val,info)
|
||||
!!$ end select
|
||||
ival = sv%stringval(val)
|
||||
|
||||
if (ival >=0) then
|
||||
call sv%set(what,ival,info)
|
||||
end if
|
||||
|
||||
if (info /= psb_success_) then
|
||||
info = psb_err_from_subroutine_
|
||||
call psb_errpush(info, name)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_c_ainv_solver_csetc
|
||||
@@ -0,0 +1,69 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_ainv_solver_cseti(sv,what,val,info,idx)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_c_ainv_solver, amg_protect_name => amg_c_ainv_solver_cseti
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_ainv_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='amg_c_ainv_solver_cseti'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select case(psb_toupper(trim(what)))
|
||||
case('SUB_FILLIN')
|
||||
sv%fill_in = val
|
||||
case('AINV_ALG')
|
||||
sv%alg = val
|
||||
case default
|
||||
call sv%amg_c_base_solver_type%set(what,val,info)
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_c_ainv_solver_cseti
|
||||
@@ -0,0 +1,67 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_ainv_solver_csetr(sv,what,val,info,idx)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_c_ainv_solver, amg_protect_name => amg_c_ainv_solver_csetr
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_ainv_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='amg_c_ainv_solver_csetr'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
|
||||
select case(psb_toupper(what))
|
||||
case('SUB_ILUTHRS')
|
||||
sv%thresh = val
|
||||
case default
|
||||
call sv%amg_c_base_solver_type%set(what,val,info)
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_c_ainv_solver_csetr
|
||||
@@ -0,0 +1,73 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_ainv_solver_descr(sv,info,iout,coarse)
|
||||
|
||||
|
||||
use psb_base_mod
|
||||
use amg_c_ainv_solver, amg_protect_name => amg_c_ainv_solver_descr
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_ainv_solver_type), intent(in) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(in), optional :: iout
|
||||
logical, intent(in), optional :: coarse
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: err_act
|
||||
integer(psb_ipk_) :: ictxt, me, np
|
||||
character(len=20), parameter :: name='amg_c_ainv_solver_descr'
|
||||
integer(psb_ipk_) :: iout_
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
if (present(iout)) then
|
||||
iout_ = iout
|
||||
else
|
||||
iout_ = 6
|
||||
endif
|
||||
|
||||
write(iout_,*) ' AINV: Approximate Inverse with sparse biconjugation '
|
||||
write(iout_,*) ' Algorithm variant : ',sv%algname(sv%alg)
|
||||
write(iout_,*) ' Fill level : ',sv%fill_in
|
||||
write(iout_,*) ' Fill threshold : ',sv%thresh
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_c_ainv_solver_descr
|
||||
@@ -0,0 +1,71 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_ainv_solver_setc(sv,what,val,info)
|
||||
|
||||
|
||||
use psb_base_mod
|
||||
use amg_c_ainv_solver, amg_protect_name => amg_c_ainv_solver_setc
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_ainv_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(in) :: what
|
||||
character(len=*), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
!
|
||||
integer(psb_ipk_) :: err_act, ival
|
||||
character(len=20) :: name='amg_c_ainv_solver_setc'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
ival = sv%stringval(val)
|
||||
if (ival >=0) then
|
||||
call sv%set(what,ival,info)
|
||||
end if
|
||||
|
||||
if (info /= psb_success_) then
|
||||
info = psb_err_from_subroutine_
|
||||
call psb_errpush(info, name)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_c_ainv_solver_setc
|
||||
@@ -0,0 +1,70 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_ainv_solver_seti(sv,what,val,info)
|
||||
|
||||
|
||||
use psb_base_mod
|
||||
use amg_c_ainv_solver, amg_protect_name => amg_c_ainv_solver_seti
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_ainv_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(in) :: what
|
||||
integer(psb_ipk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
!
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='amg_c_ainv_solver_seti'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select case(what)
|
||||
case(amg_sub_fillin_)
|
||||
sv%fill_in = val
|
||||
case(amg_ainv_alg_)
|
||||
sv%alg = val
|
||||
case default
|
||||
!!$ write(0,*) name,': Error: invalid WHAT'
|
||||
!!$ info = -2
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_c_ainv_solver_seti
|
||||
@@ -0,0 +1,69 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_ainv_solver_setr(sv,what,val,info)
|
||||
|
||||
|
||||
use psb_base_mod
|
||||
use amg_c_ainv_solver, amg_protect_name => amg_c_ainv_solver_setr
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_ainv_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(in) :: what
|
||||
real(psb_spk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
!
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='amg_c_ainv_solver_setr'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
|
||||
select case(what)
|
||||
case(amg_sub_iluthrs_)
|
||||
sv%thresh = val
|
||||
case default
|
||||
!!$ write(0,*) name,': Error: invalid WHAT'
|
||||
!!$ info = -2
|
||||
!!$ goto 9999
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_c_ainv_solver_setr
|
||||
@@ -0,0 +1,153 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_base_ainv_solver_apply(alpha,sv,x,beta,y,desc_data,&
|
||||
& trans,work,info,init,initu)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_c_base_ainv_mod, amg_protect_name => amg_c_base_ainv_solver_apply
|
||||
implicit none
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(amg_c_base_ainv_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
|
||||
complex(psb_spk_), pointer :: ww(:), aux(:), tx(:),ty(:)
|
||||
integer(psb_ipk_) :: np,me,i, err_act
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
character :: trans_
|
||||
character(len=20) :: name='d_base_ainv_solver_apply'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
info = psb_success_
|
||||
|
||||
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
|
||||
!
|
||||
! For non-iterative solvers, init and initu are ignored.
|
||||
!
|
||||
|
||||
n_row = psb_cd_get_local_rows(desc_data)
|
||||
n_col = psb_cd_get_local_cols(desc_data)
|
||||
|
||||
if (n_col <= size(work)) then
|
||||
ww => work(1:n_col)
|
||||
if ((4*n_col+n_col) <= size(work)) then
|
||||
aux => work(n_col+1:)
|
||||
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/),&
|
||||
& a_err='real(psb_dpk_)')
|
||||
goto 9999
|
||||
end if
|
||||
endif
|
||||
else
|
||||
allocate(ww(n_col),aux(4*n_col),stat=info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_alloc_request_
|
||||
call psb_errpush(info,name,i_err=(/5*n_col/),&
|
||||
& a_err='real(psb_dpk_)')
|
||||
goto 9999
|
||||
end if
|
||||
endif
|
||||
|
||||
select case(trans_)
|
||||
case('N')
|
||||
call psb_spmm(cone,sv%w,x,czero,ww,desc_data,info,&
|
||||
& trans=trans_,work=aux,doswap=.false.)
|
||||
ww(1:n_row) = ww(1:n_row) * sv%d(1:n_row)
|
||||
if (info == psb_success_) &
|
||||
& call psb_spmm(alpha,sv%z,ww,beta,y,desc_data,info,&
|
||||
& trans=trans_,work=aux,doswap=.false.)
|
||||
|
||||
case('T','C')
|
||||
call psb_spmm(cone,sv%z,x,czero,ww,desc_data,info,&
|
||||
& trans=trans_,work=aux,doswap=.false.)
|
||||
ww(1:n_row) = ww(1:n_row) * sv%d(1:n_row)
|
||||
if (info == psb_success_) &
|
||||
& call psb_spmm(alpha,sv%w,ww,beta,y,desc_data,info,&
|
||||
& trans=trans_,work=aux,doswap=.false.)
|
||||
|
||||
case default
|
||||
call psb_errpush(psb_err_internal_error_,name,&
|
||||
& a_err='Invalid TRANS in ainv subsolve')
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
|
||||
if (info /= psb_success_) then
|
||||
|
||||
call psb_errpush(psb_err_internal_error_,name,&
|
||||
& a_err='Error in subsolve')
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
if (n_col <= size(work)) then
|
||||
if ((4*n_col+n_col) <= size(work)) then
|
||||
else
|
||||
deallocate(aux,stat=info)
|
||||
endif
|
||||
else
|
||||
deallocate(ww,aux,stat=info)
|
||||
endif
|
||||
|
||||
if (info /= psb_success_) then
|
||||
|
||||
call psb_errpush(psb_err_internal_error_,name,&
|
||||
& a_err='Deallocate')
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_c_base_ainv_solver_apply
|
||||
@@ -0,0 +1,167 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_base_ainv_solver_apply_vect(alpha,sv,x,beta,y,desc_data,&
|
||||
& trans,work,wv,info,init,initu)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_c_base_ainv_mod, amg_protect_name => amg_c_base_ainv_solver_apply_vect
|
||||
implicit none
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(amg_c_base_ainv_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
|
||||
complex(psb_spk_), pointer :: ww(:), aux(:)
|
||||
type(psb_c_vect_type) :: tx,ty
|
||||
integer(psb_ipk_) :: np,me,i, err_act
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
character :: trans_
|
||||
character(len=20) :: name='d_base_ainv_solver_apply'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
info = psb_success_
|
||||
|
||||
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
|
||||
!
|
||||
! For non-iterative solvers, init and initu are ignored.
|
||||
!
|
||||
|
||||
n_row = psb_cd_get_local_rows(desc_data)
|
||||
n_col = psb_cd_get_local_cols(desc_data)
|
||||
|
||||
if (n_col <= size(work)) then
|
||||
ww => work(1:n_col)
|
||||
if ((4*n_col+n_col) <= size(work)) then
|
||||
aux => work(n_col+1:)
|
||||
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/),&
|
||||
& a_err='real(psb_dpk_)')
|
||||
goto 9999
|
||||
end if
|
||||
endif
|
||||
else
|
||||
allocate(ww(n_col),aux(4*n_col),stat=info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_alloc_request_
|
||||
call psb_errpush(info,name,i_err=(/5*n_col/),&
|
||||
& a_err='real(psb_dpk_)')
|
||||
goto 9999
|
||||
end if
|
||||
endif
|
||||
|
||||
if (size(wv) < 2) then
|
||||
info = psb_err_internal_error_
|
||||
call psb_errpush(info,name,&
|
||||
& a_err='invalid wv size')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
|
||||
associate(tx => wv(1), ty => wv(2))
|
||||
|
||||
select case(trans_)
|
||||
case('N')
|
||||
call psb_spmm(cone,sv%w,x,czero,tx,desc_data,info,&
|
||||
& trans=trans_,work=aux,doswap=.false.)
|
||||
if (info == psb_success_) call ty%mlt(cone,sv%dv,tx,czero,info)
|
||||
if (info == psb_success_) &
|
||||
& call psb_spmm(alpha,sv%z,ty,beta,y,desc_data,info,&
|
||||
& trans=trans_,work=aux,doswap=.false.)
|
||||
|
||||
case('T','C')
|
||||
call psb_spmm(cone,sv%z,x,czero,tx,desc_data,info,&
|
||||
& trans=trans_,work=aux,doswap=.false.)
|
||||
if (info == psb_success_) call ty%mlt(cone,sv%dv,tx,czero,info)
|
||||
if (info == psb_success_) &
|
||||
& call psb_spmm(alpha,sv%w,ty,beta,y,desc_data,info,&
|
||||
& trans=trans_,work=aux,doswap=.false.)
|
||||
|
||||
case default
|
||||
call psb_errpush(psb_err_internal_error_,name,&
|
||||
& a_err='Invalid TRANS in ainv subsolve')
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
|
||||
if (info /= psb_success_) then
|
||||
|
||||
call psb_errpush(psb_err_internal_error_,name,&
|
||||
& a_err='Error in subsolve')
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
end associate
|
||||
|
||||
if (n_col <= size(work)) then
|
||||
if ((4*n_col+n_col) <= size(work)) then
|
||||
else
|
||||
deallocate(aux,stat=info)
|
||||
endif
|
||||
else
|
||||
deallocate(ww,aux,stat=info)
|
||||
endif
|
||||
|
||||
if (info /= psb_success_) then
|
||||
|
||||
call psb_errpush(psb_err_internal_error_,name,&
|
||||
& a_err='Deallocate')
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_c_base_ainv_solver_apply_vect
|
||||
@@ -0,0 +1,63 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_base_ainv_solver_cnv(sv,info,amold,vmold,imold)
|
||||
use psb_base_mod
|
||||
use amg_c_base_ainv_mod, amg_protect_name => amg_c_base_ainv_solver_cnv
|
||||
Implicit None
|
||||
! Arguments
|
||||
class(amg_c_base_ainv_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
|
||||
integer(psb_ipk_) :: i, j, il1, iln, lname, lev
|
||||
integer(psb_ipk_) :: iam, np
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
character(len=80) :: prefix_
|
||||
character(len=120) :: fname ! len should be at least 20 more than
|
||||
logical :: solver_
|
||||
! len of prefix_
|
||||
|
||||
info = 0
|
||||
|
||||
if (present(amold)) then
|
||||
call sv%w%cscnv(info,mold=amold)
|
||||
call sv%z%cscnv(info,mold=amold)
|
||||
end if
|
||||
call sv%dv%cnv(mold=vmold)
|
||||
|
||||
end subroutine amg_c_base_ainv_solver_cnv
|
||||
@@ -0,0 +1,93 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_base_ainv_solver_dmp(sv,desc,level,info,prefix,head,solver,global_num)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_c_base_ainv_mod, amg_protect_name => amg_c_base_ainv_solver_dmp
|
||||
implicit none
|
||||
class(amg_c_base_ainv_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
|
||||
integer(psb_ipk_) :: iam, np
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
character(len=80) :: prefix_
|
||||
character(len=120) :: fname ! len should be at least 20 more than
|
||||
logical :: solver_, global_num_
|
||||
! len of prefix_
|
||||
|
||||
info = 0
|
||||
|
||||
if (present(prefix)) then
|
||||
prefix_ = trim(prefix(1:min(len(prefix),len(prefix_))))
|
||||
else
|
||||
prefix_ = "dump_ainv_d"
|
||||
end if
|
||||
|
||||
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
|
||||
lname = len_trim(prefix_)
|
||||
fname = trim(prefix_)
|
||||
write(fname(lname+1:lname+5),'(a,i3.3)') '_p',iam
|
||||
lname = lname + 5
|
||||
|
||||
if (solver_) then
|
||||
write(fname(lname+1:),'(a,i3.3,a)')'_l',level,'_wmat.mtx'
|
||||
if (sv%w%is_asb()) &
|
||||
& call sv%w%print(fname,head=head)
|
||||
write(fname(lname+1:),'(a,i3.3,a)')'_l',level,'_diag.mtx'
|
||||
if (allocated(sv%d)) &
|
||||
& call psb_geprt(fname,sv%d,head=head)
|
||||
write(fname(lname+1:),'(a,i3.3,a)')'_l',level,'_zmat.mtx'
|
||||
if (sv%z%is_asb()) &
|
||||
& call sv%z%print(fname,head=head)
|
||||
end if
|
||||
|
||||
end subroutine amg_c_base_ainv_solver_dmp
|
||||
@@ -0,0 +1,70 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_base_ainv_solver_free(sv,info)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_c_base_ainv_mod, amg_protect_name => amg_c_base_ainv_solver_free
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_base_ainv_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
!
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='amg_c_base_ainv_solver_free'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
call sv%clear_data(info)
|
||||
|
||||
if (allocated(sv%d)) then
|
||||
deallocate(sv%d,stat=info)
|
||||
if (info /= psb_success_) then
|
||||
info = psb_err_alloc_dealloc_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
end if
|
||||
call sv%w%free()
|
||||
call sv%z%free()
|
||||
call sv%dv%free(info)
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_c_base_ainv_solver_free
|
||||
@@ -0,0 +1,81 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_base_ainv_update_a(sv,x,desc_data,info)
|
||||
use amg_c_base_ainv_mod, amg_protect_name => amg_c_base_ainv_update_a
|
||||
use psb_base_mod
|
||||
|
||||
implicit none
|
||||
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(amg_c_base_ainv_solver_type), intent(inout) :: sv
|
||||
complex(psb_spk_),intent(in) :: x(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
! Local variables
|
||||
complex(psb_spk_), allocatable :: dd(:), ee(:)
|
||||
integer(psb_ipk_) :: nrows, ncols, i, j, k, nzr, nzc, ir, ic
|
||||
|
||||
type(psb_c_csc_sparse_mat) :: ac
|
||||
type(psb_c_csr_sparse_mat) :: ar
|
||||
|
||||
dd = sv%dv%get_vect()
|
||||
if (size(x)<size(dd)) then
|
||||
write(0,*) 'Wrong size in update',size(x),size(dd)
|
||||
info = -1
|
||||
return
|
||||
end if
|
||||
|
||||
ee = x(1:size(dd))
|
||||
call sv%z%cp_to(ac)
|
||||
call sv%w%cp_to(ar)
|
||||
! Compute diag(W ee Z)
|
||||
! First ee Z
|
||||
call ac%scal(ee,info,side='L')
|
||||
! Then diag(W (ee Z))
|
||||
do i=1,ar%get_nrows()
|
||||
ir = ar%irp(i); nzr = ar%irp(i+1)-ar%irp(i)
|
||||
ic = ac%icp(i); nzc = ac%icp(i+1)-ac%icp(i)
|
||||
ee(i) = psb_spdot_srtd(&
|
||||
& nzr,ar%ja(ir:ir+nzr-1),ar%val(ir:ir+nzr-1),&
|
||||
& nzc,ac%ia(ic:ic+nzc-1),ac%val(ic:ic+nzc-1))
|
||||
end do
|
||||
! Now invert diagonal
|
||||
dd = done/dd
|
||||
dd = dd + ee
|
||||
dd = done/dd
|
||||
sv%d = dd
|
||||
call sv%dv%bld(dd,mold=sv%dv%v)
|
||||
|
||||
end subroutine amg_c_base_ainv_update_a
|
||||
@@ -0,0 +1,93 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_invk_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
|
||||
|
||||
use psb_base_mod
|
||||
use psb_c_invk_fact_mod ! This module contains the construction routines
|
||||
|
||||
use amg_c_invk_solver, amg_protect_name => amg_c_invk_solver_bld
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
type(psb_cspmat_type), intent(in), target :: a
|
||||
Type(psb_desc_type), Intent(inout) :: desc_a
|
||||
class(amg_c_invk_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(:)
|
||||
integer(psb_ipk_) :: np,me,i, err_act, debug_unit, debug_level
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
character(len=20) :: name='c_invk_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'
|
||||
|
||||
|
||||
call psb_invk_fact(a,sv%fill_in,sv%inv_fill,&
|
||||
& sv%w,sv%d,sv%z,desc_a,info,b)
|
||||
|
||||
|
||||
if ((info == psb_success_) .and.present(amold)) then
|
||||
call sv%w%cscnv(info,mold=amold)
|
||||
if (info == psb_success_) &
|
||||
& call sv%z%cscnv(info,mold=amold)
|
||||
end if
|
||||
|
||||
if (info == psb_success_) then
|
||||
call sv%dv%bld(sv%d,mold=vmold)
|
||||
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_invk_solver_bld
|
||||
@@ -0,0 +1,64 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_invk_solver_check(sv,info)
|
||||
|
||||
|
||||
use psb_base_mod
|
||||
use amg_c_invk_solver, amg_protect_name => amg_c_invk_solver_check
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_invk_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
Integer(Psb_Ipk_) :: err_act
|
||||
character(len=20) :: name='c_invk_solver_check'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
|
||||
call amg_check_def(sv%fill_in,&
|
||||
& 'Level',izero,is_int_non_negative)
|
||||
call amg_check_def(sv%inv_fill,&
|
||||
& 'Level',izero,is_int_non_negative)
|
||||
|
||||
if (info /= psb_success_) goto 9999
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_c_invk_solver_check
|
||||
@@ -0,0 +1,90 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.0)
|
||||
!
|
||||
! (C) Copyright 2008,2009,2010,2010,2012
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
! Alfredo Buttari CNRS-IRIT, Toulouse
|
||||
! Pasqua D'Ambra ICAR-CNR, Naples
|
||||
! Daniela di Serafino Second University of Naples
|
||||
!
|
||||
! 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_invk_solver_clone(sv,svout,info)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_c_invk_solver, amg_protect_name => amg_c_invk_solver_clone
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_invk_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(amg_c_invk_solver_type :: svout, stat=info)
|
||||
if (info /= 0) then
|
||||
info = psb_err_alloc_dealloc_
|
||||
goto 9999
|
||||
end if
|
||||
select type(svo => svout)
|
||||
type is (amg_c_invk_solver_type)
|
||||
svo%fill_in = sv%fill_in
|
||||
svo%inv_fill = sv%inv_fill
|
||||
call psb_safe_ab_cpy(sv%d,svo%d,info)
|
||||
if (info == psb_success_) &
|
||||
& call sv%dv%clone(svo%dv,info)
|
||||
if (info == psb_success_) &
|
||||
& call sv%w%clone(svo%w,info)
|
||||
if (info == psb_success_) &
|
||||
& call sv%z%clone(svo%z,info)
|
||||
|
||||
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_invk_solver_clone
|
||||
@@ -0,0 +1,69 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_invk_solver_cseti(sv,what,val,info,idx)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_c_invk_solver, amg_protect_name => amg_c_invk_solver_cseti
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_invk_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_invk_solver_cseti'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select case(psb_toupper(what))
|
||||
case('SUB_FILLIN')
|
||||
sv%fill_in = val
|
||||
case('INV_FILLIN')
|
||||
sv%inv_fill = val
|
||||
case default
|
||||
call sv%amg_c_base_solver_type%set(what,val,info)
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_c_invk_solver_cseti
|
||||
@@ -0,0 +1,73 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_invk_solver_descr(sv,info,iout,coarse)
|
||||
|
||||
|
||||
use psb_base_mod
|
||||
use amg_c_invk_solver, amg_protect_name => amg_c_invk_solver_descr
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_invk_solver_type), intent(in) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(in), optional :: iout
|
||||
logical, intent(in), optional :: coarse
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: err_act
|
||||
integer(psb_ipk_) :: me, np
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
character(len=20), parameter :: name='amg_c_invk_solver_descr'
|
||||
integer(psb_ipk_) :: iout_
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
if (present(iout)) then
|
||||
iout_ = iout
|
||||
else
|
||||
iout_ = 6
|
||||
endif
|
||||
|
||||
write(iout_,*) ' INVK Approximate Inverse with ILU(N) '
|
||||
write(iout_,*) ' Fill level :',sv%fill_in
|
||||
write(iout_,*) ' Inverse fill level :',sv%inv_fill
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_c_invk_solver_descr
|
||||
@@ -0,0 +1,69 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_invk_solver_seti(sv,what,val,info)
|
||||
|
||||
|
||||
use psb_base_mod
|
||||
use amg_c_invk_solver, amg_protect_name => amg_c_invk_solver_seti
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_invk_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(in) :: what
|
||||
integer(psb_ipk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
!
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='d_invk_solver_seti'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select case(what)
|
||||
case(amg_sub_fillin_)
|
||||
sv%fill_in = val
|
||||
case(amg_inv_fillin_)
|
||||
sv%inv_fill = val
|
||||
case default
|
||||
! call sv%amg_c_base_solver_type%set(what,val,info)
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_c_invk_solver_seti
|
||||
@@ -0,0 +1,97 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_invt_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
|
||||
use psb_base_mod
|
||||
use psb_c_invt_fact_mod ! This module contains the construction routines
|
||||
use amg_c_invt_solver, amg_protect_name => amg_c_invt_solver_bld
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
type(psb_cspmat_type), intent(in), target :: a
|
||||
Type(psb_desc_type), Intent(inout) :: desc_a
|
||||
class(amg_c_invt_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(:)
|
||||
integer(psb_ipk_) :: np,me,i, err_act, debug_unit, debug_level
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
character(len=20) :: name='amg_c_invt_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'
|
||||
|
||||
|
||||
call psb_invt_fact(a,sv%fill_in,sv%inv_fill,&
|
||||
& sv%thresh,sv%inv_thresh,&
|
||||
& sv%w,sv%d,sv%z,desc_a,info,b)
|
||||
|
||||
if ((info == psb_success_) .and.present(amold)) then
|
||||
call sv%w%cscnv(info,mold=amold)
|
||||
if (info == psb_success_) &
|
||||
& call sv%z%cscnv(info,mold=amold)
|
||||
end if
|
||||
|
||||
if (info == psb_success_) then
|
||||
call sv%dv%bld(sv%d,mold=vmold)
|
||||
end if
|
||||
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_internal_error_,name)
|
||||
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_invt_solver_bld
|
||||
@@ -0,0 +1,69 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_invt_solver_check(sv,info)
|
||||
|
||||
|
||||
use psb_base_mod
|
||||
use amg_c_invt_solver, amg_protect_name => amg_c_invt_solver_check
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_invt_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
!
|
||||
Integer(Psb_Ipk_) :: err_act
|
||||
character(len=20) :: name='amg_c_invt_solver_check'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
|
||||
call amg_check_def(sv%fill_in,&
|
||||
& 'Level',izero,is_int_non_negative)
|
||||
call amg_check_def(sv%inv_fill,&
|
||||
& 'Level',izero,is_int_non_negative)
|
||||
call amg_check_def(sv%thresh,&
|
||||
& 'Eps',szero,is_legal_s_fact_thrs)
|
||||
call amg_check_def(sv%inv_thresh,&
|
||||
& 'Eps',szero,is_legal_s_fact_thrs)
|
||||
|
||||
if (info /= psb_success_) goto 9999
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_c_invt_solver_check
|
||||
@@ -0,0 +1,92 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.0)
|
||||
!
|
||||
! (C) Copyright 2008,2009,2010,2010,2012
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
! Alfredo Buttari CNRS-IRIT, Toulouse
|
||||
! Pasqua D'Ambra ICAR-CNR, Naples
|
||||
! Daniela di Serafino Second University of Naples
|
||||
!
|
||||
! 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_invt_solver_clone(sv,svout,info)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_c_invt_solver, amg_protect_name => amg_c_invt_solver_clone
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_invt_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(amg_c_invt_solver_type :: svout, stat=info)
|
||||
if (info /= 0) then
|
||||
info = psb_err_alloc_dealloc_
|
||||
goto 9999
|
||||
end if
|
||||
select type(svo => svout)
|
||||
type is (amg_c_invt_solver_type)
|
||||
svo%fill_in = sv%fill_in
|
||||
svo%inv_fill = sv%inv_fill
|
||||
svo%thresh = sv%thresh
|
||||
svo%inv_thresh = sv%inv_thresh
|
||||
call psb_safe_ab_cpy(sv%d,svo%d,info)
|
||||
if (info == psb_success_) &
|
||||
& call sv%dv%clone(svo%dv,info)
|
||||
if (info == psb_success_) &
|
||||
& call sv%w%clone(svo%w,info)
|
||||
if (info == psb_success_) &
|
||||
& call sv%z%clone(svo%z,info)
|
||||
|
||||
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_invt_solver_clone
|
||||
@@ -0,0 +1,69 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_invt_solver_cseti(sv,what,val,info,idx)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_c_invt_solver, amg_protect_name => amg_c_invt_solver_cseti
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_invt_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='amg_c_invt_solver_cseti'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select case(psb_toupper(what))
|
||||
case('SUB_FILLIN')
|
||||
sv%fill_in = val
|
||||
case('INV_FILLIN')
|
||||
sv%inv_fill = val
|
||||
case default
|
||||
call sv%amg_c_base_solver_type%set(what,val,info)
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_c_invt_solver_cseti
|
||||
@@ -0,0 +1,69 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_invt_solver_csetr(sv,what,val,info,idx)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_c_invt_solver, amg_protect_name => amg_c_invt_solver_csetr
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_invt_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='amg_c_invt_solver_csetr'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
|
||||
select case(psb_toupper(what))
|
||||
case('SUB_ILUTHRS')
|
||||
sv%thresh = val
|
||||
case('INV_THRESH')
|
||||
sv%inv_thresh = val
|
||||
case default
|
||||
call sv%amg_c_base_solver_type%set(what,val,info)
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_c_invt_solver_csetr
|
||||
@@ -0,0 +1,74 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_invt_solver_descr(sv,info,iout,coarse)
|
||||
|
||||
|
||||
use psb_base_mod
|
||||
use amg_c_invt_solver, amg_protect_name => amg_c_invt_solver_descr
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_invt_solver_type), intent(in) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(in), optional :: iout
|
||||
logical, intent(in), optional :: coarse
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: err_act
|
||||
integer(psb_ipk_) :: ictxt, me, np
|
||||
character(len=20), parameter :: name='amg_c_invt_solver_descr'
|
||||
integer(psb_ipk_) :: iout_
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
if (present(iout)) then
|
||||
iout_ = iout
|
||||
else
|
||||
iout_ = 6
|
||||
endif
|
||||
|
||||
write(iout_,*) ' INVT Approximate Inverse with ILU(T,P) '
|
||||
write(iout_,*) ' Fill level :',sv%fill_in
|
||||
write(iout_,*) ' Fill threshold :',sv%thresh
|
||||
write(iout_,*) ' Inverse fill level :',sv%inv_fill
|
||||
write(iout_,*) ' Inverse fill threshold :',sv%inv_thresh
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_c_invt_solver_descr
|
||||
@@ -0,0 +1,70 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_invt_solver_seti(sv,what,val,info)
|
||||
|
||||
|
||||
use psb_base_mod
|
||||
use amg_c_invt_solver, amg_protect_name => amg_c_invt_solver_seti
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_invt_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(in) :: what
|
||||
integer(psb_ipk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
!
|
||||
Integer(Psb_Ipk_) :: err_act
|
||||
character(len=20) :: name='amg_c_invt_solver_seti'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select case(what)
|
||||
case(amg_sub_fillin_)
|
||||
sv%fill_in = val
|
||||
case(amg_inv_fillin_)
|
||||
sv%inv_fill = val
|
||||
case default
|
||||
!!$ write(0,*) name,': Error: invalid WHAT'
|
||||
!!$ info = -2
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_c_invt_solver_seti
|
||||
@@ -0,0 +1,69 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_invt_solver_setr(sv,what,val,info)
|
||||
|
||||
|
||||
use psb_base_mod
|
||||
use amg_c_invt_solver, amg_protect_name => amg_c_invt_solver_setr
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_c_invt_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(in) :: what
|
||||
real(psb_spk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
!
|
||||
Integer(Psb_Ipk_) :: err_act
|
||||
character(len=20) :: name='amg_c_invt_solver_setr'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
|
||||
select case(what)
|
||||
case(amg_sub_iluthrs_)
|
||||
sv%thresh = val
|
||||
case(amg_inv_thresh_)
|
||||
sv%inv_thresh = val
|
||||
case default
|
||||
! call sv%amg_c_base_solver_type%set(what,val,info)
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_c_invt_solver_setr
|
||||
@@ -0,0 +1,98 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_ainv_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
|
||||
|
||||
use psb_base_mod
|
||||
use psb_d_ainv_fact_mod
|
||||
use amg_d_ainv_solver, amg_protect_name => amg_d_ainv_solver_bld
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
type(psb_dspmat_type), intent(in), target :: a
|
||||
Type(psb_desc_type), Intent(inout) :: desc_a
|
||||
class(amg_d_ainv_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(:)
|
||||
integer(psb_ipk_) :: np,me,i, err_act, debug_unit, debug_level
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
character(len=20) :: name='amg_d_ainv_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'
|
||||
|
||||
call psb_d_ainv_bld(a,sv%alg,sv%fill_in,sv%thresh,&
|
||||
& sv%w,sv%d,sv%z,desc_a,info,b,iscale=amg_ilu_scale_maxval_)
|
||||
|
||||
if ((info == psb_success_) .and.present(amold)) then
|
||||
call sv%w%set_asb()
|
||||
call sv%w%trim()
|
||||
call sv%z%set_asb()
|
||||
call sv%z%trim()
|
||||
call sv%w%cscnv(info,mold=amold)
|
||||
if (info == psb_success_) &
|
||||
& call sv%z%cscnv(info,mold=amold)
|
||||
end if
|
||||
|
||||
if (info == psb_success_) &
|
||||
& call sv%dv%bld(sv%d,mold=vmold)
|
||||
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_internal_error_,name)
|
||||
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_ainv_solver_bld
|
||||
@@ -0,0 +1,65 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_ainv_solver_check(sv,info)
|
||||
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_ainv_solver, amg_protect_name => amg_d_ainv_solver_check
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_ainv_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
!
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='amg_d_ainv_solver_check'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
|
||||
call amg_check_def(sv%fill_in,&
|
||||
& 'Nzmin',ione,is_positive_nz_min)
|
||||
call amg_check_def(sv%thresh,&
|
||||
& 'Eps',dzero,is_legal_d_fact_thrs)
|
||||
|
||||
if (info /= psb_success_) goto 9999
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_d_ainv_solver_check
|
||||
@@ -0,0 +1,91 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.0)
|
||||
!
|
||||
! (C) Copyright 2008,2009,2010,2010,2012
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
! Alfredo Buttari CNRS-IRIT, Toulouse
|
||||
! Pasqua D'Ambra ICAR-CNR, Naples
|
||||
! Daniela di Serafino Second University of Naples
|
||||
!
|
||||
! 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_ainv_solver_clone(sv,svout,info)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_ainv_solver, amg_protect_name => amg_d_ainv_solver_clone
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_ainv_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(amg_d_ainv_solver_type :: svout, stat=info)
|
||||
if (info /= 0) then
|
||||
info = psb_err_alloc_dealloc_
|
||||
goto 9999
|
||||
end if
|
||||
select type(svo => svout)
|
||||
type is (amg_d_ainv_solver_type)
|
||||
svo%alg = sv%alg
|
||||
svo%fill_in = sv%fill_in
|
||||
svo%thresh = sv%thresh
|
||||
call psb_safe_ab_cpy(sv%d,svo%d,info)
|
||||
if (info == psb_success_) &
|
||||
& call sv%dv%clone(svo%dv,info)
|
||||
if (info == psb_success_) &
|
||||
& call sv%w%clone(svo%w,info)
|
||||
if (info == psb_success_) &
|
||||
& call sv%z%clone(svo%z,info)
|
||||
|
||||
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_ainv_solver_clone
|
||||
@@ -0,0 +1,79 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_ainv_solver_csetc(sv,what,val,info,idx)
|
||||
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_ainv_solver, amg_protect_name => amg_d_ainv_solver_csetc
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_ainv_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='amg_d_ainv_solver_setc'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
!!$ select case(psb_toupper(trim(what)))
|
||||
!!$ case('AINV_ALG')
|
||||
!!$ sv%alg = sv%stringval(val)
|
||||
!!$ case default
|
||||
!!$ call sv%mld_d_base_solver_type%set(what,val,info)
|
||||
!!$ end select
|
||||
ival = sv%stringval(val)
|
||||
|
||||
if (ival >=0) then
|
||||
call sv%set(what,ival,info)
|
||||
end if
|
||||
|
||||
if (info /= psb_success_) then
|
||||
info = psb_err_from_subroutine_
|
||||
call psb_errpush(info, name)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_d_ainv_solver_csetc
|
||||
@@ -0,0 +1,69 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_ainv_solver_cseti(sv,what,val,info,idx)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_ainv_solver, amg_protect_name => amg_d_ainv_solver_cseti
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_ainv_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='amg_d_ainv_solver_cseti'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select case(psb_toupper(trim(what)))
|
||||
case('SUB_FILLIN')
|
||||
sv%fill_in = val
|
||||
case('AINV_ALG')
|
||||
sv%alg = val
|
||||
case default
|
||||
call sv%amg_d_base_solver_type%set(what,val,info)
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_d_ainv_solver_cseti
|
||||
@@ -0,0 +1,67 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_ainv_solver_csetr(sv,what,val,info,idx)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_ainv_solver, amg_protect_name => amg_d_ainv_solver_csetr
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_ainv_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='amg_d_ainv_solver_csetr'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
|
||||
select case(psb_toupper(what))
|
||||
case('SUB_ILUTHRS')
|
||||
sv%thresh = val
|
||||
case default
|
||||
call sv%amg_d_base_solver_type%set(what,val,info)
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_d_ainv_solver_csetr
|
||||
@@ -0,0 +1,73 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_ainv_solver_descr(sv,info,iout,coarse)
|
||||
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_ainv_solver, amg_protect_name => amg_d_ainv_solver_descr
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_ainv_solver_type), intent(in) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(in), optional :: iout
|
||||
logical, intent(in), optional :: coarse
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: err_act
|
||||
integer(psb_ipk_) :: ictxt, me, np
|
||||
character(len=20), parameter :: name='amg_d_ainv_solver_descr'
|
||||
integer(psb_ipk_) :: iout_
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
if (present(iout)) then
|
||||
iout_ = iout
|
||||
else
|
||||
iout_ = 6
|
||||
endif
|
||||
|
||||
write(iout_,*) ' AINV: Approximate Inverse with sparse biconjugation '
|
||||
write(iout_,*) ' Algorithm variant : ',sv%algname(sv%alg)
|
||||
write(iout_,*) ' Fill level : ',sv%fill_in
|
||||
write(iout_,*) ' Fill threshold : ',sv%thresh
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_d_ainv_solver_descr
|
||||
@@ -0,0 +1,71 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_ainv_solver_setc(sv,what,val,info)
|
||||
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_ainv_solver, amg_protect_name => amg_d_ainv_solver_setc
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_ainv_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(in) :: what
|
||||
character(len=*), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
!
|
||||
integer(psb_ipk_) :: err_act, ival
|
||||
character(len=20) :: name='amg_d_ainv_solver_setc'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
ival = sv%stringval(val)
|
||||
if (ival >=0) then
|
||||
call sv%set(what,ival,info)
|
||||
end if
|
||||
|
||||
if (info /= psb_success_) then
|
||||
info = psb_err_from_subroutine_
|
||||
call psb_errpush(info, name)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_d_ainv_solver_setc
|
||||
@@ -0,0 +1,70 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_ainv_solver_seti(sv,what,val,info)
|
||||
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_ainv_solver, amg_protect_name => amg_d_ainv_solver_seti
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_ainv_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(in) :: what
|
||||
integer(psb_ipk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
!
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='amg_d_ainv_solver_seti'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select case(what)
|
||||
case(amg_sub_fillin_)
|
||||
sv%fill_in = val
|
||||
case(amg_ainv_alg_)
|
||||
sv%alg = val
|
||||
case default
|
||||
!!$ write(0,*) name,': Error: invalid WHAT'
|
||||
!!$ info = -2
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_d_ainv_solver_seti
|
||||
@@ -0,0 +1,69 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_ainv_solver_setr(sv,what,val,info)
|
||||
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_ainv_solver, amg_protect_name => amg_d_ainv_solver_setr
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_ainv_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(in) :: what
|
||||
real(psb_dpk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
!
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='amg_d_ainv_solver_setr'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
|
||||
select case(what)
|
||||
case(amg_sub_iluthrs_)
|
||||
sv%thresh = val
|
||||
case default
|
||||
!!$ write(0,*) name,': Error: invalid WHAT'
|
||||
!!$ info = -2
|
||||
!!$ goto 9999
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_d_ainv_solver_setr
|
||||
@@ -0,0 +1,153 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_base_ainv_solver_apply(alpha,sv,x,beta,y,desc_data,&
|
||||
& trans,work,info,init,initu)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_base_ainv_mod, amg_protect_name => amg_d_base_ainv_solver_apply
|
||||
implicit none
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(amg_d_base_ainv_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
|
||||
real(psb_dpk_), pointer :: ww(:), aux(:), tx(:),ty(:)
|
||||
integer(psb_ipk_) :: np,me,i, err_act
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
character :: trans_
|
||||
character(len=20) :: name='d_base_ainv_solver_apply'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
info = psb_success_
|
||||
|
||||
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
|
||||
!
|
||||
! For non-iterative solvers, init and initu are ignored.
|
||||
!
|
||||
|
||||
n_row = psb_cd_get_local_rows(desc_data)
|
||||
n_col = psb_cd_get_local_cols(desc_data)
|
||||
|
||||
if (n_col <= size(work)) then
|
||||
ww => work(1:n_col)
|
||||
if ((4*n_col+n_col) <= size(work)) then
|
||||
aux => work(n_col+1:)
|
||||
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/),&
|
||||
& a_err='real(psb_dpk_)')
|
||||
goto 9999
|
||||
end if
|
||||
endif
|
||||
else
|
||||
allocate(ww(n_col),aux(4*n_col),stat=info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_alloc_request_
|
||||
call psb_errpush(info,name,i_err=(/5*n_col/),&
|
||||
& a_err='real(psb_dpk_)')
|
||||
goto 9999
|
||||
end if
|
||||
endif
|
||||
|
||||
select case(trans_)
|
||||
case('N')
|
||||
call psb_spmm(done,sv%w,x,dzero,ww,desc_data,info,&
|
||||
& trans=trans_,work=aux,doswap=.false.)
|
||||
ww(1:n_row) = ww(1:n_row) * sv%d(1:n_row)
|
||||
if (info == psb_success_) &
|
||||
& call psb_spmm(alpha,sv%z,ww,beta,y,desc_data,info,&
|
||||
& trans=trans_,work=aux,doswap=.false.)
|
||||
|
||||
case('T','C')
|
||||
call psb_spmm(done,sv%z,x,dzero,ww,desc_data,info,&
|
||||
& trans=trans_,work=aux,doswap=.false.)
|
||||
ww(1:n_row) = ww(1:n_row) * sv%d(1:n_row)
|
||||
if (info == psb_success_) &
|
||||
& call psb_spmm(alpha,sv%w,ww,beta,y,desc_data,info,&
|
||||
& trans=trans_,work=aux,doswap=.false.)
|
||||
|
||||
case default
|
||||
call psb_errpush(psb_err_internal_error_,name,&
|
||||
& a_err='Invalid TRANS in ainv subsolve')
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
|
||||
if (info /= psb_success_) then
|
||||
|
||||
call psb_errpush(psb_err_internal_error_,name,&
|
||||
& a_err='Error in subsolve')
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
if (n_col <= size(work)) then
|
||||
if ((4*n_col+n_col) <= size(work)) then
|
||||
else
|
||||
deallocate(aux,stat=info)
|
||||
endif
|
||||
else
|
||||
deallocate(ww,aux,stat=info)
|
||||
endif
|
||||
|
||||
if (info /= psb_success_) then
|
||||
|
||||
call psb_errpush(psb_err_internal_error_,name,&
|
||||
& a_err='Deallocate')
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_d_base_ainv_solver_apply
|
||||
@@ -0,0 +1,167 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_base_ainv_solver_apply_vect(alpha,sv,x,beta,y,desc_data,&
|
||||
& trans,work,wv,info,init,initu)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_base_ainv_mod, amg_protect_name => amg_d_base_ainv_solver_apply_vect
|
||||
implicit none
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(amg_d_base_ainv_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
|
||||
real(psb_dpk_), pointer :: ww(:), aux(:)
|
||||
type(psb_d_vect_type) :: tx,ty
|
||||
integer(psb_ipk_) :: np,me,i, err_act
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
character :: trans_
|
||||
character(len=20) :: name='d_base_ainv_solver_apply'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
info = psb_success_
|
||||
|
||||
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
|
||||
!
|
||||
! For non-iterative solvers, init and initu are ignored.
|
||||
!
|
||||
|
||||
n_row = psb_cd_get_local_rows(desc_data)
|
||||
n_col = psb_cd_get_local_cols(desc_data)
|
||||
|
||||
if (n_col <= size(work)) then
|
||||
ww => work(1:n_col)
|
||||
if ((4*n_col+n_col) <= size(work)) then
|
||||
aux => work(n_col+1:)
|
||||
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/),&
|
||||
& a_err='real(psb_dpk_)')
|
||||
goto 9999
|
||||
end if
|
||||
endif
|
||||
else
|
||||
allocate(ww(n_col),aux(4*n_col),stat=info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_alloc_request_
|
||||
call psb_errpush(info,name,i_err=(/5*n_col/),&
|
||||
& a_err='real(psb_dpk_)')
|
||||
goto 9999
|
||||
end if
|
||||
endif
|
||||
|
||||
if (size(wv) < 2) then
|
||||
info = psb_err_internal_error_
|
||||
call psb_errpush(info,name,&
|
||||
& a_err='invalid wv size')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
|
||||
associate(tx => wv(1), ty => wv(2))
|
||||
|
||||
select case(trans_)
|
||||
case('N')
|
||||
call psb_spmm(done,sv%w,x,dzero,tx,desc_data,info,&
|
||||
& trans=trans_,work=aux,doswap=.false.)
|
||||
if (info == psb_success_) call ty%mlt(done,sv%dv,tx,dzero,info)
|
||||
if (info == psb_success_) &
|
||||
& call psb_spmm(alpha,sv%z,ty,beta,y,desc_data,info,&
|
||||
& trans=trans_,work=aux,doswap=.false.)
|
||||
|
||||
case('T','C')
|
||||
call psb_spmm(done,sv%z,x,dzero,tx,desc_data,info,&
|
||||
& trans=trans_,work=aux,doswap=.false.)
|
||||
if (info == psb_success_) call ty%mlt(done,sv%dv,tx,dzero,info)
|
||||
if (info == psb_success_) &
|
||||
& call psb_spmm(alpha,sv%w,ty,beta,y,desc_data,info,&
|
||||
& trans=trans_,work=aux,doswap=.false.)
|
||||
|
||||
case default
|
||||
call psb_errpush(psb_err_internal_error_,name,&
|
||||
& a_err='Invalid TRANS in ainv subsolve')
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
|
||||
if (info /= psb_success_) then
|
||||
|
||||
call psb_errpush(psb_err_internal_error_,name,&
|
||||
& a_err='Error in subsolve')
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
end associate
|
||||
|
||||
if (n_col <= size(work)) then
|
||||
if ((4*n_col+n_col) <= size(work)) then
|
||||
else
|
||||
deallocate(aux,stat=info)
|
||||
endif
|
||||
else
|
||||
deallocate(ww,aux,stat=info)
|
||||
endif
|
||||
|
||||
if (info /= psb_success_) then
|
||||
|
||||
call psb_errpush(psb_err_internal_error_,name,&
|
||||
& a_err='Deallocate')
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_d_base_ainv_solver_apply_vect
|
||||
@@ -0,0 +1,63 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_base_ainv_solver_cnv(sv,info,amold,vmold,imold)
|
||||
use psb_base_mod
|
||||
use amg_d_base_ainv_mod, amg_protect_name => amg_d_base_ainv_solver_cnv
|
||||
Implicit None
|
||||
! Arguments
|
||||
class(amg_d_base_ainv_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
|
||||
integer(psb_ipk_) :: i, j, il1, iln, lname, lev
|
||||
integer(psb_ipk_) :: iam, np
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
character(len=80) :: prefix_
|
||||
character(len=120) :: fname ! len should be at least 20 more than
|
||||
logical :: solver_
|
||||
! len of prefix_
|
||||
|
||||
info = 0
|
||||
|
||||
if (present(amold)) then
|
||||
call sv%w%cscnv(info,mold=amold)
|
||||
call sv%z%cscnv(info,mold=amold)
|
||||
end if
|
||||
call sv%dv%cnv(mold=vmold)
|
||||
|
||||
end subroutine amg_d_base_ainv_solver_cnv
|
||||
@@ -0,0 +1,93 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_base_ainv_solver_dmp(sv,desc,level,info,prefix,head,solver,global_num)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_base_ainv_mod, amg_protect_name => amg_d_base_ainv_solver_dmp
|
||||
implicit none
|
||||
class(amg_d_base_ainv_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
|
||||
integer(psb_ipk_) :: iam, np
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
character(len=80) :: prefix_
|
||||
character(len=120) :: fname ! len should be at least 20 more than
|
||||
logical :: solver_, global_num_
|
||||
! len of prefix_
|
||||
|
||||
info = 0
|
||||
|
||||
if (present(prefix)) then
|
||||
prefix_ = trim(prefix(1:min(len(prefix),len(prefix_))))
|
||||
else
|
||||
prefix_ = "dump_ainv_d"
|
||||
end if
|
||||
|
||||
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
|
||||
lname = len_trim(prefix_)
|
||||
fname = trim(prefix_)
|
||||
write(fname(lname+1:lname+5),'(a,i3.3)') '_p',iam
|
||||
lname = lname + 5
|
||||
|
||||
if (solver_) then
|
||||
write(fname(lname+1:),'(a,i3.3,a)')'_l',level,'_wmat.mtx'
|
||||
if (sv%w%is_asb()) &
|
||||
& call sv%w%print(fname,head=head)
|
||||
write(fname(lname+1:),'(a,i3.3,a)')'_l',level,'_diag.mtx'
|
||||
if (allocated(sv%d)) &
|
||||
& call psb_geprt(fname,sv%d,head=head)
|
||||
write(fname(lname+1:),'(a,i3.3,a)')'_l',level,'_zmat.mtx'
|
||||
if (sv%z%is_asb()) &
|
||||
& call sv%z%print(fname,head=head)
|
||||
end if
|
||||
|
||||
end subroutine amg_d_base_ainv_solver_dmp
|
||||
@@ -0,0 +1,70 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_base_ainv_solver_free(sv,info)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_base_ainv_mod, amg_protect_name => amg_d_base_ainv_solver_free
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_base_ainv_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
!
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='amg_d_base_ainv_solver_free'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
call sv%clear_data(info)
|
||||
|
||||
if (allocated(sv%d)) then
|
||||
deallocate(sv%d,stat=info)
|
||||
if (info /= psb_success_) then
|
||||
info = psb_err_alloc_dealloc_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
end if
|
||||
call sv%w%free()
|
||||
call sv%z%free()
|
||||
call sv%dv%free(info)
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_d_base_ainv_solver_free
|
||||
@@ -0,0 +1,81 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_base_ainv_update_a(sv,x,desc_data,info)
|
||||
use amg_d_base_ainv_mod, amg_protect_name => amg_d_base_ainv_update_a
|
||||
use psb_base_mod
|
||||
|
||||
implicit none
|
||||
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(amg_d_base_ainv_solver_type), intent(inout) :: sv
|
||||
real(psb_dpk_),intent(in) :: x(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
! Local variables
|
||||
real(psb_dpk_), allocatable :: dd(:), ee(:)
|
||||
integer(psb_ipk_) :: nrows, ncols, i, j, k, nzr, nzc, ir, ic
|
||||
|
||||
type(psb_d_csc_sparse_mat) :: ac
|
||||
type(psb_d_csr_sparse_mat) :: ar
|
||||
|
||||
dd = sv%dv%get_vect()
|
||||
if (size(x)<size(dd)) then
|
||||
write(0,*) 'Wrong size in update',size(x),size(dd)
|
||||
info = -1
|
||||
return
|
||||
end if
|
||||
|
||||
ee = x(1:size(dd))
|
||||
call sv%z%cp_to(ac)
|
||||
call sv%w%cp_to(ar)
|
||||
! Compute diag(W ee Z)
|
||||
! First ee Z
|
||||
call ac%scal(ee,info,side='L')
|
||||
! Then diag(W (ee Z))
|
||||
do i=1,ar%get_nrows()
|
||||
ir = ar%irp(i); nzr = ar%irp(i+1)-ar%irp(i)
|
||||
ic = ac%icp(i); nzc = ac%icp(i+1)-ac%icp(i)
|
||||
ee(i) = psb_spdot_srtd(&
|
||||
& nzr,ar%ja(ir:ir+nzr-1),ar%val(ir:ir+nzr-1),&
|
||||
& nzc,ac%ia(ic:ic+nzc-1),ac%val(ic:ic+nzc-1))
|
||||
end do
|
||||
! Now invert diagonal
|
||||
dd = done/dd
|
||||
dd = dd + ee
|
||||
dd = done/dd
|
||||
sv%d = dd
|
||||
call sv%dv%bld(dd,mold=sv%dv%v)
|
||||
|
||||
end subroutine amg_d_base_ainv_update_a
|
||||
@@ -0,0 +1,93 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_invk_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
|
||||
|
||||
use psb_base_mod
|
||||
use psb_d_invk_fact_mod ! This module contains the construction routines
|
||||
|
||||
use amg_d_invk_solver, amg_protect_name => amg_d_invk_solver_bld
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
type(psb_dspmat_type), intent(in), target :: a
|
||||
Type(psb_desc_type), Intent(inout) :: desc_a
|
||||
class(amg_d_invk_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(:)
|
||||
integer(psb_ipk_) :: np,me,i, err_act, debug_unit, debug_level
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
character(len=20) :: name='d_invk_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'
|
||||
|
||||
|
||||
call psb_invk_fact(a,sv%fill_in,sv%inv_fill,&
|
||||
& sv%w,sv%d,sv%z,desc_a,info,b)
|
||||
|
||||
|
||||
if ((info == psb_success_) .and.present(amold)) then
|
||||
call sv%w%cscnv(info,mold=amold)
|
||||
if (info == psb_success_) &
|
||||
& call sv%z%cscnv(info,mold=amold)
|
||||
end if
|
||||
|
||||
if (info == psb_success_) then
|
||||
call sv%dv%bld(sv%d,mold=vmold)
|
||||
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_invk_solver_bld
|
||||
@@ -0,0 +1,64 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_invk_solver_check(sv,info)
|
||||
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_invk_solver, amg_protect_name => amg_d_invk_solver_check
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_invk_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
Integer(Psb_Ipk_) :: err_act
|
||||
character(len=20) :: name='d_invk_solver_check'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
|
||||
call amg_check_def(sv%fill_in,&
|
||||
& 'Level',izero,is_int_non_negative)
|
||||
call amg_check_def(sv%inv_fill,&
|
||||
& 'Level',izero,is_int_non_negative)
|
||||
|
||||
if (info /= psb_success_) goto 9999
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_d_invk_solver_check
|
||||
@@ -0,0 +1,90 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.0)
|
||||
!
|
||||
! (C) Copyright 2008,2009,2010,2010,2012
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
! Alfredo Buttari CNRS-IRIT, Toulouse
|
||||
! Pasqua D'Ambra ICAR-CNR, Naples
|
||||
! Daniela di Serafino Second University of Naples
|
||||
!
|
||||
! 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_invk_solver_clone(sv,svout,info)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_invk_solver, amg_protect_name => amg_d_invk_solver_clone
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_invk_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(amg_d_invk_solver_type :: svout, stat=info)
|
||||
if (info /= 0) then
|
||||
info = psb_err_alloc_dealloc_
|
||||
goto 9999
|
||||
end if
|
||||
select type(svo => svout)
|
||||
type is (amg_d_invk_solver_type)
|
||||
svo%fill_in = sv%fill_in
|
||||
svo%inv_fill = sv%inv_fill
|
||||
call psb_safe_ab_cpy(sv%d,svo%d,info)
|
||||
if (info == psb_success_) &
|
||||
& call sv%dv%clone(svo%dv,info)
|
||||
if (info == psb_success_) &
|
||||
& call sv%w%clone(svo%w,info)
|
||||
if (info == psb_success_) &
|
||||
& call sv%z%clone(svo%z,info)
|
||||
|
||||
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_invk_solver_clone
|
||||
@@ -0,0 +1,69 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_invk_solver_cseti(sv,what,val,info,idx)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_invk_solver, amg_protect_name => amg_d_invk_solver_cseti
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_invk_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_invk_solver_cseti'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select case(psb_toupper(what))
|
||||
case('SUB_FILLIN')
|
||||
sv%fill_in = val
|
||||
case('INV_FILLIN')
|
||||
sv%inv_fill = val
|
||||
case default
|
||||
call sv%amg_d_base_solver_type%set(what,val,info)
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_d_invk_solver_cseti
|
||||
@@ -0,0 +1,73 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_invk_solver_descr(sv,info,iout,coarse)
|
||||
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_invk_solver, amg_protect_name => amg_d_invk_solver_descr
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_invk_solver_type), intent(in) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(in), optional :: iout
|
||||
logical, intent(in), optional :: coarse
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: err_act
|
||||
integer(psb_ipk_) :: me, np
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
character(len=20), parameter :: name='amg_d_invk_solver_descr'
|
||||
integer(psb_ipk_) :: iout_
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
if (present(iout)) then
|
||||
iout_ = iout
|
||||
else
|
||||
iout_ = 6
|
||||
endif
|
||||
|
||||
write(iout_,*) ' INVK Approximate Inverse with ILU(N) '
|
||||
write(iout_,*) ' Fill level :',sv%fill_in
|
||||
write(iout_,*) ' Inverse fill level :',sv%inv_fill
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_d_invk_solver_descr
|
||||
@@ -0,0 +1,69 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_invk_solver_seti(sv,what,val,info)
|
||||
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_invk_solver, amg_protect_name => amg_d_invk_solver_seti
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_invk_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(in) :: what
|
||||
integer(psb_ipk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
!
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='d_invk_solver_seti'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select case(what)
|
||||
case(amg_sub_fillin_)
|
||||
sv%fill_in = val
|
||||
case(amg_inv_fillin_)
|
||||
sv%inv_fill = val
|
||||
case default
|
||||
! call sv%amg_d_base_solver_type%set(what,val,info)
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_d_invk_solver_seti
|
||||
@@ -0,0 +1,97 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_invt_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
|
||||
use psb_base_mod
|
||||
use psb_d_invt_fact_mod ! This module contains the construction routines
|
||||
use amg_d_invt_solver, amg_protect_name => amg_d_invt_solver_bld
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
type(psb_dspmat_type), intent(in), target :: a
|
||||
Type(psb_desc_type), Intent(inout) :: desc_a
|
||||
class(amg_d_invt_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(:)
|
||||
integer(psb_ipk_) :: np,me,i, err_act, debug_unit, debug_level
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
character(len=20) :: name='amg_d_invt_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'
|
||||
|
||||
|
||||
call psb_invt_fact(a,sv%fill_in,sv%inv_fill,&
|
||||
& sv%thresh,sv%inv_thresh,&
|
||||
& sv%w,sv%d,sv%z,desc_a,info,b)
|
||||
|
||||
if ((info == psb_success_) .and.present(amold)) then
|
||||
call sv%w%cscnv(info,mold=amold)
|
||||
if (info == psb_success_) &
|
||||
& call sv%z%cscnv(info,mold=amold)
|
||||
end if
|
||||
|
||||
if (info == psb_success_) then
|
||||
call sv%dv%bld(sv%d,mold=vmold)
|
||||
end if
|
||||
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_internal_error_,name)
|
||||
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_invt_solver_bld
|
||||
@@ -0,0 +1,69 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_invt_solver_check(sv,info)
|
||||
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_invt_solver, amg_protect_name => amg_d_invt_solver_check
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_invt_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
!
|
||||
Integer(Psb_Ipk_) :: err_act
|
||||
character(len=20) :: name='amg_d_invt_solver_check'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
|
||||
call amg_check_def(sv%fill_in,&
|
||||
& 'Level',izero,is_int_non_negative)
|
||||
call amg_check_def(sv%inv_fill,&
|
||||
& 'Level',izero,is_int_non_negative)
|
||||
call amg_check_def(sv%thresh,&
|
||||
& 'Eps',dzero,is_legal_d_fact_thrs)
|
||||
call amg_check_def(sv%inv_thresh,&
|
||||
& 'Eps',dzero,is_legal_d_fact_thrs)
|
||||
|
||||
if (info /= psb_success_) goto 9999
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_d_invt_solver_check
|
||||
@@ -0,0 +1,92 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.0)
|
||||
!
|
||||
! (C) Copyright 2008,2009,2010,2010,2012
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
! Alfredo Buttari CNRS-IRIT, Toulouse
|
||||
! Pasqua D'Ambra ICAR-CNR, Naples
|
||||
! Daniela di Serafino Second University of Naples
|
||||
!
|
||||
! 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_invt_solver_clone(sv,svout,info)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_invt_solver, amg_protect_name => amg_d_invt_solver_clone
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_invt_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(amg_d_invt_solver_type :: svout, stat=info)
|
||||
if (info /= 0) then
|
||||
info = psb_err_alloc_dealloc_
|
||||
goto 9999
|
||||
end if
|
||||
select type(svo => svout)
|
||||
type is (amg_d_invt_solver_type)
|
||||
svo%fill_in = sv%fill_in
|
||||
svo%inv_fill = sv%inv_fill
|
||||
svo%thresh = sv%thresh
|
||||
svo%inv_thresh = sv%inv_thresh
|
||||
call psb_safe_ab_cpy(sv%d,svo%d,info)
|
||||
if (info == psb_success_) &
|
||||
& call sv%dv%clone(svo%dv,info)
|
||||
if (info == psb_success_) &
|
||||
& call sv%w%clone(svo%w,info)
|
||||
if (info == psb_success_) &
|
||||
& call sv%z%clone(svo%z,info)
|
||||
|
||||
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_invt_solver_clone
|
||||
@@ -0,0 +1,69 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_invt_solver_cseti(sv,what,val,info,idx)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_invt_solver, amg_protect_name => amg_d_invt_solver_cseti
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_invt_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='amg_d_invt_solver_cseti'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select case(psb_toupper(what))
|
||||
case('SUB_FILLIN')
|
||||
sv%fill_in = val
|
||||
case('INV_FILLIN')
|
||||
sv%inv_fill = val
|
||||
case default
|
||||
call sv%amg_d_base_solver_type%set(what,val,info)
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_d_invt_solver_cseti
|
||||
@@ -0,0 +1,69 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_invt_solver_csetr(sv,what,val,info,idx)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_invt_solver, amg_protect_name => amg_d_invt_solver_csetr
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_invt_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='amg_d_invt_solver_csetr'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
|
||||
select case(psb_toupper(what))
|
||||
case('SUB_ILUTHRS')
|
||||
sv%thresh = val
|
||||
case('INV_THRESH')
|
||||
sv%inv_thresh = val
|
||||
case default
|
||||
call sv%amg_d_base_solver_type%set(what,val,info)
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_d_invt_solver_csetr
|
||||
@@ -0,0 +1,74 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_invt_solver_descr(sv,info,iout,coarse)
|
||||
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_invt_solver, amg_protect_name => amg_d_invt_solver_descr
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_invt_solver_type), intent(in) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(in), optional :: iout
|
||||
logical, intent(in), optional :: coarse
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: err_act
|
||||
integer(psb_ipk_) :: ictxt, me, np
|
||||
character(len=20), parameter :: name='amg_d_invt_solver_descr'
|
||||
integer(psb_ipk_) :: iout_
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
if (present(iout)) then
|
||||
iout_ = iout
|
||||
else
|
||||
iout_ = 6
|
||||
endif
|
||||
|
||||
write(iout_,*) ' INVT Approximate Inverse with ILU(T,P) '
|
||||
write(iout_,*) ' Fill level :',sv%fill_in
|
||||
write(iout_,*) ' Fill threshold :',sv%thresh
|
||||
write(iout_,*) ' Inverse fill level :',sv%inv_fill
|
||||
write(iout_,*) ' Inverse fill threshold :',sv%inv_thresh
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_d_invt_solver_descr
|
||||
@@ -0,0 +1,70 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_invt_solver_seti(sv,what,val,info)
|
||||
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_invt_solver, amg_protect_name => amg_d_invt_solver_seti
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_invt_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(in) :: what
|
||||
integer(psb_ipk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
!
|
||||
Integer(Psb_Ipk_) :: err_act
|
||||
character(len=20) :: name='amg_d_invt_solver_seti'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select case(what)
|
||||
case(amg_sub_fillin_)
|
||||
sv%fill_in = val
|
||||
case(amg_inv_fillin_)
|
||||
sv%inv_fill = val
|
||||
case default
|
||||
!!$ write(0,*) name,': Error: invalid WHAT'
|
||||
!!$ info = -2
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_d_invt_solver_seti
|
||||
@@ -0,0 +1,69 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_invt_solver_setr(sv,what,val,info)
|
||||
|
||||
|
||||
use psb_base_mod
|
||||
use amg_d_invt_solver, amg_protect_name => amg_d_invt_solver_setr
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_d_invt_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(in) :: what
|
||||
real(psb_dpk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
!
|
||||
Integer(Psb_Ipk_) :: err_act
|
||||
character(len=20) :: name='amg_d_invt_solver_setr'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
|
||||
select case(what)
|
||||
case(amg_sub_iluthrs_)
|
||||
sv%thresh = val
|
||||
case(amg_inv_thresh_)
|
||||
sv%inv_thresh = val
|
||||
case default
|
||||
! call sv%amg_d_base_solver_type%set(what,val,info)
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_d_invt_solver_setr
|
||||
@@ -0,0 +1,98 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_ainv_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold)
|
||||
|
||||
|
||||
use psb_base_mod
|
||||
use psb_s_ainv_fact_mod
|
||||
use amg_s_ainv_solver, amg_protect_name => amg_s_ainv_solver_bld
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
type(psb_sspmat_type), intent(in), target :: a
|
||||
Type(psb_desc_type), Intent(inout) :: desc_a
|
||||
class(amg_s_ainv_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(:)
|
||||
integer(psb_ipk_) :: np,me,i, err_act, debug_unit, debug_level
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
character(len=20) :: name='amg_s_ainv_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'
|
||||
|
||||
call psb_s_ainv_bld(a,sv%alg,sv%fill_in,sv%thresh,&
|
||||
& sv%w,sv%d,sv%z,desc_a,info,b,iscale=amg_ilu_scale_maxval_)
|
||||
|
||||
if ((info == psb_success_) .and.present(amold)) then
|
||||
call sv%w%set_asb()
|
||||
call sv%w%trim()
|
||||
call sv%z%set_asb()
|
||||
call sv%z%trim()
|
||||
call sv%w%cscnv(info,mold=amold)
|
||||
if (info == psb_success_) &
|
||||
& call sv%z%cscnv(info,mold=amold)
|
||||
end if
|
||||
|
||||
if (info == psb_success_) &
|
||||
& call sv%dv%bld(sv%d,mold=vmold)
|
||||
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_internal_error_,name)
|
||||
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_ainv_solver_bld
|
||||
@@ -0,0 +1,65 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_ainv_solver_check(sv,info)
|
||||
|
||||
|
||||
use psb_base_mod
|
||||
use amg_s_ainv_solver, amg_protect_name => amg_s_ainv_solver_check
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_s_ainv_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
!
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='amg_s_ainv_solver_check'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
|
||||
call amg_check_def(sv%fill_in,&
|
||||
& 'Nzmin',ione,is_positive_nz_min)
|
||||
call amg_check_def(sv%thresh,&
|
||||
& 'Eps',szero,is_legal_s_fact_thrs)
|
||||
|
||||
if (info /= psb_success_) goto 9999
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_s_ainv_solver_check
|
||||
@@ -0,0 +1,91 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.0)
|
||||
!
|
||||
! (C) Copyright 2008,2009,2010,2010,2012
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
! Alfredo Buttari CNRS-IRIT, Toulouse
|
||||
! Pasqua D'Ambra ICAR-CNR, Naples
|
||||
! Daniela di Serafino Second University of Naples
|
||||
!
|
||||
! 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_ainv_solver_clone(sv,svout,info)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_s_ainv_solver, amg_protect_name => amg_s_ainv_solver_clone
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_s_ainv_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(amg_s_ainv_solver_type :: svout, stat=info)
|
||||
if (info /= 0) then
|
||||
info = psb_err_alloc_dealloc_
|
||||
goto 9999
|
||||
end if
|
||||
select type(svo => svout)
|
||||
type is (amg_s_ainv_solver_type)
|
||||
svo%alg = sv%alg
|
||||
svo%fill_in = sv%fill_in
|
||||
svo%thresh = sv%thresh
|
||||
call psb_safe_ab_cpy(sv%d,svo%d,info)
|
||||
if (info == psb_success_) &
|
||||
& call sv%dv%clone(svo%dv,info)
|
||||
if (info == psb_success_) &
|
||||
& call sv%w%clone(svo%w,info)
|
||||
if (info == psb_success_) &
|
||||
& call sv%z%clone(svo%z,info)
|
||||
|
||||
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_ainv_solver_clone
|
||||
@@ -0,0 +1,79 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_ainv_solver_csetc(sv,what,val,info,idx)
|
||||
|
||||
|
||||
use psb_base_mod
|
||||
use amg_s_ainv_solver, amg_protect_name => amg_s_ainv_solver_csetc
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_s_ainv_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='amg_s_ainv_solver_setc'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
!!$ select case(psb_toupper(trim(what)))
|
||||
!!$ case('AINV_ALG')
|
||||
!!$ sv%alg = sv%stringval(val)
|
||||
!!$ case default
|
||||
!!$ call sv%mld_d_base_solver_type%set(what,val,info)
|
||||
!!$ end select
|
||||
ival = sv%stringval(val)
|
||||
|
||||
if (ival >=0) then
|
||||
call sv%set(what,ival,info)
|
||||
end if
|
||||
|
||||
if (info /= psb_success_) then
|
||||
info = psb_err_from_subroutine_
|
||||
call psb_errpush(info, name)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_s_ainv_solver_csetc
|
||||
@@ -0,0 +1,69 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_ainv_solver_cseti(sv,what,val,info,idx)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_s_ainv_solver, amg_protect_name => amg_s_ainv_solver_cseti
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_s_ainv_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='amg_s_ainv_solver_cseti'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select case(psb_toupper(trim(what)))
|
||||
case('SUB_FILLIN')
|
||||
sv%fill_in = val
|
||||
case('AINV_ALG')
|
||||
sv%alg = val
|
||||
case default
|
||||
call sv%amg_s_base_solver_type%set(what,val,info)
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_s_ainv_solver_cseti
|
||||
@@ -0,0 +1,67 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_ainv_solver_csetr(sv,what,val,info,idx)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_s_ainv_solver, amg_protect_name => amg_s_ainv_solver_csetr
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_s_ainv_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='amg_s_ainv_solver_csetr'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
|
||||
select case(psb_toupper(what))
|
||||
case('SUB_ILUTHRS')
|
||||
sv%thresh = val
|
||||
case default
|
||||
call sv%amg_s_base_solver_type%set(what,val,info)
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_s_ainv_solver_csetr
|
||||
@@ -0,0 +1,73 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_ainv_solver_descr(sv,info,iout,coarse)
|
||||
|
||||
|
||||
use psb_base_mod
|
||||
use amg_s_ainv_solver, amg_protect_name => amg_s_ainv_solver_descr
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_s_ainv_solver_type), intent(in) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(in), optional :: iout
|
||||
logical, intent(in), optional :: coarse
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: err_act
|
||||
integer(psb_ipk_) :: ictxt, me, np
|
||||
character(len=20), parameter :: name='amg_s_ainv_solver_descr'
|
||||
integer(psb_ipk_) :: iout_
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
if (present(iout)) then
|
||||
iout_ = iout
|
||||
else
|
||||
iout_ = 6
|
||||
endif
|
||||
|
||||
write(iout_,*) ' AINV: Approximate Inverse with sparse biconjugation '
|
||||
write(iout_,*) ' Algorithm variant : ',sv%algname(sv%alg)
|
||||
write(iout_,*) ' Fill level : ',sv%fill_in
|
||||
write(iout_,*) ' Fill threshold : ',sv%thresh
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_s_ainv_solver_descr
|
||||
@@ -0,0 +1,71 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_ainv_solver_setc(sv,what,val,info)
|
||||
|
||||
|
||||
use psb_base_mod
|
||||
use amg_s_ainv_solver, amg_protect_name => amg_s_ainv_solver_setc
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_s_ainv_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(in) :: what
|
||||
character(len=*), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
!
|
||||
integer(psb_ipk_) :: err_act, ival
|
||||
character(len=20) :: name='amg_s_ainv_solver_setc'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
ival = sv%stringval(val)
|
||||
if (ival >=0) then
|
||||
call sv%set(what,ival,info)
|
||||
end if
|
||||
|
||||
if (info /= psb_success_) then
|
||||
info = psb_err_from_subroutine_
|
||||
call psb_errpush(info, name)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_s_ainv_solver_setc
|
||||
@@ -0,0 +1,70 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_ainv_solver_seti(sv,what,val,info)
|
||||
|
||||
|
||||
use psb_base_mod
|
||||
use amg_s_ainv_solver, amg_protect_name => amg_s_ainv_solver_seti
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_s_ainv_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(in) :: what
|
||||
integer(psb_ipk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
!
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='amg_s_ainv_solver_seti'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select case(what)
|
||||
case(amg_sub_fillin_)
|
||||
sv%fill_in = val
|
||||
case(amg_ainv_alg_)
|
||||
sv%alg = val
|
||||
case default
|
||||
!!$ write(0,*) name,': Error: invalid WHAT'
|
||||
!!$ info = -2
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_s_ainv_solver_seti
|
||||
@@ -0,0 +1,69 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_ainv_solver_setr(sv,what,val,info)
|
||||
|
||||
|
||||
use psb_base_mod
|
||||
use amg_s_ainv_solver, amg_protect_name => amg_s_ainv_solver_setr
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(amg_s_ainv_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(in) :: what
|
||||
real(psb_spk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
!
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='amg_s_ainv_solver_setr'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
|
||||
select case(what)
|
||||
case(amg_sub_iluthrs_)
|
||||
sv%thresh = val
|
||||
case default
|
||||
!!$ write(0,*) name,': Error: invalid WHAT'
|
||||
!!$ info = -2
|
||||
!!$ goto 9999
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_s_ainv_solver_setr
|
||||
@@ -0,0 +1,153 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_base_ainv_solver_apply(alpha,sv,x,beta,y,desc_data,&
|
||||
& trans,work,info,init,initu)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_s_base_ainv_mod, amg_protect_name => amg_s_base_ainv_solver_apply
|
||||
implicit none
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(amg_s_base_ainv_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
|
||||
real(psb_spk_), pointer :: ww(:), aux(:), tx(:),ty(:)
|
||||
integer(psb_ipk_) :: np,me,i, err_act
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
character :: trans_
|
||||
character(len=20) :: name='d_base_ainv_solver_apply'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
info = psb_success_
|
||||
|
||||
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
|
||||
!
|
||||
! For non-iterative solvers, init and initu are ignored.
|
||||
!
|
||||
|
||||
n_row = psb_cd_get_local_rows(desc_data)
|
||||
n_col = psb_cd_get_local_cols(desc_data)
|
||||
|
||||
if (n_col <= size(work)) then
|
||||
ww => work(1:n_col)
|
||||
if ((4*n_col+n_col) <= size(work)) then
|
||||
aux => work(n_col+1:)
|
||||
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/),&
|
||||
& a_err='real(psb_dpk_)')
|
||||
goto 9999
|
||||
end if
|
||||
endif
|
||||
else
|
||||
allocate(ww(n_col),aux(4*n_col),stat=info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_alloc_request_
|
||||
call psb_errpush(info,name,i_err=(/5*n_col/),&
|
||||
& a_err='real(psb_dpk_)')
|
||||
goto 9999
|
||||
end if
|
||||
endif
|
||||
|
||||
select case(trans_)
|
||||
case('N')
|
||||
call psb_spmm(sone,sv%w,x,szero,ww,desc_data,info,&
|
||||
& trans=trans_,work=aux,doswap=.false.)
|
||||
ww(1:n_row) = ww(1:n_row) * sv%d(1:n_row)
|
||||
if (info == psb_success_) &
|
||||
& call psb_spmm(alpha,sv%z,ww,beta,y,desc_data,info,&
|
||||
& trans=trans_,work=aux,doswap=.false.)
|
||||
|
||||
case('T','C')
|
||||
call psb_spmm(sone,sv%z,x,szero,ww,desc_data,info,&
|
||||
& trans=trans_,work=aux,doswap=.false.)
|
||||
ww(1:n_row) = ww(1:n_row) * sv%d(1:n_row)
|
||||
if (info == psb_success_) &
|
||||
& call psb_spmm(alpha,sv%w,ww,beta,y,desc_data,info,&
|
||||
& trans=trans_,work=aux,doswap=.false.)
|
||||
|
||||
case default
|
||||
call psb_errpush(psb_err_internal_error_,name,&
|
||||
& a_err='Invalid TRANS in ainv subsolve')
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
|
||||
if (info /= psb_success_) then
|
||||
|
||||
call psb_errpush(psb_err_internal_error_,name,&
|
||||
& a_err='Error in subsolve')
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
if (n_col <= size(work)) then
|
||||
if ((4*n_col+n_col) <= size(work)) then
|
||||
else
|
||||
deallocate(aux,stat=info)
|
||||
endif
|
||||
else
|
||||
deallocate(ww,aux,stat=info)
|
||||
endif
|
||||
|
||||
if (info /= psb_success_) then
|
||||
|
||||
call psb_errpush(psb_err_internal_error_,name,&
|
||||
& a_err='Deallocate')
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_s_base_ainv_solver_apply
|
||||
@@ -0,0 +1,167 @@
|
||||
!
|
||||
!
|
||||
! AMG-AINV: Approximate Inverse plugin for
|
||||
! AMG4PSBLAS version 1.0
|
||||
!
|
||||
! (C) Copyright 2020
|
||||
!
|
||||
! Salvatore Filippone University of Rome Tor Vergata
|
||||
!
|
||||
! 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_base_ainv_solver_apply_vect(alpha,sv,x,beta,y,desc_data,&
|
||||
& trans,work,wv,info,init,initu)
|
||||
|
||||
use psb_base_mod
|
||||
use amg_s_base_ainv_mod, amg_protect_name => amg_s_base_ainv_solver_apply_vect
|
||||
implicit none
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(amg_s_base_ainv_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
|
||||
real(psb_spk_), pointer :: ww(:), aux(:)
|
||||
type(psb_s_vect_type) :: tx,ty
|
||||
integer(psb_ipk_) :: np,me,i, err_act
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
character :: trans_
|
||||
character(len=20) :: name='d_base_ainv_solver_apply'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
info = psb_success_
|
||||
|
||||
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
|
||||
!
|
||||
! For non-iterative solvers, init and initu are ignored.
|
||||
!
|
||||
|
||||
n_row = psb_cd_get_local_rows(desc_data)
|
||||
n_col = psb_cd_get_local_cols(desc_data)
|
||||
|
||||
if (n_col <= size(work)) then
|
||||
ww => work(1:n_col)
|
||||
if ((4*n_col+n_col) <= size(work)) then
|
||||
aux => work(n_col+1:)
|
||||
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/),&
|
||||
& a_err='real(psb_dpk_)')
|
||||
goto 9999
|
||||
end if
|
||||
endif
|
||||
else
|
||||
allocate(ww(n_col),aux(4*n_col),stat=info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_alloc_request_
|
||||
call psb_errpush(info,name,i_err=(/5*n_col/),&
|
||||
& a_err='real(psb_dpk_)')
|
||||
goto 9999
|
||||
end if
|
||||
endif
|
||||
|
||||
if (size(wv) < 2) then
|
||||
info = psb_err_internal_error_
|
||||
call psb_errpush(info,name,&
|
||||
& a_err='invalid wv size')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
|
||||
associate(tx => wv(1), ty => wv(2))
|
||||
|
||||
select case(trans_)
|
||||
case('N')
|
||||
call psb_spmm(sone,sv%w,x,szero,tx,desc_data,info,&
|
||||
& trans=trans_,work=aux,doswap=.false.)
|
||||
if (info == psb_success_) call ty%mlt(sone,sv%dv,tx,szero,info)
|
||||
if (info == psb_success_) &
|
||||
& call psb_spmm(alpha,sv%z,ty,beta,y,desc_data,info,&
|
||||
& trans=trans_,work=aux,doswap=.false.)
|
||||
|
||||
case('T','C')
|
||||
call psb_spmm(sone,sv%z,x,szero,tx,desc_data,info,&
|
||||
& trans=trans_,work=aux,doswap=.false.)
|
||||
if (info == psb_success_) call ty%mlt(sone,sv%dv,tx,szero,info)
|
||||
if (info == psb_success_) &
|
||||
& call psb_spmm(alpha,sv%w,ty,beta,y,desc_data,info,&
|
||||
& trans=trans_,work=aux,doswap=.false.)
|
||||
|
||||
case default
|
||||
call psb_errpush(psb_err_internal_error_,name,&
|
||||
& a_err='Invalid TRANS in ainv subsolve')
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
|
||||
if (info /= psb_success_) then
|
||||
|
||||
call psb_errpush(psb_err_internal_error_,name,&
|
||||
& a_err='Error in subsolve')
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
end associate
|
||||
|
||||
if (n_col <= size(work)) then
|
||||
if ((4*n_col+n_col) <= size(work)) then
|
||||
else
|
||||
deallocate(aux,stat=info)
|
||||
endif
|
||||
else
|
||||
deallocate(ww,aux,stat=info)
|
||||
endif
|
||||
|
||||
if (info /= psb_success_) then
|
||||
|
||||
call psb_errpush(psb_err_internal_error_,name,&
|
||||
& a_err='Deallocate')
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(err_act)
|
||||
return
|
||||
end subroutine amg_s_base_ainv_solver_apply_vect
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user