Well, I've this problem now. I've a (huge) set of parameters I'd like to organize in a vector.
Of course, I can do something like:
real, dimension(64) :: CONST
CONST(1) = 2.4
CONST(2) = 1.4
...
CONST(n) = CONST(1)*CONST(14)**CONST(7)
...
CONST(64) = ABS(CONST(18))
(Note that some of the constants are related to other constants).
But in that case, I wouldn't have the parameter
attribute in the variable, wich I'd like to have.
The other option I can think about is using the attribute parameter
, in which case I've to assign the value to the vector during the definition of the variable. Something like:
real, parameter, dimension(64) :: CONST =[2.4 , 1.4 , &
... , &
1.5412356 , &
... , &
342.5]
But, with some huge counterparts:
- The code becomes difficult to read as a consequence of an enormous amount of lines during the definition of the variable.
- I cannot define constants as a function of other constants.
So,
- There is a neat way (as in the first code) to define long vector with the attribute
parameter
in Fortran? - (As I suppose it is not) there is a way to change the attributes of the variable once I'd defined it values?
Thank you for your time.