reallocate_array_2d Subroutine

subroutine reallocate_array_2d(array, new_dim, new_dim2)

Reallocate a 2-dimensional array

FT 22.07.2021


Arguments

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

Called by

proc~~reallocate_array_2d~~CalledByGraph proc~reallocate_array_2d reallocate_array_2d proc~place_particles_ellipsoidal_surfaces place_particles_ellipsoidal_surfaces proc~place_particles_ellipsoidal_surfaces->proc~reallocate_array_2d 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_2d( array, new_dim, new_dim2 )

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

    IMPLICIT NONE

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

    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, new_dim2 ), 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_2d