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

Accessing components/type-bound procedures of a more specialized type in F2003

thomas_boehme
New Contributor II
237 Views

I would like to know all possibilities to access components of an extended type via a class pointer of a more generalized type. I.E. if i have a type A and a type Aext which extends A, how can I access a component only present in Aext via a class (A) pointer?

So far, the only way I found is a SELECT TYPE construct. While this works, it does addquite alot of code and also seems to be performing very poorly.

Is that the only way to accessspecialized componentsor are there any other possibilities I did not find?

regards,
Thomas

0 Kudos
1 Solution
reinhold-bader
New Contributor II
237 Views
To my knowledge, SELECT TYPE is indeed the only way to access components of an extended type. This is by design. The performance of the construct may to some extent be an implementation issue (for ifort, 11.1 is the first release at all to support SELECT TYPE), but of course it is not recommended to execute the statement in a block enclosed by a loop nest which dominates execution time.

View solution in original post

0 Kudos
1 Reply
reinhold-bader
New Contributor II
238 Views
To my knowledge, SELECT TYPE is indeed the only way to access components of an extended type. This is by design. The performance of the construct may to some extent be an implementation issue (for ifort, 11.1 is the first release at all to support SELECT TYPE), but of course it is not recommended to execute the statement in a block enclosed by a loop nest which dominates execution time.

0 Kudos
Reply