From 492b059e85c0043eec00bad0e8b0dc5e7c3fa789 Mon Sep 17 00:00:00 2001 From: Salvatore Filippone Date: Thu, 26 Sep 2013 14:08:33 +0000 Subject: [PATCH] psblas-3.99: base/serial/impl/psb_c_coo_impl.f90 base/serial/impl/psb_d_coo_impl.f90 base/serial/impl/psb_s_coo_impl.f90 base/serial/impl/psb_z_coo_impl.f90 Optimizations of inner_coo_ins. --- base/serial/impl/psb_c_coo_impl.f90 | 14 +++++--------- base/serial/impl/psb_d_coo_impl.f90 | 14 +++++--------- base/serial/impl/psb_s_coo_impl.f90 | 14 +++++--------- base/serial/impl/psb_z_coo_impl.f90 | 14 +++++--------- 4 files changed, 20 insertions(+), 36 deletions(-) diff --git a/base/serial/impl/psb_c_coo_impl.f90 b/base/serial/impl/psb_c_coo_impl.f90 index c85b6aa4..6d757d01 100644 --- a/base/serial/impl/psb_c_coo_impl.f90 +++ b/base/serial/impl/psb_c_coo_impl.f90 @@ -2630,8 +2630,12 @@ subroutine psb_c_coo_csput(nz,ia,ja,val,a,imin,imax,jmin,jmax,info,gtl) ! Build phase. Must handle reallocations in a sensible way. if (isza < (nza+nz)) then call a%reallocate(max(nza+nz,int(1.5*isza))) - isza = a%get_size() endif + isza = a%get_size() + if (isza < (nza+nz)) then + info = psb_err_alloc_dealloc_; call psb_errpush(info,name) + goto 9999 + end if call psb_inner_ins(nz,ia,ja,val,nza,a%ia,a%ja,a%val,isza,& & imin,imax,jmin,jmax,info,gtl) @@ -2696,10 +2700,6 @@ contains ic = gtl(ic) if ((ir >=imin).and.(ir<=imax).and.(ic>=jmin).and.(ic<=jmax)) then nza = nza + 1 - if (nza > maxsz) then - info = -91 - return - endif ia1(nza) = ir ia2(nza) = ic aspk(nza) = val(i) @@ -2713,10 +2713,6 @@ contains ic = ja(i) if ((ir >=imin).and.(ir<=imax).and.(ic>=jmin).and.(ic<=jmax)) then nza = nza + 1 - if (nza > maxsz) then - info = -92 - return - endif ia1(nza) = ir ia2(nza) = ic aspk(nza) = val(i) diff --git a/base/serial/impl/psb_d_coo_impl.f90 b/base/serial/impl/psb_d_coo_impl.f90 index 9c92e587..819c6c95 100644 --- a/base/serial/impl/psb_d_coo_impl.f90 +++ b/base/serial/impl/psb_d_coo_impl.f90 @@ -2630,8 +2630,12 @@ subroutine psb_d_coo_csput(nz,ia,ja,val,a,imin,imax,jmin,jmax,info,gtl) ! Build phase. Must handle reallocations in a sensible way. if (isza < (nza+nz)) then call a%reallocate(max(nza+nz,int(1.5*isza))) - isza = a%get_size() endif + isza = a%get_size() + if (isza < (nza+nz)) then + info = psb_err_alloc_dealloc_; call psb_errpush(info,name) + goto 9999 + end if call psb_inner_ins(nz,ia,ja,val,nza,a%ia,a%ja,a%val,isza,& & imin,imax,jmin,jmax,info,gtl) @@ -2696,10 +2700,6 @@ contains ic = gtl(ic) if ((ir >=imin).and.(ir<=imax).and.(ic>=jmin).and.(ic<=jmax)) then nza = nza + 1 - if (nza > maxsz) then - info = -91 - return - endif ia1(nza) = ir ia2(nza) = ic aspk(nza) = val(i) @@ -2713,10 +2713,6 @@ contains ic = ja(i) if ((ir >=imin).and.(ir<=imax).and.(ic>=jmin).and.(ic<=jmax)) then nza = nza + 1 - if (nza > maxsz) then - info = -92 - return - endif ia1(nza) = ir ia2(nza) = ic aspk(nza) = val(i) diff --git a/base/serial/impl/psb_s_coo_impl.f90 b/base/serial/impl/psb_s_coo_impl.f90 index 630892b8..8c84691a 100644 --- a/base/serial/impl/psb_s_coo_impl.f90 +++ b/base/serial/impl/psb_s_coo_impl.f90 @@ -2630,8 +2630,12 @@ subroutine psb_s_coo_csput(nz,ia,ja,val,a,imin,imax,jmin,jmax,info,gtl) ! Build phase. Must handle reallocations in a sensible way. if (isza < (nza+nz)) then call a%reallocate(max(nza+nz,int(1.5*isza))) - isza = a%get_size() endif + isza = a%get_size() + if (isza < (nza+nz)) then + info = psb_err_alloc_dealloc_; call psb_errpush(info,name) + goto 9999 + end if call psb_inner_ins(nz,ia,ja,val,nza,a%ia,a%ja,a%val,isza,& & imin,imax,jmin,jmax,info,gtl) @@ -2696,10 +2700,6 @@ contains ic = gtl(ic) if ((ir >=imin).and.(ir<=imax).and.(ic>=jmin).and.(ic<=jmax)) then nza = nza + 1 - if (nza > maxsz) then - info = -91 - return - endif ia1(nza) = ir ia2(nza) = ic aspk(nza) = val(i) @@ -2713,10 +2713,6 @@ contains ic = ja(i) if ((ir >=imin).and.(ir<=imax).and.(ic>=jmin).and.(ic<=jmax)) then nza = nza + 1 - if (nza > maxsz) then - info = -92 - return - endif ia1(nza) = ir ia2(nza) = ic aspk(nza) = val(i) diff --git a/base/serial/impl/psb_z_coo_impl.f90 b/base/serial/impl/psb_z_coo_impl.f90 index ddd2f78c..c14ade32 100644 --- a/base/serial/impl/psb_z_coo_impl.f90 +++ b/base/serial/impl/psb_z_coo_impl.f90 @@ -2630,8 +2630,12 @@ subroutine psb_z_coo_csput(nz,ia,ja,val,a,imin,imax,jmin,jmax,info,gtl) ! Build phase. Must handle reallocations in a sensible way. if (isza < (nza+nz)) then call a%reallocate(max(nza+nz,int(1.5*isza))) - isza = a%get_size() endif + isza = a%get_size() + if (isza < (nza+nz)) then + info = psb_err_alloc_dealloc_; call psb_errpush(info,name) + goto 9999 + end if call psb_inner_ins(nz,ia,ja,val,nza,a%ia,a%ja,a%val,isza,& & imin,imax,jmin,jmax,info,gtl) @@ -2696,10 +2700,6 @@ contains ic = gtl(ic) if ((ir >=imin).and.(ir<=imax).and.(ic>=jmin).and.(ic<=jmax)) then nza = nza + 1 - if (nza > maxsz) then - info = -91 - return - endif ia1(nza) = ir ia2(nza) = ic aspk(nza) = val(i) @@ -2713,10 +2713,6 @@ contains ic = ja(i) if ((ir >=imin).and.(ir<=imax).and.(ic>=jmin).and.(ic<=jmax)) then nza = nza + 1 - if (nza > maxsz) then - info = -92 - return - endif ia1(nza) = ir ia2(nza) = ic aspk(nza) = val(i)