gfxgfx
 
Please login or register.

Login with username, password and session length
 
gfx gfx
gfx
1617 Posts in 535 Topics by 779 Members - Latest Member: rhoronjeff@comcast.net December 02, 2022, 08:44:16 PM
*
gfx* Home | Help | Search | Login | Register | gfx
gfx
Absoft User Forum  |  Support  |  General  |  Accessing Structure Elements by Name
gfx
gfxgfx
 

Author Topic: Accessing Structure Elements by Name  (Read 3327 times)

rboone

  • Newbie
  • *
  • Posts: 11
Accessing Structure Elements by Name
« on: February 23, 2011, 09:27:55 PM »
Folks,

I'm having difficulty phrasing this question, but here goes ...

I have a program where I have used a typical FORTRAN structure (in ABSOFT 10), with perhaps 100 entries.  From that I dimension a large array of that structure, representing landscape cells.  I would like a user to be able to write-out any set of these 100 entries they wish.  That is proving hard for me, an intermediate programmer at best.  Ideally, I would like to reference the *name* of the structure element, and suppose I had another little structure called Outs that stored whether the so that I could use one structure, something like:

do i = 1, Number_of_Maps
   if ( Outs(i)%whole_map_output .eq.  **structure_element**  .and. Outs(i)%write_out .eq. .TRUE. ) then
      do icell = 1, range_cells
        rng_out(icell) = float(Rng(icell)%**structure_element**)
      end do
      call Output_One_Surface (Outs(i)%whole_map_output, rng_out)                                                ! Pass the string for a file name, and the array with the data
   end if
end do

Where **structure_element** would be the name of an element in the Rng() strucutre, and whoe_map_output would store a matching (or not) string.

The best I've got right now isn't very good.  I've got the same Outs() structure, but 100 or so clauses that include the names of the entries in the structure edited by hand.  I search the Outs() directory each time for the entry.  So one of the 100 would be:

  ! Temperature
  write_it = .FALSE.
  do i = 1, WHOLE_MAP_COUNT
    if ( 'temperature' .eq. Outs(i)%whole_map_output .and. Outs(i)%write_out .eq. .TRUE. ) write_it = .TRUE.
  end do
  if ( write_it .eq. .TRUE. ) then
    do icell = 1, range_cells
      rng_out(icell) = float(Rng(icell)%temperature)
    end do
    call Output_One_Surface ('temperature', rng_out)
  end if

Well, not too clear, but any thoughts you may have are appreciated.

Thanks,
Randy

Absoft User Forum  |  Support  |  General  |  Accessing Structure Elements by Name
 

gfxgfx
gfx gfx
Powered by MySQL Powered by PHP Valid XHTML 1.0! Valid CSS!