Topic: Version 2.19 Problem

Hi Jeff,
Downloaded and installed 2.19. And it does display the Allocated elements. But something is going wrong and I'm not sure what it is.  I have a line of data that contains 4 different elements in 10-column fields for a Dam Structure table - Elevation, Discharge, Volume and Area.  The first line of data would look like this:
                             Elev      Disch      Volume      Area
(20 blank spaces) 591.00                    247.8      76.8

and the 10th line of data:

(20 blanks)             615                                     607.7     

The elements are referenced as Str%Elev(), Str%PSDisch(), Str%Volume() and Str%Area(%)

When I display the values, the elevation value shows up in all 4 elements, i.e., 591.00 as Str%Elev(1), Str%PSDisch(1), Str%Volume(1) and Str%Area(1).

If I look at the 10th elements (Str%Elev(10), etc.), the elevation 615.00 is shown as above.

I THINK the values are being stored correctly, but I'm not sure.

Don

2 (edited by davidb 2015-01-06 22:59:16)

Re: Version 2.19 Problem

Wait and see what Jeff thinks.

For the test code below, I found that all the values were correctly shown in the variables window.

   type dam_struct
      real :: Elevation
      real :: Discharge
      real :: Volume
      real :: Area
   end type dam_struct
   
   type(dam_struct), allocatable :: dam(:)
   
   allocate (dam(3))
   
   ! Setup structures with an easily recognized pattern
   dam(1) = dam_struct(1.0, 2.0, 3.0, 4.0)
   dam(2) = dam_struct(10.0, 20.0, 30.0, 40.0)
   dam(3) = dam_struct(100.0 ,200.0, 300.0, 400.0)

   end

Or arranging things differently, it still worked:

   type dam_struct
      real, allocatable :: elev(:)
      real, allocatable :: Disch(:)
      real, allocatable :: Volume(:)
      real, allocatable :: Area(:)
   end type dam_struct
   
   type(dam_struct) :: dam
   
   allocate (dam%elev(3))
   allocate (dam%disch(3))
   allocate (dam%volume(3))
   allocate (dam%Area(3))
   
   dam%elev = (/1.0, 10.0, 100.0/)
   dam%disch = (/2.0, 20.0, 200.0/)
   dam%volume = (/3.0, 30.0, 300.0/)
   dam%Area = (/4.0, 40.0, 400.0/)

Perhaps double check your values are stored correctly.

--
David

Re: Version 2.19 Problem

Don Hazlewood wrote:

Hi Jeff,
When I display the values, the elevation value shows up in all 4 elements, i.e., 591.00 as Str%Elev(1), Str%PSDisch(1), Str%Volume(1) and Str%Area(1).

Don,

I'm a bit confused about your description.  By "when I display the values," are you referring to examining the values in the debugger?  When you print (via Write(*,*) or Print *,) the four values, do you see something different than what the debugger is showing?

I'm just trying to understand the situation and ensure that the issue isn't related to a formatted read issue.

Jeff Armstrong
Approximatrix, LLC

Re: Version 2.19 Problem

The values are stored correctly, they just don't display correctly in the debugger.  The debugger repeats what is shown in the first column (Str%Elev(n)) for all the other columns (Str%PSDisch(n), Str%Volume(n), Str%Area(n)).  If I create a dummy variable, such as STArea and put in the statement STArea = Str%Area(n), STArea has the proper value and displays correctly, both in the list of variables and hi-lite and hover.  I haven't tried using a Write or Print statements -- after I satisfied myself the values were correctly stored, I moved on to other issues.