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

Are type-bound procedures supported yet within ifort?

rotero
Einsteiger
491Aufrufe
Are type-bound procedures and classes supported yet by the ifort compiler?

This is a subset of the module I'm writting that still shows the errors I've included below. I've been trying to find my errors for some time. Is it simply something that has gone into my programming 'blind spot' or are the features not yet supported? If they aren't supported are there suggestions as to a compiler that would support them?

thank you!
Richard

module planet_class
implicit none
integer, parameter :: dbl = selected_real_kind(p=15, r=200)

type, public :: planet
private
integer :: planetID = -1
real(kind=dbl) :: gravitySurf, densitySurf, scaleHeight, radiusPlanet
contains
procedure, pass :: rho=>getDensity
procedure, pass :: p=>getPressure
end type planet

contains

real function getDensity(this, altitude)
implicit none
class(planet), intent(in) :: this
real(kind=dbl), intent(in) :: altitude
getDensity = altitude+1 ! temp equation
end function getDensity

real function getPressure(this, altitude)
implicit none
class(planet) :: this
real(kind=dbl), intent(in) :: altitude
getPressure = altitude+1 ! temp equation
end function getPressure

end module planet_class

=================================

This code generates the following errors:

fortcom: Error: test.f90, line 11: Syntax error, found ',' following statement keyword
procedure, pass :: rho=>getDensity
--------------^
fortcom: Error: test.f90, line 11: Syntax error, found 'PROCEDURE' when expecting one of:
0 Kudos
1 Antworten
Steven_L_Intel1
Mitarbeiter
491Aufrufe
Not yet supported. Probably in the next major release, whenever that is. (At the moment, I would not venture a guess.) Procedure pointers and type-bound procedures are not commonly implemented. You could try NAG.
Antworten