Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

3.2.2 "get" and "getSlice" functions

getgetSlice
Code Block
titleIMAS
linenumberstrue
program diagnostic
    use ids_schemas
    use ids_routines
    implicit none

    integer :: idx, i, arraySize
    type (ids_core_profiles) :: ids ! <= Single object !!


	! Open a database
    call imas_open('ids', 14, 4, idx)
  
    ! Get data
    call ids_get(idx, 'core_profiles', ids)

	! Check array size
    arraySize = size(ids%time)  ! <= time vector
    
    
	! SCALARS (!)
	do i=1, arraySize
    	write (*,*) "Time : ", ids%time(i)
        write (*,*) "Value: ", ids%x%y(i)
    enddo

	! VECTORS
    write (*,*) "Time : ", ids%time
    write (*,*) "Value: ", ids%x%y
	
	! Close a pulse file
    call imas_close(idx)
end program
Code Block
titleIMAS
linenumberstrue
program diagnostic
    ! UAL library
    use ids_schemas
    use ids_routines  
    implicit none

    integer :: idx 
    type (ids_core_profiles) :: ids
    
    ! Open a database
    call imas_open('ids', 11, 22, idx)
    
    ! Get data
    call ids_get_slice(idx, 'core_profiles', ids, 4.0, 1)
            
    write (*,*) "Time  : ", ids%time
    write (*,*) "Value : ", ids%x%y

	! Memory clean-up
    call ids_deallocate(ids)

    ! Close a pulse file
    call imas_close(idx)
end program