Re: Reference to derived type element by index?
- From: Gary Scott <garylscott@xxxxxxxxxxxxx>
- Date: Sat, 29 Mar 2008 20:03:58 -0500
Rob Crain wrote:
Hi Gary - thanks for your reply. I think my initial explanation may have been unclear, as this is not the solution to my problem. The problem reduces to the following: I don't know explicitly which variable (I incorrectly referred to this variable as an element previously, hence the confusion) I want to update, so I can't say
circle%radius = <something>
All I have is an index that tells me I need to update the i^th variable within the derived type. So say I need to update circle%z, the index would have value 4. But I know that I can't do
By i'th variable, are you saying the i'th component? No you can't alias an index with the formally defined components and have value 1 refer to radius and value 2 refer to x. You could use select case to make that choice based upon the index. Still not sure I understand fully tho.
<snip>--
Gary Scott
mailto:garylscott@sbcglobal dot net
Fortran Library: http://www.fortranlib.com
Support the Original G95 Project: http://www.g95.org
-OR-
Support the GNU GFortran Project: http://gcc.gnu.org/fortran/index.html
If you want to do the impossible, don't hire an expert because he knows it can't be done.
-- Henry Ford
.
- Follow-Ups:
- Re: Reference to derived type element by index?
- From: Rob Crain
- Re: Reference to derived type element by index?
- References:
- Reference to derived type element by index?
- From: Rob Crain
- Re: Reference to derived type element by index?
- From: Gary Scott
- Re: Reference to derived type element by index?
- From: Rob Crain
- Reference to derived type element by index?
- Prev by Date: Re: Reference to derived type element by index?
- Next by Date: Re: Reference to derived type element by index?
- Previous by thread: Re: Reference to derived type element by index?
- Next by thread: Re: Reference to derived type element by index?
- Index(es):
Relevant Pages
|
|