billgray1234
Programmer
- Mar 14, 2011
- 39
i'm using fortran 90/95. i'm using derived type structures. some of these type structures contain other type structures (which, in turn, might contain other type structures, etc). for example, i might have the following :-
TYPE T_T1
TYPE (T_T2) :: T2
END TYPE T_T1
TYPE T_T2
TYPE (T_T3) :: T3
END TYPE T_T2
TYPE T_T3
TYPE (T_T4) :: T4
END TYPE T_T3
...
TYPE T_TN
REAL :: SOME_REAL_VARIABLE
END TYPE T_TN
where N is some positive integer number (i.e. i = 1,2,3,...,N). for this set-up, in my main program (or calling subroutine), i might have a variable as such :-
TYPE (T_T1) :: T1
REAL :: REAL_VARIABLE
REAL_VARIABLE = T1 % T2 % T3 % ... % TN % SOME_REAL_VARIABLE
my question is :- is there a limit on the size of 'N' ? i.e. is there a maximum allowable number of "levels" of type structures that can be "contained" in a type structure ?
for example, if N can be no higher than 5 (i.e. N=5), then my code would look like this :-
REAL_VARIABLE = T1 % T2 % T3 % T4 % T5 % SOME_REAL_VARIABLE
note that i've been writing a simple "test" program, in order to explore this. but, i was also wondering if anyone might know the answer. any help would be much appreciated.
TYPE T_T1
TYPE (T_T2) :: T2
END TYPE T_T1
TYPE T_T2
TYPE (T_T3) :: T3
END TYPE T_T2
TYPE T_T3
TYPE (T_T4) :: T4
END TYPE T_T3
...
TYPE T_TN
REAL :: SOME_REAL_VARIABLE
END TYPE T_TN
where N is some positive integer number (i.e. i = 1,2,3,...,N). for this set-up, in my main program (or calling subroutine), i might have a variable as such :-
TYPE (T_T1) :: T1
REAL :: REAL_VARIABLE
REAL_VARIABLE = T1 % T2 % T3 % ... % TN % SOME_REAL_VARIABLE
my question is :- is there a limit on the size of 'N' ? i.e. is there a maximum allowable number of "levels" of type structures that can be "contained" in a type structure ?
for example, if N can be no higher than 5 (i.e. N=5), then my code would look like this :-
REAL_VARIABLE = T1 % T2 % T3 % T4 % T5 % SOME_REAL_VARIABLE
note that i've been writing a simple "test" program, in order to explore this. but, i was also wondering if anyone might know the answer. any help would be much appreciated.