I can define a user defined data type with allocatable array as its data type.
Allocation works perfectly while we are still in the same subroutine. But i don't know how to pass this type of user defined data type as a subroutine argument.
Intel compiler shows the error # 6530
:
"Error 1 error #6530: The array spec for this component must be of explicit shape and each bound must be an initialization expression."
The code has been shared below to show the error. It is written in FORTRAN 77. I am working in FORTRAN 77, as i will have to append this code in user subroutine of Abaqus that accepts only FORTRAN 77 files.
PROGRAM DERIVED_DATA_TYPE_CHECK
IMPLICIT NONE
INTEGER :: I,J,A,B
TYPE SS
SEQUENCE
DOUBLE PRECISION, DIMENSION(:,:), ALLOCATABLE :: S1
END TYPE SS
TYPE (SS),DIMENSION(:,:),ALLOCATABLE :: SS_
A=10
B=10
ALLOCATE (SS_(A,B))
! ALLOCATING THE VARIABLE S1 DIMENSIONS
! EVERY ALLOCATABLE VARIABLE HAS THE SAME SIZE AS
! THE TOTAL NUMBER OF STRUCTURE (TYPE)
DO I = 1,A
DO J = 1,B
ALLOCATE(SS_(I,J)%S1(A,B))
ENDDO
ENDDO
CALL PASS_ARG(SS_,A,B)
END
SUBROUTINE PASS_ARG(SS_,A,B)
IMPLICIT NONE
INTEGER :: A,B
TYPE SS
SEQUENCE
DOUBLE PRECISION, DIMENSION(A,B) :: S1
END TYPE SS
TYPE (SS), DIMENSION (A,B) :: SS_
END
The program at compilation gives the error as shown below:
----------
Error 2 error #6530: The array spec for this component must be of explicit shape and each bound must be an initialization expression. [S1]
----------
There must be a way to solve this problem. I want to stay away from common blocks or modules. Anyway I cant use module in Fortran.
In order to avoid this error, I had used allocatable variables in main program as well as called subroutine. Program is then compiled, but on execution, it show the error "that allocation has been done more than once".
At last I think I will have to use some global constants..... I guess.