lists, vector elements

Mike Fiorino fiorino at LLNL.GOV
Tue Oct 18 11:48:05 EDT 2005


Bernd,

make p a global variable, e.g,

_p.1.1=0 ...

then the _p array will be visible at all levels. cheers, Mike

> -----Original Message-----
> From: GRADSUSR at LIST.CINECA.IT
> [mailto:GRADSUSR at LIST.CINECA.IT] On Behalf Of Becker, Bernd
> Sent: Tuesday, October 18, 2005 7:23 AM
> To: GRADSUSR at LIST.CINECA.IT
> Subject: lists, vector elements
>
> hello,
>
> I want to count members of 5*5 matrix in a sub routine.
> Theerfore I pass 25 blanks into the routine, fill the 25
> blanks with precious results and continue using the 25
> numbers afterwards.
>
> But I cannot get the flow of information from calling level
> to subroutine and back to work. What am I doing wrong?
>
> How can I get 25 numbers in and out of a grads function?
>
>        calling routine:
>
>             p.1.1=0
>             p.1.2=0
>             p.1.3=0
>             p.1.4=0
>             p.1.5=0
>             p.2.1=0
>             p.2.2=0
>             p.2.3=0
>             p.2.4=0
>             p.2.5=0
>             p.3.1=0
>             p.3.2=0
>             p.3.3=0
>             p.3.4=0
>             p.3.5=0
>             p.4.1=0
>             p.4.2=0
>             p.4.3=0
>             p.4.4=0
>             p.4.5=0
>             p.5.1=0
>             p.5.2=0
>             p.5.3=0
>             p.5.4=0
>             p.5.5=0
>
>             contitab(var,tim, p.1.1, p.1.2, p.1.3, p.1.4,
> p.1.5, p.2.1, p.2.2, p.2.3, p.2.4, p.2.5, p.3.1, p.3.2,
> p.3.3, p.3.4, p.3.5, p.4.1, p.4.2, p.4.3, p.4.4, p.4.5,
> p.5.1, p.5.2, p.5.3, p.5.4, p.5.5)
>
> in contitab:
>
>             say p.1.1' ' p.1.2' ' p.1.3' ' p.1.4' ' p.1.5' ' p.2.1' '
> p.2.2' ' p.2.3' ' p.2.4' ' p.2.5' ' p.3.1' ' p.3.2' ' p.3.3'
> ' p.3.4' '
> p.3.5' ' p.4.1' ' p.4.2' ' p.4.3' ' p.4.4' ' p.4.5' ' p.5.1'
> ' p.5.2' '
> p.5.3' ' p.5.4' ' p.5.5
>
> yields:
>
> p.1.1 p.1.2 p.1.3 p.1.4 p.1.5 p.2.1 p.2.2 p.2.3 p.2.4 p.2.5
> p.3.1 p.3.2
> p.3.3 p.3.4 p.3.5 p.4.1 p.4.2 p.4.3 p.4.4 p.4.5 p.5.1 p.5.2
> p.5.3 p.5.4
> p.5.5
>
> in calling routine after contitab
>
>             say p.1.1' ' p.1.2' ' p.1.3' ' p.1.4' ' p.1.5' ' p.2.1' '
> p.2.2' ' p.2.3' ' p.2.4' ' p.2.5' ' p.3.1' ' p.3.2' ' p.3.3'
> ' p.3.4' '
> p.3.5' ' p.4.1' ' p.4.2' ' p.4.3' ' p.4.4' ' p.4.5' ' p.5.1'
> ' p.5.2' '
> p.5.3' ' p.5.4' ' p.5.5
>
> yields:
>
> 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
>
> How do I get 2-D list thing "p"
>
> from one calling level to the next and back?
>
>
>
> Thanks,
> Bernd.
>
>
> --
> Bernd Becker   The Monthly Outlook
> Met Office  FitzRoy Road  Exeter   Devon EX1 3PB  United Kingdom
> Tel.: +44 (0) 1392 884511 Fax: +44 (0)870 900 5050
> E-mail:bernd.becker at metoffice.gov.uk -  http://www.metoffice.gov.uk
>



More information about the gradsusr mailing list