config/pac.m4
 configure
 docs/pdf/util.tex
 docs/userguide.pdf
 test/fileread/cf_sample.f90
 test/fileread/df_sample.f90
 test/fileread/getp.f90
 test/fileread/runs/cfs.inp
 test/fileread/runs/dfs.inp
 test/fileread/runs/sfs.inp
 test/fileread/runs/zfs.inp
 test/fileread/sf_sample.f90
 test/fileread/zf_sample.f90
 util/Makefile
 util/psb_hbio_mod.f90
 util/psb_mmio_mod.f90
 util/psb_read_mat_mod.f90
 util/psb_util_mod.f90

Fixed I/O for fileread samples.
This commit is contained in:
Salvatore Filippone
2008-07-22 16:51:33 +00:00
parent e8f6804783
commit a25813858e
18 changed files with 17821 additions and 33097 deletions
+1 -2
View File
@@ -6,8 +6,7 @@ LIBDIR=../lib
HERE=.
BASEOBJS= psb_blockpart_mod.o psb_metispart_mod.o \
psb_hbio_mod.o psb_mmio_mod.o psb_mat_dist_mod.o \
psb_read_mat_mod.o
psb_hbio_mod.o psb_mmio_mod.o psb_mat_dist_mod.o
MODOBJ=psb_util_mod.o
OBJS=$(BASEOBJS) $(MODOBJ)
LIBMOD=psb_util_mod$(.mod)
+107 -284
View File
@@ -48,10 +48,11 @@ contains
integer, intent(out) :: iret
integer, optional, intent(in) :: iunit
character(len=*), optional, intent(in) :: filename
real(psb_spk_), optional, allocatable :: b(:), g(:), x(:)
real(psb_spk_), optional, allocatable, intent(out) :: b(:,:), g(:,:), x(:,:)
character(len=72), optional, intent(out) :: mtitle
character :: rhstype*3,type*3,key*8
character(len=72) :: mtitle_
character indfmt*16,ptrfmt*16,rhsfmt*20,valfmt*20
integer :: indcrd, ptrcrd, totcrd,&
& valcrd, rhscrd, nrow, ncol, nnzero, neltvl, nrhs, nrhsix
@@ -81,7 +82,7 @@ contains
endif
endif
read (infile,fmt=fmt10) mtitle,key,totcrd,ptrcrd,indcrd,valcrd,rhscrd,&
read(infile,fmt=fmt10) mtitle_,key,totcrd,ptrcrd,indcrd,valcrd,rhscrd,&
& type,nrow,ncol,nnzero,neltvl,ptrfmt,indfmt,valfmt,rhsfmt
if (rhscrd > 0) read(infile,fmt=fmt11)rhstype,nrhs,nrhsix
@@ -90,6 +91,7 @@ contains
write(0,*) 'Memory allocation failed'
goto 993
end if
if (present(mtitle)) mtitle=mtitle_
a%m = nrow
a%k = ncol
@@ -107,20 +109,20 @@ contains
if (present(b)) then
if ((psb_toupper(rhstype(1:1)) == 'F').and.(rhscrd > 0)) then
call psb_ensure_size(nrow,b,info)
read (infile,fmt=rhsfmt) (b(i),i=1,nrow)
call psb_realloc(nrow,1,b,info)
read (infile,fmt=rhsfmt) (b(i,1),i=1,nrow)
endif
endif
if (present(g)) then
if ((psb_toupper(rhstype(2:2)) == 'G').and.(rhscrd > 0)) then
call psb_ensure_size(nrow,g,info)
read (infile,fmt=rhsfmt) (g(i),i=1,nrow)
call psb_realloc(nrow,1,g,info)
read (infile,fmt=rhsfmt) (g(i,1),i=1,nrow)
endif
endif
if (present(x)) then
if ((psb_toupper(rhstype(3:3)) == 'X').and.(rhscrd > 0)) then
call psb_ensure_size(nrow,x,info)
read (infile,fmt=rhsfmt) (x(i),i=1,nrow)
call psb_realloc(nrow,1,x,info)
read (infile,fmt=rhsfmt) (x(i,1),i=1,nrow)
endif
endif
@@ -133,22 +135,23 @@ contains
read (infile,fmt=indfmt) (a%ia1(i),i=1,nnzero)
if (valcrd > 0) read (infile,fmt=valfmt) (a%aspk(i),i=1,nnzero)
if (present(b)) then
if ((psb_toupper(rhstype(1:1)) == 'F').and.(rhscrd > 0)) then
call psb_ensure_size(nrow,b,info)
read (infile,fmt=rhsfmt) (b(i),i=1,nrow)
call psb_realloc(nrow,1,b,info)
read (infile,fmt=rhsfmt) (b(i,1),i=1,nrow)
endif
endif
if (present(g)) then
if ((psb_toupper(rhstype(2:2)) == 'G').and.(rhscrd > 0)) then
call psb_ensure_size(nrow,g,info)
read (infile,fmt=rhsfmt) (g(i),i=1,nrow)
call psb_realloc(nrow,1,g,info)
read (infile,fmt=rhsfmt) (g(i,1),i=1,nrow)
endif
endif
if (present(x)) then
if ((psb_toupper(rhstype(3:3)) == 'X').and.(rhscrd > 0)) then
call psb_ensure_size(nrow,x,info)
read (infile,fmt=rhsfmt) (x(i),i=1,nrow)
call psb_realloc(nrow,1,x,info)
read (infile,fmt=rhsfmt) (x(i,1),i=1,nrow)
endif
endif
@@ -187,10 +190,10 @@ contains
write(0,*) 'read_matrix: could not open file ',filename,' for input'
return
902 iret=902
write(0,*) 'DHB_READ: Unexpected end of file '
write(0,*) 'HB_READ: Unexpected end of file '
return
993 iret=993
write(0,*) 'DHB_READ: Memory allocation failure'
write(0,*) 'HB_READ: Memory allocation failure'
return
end subroutine shb_read
@@ -329,10 +332,11 @@ contains
integer, intent(out) :: iret
integer, optional, intent(in) :: iunit
character(len=*), optional, intent(in) :: filename
real(psb_dpk_), optional, allocatable :: b(:), g(:), x(:)
real(psb_dpk_), optional, allocatable, intent(out) :: b(:,:), g(:,:), x(:,:)
character(len=72), optional, intent(out) :: mtitle
character :: rhstype*3,type*3,key*8
character(len=72) :: mtitle_
character indfmt*16,ptrfmt*16,rhsfmt*20,valfmt*20
integer :: indcrd, ptrcrd, totcrd,&
& valcrd, rhscrd, nrow, ncol, nnzero, neltvl, nrhs, nrhsix
@@ -362,7 +366,7 @@ contains
endif
endif
read (infile,fmt=fmt10) mtitle,key,totcrd,ptrcrd,indcrd,valcrd,rhscrd,&
read (infile,fmt=fmt10) mtitle_,key,totcrd,ptrcrd,indcrd,valcrd,rhscrd,&
& type,nrow,ncol,nnzero,neltvl,ptrfmt,indfmt,valfmt,rhsfmt
if (rhscrd > 0) read(infile,fmt=fmt11)rhstype,nrhs,nrhsix
@@ -371,7 +375,7 @@ contains
write(0,*) 'Memory allocation failed'
goto 993
end if
if (present(mtitle)) mtitle=mtitle_
a%m = nrow
a%k = ncol
a%fida = 'CSR'
@@ -388,20 +392,20 @@ contains
if (present(b)) then
if ((psb_toupper(rhstype(1:1)) == 'F').and.(rhscrd > 0)) then
call psb_ensure_size(nrow,b,info)
read (infile,fmt=rhsfmt) (b(i),i=1,nrow)
call psb_realloc(nrow,1,b,info)
read (infile,fmt=rhsfmt) (b(i,1),i=1,nrow)
endif
endif
if (present(g)) then
if ((psb_toupper(rhstype(2:2)) == 'G').and.(rhscrd > 0)) then
call psb_ensure_size(nrow,g,info)
read (infile,fmt=rhsfmt) (g(i),i=1,nrow)
call psb_realloc(nrow,1,g,info)
read (infile,fmt=rhsfmt) (g(i,1),i=1,nrow)
endif
endif
if (present(x)) then
if ((psb_toupper(rhstype(3:3)) == 'X').and.(rhscrd > 0)) then
call psb_ensure_size(nrow,x,info)
read (infile,fmt=rhsfmt) (x(i),i=1,nrow)
call psb_realloc(nrow,1,x,info)
read (infile,fmt=rhsfmt) (x(i,1),i=1,nrow)
endif
endif
@@ -417,24 +421,23 @@ contains
if (present(b)) then
if ((psb_toupper(rhstype(1:1)) == 'F').and.(rhscrd > 0)) then
call psb_ensure_size(nrow,b,info)
read (infile,fmt=rhsfmt) (b(i),i=1,nrow)
call psb_realloc(nrow,1,b,info)
read (infile,fmt=rhsfmt) (b(i,1),i=1,nrow)
endif
endif
if (present(g)) then
if ((psb_toupper(rhstype(2:2)) == 'G').and.(rhscrd > 0)) then
call psb_ensure_size(nrow,g,info)
read (infile,fmt=rhsfmt) (g(i),i=1,nrow)
call psb_realloc(nrow,1,g,info)
read (infile,fmt=rhsfmt) (g(i,1),i=1,nrow)
endif
endif
if (present(x)) then
if ((psb_toupper(rhstype(3:3)) == 'X').and.(rhscrd > 0)) then
call psb_ensure_size(nrow,x,info)
read (infile,fmt=rhsfmt) (x(i),i=1,nrow)
call psb_realloc(nrow,1,x,info)
read (infile,fmt=rhsfmt) (x(i,1),i=1,nrow)
endif
endif
call psb_spcnv(a,ircode,afmt='csr')
if (ircode /= 0) goto 993
@@ -470,16 +473,13 @@ contains
write(0,*) 'read_matrix: could not open file ',filename,' for input'
return
902 iret=902
write(0,*) 'DHB_READ: Unexpected end of file '
write(0,*) 'HB_READ: Unexpected end of file '
return
993 iret=993
write(0,*) 'DHB_READ: Memory allocation failure'
write(0,*) 'HB_READ: Memory allocation failure'
return
end subroutine dhb_read
subroutine dhb_write(a,iret,iunit,filename,key,rhs,g,x,mtitle)
use psb_base_mod
implicit none
@@ -615,14 +615,15 @@ contains
integer, intent(out) :: iret
integer, optional, intent(in) :: iunit
character(len=*), optional, intent(in) :: filename
complex(psb_spk_), optional, allocatable :: b(:), g(:), x(:)
complex(psb_spk_), optional, allocatable, intent(out) :: b(:,:), g(:,:), x(:,:)
character(len=72), optional, intent(out) :: mtitle
character :: rhstype*3,type*3,key*8
character(len=72) :: mtitle_
character indfmt*16,ptrfmt*16,rhsfmt*20,valfmt*20
integer :: indcrd, ptrcrd, totcrd,&
& valcrd, rhscrd, nrow, ncol, nnzero, neltvl, nrhs, nrhsix
integer :: ircode, i,nzr,infile,info
integer :: ircode, i,nzr,infile, info
character(len=*), parameter :: fmt10='(a72,a8,/,5i14,/,a3,11x,4i14,/,2a16,2a20)'
character(len=*), parameter :: fmt11='(a3,11x,2i14)'
character(len=*), parameter :: fmt111='(1x,a8,1x,i8,1x,a10)'
@@ -648,25 +649,26 @@ contains
endif
endif
read (infile,fmt=fmt10) mtitle,key,totcrd,ptrcrd,indcrd,valcrd,rhscrd,&
read (infile,fmt=fmt10) mtitle_,key,totcrd,ptrcrd,indcrd,valcrd,rhscrd,&
& type,nrow,ncol,nnzero,neltvl,ptrfmt,indfmt,valfmt,rhsfmt
if (rhscrd > 0) read(infile,fmt=fmt11)rhstype,nrhs,nrhsix
call psb_sp_all(a,nnzero,nrow+1,nnzero,ircode)
if (ircode /= 0 ) then
write(0,*) 'Memory allocation failed'
goto 993
end if
if (present(mtitle)) mtitle=mtitle_
if (psb_tolower(type(1:1)) == 'c') then
a%m = nrow
a%k = ncol
a%fida = 'CSR'
a%descra='G'
if (psb_tolower(type(1:1)) == 'r') then
if (psb_tolower(type(2:2)) == 'u') then
call psb_sp_all(a,nnzero,nrow+1,nnzero,ircode)
if (ircode /= 0 ) then
write(0,*) 'Memory allocation failed'
goto 993
end if
a%m = nrow
a%k = ncol
a%fida = 'CSR'
a%descra='G'
read (infile,fmt=ptrfmt) (a%ia2(i),i=1,nrow+1)
read (infile,fmt=indfmt) (a%ia1(i),i=1,nnzero)
@@ -674,20 +676,20 @@ contains
if (present(b)) then
if ((psb_toupper(rhstype(1:1)) == 'F').and.(rhscrd > 0)) then
call psb_ensure_size(nrow,b,info)
read (infile,fmt=rhsfmt) (b(i),i=1,nrow)
call psb_realloc(nrow,1,b,info)
read (infile,fmt=rhsfmt) (b(i,1),i=1,nrow)
endif
endif
if (present(g)) then
if ((psb_toupper(rhstype(2:2)) == 'G').and.(rhscrd > 0)) then
call psb_ensure_size(nrow,g,info)
read (infile,fmt=rhsfmt) (g(i),i=1,nrow)
call psb_realloc(nrow,1,g,info)
read (infile,fmt=rhsfmt) (g(i,1),i=1,nrow)
endif
endif
if (present(x)) then
if ((psb_toupper(rhstype(3:3)) == 'X').and.(rhscrd > 0)) then
call psb_ensure_size(nrow,x,info)
read (infile,fmt=rhsfmt) (x(i),i=1,nrow)
call psb_realloc(nrow,1,x,info)
read (infile,fmt=rhsfmt) (x(i,1),i=1,nrow)
endif
endif
@@ -695,53 +697,35 @@ contains
! we are generally working with non-symmetric matrices, so
! we de-symmetrize what we are about to read
call psb_sp_all(nrow,ncol,a,nnzero,ircode)
if (ircode /= 0 ) then
write(0,*) 'Memory allocation failed'
goto 993
end if
a%fida = 'CSR'
a%descra='G'
read (infile,fmt=ptrfmt) (a%ia2(i),i=1,nrow+1)
read (infile,fmt=indfmt) (a%ia1(i),i=1,nnzero)
if (valcrd > 0) read (infile,fmt=valfmt) (a%aspk(i),i=1,nnzero)
if (present(b)) then
if ((psb_toupper(rhstype(1:1)) == 'F').and.(rhscrd > 0)) then
call psb_ensure_size(nrow,b,info)
read (infile,fmt=rhsfmt) (b(i),i=1,nrow)
call psb_realloc(nrow,1,b,info)
read (infile,fmt=rhsfmt) (b(i,1),i=1,nrow)
endif
endif
if (present(g)) then
if ((psb_toupper(rhstype(2:2)) == 'G').and.(rhscrd > 0)) then
call psb_ensure_size(nrow,g,info)
read (infile,fmt=rhsfmt) (g(i),i=1,nrow)
call psb_realloc(nrow,1,g,info)
read (infile,fmt=rhsfmt) (g(i,1),i=1,nrow)
endif
endif
if (present(x)) then
if ((psb_toupper(rhstype(3:3)) == 'X').and.(rhscrd > 0)) then
call psb_ensure_size(nrow,x,info)
read (infile,fmt=rhsfmt) (x(i),i=1,nrow)
call psb_realloc(nrow,1,x,info)
read (infile,fmt=rhsfmt) (x(i,1),i=1,nrow)
endif
endif
call psb_spcnv(a,ircode,afmt='coo')
if (ircode /= 0) then
write(0,*) 'ipcsr2coo ',ircode
goto 993
end if
call psb_spcnv(a,ircode,afmt='csr')
if (ircode /= 0) goto 993
call psb_sp_reall(a,2*nnzero,ircode)
if (ircode /= 0 ) then
write(0,*) 'Memory allocation failed'
goto 993
end if
! A is now in COO format
nzr = nnzero
do i=1,nnzero
@@ -754,78 +738,7 @@ contains
end do
a%infoa(psb_nnz_) = nzr
call psb_spcnv(a,ircode,afmt='csr')
if (ircode /= 0) then
write(0,*) 'ipcoo2csr ',ircode
goto 993
end if
else if (psb_tolower(type(2:2)) == 'h') then
! we are generally working with non-symmetric matrices, so
! we de-symmetrize what we are about to read
call psb_sp_all(nrow,ncol,a,2*nnzero,ircode)
if (ircode /= 0 ) then
write(0,*) 'Memory allocation failed'
goto 993
end if
a%fida = 'CSR'
a%descra='G'
read (infile,fmt=ptrfmt) (a%ia2(i),i=1,nrow+1)
read (infile,fmt=indfmt) (a%ia1(i),i=1,nnzero)
if (valcrd > 0) read (infile,fmt=valfmt) (a%aspk(i),i=1,nnzero)
if (present(b)) then
if ((psb_toupper(rhstype(1:1)) == 'F').and.(rhscrd > 0)) then
call psb_ensure_size(nrow,b,info)
read (infile,fmt=rhsfmt) (b(i),i=1,nrow)
endif
endif
if (present(g)) then
if ((psb_toupper(rhstype(2:2)) == 'G').and.(rhscrd > 0)) then
call psb_ensure_size(nrow,g,info)
read (infile,fmt=rhsfmt) (g(i),i=1,nrow)
endif
endif
if (present(x)) then
if ((psb_toupper(rhstype(3:3)) == 'X').and.(rhscrd > 0)) then
call psb_ensure_size(nrow,x,info)
read (infile,fmt=rhsfmt) (x(i),i=1,nrow)
endif
endif
call psb_spcnv(a,ircode,afmt='coo')
if (ircode /= 0) then
write(0,*) 'ipcsr2coo ',ircode
goto 993
end if
call psb_sp_reall(a,2*nnzero,ircode)
if (ircode /= 0 ) then
write(0,*) 'Memory allocation failed'
goto 993
end if
! A is now in COO format
nzr = nnzero
do i=1,nnzero
if (a%ia1(i) /= a%ia2(i)) then
nzr = nzr + 1
a%aspk(nzr) = conjg(a%aspk(i))
a%ia1(nzr) = a%ia2(i)
a%ia2(nzr) = a%ia1(i)
end if
end do
a%infoa(psb_nnz_) = nzr
call psb_spcnv(a,ircode,afmt='csr')
if (ircode /= 0) then
write(0,*) 'ipcoo2csr ',ircode
goto 993
end if
if (ircode /= 0) goto 993
else
write(0,*) 'read_matrix: matrix type not yet supported'
@@ -844,16 +757,14 @@ contains
write(0,*) 'read_matrix: could not open file ',filename,' for input'
return
902 iret=902
write(0,*) 'ZHB_READ: Unexpected end of file '
write(0,*) 'HB_READ: Unexpected end of file '
return
993 iret=993
write(0,*) 'ZHB_READ: Memory allocation failure'
write(0,*) 'HB_READ: Memory allocation failure'
return
end subroutine chb_read
subroutine chb_write(a,iret,iunit,filename,key,rhs,g,x,mtitle)
use psb_base_mod
implicit none
@@ -985,14 +896,15 @@ contains
integer, intent(out) :: iret
integer, optional, intent(in) :: iunit
character(len=*), optional, intent(in) :: filename
complex(psb_dpk_), optional, allocatable :: b(:), g(:), x(:)
complex(psb_dpk_), optional, allocatable, intent(out) :: b(:,:), g(:,:), x(:,:)
character(len=72), optional, intent(out) :: mtitle
character :: rhstype*3,type*3,key*8
character(len=72) :: mtitle_
character indfmt*16,ptrfmt*16,rhsfmt*20,valfmt*20
integer :: indcrd, ptrcrd, totcrd,&
& valcrd, rhscrd, nrow, ncol, nnzero, neltvl, nrhs, nrhsix
integer :: ircode, i,nzr,infile,info
integer :: ircode, i,nzr,infile, info
character(len=*), parameter :: fmt10='(a72,a8,/,5i14,/,a3,11x,4i14,/,2a16,2a20)'
character(len=*), parameter :: fmt11='(a3,11x,2i14)'
character(len=*), parameter :: fmt111='(1x,a8,1x,i8,1x,a10)'
@@ -1018,25 +930,26 @@ contains
endif
endif
read (infile,fmt=fmt10) mtitle,key,totcrd,ptrcrd,indcrd,valcrd,rhscrd,&
read (infile,fmt=fmt10) mtitle_,key,totcrd,ptrcrd,indcrd,valcrd,rhscrd,&
& type,nrow,ncol,nnzero,neltvl,ptrfmt,indfmt,valfmt,rhsfmt
if (rhscrd > 0) read(infile,fmt=fmt11)rhstype,nrhs,nrhsix
call psb_sp_all(a,nnzero,nrow+1,nnzero,ircode)
if (ircode /= 0 ) then
write(0,*) 'Memory allocation failed'
goto 993
end if
if (present(mtitle)) mtitle=mtitle_
if (psb_tolower(type(1:1)) == 'c') then
a%m = nrow
a%k = ncol
a%fida = 'CSR'
a%descra='G'
if (psb_tolower(type(1:1)) == 'r') then
if (psb_tolower(type(2:2)) == 'u') then
call psb_sp_all(a,nnzero,nrow+1,nnzero,ircode)
if (ircode /= 0 ) then
write(0,*) 'Memory allocation failed'
goto 993
end if
a%m = nrow
a%k = ncol
a%fida = 'CSR'
a%descra='G'
read (infile,fmt=ptrfmt) (a%ia2(i),i=1,nrow+1)
read (infile,fmt=indfmt) (a%ia1(i),i=1,nnzero)
@@ -1044,20 +957,20 @@ contains
if (present(b)) then
if ((psb_toupper(rhstype(1:1)) == 'F').and.(rhscrd > 0)) then
call psb_ensure_size(nrow,b,info)
read (infile,fmt=rhsfmt) (b(i),i=1,nrow)
call psb_realloc(nrow,1,b,info)
read (infile,fmt=rhsfmt) (b(i,1),i=1,nrow)
endif
endif
if (present(g)) then
if ((psb_toupper(rhstype(2:2)) == 'G').and.(rhscrd > 0)) then
call psb_ensure_size(nrow,g,info)
read (infile,fmt=rhsfmt) (g(i),i=1,nrow)
call psb_realloc(nrow,1,g,info)
read (infile,fmt=rhsfmt) (g(i,1),i=1,nrow)
endif
endif
if (present(x)) then
if ((psb_toupper(rhstype(3:3)) == 'X').and.(rhscrd > 0)) then
call psb_ensure_size(nrow,x,info)
read (infile,fmt=rhsfmt) (x(i),i=1,nrow)
call psb_realloc(nrow,1,x,info)
read (infile,fmt=rhsfmt) (x(i,1),i=1,nrow)
endif
endif
@@ -1065,53 +978,35 @@ contains
! we are generally working with non-symmetric matrices, so
! we de-symmetrize what we are about to read
call psb_sp_all(nrow,ncol,a,nnzero,ircode)
if (ircode /= 0 ) then
write(0,*) 'Memory allocation failed'
goto 993
end if
a%fida = 'CSR'
a%descra='G'
read (infile,fmt=ptrfmt) (a%ia2(i),i=1,nrow+1)
read (infile,fmt=indfmt) (a%ia1(i),i=1,nnzero)
if (valcrd > 0) read (infile,fmt=valfmt) (a%aspk(i),i=1,nnzero)
if (present(b)) then
if ((psb_toupper(rhstype(1:1)) == 'F').and.(rhscrd > 0)) then
call psb_ensure_size(nrow,b,info)
read (infile,fmt=rhsfmt) (b(i),i=1,nrow)
call psb_realloc(nrow,1,b,info)
read (infile,fmt=rhsfmt) (b(i,1),i=1,nrow)
endif
endif
if (present(g)) then
if ((psb_toupper(rhstype(2:2)) == 'G').and.(rhscrd > 0)) then
call psb_ensure_size(nrow,g,info)
read (infile,fmt=rhsfmt) (g(i),i=1,nrow)
call psb_realloc(nrow,1,g,info)
read (infile,fmt=rhsfmt) (g(i,1),i=1,nrow)
endif
endif
if (present(x)) then
if ((psb_toupper(rhstype(3:3)) == 'X').and.(rhscrd > 0)) then
call psb_ensure_size(nrow,x,info)
read (infile,fmt=rhsfmt) (x(i),i=1,nrow)
call psb_realloc(nrow,1,x,info)
read (infile,fmt=rhsfmt) (x(i,1),i=1,nrow)
endif
endif
call psb_spcnv(a,ircode,afmt='coo')
if (ircode /= 0) then
write(0,*) 'ipcsr2coo ',ircode
goto 993
end if
call psb_spcnv(a,ircode,afmt='csr')
if (ircode /= 0) goto 993
call psb_sp_reall(a,2*nnzero,ircode)
if (ircode /= 0 ) then
write(0,*) 'Memory allocation failed'
goto 993
end if
! A is now in COO format
nzr = nnzero
do i=1,nnzero
@@ -1124,77 +1019,7 @@ contains
end do
a%infoa(psb_nnz_) = nzr
call psb_spcnv(a,ircode,afmt='csr')
if (ircode /= 0) then
write(0,*) 'ipcoo2csr ',ircode
goto 993
end if
else if (psb_tolower(type(2:2)) == 'h') then
! we are generally working with non-symmetric matrices, so
! we de-symmetrize what we are about to read
call psb_sp_all(nrow,ncol,a,2*nnzero,ircode)
if (ircode /= 0 ) then
write(0,*) 'Memory allocation failed'
goto 993
end if
a%fida = 'CSR'
a%descra='G'
read (infile,fmt=ptrfmt) (a%ia2(i),i=1,nrow+1)
read (infile,fmt=indfmt) (a%ia1(i),i=1,nnzero)
if (valcrd > 0) read (infile,fmt=valfmt) (a%aspk(i),i=1,nnzero)
if (present(b)) then
if ((psb_toupper(rhstype(1:1)) == 'F').and.(rhscrd > 0)) then
call psb_ensure_size(nrow,b,info)
read (infile,fmt=rhsfmt) (b(i),i=1,nrow)
endif
endif
if (present(g)) then
if ((psb_toupper(rhstype(2:2)) == 'G').and.(rhscrd > 0)) then
call psb_ensure_size(nrow,g,info)
read (infile,fmt=rhsfmt) (g(i),i=1,nrow)
endif
endif
if (present(x)) then
if ((psb_toupper(rhstype(3:3)) == 'X').and.(rhscrd > 0)) then
call psb_ensure_size(nrow,x,info)
read (infile,fmt=rhsfmt) (x(i),i=1,nrow)
endif
endif
call psb_spcnv(a,ircode,afmt='coo')
if (ircode /= 0) then
write(0,*) 'ipcsr2coo ',ircode
goto 993
end if
call psb_sp_reall(a,2*nnzero,ircode)
if (ircode /= 0 ) then
write(0,*) 'Memory allocation failed'
goto 993
end if
! A is now in COO format
nzr = nnzero
do i=1,nnzero
if (a%ia1(i) /= a%ia2(i)) then
nzr = nzr + 1
a%aspk(nzr) = conjg(a%aspk(i))
a%ia1(nzr) = a%ia2(i)
a%ia2(nzr) = a%ia1(i)
end if
end do
a%infoa(psb_nnz_) = nzr
call psb_spcnv(a,ircode,afmt='csr')
if (ircode /= 0) then
write(0,*) 'ipcoo2csr ',ircode
goto 993
end if
if (ircode /= 0) goto 993
else
write(0,*) 'read_matrix: matrix type not yet supported'
@@ -1213,16 +1038,14 @@ contains
write(0,*) 'read_matrix: could not open file ',filename,' for input'
return
902 iret=902
write(0,*) 'ZHB_READ: Unexpected end of file '
write(0,*) 'HB_READ: Unexpected end of file '
return
993 iret=993
write(0,*) 'ZHB_READ: Memory allocation failure'
write(0,*) 'HB_READ: Memory allocation failure'
return
end subroutine zhb_read
subroutine zhb_write(a,iret,iunit,filename,key,rhs,g,x,mtitle)
use psb_base_mod
implicit none
+149 -72
View File
@@ -44,19 +44,37 @@ module psb_mmio_mod
contains
subroutine mm_svet_read(filename, b, info)
subroutine mm_svet_read(b, info, iunit, filename)
use psb_base_mod
implicit none
character :: filename*(*)
real(psb_spk_), allocatable, intent(out) :: b(:,:)
integer, intent(out) :: info
integer, parameter :: infile = 2
integer :: nrow, ncol, i,root, np, me, ircode, j
integer, intent(out) :: info
integer, optional, intent(in) :: iunit
character(len=*), optional, intent(in) :: filename
integer :: nrow, ncol, i,root, np, me, ircode, j,infile
character :: mmheader*15, fmt*15, object*10, type*10, sym*15,&
& line*1024
info = 0
open(infile,file=filename, status='old', err=901, action="read")
if (present(filename)) then
if (filename=='-') then
infile=5
else
if (present(iunit)) then
infile=iunit
else
infile=99
endif
open(infile,file=filename, status='OLD', err=901, action='READ')
endif
else
if (present(iunit)) then
infile=iunit
else
infile=5
endif
endif
read(infile,fmt=*, end=902) mmheader, object, fmt, type, sym
if ( (object /= 'matrix').or.(fmt /= 'array')) then
@@ -79,6 +97,8 @@ contains
end if ! read right hand sides
if (infile/=5) close(infile)
return
! open failed
901 write(0,*) 'mm_vet_read: could not open file ',&
@@ -96,19 +116,37 @@ contains
end subroutine mm_svet_read
subroutine mm_dvet_read(filename, b, info)
subroutine mm_dvet_read(b, info, iunit, filename)
use psb_base_mod
implicit none
character :: filename*(*)
real(psb_dpk_), allocatable, intent(out) :: b(:,:)
integer, intent(out) :: info
integer, parameter :: infile = 2
integer :: nrow, ncol, i,root, np, me, ircode, j
integer, intent(out) :: info
integer, optional, intent(in) :: iunit
character(len=*), optional, intent(in) :: filename
integer :: nrow, ncol, i,root, np, me, ircode, j, infile
character :: mmheader*15, fmt*15, object*10, type*10, sym*15,&
& line*1024
info = 0
open(infile,file=filename, status='old', err=901, action="read")
if (present(filename)) then
if (filename=='-') then
infile=5
else
if (present(iunit)) then
infile=iunit
else
infile=99
endif
open(infile,file=filename, status='OLD', err=901, action='READ')
endif
else
if (present(iunit)) then
infile=iunit
else
infile=5
endif
endif
read(infile,fmt=*, end=902) mmheader, object, fmt, type, sym
if ( (object /= 'matrix').or.(fmt /= 'array')) then
@@ -130,6 +168,7 @@ contains
read(infile,fmt=*,end=902) ((b(i,j), i=1,nrow),j=1,ncol)
end if ! read right hand sides
if (infile/=5) close(infile)
return
! open failed
@@ -148,20 +187,38 @@ contains
end subroutine mm_dvet_read
subroutine mm_cvet_read(filename, b, info)
subroutine mm_cvet_read(b, info, iunit, filename)
use psb_base_mod
implicit none
character :: filename*(*)
complex(psb_spk_), allocatable, intent(out) :: b(:,:)
integer, intent(out) :: info
integer, parameter :: infile = 2
integer :: nrow, ncol, i,root, np, me, ircode, j
integer, intent(out) :: info
integer, optional, intent(in) :: iunit
character(len=*), optional, intent(in) :: filename
integer :: nrow, ncol, i,root, np, me, ircode, j,infile
real(psb_spk_) :: bre, bim
character :: mmheader*15, fmt*15, object*10, type*10, sym*15,&
& line*1024
info = 0
open(infile,file=filename, status='old', err=901, action="read")
if (present(filename)) then
if (filename=='-') then
infile=5
else
if (present(iunit)) then
infile=iunit
else
infile=99
endif
open(infile,file=filename, status='OLD', err=901, action='READ')
endif
else
if (present(iunit)) then
infile=iunit
else
infile=5
endif
endif
read(infile,fmt=*, end=902) mmheader, object, fmt, type, sym
if ( (object /= 'matrix').or.(fmt /= 'array')) then
@@ -188,6 +245,7 @@ contains
end do
end if ! read right hand sides
if (infile/=5) close(infile)
return
! open failed
@@ -206,20 +264,38 @@ contains
end subroutine mm_cvet_read
subroutine mm_zvet_read(filename, b, info)
subroutine mm_zvet_read(b, info, iunit, filename)
use psb_base_mod
implicit none
character :: filename*(*)
complex(psb_dpk_), allocatable, intent(out) :: b(:,:)
integer, intent(out) :: info
integer, parameter :: infile = 2
integer :: nrow, ncol, i,root, np, me, ircode, j
integer, intent(out) :: info
integer, optional, intent(in) :: iunit
character(len=*), optional, intent(in) :: filename
integer :: nrow, ncol, i,root, np, me, ircode, j,infile
real(psb_dpk_) :: bre, bim
character :: mmheader*15, fmt*15, object*10, type*10, sym*15,&
& line*1024
info = 0
open(infile,file=filename, status='old', err=901, action="read")
if (present(filename)) then
if (filename=='-') then
infile=5
else
if (present(iunit)) then
infile=iunit
else
infile=99
endif
open(infile,file=filename, status='OLD', err=901, action='READ')
endif
else
if (present(iunit)) then
infile=iunit
else
infile=5
endif
endif
read(infile,fmt=*, end=902) mmheader, object, fmt, type, sym
if ( (object /= 'matrix').or.(fmt /= 'array')) then
@@ -246,6 +322,7 @@ contains
end do
end if ! read right hand sides
if (infile/=5) close(infile)
return
! open failed
@@ -265,11 +342,11 @@ contains
subroutine smm_mat_read(a, iret, iunit, filename)
subroutine smm_mat_read(a, info, iunit, filename)
use psb_base_mod
implicit none
type(psb_sspmat_type), intent(out) :: a
integer, intent(out) :: iret
integer, intent(out) :: info
integer, optional, intent(in) :: iunit
character(len=*), optional, intent(in) :: filename
character :: mmheader*15, fmt*15, object*10, type*10, sym*15
@@ -277,7 +354,7 @@ contains
integer :: nrow, ncol, nnzero
integer :: ircode, i,nzr,infile
iret = 0
info = 0
if (present(filename)) then
if (filename=='-') then
@@ -302,7 +379,7 @@ contains
if ( (psb_tolower(object) /= 'matrix').or.(psb_tolower(fmt)/='coordinate')) then
write(0,*) 'READ_MATRIX: input file type not yet supported'
iret=909
info=909
return
end if
@@ -348,36 +425,36 @@ contains
else
write(0,*) 'read_matrix: matrix type not yet supported'
iret=904
info=904
end if
if (infile/=5) close(infile)
return
! open failed
901 iret=901
901 info=901
write(0,*) 'read_matrix: could not open file ',filename,' for input'
return
902 iret=902
902 info=902
write(0,*) 'READ_MATRIX: Unexpected end of file '
return
993 iret=993
993 info=993
write(0,*) 'READ_MATRIX: Memory allocation failure'
return
end subroutine smm_mat_read
subroutine smm_mat_write(a,mtitle,iret,iunit,filename)
subroutine smm_mat_write(a,mtitle,info,iunit,filename)
use psb_base_mod
implicit none
type(psb_sspmat_type), intent(in) :: a
integer, intent(out) :: iret
integer, intent(out) :: info
character(len=*), intent(in) :: mtitle
integer, optional, intent(in) :: iunit
character(len=*), optional, intent(in) :: filename
integer :: iout
iret = 0
info = 0
if (present(filename)) then
if (filename=='-') then
@@ -406,16 +483,16 @@ contains
return
901 continue
iret=901
info=901
write(0,*) 'Error while opening ',filename
return
end subroutine smm_mat_write
subroutine dmm_mat_read(a, iret, iunit, filename)
subroutine dmm_mat_read(a, info, iunit, filename)
use psb_base_mod
implicit none
type(psb_dspmat_type), intent(out) :: a
integer, intent(out) :: iret
integer, intent(out) :: info
integer, optional, intent(in) :: iunit
character(len=*), optional, intent(in) :: filename
character :: mmheader*15, fmt*15, object*10, type*10, sym*15
@@ -423,7 +500,7 @@ contains
integer :: nrow, ncol, nnzero
integer :: ircode, i,nzr,infile
iret = 0
info = 0
if (present(filename)) then
if (filename=='-') then
@@ -448,7 +525,7 @@ contains
if ( (psb_tolower(object) /= 'matrix').or.(psb_tolower(fmt)/='coordinate')) then
write(0,*) 'READ_MATRIX: input file type not yet supported'
iret=909
info=909
return
end if
@@ -494,36 +571,36 @@ contains
else
write(0,*) 'read_matrix: matrix type not yet supported'
iret=904
info=904
end if
if (infile/=5) close(infile)
return
! open failed
901 iret=901
901 info=901
write(0,*) 'read_matrix: could not open file ',filename,' for input'
return
902 iret=902
902 info=902
write(0,*) 'READ_MATRIX: Unexpected end of file '
return
993 iret=993
993 info=993
write(0,*) 'READ_MATRIX: Memory allocation failure'
return
end subroutine dmm_mat_read
subroutine dmm_mat_write(a,mtitle,iret,iunit,filename)
subroutine dmm_mat_write(a,mtitle,info,iunit,filename)
use psb_base_mod
implicit none
type(psb_dspmat_type), intent(in) :: a
integer, intent(out) :: iret
integer, intent(out) :: info
character(len=*), intent(in) :: mtitle
integer, optional, intent(in) :: iunit
character(len=*), optional, intent(in) :: filename
integer :: iout
iret = 0
info = 0
if (present(filename)) then
if (filename=='-') then
@@ -552,16 +629,16 @@ contains
return
901 continue
iret=901
info=901
write(0,*) 'Error while opening ',filename
return
end subroutine dmm_mat_write
subroutine cmm_mat_read(a, iret, iunit, filename)
subroutine cmm_mat_read(a, info, iunit, filename)
use psb_base_mod
implicit none
type(psb_cspmat_type), intent(out) :: a
integer, intent(out) :: iret
integer, intent(out) :: info
integer, optional, intent(in) :: iunit
character(len=*), optional, intent(in) :: filename
character :: mmheader*15, fmt*15, object*10, type*10, sym*15
@@ -570,7 +647,7 @@ contains
integer :: ircode, i,nzr,infile
real(psb_spk_) :: are, aim
iret = 0
info = 0
if (present(filename)) then
if (filename=='-') then
@@ -595,7 +672,7 @@ contains
if ( (psb_tolower(object) /= 'matrix').or.(psb_tolower(fmt)/='coordinate')) then
write(0,*) 'READ_MATRIX: input file type not yet supported'
iret=909
info=909
return
end if
@@ -668,37 +745,37 @@ contains
else
write(0,*) 'read_matrix: matrix type not yet supported'
iret=904
info=904
end if
if (infile/=5) close(infile)
return
! open failed
901 iret=901
901 info=901
write(0,*) 'read_matrix: could not open file ',filename,' for input'
return
902 iret=902
902 info=902
write(0,*) 'READ_MATRIX: Unexpected end of file '
return
993 iret=993
993 info=993
write(0,*) 'READ_MATRIX: Memory allocation failure'
return
end subroutine cmm_mat_read
subroutine cmm_mat_write(a,mtitle,iret,iunit,filename)
subroutine cmm_mat_write(a,mtitle,info,iunit,filename)
use psb_base_mod
implicit none
type(psb_cspmat_type), intent(in) :: a
integer, intent(out) :: iret
integer, intent(out) :: info
character(len=*), intent(in) :: mtitle
integer, optional, intent(in) :: iunit
character(len=*), optional, intent(in) :: filename
integer :: iout
iret = 0
info = 0
if (present(filename)) then
if (filename=='-') then
@@ -727,16 +804,16 @@ contains
return
901 continue
iret=901
info=901
write(0,*) 'Error while opening ',filename
return
end subroutine cmm_mat_write
subroutine zmm_mat_read(a, iret, iunit, filename)
subroutine zmm_mat_read(a, info, iunit, filename)
use psb_base_mod
implicit none
type(psb_zspmat_type), intent(out) :: a
integer, intent(out) :: iret
integer, intent(out) :: info
integer, optional, intent(in) :: iunit
character(len=*), optional, intent(in) :: filename
character :: mmheader*15, fmt*15, object*10, type*10, sym*15
@@ -745,7 +822,7 @@ contains
integer :: ircode, i,nzr,infile
real(psb_dpk_) :: are, aim
iret = 0
info = 0
if (present(filename)) then
if (filename=='-') then
@@ -770,7 +847,7 @@ contains
if ( (psb_tolower(object) /= 'matrix').or.(psb_tolower(fmt)/='coordinate')) then
write(0,*) 'READ_MATRIX: input file type not yet supported'
iret=909
info=909
return
end if
@@ -843,37 +920,37 @@ contains
else
write(0,*) 'read_matrix: matrix type not yet supported'
iret=904
info=904
end if
if (infile/=5) close(infile)
return
! open failed
901 iret=901
901 info=901
write(0,*) 'read_matrix: could not open file ',filename,' for input'
return
902 iret=902
902 info=902
write(0,*) 'READ_MATRIX: Unexpected end of file '
return
993 iret=993
993 info=993
write(0,*) 'READ_MATRIX: Memory allocation failure'
return
end subroutine zmm_mat_read
subroutine zmm_mat_write(a,mtitle,iret,iunit,filename)
subroutine zmm_mat_write(a,mtitle,info,iunit,filename)
use psb_base_mod
implicit none
type(psb_zspmat_type), intent(in) :: a
integer, intent(out) :: iret
integer, intent(out) :: info
character(len=*), intent(in) :: mtitle
integer, optional, intent(in) :: iunit
character(len=*), optional, intent(in) :: filename
integer :: iout
iret = 0
info = 0
if (present(filename)) then
if (filename=='-') then
@@ -902,7 +979,7 @@ contains
return
901 continue
iret=901
info=901
write(0,*) 'Error while opening ',filename
return
end subroutine zmm_mat_write
-322
View File
@@ -1,322 +0,0 @@
!!$
!!$ Parallel Sparse BLAS version 2.2
!!$ (C) Copyright 2006/2007/2008
!!$ Salvatore Filippone University of Rome Tor Vergata
!!$ Alfredo Buttari University of Rome Tor Vergata
!!$
!!$ Redistribution and use in source and binary forms, with or without
!!$ modification, are permitted provided that the following conditions
!!$ are met:
!!$ 1. Redistributions of source code must retain the above copyright
!!$ notice, this list of conditions and the following disclaimer.
!!$ 2. Redistributions in binary form must reproduce the above copyright
!!$ notice, this list of conditions, and the following disclaimer in the
!!$ documentation and/or other materials provided with the distribution.
!!$ 3. The name of the 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.
!!$
!!$
!
! READ_MAT subroutine reads a matrix and its right hand sides,
! all stored in Matrix Market format file. The B field is optional,.
!
! Character :: filename*20
! On Entry: name of file to be processed.
! On Exit : unchanged.
!
! Type(D_SPMAT) :: A
! On Entry: fresh variable.
! On Exit : will contain the global sparse matrix as follows:
! A%AS for coefficient values
! A%IA1 for column indices
! A%IA2 for row pointers
! A%M for number of global matrix rows
! A%K for number of global matrix columns
!
! Integer :: ICTXT
! On Entry: BLACS context.
! On Exit : unchanged.
!
! Real(psb_dpk_), Pointer, Optional :: B(:,:)
! On Entry: fresh variable.
! On Exit: will contain right hand side(s).
!
! Integer, Optional :: inroot
! On Entry: Index of root processor (default: 0)
! On Exit : unchanged.
!
module psb_read_mat_mod
interface read_mat
module procedure sreadmat, dreadmat, creadmat, zreadmat
end interface
interface read_rhs
module procedure sread_rhs, cread_rhs, dread_rhs, zread_rhs
end interface
contains
subroutine sreadmat (filename, a, ictxt, inroot)
use psb_base_mod
use psb_mmio_mod
implicit none
integer :: ictxt
type(psb_sspmat_type) :: a
character(len=*) :: filename
integer, optional :: inroot
integer, parameter :: infile = 2
integer :: info, root, np, me
if (present(inroot)) then
root = inroot
else
root = psb_root_
end if
call psb_info(ictxt, me, np)
if (me == root) then
write(*, '("Reading matrix...")') ! open input file
call mm_mat_read(a,info,infile,filename)
if (info /= 0) then
write(0,*) 'Error return from MM_MAT_READ ',info
call psb_abort(ictxt) ! Unexpected End of File
endif
end if
return
end subroutine sreadmat
subroutine sread_rhs (filename, b, info,ictxt, inroot)
use psb_base_mod
use psb_mmio_mod
implicit none
integer :: ictxt
character :: filename*(*)
real(psb_spk_), allocatable, intent(out) :: b(:,:)
integer, intent(out) :: info
integer, optional :: inroot
integer, parameter :: infile = 2
integer :: nrow, ncol, i,root, np, me, ircode, j
if (present(inroot)) then
root = inroot
else
root = psb_root_
end if
info = 0
call psb_info(ictxt, me, np)
if (me == root) then
write(*, '("Reading rhs...")') ! open input file
call mm_vet_read(filename,b,info)
if (info /= 0) then
write(0,*) 'read_rhs: something went wrong.'
return
end if ! read right hand sides
write(*,*) 'end read_rhs'
end if
return
end subroutine sread_rhs
subroutine dreadmat (filename, a, ictxt, inroot)
use psb_base_mod
use psb_mmio_mod
implicit none
integer :: ictxt
type(psb_dspmat_type) :: a
character(len=*) :: filename
integer, optional :: inroot
integer, parameter :: infile = 2
integer :: info, root, np, me
if (present(inroot)) then
root = inroot
else
root = psb_root_
end if
call psb_info(ictxt, me, np)
if (me == root) then
write(*, '("Reading matrix...")') ! open input file
call mm_mat_read(a,info,infile,filename)
if (info /= 0) then
write(0,*) 'Error return from MM_MAT_READ ',info
call psb_abort(ictxt) ! Unexpected End of File
endif
end if
return
end subroutine dreadmat
subroutine dread_rhs (filename, b, info,ictxt, inroot)
use psb_base_mod
use psb_mmio_mod
implicit none
integer :: ictxt
character :: filename*(*)
real(psb_dpk_), allocatable, intent(out) :: b(:,:)
integer, intent(out) :: info
integer, optional :: inroot
integer, parameter :: infile = 2
integer :: nrow, ncol, i,root, np, me, ircode, j
if (present(inroot)) then
root = inroot
else
root = psb_root_
end if
info = 0
call psb_info(ictxt, me, np)
if (me == root) then
write(*, '("Reading rhs...")') ! open input file
call mm_vet_read(filename,b,info)
if (info /= 0) then
write(0,*) 'read_rhs: something went wrong.'
return
end if ! read right hand sides
write(*,*) 'end read_rhs'
end if
return
end subroutine dread_rhs
subroutine creadmat (filename, a, ictxt, inroot)
use psb_base_mod
use psb_mmio_mod
implicit none
integer :: ictxt
type(psb_cspmat_type) :: a
character(len=*) :: filename
integer, optional :: inroot
integer, parameter :: infile = 2
integer :: info, root, np, me
if (present(inroot)) then
root = inroot
else
root = psb_root_
end if
call psb_info(ictxt, me, np)
if (me == root) then
write(*, '("Reading matrix...")') ! open input file
call mm_mat_read(a,info,infile,filename)
if (info /= 0) then
write(0,*) 'Error return from MM_MAT_READ ',info
call psb_abort(ictxt) ! Unexpected End of File
endif
end if
return
end subroutine creadmat
subroutine cread_rhs (filename, b, info,ictxt, inroot)
use psb_base_mod
use psb_mmio_mod
implicit none
integer :: ictxt
character :: filename*(*)
complex(psb_spk_), allocatable, intent(out) :: b(:,:)
integer, intent(out) :: info
integer, optional :: inroot
integer, parameter :: infile = 2
integer :: nrow, ncol, i,root, np, me, ircode, j
if (present(inroot)) then
root = inroot
else
root = psb_root_
end if
info = 0
call psb_info(ictxt, me, np)
if (me == root) then
write(*, '("Reading rhs...")') ! open input file
call mm_vet_read(filename,b,info)
if (info /= 0) then
write(0,*) 'read_rhs: something went wrong.'
return
end if ! read right hand sides
write(*,*) 'end read_rhs'
end if
return
end subroutine cread_rhs
subroutine zreadmat (filename, a, ictxt, inroot)
use psb_base_mod
use psb_mmio_mod
implicit none
integer :: ictxt
type(psb_zspmat_type) :: a
character(len=*) :: filename
integer, optional :: inroot
integer, parameter :: infile = 2
integer :: info, root, np, me
if (present(inroot)) then
root = inroot
else
root = psb_root_
end if
call psb_info(ictxt, me, np)
if (me == root) then
write(*, '("Reading matrix...")') ! open input file
call mm_mat_read(a,info,infile,filename)
if (info /= 0) then
write(0,*) 'Error return from MM_MAT_READ ',info
call psb_abort(ictxt) ! Unexpected End of File
endif
end if
return
end subroutine zreadmat
subroutine zread_rhs (filename, b, info,ictxt, inroot)
use psb_base_mod
use psb_mmio_mod
implicit none
integer :: ictxt
character :: filename*(*)
complex(psb_dpk_), allocatable, intent(out) :: b(:,:)
integer, intent(out) :: info
integer, optional :: inroot
integer, parameter :: infile = 2
integer :: nrow, ncol, i,root, np, me, ircode, j
if (present(inroot)) then
root = inroot
else
root = psb_root_
end if
info = 0
call psb_info(ictxt, me, np)
if (me == root) then
write(*, '("Reading rhs...")') ! open input file
call mm_vet_read(filename,b,info)
if (info /= 0) then
write(0,*) 'read_rhs: something went wrong.'
return
end if ! read right hand sides
write(*,*) 'end read_rhs'
end if
return
end subroutine zread_rhs
end module psb_read_mat_mod
-1
View File
@@ -36,7 +36,6 @@ module psb_util_mod
use psb_metispart_mod
use psb_hbio_mod
use psb_mmio_mod
use psb_read_mat_mod
use psb_mat_dist_mod
end module psb_util_mod