close_solver Subroutine

public subroutine close_solver(mat)

Arguments

Type IntentOptional AttributesName
type(MAT_SOLV), intent(inout) :: mat

high level system type


Calls

proc~~close_solver~~CallsGraph proc~close_solver close_solver mpi_finalize mpi_finalize proc~close_solver->mpi_finalize proc~umfpack_di_free_numeric umfpack_di_free_numeric proc~close_solver->proc~umfpack_di_free_numeric proc~umfpack_di_report_info umfpack_di_report_info proc~close_solver->proc~umfpack_di_report_info dmumps dmumps proc~close_solver->dmumps proc~umfpack_di_free_symbolic umfpack_di_free_symbolic proc~close_solver->proc~umfpack_di_free_symbolic ma48_finalize ma48_finalize proc~close_solver->ma48_finalize proc~close_superlu close_superlu proc~close_solver->proc~close_superlu interface~c_umfpack_di_free_numeric c_umfpack_di_free_numeric proc~umfpack_di_free_numeric->interface~c_umfpack_di_free_numeric interface~c_umfpack_di_report_info c_umfpack_di_report_info proc~umfpack_di_report_info->interface~c_umfpack_di_report_info interface~c_umfpack_di_free_symbolic c_umfpack_di_free_symbolic proc~umfpack_di_free_symbolic->interface~c_umfpack_di_free_symbolic interface~destroy_dense_matrix Destroy_Dense_Matrix proc~close_superlu->interface~destroy_dense_matrix interface~destroy_compcol_matrix Destroy_CompCol_Matrix proc~close_superlu->interface~destroy_compcol_matrix

Called by

proc~~close_solver~~CalledByGraph proc~close_solver close_solver proc~solve_syst solve_syst proc~solve_syst->proc~close_solver program~test_solvers test_solvers program~test_solvers->proc~solve_syst

Contents

Source Code


Source Code

   subroutine close_solver(mat)
   implicit none
   type(MAT_SOLV), intent(inout) :: mat   !! *high level system type*
      integer(kind=I4) :: ierr

      deallocate( mat%eltptr )
      deallocate( mat%eltvar )

      select case(mat%slv_t)

         case(MA48)
            nullify( mat%matma48%zmat%row )
            nullify( mat%matma48%zmat%col )
            nullify( mat%matma48%zmat%val )

            call ma48_finalize(factors = mat%matma48%fact, &
                               control = mat%matma48%ctrl, &
                               info    = ierr)
            deallocate( mat%b, mat%x )

         case(MUMP)
            if ( mat%matmump%myid == 0 )then
               nullify( mat%matmump%rhs    )
               nullify( mat%matmump%eltptr )
               nullify( mat%matmump%eltvar )
               nullify( mat%matmump%a_elt  )
            endif

            ! destroy the instance (deallocate internal data structures)
            mat%matmump%job = -2
            call dmumps(mat%matmump)
            if (mat%matmump%infog(1) < 0) then
               write(OPU,'(a,a,i6,a,i9)') ' error return: ',                              &
                                          '  mumps_par%infog(1)= ', mat%matmump%infog(1), &
                                          '  mumps_par%infog(2)= ', mat%matmump%infog(2)
               call mpi_finalize(ierr)
               stop 'Error MUMP in close_solver'
            endif
            call mpi_finalize(ierr)
            deallocate( mat%b, mat%x )

         case(SULU)
            call close_superlu(sulu = mat%matsulu)

            nullify( mat%matsulu%b     )
            nullify( mat%matsulu%irow  )
            nullify( mat%matsulu%jptr  )
            nullify( mat%matsulu%a_elt )

         case(UMFP)
            deallocate( mat%jptr, mat%irow )

            call umfpack_di_free_numeric(Numeric = mat%matumfp%c_numeric)     ! free the numeric factorization
            ! no lu factors (numeric) are in memory at this point.
            call umfpack_di_free_symbolic(Symbolic = mat%matumfp%c_symbolic)  ! free the symbolic analysis
            call umfpack_di_report_info(Control = mat%matumfp%c_control,      &
                                        Info    = mat%matumfp%c_info)         ! print final statistics
            deallocate( mat%b, mat%x )

         case default
            stop 'Unknown solver type, close_solver'

      endselect

   return
   endsubroutine close_solver