- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
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.
- Balises:
- Intel® Fortran Compiler
Lien copié
2 Réponses
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
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.
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
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.)

Répondre
Options du sujet
- S'abonner au fil RSS
- Marquer le sujet comme nouveau
- Marquer le sujet comme lu
- Placer ce Sujet en tête de liste pour l'utilisateur actuel
- Marquer
- S'abonner
- Page imprimable