- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a problem in my programing in Fortran:
First there are some variable pairs like: (a, aa) (b, bb) (c, cc)
and they have a relation like:
a=f(aa)
b=f(bb)
c=f(cc)
The question is: I have a large number of this variable pairs, so I do not want to write this every time.
Can Ihave somethinglike a name group: a, b, c-> group1
aa, bb, cc-> group2
then I only need to write:
group1=f(group2)
Thanks.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think I would just have an array of pairs:
type Pair integer :: x integer :: y end type Pair type(Pair), dimension (1:number_of_pairs) :: pairs !you would put all the pairs in the array somehow !effectively putting them in a "group" pairs(1)%x = a pairs(1)%y = aa etc... do i=1, number_of_pairs pairs(i)%x = f(pairs(i)%y)Forgive me if they syntax isn't perfect, I'm very new to fortran
Chip
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No, it's not so simple, because the variables a,b,c are variables used someplaceelse, and theyactualyare allocated arries with different shapes. The point is:these variableshave different names, but they all have very similar operation in someplace, (eg. deallocate them all), and I do not want to write every name of them, if they can be included in a name group and be treated together, that will be nice.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page