diff --git a/base/tools/psb_c_map.f90 b/base/tools/psb_c_map.f90 index 796a6c2c..e043bd6c 100644 --- a/base/tools/psb_c_map.f90 +++ b/base/tools/psb_c_map.f90 @@ -183,7 +183,7 @@ subroutine psb_c_map_X2Y_vect(alpha,x,beta,y,map,info,work,vtx,vty) ptx => xt pty => yt end if - + call psb_geaxpby(cone,x,czero,ptx,map%desc_X,info) if (info == psb_success_) call psb_halo(ptx,map%desc_X,info,work=work) if (info == psb_success_) call psb_csmm(cone,map%map_X2Y,ptx,czero,pty,info) @@ -364,7 +364,7 @@ subroutine psb_c_map_Y2X_vect(alpha,x,beta,y,map,info,work,vtx,vty) pty => yt end if - call psb_geaxpby(cone,x,czero,ptx,map%desc_X,info) + call psb_geaxpby(cone,x,czero,ptx,map%desc_Y,info) if (info == psb_success_) call psb_halo(ptx,map%desc_Y,info,work=work) if (info == psb_success_) call psb_csmm(cone,map%map_Y2X,ptx,czero,pty,info) @@ -439,17 +439,30 @@ function psb_c_linmap(map_kind,desc_X, desc_Y, map_X2Y, map_Y2X,iaggr,naggr) & case(psb_map_gen_linear_) if (desc_X%is_ok()) then - call psb_cdcpy(desc_X, this%desc_X,info) + call desc_X%clone(this%desc_X,info) else info = psb_err_pivot_too_small_ endif if (desc_Y%is_ok()) then - call psb_cdcpy(desc_Y, this%desc_Y,info) + call desc_Y%clone(this%desc_Y,info) else info = psb_err_invalid_ovr_num_ endif - ! For a general linear map ignore iaggr,naggr - allocate(this%iaggr(0), this%naggr(0), stat=info) + ! If iaggr/naggr are present, copy them anyway. + if (present(iaggr)) then + if (.not.present(naggr)) then + info = 7 + else + allocate(this%iaggr(size(iaggr)),& + & this%naggr(size(naggr)), stat=info) + if (info == psb_success_) then + this%iaggr(:) = iaggr(:) + this%naggr(:) = naggr(:) + end if + end if + else + allocate(this%iaggr(0), this%naggr(0), stat=info) + end if case default write(psb_err_unit,*) 'Bad map kind into psb_linmap ',map_kind diff --git a/base/tools/psb_d_map.f90 b/base/tools/psb_d_map.f90 index 6f151921..8d3653a7 100644 --- a/base/tools/psb_d_map.f90 +++ b/base/tools/psb_d_map.f90 @@ -183,7 +183,7 @@ subroutine psb_d_map_X2Y_vect(alpha,x,beta,y,map,info,work,vtx,vty) ptx => xt pty => yt end if - + call psb_geaxpby(done,x,dzero,ptx,map%desc_X,info) if (info == psb_success_) call psb_halo(ptx,map%desc_X,info,work=work) if (info == psb_success_) call psb_csmm(done,map%map_X2Y,ptx,dzero,pty,info) @@ -364,7 +364,7 @@ subroutine psb_d_map_Y2X_vect(alpha,x,beta,y,map,info,work,vtx,vty) pty => yt end if - call psb_geaxpby(done,x,dzero,ptx,map%desc_X,info) + call psb_geaxpby(done,x,dzero,ptx,map%desc_Y,info) if (info == psb_success_) call psb_halo(ptx,map%desc_Y,info,work=work) if (info == psb_success_) call psb_csmm(done,map%map_Y2X,ptx,dzero,pty,info) @@ -439,17 +439,30 @@ function psb_d_linmap(map_kind,desc_X, desc_Y, map_X2Y, map_Y2X,iaggr,naggr) & case(psb_map_gen_linear_) if (desc_X%is_ok()) then - call psb_cdcpy(desc_X, this%desc_X,info) + call desc_X%clone(this%desc_X,info) else info = psb_err_pivot_too_small_ endif if (desc_Y%is_ok()) then - call psb_cdcpy(desc_Y, this%desc_Y,info) + call desc_Y%clone(this%desc_Y,info) else info = psb_err_invalid_ovr_num_ endif - ! For a general linear map ignore iaggr,naggr - allocate(this%iaggr(0), this%naggr(0), stat=info) + ! If iaggr/naggr are present, copy them anyway. + if (present(iaggr)) then + if (.not.present(naggr)) then + info = 7 + else + allocate(this%iaggr(size(iaggr)),& + & this%naggr(size(naggr)), stat=info) + if (info == psb_success_) then + this%iaggr(:) = iaggr(:) + this%naggr(:) = naggr(:) + end if + end if + else + allocate(this%iaggr(0), this%naggr(0), stat=info) + end if case default write(psb_err_unit,*) 'Bad map kind into psb_linmap ',map_kind diff --git a/base/tools/psb_s_map.f90 b/base/tools/psb_s_map.f90 index b5ea9b4f..14ac6da3 100644 --- a/base/tools/psb_s_map.f90 +++ b/base/tools/psb_s_map.f90 @@ -183,7 +183,7 @@ subroutine psb_s_map_X2Y_vect(alpha,x,beta,y,map,info,work,vtx,vty) ptx => xt pty => yt end if - + call psb_geaxpby(sone,x,szero,ptx,map%desc_X,info) if (info == psb_success_) call psb_halo(ptx,map%desc_X,info,work=work) if (info == psb_success_) call psb_csmm(sone,map%map_X2Y,ptx,szero,pty,info) @@ -364,7 +364,7 @@ subroutine psb_s_map_Y2X_vect(alpha,x,beta,y,map,info,work,vtx,vty) pty => yt end if - call psb_geaxpby(sone,x,szero,ptx,map%desc_X,info) + call psb_geaxpby(sone,x,szero,ptx,map%desc_Y,info) if (info == psb_success_) call psb_halo(ptx,map%desc_Y,info,work=work) if (info == psb_success_) call psb_csmm(sone,map%map_Y2X,ptx,szero,pty,info) @@ -439,17 +439,30 @@ function psb_s_linmap(map_kind,desc_X, desc_Y, map_X2Y, map_Y2X,iaggr,naggr) & case(psb_map_gen_linear_) if (desc_X%is_ok()) then - call psb_cdcpy(desc_X, this%desc_X,info) + call desc_X%clone(this%desc_X,info) else info = psb_err_pivot_too_small_ endif if (desc_Y%is_ok()) then - call psb_cdcpy(desc_Y, this%desc_Y,info) + call desc_Y%clone(this%desc_Y,info) else info = psb_err_invalid_ovr_num_ endif - ! For a general linear map ignore iaggr,naggr - allocate(this%iaggr(0), this%naggr(0), stat=info) + ! If iaggr/naggr are present, copy them anyway. + if (present(iaggr)) then + if (.not.present(naggr)) then + info = 7 + else + allocate(this%iaggr(size(iaggr)),& + & this%naggr(size(naggr)), stat=info) + if (info == psb_success_) then + this%iaggr(:) = iaggr(:) + this%naggr(:) = naggr(:) + end if + end if + else + allocate(this%iaggr(0), this%naggr(0), stat=info) + end if case default write(psb_err_unit,*) 'Bad map kind into psb_linmap ',map_kind diff --git a/base/tools/psb_z_map.f90 b/base/tools/psb_z_map.f90 index 53893f85..7018f3fa 100644 --- a/base/tools/psb_z_map.f90 +++ b/base/tools/psb_z_map.f90 @@ -183,7 +183,7 @@ subroutine psb_z_map_X2Y_vect(alpha,x,beta,y,map,info,work,vtx,vty) ptx => xt pty => yt end if - + call psb_geaxpby(zone,x,zzero,ptx,map%desc_X,info) if (info == psb_success_) call psb_halo(ptx,map%desc_X,info,work=work) if (info == psb_success_) call psb_csmm(zone,map%map_X2Y,ptx,zzero,pty,info) @@ -364,7 +364,7 @@ subroutine psb_z_map_Y2X_vect(alpha,x,beta,y,map,info,work,vtx,vty) pty => yt end if - call psb_geaxpby(zone,x,zzero,ptx,map%desc_X,info) + call psb_geaxpby(zone,x,zzero,ptx,map%desc_Y,info) if (info == psb_success_) call psb_halo(ptx,map%desc_Y,info,work=work) if (info == psb_success_) call psb_csmm(zone,map%map_Y2X,ptx,zzero,pty,info) @@ -439,17 +439,30 @@ function psb_z_linmap(map_kind,desc_X, desc_Y, map_X2Y, map_Y2X,iaggr,naggr) & case(psb_map_gen_linear_) if (desc_X%is_ok()) then - call psb_cdcpy(desc_X, this%desc_X,info) + call desc_X%clone(this%desc_X,info) else info = psb_err_pivot_too_small_ endif if (desc_Y%is_ok()) then - call psb_cdcpy(desc_Y, this%desc_Y,info) + call desc_Y%clone(this%desc_Y,info) else info = psb_err_invalid_ovr_num_ endif - ! For a general linear map ignore iaggr,naggr - allocate(this%iaggr(0), this%naggr(0), stat=info) + ! If iaggr/naggr are present, copy them anyway. + if (present(iaggr)) then + if (.not.present(naggr)) then + info = 7 + else + allocate(this%iaggr(size(iaggr)),& + & this%naggr(size(naggr)), stat=info) + if (info == psb_success_) then + this%iaggr(:) = iaggr(:) + this%naggr(:) = naggr(:) + end if + end if + else + allocate(this%iaggr(0), this%naggr(0), stat=info) + end if case default write(psb_err_unit,*) 'Bad map kind into psb_linmap ',map_kind