|
[Sponsors] |
November 26, 2003, 20:29 |
INTFLG
|
#1 |
Guest
Posts: n/a
|
Hi,experts can you give me detailed information about INTFLG, how to use it, what is it mean?
thanks a lot Juliet |
|
November 27, 2003, 05:49 |
Re: INTFLG
|
#2 |
Guest
Posts: n/a
|
INTFLG is an array of 100 integers which is available to all user subroutines. The initial values are 0, but STAR "remembers" any changes you make to these values. Hence you can use INTFLG to pass a message from one subroutine to another, or from one call of a subroutine to the next call of the same subroutine. So, for example, if you wanted a subroutine to do something once only:
if (intflg(1).eq.0) then    do_this_once    intflg(1)=1 end if |
|
November 27, 2003, 20:06 |
Re: INTFLG
|
#3 |
Guest
Posts: n/a
|
thank you Richard!
I understand some from you. but it is not very clear now, for example, if i want first call sorsca.f then sorent.f, therefore i should make (if intflg(1) .eq. 0 then(),intflg(1)=1,endif )in sorsca.f, then i make (if intflg(1).eq.1 then (),intflg(1)=2,endif) in sorent.f. is it right? but how to pass some message from one subroutine to another, would you give me some example for intflg? thank you again for your help and your time! Juliet |
|
November 28, 2003, 05:12 |
Re: INTFLG
|
#4 |
Guest
Posts: n/a
|
The INTFLG array doesn't "mean" anything by default; it doesn't control which subroutines are called or what order they are called in. You can think of it as scratch space which STAR maintains for you. STAR "promises" to initialise the array to 100*0, to pass it to all user subroutines and to "remember" the changes you make to it. Hence these are flags for you to use as you wish.
Here's a simple example. Suppose you wanted your user subroutine to print a message the first time it is called - useful if you want to be sure it is being used. Here's how you could do it (in BCDEFI, for example): if (intflg(1).eq.0) then write(*,*) 'In BCDEFI!' write(60,*) 'In BCDEFI!' intflg(1)=1 end if The choice of which intlfg you use (in the range 1-100) is up to you, but make sure there's no conflict with other intflgs you use elsewhere. Now, other subroutines will see intflg(1)=1 as well, so you could have some code in another subroutine, like this if (intflg(1).eq.1) then write(*,*) 'BCDEFI has already been called' write(60,*) 'BCDEFI has already been called' end if |
|
November 29, 2003, 01:31 |
Re: INTFLG
|
#5 |
Guest
Posts: n/a
|
thank you so much Richard!
now i understand some about it, it looks useful sometimes, so i will try it.i wish i can get more help from you if i have advanced qustion about it after practice thank you again regards Juliet |
|
December 1, 2003, 05:20 |
Re: INTFLG
|
#6 |
Guest
Posts: n/a
|
Alternatively, just define your own COMMON blocks to share data between routines.
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
INTFLG | CMB | Siemens | 4 | November 15, 2004 12:57 |