reallocate_array_1d Subroutine

subroutine reallocate_array_1d(array, new_dim)

Reallocate a 1-dimensional array

FT 22.07.2021


Arguments

Type IntentOptional Attributes Name
double precision, intent(inout), DIMENSION(:), ALLOCATABLE :: array
integer, intent(in) :: new_dim

Called by

proc~~reallocate_array_1d~~CalledByGraph proc~reallocate_array_1d reallocate_array_1d proc~place_particles_ellipsoidal_surfaces place_particles_ellipsoidal_surfaces proc~place_particles_ellipsoidal_surfaces->proc~reallocate_array_1d interface~place_particles_ellipsoidal_surfaces place_particles_ellipsoidal_surfaces interface~place_particles_ellipsoidal_surfaces->proc~place_particles_ellipsoidal_surfaces

Contents

Source Code


Source Code

  SUBROUTINE reallocate_array_1d( array, new_dim )

    !************************************
    !
    !# Reallocate a 1-dimensional array
    !
    !  FT 22.07.2021
    !
    !************************************

    IMPLICIT NONE

    DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE, INTENT(IN OUT):: array
    INTEGER, INTENT(IN):: new_dim

    DEALLOCATE( array, STAT= ios, ERRMSG= err_msg )
    IF( ios > 0 )THEN
       PRINT *, "...deallocation error in SUBROUTINE" &
                // "reallocate_tmp_variable. ", &
                "The error message is", err_msg, ", and IOSTAT= ", ios
       STOP
    ENDIF

    ALLOCATE( array( new_dim ), STAT= ios, ERRMSG= err_msg )
    IF( ios > 0 )THEN
       PRINT *, "...allocation error in SUBROUTINE" &
                // "reallocate_tmp_variable. ", &
                "The error message is", err_msg, ", and IOSTAT= ", ios
       STOP
    ENDIF

  END SUBROUTINE reallocate_array_1d