|
[Sponsors] |
November 16, 2009, 16:59 |
Coding in Fortran95
|
#1 |
New Member
Mohammad
Join Date: Jul 2009
Posts: 4
Rep Power: 16 |
Hi,
I am doing coding. I use Fortran95. I have some subroutines which contains optional arguments. When I call them I can use "if () then" or "select case()" to choose whether assign data to these optional arguments or not. As I know even if I assign an undefined data (undefined array; e.g. an allocatable array which i not allocated) to these subroutines, program will not encounter any problem. My question is: should I actually use a criterion (using "if" or "select case") when I assign data to these subroutines (for example: when I have an allocatable array I can use "if"; so, when the array is not allocated I will not assign it to the optional argument. But, is it necessary)? Thanks so much. |
|
November 24, 2009, 12:31 |
|
#2 |
Senior Member
|
generally, we set it to a default value ,such as 0 to avoid some zero.
|
|
November 24, 2009, 12:53 |
Hi
|
#3 | |
New Member
Mohammad
Join Date: Jul 2009
Posts: 4
Rep Power: 16 |
Quote:
First of all, thanks for giving me some comments. Yes, that is right. But, what if this variable (an array) is not allocated (if I can ignore allocation of an unnecessary array , I can save the memory[assume I am solving for laminnar flow. So, alocation of turbulence related variables will be unnecessary]). My question actually is about such cases. Thanks so much Ztdep |
||
November 24, 2009, 19:57 |
|
#4 |
Senior Member
|
if(Solve Turbulent) then
Allocate( Turbulent related variables ) Else Allocate( laminar flow related variables endif |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Varibales for user coding | Tomo | STAR-CCM+ | 3 | September 10, 2009 03:49 |
Help with coding | James | Main CFD Forum | 2 | May 18, 2005 05:12 |
Coding | begineer of cfd | Main CFD Forum | 1 | July 21, 2004 05:11 |
Ground coding enquiry | Wenqing Zhang | Phoenics | 2 | August 12, 2002 11:56 |
User coding on NT w2k | Philip Jones | Siemens | 0 | November 26, 2001 03:43 |