You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
472 lines
19 KiB
Fortran
472 lines
19 KiB
Fortran
8 years ago
|
!
|
||
|
!
|
||
7 years ago
|
! MLD2P4 version 2.2
|
||
8 years ago
|
! MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||
8 years ago
|
! based on PSBLAS (Parallel Sparse BLAS version 3.5)
|
||
8 years ago
|
!
|
||
7 years ago
|
! (C) Copyright 2008-2018
|
||
8 years ago
|
!
|
||
7 years ago
|
! Salvatore Filippone
|
||
|
! Pasqua D'Ambra
|
||
|
! Daniela di Serafino
|
||
8 years ago
|
!
|
||
|
! Redistribution and use in source and binary forms, with or without
|
||
|
! modification, are permitted provided that the following conditions
|
||
|
! are met:
|
||
|
! 1. Redistributions of source code must retain the above copyright
|
||
|
! notice, this list of conditions and the following disclaimer.
|
||
|
! 2. Redistributions in binary form must reproduce the above copyright
|
||
|
! notice, this list of conditions, and the following disclaimer in the
|
||
|
! documentation and/or other materials provided with the distribution.
|
||
|
! 3. The name of the MLD2P4 group or the names of its contributors may
|
||
|
! not be used to endorse or promote products derived from this
|
||
|
! software without specific written permission.
|
||
|
!
|
||
|
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||
|
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||
|
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||
|
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE MLD2P4 GROUP OR ITS CONTRIBUTORS
|
||
|
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||
|
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||
|
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||
|
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||
|
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||
|
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||
|
! POSSIBILITY OF SUCH DAMAGE.
|
||
|
!
|
||
|
!
|
||
14 years ago
|
!
|
||
4 years ago
|
! File: amg_c_as_smoother_mod.f90
|
||
14 years ago
|
!
|
||
4 years ago
|
! Module: amg_c_as_smoother_mod
|
||
14 years ago
|
!
|
||
8 years ago
|
! This module defines:
|
||
4 years ago
|
! the amg_c_as_smoother_type data structure containing the
|
||
8 years ago
|
! smoother for an Additive Schwarz smoother.
|
||
14 years ago
|
!
|
||
8 years ago
|
! To begin with, the build procedure constructs the extended
|
||
|
! matrix A and its corresponding descriptor (this has multiple
|
||
|
! halo layers duplicated across different processes); it then
|
||
|
! stores in ND the block off-diagonal matrix, and builds the solver
|
||
|
! on the (extended) block diagonal matrix.
|
||
14 years ago
|
!
|
||
8 years ago
|
! The code allows for the variations of Additive Schwartz, Restricted
|
||
|
! Additive Schwartz and Additive Schwartz with Harmonic Extensions.
|
||
|
! From an implementation point of view, these are handled by
|
||
|
! combining application/non-application of the prolongator/restrictor
|
||
|
! operators.
|
||
|
!
|
||
4 years ago
|
module amg_c_as_smoother
|
||
14 years ago
|
|
||
4 years ago
|
use amg_c_base_smoother_mod
|
||
13 years ago
|
|
||
4 years ago
|
type, extends(amg_c_base_smoother_type) :: amg_c_as_smoother_type
|
||
14 years ago
|
! The local solver component is inherited from the
|
||
|
! parent type.
|
||
4 years ago
|
! class(amg_c_base_solver_type), allocatable :: sv
|
||
14 years ago
|
!
|
||
|
type(psb_cspmat_type) :: nd
|
||
12 years ago
|
type(psb_desc_type) :: desc_data
|
||
5 years ago
|
integer(psb_ipk_) :: novr, restr, prol
|
||
|
integer(psb_lpk_) :: nd_nnz_tot
|
||
14 years ago
|
contains
|
||
4 years ago
|
procedure, pass(sm) :: apply_v => amg_c_as_smoother_apply_vect
|
||
|
procedure, pass(sm) :: apply_a => amg_c_as_smoother_apply
|
||
|
procedure, pass(sm) :: check => amg_c_as_smoother_check
|
||
|
procedure, pass(sm) :: dump => amg_c_as_smoother_dmp
|
||
|
procedure, pass(sm) :: build => amg_c_as_smoother_bld
|
||
|
procedure, pass(sm) :: cnv => amg_c_as_smoother_cnv
|
||
|
procedure, pass(sm) :: clone => amg_c_as_smoother_clone
|
||
|
procedure, pass(sm) :: clone_settings => amg_c_as_smoother_clone_settings
|
||
|
procedure, pass(sm) :: clear_data => amg_c_as_smoother_clear_data
|
||
|
procedure, pass(sm) :: restr_a => amg_c_as_smoother_restr_a
|
||
|
procedure, pass(sm) :: prol_a => amg_c_as_smoother_prol_a
|
||
|
procedure, pass(sm) :: restr_v => amg_c_as_smoother_restr_v
|
||
|
procedure, pass(sm) :: prol_v => amg_c_as_smoother_prol_v
|
||
9 years ago
|
generic, public :: apply_restr => restr_v, restr_a
|
||
|
generic, public :: apply_prol => prol_v, prol_a
|
||
4 years ago
|
procedure, pass(sm) :: free => amg_c_as_smoother_free
|
||
|
procedure, pass(sm) :: cseti => amg_c_as_smoother_cseti
|
||
|
procedure, pass(sm) :: csetc => amg_c_as_smoother_csetc
|
||
13 years ago
|
procedure, pass(sm) :: descr => c_as_smoother_descr
|
||
|
procedure, pass(sm) :: sizeof => c_as_smoother_sizeof
|
||
14 years ago
|
procedure, pass(sm) :: default => c_as_smoother_default
|
||
13 years ago
|
procedure, pass(sm) :: get_nzeros => c_as_smoother_get_nzeros
|
||
7 years ago
|
procedure, pass(sm) :: get_wrksz => c_as_smoother_get_wrksize
|
||
12 years ago
|
procedure, nopass :: get_fmt => c_as_smoother_get_fmt
|
||
8 years ago
|
procedure, nopass :: get_id => c_as_smoother_get_id
|
||
4 years ago
|
end type amg_c_as_smoother_type
|
||
14 years ago
|
|
||
|
|
||
13 years ago
|
private :: c_as_smoother_descr, c_as_smoother_sizeof, &
|
||
12 years ago
|
& c_as_smoother_default, c_as_smoother_get_nzeros, &
|
||
7 years ago
|
& c_as_smoother_get_fmt, c_as_smoother_get_id, &
|
||
|
& c_as_smoother_get_wrksize
|
||
13 years ago
|
|
||
14 years ago
|
character(len=6), parameter, private :: &
|
||
|
& restrict_names(0:4)=(/'none ','halo ',' ',' ',' '/)
|
||
|
character(len=12), parameter, private :: &
|
||
|
& prolong_names(0:3)=(/'none ','sum ','average ','square root'/)
|
||
|
|
||
|
|
||
13 years ago
|
interface
|
||
4 years ago
|
subroutine amg_c_as_smoother_check(sm,info)
|
||
13 years ago
|
import :: psb_cspmat_type, psb_c_vect_type, psb_c_base_vect_type, &
|
||
4 years ago
|
& psb_spk_, amg_c_as_smoother_type, psb_epk_, psb_desc_type, psb_ipk_
|
||
12 years ago
|
implicit none
|
||
4 years ago
|
class(amg_c_as_smoother_type), intent(inout) :: sm
|
||
12 years ago
|
integer(psb_ipk_), intent(out) :: info
|
||
4 years ago
|
end subroutine amg_c_as_smoother_check
|
||
13 years ago
|
end interface
|
||
13 years ago
|
|
||
9 years ago
|
interface
|
||
4 years ago
|
subroutine amg_c_as_smoother_restr_v(sm,x,trans,work,info,data)
|
||
9 years ago
|
import :: psb_cspmat_type, psb_c_vect_type, psb_c_base_vect_type, &
|
||
4 years ago
|
& psb_spk_, amg_c_as_smoother_type, psb_epk_, &
|
||
9 years ago
|
& psb_desc_type, psb_ipk_
|
||
|
implicit none
|
||
4 years ago
|
class(amg_c_as_smoother_type), intent(inout) :: sm
|
||
9 years ago
|
type(psb_c_vect_type),intent(inout) :: x
|
||
|
character(len=1),intent(in) :: trans
|
||
|
complex(psb_spk_),target, intent(inout) :: work(:)
|
||
|
integer(psb_ipk_), intent(out) :: info
|
||
|
integer(psb_ipk_), optional, intent(in) :: data
|
||
4 years ago
|
end subroutine amg_c_as_smoother_restr_v
|
||
9 years ago
|
end interface
|
||
|
|
||
|
interface
|
||
4 years ago
|
subroutine amg_c_as_smoother_restr_a(sm,x,trans,work,info,data)
|
||
9 years ago
|
import :: psb_cspmat_type, psb_c_vect_type, psb_c_base_vect_type, &
|
||
4 years ago
|
& psb_spk_, amg_c_as_smoother_type, psb_epk_, &
|
||
9 years ago
|
& psb_desc_type, psb_ipk_
|
||
|
implicit none
|
||
4 years ago
|
class(amg_c_as_smoother_type), intent(inout) :: sm
|
||
9 years ago
|
complex(psb_spk_), intent(inout) :: x(:)
|
||
|
character(len=1),intent(in) :: trans
|
||
|
complex(psb_spk_),target, intent(inout) :: work(:)
|
||
|
integer(psb_ipk_), intent(out) :: info
|
||
|
integer(psb_ipk_), optional, intent(in) :: data
|
||
4 years ago
|
end subroutine amg_c_as_smoother_restr_a
|
||
9 years ago
|
end interface
|
||
|
|
||
|
interface
|
||
4 years ago
|
subroutine amg_c_as_smoother_prol_v(sm,x,trans,work,info,data)
|
||
9 years ago
|
import :: psb_cspmat_type, psb_c_vect_type, psb_c_base_vect_type, &
|
||
4 years ago
|
& psb_spk_, amg_c_as_smoother_type, psb_epk_, &
|
||
9 years ago
|
& psb_desc_type, psb_ipk_
|
||
|
implicit none
|
||
4 years ago
|
class(amg_c_as_smoother_type), intent(inout) :: sm
|
||
9 years ago
|
type(psb_c_vect_type),intent(inout) :: x
|
||
|
character(len=1),intent(in) :: trans
|
||
|
complex(psb_spk_),target, intent(inout) :: work(:)
|
||
|
integer(psb_ipk_), intent(out) :: info
|
||
|
integer(psb_ipk_), optional, intent(in) :: data
|
||
4 years ago
|
end subroutine amg_c_as_smoother_prol_v
|
||
9 years ago
|
end interface
|
||
|
|
||
|
interface
|
||
4 years ago
|
subroutine amg_c_as_smoother_prol_a(sm,x,trans,work,info,data)
|
||
9 years ago
|
import :: psb_cspmat_type, psb_c_vect_type, psb_c_base_vect_type, &
|
||
4 years ago
|
& psb_spk_, amg_c_as_smoother_type, psb_epk_, &
|
||
9 years ago
|
& psb_desc_type, psb_ipk_
|
||
|
implicit none
|
||
4 years ago
|
class(amg_c_as_smoother_type), intent(inout) :: sm
|
||
9 years ago
|
complex(psb_spk_), intent(inout) :: x(:)
|
||
|
character(len=1),intent(in) :: trans
|
||
|
complex(psb_spk_),target, intent(inout) :: work(:)
|
||
|
integer(psb_ipk_), intent(out) :: info
|
||
|
integer(psb_ipk_), optional, intent(in) :: data
|
||
4 years ago
|
end subroutine amg_c_as_smoother_prol_a
|
||
9 years ago
|
end interface
|
||
|
|
||
|
|
||
13 years ago
|
interface
|
||
4 years ago
|
subroutine amg_c_as_smoother_apply_vect(alpha,sm,x,beta,y,desc_data,&
|
||
7 years ago
|
& trans,sweeps,work,wv,info,init,initu)
|
||
13 years ago
|
import :: psb_cspmat_type, psb_c_vect_type, psb_c_base_vect_type, &
|
||
4 years ago
|
& psb_spk_, amg_c_as_smoother_type, psb_epk_, &
|
||
11 years ago
|
& psb_desc_type, psb_ipk_
|
||
12 years ago
|
implicit none
|
||
13 years ago
|
type(psb_desc_type), intent(in) :: desc_data
|
||
4 years ago
|
class(amg_c_as_smoother_type), intent(inout) :: sm
|
||
13 years ago
|
type(psb_c_vect_type),intent(inout) :: x
|
||
|
type(psb_c_vect_type),intent(inout) :: y
|
||
12 years ago
|
complex(psb_spk_),intent(in) :: alpha,beta
|
||
|
character(len=1),intent(in) :: trans
|
||
|
integer(psb_ipk_), intent(in) :: sweeps
|
||
|
complex(psb_spk_),target, intent(inout) :: work(:)
|
||
7 years ago
|
type(psb_c_vect_type),intent(inout) :: wv(:)
|
||
12 years ago
|
integer(psb_ipk_), intent(out) :: info
|
||
9 years ago
|
character, intent(in), optional :: init
|
||
|
type(psb_c_vect_type),intent(inout), optional :: initu
|
||
4 years ago
|
end subroutine amg_c_as_smoother_apply_vect
|
||
13 years ago
|
end interface
|
||
13 years ago
|
|
||
13 years ago
|
interface
|
||
4 years ago
|
subroutine amg_c_as_smoother_apply(alpha,sm,x,beta,y,desc_data,&
|
||
9 years ago
|
& trans,sweeps,work,info,init,initu)
|
||
13 years ago
|
import :: psb_cspmat_type, psb_c_vect_type, psb_c_base_vect_type, &
|
||
4 years ago
|
& psb_spk_, amg_c_as_smoother_type, psb_epk_,&
|
||
11 years ago
|
& psb_desc_type, psb_ipk_
|
||
12 years ago
|
implicit none
|
||
13 years ago
|
type(psb_desc_type), intent(in) :: desc_data
|
||
4 years ago
|
class(amg_c_as_smoother_type), intent(inout) :: sm
|
||
13 years ago
|
complex(psb_spk_),intent(inout) :: x(:)
|
||
|
complex(psb_spk_),intent(inout) :: y(:)
|
||
|
complex(psb_spk_),intent(in) :: alpha,beta
|
||
12 years ago
|
character(len=1),intent(in) :: trans
|
||
|
integer(psb_ipk_), intent(in) :: sweeps
|
||
13 years ago
|
complex(psb_spk_),target, intent(inout) :: work(:)
|
||
12 years ago
|
integer(psb_ipk_), intent(out) :: info
|
||
9 years ago
|
character, intent(in), optional :: init
|
||
|
complex(psb_spk_),intent(inout), optional :: initu(:)
|
||
4 years ago
|
end subroutine amg_c_as_smoother_apply
|
||
13 years ago
|
end interface
|
||
13 years ago
|
|
||
13 years ago
|
interface
|
||
4 years ago
|
subroutine amg_c_as_smoother_bld(a,desc_a,sm,info,amold,vmold,imold)
|
||
13 years ago
|
import :: psb_cspmat_type, psb_c_vect_type, psb_c_base_vect_type, &
|
||
4 years ago
|
& psb_spk_, amg_c_as_smoother_type, psb_epk_, &
|
||
11 years ago
|
& psb_desc_type, psb_c_base_sparse_mat, psb_ipk_,&
|
||
|
& psb_i_base_vect_type
|
||
12 years ago
|
implicit none
|
||
|
type(psb_cspmat_type), intent(in), target :: a
|
||
12 years ago
|
Type(psb_desc_type), Intent(inout) :: desc_a
|
||
4 years ago
|
class(amg_c_as_smoother_type), intent(inout) :: sm
|
||
12 years ago
|
integer(psb_ipk_), intent(out) :: info
|
||
13 years ago
|
class(psb_c_base_sparse_mat), intent(in), optional :: amold
|
||
|
class(psb_c_base_vect_type), intent(in), optional :: vmold
|
||
11 years ago
|
class(psb_i_base_vect_type), intent(in), optional :: imold
|
||
4 years ago
|
end subroutine amg_c_as_smoother_bld
|
||
13 years ago
|
end interface
|
||
13 years ago
|
|
||
11 years ago
|
interface
|
||
4 years ago
|
subroutine amg_c_as_smoother_cnv(sm,info,amold,vmold,imold)
|
||
11 years ago
|
import :: psb_c_base_vect_type, &
|
||
4 years ago
|
& psb_spk_, amg_c_as_smoother_type, psb_epk_, &
|
||
11 years ago
|
& psb_c_base_sparse_mat, psb_ipk_, psb_i_base_vect_type
|
||
|
implicit none
|
||
4 years ago
|
class(amg_c_as_smoother_type), intent(inout) :: sm
|
||
11 years ago
|
integer(psb_ipk_), intent(out) :: info
|
||
|
class(psb_c_base_sparse_mat), intent(in), optional :: amold
|
||
|
class(psb_c_base_vect_type), intent(in), optional :: vmold
|
||
|
class(psb_i_base_vect_type), intent(in), optional :: imold
|
||
4 years ago
|
end subroutine amg_c_as_smoother_cnv
|
||
11 years ago
|
end interface
|
||
|
|
||
13 years ago
|
interface
|
||
4 years ago
|
subroutine amg_c_as_smoother_cseti(sm,what,val,info,idx)
|
||
12 years ago
|
import :: psb_cspmat_type, psb_c_vect_type, psb_c_base_vect_type, &
|
||
4 years ago
|
& psb_spk_, amg_c_as_smoother_type, psb_epk_, psb_desc_type, psb_ipk_
|
||
12 years ago
|
implicit none
|
||
4 years ago
|
class(amg_c_as_smoother_type), intent(inout) :: sm
|
||
12 years ago
|
character(len=*), intent(in) :: what
|
||
|
integer(psb_ipk_), intent(in) :: val
|
||
|
integer(psb_ipk_), intent(out) :: info
|
||
6 years ago
|
integer(psb_ipk_), intent(in), optional :: idx
|
||
4 years ago
|
end subroutine amg_c_as_smoother_cseti
|
||
12 years ago
|
end interface
|
||
|
|
||
|
interface
|
||
4 years ago
|
subroutine amg_c_as_smoother_csetc(sm,what,val,info,idx)
|
||
12 years ago
|
import :: psb_cspmat_type, psb_c_vect_type, psb_c_base_vect_type, &
|
||
4 years ago
|
& psb_spk_, amg_c_as_smoother_type, psb_epk_, psb_desc_type, psb_ipk_
|
||
12 years ago
|
implicit none
|
||
4 years ago
|
class(amg_c_as_smoother_type), intent(inout) :: sm
|
||
12 years ago
|
character(len=*), intent(in) :: what
|
||
|
character(len=*), intent(in) :: val
|
||
|
integer(psb_ipk_), intent(out) :: info
|
||
6 years ago
|
integer(psb_ipk_), intent(in), optional :: idx
|
||
4 years ago
|
end subroutine amg_c_as_smoother_csetc
|
||
12 years ago
|
end interface
|
||
|
|
||
13 years ago
|
interface
|
||
4 years ago
|
subroutine amg_c_as_smoother_free(sm,info)
|
||
13 years ago
|
import :: psb_cspmat_type, psb_c_vect_type, psb_c_base_vect_type, &
|
||
4 years ago
|
& psb_spk_, amg_c_as_smoother_type, psb_epk_, psb_desc_type, psb_ipk_
|
||
12 years ago
|
implicit none
|
||
4 years ago
|
class(amg_c_as_smoother_type), intent(inout) :: sm
|
||
12 years ago
|
integer(psb_ipk_), intent(out) :: info
|
||
4 years ago
|
end subroutine amg_c_as_smoother_free
|
||
13 years ago
|
end interface
|
||
13 years ago
|
|
||
13 years ago
|
interface
|
||
4 years ago
|
subroutine amg_c_as_smoother_dmp(sm,desc,level,info,prefix,head,smoother,solver,global_num)
|
||
13 years ago
|
import :: psb_cspmat_type, psb_c_vect_type, psb_c_base_vect_type, &
|
||
4 years ago
|
& psb_spk_, amg_c_as_smoother_type, psb_epk_, psb_desc_type, &
|
||
12 years ago
|
& psb_ipk_
|
||
12 years ago
|
implicit none
|
||
4 years ago
|
class(amg_c_as_smoother_type), intent(in) :: sm
|
||
5 years ago
|
type(psb_desc_type), intent(in) :: desc
|
||
12 years ago
|
integer(psb_ipk_), intent(in) :: level
|
||
|
integer(psb_ipk_), intent(out) :: info
|
||
13 years ago
|
character(len=*), intent(in), optional :: prefix, head
|
||
5 years ago
|
logical, optional, intent(in) :: smoother, solver, global_num
|
||
4 years ago
|
end subroutine amg_c_as_smoother_dmp
|
||
13 years ago
|
end interface
|
||
13 years ago
|
|
||
12 years ago
|
interface
|
||
4 years ago
|
subroutine amg_c_as_smoother_clone(sm,smout,info)
|
||
|
import :: amg_c_as_smoother_type, psb_spk_, &
|
||
|
& amg_c_base_smoother_type, psb_ipk_
|
||
|
class(amg_c_as_smoother_type), intent(inout) :: sm
|
||
|
class(amg_c_base_smoother_type), allocatable, intent(inout) :: smout
|
||
12 years ago
|
integer(psb_ipk_), intent(out) :: info
|
||
4 years ago
|
end subroutine amg_c_as_smoother_clone
|
||
12 years ago
|
end interface
|
||
5 years ago
|
|
||
|
|
||
|
interface
|
||
4 years ago
|
subroutine amg_c_as_smoother_clone_settings(sm,smout,info)
|
||
5 years ago
|
import :: psb_desc_type, psb_cspmat_type, psb_c_base_sparse_mat, &
|
||
|
& psb_c_vect_type, psb_c_base_vect_type, psb_spk_, &
|
||
4 years ago
|
& amg_c_base_smoother_type, amg_c_as_smoother_type, psb_ipk_
|
||
5 years ago
|
Implicit None
|
||
|
|
||
|
! Arguments
|
||
4 years ago
|
class(amg_c_as_smoother_type), intent(inout) :: sm
|
||
|
class(amg_c_base_smoother_type), intent(inout) :: smout
|
||
5 years ago
|
integer(psb_ipk_), intent(out) :: info
|
||
4 years ago
|
end subroutine amg_c_as_smoother_clone_settings
|
||
5 years ago
|
end interface
|
||
|
|
||
|
interface
|
||
4 years ago
|
subroutine amg_c_as_smoother_clear_data(sm,info)
|
||
5 years ago
|
import :: psb_desc_type, psb_cspmat_type, psb_c_base_sparse_mat, &
|
||
|
& psb_c_vect_type, psb_c_base_vect_type, psb_spk_, &
|
||
4 years ago
|
& amg_c_as_smoother_type, psb_ipk_
|
||
5 years ago
|
Implicit None
|
||
|
|
||
|
! Arguments
|
||
4 years ago
|
class(amg_c_as_smoother_type), intent(inout) :: sm
|
||
5 years ago
|
integer(psb_ipk_), intent(out) :: info
|
||
4 years ago
|
end subroutine amg_c_as_smoother_clear_data
|
||
5 years ago
|
end interface
|
||
12 years ago
|
|
||
5 years ago
|
|
||
14 years ago
|
contains
|
||
|
|
||
13 years ago
|
function c_as_smoother_sizeof(sm) result(val)
|
||
|
implicit none
|
||
14 years ago
|
! Arguments
|
||
4 years ago
|
class(amg_c_as_smoother_type), intent(in) :: sm
|
||
7 years ago
|
integer(psb_epk_) :: val
|
||
12 years ago
|
integer(psb_ipk_) :: i
|
||
14 years ago
|
|
||
5 years ago
|
val = 3*psb_sizeof_ip + psb_sizeof_lp
|
||
13 years ago
|
if (allocated(sm%sv)) val = val + sm%sv%sizeof()
|
||
|
val = val + sm%nd%sizeof()
|
||
14 years ago
|
|
||
|
return
|
||
13 years ago
|
end function c_as_smoother_sizeof
|
||
14 years ago
|
|
||
13 years ago
|
function c_as_smoother_get_nzeros(sm) result(val)
|
||
|
implicit none
|
||
4 years ago
|
class(amg_c_as_smoother_type), intent(in) :: sm
|
||
7 years ago
|
integer(psb_epk_) :: val
|
||
12 years ago
|
integer(psb_ipk_) :: i
|
||
13 years ago
|
val = 0
|
||
|
if (allocated(sm%sv)) &
|
||
|
& val = sm%sv%get_nzeros()
|
||
|
val = val + sm%nd%get_nzeros()
|
||
14 years ago
|
|
||
13 years ago
|
end function c_as_smoother_get_nzeros
|
||
14 years ago
|
|
||
13 years ago
|
subroutine c_as_smoother_default(sm)
|
||
14 years ago
|
|
||
13 years ago
|
use psb_base_mod, only : psb_halo_, psb_none_
|
||
14 years ago
|
|
||
|
Implicit None
|
||
|
|
||
|
! Arguments
|
||
4 years ago
|
class(amg_c_as_smoother_type), intent(inout) :: sm
|
||
14 years ago
|
|
||
8 years ago
|
!
|
||
7 years ago
|
! Default: AS with 1 overlap layer
|
||
8 years ago
|
!
|
||
13 years ago
|
sm%restr = psb_halo_
|
||
7 years ago
|
sm%prol = psb_sum_
|
||
13 years ago
|
sm%novr = 1
|
||
14 years ago
|
|
||
|
if (allocated(sm%sv)) then
|
||
13 years ago
|
call sm%sv%default()
|
||
14 years ago
|
end if
|
||
|
|
||
|
return
|
||
13 years ago
|
end subroutine c_as_smoother_default
|
||
14 years ago
|
|
||
|
|
||
14 years ago
|
subroutine c_as_smoother_descr(sm,info,iout,coarse)
|
||
14 years ago
|
|
||
|
Implicit None
|
||
|
|
||
|
! Arguments
|
||
4 years ago
|
class(amg_c_as_smoother_type), intent(in) :: sm
|
||
12 years ago
|
integer(psb_ipk_), intent(out) :: info
|
||
|
integer(psb_ipk_), intent(in), optional :: iout
|
||
14 years ago
|
logical, intent(in), optional :: coarse
|
||
14 years ago
|
|
||
|
! Local variables
|
||
12 years ago
|
integer(psb_ipk_) :: err_act
|
||
4 years ago
|
character(len=20), parameter :: name='amg_c_as_smoother_descr'
|
||
12 years ago
|
integer(psb_ipk_) :: iout_
|
||
14 years ago
|
logical :: coarse_
|
||
14 years ago
|
|
||
|
call psb_erractionsave(err_act)
|
||
|
info = psb_success_
|
||
14 years ago
|
if (present(coarse)) then
|
||
|
coarse_ = coarse
|
||
|
else
|
||
|
coarse_ = .false.
|
||
|
end if
|
||
14 years ago
|
if (present(iout)) then
|
||
|
iout_ = iout
|
||
|
else
|
||
8 years ago
|
iout_ = psb_out_unit
|
||
14 years ago
|
endif
|
||
|
|
||
14 years ago
|
if (.not.coarse_) then
|
||
|
write(iout_,*) ' Additive Schwarz with ',&
|
||
|
& sm%novr, ' overlap layers.'
|
||
|
write(iout_,*) ' Restrictor: ',restrict_names(sm%restr)
|
||
|
write(iout_,*) ' Prolongator: ',prolong_names(sm%prol)
|
||
|
write(iout_,*) ' Local solver:'
|
||
|
endif
|
||
14 years ago
|
if (allocated(sm%sv)) then
|
||
14 years ago
|
call sm%sv%descr(info,iout_,coarse=coarse)
|
||
14 years ago
|
end if
|
||
|
|
||
|
call psb_erractionrestore(err_act)
|
||
|
return
|
||
|
|
||
10 years ago
|
9999 call psb_error_handler(err_act)
|
||
14 years ago
|
return
|
||
10 years ago
|
|
||
14 years ago
|
end subroutine c_as_smoother_descr
|
||
|
|
||
7 years ago
|
function c_as_smoother_get_wrksize(sm) result(val)
|
||
|
implicit none
|
||
4 years ago
|
class(amg_c_as_smoother_type), intent(inout) :: sm
|
||
7 years ago
|
integer(psb_ipk_) :: val
|
||
|
|
||
|
val = 3
|
||
|
if (allocated(sm%sv)) val = val + sm%sv%get_wrksz()
|
||
|
|
||
|
end function c_as_smoother_get_wrksize
|
||
|
|
||
12 years ago
|
function c_as_smoother_get_fmt() result(val)
|
||
|
implicit none
|
||
|
character(len=32) :: val
|
||
|
|
||
7 years ago
|
val = "Additive Schwarz"
|
||
12 years ago
|
end function c_as_smoother_get_fmt
|
||
|
|
||
8 years ago
|
function c_as_smoother_get_id() result(val)
|
||
|
implicit none
|
||
|
integer(psb_ipk_) :: val
|
||
|
|
||
4 years ago
|
val = amg_as_
|
||
8 years ago
|
end function c_as_smoother_get_id
|
||
|
|
||
4 years ago
|
end module amg_c_as_smoother
|