Reference to derived type element by index?
- From: Rob Crain <r.a.crain@xxxxxxxxxxxx>
- Date: Sun, 30 Mar 2008 00:11:58 +0000
I have a derived type, e.g.
type circle_datatype
real :: radius
real :: x
real :: y
real :: z
character(len=*) :: circle_label
endtype circle_datatype
type(circle_datatype) :: circle
and want to refer to the individual elements via some indexing scheme, say in this example I want to change the value of circle%radius I would use index #1, or the z-coordinate I would use #4. Is there some method by which this is possible?
I think IDL has a system for this, such that circle.radius can be referenced by circle.(0), but I really need Fortran's horsepower for this code!
.
- Follow-Ups:
- Re: Reference to derived type element by index?
- From: *** Hendrickson
- Re: Reference to derived type element by index?
- From: jwm
- Re: Reference to derived type element by index?
- From: Richard Maine
- Re: Reference to derived type element by index?
- From: Gary Scott
- Re: Reference to derived type element by index?
- Prev by Date: Re: what is wrong with this code?can someone walk me through this?
- Next by Date: Re: Reference to derived type element by index?
- Previous by thread: Rounding off double precision
- Next by thread: Re: Reference to derived type element by index?
- Index(es):