diff --git a/mlprec/mld_c_slu_solver.F90 b/mlprec/mld_c_slu_solver.F90 index 8dcf6a9c..5f324d96 100644 --- a/mlprec/mld_c_slu_solver.F90 +++ b/mlprec/mld_c_slu_solver.F90 @@ -67,6 +67,7 @@ module mld_c_slu_solver procedure, pass(sv) :: apply_a => c_slu_solver_apply procedure, pass(sv) :: apply_v => c_slu_solver_apply_vect procedure, pass(sv) :: free => c_slu_solver_free + procedure, pass(sv) :: clear_data => c_slu_solver_clear_data procedure, pass(sv) :: descr => c_slu_solver_descr procedure, pass(sv) :: sizeof => c_slu_solver_sizeof procedure, nopass :: get_fmt => c_slu_solver_get_fmt @@ -80,7 +81,8 @@ module mld_c_slu_solver private :: c_slu_solver_bld, c_slu_solver_apply, & & c_slu_solver_free, c_slu_solver_descr, & & c_slu_solver_sizeof, c_slu_solver_apply_vect, & - & c_slu_solver_get_fmt, c_slu_solver_get_id + & c_slu_solver_get_fmt, c_slu_solver_get_id, & + & c_slu_solver_clear_data #if defined(HAVE_FINAL) private :: c_slu_solver_finalize #endif @@ -333,8 +335,9 @@ contains call psb_erractionsave(err_act) info = psb_success_ - if (c_associated(sv%lufactors)) info = mld_cslu_free(sv%lufactors) - sv%lufactors = c_null_ptr + + call sv%clear_data(info) + if (info /= psb_success_) goto 9999 call psb_erractionrestore(err_act) @@ -344,6 +347,30 @@ contains return end subroutine c_slu_solver_free + subroutine c_slu_solver_clear_data(sv,info) + + Implicit None + + ! Arguments + class(mld_c_slu_solver_type), intent(inout) :: sv + integer, intent(out) :: info + Integer :: err_act + character(len=20) :: name='c_slu_solver_clear_data' + + call psb_erractionsave(err_act) + + info = psb_success_ + if (c_associated(sv%lufactors)) info = mld_cslu_free(sv%lufactors) + sv%lufactors = c_null_ptr + if (info /= psb_success_) goto 9999 + + call psb_erractionrestore(err_act) + return + +9999 call psb_error_handler(err_act) + return + end subroutine c_slu_solver_clear_data + #if defined(HAVE_FINAL) subroutine c_slu_solver_finalize(sv) diff --git a/mlprec/mld_d_slu_solver.F90 b/mlprec/mld_d_slu_solver.F90 index 8c27650f..e203ca8d 100644 --- a/mlprec/mld_d_slu_solver.F90 +++ b/mlprec/mld_d_slu_solver.F90 @@ -67,6 +67,7 @@ module mld_d_slu_solver procedure, pass(sv) :: apply_a => d_slu_solver_apply procedure, pass(sv) :: apply_v => d_slu_solver_apply_vect procedure, pass(sv) :: free => d_slu_solver_free + procedure, pass(sv) :: clear_data => d_slu_solver_clear_data procedure, pass(sv) :: descr => d_slu_solver_descr procedure, pass(sv) :: sizeof => d_slu_solver_sizeof procedure, nopass :: get_fmt => d_slu_solver_get_fmt @@ -80,7 +81,8 @@ module mld_d_slu_solver private :: d_slu_solver_bld, d_slu_solver_apply, & & d_slu_solver_free, d_slu_solver_descr, & & d_slu_solver_sizeof, d_slu_solver_apply_vect, & - & d_slu_solver_get_fmt, d_slu_solver_get_id + & d_slu_solver_get_fmt, d_slu_solver_get_id, & + & d_slu_solver_clear_data #if defined(HAVE_FINAL) private :: d_slu_solver_finalize #endif @@ -333,8 +335,9 @@ contains call psb_erractionsave(err_act) info = psb_success_ - if (c_associated(sv%lufactors)) info = mld_dslu_free(sv%lufactors) - sv%lufactors = c_null_ptr + + call sv%clear_data(info) + if (info /= psb_success_) goto 9999 call psb_erractionrestore(err_act) @@ -344,6 +347,30 @@ contains return end subroutine d_slu_solver_free + subroutine d_slu_solver_clear_data(sv,info) + + Implicit None + + ! Arguments + class(mld_d_slu_solver_type), intent(inout) :: sv + integer, intent(out) :: info + Integer :: err_act + character(len=20) :: name='d_slu_solver_clear_data' + + call psb_erractionsave(err_act) + + info = psb_success_ + if (c_associated(sv%lufactors)) info = mld_dslu_free(sv%lufactors) + sv%lufactors = c_null_ptr + if (info /= psb_success_) goto 9999 + + call psb_erractionrestore(err_act) + return + +9999 call psb_error_handler(err_act) + return + end subroutine d_slu_solver_clear_data + #if defined(HAVE_FINAL) subroutine d_slu_solver_finalize(sv) diff --git a/mlprec/mld_d_sludist_solver.F90 b/mlprec/mld_d_sludist_solver.F90 index 52f4cd2c..74328f5b 100644 --- a/mlprec/mld_d_sludist_solver.F90 +++ b/mlprec/mld_d_sludist_solver.F90 @@ -66,6 +66,7 @@ module mld_d_sludist_solver procedure, pass(sv) :: apply_a => d_sludist_solver_apply procedure, pass(sv) :: apply_v => d_sludist_solver_apply_vect procedure, pass(sv) :: free => d_sludist_solver_free + procedure, pass(sv) :: clear_data => d_sludist_solver_clear_data procedure, pass(sv) :: descr => d_sludist_solver_descr procedure, pass(sv) :: sizeof => d_sludist_solver_sizeof procedure, nopass :: get_fmt => d_sludist_solver_get_fmt @@ -81,7 +82,7 @@ module mld_d_sludist_solver & d_sludist_solver_free, d_sludist_solver_descr, & & d_sludist_solver_sizeof, d_sludist_solver_apply_vect, & & d_sludist_solver_get_fmt, d_sludist_solver_get_id, & - & d_sludist_solver_is_global + & d_sludist_solver_is_global, d_sludist_solver_clear_data #if defined(HAVE_FINAL) private :: d_sludist_solver_finalize #endif @@ -341,6 +342,29 @@ contains Integer :: err_act character(len=20) :: name='d_sludist_solver_free' + call psb_erractionsave(err_act) + info = 0 + call sv%clear_data(info) + + if (info /= psb_success_) goto 9999 + + call psb_erractionrestore(err_act) + return + +9999 call psb_error_handler(err_act) + return + end subroutine d_sludist_solver_free + + subroutine d_sludist_solver_clear_data(sv,info) + + Implicit None + + ! Arguments + class(mld_d_sludist_solver_type), intent(inout) :: sv + integer, intent(out) :: info + Integer :: err_act + character(len=20) :: name='d_sludist_solver_clear_data' + call psb_erractionsave(err_act) info = psb_success_ @@ -354,7 +378,7 @@ contains 9999 call psb_error_handler(err_act) return - end subroutine d_sludist_solver_free + end subroutine d_sludist_solver_clear_data ! function d_sludist_solver_is_global(sv) result(val) diff --git a/mlprec/mld_s_slu_solver.F90 b/mlprec/mld_s_slu_solver.F90 index 99df4592..266ad4ac 100644 --- a/mlprec/mld_s_slu_solver.F90 +++ b/mlprec/mld_s_slu_solver.F90 @@ -67,6 +67,7 @@ module mld_s_slu_solver procedure, pass(sv) :: apply_a => s_slu_solver_apply procedure, pass(sv) :: apply_v => s_slu_solver_apply_vect procedure, pass(sv) :: free => s_slu_solver_free + procedure, pass(sv) :: clear_data => s_slu_solver_clear_data procedure, pass(sv) :: descr => s_slu_solver_descr procedure, pass(sv) :: sizeof => s_slu_solver_sizeof procedure, nopass :: get_fmt => s_slu_solver_get_fmt @@ -80,7 +81,8 @@ module mld_s_slu_solver private :: s_slu_solver_bld, s_slu_solver_apply, & & s_slu_solver_free, s_slu_solver_descr, & & s_slu_solver_sizeof, s_slu_solver_apply_vect, & - & s_slu_solver_get_fmt, s_slu_solver_get_id + & s_slu_solver_get_fmt, s_slu_solver_get_id, & + & s_slu_solver_clear_data #if defined(HAVE_FINAL) private :: s_slu_solver_finalize #endif @@ -333,8 +335,9 @@ contains call psb_erractionsave(err_act) info = psb_success_ - if (c_associated(sv%lufactors)) info = mld_sslu_free(sv%lufactors) - sv%lufactors = c_null_ptr + + call sv%clear_data(info) + if (info /= psb_success_) goto 9999 call psb_erractionrestore(err_act) @@ -344,6 +347,30 @@ contains return end subroutine s_slu_solver_free + subroutine s_slu_solver_clear_data(sv,info) + + Implicit None + + ! Arguments + class(mld_s_slu_solver_type), intent(inout) :: sv + integer, intent(out) :: info + Integer :: err_act + character(len=20) :: name='s_slu_solver_clear_data' + + call psb_erractionsave(err_act) + + info = psb_success_ + if (c_associated(sv%lufactors)) info = mld_sslu_free(sv%lufactors) + sv%lufactors = c_null_ptr + if (info /= psb_success_) goto 9999 + + call psb_erractionrestore(err_act) + return + +9999 call psb_error_handler(err_act) + return + end subroutine s_slu_solver_clear_data + #if defined(HAVE_FINAL) subroutine s_slu_solver_finalize(sv) diff --git a/mlprec/mld_z_slu_solver.F90 b/mlprec/mld_z_slu_solver.F90 index 7c329682..0d6483eb 100644 --- a/mlprec/mld_z_slu_solver.F90 +++ b/mlprec/mld_z_slu_solver.F90 @@ -67,6 +67,7 @@ module mld_z_slu_solver procedure, pass(sv) :: apply_a => z_slu_solver_apply procedure, pass(sv) :: apply_v => z_slu_solver_apply_vect procedure, pass(sv) :: free => z_slu_solver_free + procedure, pass(sv) :: clear_data => z_slu_solver_clear_data procedure, pass(sv) :: descr => z_slu_solver_descr procedure, pass(sv) :: sizeof => z_slu_solver_sizeof procedure, nopass :: get_fmt => z_slu_solver_get_fmt @@ -80,7 +81,8 @@ module mld_z_slu_solver private :: z_slu_solver_bld, z_slu_solver_apply, & & z_slu_solver_free, z_slu_solver_descr, & & z_slu_solver_sizeof, z_slu_solver_apply_vect, & - & z_slu_solver_get_fmt, z_slu_solver_get_id + & z_slu_solver_get_fmt, z_slu_solver_get_id, & + & z_slu_solver_clear_data #if defined(HAVE_FINAL) private :: z_slu_solver_finalize #endif @@ -333,8 +335,9 @@ contains call psb_erractionsave(err_act) info = psb_success_ - if (c_associated(sv%lufactors)) info = mld_zslu_free(sv%lufactors) - sv%lufactors = c_null_ptr + + call sv%clear_data(info) + if (info /= psb_success_) goto 9999 call psb_erractionrestore(err_act) @@ -344,6 +347,30 @@ contains return end subroutine z_slu_solver_free + subroutine z_slu_solver_clear_data(sv,info) + + Implicit None + + ! Arguments + class(mld_z_slu_solver_type), intent(inout) :: sv + integer, intent(out) :: info + Integer :: err_act + character(len=20) :: name='z_slu_solver_clear_data' + + call psb_erractionsave(err_act) + + info = psb_success_ + if (c_associated(sv%lufactors)) info = mld_zslu_free(sv%lufactors) + sv%lufactors = c_null_ptr + if (info /= psb_success_) goto 9999 + + call psb_erractionrestore(err_act) + return + +9999 call psb_error_handler(err_act) + return + end subroutine z_slu_solver_clear_data + #if defined(HAVE_FINAL) subroutine z_slu_solver_finalize(sv) diff --git a/mlprec/mld_z_sludist_solver.F90 b/mlprec/mld_z_sludist_solver.F90 index 2b2cece7..ffe73637 100644 --- a/mlprec/mld_z_sludist_solver.F90 +++ b/mlprec/mld_z_sludist_solver.F90 @@ -66,6 +66,7 @@ module mld_z_sludist_solver procedure, pass(sv) :: apply_a => z_sludist_solver_apply procedure, pass(sv) :: apply_v => z_sludist_solver_apply_vect procedure, pass(sv) :: free => z_sludist_solver_free + procedure, pass(sv) :: clear_data => z_sludist_solver_clear_data procedure, pass(sv) :: descr => z_sludist_solver_descr procedure, pass(sv) :: sizeof => z_sludist_solver_sizeof procedure, nopass :: get_fmt => z_sludist_solver_get_fmt @@ -81,7 +82,7 @@ module mld_z_sludist_solver & z_sludist_solver_free, z_sludist_solver_descr, & & z_sludist_solver_sizeof, z_sludist_solver_apply_vect, & & z_sludist_solver_get_fmt, z_sludist_solver_get_id, & - & z_sludist_solver_is_global + & z_sludist_solver_is_global, z_sludist_solver_clear_data #if defined(HAVE_FINAL) private :: z_sludist_solver_finalize #endif @@ -341,6 +342,29 @@ contains Integer :: err_act character(len=20) :: name='z_sludist_solver_free' + call psb_erractionsave(err_act) + info = 0 + call sv%clear_data(info) + + if (info /= psb_success_) goto 9999 + + call psb_erractionrestore(err_act) + return + +9999 call psb_error_handler(err_act) + return + end subroutine z_sludist_solver_free + + subroutine z_sludist_solver_clear_data(sv,info) + + Implicit None + + ! Arguments + class(mld_z_sludist_solver_type), intent(inout) :: sv + integer, intent(out) :: info + Integer :: err_act + character(len=20) :: name='z_sludist_solver_clear_data' + call psb_erractionsave(err_act) info = psb_success_ @@ -354,7 +378,7 @@ contains 9999 call psb_error_handler(err_act) return - end subroutine z_sludist_solver_free + end subroutine z_sludist_solver_clear_data ! function z_sludist_solver_is_global(sv) result(val)