- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I need to know if the pointer to the array called 'AA' in the code below will actuall reference the several 'AA' elements of the 'ex' array. (The compiler makes no complaints.)
...
REAL, POINTER :: arr(:) => NULL()
END TYPE symbol
TYPE
EREAL :: AA, BB, CC
END TYPE E
TYPE
PTYPE(E), ALLOCATABLE, DIMENSION(:) :: ex
END TYPE P
TYPE
BodTYPE(P) :: pro
END TYPE Bod
TYPE
(Bod), ALLOCATABLE, DIMENSION(:) :: bodyREAL, POINTER :: AA(:), BB(:), CC(:)
TYPE(symbol) :: sym
REAL, POINTER :: pnt
...
ALLOCATE(body(MAXBODIES))
...
ALLOCATE(body(B)%pro%ex(MAX))
CALL init_ex(body(B)) ! ..%ex(I)%AA gets data here
...
AA => body(B)%pro%ex(:)%AA
CALL insert_array_in_symbol_table('AA', AA)
! passes AA as REAL, POINTER pt(:) and sets symb(I)%arr => pt
...
sym = getSymbol('AA')
pnt => sym%arr(N) ! where N is in 1..MAX
...
My concern is that the REAL array AAhas other data between itssequential elements. Will theAA pointer array still index to the expected data elements?
Will 'pnt'point to theexpected AA element?
I appologize in advance for the convoluted qu estion. I am writing a parser around this data structure, andI fealt that waiting till the parser is completelydone to get to a test would be a waste of time ifthepointer arraydoesn't work.
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It should work. AA will point to noncontiguous data and will have a non-unit stride in its descriptor. I assume that the corresponding dummy argument of insert_array_in_symbol_table declares the argument as an assumed-shape array (:) and that an explicit interface is provided.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
MADsblionel:
I assume that the corresponding dummy argument of insert_array_in_symbol_table declares the argument as an assumed-shape array (:)
Yes
MADsblionel:
and that an explicit interface is provided.
and Yes (by use of the module it is part of.)

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page