diff --git a/amgprec/amg_c_jac_smoother.f90 b/amgprec/amg_c_jac_smoother.f90 index 94229ff5..22fd5bef 100644 --- a/amgprec/amg_c_jac_smoother.f90 +++ b/amgprec/amg_c_jac_smoother.f90 @@ -345,7 +345,6 @@ contains if (allocated(sm%sv)) then call sm%sv%free(info) - if (info == psb_success_) deallocate(sm%sv,stat=info) if (info /= psb_success_) then info = psb_err_alloc_dealloc_ call psb_errpush(info,name) diff --git a/amgprec/amg_c_prec_type.f90 b/amgprec/amg_c_prec_type.f90 index 85e05366..578dcff0 100644 --- a/amgprec/amg_c_prec_type.f90 +++ b/amgprec/amg_c_prec_type.f90 @@ -665,6 +665,10 @@ contains info = psb_err_internal_error_; goto 9999 end if + ! + ! In the internals, do FREE on components, + ! but do not deallocate them + ! if (allocated(prec%precv)) then do i=1,size(prec%precv) call prec%precv(i)%free_smoothers(info) diff --git a/amgprec/amg_d_jac_smoother.f90 b/amgprec/amg_d_jac_smoother.f90 index fff8e22e..01f9d786 100644 --- a/amgprec/amg_d_jac_smoother.f90 +++ b/amgprec/amg_d_jac_smoother.f90 @@ -345,7 +345,6 @@ contains if (allocated(sm%sv)) then call sm%sv%free(info) - if (info == psb_success_) deallocate(sm%sv,stat=info) if (info /= psb_success_) then info = psb_err_alloc_dealloc_ call psb_errpush(info,name) diff --git a/amgprec/amg_d_poly_smoother.f90 b/amgprec/amg_d_poly_smoother.f90 index bd24b49a..7529c6d0 100644 --- a/amgprec/amg_d_poly_smoother.f90 +++ b/amgprec/amg_d_poly_smoother.f90 @@ -279,7 +279,6 @@ contains if (allocated(sm%sv)) then call sm%sv%free(info) - if (info == psb_success_) deallocate(sm%sv,stat=info) if (info /= psb_success_) then info = psb_err_alloc_dealloc_ call psb_errpush(info,name) diff --git a/amgprec/amg_d_prec_type.f90 b/amgprec/amg_d_prec_type.f90 index c7404e2d..805f73d5 100644 --- a/amgprec/amg_d_prec_type.f90 +++ b/amgprec/amg_d_prec_type.f90 @@ -665,6 +665,10 @@ contains info = psb_err_internal_error_; goto 9999 end if + ! + ! In the internals, do FREE on components, + ! but do not deallocate them + ! if (allocated(prec%precv)) then do i=1,size(prec%precv) call prec%precv(i)%free_smoothers(info) diff --git a/amgprec/amg_s_jac_smoother.f90 b/amgprec/amg_s_jac_smoother.f90 index 256f9ecc..8df800da 100644 --- a/amgprec/amg_s_jac_smoother.f90 +++ b/amgprec/amg_s_jac_smoother.f90 @@ -345,7 +345,6 @@ contains if (allocated(sm%sv)) then call sm%sv%free(info) - if (info == psb_success_) deallocate(sm%sv,stat=info) if (info /= psb_success_) then info = psb_err_alloc_dealloc_ call psb_errpush(info,name) diff --git a/amgprec/amg_s_poly_smoother.f90 b/amgprec/amg_s_poly_smoother.f90 index aa905aad..322f249e 100644 --- a/amgprec/amg_s_poly_smoother.f90 +++ b/amgprec/amg_s_poly_smoother.f90 @@ -279,7 +279,6 @@ contains if (allocated(sm%sv)) then call sm%sv%free(info) - if (info == psb_success_) deallocate(sm%sv,stat=info) if (info /= psb_success_) then info = psb_err_alloc_dealloc_ call psb_errpush(info,name) diff --git a/amgprec/amg_s_prec_type.f90 b/amgprec/amg_s_prec_type.f90 index 7d45e184..5a4a94dc 100644 --- a/amgprec/amg_s_prec_type.f90 +++ b/amgprec/amg_s_prec_type.f90 @@ -665,6 +665,10 @@ contains info = psb_err_internal_error_; goto 9999 end if + ! + ! In the internals, do FREE on components, + ! but do not deallocate them + ! if (allocated(prec%precv)) then do i=1,size(prec%precv) call prec%precv(i)%free_smoothers(info) diff --git a/amgprec/amg_z_jac_smoother.f90 b/amgprec/amg_z_jac_smoother.f90 index f698f95b..b1aa7d5a 100644 --- a/amgprec/amg_z_jac_smoother.f90 +++ b/amgprec/amg_z_jac_smoother.f90 @@ -345,7 +345,6 @@ contains if (allocated(sm%sv)) then call sm%sv%free(info) - if (info == psb_success_) deallocate(sm%sv,stat=info) if (info /= psb_success_) then info = psb_err_alloc_dealloc_ call psb_errpush(info,name) diff --git a/amgprec/amg_z_prec_type.f90 b/amgprec/amg_z_prec_type.f90 index dba1ab52..1db85845 100644 --- a/amgprec/amg_z_prec_type.f90 +++ b/amgprec/amg_z_prec_type.f90 @@ -665,6 +665,10 @@ contains info = psb_err_internal_error_; goto 9999 end if + ! + ! In the internals, do FREE on components, + ! but do not deallocate them + ! if (allocated(prec%precv)) then do i=1,size(prec%precv) call prec%precv(i)%free_smoothers(info) diff --git a/amgprec/impl/smoother/amg_c_as_smoother_free.f90 b/amgprec/impl/smoother/amg_c_as_smoother_free.f90 index f491fb4f..6f05f30e 100644 --- a/amgprec/impl/smoother/amg_c_as_smoother_free.f90 +++ b/amgprec/impl/smoother/amg_c_as_smoother_free.f90 @@ -53,7 +53,6 @@ subroutine amg_c_as_smoother_free(sm,info) if (allocated(sm%sv)) then call sm%sv%free(info) - if (info == psb_success_) deallocate(sm%sv,stat=info) if (info /= psb_success_) then info = psb_err_alloc_dealloc_ call psb_errpush(info,name) diff --git a/amgprec/impl/smoother/amg_c_base_smoother_free.f90 b/amgprec/impl/smoother/amg_c_base_smoother_free.f90 index d5a1882f..f3af2822 100644 --- a/amgprec/impl/smoother/amg_c_base_smoother_free.f90 +++ b/amgprec/impl/smoother/amg_c_base_smoother_free.f90 @@ -52,7 +52,6 @@ subroutine amg_c_base_smoother_free(sm,info) if (allocated(sm%sv)) then call sm%sv%free(info) - if (info == psb_success_) deallocate(sm%sv,stat=info) end if if (info /= psb_success_) then info = psb_err_alloc_dealloc_ diff --git a/amgprec/impl/smoother/amg_d_as_smoother_free.f90 b/amgprec/impl/smoother/amg_d_as_smoother_free.f90 index 55bf9355..5f06713c 100644 --- a/amgprec/impl/smoother/amg_d_as_smoother_free.f90 +++ b/amgprec/impl/smoother/amg_d_as_smoother_free.f90 @@ -53,7 +53,6 @@ subroutine amg_d_as_smoother_free(sm,info) if (allocated(sm%sv)) then call sm%sv%free(info) - if (info == psb_success_) deallocate(sm%sv,stat=info) if (info /= psb_success_) then info = psb_err_alloc_dealloc_ call psb_errpush(info,name) diff --git a/amgprec/impl/smoother/amg_d_base_smoother_free.f90 b/amgprec/impl/smoother/amg_d_base_smoother_free.f90 index fcbe41ba..056da6cc 100644 --- a/amgprec/impl/smoother/amg_d_base_smoother_free.f90 +++ b/amgprec/impl/smoother/amg_d_base_smoother_free.f90 @@ -52,7 +52,6 @@ subroutine amg_d_base_smoother_free(sm,info) if (allocated(sm%sv)) then call sm%sv%free(info) - if (info == psb_success_) deallocate(sm%sv,stat=info) end if if (info /= psb_success_) then info = psb_err_alloc_dealloc_ diff --git a/amgprec/impl/smoother/amg_s_as_smoother_free.f90 b/amgprec/impl/smoother/amg_s_as_smoother_free.f90 index 8b71ab0a..c23b86fb 100644 --- a/amgprec/impl/smoother/amg_s_as_smoother_free.f90 +++ b/amgprec/impl/smoother/amg_s_as_smoother_free.f90 @@ -53,7 +53,6 @@ subroutine amg_s_as_smoother_free(sm,info) if (allocated(sm%sv)) then call sm%sv%free(info) - if (info == psb_success_) deallocate(sm%sv,stat=info) if (info /= psb_success_) then info = psb_err_alloc_dealloc_ call psb_errpush(info,name) diff --git a/amgprec/impl/smoother/amg_s_base_smoother_free.f90 b/amgprec/impl/smoother/amg_s_base_smoother_free.f90 index cd626c27..8691f9d3 100644 --- a/amgprec/impl/smoother/amg_s_base_smoother_free.f90 +++ b/amgprec/impl/smoother/amg_s_base_smoother_free.f90 @@ -52,7 +52,6 @@ subroutine amg_s_base_smoother_free(sm,info) if (allocated(sm%sv)) then call sm%sv%free(info) - if (info == psb_success_) deallocate(sm%sv,stat=info) end if if (info /= psb_success_) then info = psb_err_alloc_dealloc_ diff --git a/amgprec/impl/smoother/amg_z_as_smoother_free.f90 b/amgprec/impl/smoother/amg_z_as_smoother_free.f90 index 08b23f50..36640bd6 100644 --- a/amgprec/impl/smoother/amg_z_as_smoother_free.f90 +++ b/amgprec/impl/smoother/amg_z_as_smoother_free.f90 @@ -53,7 +53,6 @@ subroutine amg_z_as_smoother_free(sm,info) if (allocated(sm%sv)) then call sm%sv%free(info) - if (info == psb_success_) deallocate(sm%sv,stat=info) if (info /= psb_success_) then info = psb_err_alloc_dealloc_ call psb_errpush(info,name) diff --git a/amgprec/impl/smoother/amg_z_base_smoother_free.f90 b/amgprec/impl/smoother/amg_z_base_smoother_free.f90 index 3cae112e..f1da5f3c 100644 --- a/amgprec/impl/smoother/amg_z_base_smoother_free.f90 +++ b/amgprec/impl/smoother/amg_z_base_smoother_free.f90 @@ -52,7 +52,6 @@ subroutine amg_z_base_smoother_free(sm,info) if (allocated(sm%sv)) then call sm%sv%free(info) - if (info == psb_success_) deallocate(sm%sv,stat=info) end if if (info /= psb_success_) then info = psb_err_alloc_dealloc_ diff --git a/amgprec/impl/solver/amg_c_diag_solver_bld.f90 b/amgprec/impl/solver/amg_c_diag_solver_bld.f90 index 3048605f..32252377 100644 --- a/amgprec/impl/solver/amg_c_diag_solver_bld.f90 +++ b/amgprec/impl/solver/amg_c_diag_solver_bld.f90 @@ -91,7 +91,7 @@ subroutine amg_c_diag_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold) sv%d(i) = cone/sv%d(i) end if end do - allocate(sv%dv,stat=info) + if (.not.allocated(sv%dv)) allocate(sv%dv,stat=info) if (info == psb_success_) then call sv%dv%bld(sv%d) if (present(vmold)) call sv%dv%cnv(vmold) @@ -172,7 +172,7 @@ subroutine amg_c_l1_diag_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold) sv%d(i) = cone/sv%d(i) end if end do - allocate(sv%dv,stat=info) + if (.not.allocated(sv%dv)) allocate(sv%dv,stat=info) if (info == psb_success_) then call sv%dv%bld(sv%d) if (present(vmold)) call sv%dv%cnv(vmold) diff --git a/amgprec/impl/solver/amg_c_jac_solver_bld.f90 b/amgprec/impl/solver/amg_c_jac_solver_bld.f90 index 2a55b8b5..b9d9bcd7 100644 --- a/amgprec/impl/solver/amg_c_jac_solver_bld.f90 +++ b/amgprec/impl/solver/amg_c_jac_solver_bld.f90 @@ -100,7 +100,7 @@ subroutine amg_c_jac_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold) sv%d(i) = cone/sv%d(i) end if end do - allocate(sv%dv,stat=info) + if (.not.allocated(sv%dv)) allocate(sv%dv,stat=info) if (info == psb_success_) then call sv%dv%bld(sv%d) if (present(vmold)) call sv%dv%cnv(vmold) diff --git a/amgprec/impl/solver/amg_c_l1_jac_solver_bld.f90 b/amgprec/impl/solver/amg_c_l1_jac_solver_bld.f90 index b83fe53d..809af437 100644 --- a/amgprec/impl/solver/amg_c_l1_jac_solver_bld.f90 +++ b/amgprec/impl/solver/amg_c_l1_jac_solver_bld.f90 @@ -103,7 +103,7 @@ subroutine amg_c_l1_jac_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold) sv%d(i) = cone/sv%d(i) end if end do - allocate(sv%dv,stat=info) + if (.not.allocated(sv%dv)) allocate(sv%dv,stat=info) if (info == psb_success_) then call sv%dv%bld(sv%d) if (present(vmold)) call sv%dv%cnv(vmold) diff --git a/amgprec/impl/solver/amg_d_diag_solver_bld.f90 b/amgprec/impl/solver/amg_d_diag_solver_bld.f90 index 77d34ce7..08c5d0b5 100644 --- a/amgprec/impl/solver/amg_d_diag_solver_bld.f90 +++ b/amgprec/impl/solver/amg_d_diag_solver_bld.f90 @@ -91,7 +91,7 @@ subroutine amg_d_diag_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold) sv%d(i) = done/sv%d(i) end if end do - allocate(sv%dv,stat=info) + if (.not.allocated(sv%dv)) allocate(sv%dv,stat=info) if (info == psb_success_) then call sv%dv%bld(sv%d) if (present(vmold)) call sv%dv%cnv(vmold) @@ -172,7 +172,7 @@ subroutine amg_d_l1_diag_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold) sv%d(i) = done/sv%d(i) end if end do - allocate(sv%dv,stat=info) + if (.not.allocated(sv%dv)) allocate(sv%dv,stat=info) if (info == psb_success_) then call sv%dv%bld(sv%d) if (present(vmold)) call sv%dv%cnv(vmold) diff --git a/amgprec/impl/solver/amg_d_jac_solver_bld.f90 b/amgprec/impl/solver/amg_d_jac_solver_bld.f90 index 1a8f9456..8660eaf2 100644 --- a/amgprec/impl/solver/amg_d_jac_solver_bld.f90 +++ b/amgprec/impl/solver/amg_d_jac_solver_bld.f90 @@ -100,7 +100,7 @@ subroutine amg_d_jac_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold) sv%d(i) = done/sv%d(i) end if end do - allocate(sv%dv,stat=info) + if (.not.allocated(sv%dv)) allocate(sv%dv,stat=info) if (info == psb_success_) then call sv%dv%bld(sv%d) if (present(vmold)) call sv%dv%cnv(vmold) diff --git a/amgprec/impl/solver/amg_d_l1_jac_solver_bld.f90 b/amgprec/impl/solver/amg_d_l1_jac_solver_bld.f90 index 3ba0dc4a..9cb47dbb 100644 --- a/amgprec/impl/solver/amg_d_l1_jac_solver_bld.f90 +++ b/amgprec/impl/solver/amg_d_l1_jac_solver_bld.f90 @@ -103,7 +103,7 @@ subroutine amg_d_l1_jac_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold) sv%d(i) = done/sv%d(i) end if end do - allocate(sv%dv,stat=info) + if (.not.allocated(sv%dv)) allocate(sv%dv,stat=info) if (info == psb_success_) then call sv%dv%bld(sv%d) if (present(vmold)) call sv%dv%cnv(vmold) diff --git a/amgprec/impl/solver/amg_s_diag_solver_bld.f90 b/amgprec/impl/solver/amg_s_diag_solver_bld.f90 index 9e678a00..3a6588a5 100644 --- a/amgprec/impl/solver/amg_s_diag_solver_bld.f90 +++ b/amgprec/impl/solver/amg_s_diag_solver_bld.f90 @@ -91,7 +91,7 @@ subroutine amg_s_diag_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold) sv%d(i) = sone/sv%d(i) end if end do - allocate(sv%dv,stat=info) + if (.not.allocated(sv%dv)) allocate(sv%dv,stat=info) if (info == psb_success_) then call sv%dv%bld(sv%d) if (present(vmold)) call sv%dv%cnv(vmold) @@ -172,7 +172,7 @@ subroutine amg_s_l1_diag_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold) sv%d(i) = sone/sv%d(i) end if end do - allocate(sv%dv,stat=info) + if (.not.allocated(sv%dv)) allocate(sv%dv,stat=info) if (info == psb_success_) then call sv%dv%bld(sv%d) if (present(vmold)) call sv%dv%cnv(vmold) diff --git a/amgprec/impl/solver/amg_s_jac_solver_bld.f90 b/amgprec/impl/solver/amg_s_jac_solver_bld.f90 index 2486b017..2ae080e9 100644 --- a/amgprec/impl/solver/amg_s_jac_solver_bld.f90 +++ b/amgprec/impl/solver/amg_s_jac_solver_bld.f90 @@ -100,7 +100,7 @@ subroutine amg_s_jac_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold) sv%d(i) = sone/sv%d(i) end if end do - allocate(sv%dv,stat=info) + if (.not.allocated(sv%dv)) allocate(sv%dv,stat=info) if (info == psb_success_) then call sv%dv%bld(sv%d) if (present(vmold)) call sv%dv%cnv(vmold) diff --git a/amgprec/impl/solver/amg_s_l1_jac_solver_bld.f90 b/amgprec/impl/solver/amg_s_l1_jac_solver_bld.f90 index 6cfff1e9..b90b9df2 100644 --- a/amgprec/impl/solver/amg_s_l1_jac_solver_bld.f90 +++ b/amgprec/impl/solver/amg_s_l1_jac_solver_bld.f90 @@ -103,7 +103,7 @@ subroutine amg_s_l1_jac_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold) sv%d(i) = sone/sv%d(i) end if end do - allocate(sv%dv,stat=info) + if (.not.allocated(sv%dv)) allocate(sv%dv,stat=info) if (info == psb_success_) then call sv%dv%bld(sv%d) if (present(vmold)) call sv%dv%cnv(vmold) diff --git a/amgprec/impl/solver/amg_z_diag_solver_bld.f90 b/amgprec/impl/solver/amg_z_diag_solver_bld.f90 index ef743861..aaf5ef97 100644 --- a/amgprec/impl/solver/amg_z_diag_solver_bld.f90 +++ b/amgprec/impl/solver/amg_z_diag_solver_bld.f90 @@ -91,7 +91,7 @@ subroutine amg_z_diag_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold) sv%d(i) = zone/sv%d(i) end if end do - allocate(sv%dv,stat=info) + if (.not.allocated(sv%dv)) allocate(sv%dv,stat=info) if (info == psb_success_) then call sv%dv%bld(sv%d) if (present(vmold)) call sv%dv%cnv(vmold) @@ -172,7 +172,7 @@ subroutine amg_z_l1_diag_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold) sv%d(i) = zone/sv%d(i) end if end do - allocate(sv%dv,stat=info) + if (.not.allocated(sv%dv)) allocate(sv%dv,stat=info) if (info == psb_success_) then call sv%dv%bld(sv%d) if (present(vmold)) call sv%dv%cnv(vmold) diff --git a/amgprec/impl/solver/amg_z_jac_solver_bld.f90 b/amgprec/impl/solver/amg_z_jac_solver_bld.f90 index 4185e069..26b6015c 100644 --- a/amgprec/impl/solver/amg_z_jac_solver_bld.f90 +++ b/amgprec/impl/solver/amg_z_jac_solver_bld.f90 @@ -100,7 +100,7 @@ subroutine amg_z_jac_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold) sv%d(i) = zone/sv%d(i) end if end do - allocate(sv%dv,stat=info) + if (.not.allocated(sv%dv)) allocate(sv%dv,stat=info) if (info == psb_success_) then call sv%dv%bld(sv%d) if (present(vmold)) call sv%dv%cnv(vmold) diff --git a/amgprec/impl/solver/amg_z_l1_jac_solver_bld.f90 b/amgprec/impl/solver/amg_z_l1_jac_solver_bld.f90 index febe2c3a..be333796 100644 --- a/amgprec/impl/solver/amg_z_l1_jac_solver_bld.f90 +++ b/amgprec/impl/solver/amg_z_l1_jac_solver_bld.f90 @@ -103,7 +103,7 @@ subroutine amg_z_l1_jac_solver_bld(a,desc_a,sv,info,b,amold,vmold,imold) sv%d(i) = zone/sv%d(i) end if end do - allocate(sv%dv,stat=info) + if (.not.allocated(sv%dv)) allocate(sv%dv,stat=info) if (info == psb_success_) then call sv%dv%bld(sv%d) if (present(vmold)) call sv%dv%cnv(vmold)