I am trying to implement an array of pointers, so that I can loop over the elements. However I am not sure how to do this correctly:
TYPE(domain),POINTER :: d01,d02,d03
TYPE(domain),DIMENSION(:),POINTER :: dom
...
dom(1) => d01
dom(2) => d02
dom(3) => d03
...
and then:
...
IF(ASSOCIATED(dom(2),d02))THEN
...
The compiler (pgf90 10.6-0 64-bit target on x86-64 Linux -tp istanbul-64) gives me this error message:
PGF90-S-0074-Illegal number or type of arguments to associated - keyword argument pointer (test_ptr.f90: 10)
0 inform, 0 warnings, 1 severes, 0 fatal for MAIN
As far as I understand, there is something wrong about how I subset an array of pointers. Both dom(2)
and d02
are rank 0 (scalar pointers). What is the correct way to implement this?
Thanks.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…