Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Pointing etiquette

rahzan
New Contributor I
341 Views
Under CVF6.6B
This works:
type symbolType
real, pointer:: a(:),b(:)
end type symbolType
type(symbolType):: symbol

symbol.a => symData(:,1)
symbol.b => symData(:,2)
But its extension to an array does not:
type symbolType
real, pointer:: a(:),b(:)
end type symbolType
type(symbolType):: symbol(4)

symbol(:).a(:) => symSetData(:,1,:) !or (:,:,1)
symbol(:).b(:) => symSetData(:,2,:)
Where the intent is the first (:) on the lhs should point to the first onthe rhs etc, Is thereANY way that this can be achieved?
I have tried
type(symbolType),pointer:: symbol(:)
type(symbolType),allocatable:: symbol(:) !followed by allocation
and a number of other variations, But none compile.
Thanks,
Tim
0 Kudos
1 Reply
Jugoslav_Dujic
Valued Contributor II
341 Views
You cannot have T(:)%component(:) notation anywhereaccording tothe Standard. I can't quoteexact reasons, butI think that 1) itcan lead to ambiguities, 2) in general case, an array/pointer descriptor cannot be always constructed to match the resulting memory layout.
Thus, you have to resort to DO-loops.
Jugoslav
0 Kudos
Reply