From 07a2a97b13ce3dc6eb646d273902de9287e98f91 Mon Sep 17 00:00:00 2001 From: Salvatore Filippone Date: Tue, 12 May 2020 17:18:11 +0200 Subject: [PATCH] Added clear_data to diag solver --- mlprec/impl/solver/Makefile | 4 ++ .../solver/mld_c_diag_solver_clear_data.f90 | 65 +++++++++++++++++++ .../solver/mld_d_diag_solver_clear_data.f90 | 65 +++++++++++++++++++ .../solver/mld_s_diag_solver_clear_data.f90 | 65 +++++++++++++++++++ .../solver/mld_z_diag_solver_clear_data.f90 | 65 +++++++++++++++++++ mlprec/mld_c_diag_solver.f90 | 14 ++++ mlprec/mld_d_diag_solver.f90 | 14 ++++ mlprec/mld_s_diag_solver.f90 | 14 ++++ mlprec/mld_z_diag_solver.f90 | 14 ++++ 9 files changed, 320 insertions(+) create mode 100644 mlprec/impl/solver/mld_c_diag_solver_clear_data.f90 create mode 100644 mlprec/impl/solver/mld_d_diag_solver_clear_data.f90 create mode 100644 mlprec/impl/solver/mld_s_diag_solver_clear_data.f90 create mode 100644 mlprec/impl/solver/mld_z_diag_solver_clear_data.f90 diff --git a/mlprec/impl/solver/Makefile b/mlprec/impl/solver/Makefile index 7091fc90..b201dbc3 100644 --- a/mlprec/impl/solver/Makefile +++ b/mlprec/impl/solver/Makefile @@ -26,6 +26,7 @@ mld_c_diag_solver_apply_vect.o \ mld_c_diag_solver_bld.o \ mld_c_diag_solver_dmp.o \ mld_c_diag_solver_clone.o \ +mld_c_diag_solver_clear_data.o \ mld_c_diag_solver_cnv.o \ mld_c_gs_solver_bld.o \ mld_c_gs_solver_clone.o \ @@ -70,6 +71,7 @@ mld_d_diag_solver_apply_vect.o \ mld_d_diag_solver_bld.o \ mld_d_diag_solver_dmp.o \ mld_d_diag_solver_clone.o \ +mld_d_diag_solver_clear_data.o \ mld_d_diag_solver_cnv.o \ mld_d_bwgs_solver_bld.o \ mld_d_bwgs_solver_apply.o \ @@ -114,6 +116,7 @@ mld_s_diag_solver_apply_vect.o \ mld_s_diag_solver_bld.o \ mld_s_diag_solver_dmp.o \ mld_s_diag_solver_clone.o \ +mld_s_diag_solver_clear_data.o \ mld_s_diag_solver_cnv.o \ mld_s_gs_solver_bld.o \ mld_s_gs_solver_clone.o \ @@ -158,6 +161,7 @@ mld_z_diag_solver_apply_vect.o \ mld_z_diag_solver_bld.o \ mld_z_diag_solver_dmp.o \ mld_z_diag_solver_clone.o \ +mld_z_diag_solver_clear_data.o \ mld_z_diag_solver_cnv.o \ mld_z_gs_solver_bld.o \ mld_z_gs_solver_clone.o \ diff --git a/mlprec/impl/solver/mld_c_diag_solver_clear_data.f90 b/mlprec/impl/solver/mld_c_diag_solver_clear_data.f90 new file mode 100644 index 00000000..fcf4f5bf --- /dev/null +++ b/mlprec/impl/solver/mld_c_diag_solver_clear_data.f90 @@ -0,0 +1,65 @@ +! +! +! MLD2P4 version 2.2 +! MultiLevel Domain Decomposition Parallel Preconditioners Package +! based on PSBLAS (Parallel Sparse BLAS version 3.5) +! +! (C) Copyright 2008-2018 +! +! Salvatore Filippone +! Pasqua D'Ambra +! Daniela di Serafino +! +! Redistribution and use in source and binary forms, with or without +! modification, are permitted provided that the following conditions +! are met: +! 1. Redistributions of source code must retain the above copyright +! notice, this list of conditions and the following disclaimer. +! 2. Redistributions in binary form must reproduce the above copyright +! notice, this list of conditions, and the following disclaimer in the +! documentation and/or other materials provided with the distribution. +! 3. The name of the MLD2P4 group or the names of its contributors may +! not be used to endorse or promote products derived from this +! software without specific written permission. +! +! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE MLD2P4 GROUP OR ITS CONTRIBUTORS +! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +! POSSIBILITY OF SUCH DAMAGE. +! +! +subroutine mld_c_diag_solver_clear_data(sv,info) + + use psb_base_mod + use mld_c_diag_solver, mld_protect_name => mld_c_diag_solver_clear_data + + Implicit None + + ! Arguments + class(mld_c_diag_solver_type), intent(inout) :: sv + integer(psb_ipk_), intent(out) :: info + ! Local variables + integer(psb_ipk_) :: err_act + + info=psb_success_ + call psb_erractionsave(err_act) + + call sv%dv%free(info) + if ((info ==0).and.allocated(sv%d)) deallocate(sv%d,stat=info) + + if (info /= 0) goto 9999 + + call psb_erractionrestore(err_act) + return + +9999 call psb_error_handler(err_act) + + return +end subroutine mld_c_diag_solver_clear_data diff --git a/mlprec/impl/solver/mld_d_diag_solver_clear_data.f90 b/mlprec/impl/solver/mld_d_diag_solver_clear_data.f90 new file mode 100644 index 00000000..5e246265 --- /dev/null +++ b/mlprec/impl/solver/mld_d_diag_solver_clear_data.f90 @@ -0,0 +1,65 @@ +! +! +! MLD2P4 version 2.2 +! MultiLevel Domain Decomposition Parallel Preconditioners Package +! based on PSBLAS (Parallel Sparse BLAS version 3.5) +! +! (C) Copyright 2008-2018 +! +! Salvatore Filippone +! Pasqua D'Ambra +! Daniela di Serafino +! +! Redistribution and use in source and binary forms, with or without +! modification, are permitted provided that the following conditions +! are met: +! 1. Redistributions of source code must retain the above copyright +! notice, this list of conditions and the following disclaimer. +! 2. Redistributions in binary form must reproduce the above copyright +! notice, this list of conditions, and the following disclaimer in the +! documentation and/or other materials provided with the distribution. +! 3. The name of the MLD2P4 group or the names of its contributors may +! not be used to endorse or promote products derived from this +! software without specific written permission. +! +! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE MLD2P4 GROUP OR ITS CONTRIBUTORS +! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +! POSSIBILITY OF SUCH DAMAGE. +! +! +subroutine mld_d_diag_solver_clear_data(sv,info) + + use psb_base_mod + use mld_d_diag_solver, mld_protect_name => mld_d_diag_solver_clear_data + + Implicit None + + ! Arguments + class(mld_d_diag_solver_type), intent(inout) :: sv + integer(psb_ipk_), intent(out) :: info + ! Local variables + integer(psb_ipk_) :: err_act + + info=psb_success_ + call psb_erractionsave(err_act) + + call sv%dv%free(info) + if ((info ==0).and.allocated(sv%d)) deallocate(sv%d,stat=info) + + if (info /= 0) goto 9999 + + call psb_erractionrestore(err_act) + return + +9999 call psb_error_handler(err_act) + + return +end subroutine mld_d_diag_solver_clear_data diff --git a/mlprec/impl/solver/mld_s_diag_solver_clear_data.f90 b/mlprec/impl/solver/mld_s_diag_solver_clear_data.f90 new file mode 100644 index 00000000..83d0c6ac --- /dev/null +++ b/mlprec/impl/solver/mld_s_diag_solver_clear_data.f90 @@ -0,0 +1,65 @@ +! +! +! MLD2P4 version 2.2 +! MultiLevel Domain Decomposition Parallel Preconditioners Package +! based on PSBLAS (Parallel Sparse BLAS version 3.5) +! +! (C) Copyright 2008-2018 +! +! Salvatore Filippone +! Pasqua D'Ambra +! Daniela di Serafino +! +! Redistribution and use in source and binary forms, with or without +! modification, are permitted provided that the following conditions +! are met: +! 1. Redistributions of source code must retain the above copyright +! notice, this list of conditions and the following disclaimer. +! 2. Redistributions in binary form must reproduce the above copyright +! notice, this list of conditions, and the following disclaimer in the +! documentation and/or other materials provided with the distribution. +! 3. The name of the MLD2P4 group or the names of its contributors may +! not be used to endorse or promote products derived from this +! software without specific written permission. +! +! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE MLD2P4 GROUP OR ITS CONTRIBUTORS +! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +! POSSIBILITY OF SUCH DAMAGE. +! +! +subroutine mld_s_diag_solver_clear_data(sv,info) + + use psb_base_mod + use mld_s_diag_solver, mld_protect_name => mld_s_diag_solver_clear_data + + Implicit None + + ! Arguments + class(mld_s_diag_solver_type), intent(inout) :: sv + integer(psb_ipk_), intent(out) :: info + ! Local variables + integer(psb_ipk_) :: err_act + + info=psb_success_ + call psb_erractionsave(err_act) + + call sv%dv%free(info) + if ((info ==0).and.allocated(sv%d)) deallocate(sv%d,stat=info) + + if (info /= 0) goto 9999 + + call psb_erractionrestore(err_act) + return + +9999 call psb_error_handler(err_act) + + return +end subroutine mld_s_diag_solver_clear_data diff --git a/mlprec/impl/solver/mld_z_diag_solver_clear_data.f90 b/mlprec/impl/solver/mld_z_diag_solver_clear_data.f90 new file mode 100644 index 00000000..59add192 --- /dev/null +++ b/mlprec/impl/solver/mld_z_diag_solver_clear_data.f90 @@ -0,0 +1,65 @@ +! +! +! MLD2P4 version 2.2 +! MultiLevel Domain Decomposition Parallel Preconditioners Package +! based on PSBLAS (Parallel Sparse BLAS version 3.5) +! +! (C) Copyright 2008-2018 +! +! Salvatore Filippone +! Pasqua D'Ambra +! Daniela di Serafino +! +! Redistribution and use in source and binary forms, with or without +! modification, are permitted provided that the following conditions +! are met: +! 1. Redistributions of source code must retain the above copyright +! notice, this list of conditions and the following disclaimer. +! 2. Redistributions in binary form must reproduce the above copyright +! notice, this list of conditions, and the following disclaimer in the +! documentation and/or other materials provided with the distribution. +! 3. The name of the MLD2P4 group or the names of its contributors may +! not be used to endorse or promote products derived from this +! software without specific written permission. +! +! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE MLD2P4 GROUP OR ITS CONTRIBUTORS +! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +! POSSIBILITY OF SUCH DAMAGE. +! +! +subroutine mld_z_diag_solver_clear_data(sv,info) + + use psb_base_mod + use mld_z_diag_solver, mld_protect_name => mld_z_diag_solver_clear_data + + Implicit None + + ! Arguments + class(mld_z_diag_solver_type), intent(inout) :: sv + integer(psb_ipk_), intent(out) :: info + ! Local variables + integer(psb_ipk_) :: err_act + + info=psb_success_ + call psb_erractionsave(err_act) + + call sv%dv%free(info) + if ((info ==0).and.allocated(sv%d)) deallocate(sv%d,stat=info) + + if (info /= 0) goto 9999 + + call psb_erractionrestore(err_act) + return + +9999 call psb_error_handler(err_act) + + return +end subroutine mld_z_diag_solver_clear_data diff --git a/mlprec/mld_c_diag_solver.f90 b/mlprec/mld_c_diag_solver.f90 index 97124f10..5f8c738d 100644 --- a/mlprec/mld_c_diag_solver.f90 +++ b/mlprec/mld_c_diag_solver.f90 @@ -58,6 +58,7 @@ module mld_c_diag_solver procedure, pass(sv) :: build => mld_c_diag_solver_bld procedure, pass(sv) :: cnv => mld_c_diag_solver_cnv procedure, pass(sv) :: clone => mld_c_diag_solver_clone + procedure, pass(sv) :: clear_data => mld_c_diag_solver_clear_data procedure, pass(sv) :: apply_v => mld_c_diag_solver_apply_vect procedure, pass(sv) :: apply_a => mld_c_diag_solver_apply procedure, pass(sv) :: free => c_diag_solver_free @@ -169,6 +170,19 @@ module mld_c_diag_solver integer(psb_ipk_), intent(out) :: info end subroutine mld_c_diag_solver_clone end interface + + interface + subroutine mld_c_diag_solver_clear_data(sv,info) + import :: psb_desc_type, psb_cspmat_type, psb_c_base_sparse_mat, & + & psb_c_vect_type, psb_c_base_vect_type, psb_spk_, & + & mld_c_diag_solver_type, psb_ipk_ + Implicit None + + ! Arguments + class(mld_c_diag_solver_type), intent(inout) :: sv + integer(psb_ipk_), intent(out) :: info + end subroutine mld_c_diag_solver_clear_data + end interface contains diff --git a/mlprec/mld_d_diag_solver.f90 b/mlprec/mld_d_diag_solver.f90 index c1f0ec4f..0235e259 100644 --- a/mlprec/mld_d_diag_solver.f90 +++ b/mlprec/mld_d_diag_solver.f90 @@ -58,6 +58,7 @@ module mld_d_diag_solver procedure, pass(sv) :: build => mld_d_diag_solver_bld procedure, pass(sv) :: cnv => mld_d_diag_solver_cnv procedure, pass(sv) :: clone => mld_d_diag_solver_clone + procedure, pass(sv) :: clear_data => mld_d_diag_solver_clear_data procedure, pass(sv) :: apply_v => mld_d_diag_solver_apply_vect procedure, pass(sv) :: apply_a => mld_d_diag_solver_apply procedure, pass(sv) :: free => d_diag_solver_free @@ -169,6 +170,19 @@ module mld_d_diag_solver integer(psb_ipk_), intent(out) :: info end subroutine mld_d_diag_solver_clone end interface + + interface + subroutine mld_d_diag_solver_clear_data(sv,info) + import :: psb_desc_type, psb_dspmat_type, psb_d_base_sparse_mat, & + & psb_d_vect_type, psb_d_base_vect_type, psb_dpk_, & + & mld_d_diag_solver_type, psb_ipk_ + Implicit None + + ! Arguments + class(mld_d_diag_solver_type), intent(inout) :: sv + integer(psb_ipk_), intent(out) :: info + end subroutine mld_d_diag_solver_clear_data + end interface contains diff --git a/mlprec/mld_s_diag_solver.f90 b/mlprec/mld_s_diag_solver.f90 index 42d418eb..76c1151c 100644 --- a/mlprec/mld_s_diag_solver.f90 +++ b/mlprec/mld_s_diag_solver.f90 @@ -58,6 +58,7 @@ module mld_s_diag_solver procedure, pass(sv) :: build => mld_s_diag_solver_bld procedure, pass(sv) :: cnv => mld_s_diag_solver_cnv procedure, pass(sv) :: clone => mld_s_diag_solver_clone + procedure, pass(sv) :: clear_data => mld_s_diag_solver_clear_data procedure, pass(sv) :: apply_v => mld_s_diag_solver_apply_vect procedure, pass(sv) :: apply_a => mld_s_diag_solver_apply procedure, pass(sv) :: free => s_diag_solver_free @@ -169,6 +170,19 @@ module mld_s_diag_solver integer(psb_ipk_), intent(out) :: info end subroutine mld_s_diag_solver_clone end interface + + interface + subroutine mld_s_diag_solver_clear_data(sv,info) + import :: psb_desc_type, psb_sspmat_type, psb_s_base_sparse_mat, & + & psb_s_vect_type, psb_s_base_vect_type, psb_spk_, & + & mld_s_diag_solver_type, psb_ipk_ + Implicit None + + ! Arguments + class(mld_s_diag_solver_type), intent(inout) :: sv + integer(psb_ipk_), intent(out) :: info + end subroutine mld_s_diag_solver_clear_data + end interface contains diff --git a/mlprec/mld_z_diag_solver.f90 b/mlprec/mld_z_diag_solver.f90 index ddaafd38..b403a8e2 100644 --- a/mlprec/mld_z_diag_solver.f90 +++ b/mlprec/mld_z_diag_solver.f90 @@ -58,6 +58,7 @@ module mld_z_diag_solver procedure, pass(sv) :: build => mld_z_diag_solver_bld procedure, pass(sv) :: cnv => mld_z_diag_solver_cnv procedure, pass(sv) :: clone => mld_z_diag_solver_clone + procedure, pass(sv) :: clear_data => mld_z_diag_solver_clear_data procedure, pass(sv) :: apply_v => mld_z_diag_solver_apply_vect procedure, pass(sv) :: apply_a => mld_z_diag_solver_apply procedure, pass(sv) :: free => z_diag_solver_free @@ -169,6 +170,19 @@ module mld_z_diag_solver integer(psb_ipk_), intent(out) :: info end subroutine mld_z_diag_solver_clone end interface + + interface + subroutine mld_z_diag_solver_clear_data(sv,info) + import :: psb_desc_type, psb_zspmat_type, psb_z_base_sparse_mat, & + & psb_z_vect_type, psb_z_base_vect_type, psb_dpk_, & + & mld_z_diag_solver_type, psb_ipk_ + Implicit None + + ! Arguments + class(mld_z_diag_solver_type), intent(inout) :: sv + integer(psb_ipk_), intent(out) :: info + end subroutine mld_z_diag_solver_clear_data + end interface contains