diff --git a/base/Makefile b/base/Makefile index ccaa913c..2f7c775f 100644 --- a/base/Makefile +++ b/base/Makefile @@ -7,11 +7,11 @@ LIBMOD=psb_base_mod$(.mod) lib: (cd modules; make lib LIBNAME=$(BASELIBNAME) F90=$(MPF90) F90COPT="$(F90COPT) $(MPI_OPT)") (cd serial; make lib LIBNAME=$(BASELIBNAME)) + (cd newserial; make lib LIBNAME=$(BASELIBNAME) ) (cd comm; make lib LIBNAME=$(BASELIBNAME)) (cd internals; make lib LIBNAME=$(BASELIBNAME)) (cd tools; make lib LIBNAME=$(BASELIBNAME)) (cd psblas; make lib LIBNAME=$(BASELIBNAME)) - (cd newserial; make lib LIBNAME=$(BASELIBNAME) ) /bin/cp -p $(HERE)/$(LIBNAME) $(LIBDIR) /bin/cp -p $(LIBMOD) *$(.mod) $(LIBDIR) diff --git a/base/modules/Makefile b/base/modules/Makefile index 4d7a5d9a..946ebce4 100644 --- a/base/modules/Makefile +++ b/base/modules/Makefile @@ -17,7 +17,7 @@ CINCLUDES=-I. FINCLUDES=$(FMFLAG)$(LIBDIR) $(FMFLAG). $(FIFLAG). -lib: $(BASIC_MODS) blacsmod $(UTIL_MODS) $(OBJS) $(LIBMOD) +lib: $(BASIC_MODS) blacsmod newmods $(UTIL_MODS) $(OBJS) $(LIBMOD) $(AR) $(LIBDIR)/$(LIBNAME) $(MODULES) $(OBJS) $(MPFOBJS) $(RANLIB) $(LIBDIR)/$(LIBNAME) /bin/cp -p $(LIBMOD) $(LIBDIR) @@ -44,7 +44,8 @@ psb_hash_mod.o: psb_const_mod.o psb_realloc_mod.o psb_base_mod.o: $(MODULES) - +newmods: $(BASIC_MODS) psb_string_mod.o psb_sort_mod.o psb_ip_reord_mod.o + (cd ../newserial; make lib LIBNAME=$(LIBNAME)) blacsmod: (make psb_blacs_mod.o psb_penv_mod.o F90COPT="$(F90COPT) $(EXTRA_OPT)") diff --git a/base/modules/psb_psblas_mod.f90 b/base/modules/psb_psblas_mod.f90 index 23ad814f..8eaba543 100644 --- a/base/modules/psb_psblas_mod.f90 +++ b/base/modules/psb_psblas_mod.f90 @@ -589,8 +589,9 @@ module psb_psblas_mod function psb_dnrmi(a, desc_a,info) use psb_serial_mod use psb_descriptor_type + use psbn_d_mat_mod real(psb_dpk_) :: psb_dnrmi - type(psb_dspmat_type), intent (in) :: a + type(psbn_d_sparse_mat), intent (in) :: a type(psb_desc_type), intent (in) :: desc_a integer, intent(out) :: info end function psb_dnrmi @@ -646,7 +647,8 @@ module psb_psblas_mod &trans, k, jx, jy,work,doswap) use psb_serial_mod use psb_descriptor_type - type(psb_dspmat_type), intent(in) :: a + use psbn_d_mat_mod + type(psbn_d_sparse_mat), intent(in) :: a real(psb_dpk_), intent(inout) :: x(:,:) real(psb_dpk_), intent(inout) :: y(:,:) real(psb_dpk_), intent(in) :: alpha, beta @@ -661,7 +663,8 @@ module psb_psblas_mod & desc_a, info, trans, work,doswap) use psb_serial_mod use psb_descriptor_type - type(psb_dspmat_type), intent(in) :: a + use psbn_d_mat_mod + type(psbn_d_sparse_mat), intent(in) :: a real(psb_dpk_), intent(inout) :: x(:) real(psb_dpk_), intent(inout) :: y(:) real(psb_dpk_), intent(in) :: alpha, beta diff --git a/base/modules/psb_tools_mod.f90 b/base/modules/psb_tools_mod.f90 index e0ffc66c..6f073d4e 100644 --- a/base/modules/psb_tools_mod.f90 +++ b/base/modules/psb_tools_mod.f90 @@ -550,8 +550,9 @@ Module psb_tools_mod subroutine psb_dspalloc(a, desc_a, info, nnz) use psb_descriptor_type use psb_spmat_type + use psbn_d_mat_mod type(psb_desc_type), intent(inout) :: desc_a - type(psb_dspmat_type), intent(out) :: a + type(psbn_d_sparse_mat), intent(out) :: a integer, intent(out) :: info integer, optional, intent(in) :: nnz end subroutine psb_dspalloc @@ -586,7 +587,8 @@ Module psb_tools_mod subroutine psb_dspasb(a,desc_a, info, afmt, upd, dupl) use psb_descriptor_type use psb_spmat_type - type(psb_dspmat_type), intent (inout) :: a + use psbn_d_mat_mod + type(psbn_d_sparse_mat), intent (inout) :: a type(psb_desc_type), intent(in) :: desc_a integer, intent(out) :: info integer,optional, intent(in) :: dupl, upd @@ -627,8 +629,9 @@ Module psb_tools_mod subroutine psb_dspfree(a, desc_a,info) use psb_descriptor_type use psb_spmat_type + use psbn_d_mat_mod type(psb_desc_type), intent(in) :: desc_a - type(psb_dspmat_type), intent(inout) ::a + type(psbn_d_sparse_mat), intent(inout) ::a integer, intent(out) :: info end subroutine psb_dspfree subroutine psb_cspfree(a, desc_a,info) @@ -672,8 +675,9 @@ Module psb_tools_mod subroutine psb_dspins(nz,ia,ja,val,a,desc_a,info,rebuild) use psb_descriptor_type use psb_spmat_type + use psbn_d_mat_mod type(psb_desc_type), intent(inout) :: desc_a - type(psb_dspmat_type), intent(inout) :: a + type(psbn_d_sparse_mat), intent(inout) :: a integer, intent(in) :: nz,ia(:),ja(:) real(psb_dpk_), intent(in) :: val(:) integer, intent(out) :: info diff --git a/base/newserial/Makefile b/base/newserial/Makefile index fc1c1f47..bda4af54 100644 --- a/base/newserial/Makefile +++ b/base/newserial/Makefile @@ -8,7 +8,7 @@ LIBMOD= OBJS = LIBDIR=.. CINCLUDES=-I. -FINCLUDES=$(FMFLAG)$(LIBDIR) $(FMFLAG). $(FIFLAG). +FINCLUDES=$(FMFLAG)$(LIBDIR) $(FMFLAG). $(FIFLAG). $(FMFLAG)../modules lib: $(MODULES) $(OBJS) $(LIBMOD) @@ -16,7 +16,7 @@ lib: $(MODULES) $(OBJS) $(LIBMOD) $(RANLIB) $(LIBDIR)/$(LIBNAME) # /bin/cp -p $(LIBMOD) $(LIBDIR) /bin/cp -p *$(.mod) $(LIBDIR) -psbn_mat_mod.o: psbn_base_mat_mod.o +psbn_mat_mod.o: psbn_base_mat_mod.o psbn_d_csr_mat_mod.o psbn_coo_mat.o psbn_csr_mat.o: psbn_d_base_mat_mod.o psbn_d_coo_impl.o: psbn_d_base_mat_mod.o diff --git a/base/newserial/README b/base/newserial/README index 3a90bbc3..cf972015 100644 --- a/base/newserial/README +++ b/base/newserial/README @@ -15,11 +15,11 @@ Design principles for this directory. type. At this level we define the computational interfaces to MV and SV, since they require the type of the vectors/scalars involved (should also add NRMI here!!!!), but again they will - be empty shells. We also define the interface to CSINS, + be empty shells. We also define the interface to CSPUT, required to build the object, and TO_COO,FROM_COO (see below). iii. The X_YYY_object where the real implementation of the - MV/SV/NRMI/CSINS/ALLOCATE/FREE/TO_COO/FROM_COO takes place. + MV/SV/NRMI/CSPUT/ALLOCATE/FREE/TO_COO/FROM_COO takes place. 2. What is a sparse matrix (take 2)? The above structure by itself does not allow a sparse matrix to diff --git a/base/newserial/psbn_base_mat_mod.f03 b/base/newserial/psbn_base_mat_mod.f03 index a8fa96d0..1aa3bc43 100644 --- a/base/newserial/psbn_base_mat_mod.f03 +++ b/base/newserial/psbn_base_mat_mod.f03 @@ -369,8 +369,7 @@ contains end function get_size subroutine sparse_print(iout,a,iv,eirs,eics,head,ivr,ivc) - use psb_spmat_type - use psb_string_mod + use psb_error_mod implicit none integer, intent(in) :: iout diff --git a/base/newserial/psbn_d_base_mat_mod.f03 b/base/newserial/psbn_d_base_mat_mod.f03 index db43d352..59788756 100644 --- a/base/newserial/psbn_d_base_mat_mod.f03 +++ b/base/newserial/psbn_d_base_mat_mod.f03 @@ -191,7 +191,7 @@ module psbn_d_base_mat_mod interface - subroutine d_coo_csput_impl(nz,val,ia,ja,a,imin,imax,jmin,jmax,info,gtl) + subroutine d_coo_csput_impl(nz,ia,ja,val,a,imin,imax,jmin,jmax,info,gtl) use psb_const_mod import psbn_d_coo_sparse_mat class(psbn_d_coo_sparse_mat), intent(inout) :: a @@ -504,7 +504,7 @@ contains end subroutine mv_from_fmt - subroutine csput(nz,val,ia,ja,a,imin,imax,jmin,jmax,info,gtl) + subroutine csput(nz,ia,ja,val,a,imin,imax,jmin,jmax,info,gtl) use psb_error_mod use psb_realloc_mod implicit none @@ -1283,7 +1283,7 @@ contains end subroutine d_coo_reallocate_nz - subroutine d_coo_csput(nz,val,ia,ja,a,imin,imax,jmin,jmax,info,gtl) + subroutine d_coo_csput(nz,ia,ja,val,a,imin,imax,jmin,jmax,info,gtl) use psb_error_mod use psb_realloc_mod implicit none @@ -1330,7 +1330,7 @@ contains if (nz == 0) return nza = a%get_nzeros() - call d_coo_csput_impl(nz,val,ia,ja,a,imin,imax,jmin,jmax,info,gtl) + call d_coo_csput_impl(nz,ia,ja,val,a,imin,imax,jmin,jmax,info,gtl) if (info /= 0) goto 9999 call psb_erractionrestore(err_act) @@ -1694,7 +1694,6 @@ contains subroutine d_coo_print(iout,a,iv,eirs,eics,head,ivr,ivc) - use psb_spmat_type use psb_string_mod implicit none diff --git a/base/newserial/psbn_d_coo_impl.f03 b/base/newserial/psbn_d_coo_impl.f03 index 58ac106a..86c30b31 100644 --- a/base/newserial/psbn_d_coo_impl.f03 +++ b/base/newserial/psbn_d_coo_impl.f03 @@ -1184,9 +1184,10 @@ contains end subroutine d_coo_csgetrow_impl -subroutine d_coo_csput_impl(nz,val,ia,ja,a,imin,imax,jmin,jmax,info,gtl) +subroutine d_coo_csput_impl(nz,ia,ja,val,a,imin,imax,jmin,jmax,info,gtl) use psb_error_mod use psb_realloc_mod + use psb_sort_mod use psbn_d_base_mat_mod, psb_protect_name => d_coo_csput_impl implicit none @@ -1346,7 +1347,6 @@ contains use psb_const_mod use psb_realloc_mod use psb_string_mod - use psb_serial_mod implicit none class(psbn_d_coo_sparse_mat), intent(inout) :: a @@ -1742,9 +1742,9 @@ subroutine d_fix_coo_impl(a,info,idir) use psb_const_mod use psb_error_mod use psb_realloc_mod - use psbn_d_base_mat_mod, psb_protect_name => d_fix_coo_impl use psb_string_mod use psb_ip_reord_mod + use psbn_d_base_mat_mod, psb_protect_name => d_fix_coo_impl implicit none class(psbn_d_coo_sparse_mat), intent(inout) :: a diff --git a/base/newserial/psbn_d_csr_impl.f03 b/base/newserial/psbn_d_csr_impl.f03 index e9545baa..3e2a213a 100644 --- a/base/newserial/psbn_d_csr_impl.f03 +++ b/base/newserial/psbn_d_csr_impl.f03 @@ -1172,7 +1172,7 @@ end subroutine d_csr_csgetrow_impl -subroutine d_csr_csput_impl(nz,val,ia,ja,a,imin,imax,jmin,jmax,info,gtl) +subroutine d_csr_csput_impl(nz,ia,ja,val,a,imin,imax,jmin,jmax,info,gtl) use psb_error_mod use psb_realloc_mod use psbn_d_csr_mat_mod, psb_protect_name => d_csr_csput_impl @@ -1236,7 +1236,7 @@ contains use psb_const_mod use psb_realloc_mod use psb_string_mod - use psb_serial_mod + use psb_sort_mod implicit none class(psbn_d_csr_sparse_mat), intent(inout) :: a diff --git a/base/newserial/psbn_d_csr_mat_mod.f03 b/base/newserial/psbn_d_csr_mat_mod.f03 index 4cbff6e0..663b8ae9 100644 --- a/base/newserial/psbn_d_csr_mat_mod.f03 +++ b/base/newserial/psbn_d_csr_mat_mod.f03 @@ -139,7 +139,7 @@ module psbn_d_csr_mat_mod end interface interface - subroutine d_csr_csput_impl(nz,val,ia,ja,a,imin,imax,jmin,jmax,info,gtl) + subroutine d_csr_csput_impl(nz,ia,ja,val,a,imin,imax,jmin,jmax,info,gtl) use psb_const_mod import psbn_d_csr_sparse_mat class(psbn_d_csr_sparse_mat), intent(inout) :: a @@ -322,7 +322,7 @@ contains end subroutine d_csr_reallocate_nz - subroutine d_csr_csput(nz,val,ia,ja,a,imin,imax,jmin,jmax,info,gtl) + subroutine d_csr_csput(nz,ia,ja,val,a,imin,imax,jmin,jmax,info,gtl) use psb_const_mod use psb_error_mod implicit none @@ -369,7 +369,7 @@ contains if (nz == 0) return - call d_csr_csput_impl(nz,val,ia,ja,a,imin,imax,jmin,jmax,info,gtl) + call d_csr_csput_impl(nz,ia,ja,val,a,imin,imax,jmin,jmax,info,gtl) if (info /= 0) goto 9999 call psb_erractionrestore(err_act) @@ -948,7 +948,6 @@ contains subroutine d_csr_print(iout,a,iv,eirs,eics,head,ivr,ivc) - use psb_spmat_type use psb_string_mod implicit none diff --git a/base/newserial/psbn_mat_mod.f03 b/base/newserial/psbn_mat_mod.f03 index ab9127cd..3c5b18a1 100644 --- a/base/newserial/psbn_mat_mod.f03 +++ b/base/newserial/psbn_mat_mod.f03 @@ -66,7 +66,6 @@ module psbn_d_mat_mod procedure, pass(a) :: d_scals procedure, pass(a) :: d_scal generic, public :: scal => d_scals, d_scal - procedure, pass(a) :: d_cssv procedure, pass(a) :: d_cssm generic, public :: cssm => d_cssm, d_cssv @@ -78,9 +77,12 @@ module psbn_d_mat_mod & is_asb, is_sorted, is_upper, is_lower, is_triangle, & & is_unit, get_neigh, csall, csput, d_csgetrow,& & d_csgetblk, csclip, d_cscnv, d_cscnv_ip, & - & reallocate_nz, free, trim, d_csmv, d_csmm, d_cssv, d_cssm, sparse_print, & - & set_nrows, set_ncols, set_dupl, set_state, set_null, set_bld, & - & set_upd, set_asb, set_sorted, set_upper, set_lower, set_triangle, & + & reallocate_nz, free, trim, & + & d_csmv, d_csmm, d_cssv, d_cssm, sparse_print, & + & set_nrows, set_ncols, set_dupl, & + & set_state, set_null, set_bld, & + & set_upd, set_asb, set_sorted, & + & set_upper, set_lower, set_triangle, & & set_unit, csnmi, get_diag, d_scals, d_scal contains @@ -994,7 +996,7 @@ contains end subroutine trim - subroutine csput(nz,val,ia,ja,a,imin,imax,jmin,jmax,info,gtl) + subroutine csput(nz,ia,ja,val,a,imin,imax,jmin,jmax,info,gtl) use psbn_d_base_mat_mod use psb_error_mod implicit none @@ -1017,7 +1019,7 @@ contains endif - call a%a%csput(nz,val,ia,ja,imin,imax,jmin,jmax,info,gtl) + call a%a%csput(nz,ia,ja,val,imin,imax,jmin,jmax,info,gtl) if (info /= 0) goto 9999 call psb_erractionrestore(err_act) diff --git a/base/psblas/psb_dnrmi.f90 b/base/psblas/psb_dnrmi.f90 index b84ebcb4..32b40691 100644 --- a/base/psblas/psb_dnrmi.f90 +++ b/base/psblas/psb_dnrmi.f90 @@ -47,9 +47,10 @@ function psb_dnrmi(a,desc_a,info) use psb_check_mod use psb_error_mod use psb_penv_mod + use psbn_d_mat_mod implicit none - type(psb_dspmat_type), intent(in) :: a + type(psbn_d_sparse_mat), intent(in) :: a integer, intent(out) :: info type(psb_desc_type), intent(in) :: desc_a real(psb_dpk_) :: psb_dnrmi @@ -94,7 +95,7 @@ function psb_dnrmi(a,desc_a,info) end if if ((m /= 0).and.(n /= 0)) then - nrmi = psb_csnmi(a,info) + nrmi = a%csnmi() if(info /= 0) then info=4010 ch_err='psb_csnmi' diff --git a/base/psblas/psb_dspmm.f90 b/base/psblas/psb_dspmm.f90 index 8b58728b..9737e501 100644 --- a/base/psblas/psb_dspmm.f90 +++ b/base/psblas/psb_dspmm.f90 @@ -74,12 +74,13 @@ subroutine psb_dspmm(alpha,a,x,beta,y,desc_a,info,& use psb_error_mod use psb_string_mod use psb_penv_mod + use psbn_d_mat_mod implicit none real(psb_dpk_), intent(in) :: alpha, beta real(psb_dpk_), intent(inout), target :: x(:,:) real(psb_dpk_), intent(inout), target :: y(:,:) - type(psb_dspmat_type), intent(in) :: a + type(psbn_d_sparse_mat), intent(in) :: a type(psb_desc_type), intent(in) :: desc_a integer, intent(out) :: info real(psb_dpk_), optional, target :: work(:) @@ -435,12 +436,14 @@ subroutine psb_dspmv(alpha,a,x,beta,y,desc_a,info,& use psb_error_mod use psb_string_mod use psb_penv_mod + use psbn_d_mat_mod implicit none real(psb_dpk_), intent(in) :: alpha, beta real(psb_dpk_), intent(inout), target :: x(:) real(psb_dpk_), intent(inout), target :: y(:) - type(psb_dspmat_type), intent(in) :: a + type(psbn_d_sparse_mat), intent(in) :: a +!!$ type(psb_dspmat_type), intent(in) :: a type(psb_desc_type), intent(in) :: desc_a integer, intent(out) :: info real(psb_dpk_), optional, target :: work(:) diff --git a/base/tools/psb_dspalloc.f90 b/base/tools/psb_dspalloc.f90 index a9f2246b..5f128885 100644 --- a/base/tools/psb_dspalloc.f90 +++ b/base/tools/psb_dspalloc.f90 @@ -49,11 +49,12 @@ subroutine psb_dspalloc(a, desc_a, info, nnz) use psb_const_mod use psb_error_mod use psb_penv_mod + use psbn_d_mat_mod implicit none !....parameters... type(psb_desc_type), intent(inout) :: desc_a - type(psb_dspmat_type), intent(out) :: a + type(psbn_d_sparse_mat), intent(out) :: a integer, intent(out) :: info integer, optional, intent(in) :: nnz @@ -108,7 +109,7 @@ subroutine psb_dspalloc(a, desc_a, info, nnz) & write(debug_unit,*) me,' ',trim(name),':allocating size:',length_ia1 !....allocate aspk, ia1, ia2..... - call psb_sp_all(loc_row,loc_col,a,length_ia1,info) + call a%csall(loc_row,loc_col,length_ia1,info) if(info /= 0) then info=4010 ch_err='sp_all' diff --git a/base/tools/psb_dspasb.f90 b/base/tools/psb_dspasb.f90 index 4e3378ee..6d1a444c 100644 --- a/base/tools/psb_dspasb.f90 +++ b/base/tools/psb_dspasb.f90 @@ -57,11 +57,12 @@ subroutine psb_dspasb(a,desc_a, info, afmt, upd, dupl) use psb_error_mod use psb_string_mod use psb_penv_mod + use psbn_d_mat_mod implicit none !...Parameters.... - type(psb_dspmat_type), intent (inout) :: a + type(psbn_d_sparse_mat), intent (inout) :: a type(psb_desc_type), intent(in) :: desc_a integer, intent(out) :: info integer,optional, intent(in) :: dupl, upd @@ -106,23 +107,27 @@ subroutine psb_dspasb(a,desc_a, info, afmt, upd, dupl) !check on errors encountered in psdspins - spstate = a%infoa(psb_state_) - if (spstate == psb_spmat_bld_) then + + if (a%is_bld()) then ! ! First case: we come from a fresh build. ! n_row = psb_cd_get_local_rows(desc_a) n_col = psb_cd_get_local_cols(desc_a) - a%m = n_row - a%k = n_col + call a%set_nrows(n_row) + call a%set_ncols(n_col) end if - call psb_spcnv(a,info,afmt=afmt,upd=upd,dupl=dupl) + call a%cscnv(info,type=afmt,dupl=dupl) - IF (debug_level >= psb_debug_ext_)& - & write(debug_unit, *) me,' ',trim(name),': From SPCNV',& - & info,' ',A%FIDA + + IF (debug_level >= psb_debug_ext_) then + ch_err=a%get_fmt() + write(debug_unit, *) me,' ',trim(name),': From SPCNV',& + & info,' ',ch_err + end IF + if (info /= psb_no_err_) then info=4010 ch_err='psb_spcnv' diff --git a/base/tools/psb_dspfree.f90 b/base/tools/psb_dspfree.f90 index f918fc47..a5641f75 100644 --- a/base/tools/psb_dspfree.f90 +++ b/base/tools/psb_dspfree.f90 @@ -46,11 +46,12 @@ subroutine psb_dspfree(a, desc_a,info) use psb_serial_mod use psb_const_mod use psb_error_mod + use psbn_d_mat_mod implicit none !....parameters... type(psb_desc_type), intent(in) :: desc_a - type(psb_dspmat_type), intent(inout) :: a + type(psbn_d_sparse_mat), intent(inout) :: a integer, intent(out) :: info !...locals.... integer :: ictxt,err_act @@ -70,14 +71,14 @@ subroutine psb_dspfree(a, desc_a,info) end if !...deallocate a.... - call psb_sp_free(a,info) + call a%free() - if(info /= 0) then - info=2045 - call psb_errpush(info,name) - goto 9999 - end if +!!$ if(info /= 0) then +!!$ info=2045 +!!$ call psb_errpush(info,name) +!!$ goto 9999 +!!$ end if call psb_erractionrestore(err_act) return diff --git a/base/tools/psb_dspins.f90 b/base/tools/psb_dspins.f90 index 0f6e27a3..31bf7383 100644 --- a/base/tools/psb_dspins.f90 +++ b/base/tools/psb_dspins.f90 @@ -57,11 +57,12 @@ subroutine psb_dspins(nz,ia,ja,val,a,desc_a,info,rebuild) use psb_const_mod use psb_error_mod use psb_penv_mod + use psbn_d_mat_mod implicit none !....parameters... type(psb_desc_type), intent(inout) :: desc_a - type(psb_dspmat_type), intent(inout) :: a + type(psbn_d_sparse_mat), intent(inout) :: a integer, intent(in) :: nz,ia(:),ja(:) real(psb_dpk_), intent(in) :: val(:) integer, intent(out) :: info @@ -120,7 +121,6 @@ subroutine psb_dspins(nz,ia,ja,val,a,desc_a,info,rebuild) rebuild_ = .false. endif - spstate = a%infoa(psb_state_) if (psb_is_bld_desc(desc_a)) then if (psb_is_large_desc(desc_a)) then @@ -139,8 +139,8 @@ subroutine psb_dspins(nz,ia,ja,val,a,desc_a,info,rebuild) nrow = psb_cd_get_local_rows(desc_a) ncol = psb_cd_get_local_cols(desc_a) - if (spstate == psb_spmat_bld_) then - call psb_coins(nz,ila,jla,val,a,1,nrow,1,ncol,info) + if (a%is_bld()) then + call a%csput(nz,ila,jla,val,1,nrow,1,ncol,info) if (info /= 0) then info=4010 ch_err='psb_coins' @@ -164,8 +164,8 @@ subroutine psb_dspins(nz,ia,ja,val,a,desc_a,info,rebuild) nrow = psb_cd_get_local_rows(desc_a) ncol = psb_cd_get_local_cols(desc_a) - if (spstate == psb_spmat_bld_) then - call psb_coins(nz,ia,ja,val,a,1,nrow,1,ncol,info,gtl=desc_a%idxmap%glob_to_loc) + if (a%is_bld()) then + call a%csput(nz,ia,ja,val,1,nrow,1,ncol,info,gtl=desc_a%idxmap%glob_to_loc) if (info /= 0) then info=4010 ch_err='psb_coins' @@ -198,8 +198,7 @@ subroutine psb_dspins(nz,ia,ja,val,a,desc_a,info,rebuild) nrow = psb_cd_get_local_rows(desc_a) ncol = psb_cd_get_local_cols(desc_a) - call psb_coins(nz,ila,jla,val,a,1,nrow,1,ncol,& - & info,rebuild=rebuild_) + call a%csput(nz,ila,jla,val,1,nrow,1,ncol,info) if (info /= 0) then info=4010 ch_err='psb_coins' @@ -210,8 +209,8 @@ subroutine psb_dspins(nz,ia,ja,val,a,desc_a,info,rebuild) else nrow = psb_cd_get_local_rows(desc_a) ncol = psb_cd_get_local_cols(desc_a) - call psb_coins(nz,ia,ja,val,a,1,nrow,1,ncol,& - & info,gtl=desc_a%idxmap%glob_to_loc,rebuild=rebuild_) + call a%csput(nz,ia,ja,val,1,nrow,1,ncol,& + & info,gtl=desc_a%idxmap%glob_to_loc) if (info /= 0) then info=4010 ch_err='psb_coins' diff --git a/krylov/psb_dbicg.f90 b/krylov/psb_dbicg.f90 index 003f5175..06c005f5 100644 --- a/krylov/psb_dbicg.f90 +++ b/krylov/psb_dbicg.f90 @@ -98,10 +98,12 @@ subroutine psb_dbicg(a,prec,b,x,eps,desc_a,info,itmax,iter,err,itrace,istop) use psb_base_mod use psb_prec_mod use psb_krylov_mod, psb_protect_name => psb_dbicg + use psbn_d_mat_mod implicit none - + type(psbn_d_sparse_mat), intent(in) :: a + !!$ parameters - type(psb_dspmat_type), intent(in) :: a +!!$ type(psb_dspmat_type), intent(in) :: a type(psb_dprec_type), intent(in) :: prec type(psb_desc_type), intent(in) :: desc_a real(psb_dpk_), intent(in) :: b(:) diff --git a/krylov/psb_dcg.F90 b/krylov/psb_dcg.F90 index 42c375d1..c02c4364 100644 --- a/krylov/psb_dcg.F90 +++ b/krylov/psb_dcg.F90 @@ -99,10 +99,14 @@ subroutine psb_dcg(a,prec,b,x,eps,desc_a,info,itmax,iter,err,itrace,istop,cond) use psb_base_mod use psb_prec_mod use psb_krylov_mod, psb_protect_name => psb_dcg + use psbn_d_mat_mod implicit none + type(psbn_d_sparse_mat), intent(in) :: a + + !!$ Parameters - Type(psb_dspmat_type), Intent(in) :: a +!!$ Type(psb_dspmat_type), Intent(in) :: a Type(psb_dprec_type), Intent(in) :: prec Type(psb_desc_type), Intent(in) :: desc_a Real(psb_dpk_), Intent(in) :: b(:) diff --git a/krylov/psb_dcgs.f90 b/krylov/psb_dcgs.f90 index b3c58642..ab451c34 100644 --- a/krylov/psb_dcgs.f90 +++ b/krylov/psb_dcgs.f90 @@ -98,10 +98,13 @@ Subroutine psb_dcgs(a,prec,b,x,eps,desc_a,info,itmax,iter,err,itrace,istop) use psb_base_mod use psb_prec_mod use psb_krylov_mod, psb_protect_name => psb_dcgs + use psbn_d_mat_mod implicit none + type(psbn_d_sparse_mat), intent(in) :: a + !!$ parameters - Type(psb_dspmat_type), Intent(in) :: a +!!$ Type(psb_dspmat_type), Intent(in) :: a Type(psb_desc_type), Intent(in) :: desc_a Type(psb_dprec_type), Intent(in) :: prec Real(psb_dpk_), Intent(in) :: b(:) diff --git a/krylov/psb_dcgstab.F90 b/krylov/psb_dcgstab.F90 index a569ad1a..995e22c7 100644 --- a/krylov/psb_dcgstab.F90 +++ b/krylov/psb_dcgstab.F90 @@ -98,9 +98,13 @@ Subroutine psb_dcgstab(a,prec,b,x,eps,desc_a,info,itmax,iter,err,itrace,istop) use psb_base_mod use psb_prec_mod use psb_krylov_mod, psb_protect_name => psb_dcgstab - Implicit None + use psbn_d_mat_mod + implicit none + type(psbn_d_sparse_mat), intent(in) :: a + + !!$ parameters - Type(psb_dspmat_type), Intent(in) :: a +!!$ Type(psb_dspmat_type), Intent(in) :: a Type(psb_dprec_type), Intent(in) :: prec Type(psb_desc_type), Intent(in) :: desc_a Real(psb_dpk_), Intent(in) :: b(:) diff --git a/krylov/psb_dcgstabl.f90 b/krylov/psb_dcgstabl.f90 index e6c27ece..d577794e 100644 --- a/krylov/psb_dcgstabl.f90 +++ b/krylov/psb_dcgstabl.f90 @@ -107,10 +107,13 @@ Subroutine psb_dcgstabl(a,prec,b,x,eps,desc_a,info,itmax,iter,err,itrace,irst,is use psb_base_mod use psb_prec_mod use psb_krylov_mod, psb_protect_name => psb_dcgstabl + use psbn_d_mat_mod implicit none + type(psbn_d_sparse_mat), intent(in) :: a + !!$ parameters - Type(psb_dspmat_type), Intent(in) :: a +!!$ Type(psb_dspmat_type), Intent(in) :: a Type(psb_dprec_type), Intent(in) :: prec Type(psb_desc_type), Intent(in) :: desc_a Real(psb_dpk_), Intent(in) :: b(:) diff --git a/krylov/psb_drgmres.f90 b/krylov/psb_drgmres.f90 index 09ae9a03..b923c734 100644 --- a/krylov/psb_drgmres.f90 +++ b/krylov/psb_drgmres.f90 @@ -110,10 +110,13 @@ subroutine psb_drgmres(a,prec,b,x,eps,desc_a,info,itmax,iter,err,itrace,irst,ist use psb_base_mod use psb_prec_mod use psb_krylov_mod, psb_protect_name => psb_drgmres + use psbn_d_mat_mod implicit none + type(psbn_d_sparse_mat), intent(in) :: a + !!$ Parameters - Type(psb_dspmat_type), Intent(in) :: a +!!$ Type(psb_dspmat_type), Intent(in) :: a Type(psb_dprec_type), Intent(in) :: prec Type(psb_desc_type), Intent(in) :: desc_a Real(psb_dpk_), Intent(in) :: b(:) diff --git a/krylov/psb_krylov_mod.f90 b/krylov/psb_krylov_mod.f90 index 278dde12..be8f51f5 100644 --- a/krylov/psb_krylov_mod.f90 +++ b/krylov/psb_krylov_mod.f90 @@ -62,7 +62,8 @@ Module psb_krylov_mod & desc_a,info,itmax,iter,err,itrace,istop,cond) use psb_base_mod, only : psb_desc_type, psb_dspmat_type, psb_dpk_ use psb_prec_mod, only : psb_dprec_type - type(psb_dspmat_type), intent(in) :: a + use psbn_d_mat_mod + type(psbn_d_sparse_mat), intent(in) :: a type(psb_desc_type), intent(in) :: desc_a real(psb_dpk_), intent(in) :: b(:) real(psb_dpk_), intent(inout) :: x(:) @@ -125,7 +126,8 @@ Module psb_krylov_mod & desc_a,info,itmax,iter,err,itrace,istop) use psb_base_mod, only : psb_desc_type, psb_dspmat_type, psb_dpk_ use psb_prec_mod, only : psb_dprec_type - type(psb_dspmat_type), intent(in) :: a + use psbn_d_mat_mod + type(psbn_d_sparse_mat), intent(in) :: a type(psb_desc_type), intent(in) :: desc_a real(psb_dpk_), intent(in) :: b(:) real(psb_dpk_), intent(inout) :: x(:) @@ -188,7 +190,8 @@ Module psb_krylov_mod & desc_a,info,itmax,iter,err,itrace,istop) use psb_base_mod, only : psb_desc_type, psb_dspmat_type, psb_dpk_ use psb_prec_mod, only : psb_dprec_type - type(psb_dspmat_type), intent(in) :: a + use psbn_d_mat_mod + type(psbn_d_sparse_mat), intent(in) :: a type(psb_desc_type), intent(in) :: desc_a real(psb_dpk_), intent(in) :: b(:) real(psb_dpk_), intent(inout) :: x(:) @@ -251,7 +254,8 @@ Module psb_krylov_mod &itmax,iter,err, itrace,irst,istop) use psb_base_mod, only : psb_desc_type, psb_dspmat_type, psb_dpk_ use psb_prec_mod, only : psb_dprec_type - Type(psb_dspmat_type), Intent(in) :: a + use psbn_d_mat_mod + type(psbn_d_sparse_mat), intent(in) :: a Type(psb_desc_type), Intent(in) :: desc_a type(psb_dprec_type), intent(in) :: prec Real(psb_dpk_), Intent(in) :: b(:) @@ -314,7 +318,8 @@ Module psb_krylov_mod &itmax,iter,err,itrace,irst,istop) use psb_base_mod, only : psb_desc_type, psb_dspmat_type, psb_dpk_ use psb_prec_mod, only : psb_dprec_type - Type(psb_dspmat_type), Intent(in) :: a + use psbn_d_mat_mod + type(psbn_d_sparse_mat), intent(in) :: a Type(psb_desc_type), Intent(in) :: desc_a type(psb_dprec_type), intent(in) :: prec Real(psb_dpk_), Intent(in) :: b(:) @@ -377,7 +382,8 @@ Module psb_krylov_mod &itmax,iter,err,itrace,istop) use psb_base_mod, only : psb_desc_type, psb_dspmat_type, psb_dpk_ use psb_prec_mod, only : psb_dprec_type - type(psb_dspmat_type), intent(in) :: a + use psbn_d_mat_mod + type(psbn_d_sparse_mat), intent(in) :: a type(psb_desc_type), intent(in) :: desc_a type(psb_dprec_type), intent(in) :: prec real(psb_dpk_), intent(in) :: b(:) @@ -613,9 +619,12 @@ contains use psb_base_mod use psb_prec_mod,only : psb_sprec_type, psb_dprec_type, psb_cprec_type, psb_zprec_type + use psbn_d_mat_mod + + type(psbn_d_sparse_mat), intent(in) :: a character(len=*) :: method - Type(psb_dspmat_type), Intent(in) :: a +!!$ Type(psb_dspmat_type), Intent(in) :: a Type(psb_desc_type), Intent(in) :: desc_a type(psb_dprec_type), intent(in) :: prec Real(psb_dpk_), Intent(in) :: b(:) @@ -1059,10 +1068,12 @@ contains subroutine psb_d_init_conv(methdname,stopc,trace,itmax,a,b,eps,desc_a,stopdat,info) use psb_base_mod + use psbn_d_mat_mod implicit none + type(psbn_d_sparse_mat), intent(in) :: a character(len=*), intent(in) :: methdname integer, intent(in) :: stopc, trace,itmax - type(psb_dspmat_type), intent(in) :: a +!!$ type(psb_dspmat_type), intent(in) :: a real(psb_dpk_), intent(in) :: b(:), eps type(psb_desc_type), intent(in) :: desc_a type(psb_itconv_type) :: stopdat diff --git a/prec/psb_dprecbld.f90 b/prec/psb_dprecbld.f90 index ddbb1d80..7962d1b3 100644 --- a/prec/psb_dprecbld.f90 +++ b/prec/psb_dprecbld.f90 @@ -29,13 +29,14 @@ !!$ POSSIBILITY OF SUCH DAMAGE. !!$ !!$ -subroutine psb_dprecbld(a,desc_a,p,info,upd) +subroutine psb_dprecbld(aa,desc_a,p,info,upd) use psb_base_mod + use psbn_d_mat_mod use psb_prec_mod, psb_protect_name => psb_dprecbld Implicit None - type(psb_dspmat_type), intent(in), target :: a + type(psbn_d_sparse_mat), intent(in), target :: aa type(psb_desc_type), intent(in), target :: desc_a type(psb_dprec_type),intent(inout) :: p integer, intent(out) :: info @@ -46,6 +47,7 @@ subroutine psb_dprecbld(a,desc_a,p,info,upd) & me,np,mglob, err_act integer :: int_err(5) character :: upd_ + type(psb_dspmat_type), target :: a integer,parameter :: iroot=psb_root_,iout=60,ilout=40 character(len=20) :: name, ch_err @@ -86,6 +88,7 @@ subroutine psb_dprecbld(a,desc_a,p,info,upd) call psb_nullify_desc(p%desc_data) + select case(p%iprcparm(psb_p_type_)) case (psb_noprec_) ! Do nothing. diff --git a/prec/psb_dprecinit.f90 b/prec/psb_dprecinit.f90 index 1b202b4d..c79b52e3 100644 --- a/prec/psb_dprecinit.f90 +++ b/prec/psb_dprecinit.f90 @@ -44,7 +44,11 @@ subroutine psb_dprecinit(p,ptype,info) if (info == 0) call psb_realloc(psb_rfpsz,p%rprcparm,info) if (info /= 0) return p%iprcparm(:) = 0 - + p%iprcparm(:) = 0 + p%iprcparm(psb_p_type_) = psb_noprec_ + p%iprcparm(psb_f_type_) = psb_f_none_ + + return select case(psb_toupper(ptype(1:len_trim(ptype)))) case ('NONE','NOPREC') p%iprcparm(:) = 0 diff --git a/prec/psb_dprecset.f90 b/prec/psb_dprecset.f90 index 582f775a..06070d64 100644 --- a/prec/psb_dprecset.f90 +++ b/prec/psb_dprecset.f90 @@ -39,7 +39,7 @@ subroutine psb_dprecseti(p,what,val,info) integer, intent(out) :: info info = 0 - + return select case(what) case (psb_f_type_) if (p%iprcparm(psb_p_type_) /= psb_bjac_) then diff --git a/prec/psb_prec_mod.f90 b/prec/psb_prec_mod.f90 index 98db45af..67501ca4 100644 --- a/prec/psb_prec_mod.f90 +++ b/prec/psb_prec_mod.f90 @@ -45,10 +45,11 @@ module psb_prec_mod character, intent(in),optional :: upd end subroutine psb_sprecbld subroutine psb_dprecbld(a,desc_a,prec,info,upd) + use psbn_d_mat_mod use psb_base_mod, only : psb_desc_type, psb_dspmat_type, psb_dpk_ use psb_prec_type, only : psb_dprec_type implicit none - type(psb_dspmat_type), intent(in), target :: a + type(psbn_d_sparse_mat), intent(in), target :: a type(psb_desc_type), intent(in), target :: desc_a type(psb_dprec_type), intent(inout) :: prec integer, intent(out) :: info diff --git a/test/pargen/ppde.f90 b/test/pargen/ppde.f90 index cd43e08f..29b28a53 100644 --- a/test/pargen/ppde.f90 +++ b/test/pargen/ppde.f90 @@ -65,6 +65,7 @@ program ppde use psb_base_mod use psb_prec_mod use psb_krylov_mod + use psbn_d_mat_mod implicit none ! input parameters @@ -77,7 +78,8 @@ program ppde real(psb_dpk_) :: t1, t2, tprec ! sparse matrix and preconditioner - type(psb_dspmat_type) :: a + type(psbn_d_sparse_mat) :: a +!!$ type(psb_dspmat_type) :: a type(psb_dprec_type) :: prec ! descriptor type(psb_desc_type) :: desc_a @@ -176,7 +178,8 @@ program ppde t2 = psb_wtime() - t1 call psb_amx(ictxt,t2) - amatsize = psb_sizeof(a) +!!$ amatsize = psb_sizeof(a) + amatsize = 0 descsize = psb_sizeof(desc_a) precsize = psb_sizeof(prec) call psb_sum(ictxt,amatsize) @@ -343,14 +346,15 @@ contains ! Note that if a1=a2=a3=a4=0., the PDE is the well-known Laplace equation. ! use psb_base_mod + use psbn_d_mat_mod implicit none - integer :: idim - integer, parameter :: nb=20 - real(psb_dpk_), allocatable :: b(:),xv(:) - type(psb_desc_type) :: desc_a - integer :: ictxt, info - character :: afmt*5 - type(psb_dspmat_type) :: a + integer :: idim + integer, parameter :: nb=20 + real(psb_dpk_), allocatable :: b(:),xv(:) + type(psb_desc_type) :: desc_a + integer :: ictxt, info + character :: afmt*5 + type(psbn_d_sparse_mat) :: a real(psb_dpk_) :: zt(nb),glob_x,glob_y,glob_z integer :: m,n,nnz,glob_row,nlr,i,ii,ib,k integer :: x,y,z,ia,indx_owner @@ -359,6 +363,7 @@ contains integer, allocatable :: irow(:),icol(:),myidx(:) real(psb_dpk_), allocatable :: val(:) ! deltah dimension of each grid cell + ! deltat discretization time real(psb_dpk_) :: deltah real(psb_dpk_),parameter :: rhs=0.d0,one=1.d0,zero=0.d0 @@ -367,7 +372,7 @@ contains external :: a1, a2, a3, a4, b1, b2, b3 integer :: err_act - character(len=20) :: name, ch_err + character(len=20) :: name, ch_err,tmpfmt info = 0 name = 'create_matrix' @@ -612,8 +617,9 @@ contains call psb_amx(ictxt,tasb) call psb_amx(ictxt,ttot) if(iam == psb_root_) then + tmpfmt = a%get_fmt() write(*,'("The matrix has been generated and assembled in ",a3," format.")')& - & a%fida(1:3) + & tmpfmt write(*,'("-allocation time : ",es12.5)') talc write(*,'("-coeff. gen. time : ",es12.5)') tgen write(*,'("-assembly time : ",es12.5)') tasb diff --git a/test/pargen/runs/ppde.inp b/test/pargen/runs/ppde.inp index b0fb0482..e4e26360 100644 --- a/test/pargen/runs/ppde.inp +++ b/test/pargen/runs/ppde.inp @@ -1,9 +1,11 @@ 7 Number of entries below this BICGSTAB Iterative method BICGSTAB CGS BICG BICGSTABL RGMRES -BJAC Preconditioner NONE DIAG BJAC +NONE Preconditioner NONE DIAG BJAC CSR Storage format for matrix A: CSR COO JAD -060 Domain size (acutal system is this**3) +050 Domain size (acutal system is this**3) 1 Stopping criterion -200 MAXIT --1 ITRACE +1000 MAXIT +040 ITRACE 20 IRST restart for RGMRES and BiCGSTABL + + diff --git a/test/serial/d_coo_matgen.f03 b/test/serial/d_coo_matgen.f03 index 843f5719..18f199fd 100644 --- a/test/serial/d_coo_matgen.f03 +++ b/test/serial/d_coo_matgen.f03 @@ -357,7 +357,7 @@ contains endif end do - call acoo%csput(element-1,val,irow,icol,1,nr,1,nr,info) + call acoo%csput(element-1,irow,icol,val,1,nr,1,nr,info) end do diff --git a/test/serial/d_matgen.f03 b/test/serial/d_matgen.f03 index 2733fe41..7b587f5e 100644 --- a/test/serial/d_matgen.f03 +++ b/test/serial/d_matgen.f03 @@ -357,7 +357,7 @@ contains endif end do - call a_n%csput(element-1,val,irow,icol,1,nr,1,nr,info) + call a_n%csput(element-1,irow,icol,val,1,nr,1,nr,info) end do diff --git a/test/serial/psbn_d_cxx_mat_mod.f03 b/test/serial/psbn_d_cxx_mat_mod.f03 index 0d4414b6..89d42ed1 100644 --- a/test/serial/psbn_d_cxx_mat_mod.f03 +++ b/test/serial/psbn_d_cxx_mat_mod.f03 @@ -129,7 +129,7 @@ module psbn_d_cxx_mat_mod end interface interface - subroutine d_cxx_csput_impl(nz,val,ia,ja,a,imin,imax,jmin,jmax,info,gtl) + subroutine d_cxx_csput_impl(nz,ia,ja,val,a,imin,imax,jmin,jmax,info,gtl) use psb_const_mod import psbn_d_cxx_sparse_mat class(psbn_d_cxx_sparse_mat), intent(inout) :: a