- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can anyone help? I cannot get the array constructor data values to compile when using a multiplier on a constant.
This is an f77 conversion. Using MS VS 2003 and Intel V9.
The array used to look like:
DATA ASTP1/0.,20.,40.,3*0.0/
I believed it should be like:
Real, Parameter :: ASTP1(6) = (/0.,20.,40.,3*0.0/)
Real, Parameter :: ASTP1(6) = [/0.,20.,40.,3*0.0/]
The issue is there are some arrays with 80*0..
That would be alot to do by hand.
Thanks Ken
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you trying to set the last 3 values to zero?
program p integer :: i real, parameter :: ASTP1(6) = [ 0., 20., 40., [(0.0, i=1,3)] ] print *, " ASTP1 = ", ASTP1 stop end program p
ASTP1 = 0.00000000 20.0000000 40.0000000 0.00000000 0.00000000 0.00000000
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you. That can work. But I wonder is the 3*0. operation no longer applicable?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ken B. wrote:
Thank you. That can work. But I wonder is the 3*0. operation no longer applicable?
By "3*0. operation", I assume you mean the repeat operation where 3 successive elements are assigned a specific value. You may want to look into the Fortran language standard (https://software.intel.com/en-us/node/581560) for more detail, but I believe such repeat syntax is restricted to DATA statements and perhaps in NAMELIST I/O processing as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, the repeat syntax is valid for DATA statements, reference https://software.intel.com/en-us/node/580482, but I think that is the only place it is allowed. Probably something for the deep dark past when I was learning the language.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page