mirror of
https://github.com/sfilippone/psblas3.git
synced 2026-10-13 01:19:05 +00:00
base/comm/psb_cgather.f90 base/comm/psb_chalo.f90 base/comm/psb_covrl.f90 base/comm/psb_cscatter.F90 base/comm/psb_dgather.f90 base/comm/psb_dhalo.f90 base/comm/psb_dovrl.f90 base/comm/psb_dscatter.F90 base/comm/psb_igather.f90 base/comm/psb_ihalo.f90 base/comm/psb_iovrl.f90 base/comm/psb_iscatter.F90 base/comm/psb_sgather.f90 base/comm/psb_shalo.f90 base/comm/psb_sovrl.f90 base/comm/psb_sscatter.F90 base/comm/psb_zgather.f90 base/comm/psb_zhalo.f90 base/comm/psb_zovrl.f90 base/comm/psb_zscatter.F90 base/internals/psi_bld_g2lmap.f90 base/internals/psi_bld_tmphalo.f90 base/internals/psi_bld_tmpovrl.f90 base/internals/psi_compute_size.f90 base/internals/psi_crea_bnd_elem.f90 base/internals/psi_crea_index.f90 base/internals/psi_crea_ovr_elem.f90 base/internals/psi_cswapdata.F90 base/internals/psi_cswaptran.F90 base/internals/psi_desc_index.F90 base/internals/psi_dl_check.f90 base/internals/psi_dswapdata.F90 base/internals/psi_dswaptran.F90 base/internals/psi_exist_ovr_elem.f base/internals/psi_extrct_dl.F90 base/internals/psi_fnd_owner.F90 base/internals/psi_idx_cnv.f90 base/internals/psi_idx_ins_cnv.f90 base/internals/psi_iswapdata.F90 base/internals/psi_iswaptran.F90 base/internals/psi_ldsc_pre_halo.f90 base/internals/psi_list_search.f base/internals/psi_sort_dl.f90 base/internals/psi_sswapdata.F90 base/internals/psi_sswaptran.F90 base/internals/psi_zswapdata.F90 base/internals/psi_zswaptran.F90 base/internals/srtlist.f base/modules/error.f90 base/modules/psb_base_mat_mod.f03 base/modules/psb_base_tools_mod.f90 base/modules/psb_c_base_mat_mod.f03 base/modules/psb_c_csc_mat_mod.f03 base/modules/psb_c_csr_mat_mod.f03 base/modules/psb_c_linmap_mod.f90 base/modules/psb_c_mat_mod.f03 base/modules/psb_c_psblas_mod.f90 base/modules/psb_c_tools_mod.f90 base/modules/psb_check_mod.f90 base/modules/psb_comm_mod.f90 base/modules/psb_const_mod.F90 base/modules/psb_d_base_mat_mod.f03 base/modules/psb_d_csc_mat_mod.f03 base/modules/psb_d_csr_mat_mod.f03 base/modules/psb_d_linmap_mod.f90 base/modules/psb_d_mat_mod.f03 base/modules/psb_d_psblas_mod.f90 base/modules/psb_d_tools_mod.f90 base/modules/psb_desc_type.f90 base/modules/psb_error_mod.F90 base/modules/psb_gps_mod.f90 base/modules/psb_hash_mod.f90 base/modules/psb_ip_reord_mod.f90 base/modules/psb_linmap_mod.f90 base/modules/psb_linmap_type_mod.f90 base/modules/psb_psblas_mod.f90 base/modules/psb_realloc_mod.F90 base/modules/psb_s_base_mat_mod.f03 base/modules/psb_s_csc_mat_mod.f03 base/modules/psb_s_csr_mat_mod.f03 base/modules/psb_s_linmap_mod.f90 base/modules/psb_s_mat_mod.f03 base/modules/psb_s_psblas_mod.f90 base/modules/psb_s_tools_mod.f90 base/modules/psb_serial_mod.f90 base/modules/psb_sort_mod.f90 base/modules/psb_sparse_mod.f90 base/modules/psb_string_mod.f90 base/modules/psb_tools_mod.f90 base/modules/psb_z_base_mat_mod.f03 base/modules/psb_z_csc_mat_mod.f03 base/modules/psb_z_csr_mat_mod.f03 base/modules/psb_z_linmap_mod.f90 base/modules/psb_z_mat_mod.f03 base/modules/psb_z_psblas_mod.f90 base/modules/psb_z_tools_mod.f90 base/modules/psi_mod.f90 base/modules/psi_serial_mod.f90 base/psblas/psb_camax.f90 base/psblas/psb_casum.f90 base/psblas/psb_caxpby.f90 base/psblas/psb_cdot.f90 base/psblas/psb_cnrm2.f90 base/psblas/psb_cnrmi.f90 base/psblas/psb_cspmm.f90 base/psblas/psb_cspsm.f90 base/psblas/psb_damax.f90 base/psblas/psb_dasum.f90 base/psblas/psb_daxpby.f90 base/psblas/psb_ddot.f90 base/psblas/psb_dnrm2.f90 base/psblas/psb_dnrmi.f90 base/psblas/psb_dspmm.f90 base/psblas/psb_dspnrm1.f90 base/psblas/psb_dspsm.f90 base/psblas/psb_samax.f90 base/psblas/psb_sasum.f90 base/psblas/psb_saxpby.f90 base/psblas/psb_sdot.f90 base/psblas/psb_snrm2.f90 base/psblas/psb_snrmi.f90 base/psblas/psb_sspmm.f90 base/psblas/psb_sspsm.f90 base/psblas/psb_sxdot.f90 base/psblas/psb_zamax.f90 base/psblas/psb_zasum.f90 base/psblas/psb_zaxpby.f90 base/psblas/psb_zdot.f90 base/psblas/psb_znrm2.f90 base/psblas/psb_znrmi.f90 base/psblas/psb_zspmm.f90 base/psblas/psb_zspsm.f90 base/serial/aux/cacmp_mod.f90 base/serial/aux/calcmp_mod.f90 base/serial/aux/calsr.f90 base/serial/aux/calsrx.f90 base/serial/aux/camsort_dw.f90 base/serial/aux/camsort_up.f90 base/serial/aux/camsr.f90 base/serial/aux/camsrx.f90 base/serial/aux/casr.f90 base/serial/aux/casrx.f90 base/serial/aux/clcmp_mod.f90 base/serial/aux/clsr.f90 base/serial/aux/clsrx.f90 base/serial/aux/dasr.f90 base/serial/aux/dasrx.f90 base/serial/aux/dmsort_dw.f90 base/serial/aux/dmsort_up.f90 base/serial/aux/dmsr.f90 base/serial/aux/dmsrx.f90 base/serial/aux/dsr.f90 base/serial/aux/dsrx.f90 base/serial/aux/iasr.f90 base/serial/aux/iasrx.f90 base/serial/aux/ibsrch.f base/serial/aux/imsr.f90 base/serial/aux/imsru.f90 base/serial/aux/imsrx.f90 base/serial/aux/isaperm.f base/serial/aux/isr.f90 base/serial/aux/isrx.f90 base/serial/aux/issrch.f base/serial/aux/msort_dw.f90 base/serial/aux/msort_up.f90 base/serial/aux/sasr.f90 base/serial/aux/sasrx.f90 base/serial/aux/smsort_dw.f90 base/serial/aux/smsort_up.f90 base/serial/aux/smsr.f90 base/serial/aux/smsrx.f90 base/serial/aux/ssr.f90 base/serial/aux/ssrx.f90 base/serial/aux/zacmp_mod.f90 base/serial/aux/zalcmp_mod.f90 base/serial/aux/zalsr.f90 base/serial/aux/zalsrx.f90 base/serial/aux/zamsort_dw.f90 base/serial/aux/zamsort_up.f90 base/serial/aux/zamsr.f90 base/serial/aux/zamsrx.f90 base/serial/aux/zasr.f90 base/serial/aux/zasrx.f90 base/serial/aux/zlcmp_mod.f90 base/serial/aux/zlsr.f90 base/serial/aux/zlsrx.f90 base/serial/f77/caxpby.f base/serial/f77/daxpby.f base/serial/f77/saxpby.f base/serial/f77/zaxpby.f base/serial/psb_cnumbmm.f90 base/serial/psb_crwextd.f90 base/serial/psb_csymbmm.f90 base/serial/psb_dnumbmm.f90 base/serial/psb_drwextd.f90 base/serial/psb_dsymbmm.f90 base/serial/psb_lsame.f90 base/serial/psb_snumbmm.f90 base/serial/psb_sort_impl.f90 base/serial/psb_srwextd.f90 base/serial/psb_ssymbmm.f90 base/serial/psb_znumbmm.f90 base/serial/psb_zrwextd.f90 base/serial/psb_zsymbmm.f90 base/serial/psi_impl.f90 base/serial/psi_serial_impl.f90 base/tools/psb_callc.f90 base/tools/psb_casb.f90 base/tools/psb_ccdbldext.F90 base/tools/psb_cd_inloc.f90 base/tools/psb_cd_lstext.f90 base/tools/psb_cd_reinit.f90 base/tools/psb_cd_set_bld.f90 base/tools/psb_cdals.f90 base/tools/psb_cdalv.f90 base/tools/psb_cdcpy.f90 base/tools/psb_cdins.f90 base/tools/psb_cdprt.f90 base/tools/psb_cdren.f90 base/tools/psb_cdrep.f90 base/tools/psb_cfree.f90 base/tools/psb_cins.f90 base/tools/psb_cspalloc.f90 base/tools/psb_cspasb.f90 base/tools/psb_cspfree.f90 base/tools/psb_csphalo.F90 base/tools/psb_cspins.f90 base/tools/psb_csprn.f90 base/tools/psb_dallc.f90 base/tools/psb_dasb.f90 base/tools/psb_dcdbldext.F90 base/tools/psb_dfree.f90 base/tools/psb_dins.f90 base/tools/psb_dspalloc.f90 base/tools/psb_dspasb.f90 base/tools/psb_dspfree.f90 base/tools/psb_dsphalo.F90 base/tools/psb_dspins.f90 base/tools/psb_dsprn.f90 base/tools/psb_get_overlap.f90 base/tools/psb_glob_to_loc.f90 base/tools/psb_ialloc.f90 base/tools/psb_iasb.f90 base/tools/psb_icdasb.F90 base/tools/psb_ifree.f90 base/tools/psb_iins.f90 base/tools/psb_linmap.f90 base/tools/psb_loc_to_glob.f90 base/tools/psb_map.f90 base/tools/psb_sallc.f90 base/tools/psb_sasb.f90 base/tools/psb_scdbldext.F90 base/tools/psb_sfree.f90 base/tools/psb_sins.f90 base/tools/psb_sspalloc.f90 base/tools/psb_sspasb.f90 base/tools/psb_sspfree.f90 base/tools/psb_ssphalo.F90 base/tools/psb_sspins.f90 base/tools/psb_ssprn.f90 base/tools/psb_zallc.f90 base/tools/psb_zasb.f90 base/tools/psb_zcdbldext.F90 base/tools/psb_zfree.f90 base/tools/psb_zins.f90 base/tools/psb_zspalloc.f90 base/tools/psb_zspasb.f90 base/tools/psb_zspfree.f90 base/tools/psb_zsphalo.F90 base/tools/psb_zspins.f90 base/tools/psb_zsprn.f90 krylov/psb_base_inner_krylov_mod.f90 krylov/psb_c_inner_krylov_mod.f90 krylov/psb_cbicg.f90 krylov/psb_ccg.f90 krylov/psb_ccgs.f90 krylov/psb_ccgstab.f90 krylov/psb_ccgstabl.f90 krylov/psb_ckrylov.f90 krylov/psb_crgmres.f90 krylov/psb_d_inner_krylov_mod.f90 krylov/psb_dbicg.f90 krylov/psb_dcg.F90 krylov/psb_dcgs.f90 krylov/psb_dcgstab.F90 krylov/psb_dcgstabl.f90 krylov/psb_dkrylov.f90 krylov/psb_drgmres.f90 krylov/psb_inner_krylov_mod.f90 krylov/psb_krylov_mod.f90 krylov/psb_s_inner_krylov_mod.f90 krylov/psb_sbicg.f90 krylov/psb_scg.F90 krylov/psb_scgs.f90 krylov/psb_scgstab.F90 krylov/psb_scgstabl.f90 krylov/psb_skrylov.f90 krylov/psb_srgmres.f90 krylov/psb_z_inner_krylov_mod.f90 krylov/psb_zbicg.f90 krylov/psb_zcg.F90 krylov/psb_zcgs.f90 krylov/psb_zcgstab.f90 krylov/psb_zcgstabl.f90 krylov/psb_zkrylov.f90 krylov/psb_zrgmres.f90 prec/psb_c_base_prec_mod.f03 prec/psb_c_prec_type.f03 prec/psb_cilu_fct.f90 prec/psb_cprc_aply.f90 prec/psb_cprecbld.f90 prec/psb_cprecinit.f90 prec/psb_cprecset.f90 prec/psb_d_base_prec_mod.f03 prec/psb_d_prec_type.f03 prec/psb_dilu_fct.f90 prec/psb_dprc_aply.f90 prec/psb_dprecbld.f90 prec/psb_dprecinit.f90 prec/psb_dprecset.f90 prec/psb_prec_const_mod.f03 prec/psb_prec_mod.f90 prec/psb_prec_type.f03 prec/psb_s_base_prec_mod.f03 prec/psb_s_prec_type.f03 prec/psb_silu_fct.f90 prec/psb_sprc_aply.f90 prec/psb_sprecbld.f90 prec/psb_sprecinit.f90 prec/psb_sprecset.f90 prec/psb_z_base_prec_mod.f03 prec/psb_z_prec_type.f03 prec/psb_zilu_fct.f90 prec/psb_zprc_aply.f90 prec/psb_zprecbld.f90 prec/psb_zprecinit.f90 prec/psb_zprecset.f90 test/fileread/cf_sample.f90 test/fileread/df_sample.f90 test/fileread/getp.f90 test/fileread/sf_sample.f90 test/fileread/zf_sample.f90 test/pargen/ppde.f90 test/pargen/spde.f90 test/serial/psb_d_cxx_mat_mod.f03 test/util/dhb2mm.f90 test/util/dmm2hb.f90 test/util/zhb2mm.f90 test/util/zmm2hb.f90 util/psb_blockpart_mod.f90 util/psb_hbio_impl.f90 util/psb_hbio_mod.f90 util/psb_mat_dist_impl.f90 util/psb_mat_dist_mod.f90 util/psb_metispart_mod.F90 util/psb_mmio_impl.f90 util/psb_mmio_mod.f90 util/psb_util_mod.f90 Updated copyright statement. Fixed style to use "import :: " statement.
3197 lines
78 KiB
Fortran
3197 lines
78 KiB
Fortran
!!$
|
|
!!$ Parallel Sparse BLAS version 3.0
|
|
!!$ (C) Copyright 2006, 2007, 2008, 2009, 2010
|
|
!!$ Salvatore Filippone University of Rome Tor Vergata
|
|
!!$ Alfredo Buttari CNRS-IRIT, Toulouse
|
|
!!$
|
|
!!$ 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 PSBLAS 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 PSBLAS 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 psb_realloc_mod
|
|
use psb_const_mod
|
|
implicit none
|
|
|
|
!
|
|
! psb_realloc will reallocate the input array to have exactly
|
|
! the size specified, possibly shortening it.
|
|
!
|
|
Interface psb_realloc
|
|
module procedure psb_reallocate1i
|
|
module procedure psb_reallocate2i
|
|
module procedure psb_reallocate2i1d
|
|
module procedure psb_reallocate2i1s
|
|
module procedure psb_reallocate1d
|
|
module procedure psb_reallocate1s
|
|
module procedure psb_reallocated2
|
|
module procedure psb_reallocates2
|
|
module procedure psb_reallocatei2
|
|
#if ! defined(LONG_INTEGERS)
|
|
module procedure psb_reallocate1i8
|
|
module procedure psb_reallocatei8_2
|
|
#endif
|
|
module procedure psb_reallocate2i1z
|
|
module procedure psb_reallocate2i1c
|
|
module procedure psb_reallocate1z
|
|
module procedure psb_reallocate1c
|
|
module procedure psb_reallocatez2
|
|
module procedure psb_reallocatec2
|
|
end Interface
|
|
|
|
interface psb_move_alloc
|
|
module procedure psb_smove_alloc1d
|
|
module procedure psb_smove_alloc2d
|
|
module procedure psb_dmove_alloc1d
|
|
module procedure psb_dmove_alloc2d
|
|
module procedure psb_imove_alloc1d
|
|
module procedure psb_imove_alloc2d
|
|
#if !defined(LONG_INTEGERS)
|
|
module procedure psb_i8move_alloc1d
|
|
module procedure psb_i8move_alloc2d
|
|
#endif
|
|
module procedure psb_cmove_alloc1d
|
|
module procedure psb_cmove_alloc2d
|
|
module procedure psb_zmove_alloc1d
|
|
module procedure psb_zmove_alloc2d
|
|
end interface
|
|
|
|
Interface psb_safe_ab_cpy
|
|
module procedure psb_i_ab_cpy1d,psb_i_ab_cpy2d, &
|
|
& psb_s_ab_cpy1d, psb_s_ab_cpy2d,&
|
|
& psb_c_ab_cpy1d, psb_c_ab_cpy2d,&
|
|
& psb_d_ab_cpy1d, psb_d_ab_cpy2d,&
|
|
& psb_z_ab_cpy1d, psb_z_ab_cpy2d
|
|
end Interface
|
|
|
|
Interface psb_safe_cpy
|
|
module procedure psb_i_cpy1d,psb_i_cpy2d, &
|
|
& psb_s_cpy1d, psb_s_cpy2d,&
|
|
& psb_c_cpy1d, psb_c_cpy2d,&
|
|
& psb_d_cpy1d, psb_d_cpy2d,&
|
|
& psb_z_cpy1d, psb_z_cpy2d
|
|
end Interface
|
|
|
|
!
|
|
! psb_ensure_size will reallocate the input array if necessary
|
|
! to guarantee that its size is at least as large as the
|
|
! value required, usually with some room to spare.
|
|
!
|
|
interface psb_ensure_size
|
|
module procedure psb_icksz1d,&
|
|
#if !defined(LONG_INTEGERS)
|
|
& psb_i8cksz1d, &
|
|
#endif
|
|
& psb_scksz1d, psb_ccksz1d, &
|
|
& psb_dcksz1d, psb_zcksz1d
|
|
end Interface
|
|
|
|
interface psb_size
|
|
module procedure psb_isize1d, psb_isize2d,&
|
|
#if !defined(LONG_INTEGERS)
|
|
& psb_i8size1d, psb_i8size2d,&
|
|
#endif
|
|
& psb_ssize1d, psb_ssize2d,&
|
|
& psb_csize1d, psb_csize2d,&
|
|
& psb_dsize1d, psb_dsize2d,&
|
|
& psb_zsize1d, psb_zsize2d
|
|
end interface
|
|
|
|
|
|
Contains
|
|
|
|
subroutine psb_i_ab_cpy1d(vin,vout,info)
|
|
use psb_error_mod
|
|
|
|
! ...Subroutine Arguments
|
|
Integer,allocatable, intent(in) :: vin(:)
|
|
Integer,allocatable, intent(out) :: vout(:)
|
|
integer :: info
|
|
! ...Local Variables
|
|
|
|
Integer :: isz,err_act,lb
|
|
character(len=20) :: name, char_err
|
|
logical, parameter :: debug=.false.
|
|
|
|
name='psb_safe_ab_cpy'
|
|
call psb_erractionsave(err_act)
|
|
info=psb_success_
|
|
|
|
if (psb_get_errstatus() /= 0) then
|
|
info=psb_err_from_subroutine_
|
|
goto 9999
|
|
end if
|
|
|
|
if (allocated(vin)) then
|
|
isz = size(vin)
|
|
lb = lbound(vin,1)
|
|
call psb_realloc(isz,vout,info,lb=lb)
|
|
if (info /= psb_success_) then
|
|
info=psb_err_from_subroutine_
|
|
char_err='psb_realloc'
|
|
call psb_errpush(info,name,a_err=char_err)
|
|
goto 9999
|
|
else
|
|
vout(:) = vin(:)
|
|
endif
|
|
endif
|
|
|
|
call psb_erractionrestore(err_act)
|
|
return
|
|
|
|
9999 continue
|
|
call psb_erractionrestore(err_act)
|
|
|
|
if (err_act == psb_act_ret_) then
|
|
return
|
|
else
|
|
call psb_error()
|
|
end if
|
|
return
|
|
|
|
end subroutine psb_i_ab_cpy1d
|
|
|
|
subroutine psb_i_ab_cpy2d(vin,vout,info)
|
|
use psb_error_mod
|
|
|
|
! ...Subroutine Arguments
|
|
Integer, allocatable, intent(in) :: vin(:,:)
|
|
Integer, allocatable, intent(out) :: vout(:,:)
|
|
integer :: info
|
|
! ...Local Variables
|
|
|
|
Integer :: isz1, isz2,err_act, lb1, lb2
|
|
character(len=20) :: name, char_err
|
|
logical, parameter :: debug=.false.
|
|
|
|
name='psb_safe_ab_cpy'
|
|
call psb_erractionsave(err_act)
|
|
info=psb_success_
|
|
|
|
if(psb_get_errstatus() /= 0) then
|
|
info=psb_err_from_subroutine_
|
|
goto 9999
|
|
end if
|
|
if (allocated(vin)) then
|
|
isz1 = size(vin,1)
|
|
isz2 = size(vin,2)
|
|
lb1 = lbound(vin,1)
|
|
lb2 = lbound(vin,2)
|
|
call psb_realloc(isz1,isz2,vout,info,lb1=lb1,lb2=lb2)
|
|
if (info /= psb_success_) then
|
|
info=psb_err_from_subroutine_
|
|
char_err='psb_realloc'
|
|
call psb_errpush(info,name,a_err=char_err)
|
|
goto 9999
|
|
else
|
|
vout(:,:) = vin(:,:)
|
|
endif
|
|
endif
|
|
|
|
call psb_erractionrestore(err_act)
|
|
return
|
|
|
|
9999 continue
|
|
call psb_erractionrestore(err_act)
|
|
|
|
if (err_act == psb_act_ret_) then
|
|
return
|
|
else
|
|
call psb_error()
|
|
end if
|
|
return
|
|
|
|
end subroutine psb_i_ab_cpy2d
|
|
|
|
subroutine psb_s_ab_cpy1d(vin,vout,info)
|
|
use psb_error_mod
|
|
|
|
! ...Subroutine Arguments
|
|
real(psb_spk_), allocatable, intent(in) :: vin(:)
|
|
real(psb_spk_), allocatable, intent(out) :: vout(:)
|
|
integer :: info
|
|
! ...Local Variables
|
|
|
|
Integer :: isz,err_act,lb
|
|
character(len=20) :: name, char_err
|
|
logical, parameter :: debug=.false.
|
|
|
|
name='psb_safe_ab_cpy'
|
|
call psb_erractionsave(err_act)
|
|
info=psb_success_
|
|
if(psb_get_errstatus() /= 0) then
|
|
info=psb_err_from_subroutine_
|
|
goto 9999
|
|
end if
|
|
|
|
if (allocated(vin)) then
|
|
isz = size(vin)
|
|
lb = lbound(vin,1)
|
|
call psb_realloc(isz,vout,info,lb=lb)
|
|
if (info /= psb_success_) then
|
|
info=psb_err_from_subroutine_
|
|
char_err='psb_realloc'
|
|
call psb_errpush(info,name,a_err=char_err)
|
|
goto 9999
|
|
else
|
|
vout(:) = vin(:)
|
|
endif
|
|
endif
|
|
|
|
call psb_erractionrestore(err_act)
|
|
return
|
|
|
|
9999 continue
|
|
call psb_erractionrestore(err_act)
|
|
|
|
if (err_act == psb_act_ret_) then
|
|
return
|
|
else
|
|
call psb_error()
|
|
end if
|
|
return
|
|
|
|
end subroutine psb_s_ab_cpy1d
|
|
|
|
subroutine psb_s_ab_cpy2d(vin,vout,info)
|
|
use psb_error_mod
|
|
|
|
! ...Subroutine Arguments
|
|
real(psb_spk_), allocatable, intent(in) :: vin(:,:)
|
|
real(psb_spk_), allocatable, intent(out) :: vout(:,:)
|
|
integer :: info
|
|
! ...Local Variables
|
|
|
|
Integer :: isz1, isz2,err_act, lb1, lb2
|
|
character(len=20) :: name, char_err
|
|
logical, parameter :: debug=.false.
|
|
|
|
name='psb_safe_ab_cpy'
|
|
call psb_erractionsave(err_act)
|
|
info=psb_success_
|
|
if(psb_get_errstatus() /= 0) then
|
|
info=psb_err_from_subroutine_
|
|
goto 9999
|
|
end if
|
|
|
|
if (allocated(vin)) then
|
|
isz1 = size(vin,1)
|
|
isz2 = size(vin,2)
|
|
lb1 = lbound(vin,1)
|
|
lb2 = lbound(vin,2)
|
|
call psb_realloc(isz1,isz2,vout,info,lb1=lb1,lb2=lb2)
|
|
if (info /= psb_success_) then
|
|
info=psb_err_from_subroutine_
|
|
char_err='psb_realloc'
|
|
call psb_errpush(info,name,a_err=char_err)
|
|
goto 9999
|
|
else
|
|
vout(:,:) = vin(:,:)
|
|
endif
|
|
endif
|
|
|
|
call psb_erractionrestore(err_act)
|
|
return
|
|
|
|
9999 continue
|
|
call psb_erractionrestore(err_act)
|
|
|
|
if (err_act == psb_act_ret_) then
|
|
return
|
|
else
|
|
call psb_error()
|
|
end if
|
|
return
|
|
|
|
end subroutine psb_s_ab_cpy2d
|
|
|
|
subroutine psb_d_ab_cpy1d(vin,vout,info)
|
|
use psb_error_mod
|
|
|
|
! ...Subroutine Arguments
|
|
real(psb_dpk_), allocatable, intent(in) :: vin(:)
|
|
real(psb_dpk_), allocatable, intent(out) :: vout(:)
|
|
integer :: info
|
|
! ...Local Variables
|
|
|
|
Integer :: isz,err_act,lb
|
|
character(len=20) :: name, char_err
|
|
logical, parameter :: debug=.false.
|
|
|
|
name='psb_safe_ab_cpy'
|
|
call psb_erractionsave(err_act)
|
|
info=psb_success_
|
|
if(psb_get_errstatus() /= 0) then
|
|
info=psb_err_from_subroutine_
|
|
goto 9999
|
|
end if
|
|
|
|
if (allocated(vin)) then
|
|
isz = size(vin)
|
|
lb = lbound(vin,1)
|
|
call psb_realloc(isz,vout,info,lb=lb)
|
|
if (info /= psb_success_) then
|
|
info=psb_err_from_subroutine_
|
|
char_err='psb_realloc'
|
|
call psb_errpush(info,name,a_err=char_err)
|
|
goto 9999
|
|
else
|
|
vout(:) = vin(:)
|
|
endif
|
|
endif
|
|
|
|
call psb_erractionrestore(err_act)
|
|
return
|
|
|
|
9999 continue
|
|
call psb_erractionrestore(err_act)
|
|
|
|
if (err_act == psb_act_ret_) then
|
|
return
|
|
else
|
|
call psb_error()
|
|
end if
|
|
return
|
|
|
|
end subroutine psb_d_ab_cpy1d
|
|
|
|
subroutine psb_d_ab_cpy2d(vin,vout,info)
|
|
use psb_error_mod
|
|
|
|
! ...Subroutine Arguments
|
|
real(psb_dpk_), allocatable, intent(in) :: vin(:,:)
|
|
real(psb_dpk_), allocatable, intent(out) :: vout(:,:)
|
|
integer :: info
|
|
! ...Local Variables
|
|
|
|
Integer :: isz1, isz2,err_act, lb1, lb2
|
|
character(len=20) :: name, char_err
|
|
logical, parameter :: debug=.false.
|
|
|
|
name='psb_safe_ab_cpy'
|
|
call psb_erractionsave(err_act)
|
|
info=psb_success_
|
|
if(psb_get_errstatus() /= 0) then
|
|
info=psb_err_from_subroutine_
|
|
goto 9999
|
|
end if
|
|
|
|
if (allocated(vin)) then
|
|
isz1 = size(vin,1)
|
|
isz2 = size(vin,2)
|
|
lb1 = lbound(vin,1)
|
|
lb2 = lbound(vin,2)
|
|
call psb_realloc(isz1,isz2,vout,info,lb1=lb1,lb2=lb2)
|
|
if (info /= psb_success_) then
|
|
info=psb_err_from_subroutine_
|
|
char_err='psb_realloc'
|
|
call psb_errpush(info,name,a_err=char_err)
|
|
goto 9999
|
|
else
|
|
vout(:,:) = vin(:,:)
|
|
endif
|
|
endif
|
|
|
|
call psb_erractionrestore(err_act)
|
|
return
|
|
|
|
9999 continue
|
|
call psb_erractionrestore(err_act)
|
|
|
|
if (err_act == psb_act_ret_) then
|
|
return
|
|
else
|
|
call psb_error()
|
|
end if
|
|
return
|
|
|
|
end subroutine psb_d_ab_cpy2d
|
|
|
|
subroutine psb_c_ab_cpy1d(vin,vout,info)
|
|
use psb_error_mod
|
|
|
|
! ...Subroutine Arguments
|
|
complex(psb_spk_), allocatable, intent(in) :: vin(:)
|
|
complex(psb_spk_), allocatable, intent(out) :: vout(:)
|
|
integer :: info
|
|
! ...Local Variables
|
|
|
|
Integer :: isz,err_act,lb
|
|
character(len=20) :: name, char_err
|
|
logical, parameter :: debug=.false.
|
|
|
|
name='psb_safe_ab_cpy'
|
|
call psb_erractionsave(err_act)
|
|
info=psb_success_
|
|
if(psb_get_errstatus() /= 0) then
|
|
info=psb_err_from_subroutine_
|
|
goto 9999
|
|
end if
|
|
|
|
if (allocated(vin)) then
|
|
isz = size(vin)
|
|
lb = lbound(vin,1)
|
|
call psb_realloc(isz,vout,info,lb=lb)
|
|
if (info /= psb_success_) then
|
|
info=psb_err_from_subroutine_
|
|
char_err='psb_realloc'
|
|
call psb_errpush(info,name,a_err=char_err)
|
|
goto 9999
|
|
else
|
|
vout(:) = vin(:)
|
|
endif
|
|
endif
|
|
|
|
call psb_erractionrestore(err_act)
|
|
return
|
|
|
|
9999 continue
|
|
call psb_erractionrestore(err_act)
|
|
|
|
if (err_act == psb_act_ret_) then
|
|
return
|
|
else
|
|
call psb_error()
|
|
end if
|
|
return
|
|
|
|
end subroutine psb_c_ab_cpy1d
|
|
|
|
subroutine psb_c_ab_cpy2d(vin,vout,info)
|
|
use psb_error_mod
|
|
|
|
! ...Subroutine Arguments
|
|
complex(psb_spk_), allocatable, intent(in) :: vin(:,:)
|
|
complex(psb_spk_), allocatable, intent(out) :: vout(:,:)
|
|
integer :: info
|
|
! ...Local Variables
|
|
|
|
Integer :: isz1, isz2,err_act, lb1, lb2
|
|
character(len=20) :: name, char_err
|
|
logical, parameter :: debug=.false.
|
|
|
|
name='psb_safe_ab_cpy'
|
|
call psb_erractionsave(err_act)
|
|
info=psb_success_
|
|
if(psb_get_errstatus() /= 0) then
|
|
info=psb_err_from_subroutine_
|
|
goto 9999
|
|
end if
|
|
|
|
if (allocated(vin)) then
|
|
isz1 = size(vin,1)
|
|
isz2 = size(vin,2)
|
|
lb1 = lbound(vin,1)
|
|
lb2 = lbound(vin,2)
|
|
call psb_realloc(isz1,isz2,vout,info,lb1=lb1,lb2=lb2)
|
|
if (info /= psb_success_) then
|
|
info=psb_err_from_subroutine_
|
|
char_err='psb_realloc'
|
|
call psb_errpush(info,name,a_err=char_err)
|
|
goto 9999
|
|
else
|
|
vout(:,:) = vin(:,:)
|
|
endif
|
|
endif
|
|
|
|
call psb_erractionrestore(err_act)
|
|
return
|
|
|
|
9999 continue
|
|
call psb_erractionrestore(err_act)
|
|
|
|
if (err_act == psb_act_ret_) then
|
|
return
|
|
else
|
|
call psb_error()
|
|
end if
|
|
return
|
|
|
|
end subroutine psb_c_ab_cpy2d
|
|
|
|
subroutine psb_z_ab_cpy1d(vin,vout,info)
|
|
use psb_error_mod
|
|
|
|
! ...Subroutine Arguments
|
|
complex(psb_dpk_), allocatable, intent(in) :: vin(:)
|
|
complex(psb_dpk_), allocatable, intent(out) :: vout(:)
|
|
integer :: info
|
|
! ...Local Variables
|
|
|
|
Integer :: isz,err_act,lb
|
|
character(len=20) :: name, char_err
|
|
logical, parameter :: debug=.false.
|
|
|
|
name='psb_safe_ab_cpy'
|
|
call psb_erractionsave(err_act)
|
|
info=psb_success_
|
|
if(psb_get_errstatus() /= 0) then
|
|
info=psb_err_from_subroutine_
|
|
goto 9999
|
|
end if
|
|
if (allocated(vin)) then
|
|
isz = size(vin)
|
|
lb = lbound(vin,1)
|
|
call psb_realloc(isz,vout,info,lb=lb)
|
|
if (info /= psb_success_) then
|
|
info=psb_err_from_subroutine_
|
|
char_err='psb_realloc'
|
|
call psb_errpush(info,name,a_err=char_err)
|
|
goto 9999
|
|
else
|
|
vout(:) = vin(:)
|
|
endif
|
|
endif
|
|
|
|
call psb_erractionrestore(err_act)
|
|
return
|
|
|
|
9999 continue
|
|
call psb_erractionrestore(err_act)
|
|
|
|
if (err_act == psb_act_ret_) then
|
|
return
|
|
else
|
|
call psb_error()
|
|
end if
|
|
return
|
|
|
|
end subroutine psb_z_ab_cpy1d
|
|
|
|
subroutine psb_z_ab_cpy2d(vin,vout,info)
|
|
use psb_error_mod
|
|
|
|
! ...Subroutine Arguments
|
|
complex(psb_dpk_), allocatable, intent(in) :: vin(:,:)
|
|
complex(psb_dpk_), allocatable, intent(out) :: vout(:,:)
|
|
integer :: info
|
|
! ...Local Variables
|
|
|
|
Integer :: isz1, isz2,err_act, lb1, lb2
|
|
character(len=20) :: name, char_err
|
|
logical, parameter :: debug=.false.
|
|
|
|
name='psb_safe_ab_cpy'
|
|
call psb_erractionsave(err_act)
|
|
info=psb_success_
|
|
if(psb_get_errstatus() /= 0) then
|
|
info=psb_err_from_subroutine_
|
|
goto 9999
|
|
end if
|
|
if (allocated(vin)) then
|
|
isz1 = size(vin,1)
|
|
isz2 = size(vin,2)
|
|
lb1 = lbound(vin,1)
|
|
lb2 = lbound(vin,2)
|
|
call psb_realloc(isz1,isz2,vout,info,lb1=lb1,lb2=lb2)
|
|
if (info /= psb_success_) then
|
|
info=psb_err_from_subroutine_
|
|
char_err='psb_realloc'
|
|
call psb_errpush(info,name,a_err=char_err)
|
|
goto 9999
|
|
else
|
|
vout(:,:) = vin(:,:)
|
|
endif
|
|
endif
|
|
|
|
call psb_erractionrestore(err_act)
|
|
return
|
|
|
|
9999 continue
|
|
call psb_erractionrestore(err_act)
|
|
|
|
if (err_act == psb_act_ret_) then
|
|
return
|
|
else
|
|
call psb_error()
|
|
end if
|
|
return
|
|
|
|
end subroutine psb_z_ab_cpy2d
|
|
|
|
|
|
subroutine psb_i_cpy1d(vin,vout,info)
|
|
use psb_error_mod
|
|
|
|
! ...Subroutine Arguments
|
|
Integer, intent(in) :: vin(:)
|
|
Integer, allocatable, intent(out) :: vout(:)
|
|
integer :: info
|
|
! ...Local Variables
|
|
|
|
Integer :: isz,err_act,lb
|
|
character(len=20) :: name, char_err
|
|
logical, parameter :: debug=.false.
|
|
|
|
name='psb_safe_cpy'
|
|
call psb_erractionsave(err_act)
|
|
info=psb_success_
|
|
if(psb_get_errstatus() /= 0) then
|
|
info=psb_err_from_subroutine_
|
|
goto 9999
|
|
end if
|
|
isz = size(vin)
|
|
lb = lbound(vin,1)
|
|
call psb_realloc(isz,vout,info,lb=lb)
|
|
if (info /= psb_success_) then
|
|
info=psb_err_from_subroutine_
|
|
char_err='psb_realloc'
|
|
call psb_errpush(info,name,a_err=char_err)
|
|
goto 9999
|
|
else
|
|
vout(:) = vin(:)
|
|
endif
|
|
|
|
call psb_erractionrestore(err_act)
|
|
return
|
|
|
|
9999 continue
|
|
call psb_erractionrestore(err_act)
|
|
|
|
if (err_act == psb_act_ret_) then
|
|
return
|
|
else
|
|
call psb_error()
|
|
end if
|
|
return
|
|
|
|
end subroutine psb_i_cpy1d
|
|
|
|
subroutine psb_i_cpy2d(vin,vout,info)
|
|
use psb_error_mod
|
|
|
|
! ...Subroutine Arguments
|
|
Integer, intent(in) :: vin(:,:)
|
|
Integer, allocatable, intent(out) :: vout(:,:)
|
|
integer :: info
|
|
! ...Local Variables
|
|
|
|
Integer :: isz1, isz2,err_act, lb1, lb2
|
|
character(len=20) :: name, char_err
|
|
logical, parameter :: debug=.false.
|
|
|
|
name='psb_safe_cpy'
|
|
call psb_erractionsave(err_act)
|
|
info=psb_success_
|
|
if(psb_get_errstatus() /= 0) then
|
|
info=psb_err_from_subroutine_
|
|
goto 9999
|
|
end if
|
|
|
|
isz1 = size(vin,1)
|
|
isz2 = size(vin,2)
|
|
lb1 = lbound(vin,1)
|
|
lb2 = lbound(vin,2)
|
|
call psb_realloc(isz1,isz2,vout,info,lb1=lb1,lb2=lb2)
|
|
if (info /= psb_success_) then
|
|
info=psb_err_from_subroutine_
|
|
char_err='psb_realloc'
|
|
call psb_errpush(info,name,a_err=char_err)
|
|
goto 9999
|
|
else
|
|
vout(:,:) = vin(:,:)
|
|
endif
|
|
|
|
call psb_erractionrestore(err_act)
|
|
return
|
|
|
|
9999 continue
|
|
call psb_erractionrestore(err_act)
|
|
|
|
if (err_act == psb_act_ret_) then
|
|
return
|
|
else
|
|
call psb_error()
|
|
end if
|
|
return
|
|
|
|
end subroutine psb_i_cpy2d
|
|
|
|
subroutine psb_s_cpy1d(vin,vout,info)
|
|
use psb_error_mod
|
|
|
|
! ...Subroutine Arguments
|
|
real(psb_spk_), intent(in) :: vin(:)
|
|
real(psb_spk_), allocatable, intent(out) :: vout(:)
|
|
integer :: info
|
|
! ...Local Variables
|
|
|
|
Integer :: isz,err_act,lb
|
|
character(len=20) :: name, char_err
|
|
logical, parameter :: debug=.false.
|
|
|
|
name='psb_safe_cpy'
|
|
call psb_erractionsave(err_act)
|
|
info=psb_success_
|
|
if(psb_get_errstatus() /= 0) then
|
|
info=psb_err_from_subroutine_
|
|
goto 9999
|
|
end if
|
|
|
|
isz = size(vin)
|
|
lb = lbound(vin,1)
|
|
call psb_realloc(isz,vout,info,lb=lb)
|
|
if (info /= psb_success_) then
|
|
info=psb_err_from_subroutine_
|
|
char_err='psb_realloc'
|
|
call psb_errpush(info,name,a_err=char_err)
|
|
goto 9999
|
|
else
|
|
vout(:) = vin(:)
|
|
endif
|
|
|
|
call psb_erractionrestore(err_act)
|
|
return
|
|
|
|
9999 continue
|
|
call psb_erractionrestore(err_act)
|
|
|
|
if (err_act == psb_act_ret_) then
|
|
return
|
|
else
|
|
call psb_error()
|
|
end if
|
|
return
|
|
|
|
end subroutine psb_s_cpy1d
|
|
|
|
subroutine psb_s_cpy2d(vin,vout,info)
|
|
use psb_error_mod
|
|
|
|
! ...Subroutine Arguments
|
|
real(psb_spk_), intent(in) :: vin(:,:)
|
|
real(psb_spk_), allocatable, intent(out) :: vout(:,:)
|
|
integer :: info
|
|
! ...Local Variables
|
|
|
|
Integer :: isz1, isz2,err_act, lb1, lb2
|
|
character(len=20) :: name, char_err
|
|
logical, parameter :: debug=.false.
|
|
|
|
name='psb_safe_cpy'
|
|
call psb_erractionsave(err_act)
|
|
info=psb_success_
|
|
if(psb_get_errstatus() /= 0) then
|
|
info=psb_err_from_subroutine_
|
|
goto 9999
|
|
end if
|
|
|
|
isz1 = size(vin,1)
|
|
isz2 = size(vin,2)
|
|
lb1 = lbound(vin,1)
|
|
lb2 = lbound(vin,2)
|
|
call psb_realloc(isz1,isz2,vout,info,lb1=lb1,lb2=lb2)
|
|
if (info /= psb_success_) then
|
|
info=psb_err_from_subroutine_
|
|
char_err='psb_realloc'
|
|
call psb_errpush(info,name,a_err=char_err)
|
|
goto 9999
|
|
else
|
|
vout(:,:) = vin(:,:)
|
|
endif
|
|
|
|
call psb_erractionrestore(err_act)
|
|
return
|
|
|
|
9999 continue
|
|
call psb_erractionrestore(err_act)
|
|
|
|
if (err_act == psb_act_ret_) then
|
|
return
|
|
else
|
|
call psb_error()
|
|
end if
|
|
return
|
|
|
|
end subroutine psb_s_cpy2d
|
|
|
|
subroutine psb_d_cpy1d(vin,vout,info)
|
|
use psb_error_mod
|
|
|
|
! ...Subroutine Arguments
|
|
real(psb_dpk_), intent(in) :: vin(:)
|
|
real(psb_dpk_), allocatable, intent(out) :: vout(:)
|
|
integer :: info
|
|
! ...Local Variables
|
|
|
|
Integer :: isz,err_act,lb
|
|
character(len=20) :: name, char_err
|
|
logical, parameter :: debug=.false.
|
|
|
|
name='psb_safe_cpy'
|
|
call psb_erractionsave(err_act)
|
|
info=psb_success_
|
|
if(psb_get_errstatus() /= 0) then
|
|
info=psb_err_from_subroutine_
|
|
goto 9999
|
|
end if
|
|
isz = size(vin)
|
|
lb = lbound(vin,1)
|
|
call psb_realloc(isz,vout,info,lb=lb)
|
|
if (info /= psb_success_) then
|
|
info=psb_err_from_subroutine_
|
|
char_err='psb_realloc'
|
|
call psb_errpush(info,name,a_err=char_err)
|
|
goto 9999
|
|
else
|
|
vout(:) = vin(:)
|
|
endif
|
|
|
|
call psb_erractionrestore(err_act)
|
|
return
|
|
|
|
9999 continue
|
|
call psb_erractionrestore(err_act)
|
|
|
|
if (err_act == psb_act_ret_) then
|
|
return
|
|
else
|
|
call psb_error()
|
|
end if
|
|
return
|
|
|
|
end subroutine psb_d_cpy1d
|
|
|
|
subroutine psb_d_cpy2d(vin,vout,info)
|
|
use psb_error_mod
|
|
|
|
! ...Subroutine Arguments
|
|
real(psb_dpk_), intent(in) :: vin(:,:)
|
|
real(psb_dpk_), allocatable, intent(out) :: vout(:,:)
|
|
integer :: info
|
|
! ...Local Variables
|
|
|
|
Integer :: isz1, isz2,err_act, lb1, lb2
|
|
character(len=20) :: name, char_err
|
|
logical, parameter :: debug=.false.
|
|
|
|
name='psb_safe_cpy'
|
|
call psb_erractionsave(err_act)
|
|
info=psb_success_
|
|
if(psb_get_errstatus() /= 0) then
|
|
info=psb_err_from_subroutine_
|
|
goto 9999
|
|
end if
|
|
|
|
isz1 = size(vin,1)
|
|
isz2 = size(vin,2)
|
|
lb1 = lbound(vin,1)
|
|
lb2 = lbound(vin,2)
|
|
call psb_realloc(isz1,isz2,vout,info,lb1=lb1,lb2=lb2)
|
|
if (info /= psb_success_) then
|
|
info=psb_err_from_subroutine_
|
|
char_err='psb_realloc'
|
|
call psb_errpush(info,name,a_err=char_err)
|
|
goto 9999
|
|
else
|
|
vout(:,:) = vin(:,:)
|
|
endif
|
|
|
|
call psb_erractionrestore(err_act)
|
|
return
|
|
|
|
9999 continue
|
|
call psb_erractionrestore(err_act)
|
|
|
|
if (err_act == psb_act_ret_) then
|
|
return
|
|
else
|
|
call psb_error()
|
|
end if
|
|
return
|
|
|
|
end subroutine psb_d_cpy2d
|
|
|
|
subroutine psb_c_cpy1d(vin,vout,info)
|
|
use psb_error_mod
|
|
|
|
! ...Subroutine Arguments
|
|
complex(psb_spk_), intent(in) :: vin(:)
|
|
complex(psb_spk_), allocatable, intent(out) :: vout(:)
|
|
integer :: info
|
|
! ...Local Variables
|
|
|
|
Integer :: isz,err_act,lb
|
|
character(len=20) :: name, char_err
|
|
logical, parameter :: debug=.false.
|
|
|
|
name='psb_safe_cpy'
|
|
call psb_erractionsave(err_act)
|
|
info=psb_success_
|
|
if(psb_get_errstatus() /= 0) then
|
|
info=psb_err_from_subroutine_
|
|
goto 9999
|
|
end if
|
|
|
|
isz = size(vin)
|
|
lb = lbound(vin,1)
|
|
call psb_realloc(isz,vout,info,lb=lb)
|
|
if (info /= psb_success_) then
|
|
info=psb_err_from_subroutine_
|
|
char_err='psb_realloc'
|
|
call psb_errpush(info,name,a_err=char_err)
|
|
goto 9999
|
|
else
|
|
vout(:) = vin(:)
|
|
endif
|
|
|
|
call psb_erractionrestore(err_act)
|
|
return
|
|
|
|
9999 continue
|
|
call psb_erractionrestore(err_act)
|
|
|
|
if (err_act == psb_act_ret_) then
|
|
return
|
|
else
|
|
call psb_error()
|
|
end if
|
|
return
|
|
|
|
end subroutine psb_c_cpy1d
|
|
|
|
subroutine psb_c_cpy2d(vin,vout,info)
|
|
use psb_error_mod
|
|
|
|
! ...Subroutine Arguments
|
|
complex(psb_spk_), intent(in) :: vin(:,:)
|
|
complex(psb_spk_), allocatable, intent(out) :: vout(:,:)
|
|
integer :: info
|
|
! ...Local Variables
|
|
|
|
Integer :: isz1, isz2,err_act, lb1, lb2
|
|
character(len=20) :: name, char_err
|
|
logical, parameter :: debug=.false.
|
|
|
|
name='psb_safe_cpy'
|
|
call psb_erractionsave(err_act)
|
|
info=psb_success_
|
|
if(psb_get_errstatus() /= 0) then
|
|
info=psb_err_from_subroutine_
|
|
goto 9999
|
|
end if
|
|
|
|
isz1 = size(vin,1)
|
|
isz2 = size(vin,2)
|
|
lb1 = lbound(vin,1)
|
|
lb2 = lbound(vin,2)
|
|
call psb_realloc(isz1,isz2,vout,info,lb1=lb1,lb2=lb2)
|
|
if (info /= psb_success_) then
|
|
info=psb_err_from_subroutine_
|
|
char_err='psb_realloc'
|
|
call psb_errpush(info,name,a_err=char_err)
|
|
goto 9999
|
|
else
|
|
vout(:,:) = vin(:,:)
|
|
endif
|
|
|
|
call psb_erractionrestore(err_act)
|
|
return
|
|
|
|
9999 continue
|
|
call psb_erractionrestore(err_act)
|
|
|
|
if (err_act == psb_act_ret_) then
|
|
return
|
|
else
|
|
call psb_error()
|
|
end if
|
|
return
|
|
|
|
end subroutine psb_c_cpy2d
|
|
|
|
subroutine psb_z_cpy1d(vin,vout,info)
|
|
use psb_error_mod
|
|
|
|
! ...Subroutine Arguments
|
|
complex(psb_dpk_), intent(in) :: vin(:)
|
|
complex(psb_dpk_), allocatable, intent(out) :: vout(:)
|
|
integer :: info
|
|
! ...Local Variables
|
|
|
|
Integer :: isz,err_act,lb
|
|
character(len=20) :: name, char_err
|
|
logical, parameter :: debug=.false.
|
|
|
|
name='psb_safe_cpy'
|
|
call psb_erractionsave(err_act)
|
|
info=psb_success_
|
|
if(psb_get_errstatus() /= 0) then
|
|
info=psb_err_from_subroutine_
|
|
goto 9999
|
|
end if
|
|
isz = size(vin)
|
|
lb = lbound(vin,1)
|
|
call psb_realloc(isz,vout,info,lb=lb)
|
|
if (info /= psb_success_) then
|
|
info=psb_err_from_subroutine_
|
|
char_err='psb_realloc'
|
|
call psb_errpush(info,name,a_err=char_err)
|
|
goto 9999
|
|
else
|
|
vout(:) = vin(:)
|
|
endif
|
|
|
|
call psb_erractionrestore(err_act)
|
|
return
|
|
|
|
9999 continue
|
|
call psb_erractionrestore(err_act)
|
|
|
|
if (err_act == psb_act_ret_) then
|
|
return
|
|
else
|
|
call psb_error()
|
|
end if
|
|
return
|
|
|
|
end subroutine psb_z_cpy1d
|
|
|
|
subroutine psb_z_cpy2d(vin,vout,info)
|
|
use psb_error_mod
|
|
|
|
! ...Subroutine Arguments
|
|
complex(psb_dpk_), intent(in) :: vin(:,:)
|
|
complex(psb_dpk_), allocatable, intent(out) :: vout(:,:)
|
|
integer :: info
|
|
! ...Local Variables
|
|
|
|
Integer :: isz1, isz2,err_act, lb1, lb2
|
|
character(len=20) :: name, char_err
|
|
logical, parameter :: debug=.false.
|
|
|
|
name='psb_safe_cpy'
|
|
call psb_erractionsave(err_act)
|
|
|
|
info=psb_success_
|
|
if(psb_get_errstatus() /= 0) then
|
|
info=psb_err_from_subroutine_
|
|
goto 9999
|
|
end if
|
|
isz1 = size(vin,1)
|
|
isz2 = size(vin,2)
|
|
lb1 = lbound(vin,1)
|
|
lb2 = lbound(vin,2)
|
|
call psb_realloc(isz1,isz2,vout,info,lb1=lb1,lb2=lb2)
|
|
if (info /= psb_success_) then
|
|
info=psb_err_from_subroutine_
|
|
char_err='psb_realloc'
|
|
call psb_errpush(info,name,a_err=char_err)
|
|
goto 9999
|
|
else
|
|
vout(:,:) = vin(:,:)
|
|
endif
|
|
|
|
call psb_erractionrestore(err_act)
|
|
return
|
|
|
|
9999 continue
|
|
call psb_erractionrestore(err_act)
|
|
|
|
if (err_act == psb_act_ret_) then
|
|
return
|
|
else
|
|
call psb_error()
|
|
end if
|
|
return
|
|
|
|
end subroutine psb_z_cpy2d
|
|
|
|
|
|
function psb_isize1d(vin)
|
|
integer :: psb_isize1d
|
|
integer, allocatable, intent(in) :: vin(:)
|
|
|
|
if (.not.allocated(vin)) then
|
|
psb_isize1d = 0
|
|
else
|
|
psb_isize1d = size(vin)
|
|
end if
|
|
end function psb_isize1d
|
|
|
|
function psb_isize2d(vin,dim)
|
|
integer :: psb_isize2d
|
|
integer, allocatable, intent(in) :: vin(:,:)
|
|
integer, optional :: dim
|
|
integer :: dim_
|
|
|
|
if (.not.allocated(vin)) then
|
|
psb_isize2d = 0
|
|
else
|
|
if (present(dim)) then
|
|
dim_= dim
|
|
psb_isize2d = size(vin,dim=dim_)
|
|
else
|
|
psb_isize2d = size(vin)
|
|
end if
|
|
end if
|
|
end function psb_isize2d
|
|
|
|
#if !defined(LONG_INTEGERS)
|
|
function psb_i8size1d(vin)
|
|
integer :: psb_i8size1d
|
|
integer(psb_long_int_k_), allocatable, intent(in) :: vin(:)
|
|
|
|
if (.not.allocated(vin)) then
|
|
psb_i8size1d = 0
|
|
else
|
|
psb_i8size1d = size(vin)
|
|
end if
|
|
end function psb_i8size1d
|
|
|
|
function psb_i8size2d(vin,dim)
|
|
integer :: psb_i8size2d
|
|
integer(psb_long_int_k_), allocatable, intent(in) :: vin(:,:)
|
|
integer, optional :: dim
|
|
integer :: dim_
|
|
|
|
if (.not.allocated(vin)) then
|
|
psb_i8size2d = 0
|
|
else
|
|
if (present(dim)) then
|
|
dim_= dim
|
|
psb_i8size2d = size(vin,dim=dim_)
|
|
else
|
|
psb_i8size2d = size(vin)
|
|
end if
|
|
end if
|
|
end function psb_i8size2d
|
|
#endif
|
|
|
|
function psb_ssize1d(vin)
|
|
integer :: psb_ssize1d
|
|
real(psb_spk_), allocatable, intent(in) :: vin(:)
|
|
|
|
if (.not.allocated(vin)) then
|
|
psb_ssize1d = 0
|
|
else
|
|
psb_ssize1d = size(vin)
|
|
end if
|
|
end function psb_ssize1d
|
|
|
|
function psb_ssize2d(vin,dim)
|
|
integer :: psb_ssize2d
|
|
real(psb_spk_), allocatable, intent(in) :: vin(:,:)
|
|
integer, optional :: dim
|
|
integer :: dim_
|
|
|
|
|
|
if (.not.allocated(vin)) then
|
|
psb_ssize2d = 0
|
|
else
|
|
if (present(dim)) then
|
|
dim_= dim
|
|
psb_ssize2d = size(vin,dim=dim_)
|
|
else
|
|
psb_ssize2d = size(vin)
|
|
end if
|
|
end if
|
|
end function psb_ssize2d
|
|
|
|
function psb_dsize1d(vin)
|
|
integer :: psb_dsize1d
|
|
real(psb_dpk_), allocatable, intent(in) :: vin(:)
|
|
|
|
if (.not.allocated(vin)) then
|
|
psb_dsize1d = 0
|
|
else
|
|
psb_dsize1d = size(vin)
|
|
end if
|
|
end function psb_dsize1d
|
|
|
|
function psb_dsize2d(vin,dim)
|
|
integer :: psb_dsize2d
|
|
real(psb_dpk_), allocatable, intent(in) :: vin(:,:)
|
|
integer, optional :: dim
|
|
integer :: dim_
|
|
|
|
|
|
if (.not.allocated(vin)) then
|
|
psb_dsize2d = 0
|
|
else
|
|
if (present(dim)) then
|
|
dim_= dim
|
|
psb_dsize2d = size(vin,dim=dim_)
|
|
else
|
|
psb_dsize2d = size(vin)
|
|
end if
|
|
end if
|
|
end function psb_dsize2d
|
|
|
|
|
|
function psb_csize1d(vin)
|
|
integer :: psb_csize1d
|
|
complex(psb_spk_), allocatable, intent(in) :: vin(:)
|
|
|
|
if (.not.allocated(vin)) then
|
|
psb_csize1d = 0
|
|
else
|
|
psb_csize1d = size(vin)
|
|
end if
|
|
end function psb_csize1d
|
|
|
|
function psb_csize2d(vin,dim)
|
|
integer :: psb_csize2d
|
|
complex(psb_spk_), allocatable, intent(in) :: vin(:,:)
|
|
integer, optional :: dim
|
|
integer :: dim_
|
|
|
|
if (.not.allocated(vin)) then
|
|
psb_csize2d = 0
|
|
else
|
|
if (present(dim)) then
|
|
dim_= dim
|
|
psb_csize2d = size(vin,dim=dim_)
|
|
else
|
|
psb_csize2d = size(vin)
|
|
end if
|
|
end if
|
|
end function psb_csize2d
|
|
|
|
function psb_zsize1d(vin)
|
|
integer :: psb_zsize1d
|
|
complex(psb_dpk_), allocatable, intent(in) :: vin(:)
|
|
|
|
if (.not.allocated(vin)) then
|
|
psb_zsize1d = 0
|
|
else
|
|
psb_zsize1d = size(vin)
|
|
end if
|
|
end function psb_zsize1d
|
|
|
|
function psb_zsize2d(vin,dim)
|
|
integer :: psb_zsize2d
|
|
complex(psb_dpk_), allocatable, intent(in) :: vin(:,:)
|
|
integer, optional :: dim
|
|
integer :: dim_
|
|
|
|
if (.not.allocated(vin)) then
|
|
psb_zsize2d = 0
|
|
else
|
|
if (present(dim)) then
|
|
dim_= dim
|
|
psb_zsize2d = size(vin,dim=dim_)
|
|
else
|
|
psb_zsize2d = size(vin)
|
|
end if
|
|
end if
|
|
end function psb_zsize2d
|
|
|
|
|
|
Subroutine psb_icksz1d(len,v,info,pad,addsz,newsz)
|
|
use psb_error_mod
|
|
|
|
! ...Subroutine Arguments
|
|
Integer,Intent(in) :: len
|
|
Integer,allocatable, intent(inout) :: v(:)
|
|
integer :: info
|
|
integer, optional, intent(in) :: pad
|
|
integer, optional, intent(in) :: addsz,newsz
|
|
! ...Local Variables
|
|
character(len=20) :: name
|
|
logical, parameter :: debug=.false.
|
|
integer :: isz, err_act
|
|
|
|
name='psb_ensure_size'
|
|
call psb_erractionsave(err_act)
|
|
info=psb_success_
|
|
|
|
if(psb_get_errstatus() /= 0) then
|
|
info=psb_err_from_subroutine_
|
|
goto 9999
|
|
end if
|
|
|
|
If (len > psb_size(v)) Then
|
|
if (present(newsz)) then
|
|
isz = (max(len+1,newsz))
|
|
else
|
|
if (present(addsz)) then
|
|
isz = len+max(1,addsz)
|
|
else
|
|
isz = max(len+10, int(1.25*len))
|
|
endif
|
|
endif
|
|
call psb_realloc(isz,v,info,pad=pad)
|
|
|
|
if (info /= psb_success_) then
|
|
info=psb_err_from_subroutine_
|
|
call psb_errpush(info,name,a_err='psb_realloc')
|
|
goto 9999
|
|
end if
|
|
end If
|
|
|
|
call psb_erractionrestore(err_act)
|
|
return
|
|
|
|
9999 continue
|
|
call psb_erractionrestore(err_act)
|
|
|
|
if (err_act == psb_act_ret_) then
|
|
return
|
|
else
|
|
call psb_error()
|
|
end if
|
|
return
|
|
|
|
|
|
End Subroutine psb_icksz1d
|
|
|
|
#if !defined(LONG_INTEGERS)
|
|
Subroutine psb_i8cksz1d(len,v,info,pad,addsz,newsz)
|
|
use psb_error_mod
|
|
|
|
! ...Subroutine Arguments
|
|
Integer,Intent(in) :: len
|
|
Integer(psb_long_int_k_),allocatable, intent(inout) :: v(:)
|
|
integer :: info
|
|
integer(psb_long_int_k_), optional, intent(in) :: pad
|
|
integer, optional, intent(in) :: addsz,newsz
|
|
! ...Local Variables
|
|
character(len=20) :: name
|
|
logical, parameter :: debug=.false.
|
|
integer :: isz, err_act
|
|
|
|
name='psb_ensure_size'
|
|
call psb_erractionsave(err_act)
|
|
info=psb_success_
|
|
|
|
if(psb_get_errstatus() /= 0) then
|
|
info=psb_err_from_subroutine_
|
|
goto 9999
|
|
end if
|
|
|
|
If (len > psb_size(v)) Then
|
|
if (present(newsz)) then
|
|
isz = (max(len+1,newsz))
|
|
else
|
|
if (present(addsz)) then
|
|
isz = len+max(1,addsz)
|
|
else
|
|
isz = max(len+10, int(1.25*len))
|
|
endif
|
|
endif
|
|
call psb_realloc(isz,v,info,pad=pad)
|
|
|
|
if (info /= psb_success_) then
|
|
info=psb_err_from_subroutine_
|
|
call psb_errpush(info,name,a_err='psb_realloc')
|
|
goto 9999
|
|
end if
|
|
end If
|
|
|
|
call psb_erractionrestore(err_act)
|
|
return
|
|
|
|
9999 continue
|
|
call psb_erractionrestore(err_act)
|
|
|
|
if (err_act == psb_act_ret_) then
|
|
return
|
|
else
|
|
call psb_error()
|
|
end if
|
|
return
|
|
|
|
End Subroutine psb_i8cksz1d
|
|
#endif
|
|
|
|
Subroutine psb_scksz1d(len,v,info,pad,addsz,newsz)
|
|
use psb_error_mod
|
|
|
|
! ...Subroutine Arguments
|
|
Integer,Intent(in) :: len
|
|
real(psb_spk_),allocatable, intent(inout) :: v(:)
|
|
integer :: info
|
|
integer, optional, intent(in) :: addsz,newsz
|
|
real(psb_spk_), optional, intent(in) :: pad
|
|
! ...Local Variables
|
|
character(len=20) :: name
|
|
logical, parameter :: debug=.false.
|
|
integer :: isz, err_act
|
|
|
|
name='psb_ensure_size'
|
|
call psb_erractionsave(err_act)
|
|
info=psb_success_
|
|
|
|
if(psb_get_errstatus() /= 0) then
|
|
info=psb_err_from_subroutine_
|
|
goto 9999
|
|
end if
|
|
|
|
If (len > psb_size(v)) Then
|
|
if (present(newsz)) then
|
|
isz = (max(len+1,newsz))
|
|
else
|
|
if (present(addsz)) then
|
|
isz = len+max(1,addsz)
|
|
else
|
|
isz = max(len+10, int(1.25*len))
|
|
endif
|
|
endif
|
|
|
|
call psb_realloc(isz,v,info,pad=pad)
|
|
if (info /= psb_success_) then
|
|
info=psb_err_from_subroutine_
|
|
call psb_errpush(info,name,a_err='psb_realloc')
|
|
goto 9999
|
|
End If
|
|
end If
|
|
|
|
call psb_erractionrestore(err_act)
|
|
return
|
|
|
|
9999 continue
|
|
call psb_erractionrestore(err_act)
|
|
|
|
if (err_act == psb_act_ret_) then
|
|
return
|
|
else
|
|
call psb_error()
|
|
end if
|
|
return
|
|
|
|
|
|
End Subroutine psb_scksz1d
|
|
|
|
Subroutine psb_dcksz1d(len,v,info,pad,addsz,newsz)
|
|
use psb_error_mod
|
|
|
|
! ...Subroutine Arguments
|
|
Integer,Intent(in) :: len
|
|
real(psb_dpk_),allocatable, intent(inout) :: v(:)
|
|
integer :: info
|
|
integer, optional, intent(in) :: addsz,newsz
|
|
real(psb_dpk_), optional, intent(in) :: pad
|
|
! ...Local Variables
|
|
character(len=20) :: name
|
|
logical, parameter :: debug=.false.
|
|
integer :: isz, err_act
|
|
|
|
name='psb_ensure_size'
|
|
call psb_erractionsave(err_act)
|
|
info=psb_success_
|
|
|
|
if(psb_get_errstatus() /= 0) then
|
|
info=psb_err_from_subroutine_
|
|
goto 9999
|
|
end if
|
|
|
|
If (len > psb_size(v)) Then
|
|
if (present(newsz)) then
|
|
isz = (max(len+1,newsz))
|
|
else
|
|
if (present(addsz)) then
|
|
isz = len+max(1,addsz)
|
|
else
|
|
isz = max(len+10, int(1.25*len))
|
|
endif
|
|
endif
|
|
|
|
call psb_realloc(isz,v,info,pad=pad)
|
|
if (info /= psb_success_) then
|
|
info=psb_err_from_subroutine_
|
|
call psb_errpush(info,name,a_err='psb_realloc')
|
|
goto 9999
|
|
End If
|
|
end If
|
|
|
|
call psb_erractionrestore(err_act)
|
|
return
|
|
|
|
9999 continue
|
|
call psb_erractionrestore(err_act)
|
|
|
|
if (err_act == psb_act_ret_) then
|
|
return
|
|
else
|
|
call psb_error()
|
|
end if
|
|
return
|
|
|
|
|
|
End Subroutine psb_dcksz1d
|
|
|
|
|
|
Subroutine psb_ccksz1d(len,v,info,pad,addsz,newsz)
|
|
use psb_error_mod
|
|
|
|
! ...Subroutine Arguments
|
|
Integer,Intent(in) :: len
|
|
complex(psb_spk_),allocatable, intent(inout) :: v(:)
|
|
integer :: info
|
|
integer, optional, intent(in) :: addsz,newsz
|
|
complex(psb_spk_), optional, intent(in) :: pad
|
|
! ...Local Variables
|
|
character(len=20) :: name
|
|
logical, parameter :: debug=.false.
|
|
integer :: isz, err_act
|
|
|
|
name='psb_ensure_size'
|
|
call psb_erractionsave(err_act)
|
|
info=psb_success_
|
|
|
|
if(psb_get_errstatus() /= 0) then
|
|
info=psb_err_from_subroutine_
|
|
goto 9999
|
|
end if
|
|
|
|
If (len > psb_size(v)) Then
|
|
if (present(newsz)) then
|
|
isz = (max(len+1,newsz))
|
|
else
|
|
if (present(addsz)) then
|
|
isz = len+max(1,addsz)
|
|
else
|
|
isz = max(len+10, int(1.25*len))
|
|
endif
|
|
endif
|
|
call psb_realloc(isz,v,info,pad=pad)
|
|
if (info /= psb_success_) then
|
|
info=psb_err_from_subroutine_
|
|
call psb_errpush(info,name,a_err='psb_realloc')
|
|
goto 9999
|
|
end if
|
|
end If
|
|
|
|
call psb_erractionrestore(err_act)
|
|
return
|
|
|
|
9999 continue
|
|
call psb_erractionrestore(err_act)
|
|
|
|
if (err_act == psb_act_ret_) then
|
|
return
|
|
else
|
|
call psb_error()
|
|
end if
|
|
return
|
|
|
|
|
|
End Subroutine psb_ccksz1d
|
|
|
|
|
|
Subroutine psb_zcksz1d(len,v,info,pad,addsz,newsz)
|
|
use psb_error_mod
|
|
|
|
! ...Subroutine Arguments
|
|
Integer,Intent(in) :: len
|
|
complex(psb_dpk_),allocatable, intent(inout) :: v(:)
|
|
integer :: info
|
|
integer, optional, intent(in) :: addsz,newsz
|
|
complex(psb_dpk_), optional, intent(in) :: pad
|
|
! ...Local Variables
|
|
character(len=20) :: name
|
|
logical, parameter :: debug=.false.
|
|
integer :: isz, err_act
|
|
|
|
name='psb_ensure_size'
|
|
call psb_erractionsave(err_act)
|
|
info=psb_success_
|
|
|
|
if(psb_get_errstatus() /= 0) then
|
|
info=psb_err_from_subroutine_
|
|
goto 9999
|
|
end if
|
|
|
|
If (len > psb_size(v)) Then
|
|
if (present(newsz)) then
|
|
isz = (max(len+1,newsz))
|
|
else
|
|
if (present(addsz)) then
|
|
isz = len+max(1,addsz)
|
|
else
|
|
isz = max(len+10, int(1.25*len))
|
|
endif
|
|
endif
|
|
call psb_realloc(isz,v,info,pad=pad)
|
|
if (info /= psb_success_) then
|
|
info=psb_err_from_subroutine_
|
|
call psb_errpush(info,name,a_err='psb_realloc')
|
|
goto 9999
|
|
end if
|
|
end If
|
|
|
|
call psb_erractionrestore(err_act)
|
|
return
|
|
|
|
9999 continue
|
|
call psb_erractionrestore(err_act)
|
|
|
|
if (err_act == psb_act_ret_) then
|
|
return
|
|
else
|
|
call psb_error()
|
|
end if
|
|
return
|
|
|
|
|
|
End Subroutine psb_zcksz1d
|
|
|
|
|
|
Subroutine psb_reallocate1i(len,rrax,info,pad,lb)
|
|
use psb_error_mod
|
|
|
|
! ...Subroutine Arguments
|
|
Integer,Intent(in) :: len
|
|
Integer,allocatable, intent(inout) :: rrax(:)
|
|
integer :: info
|
|
integer, optional, intent(in) :: pad
|
|
integer, optional, intent(in) :: lb
|
|
! ...Local Variables
|
|
Integer,allocatable :: tmp(:)
|
|
Integer :: dim, err_act, err,lb_, lbi, ub_
|
|
character(len=20) :: name
|
|
logical, parameter :: debug=.false.
|
|
|
|
name='psb_reallocate1i'
|
|
call psb_erractionsave(err_act)
|
|
info=psb_success_
|
|
|
|
if (debug) write(psb_err_unit,*) 'reallocate I',len
|
|
if (psb_get_errstatus() /= 0) then
|
|
if (debug) write(psb_err_unit,*) 'reallocate errstatus /= 0'
|
|
info=psb_err_from_subroutine_
|
|
goto 9999
|
|
end if
|
|
|
|
if (present(lb)) then
|
|
lb_ = lb
|
|
else
|
|
lb_ = 1
|
|
endif
|
|
if ((len<0)) then
|
|
err=4025
|
|
call psb_errpush(err,name,i_err=(/len,0,0,0,0/),a_err='integer')
|
|
goto 9999
|
|
end if
|
|
ub_ = lb_+len-1
|
|
if (debug) write(psb_err_unit,*) 'reallocate : lb ub ',lb_, ub_
|
|
if (allocated(rrax)) then
|
|
dim = size(rrax)
|
|
lbi = lbound(rrax,1)
|
|
If ((dim /= len).or.(lbi /= lb_)) Then
|
|
Allocate(tmp(lb_:ub_),stat=info)
|
|
if (info /= psb_success_) then
|
|
err=4025
|
|
call psb_errpush(err,name,i_err=(/len,0,0,0,0/),a_err='integer')
|
|
goto 9999
|
|
end if
|
|
tmp(lb_:lb_-1+min(len,dim))=rrax(lbi:lbi-1+min(len,dim))
|
|
if (debug) write(psb_err_unit,*) 'reallocate : calling move_alloc '
|
|
call psb_move_alloc(tmp,rrax,info)
|
|
if (debug) write(psb_err_unit,*) 'reallocate : from move_alloc ',info
|
|
end if
|
|
else
|
|
dim = 0
|
|
allocate(rrax(lb_:ub_),stat=info)
|
|
if (info /= psb_success_) then
|
|
err=4025
|
|
call psb_errpush(err,name,i_err=(/len,0,0,0,0/),a_err='integer')
|
|
goto 9999
|
|
end if
|
|
endif
|
|
if (present(pad)) then
|
|
rrax(lb_-1+dim+1:lb_-1+len) = pad
|
|
endif
|
|
if (debug) write(psb_err_unit,*) 'end reallocate : ',info
|
|
call psb_erractionrestore(err_act)
|
|
return
|
|
|
|
9999 continue
|
|
info = err
|
|
call psb_erractionrestore(err_act)
|
|
|
|
if (err_act == psb_act_ret_) then
|
|
return
|
|
else
|
|
call psb_error()
|
|
end if
|
|
return
|
|
|
|
|
|
End Subroutine psb_reallocate1i
|
|
|
|
Subroutine psb_reallocate1i8(len,rrax,info,pad,lb)
|
|
use psb_error_mod
|
|
|
|
! ...Subroutine Arguments
|
|
Integer,Intent(in) :: len
|
|
Integer(psb_long_int_k_),allocatable, intent(inout) :: rrax(:)
|
|
integer :: info
|
|
integer(psb_long_int_k_), optional, intent(in) :: pad
|
|
integer, optional, intent(in) :: lb
|
|
! ...Local Variables
|
|
Integer(psb_long_int_k_),allocatable :: tmp(:)
|
|
Integer :: dim, err_act, err,lb_, lbi, ub_
|
|
character(len=20) :: name
|
|
logical, parameter :: debug=.false.
|
|
|
|
name='psb_reallocate1i'
|
|
call psb_erractionsave(err_act)
|
|
info=psb_success_
|
|
|
|
if (debug) write(psb_err_unit,*) 'reallocate I',len
|
|
if (psb_get_errstatus() /= 0) then
|
|
if (debug) write(psb_err_unit,*) 'reallocate errstatus /= 0'
|
|
info=psb_err_from_subroutine_
|
|
goto 9999
|
|
end if
|
|
|
|
if (present(lb)) then
|
|
lb_ = lb
|
|
else
|
|
lb_ = 1
|
|
endif
|
|
if ((len<0)) then
|
|
err=4025
|
|
call psb_errpush(err,name,i_err=(/len,0,0,0,0/),a_err='integer')
|
|
goto 9999
|
|
end if
|
|
ub_ = lb_+len-1
|
|
if (debug) write(psb_err_unit,*) 'reallocate : lb ub ',lb_, ub_
|
|
if (allocated(rrax)) then
|
|
dim = size(rrax)
|
|
lbi = lbound(rrax,1)
|
|
If ((dim /= len).or.(lbi /= lb_)) Then
|
|
Allocate(tmp(lb_:ub_),stat=info)
|
|
if (info /= psb_success_) then
|
|
err=4025
|
|
call psb_errpush(err,name,i_err=(/len,0,0,0,0/),a_err='integer')
|
|
goto 9999
|
|
end if
|
|
tmp(lb_:lb_-1+min(len,dim))=rrax(lbi:lbi-1+min(len,dim))
|
|
if (debug) write(psb_err_unit,*) 'reallocate : calling move_alloc '
|
|
call psb_move_alloc(tmp,rrax,info)
|
|
if (debug) write(psb_err_unit,*) 'reallocate : from move_alloc ',info
|
|
end if
|
|
else
|
|
dim = 0
|
|
allocate(rrax(lb_:ub_),stat=info)
|
|
if (info /= psb_success_) then
|
|
err=4025
|
|
call psb_errpush(err,name,i_err=(/len,0,0,0,0/),a_err='integer')
|
|
goto 9999
|
|
end if
|
|
endif
|
|
if (present(pad)) then
|
|
rrax(lb_-1+dim+1:lb_-1+len) = pad
|
|
endif
|
|
if (debug) write(psb_err_unit,*) 'end reallocate : ',info
|
|
call psb_erractionrestore(err_act)
|
|
return
|
|
|
|
9999 continue
|
|
info = err
|
|
call psb_erractionrestore(err_act)
|
|
|
|
if (err_act == psb_act_ret_) then
|
|
return
|
|
else
|
|
call psb_error()
|
|
end if
|
|
return
|
|
|
|
|
|
End Subroutine psb_reallocate1i8
|
|
|
|
|
|
Subroutine psb_reallocate1s(len,rrax,info,pad,lb)
|
|
use psb_error_mod
|
|
|
|
! ...Subroutine Arguments
|
|
Integer,Intent(in) :: len
|
|
Real(psb_spk_),allocatable, intent(inout) :: rrax(:)
|
|
integer :: info
|
|
real(psb_spk_), optional, intent(in) :: pad
|
|
integer, optional, intent(in) :: lb
|
|
|
|
! ...Local Variables
|
|
Real(psb_spk_),allocatable :: tmp(:)
|
|
Integer :: dim,err_act,err, lb_, lbi,ub_
|
|
character(len=20) :: name
|
|
logical, parameter :: debug=.false.
|
|
|
|
name='psb_reallocate1s'
|
|
call psb_erractionsave(err_act)
|
|
info=psb_success_
|
|
if (debug) write(psb_err_unit,*) 'reallocate S',len
|
|
|
|
if (present(lb)) then
|
|
lb_ = lb
|
|
else
|
|
lb_ = 1
|
|
endif
|
|
if ((len<0)) then
|
|
err=4025
|
|
call psb_errpush(err,name,i_err=(/len,0,0,0,0/),a_err='real(psb_spk_)')
|
|
goto 9999
|
|
end if
|
|
ub_ = lb_ + len-1
|
|
|
|
if (allocated(rrax)) then
|
|
dim = size(rrax)
|
|
lbi = lbound(rrax,1)
|
|
If ((dim /= len).or.(lbi /= lb_)) Then
|
|
Allocate(tmp(lb_:ub_),stat=info)
|
|
if (info /= psb_success_) then
|
|
err=4025
|
|
call psb_errpush(err,name,i_err=(/len,0,0,0,0/),a_err='real(psb_spk_)')
|
|
goto 9999
|
|
end if
|
|
tmp(lb_:lb_-1+min(len,dim))=rrax(lbi:lbi-1+min(len,dim))
|
|
call psb_move_alloc(tmp,rrax,info)
|
|
End If
|
|
else
|
|
dim = 0
|
|
Allocate(rrax(lb_:ub_),stat=info)
|
|
if (info /= psb_success_) then
|
|
err=4025
|
|
call psb_errpush(err,name,i_err=(/len,0,0,0,0/),a_err='real(psb_spk_)')
|
|
goto 9999
|
|
end if
|
|
endif
|
|
if (present(pad)) then
|
|
rrax(lb_-1+dim+1:lb_-1+len) = pad
|
|
endif
|
|
call psb_erractionrestore(err_act)
|
|
return
|
|
|
|
9999 continue
|
|
info = err
|
|
call psb_erractionrestore(err_act)
|
|
|
|
if (err_act == psb_act_ret_) then
|
|
return
|
|
else
|
|
call psb_error()
|
|
end if
|
|
return
|
|
|
|
End Subroutine psb_reallocate1s
|
|
|
|
Subroutine psb_reallocate1d(len,rrax,info,pad,lb)
|
|
use psb_error_mod
|
|
|
|
! ...Subroutine Arguments
|
|
Integer,Intent(in) :: len
|
|
Real(psb_dpk_),allocatable, intent(inout) :: rrax(:)
|
|
integer :: info
|
|
real(psb_dpk_), optional, intent(in) :: pad
|
|
integer, optional, intent(in) :: lb
|
|
|
|
! ...Local Variables
|
|
Real(psb_dpk_),allocatable :: tmp(:)
|
|
Integer :: dim,err_act,err, lb_, lbi,ub_
|
|
character(len=20) :: name
|
|
logical, parameter :: debug=.false.
|
|
|
|
name='psb_reallocate1d'
|
|
call psb_erractionsave(err_act)
|
|
info=psb_success_
|
|
if (debug) write(psb_err_unit,*) 'reallocate D',len
|
|
|
|
if (present(lb)) then
|
|
lb_ = lb
|
|
else
|
|
lb_ = 1
|
|
endif
|
|
if ((len<0)) then
|
|
err=4025
|
|
call psb_errpush(err,name,i_err=(/len,0,0,0,0/),a_err='real(psb_dpk_)')
|
|
goto 9999
|
|
end if
|
|
ub_ = lb_ + len-1
|
|
|
|
if (allocated(rrax)) then
|
|
dim = size(rrax)
|
|
lbi = lbound(rrax,1)
|
|
If ((dim /= len).or.(lbi /= lb_)) Then
|
|
Allocate(tmp(lb_:ub_),stat=info)
|
|
if (info /= psb_success_) then
|
|
err=4025
|
|
call psb_errpush(err,name,i_err=(/len,0,0,0,0/),a_err='real(psb_dpk_)')
|
|
goto 9999
|
|
end if
|
|
tmp(lb_:lb_-1+min(len,dim))=rrax(lbi:lbi-1+min(len,dim))
|
|
call psb_move_alloc(tmp,rrax,info)
|
|
End If
|
|
else
|
|
dim = 0
|
|
Allocate(rrax(lb_:ub_),stat=info)
|
|
if (info /= psb_success_) then
|
|
err=4025
|
|
call psb_errpush(err,name,i_err=(/len,0,0,0,0/),a_err='real(psb_dpk_)')
|
|
goto 9999
|
|
end if
|
|
endif
|
|
if (present(pad)) then
|
|
rrax(lb_-1+dim+1:lb_-1+len) = pad
|
|
endif
|
|
call psb_erractionrestore(err_act)
|
|
return
|
|
|
|
9999 continue
|
|
info = err
|
|
call psb_erractionrestore(err_act)
|
|
|
|
if (err_act == psb_act_ret_) then
|
|
return
|
|
else
|
|
call psb_error()
|
|
end if
|
|
return
|
|
|
|
End Subroutine psb_reallocate1d
|
|
|
|
|
|
Subroutine psb_reallocate1c(len,rrax,info,pad,lb)
|
|
use psb_error_mod
|
|
|
|
! ...Subroutine Arguments
|
|
Integer,Intent(in) :: len
|
|
complex(psb_spk_),allocatable, intent(inout):: rrax(:)
|
|
integer :: info
|
|
complex(psb_spk_), optional, intent(in) :: pad
|
|
integer, optional, intent(in) :: lb
|
|
|
|
! ...Local Variables
|
|
complex(psb_spk_),allocatable :: tmp(:)
|
|
Integer :: dim,err_act,err,lb_,ub_,lbi
|
|
character(len=20) :: name
|
|
logical, parameter :: debug=.false.
|
|
|
|
name='psb_reallocate1c'
|
|
call psb_erractionsave(err_act)
|
|
info=psb_success_
|
|
if (debug) write(psb_err_unit,*) 'reallocate C',len
|
|
if (present(lb)) then
|
|
lb_ = lb
|
|
else
|
|
lb_ = 1
|
|
endif
|
|
if ((len<0)) then
|
|
err=4025
|
|
call psb_errpush(err,name,i_err=(/len,0,0,0,0/),a_err='complex(psb_spk_)')
|
|
goto 9999
|
|
end if
|
|
ub_ = lb_+len-1
|
|
|
|
if (allocated(rrax)) then
|
|
dim = size(rrax)
|
|
lbi = lbound(rrax,1)
|
|
If ((dim /= len).or.(lbi /= lb_)) Then
|
|
Allocate(tmp(lb_:ub_),stat=info)
|
|
if (info /= psb_success_) then
|
|
err=4025
|
|
call psb_errpush(err,name,i_err=(/len,0,0,0,0/),a_err='complex(psb_spk_)')
|
|
goto 9999
|
|
end if
|
|
tmp(lb_:lb_-1+min(len,dim))=rrax(lbi:lbi-1+min(len,dim))
|
|
call psb_move_alloc(tmp,rrax,info)
|
|
end if
|
|
else
|
|
dim = 0
|
|
Allocate(rrax(lb_:ub_),stat=info)
|
|
if (info /= psb_success_) then
|
|
err=4025
|
|
call psb_errpush(err,name,i_err=(/len,0,0,0,0/),a_err='complex(psb_spk_)')
|
|
goto 9999
|
|
end if
|
|
endif
|
|
if (present(pad)) then
|
|
rrax(lb_-1+dim+1:lb_-1+len) = pad
|
|
endif
|
|
call psb_erractionrestore(err_act)
|
|
return
|
|
|
|
9999 continue
|
|
info = err
|
|
call psb_erractionrestore(err_act)
|
|
|
|
if (err_act == psb_act_ret_) then
|
|
return
|
|
else
|
|
call psb_error()
|
|
end if
|
|
return
|
|
|
|
End Subroutine psb_reallocate1c
|
|
|
|
Subroutine psb_reallocate1z(len,rrax,info,pad,lb)
|
|
use psb_error_mod
|
|
|
|
! ...Subroutine Arguments
|
|
Integer,Intent(in) :: len
|
|
complex(psb_dpk_),allocatable, intent(inout):: rrax(:)
|
|
integer :: info
|
|
complex(psb_dpk_), optional, intent(in) :: pad
|
|
integer, optional, intent(in) :: lb
|
|
|
|
! ...Local Variables
|
|
complex(psb_dpk_),allocatable :: tmp(:)
|
|
Integer :: dim,err_act,err,lb_,ub_,lbi
|
|
character(len=20) :: name
|
|
logical, parameter :: debug=.false.
|
|
|
|
name='psb_reallocate1z'
|
|
call psb_erractionsave(err_act)
|
|
info=psb_success_
|
|
if (debug) write(psb_err_unit,*) 'reallocate Z',len
|
|
if (present(lb)) then
|
|
lb_ = lb
|
|
else
|
|
lb_ = 1
|
|
endif
|
|
if ((len<0)) then
|
|
err=4025
|
|
call psb_errpush(err,name,i_err=(/len,0,0,0,0/),a_err='complex(psb_dpk_)')
|
|
goto 9999
|
|
end if
|
|
ub_ = lb_+len-1
|
|
|
|
if (allocated(rrax)) then
|
|
dim = size(rrax)
|
|
lbi = lbound(rrax,1)
|
|
If ((dim /= len).or.(lbi /= lb_)) Then
|
|
Allocate(tmp(lb_:ub_),stat=info)
|
|
if (info /= psb_success_) then
|
|
err=4025
|
|
call psb_errpush(err,name,i_err=(/len,0,0,0,0/),a_err='complex(psb_dpk_)')
|
|
goto 9999
|
|
end if
|
|
tmp(lb_:lb_-1+min(len,dim))=rrax(lbi:lbi-1+min(len,dim))
|
|
call psb_move_alloc(tmp,rrax,info)
|
|
end if
|
|
else
|
|
dim = 0
|
|
Allocate(rrax(lb_:ub_),stat=info)
|
|
if (info /= psb_success_) then
|
|
err=4025
|
|
call psb_errpush(err,name,i_err=(/len,0,0,0,0/),a_err='complex(psb_dpk_)')
|
|
goto 9999
|
|
end if
|
|
endif
|
|
if (present(pad)) then
|
|
rrax(lb_-1+dim+1:lb_-1+len) = pad
|
|
endif
|
|
call psb_erractionrestore(err_act)
|
|
return
|
|
|
|
9999 continue
|
|
info = err
|
|
call psb_erractionrestore(err_act)
|
|
|
|
if (err_act == psb_act_ret_) then
|
|
return
|
|
else
|
|
call psb_error()
|
|
end if
|
|
return
|
|
|
|
End Subroutine psb_reallocate1z
|
|
|
|
|
|
|
|
Subroutine psb_reallocates2(len1,len2,rrax,info,pad,lb1,lb2)
|
|
use psb_error_mod
|
|
! ...Subroutine Arguments
|
|
Integer,Intent(in) :: len1,len2
|
|
Real(psb_spk_),allocatable :: rrax(:,:)
|
|
integer :: info
|
|
real(psb_spk_), optional, intent(in) :: pad
|
|
Integer,Intent(in), optional :: lb1,lb2
|
|
|
|
! ...Local Variables
|
|
|
|
Real(psb_spk_),allocatable :: tmp(:,:)
|
|
Integer :: dim,err_act,err, dim2,lb1_, lb2_, ub1_, ub2_,&
|
|
& lbi1, lbi2
|
|
character(len=20) :: name
|
|
|
|
name='psb_reallocates2'
|
|
call psb_erractionsave(err_act)
|
|
info=psb_success_
|
|
if (present(lb1)) then
|
|
lb1_ = lb1
|
|
else
|
|
lb1_ = 1
|
|
endif
|
|
if (present(lb2)) then
|
|
lb2_ = lb2
|
|
else
|
|
lb2_ = 1
|
|
endif
|
|
ub1_ = lb1_ + len1 -1
|
|
ub2_ = lb2_ + len2 -1
|
|
|
|
if (len1 < 0) then
|
|
err=4025
|
|
call psb_errpush(err,name,i_err=(/len1,0,0,0,0/),a_err='real(psb_spk_)')
|
|
goto 9999
|
|
end if
|
|
if (len2 < 0) then
|
|
err=4025
|
|
call psb_errpush(err,name,i_err=(/len2,0,0,0,0/),a_err='real(psb_spk_)')
|
|
goto 9999
|
|
end if
|
|
|
|
|
|
if (allocated(rrax)) then
|
|
dim = size(rrax,1)
|
|
lbi1 = lbound(rrax,1)
|
|
dim2 = size(rrax,2)
|
|
lbi2 = lbound(rrax,2)
|
|
If ((dim /= len1).or.(dim2 /= len2).or.(lbi1 /= lb1_)&
|
|
& .or.(lbi2 /= lb2_)) Then
|
|
Allocate(tmp(lb1_:ub1_,lb2_:ub2_),stat=info)
|
|
if (info /= psb_success_) then
|
|
err=4025
|
|
call psb_errpush(err,name,i_err=(/len1*len2,0,0,0,0/),a_err='real(psb_spk_)')
|
|
goto 9999
|
|
end if
|
|
tmp(lb1_:lb1_-1+min(len1,dim),lb2_:lb2_-1+min(len2,dim2)) = &
|
|
& rrax(lbi1:lbi1-1+min(len1,dim),lbi2:lbi2-1+min(len2,dim2))
|
|
call psb_move_alloc(tmp,rrax,info)
|
|
End If
|
|
else
|
|
dim = 0
|
|
dim2 = 0
|
|
Allocate(rrax(lb1_:ub1_,lb2_:ub2_),stat=info)
|
|
if (info /= psb_success_) then
|
|
err=4025
|
|
call psb_errpush(err,name,i_err=(/len1*len2,0,0,0,0/),a_err='real(psb_spk_)')
|
|
goto 9999
|
|
end if
|
|
endif
|
|
if (present(pad)) then
|
|
rrax(lb1_-1+dim+1:lb1_-1+len1,:) = pad
|
|
rrax(lb1_:lb1_-1+dim,lb2_-1+dim2+1:lb2_-1+len2) = pad
|
|
endif
|
|
call psb_erractionrestore(err_act)
|
|
return
|
|
|
|
9999 continue
|
|
info = err
|
|
call psb_erractionrestore(err_act)
|
|
|
|
if (err_act == psb_act_ret_) then
|
|
return
|
|
else
|
|
call psb_error()
|
|
end if
|
|
return
|
|
|
|
End Subroutine psb_reallocates2
|
|
|
|
|
|
Subroutine psb_reallocated2(len1,len2,rrax,info,pad,lb1,lb2)
|
|
use psb_error_mod
|
|
! ...Subroutine Arguments
|
|
Integer,Intent(in) :: len1,len2
|
|
Real(psb_dpk_),allocatable :: rrax(:,:)
|
|
integer :: info
|
|
real(psb_dpk_), optional, intent(in) :: pad
|
|
Integer,Intent(in), optional :: lb1,lb2
|
|
|
|
! ...Local Variables
|
|
|
|
Real(psb_dpk_),allocatable :: tmp(:,:)
|
|
Integer :: dim,err_act,err, dim2,lb1_, lb2_, ub1_, ub2_,&
|
|
& lbi1, lbi2
|
|
character(len=20) :: name
|
|
|
|
name='psb_reallocated2'
|
|
call psb_erractionsave(err_act)
|
|
info=psb_success_
|
|
if (present(lb1)) then
|
|
lb1_ = lb1
|
|
else
|
|
lb1_ = 1
|
|
endif
|
|
if (present(lb2)) then
|
|
lb2_ = lb2
|
|
else
|
|
lb2_ = 1
|
|
endif
|
|
ub1_ = lb1_ + len1 -1
|
|
ub2_ = lb2_ + len2 -1
|
|
|
|
if (len1 < 0) then
|
|
err=4025
|
|
call psb_errpush(err,name,i_err=(/len1,0,0,0,0/),a_err='real(psb_dpk_)')
|
|
goto 9999
|
|
end if
|
|
if (len2 < 0) then
|
|
err=4025
|
|
call psb_errpush(err,name,i_err=(/len2,0,0,0,0/),a_err='real(psb_dpk_)')
|
|
goto 9999
|
|
end if
|
|
|
|
|
|
if (allocated(rrax)) then
|
|
dim = size(rrax,1)
|
|
lbi1 = lbound(rrax,1)
|
|
dim2 = size(rrax,2)
|
|
lbi2 = lbound(rrax,2)
|
|
If ((dim /= len1).or.(dim2 /= len2).or.(lbi1 /= lb1_)&
|
|
& .or.(lbi2 /= lb2_)) Then
|
|
Allocate(tmp(lb1_:ub1_,lb2_:ub2_),stat=info)
|
|
if (info /= psb_success_) then
|
|
err=4025
|
|
call psb_errpush(err,name,i_err=(/len1*len2,0,0,0,0/),a_err='real(psb_dpk_)')
|
|
goto 9999
|
|
end if
|
|
tmp(lb1_:lb1_-1+min(len1,dim),lb2_:lb2_-1+min(len2,dim2)) = &
|
|
& rrax(lbi1:lbi1-1+min(len1,dim),lbi2:lbi2-1+min(len2,dim2))
|
|
call psb_move_alloc(tmp,rrax,info)
|
|
End If
|
|
else
|
|
dim = 0
|
|
dim2 = 0
|
|
Allocate(rrax(lb1_:ub1_,lb2_:ub2_),stat=info)
|
|
if (info /= psb_success_) then
|
|
err=4025
|
|
call psb_errpush(err,name,i_err=(/len1*len2,0,0,0,0/),a_err='real(psb_dpk_)')
|
|
goto 9999
|
|
end if
|
|
endif
|
|
if (present(pad)) then
|
|
rrax(lb1_-1+dim+1:lb1_-1+len1,:) = pad
|
|
rrax(lb1_:lb1_-1+dim,lb2_-1+dim2+1:lb2_-1+len2) = pad
|
|
endif
|
|
call psb_erractionrestore(err_act)
|
|
return
|
|
|
|
9999 continue
|
|
info = err
|
|
call psb_erractionrestore(err_act)
|
|
|
|
if (err_act == psb_act_ret_) then
|
|
return
|
|
else
|
|
call psb_error()
|
|
end if
|
|
return
|
|
|
|
End Subroutine psb_reallocated2
|
|
|
|
|
|
Subroutine psb_reallocatec2(len1,len2,rrax,info,pad,lb1,lb2)
|
|
use psb_error_mod
|
|
! ...Subroutine Arguments
|
|
Integer,Intent(in) :: len1,len2
|
|
complex(psb_spk_),allocatable :: rrax(:,:)
|
|
integer :: info
|
|
complex(psb_spk_), optional, intent(in) :: pad
|
|
Integer,Intent(in), optional :: lb1,lb2
|
|
|
|
! ...Local Variables
|
|
|
|
complex(psb_spk_),allocatable :: tmp(:,:)
|
|
Integer :: dim,err_act,err,dim2,lb1_, lb2_, ub1_, ub2_,&
|
|
& lbi1, lbi2
|
|
character(len=20) :: name
|
|
|
|
name='psb_reallocatec2'
|
|
call psb_erractionsave(err_act)
|
|
info=psb_success_
|
|
if (present(lb1)) then
|
|
lb1_ = lb1
|
|
else
|
|
lb1_ = 1
|
|
endif
|
|
if (present(lb2)) then
|
|
lb2_ = lb2
|
|
else
|
|
lb2_ = 1
|
|
endif
|
|
ub1_ = lb1_ + len1 -1
|
|
ub2_ = lb2_ + len2 -1
|
|
|
|
if (len1 < 0) then
|
|
err=4025
|
|
call psb_errpush(err,name,i_err=(/len1,0,0,0,0/),a_err='complex(psb_spk_)')
|
|
goto 9999
|
|
end if
|
|
if (len2 < 0) then
|
|
err=4025
|
|
call psb_errpush(err,name,i_err=(/len2,0,0,0,0/),a_err='complex(psb_spk_)')
|
|
goto 9999
|
|
end if
|
|
|
|
|
|
if (allocated(rrax)) then
|
|
dim = size(rrax,1)
|
|
lbi1 = lbound(rrax,1)
|
|
dim2 = size(rrax,2)
|
|
lbi2 = lbound(rrax,2)
|
|
If ((dim /= len1).or.(dim2 /= len2).or.(lbi1 /= lb1_)&
|
|
& .or.(lbi2 /= lb2_)) Then
|
|
Allocate(tmp(lb1_:ub1_,lb2_:ub2_),stat=info)
|
|
if (info /= psb_success_) then
|
|
err=4025
|
|
call psb_errpush(err,name,i_err=(/len1*len2,0,0,0,0/),a_err='complex(psb_spk_)')
|
|
goto 9999
|
|
end if
|
|
tmp(lb1_:lb1_-1+min(len1,dim),lb2_:lb2_-1+min(len2,dim2)) = &
|
|
& rrax(lbi1:lbi1-1+min(len1,dim),lbi2:lbi2-1+min(len2,dim2))
|
|
call psb_move_alloc(tmp,rrax,info)
|
|
End If
|
|
else
|
|
dim = 0
|
|
dim2 = 0
|
|
Allocate(rrax(lb1_:ub1_,lb2_:ub2_),stat=info)
|
|
if (info /= psb_success_) then
|
|
err=4025
|
|
call psb_errpush(err,name,i_err=(/len1*len2,0,0,0,0/),a_err='complex(psb_spk_)')
|
|
goto 9999
|
|
end if
|
|
endif
|
|
if (present(pad)) then
|
|
rrax(lb1_-1+dim+1:lb1_-1+len1,:) = pad
|
|
rrax(lb1_:lb1_-1+dim,lb2_-1+dim2+1:lb2_-1+len2) = pad
|
|
endif
|
|
|
|
call psb_erractionrestore(err_act)
|
|
return
|
|
|
|
9999 continue
|
|
info = err
|
|
call psb_erractionrestore(err_act)
|
|
|
|
if (err_act == psb_act_ret_) then
|
|
return
|
|
else
|
|
call psb_error()
|
|
end if
|
|
return
|
|
|
|
End Subroutine psb_reallocatec2
|
|
|
|
Subroutine psb_reallocatez2(len1,len2,rrax,info,pad,lb1,lb2)
|
|
use psb_error_mod
|
|
! ...Subroutine Arguments
|
|
Integer,Intent(in) :: len1,len2
|
|
complex(psb_dpk_),allocatable :: rrax(:,:)
|
|
integer :: info
|
|
complex(psb_dpk_), optional, intent(in) :: pad
|
|
Integer,Intent(in), optional :: lb1,lb2
|
|
|
|
! ...Local Variables
|
|
|
|
complex(psb_dpk_),allocatable :: tmp(:,:)
|
|
Integer :: dim,err_act,err,dim2,lb1_, lb2_, ub1_, ub2_,&
|
|
& lbi1, lbi2
|
|
character(len=20) :: name
|
|
|
|
name='psb_reallocatez2'
|
|
call psb_erractionsave(err_act)
|
|
info=psb_success_
|
|
if (present(lb1)) then
|
|
lb1_ = lb1
|
|
else
|
|
lb1_ = 1
|
|
endif
|
|
if (present(lb2)) then
|
|
lb2_ = lb2
|
|
else
|
|
lb2_ = 1
|
|
endif
|
|
ub1_ = lb1_ + len1 -1
|
|
ub2_ = lb2_ + len2 -1
|
|
|
|
if (len1 < 0) then
|
|
err=4025
|
|
call psb_errpush(err,name,i_err=(/len1,0,0,0,0/),a_err='complex(psb_dpk_)')
|
|
goto 9999
|
|
end if
|
|
if (len2 < 0) then
|
|
err=4025
|
|
call psb_errpush(err,name,i_err=(/len2,0,0,0,0/),a_err='complex(psb_dpk_)')
|
|
goto 9999
|
|
end if
|
|
|
|
|
|
if (allocated(rrax)) then
|
|
dim = size(rrax,1)
|
|
lbi1 = lbound(rrax,1)
|
|
dim2 = size(rrax,2)
|
|
lbi2 = lbound(rrax,2)
|
|
If ((dim /= len1).or.(dim2 /= len2).or.(lbi1 /= lb1_)&
|
|
& .or.(lbi2 /= lb2_)) Then
|
|
Allocate(tmp(lb1_:ub1_,lb2_:ub2_),stat=info)
|
|
if (info /= psb_success_) then
|
|
err=4025
|
|
call psb_errpush(err,name,i_err=(/len1*len2,0,0,0,0/),a_err='complex(psb_dpk_)')
|
|
goto 9999
|
|
end if
|
|
tmp(lb1_:lb1_-1+min(len1,dim),lb2_:lb2_-1+min(len2,dim2)) = &
|
|
& rrax(lbi1:lbi1-1+min(len1,dim),lbi2:lbi2-1+min(len2,dim2))
|
|
call psb_move_alloc(tmp,rrax,info)
|
|
End If
|
|
else
|
|
dim = 0
|
|
dim2 = 0
|
|
Allocate(rrax(lb1_:ub1_,lb2_:ub2_),stat=info)
|
|
if (info /= psb_success_) then
|
|
err=4025
|
|
call psb_errpush(err,name,i_err=(/len1*len2,0,0,0,0/),a_err='complex(psb_dpk_)')
|
|
goto 9999
|
|
end if
|
|
endif
|
|
if (present(pad)) then
|
|
rrax(lb1_-1+dim+1:lb1_-1+len1,:) = pad
|
|
rrax(lb1_:lb1_-1+dim,lb2_-1+dim2+1:lb2_-1+len2) = pad
|
|
endif
|
|
|
|
call psb_erractionrestore(err_act)
|
|
return
|
|
|
|
9999 continue
|
|
info = err
|
|
call psb_erractionrestore(err_act)
|
|
|
|
if (err_act == psb_act_ret_) then
|
|
return
|
|
else
|
|
call psb_error()
|
|
end if
|
|
return
|
|
|
|
End Subroutine psb_reallocatez2
|
|
|
|
|
|
Subroutine psb_reallocatei2(len1,len2,rrax,info,pad,lb1,lb2)
|
|
use psb_error_mod
|
|
! ...Subroutine Arguments
|
|
Integer,Intent(in) :: len1,len2
|
|
integer,allocatable :: rrax(:,:)
|
|
integer :: info
|
|
integer, optional, intent(in) :: pad
|
|
Integer,Intent(in), optional :: lb1,lb2
|
|
|
|
! ...Local Variables
|
|
integer,allocatable :: tmp(:,:)
|
|
Integer :: dim,err_act,err, dim2,lb1_, lb2_, ub1_, ub2_,&
|
|
& lbi1, lbi2
|
|
character(len=20) :: name
|
|
|
|
name='psb_reallocatei2'
|
|
call psb_erractionsave(err_act)
|
|
info=psb_success_
|
|
if (present(lb1)) then
|
|
lb1_ = lb1
|
|
else
|
|
lb1_ = 1
|
|
endif
|
|
if (present(lb2)) then
|
|
lb2_ = lb2
|
|
else
|
|
lb2_ = 1
|
|
endif
|
|
ub1_ = lb1_ + len1 -1
|
|
ub2_ = lb2_ + len2 -1
|
|
|
|
if (len1 < 0) then
|
|
err=4025
|
|
call psb_errpush(err,name,i_err=(/len1,0,0,0,0/),a_err='integer')
|
|
goto 9999
|
|
end if
|
|
if (len2 < 0) then
|
|
err=4025
|
|
call psb_errpush(err,name,i_err=(/len2,0,0,0,0/),a_err='integer')
|
|
goto 9999
|
|
end if
|
|
|
|
if (allocated(rrax)) then
|
|
dim = size(rrax,1)
|
|
lbi1 = lbound(rrax,1)
|
|
dim2 = size(rrax,2)
|
|
lbi2 = lbound(rrax,2)
|
|
If ((dim /= len1).or.(dim2 /= len2).or.(lbi1 /= lb1_)&
|
|
& .or.(lbi2 /= lb2_)) Then
|
|
Allocate(tmp(lb1_:ub1_,lb2_:ub2_),stat=info)
|
|
if (info /= psb_success_) then
|
|
err=4025
|
|
call psb_errpush(err,name,i_err=(/len1*len2,0,0,0,0/),a_err='integer')
|
|
goto 9999
|
|
end if
|
|
tmp(lb1_:lb1_-1+min(len1,dim),lb2_:lb2_-1+min(len2,dim2)) = &
|
|
& rrax(lbi1:lbi1-1+min(len1,dim),lbi2:lbi2-1+min(len2,dim2))
|
|
call psb_move_alloc(tmp,rrax,info)
|
|
End If
|
|
else
|
|
dim = 0
|
|
dim2 = 0
|
|
Allocate(rrax(lb1_:ub1_,lb2_:ub2_),stat=info)
|
|
if (info /= psb_success_) then
|
|
err=4025
|
|
call psb_errpush(err,name,i_err=(/len1*len2,0,0,0,0/),a_err='integer')
|
|
goto 9999
|
|
end if
|
|
endif
|
|
if (present(pad)) then
|
|
rrax(lb1_-1+dim+1:lb1_-1+len1,:) = pad
|
|
rrax(lb1_:lb1_-1+dim,lb2_-1+dim2+1:lb2_-1+len2) = pad
|
|
endif
|
|
|
|
call psb_erractionrestore(err_act)
|
|
return
|
|
|
|
9999 continue
|
|
info = err
|
|
call psb_erractionrestore(err_act)
|
|
|
|
if (err_act == psb_act_ret_) then
|
|
return
|
|
else
|
|
call psb_error()
|
|
end if
|
|
return
|
|
|
|
End Subroutine psb_reallocatei2
|
|
|
|
#if !defined(LONG_INTEGERS)
|
|
Subroutine psb_reallocatei8_2(len1,len2,rrax,info,pad,lb1,lb2)
|
|
use psb_error_mod
|
|
! ...Subroutine Arguments
|
|
Integer,Intent(in) :: len1,len2
|
|
integer(psb_long_int_k_),allocatable :: rrax(:,:)
|
|
integer :: info
|
|
integer(psb_long_int_k_), optional, intent(in) :: pad
|
|
Integer,Intent(in), optional :: lb1,lb2
|
|
|
|
! ...Local Variables
|
|
integer(psb_long_int_k_),allocatable :: tmp(:,:)
|
|
Integer :: dim,err_act,err, dim2,lb1_, lb2_, ub1_, ub2_,&
|
|
& lbi1, lbi2
|
|
character(len=20) :: name
|
|
|
|
name='psb_reallocatei2'
|
|
call psb_erractionsave(err_act)
|
|
info=psb_success_
|
|
if (present(lb1)) then
|
|
lb1_ = lb1
|
|
else
|
|
lb1_ = 1
|
|
endif
|
|
if (present(lb2)) then
|
|
lb2_ = lb2
|
|
else
|
|
lb2_ = 1
|
|
endif
|
|
ub1_ = lb1_ + len1 -1
|
|
ub2_ = lb2_ + len2 -1
|
|
|
|
if (len1 < 0) then
|
|
err=4025
|
|
call psb_errpush(err,name,i_err=(/len1,0,0,0,0/),a_err='integer')
|
|
goto 9999
|
|
end if
|
|
if (len2 < 0) then
|
|
err=4025
|
|
call psb_errpush(err,name,i_err=(/len2,0,0,0,0/),a_err='integer')
|
|
goto 9999
|
|
end if
|
|
|
|
if (allocated(rrax)) then
|
|
dim = size(rrax,1)
|
|
lbi1 = lbound(rrax,1)
|
|
dim2 = size(rrax,2)
|
|
lbi2 = lbound(rrax,2)
|
|
If ((dim /= len1).or.(dim2 /= len2).or.(lbi1 /= lb1_)&
|
|
& .or.(lbi2 /= lb2_)) Then
|
|
Allocate(tmp(lb1_:ub1_,lb2_:ub2_),stat=info)
|
|
if (info /= psb_success_) then
|
|
err=4025
|
|
call psb_errpush(err,name,i_err=(/len1*len2,0,0,0,0/),a_err='integer')
|
|
goto 9999
|
|
end if
|
|
tmp(lb1_:lb1_-1+min(len1,dim),lb2_:lb2_-1+min(len2,dim2)) = &
|
|
& rrax(lbi1:lbi1-1+min(len1,dim),lbi2:lbi2-1+min(len2,dim2))
|
|
call psb_move_alloc(tmp,rrax,info)
|
|
End If
|
|
else
|
|
dim = 0
|
|
dim2 = 0
|
|
Allocate(rrax(lb1_:ub1_,lb2_:ub2_),stat=info)
|
|
if (info /= psb_success_) then
|
|
err=4025
|
|
call psb_errpush(err,name,i_err=(/len1*len2,0,0,0,0/),a_err='integer')
|
|
goto 9999
|
|
end if
|
|
endif
|
|
if (present(pad)) then
|
|
rrax(lb1_-1+dim+1:lb1_-1+len1,:) = pad
|
|
rrax(lb1_:lb1_-1+dim,lb2_-1+dim2+1:lb2_-1+len2) = pad
|
|
endif
|
|
|
|
call psb_erractionrestore(err_act)
|
|
return
|
|
|
|
9999 continue
|
|
info = err
|
|
call psb_erractionrestore(err_act)
|
|
|
|
if (err_act == psb_act_ret_) then
|
|
return
|
|
else
|
|
call psb_error()
|
|
end if
|
|
return
|
|
|
|
End Subroutine psb_reallocatei8_2
|
|
#endif
|
|
|
|
Subroutine psb_reallocate2i(len,rrax,y,info,pad)
|
|
use psb_error_mod
|
|
! ...Subroutine Arguments
|
|
|
|
Integer,Intent(in) :: len
|
|
Integer,allocatable, intent(inout) :: rrax(:),y(:)
|
|
integer :: info
|
|
integer, optional, intent(in) :: pad
|
|
character(len=20) :: name
|
|
integer :: err_act, err
|
|
|
|
name='psb_reallocate2i'
|
|
call psb_erractionsave(err_act)
|
|
info=psb_success_
|
|
|
|
if(psb_get_errstatus() /= 0) then
|
|
info=psb_err_from_subroutine_
|
|
goto 9999
|
|
end if
|
|
|
|
call psb_reallocate1i(len,rrax,info,pad=pad)
|
|
if (info /= psb_success_) then
|
|
err=4000
|
|
call psb_errpush(err,name)
|
|
goto 9999
|
|
end if
|
|
call psb_reallocate1i(len,y,info,pad=pad)
|
|
if (info /= psb_success_) then
|
|
err=4000
|
|
call psb_errpush(err,name)
|
|
goto 9999
|
|
end if
|
|
call psb_erractionrestore(err_act)
|
|
return
|
|
|
|
9999 continue
|
|
call psb_erractionrestore(err_act)
|
|
|
|
if (err_act == psb_act_ret_) then
|
|
return
|
|
else
|
|
call psb_error()
|
|
end if
|
|
return
|
|
|
|
End Subroutine psb_reallocate2i
|
|
|
|
|
|
|
|
|
|
Subroutine psb_reallocate2i1s(len,rrax,y,z,info)
|
|
use psb_error_mod
|
|
! ...Subroutine Arguments
|
|
Integer,Intent(in) :: len
|
|
Integer,allocatable, intent(inout) :: rrax(:),y(:)
|
|
Real(psb_spk_),allocatable, intent(inout) :: z(:)
|
|
integer :: info
|
|
character(len=20) :: name
|
|
integer :: err_act, err
|
|
logical, parameter :: debug=.false.
|
|
|
|
name='psb_reallocate2i1s'
|
|
call psb_erractionsave(err_act)
|
|
|
|
|
|
info=psb_success_
|
|
call psb_realloc(len,rrax,info)
|
|
if (info /= psb_success_) then
|
|
err=4000
|
|
call psb_errpush(err,name)
|
|
goto 9999
|
|
end if
|
|
call psb_realloc(len,y,info)
|
|
if (info /= psb_success_) then
|
|
err=4000
|
|
call psb_errpush(err,name)
|
|
goto 9999
|
|
end if
|
|
call psb_realloc(len,z,info)
|
|
if (info /= psb_success_) then
|
|
err=4000
|
|
call psb_errpush(err,name)
|
|
goto 9999
|
|
end if
|
|
call psb_erractionrestore(err_act)
|
|
return
|
|
|
|
9999 continue
|
|
call psb_erractionrestore(err_act)
|
|
|
|
if (err_act == psb_act_ret_) then
|
|
return
|
|
else
|
|
call psb_error()
|
|
end if
|
|
return
|
|
End Subroutine psb_reallocate2i1s
|
|
|
|
|
|
Subroutine psb_reallocate2i1d(len,rrax,y,z,info)
|
|
use psb_error_mod
|
|
! ...Subroutine Arguments
|
|
Integer,Intent(in) :: len
|
|
Integer,allocatable, intent(inout) :: rrax(:),y(:)
|
|
Real(psb_dpk_),allocatable, intent(inout) :: z(:)
|
|
integer :: info
|
|
character(len=20) :: name
|
|
integer :: err_act, err
|
|
|
|
name='psb_reallocate2i1d'
|
|
call psb_erractionsave(err_act)
|
|
|
|
info=psb_success_
|
|
|
|
call psb_realloc(len,rrax,info)
|
|
if (info /= psb_success_) then
|
|
err=4000
|
|
call psb_errpush(err,name)
|
|
goto 9999
|
|
end if
|
|
call psb_realloc(len,y,info)
|
|
if (info /= psb_success_) then
|
|
err=4000
|
|
call psb_errpush(err,name)
|
|
goto 9999
|
|
end if
|
|
call psb_realloc(len,z,info)
|
|
if (info /= psb_success_) then
|
|
err=4000
|
|
call psb_errpush(err,name)
|
|
goto 9999
|
|
end if
|
|
call psb_erractionrestore(err_act)
|
|
return
|
|
|
|
9999 continue
|
|
call psb_erractionrestore(err_act)
|
|
|
|
if (err_act == psb_act_ret_) then
|
|
return
|
|
else
|
|
call psb_error()
|
|
end if
|
|
return
|
|
End Subroutine psb_reallocate2i1d
|
|
|
|
|
|
|
|
Subroutine psb_reallocate2i1c(len,rrax,y,z,info)
|
|
use psb_error_mod
|
|
! ...Subroutine Arguments
|
|
Integer,Intent(in) :: len
|
|
Integer,allocatable, intent(inout) :: rrax(:),y(:)
|
|
complex(psb_spk_),allocatable, intent(inout) :: z(:)
|
|
integer :: info
|
|
character(len=20) :: name
|
|
integer :: err_act, err
|
|
|
|
name='psb_reallocate2i1c'
|
|
call psb_erractionsave(err_act)
|
|
|
|
|
|
info=psb_success_
|
|
call psb_realloc(len,rrax,info)
|
|
if (info /= psb_success_) then
|
|
err=4000
|
|
call psb_errpush(err,name)
|
|
goto 9999
|
|
end if
|
|
call psb_realloc(len,y,info)
|
|
if (info /= psb_success_) then
|
|
err=4000
|
|
call psb_errpush(err,name)
|
|
goto 9999
|
|
end if
|
|
call psb_realloc(len,z,info)
|
|
if (info /= psb_success_) then
|
|
err=4000
|
|
call psb_errpush(err,name)
|
|
goto 9999
|
|
end if
|
|
call psb_erractionrestore(err_act)
|
|
return
|
|
|
|
9999 continue
|
|
call psb_erractionrestore(err_act)
|
|
|
|
if (err_act == psb_act_ret_) then
|
|
return
|
|
else
|
|
call psb_error()
|
|
end if
|
|
return
|
|
End Subroutine psb_reallocate2i1c
|
|
|
|
Subroutine psb_reallocate2i1z(len,rrax,y,z,info)
|
|
use psb_error_mod
|
|
! ...Subroutine Arguments
|
|
Integer,Intent(in) :: len
|
|
Integer,allocatable, intent(inout) :: rrax(:),y(:)
|
|
complex(psb_dpk_),allocatable, intent(inout) :: z(:)
|
|
integer :: info
|
|
character(len=20) :: name
|
|
integer :: err_act, err
|
|
|
|
name='psb_reallocate2i1z'
|
|
call psb_erractionsave(err_act)
|
|
|
|
info=psb_success_
|
|
call psb_realloc(len,rrax,info)
|
|
if (info /= psb_success_) then
|
|
err=4000
|
|
call psb_errpush(err,name)
|
|
goto 9999
|
|
end if
|
|
call psb_realloc(len,y,info)
|
|
if (info /= psb_success_) then
|
|
err=4000
|
|
call psb_errpush(err,name)
|
|
goto 9999
|
|
end if
|
|
call psb_realloc(len,z,info)
|
|
if (info /= psb_success_) then
|
|
err=4000
|
|
call psb_errpush(err,name)
|
|
goto 9999
|
|
end if
|
|
call psb_erractionrestore(err_act)
|
|
return
|
|
|
|
9999 continue
|
|
call psb_erractionrestore(err_act)
|
|
|
|
if (err_act == psb_act_ret_) then
|
|
return
|
|
else
|
|
call psb_error()
|
|
end if
|
|
return
|
|
End Subroutine psb_reallocate2i1z
|
|
|
|
Subroutine psb_smove_alloc1d(vin,vout,info)
|
|
use psb_error_mod
|
|
real(psb_spk_), allocatable, intent(inout) :: vin(:),vout(:)
|
|
integer, intent(out) :: info
|
|
!
|
|
!
|
|
info=psb_success_
|
|
#ifdef HAVE_MOVE_ALLOC
|
|
|
|
call move_alloc(vin,vout)
|
|
|
|
#else
|
|
if (allocated(vout)) then
|
|
deallocate(vout,stat=info)
|
|
end if
|
|
if (.not.allocated(vin) ) return
|
|
allocate(vout(lbound(vin,1):ubound(vin,1)),stat=info)
|
|
if (info /= psb_success_) return
|
|
vout = vin
|
|
deallocate(vin,stat=info)
|
|
#endif
|
|
end Subroutine psb_smove_alloc1d
|
|
|
|
Subroutine psb_smove_alloc2d(vin,vout,info)
|
|
use psb_error_mod
|
|
real(psb_spk_), allocatable, intent(inout) :: vin(:,:),vout(:,:)
|
|
integer, intent(out) :: info
|
|
!
|
|
!
|
|
info=psb_success_
|
|
#ifdef HAVE_MOVE_ALLOC
|
|
|
|
call move_alloc(vin,vout)
|
|
|
|
#else
|
|
if (allocated(vout)) then
|
|
deallocate(vout,stat=info)
|
|
end if
|
|
if (.not.allocated(vin) ) return
|
|
|
|
allocate(vout(lbound(vin,1):ubound(vin,1),&
|
|
& lbound(vin,2):ubound(vin,2)),stat=info)
|
|
if (info /= psb_success_) return
|
|
vout = vin
|
|
deallocate(vin,stat=info)
|
|
#endif
|
|
end Subroutine psb_smove_alloc2d
|
|
|
|
Subroutine psb_dmove_alloc1d(vin,vout,info)
|
|
use psb_error_mod
|
|
real(psb_dpk_), allocatable, intent(inout) :: vin(:),vout(:)
|
|
integer, intent(out) :: info
|
|
!
|
|
!
|
|
info=psb_success_
|
|
#ifdef HAVE_MOVE_ALLOC
|
|
|
|
call move_alloc(vin,vout)
|
|
|
|
#else
|
|
if (allocated(vout)) then
|
|
deallocate(vout,stat=info)
|
|
end if
|
|
if (.not.allocated(vin) ) return
|
|
allocate(vout(lbound(vin,1):ubound(vin,1)),stat=info)
|
|
if (info /= psb_success_) return
|
|
vout = vin
|
|
deallocate(vin,stat=info)
|
|
#endif
|
|
end Subroutine psb_dmove_alloc1d
|
|
|
|
Subroutine psb_dmove_alloc2d(vin,vout,info)
|
|
use psb_error_mod
|
|
real(psb_dpk_), allocatable, intent(inout) :: vin(:,:),vout(:,:)
|
|
integer, intent(out) :: info
|
|
!
|
|
!
|
|
info=psb_success_
|
|
#ifdef HAVE_MOVE_ALLOC
|
|
|
|
call move_alloc(vin,vout)
|
|
|
|
#else
|
|
if (allocated(vout)) then
|
|
deallocate(vout,stat=info)
|
|
end if
|
|
if (.not.allocated(vin) ) return
|
|
|
|
allocate(vout(lbound(vin,1):ubound(vin,1),&
|
|
& lbound(vin,2):ubound(vin,2)),stat=info)
|
|
if (info /= psb_success_) return
|
|
vout = vin
|
|
deallocate(vin,stat=info)
|
|
#endif
|
|
end Subroutine psb_dmove_alloc2d
|
|
|
|
Subroutine psb_cmove_alloc1d(vin,vout,info)
|
|
use psb_error_mod
|
|
complex(psb_spk_), allocatable, intent(inout) :: vin(:),vout(:)
|
|
integer, intent(out) :: info
|
|
!
|
|
!
|
|
info=psb_success_
|
|
#ifdef HAVE_MOVE_ALLOC
|
|
|
|
call move_alloc(vin,vout)
|
|
|
|
#else
|
|
if (allocated(vout)) then
|
|
deallocate(vout,stat=info)
|
|
end if
|
|
if (.not.allocated(vin) ) return
|
|
allocate(vout(lbound(vin,1):ubound(vin,1)),stat=info)
|
|
if (info /= psb_success_) return
|
|
vout = vin
|
|
deallocate(vin,stat=info)
|
|
#endif
|
|
end Subroutine psb_cmove_alloc1d
|
|
|
|
Subroutine psb_cmove_alloc2d(vin,vout,info)
|
|
use psb_error_mod
|
|
complex(psb_spk_), allocatable, intent(inout) :: vin(:,:),vout(:,:)
|
|
integer, intent(out) :: info
|
|
!
|
|
!
|
|
info=psb_success_
|
|
#ifdef HAVE_MOVE_ALLOC
|
|
|
|
call move_alloc(vin,vout)
|
|
|
|
#else
|
|
if (allocated(vout)) then
|
|
deallocate(vout,stat=info)
|
|
end if
|
|
if (.not.allocated(vin) ) return
|
|
|
|
allocate(vout(lbound(vin,1):ubound(vin,1),&
|
|
& lbound(vin,2):ubound(vin,2)),stat=info)
|
|
if (info /= psb_success_) return
|
|
vout = vin
|
|
deallocate(vin,stat=info)
|
|
#endif
|
|
end Subroutine psb_cmove_alloc2d
|
|
|
|
Subroutine psb_zmove_alloc1d(vin,vout,info)
|
|
use psb_error_mod
|
|
complex(psb_dpk_), allocatable, intent(inout) :: vin(:),vout(:)
|
|
integer, intent(out) :: info
|
|
!
|
|
!
|
|
info=psb_success_
|
|
#ifdef HAVE_MOVE_ALLOC
|
|
|
|
call move_alloc(vin,vout)
|
|
|
|
#else
|
|
if (allocated(vout)) then
|
|
deallocate(vout,stat=info)
|
|
end if
|
|
if (.not.allocated(vin) ) return
|
|
allocate(vout(lbound(vin,1):ubound(vin,1)),stat=info)
|
|
if (info /= psb_success_) return
|
|
vout = vin
|
|
deallocate(vin,stat=info)
|
|
#endif
|
|
end Subroutine psb_zmove_alloc1d
|
|
|
|
Subroutine psb_zmove_alloc2d(vin,vout,info)
|
|
use psb_error_mod
|
|
complex(psb_dpk_), allocatable, intent(inout) :: vin(:,:),vout(:,:)
|
|
integer, intent(out) :: info
|
|
!
|
|
!
|
|
info=psb_success_
|
|
#ifdef HAVE_MOVE_ALLOC
|
|
|
|
call move_alloc(vin,vout)
|
|
|
|
#else
|
|
if (allocated(vout)) then
|
|
deallocate(vout,stat=info)
|
|
end if
|
|
if (.not.allocated(vin) ) return
|
|
|
|
allocate(vout(lbound(vin,1):ubound(vin,1),&
|
|
& lbound(vin,2):ubound(vin,2)),stat=info)
|
|
if (info /= psb_success_) return
|
|
vout = vin
|
|
deallocate(vin,stat=info)
|
|
#endif
|
|
end Subroutine psb_zmove_alloc2d
|
|
|
|
Subroutine psb_imove_alloc1d(vin,vout,info)
|
|
use psb_error_mod
|
|
integer, allocatable, intent(inout) :: vin(:),vout(:)
|
|
integer, intent(out) :: info
|
|
!
|
|
!
|
|
info=psb_success_
|
|
#ifdef HAVE_MOVE_ALLOC
|
|
|
|
call move_alloc(vin,vout)
|
|
|
|
#else
|
|
if (allocated(vout)) then
|
|
deallocate(vout,stat=info)
|
|
end if
|
|
if (.not.allocated(vin) ) return
|
|
allocate(vout(lbound(vin,1):ubound(vin,1)),stat=info)
|
|
if (info /= psb_success_) return
|
|
vout = vin
|
|
deallocate(vin,stat=info)
|
|
#endif
|
|
end Subroutine psb_imove_alloc1d
|
|
|
|
Subroutine psb_imove_alloc2d(vin,vout,info)
|
|
use psb_error_mod
|
|
integer, allocatable, intent(inout) :: vin(:,:),vout(:,:)
|
|
integer, intent(out) :: info
|
|
!
|
|
!
|
|
info=psb_success_
|
|
#ifdef HAVE_MOVE_ALLOC
|
|
|
|
call move_alloc(vin,vout)
|
|
|
|
#else
|
|
if (allocated(vout)) then
|
|
deallocate(vout,stat=info)
|
|
end if
|
|
if (.not.allocated(vin) ) return
|
|
|
|
allocate(vout(lbound(vin,1):ubound(vin,1),&
|
|
& lbound(vin,2):ubound(vin,2)),stat=info)
|
|
if (info /= psb_success_) return
|
|
vout = vin
|
|
deallocate(vin,stat=info)
|
|
#endif
|
|
end Subroutine psb_imove_alloc2d
|
|
|
|
#if !defined(LONG_INTEGERS)
|
|
Subroutine psb_i8move_alloc1d(vin,vout,info)
|
|
use psb_error_mod
|
|
integer(psb_long_int_k_), allocatable, intent(inout) :: vin(:),vout(:)
|
|
integer, intent(out) :: info
|
|
!
|
|
!
|
|
info=psb_success_
|
|
#ifdef HAVE_MOVE_ALLOC
|
|
|
|
call move_alloc(vin,vout)
|
|
|
|
#else
|
|
if (allocated(vout)) then
|
|
deallocate(vout,stat=info)
|
|
end if
|
|
if (.not.allocated(vin) ) return
|
|
allocate(vout(lbound(vin,1):ubound(vin,1)),stat=info)
|
|
if (info /= psb_success_) return
|
|
vout = vin
|
|
deallocate(vin,stat=info)
|
|
#endif
|
|
end Subroutine psb_i8move_alloc1d
|
|
|
|
Subroutine psb_i8move_alloc2d(vin,vout,info)
|
|
use psb_error_mod
|
|
integer(psb_long_int_k_), allocatable, intent(inout) :: vin(:,:),vout(:,:)
|
|
integer, intent(out) :: info
|
|
!
|
|
!
|
|
info=psb_success_
|
|
#ifdef HAVE_MOVE_ALLOC
|
|
|
|
call move_alloc(vin,vout)
|
|
|
|
#else
|
|
if (allocated(vout)) then
|
|
deallocate(vout,stat=info)
|
|
end if
|
|
if (.not.allocated(vin) ) return
|
|
|
|
allocate(vout(lbound(vin,1):ubound(vin,1),&
|
|
& lbound(vin,2):ubound(vin,2)),stat=info)
|
|
if (info /= psb_success_) return
|
|
vout = vin
|
|
deallocate(vin,stat=info)
|
|
#endif
|
|
end Subroutine psb_i8move_alloc2d
|
|
#endif
|
|
end module psb_realloc_mod
|