Subroutine to close the solver
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(MAT_SOLV), | intent(inout) | :: | mat |
high level system type |
subroutine close_solver(mat) !! Subroutine to close the solver implicit none type(MAT_SOLV), intent(inout) :: mat !! *high level system type* integer(kind=I4) :: ierr if ( allocated( mat%eltptr ) ) deallocate( mat%eltptr ) if ( allocated( mat%eltvar ) ) deallocate( mat%eltvar ) select case(mat%slv_t) case(MA48) #if WITH_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 ) #else stop 'MA48_LIB not defined' #endif 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