View previous topic :: View next topic |
Author |
Message |
Jan
Joined: 15 Apr 2014 Posts: 2
|
Posted: Wed Apr 16, 2014 8:43 am Post subject: Nested structures. |
|
|
Hi.
In my code I am using nested structure:
TYPE SUBSTRUCTURE
INTEGER ::ii_Number
REAL ::rr_Number
CHARACTER(LEN=40)::TText
END TYPE SUBSTRUCTURE
TYPE SD_TYPE
INTEGER ::i_Number
REAL ::r_Number
CHARACTER(LEN=40)::Text
TYPE (SUBSTRUCTURE) :: subStructure
END TYPE SD_TYPE
TYPE(SD_TYPE), POINTER:: p_SD_TYPE
allocate(p_SD_TYPE, SHARENAME="CFDATA2")
Although the SUBSTRUCTURE is located at the end of structure SD_TYPE, in the allocated memory is at the beginning.
Can you explain me why?
And how can I achieve exact order in the memory?
Thank you very much.
Jan |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Wed Apr 16, 2014 9:20 am Post subject: |
|
|
In Fortran, if you want a particular order, then you need to use the SEQUENCE statement. |
|
Back to top |
|
|
Jan
Joined: 15 Apr 2014 Posts: 2
|
Posted: Wed Apr 16, 2014 9:43 am Post subject: |
|
|
Thank you. |
|
Back to top |
|
|
|