diff --git a/base/tools/psb_c_map.f90 b/base/tools/psb_c_map.f90 index b0c2b99c..88745c4d 100644 --- a/base/tools/psb_c_map.f90 +++ b/base/tools/psb_c_map.f90 @@ -448,8 +448,21 @@ function psb_c_linmap(map_kind,desc_X, desc_Y, map_X2Y, map_Y2X,iaggr,naggr) & 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 7b459de5..823743c8 100644 --- a/base/tools/psb_s_map.f90 +++ b/base/tools/psb_s_map.f90 @@ -448,8 +448,21 @@ function psb_s_linmap(map_kind,desc_X, desc_Y, map_X2Y, map_Y2X,iaggr,naggr) & 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 493c4450..3e31beff 100644 --- a/base/tools/psb_z_map.f90 +++ b/base/tools/psb_z_map.f90 @@ -448,8 +448,21 @@ function psb_z_linmap(map_kind,desc_X, desc_Y, map_X2Y, map_Y2X,iaggr,naggr) & 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