You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

1.1.1. 06.2.2.2 "put" and "putSlice" functions

putputSlice
IMAS Fortran :: put
program diagnostic
    use ids_schemas
    use ids_routines
    implicit none

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

	! Open a database
    call imas_create('ids', 11, 22, -1, -1, idx)
  
   ! Mandatory to define this property
    ids%ids_properties%homogeneous_time = 1 

! IDS structure allocation
allocate(ids%time(10))
allocate(ids%x%y(10))

 !SCALARS (!)
	do i=1, 10
    	ids%time(i) = VALUE
        ids%x%y(i) = VALUE
    enddo
! VECTORS
    	ids%time = timeVector
        ids%x%y  = valueVector

call ids_put(idx, 'core_profiles', ids)
	call ids_deallocate(ids)
! Close a pulse file
    call imas_close(idx)
end program
IMAS Fortran :: putSlice
program diagnostic
    use ids_schemas
    use ids_routines
    implicit none

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

	! Open a database
    call imas_create('ids', 11, 22, -1, -1, idx)
  
   	! Mandatory to define this property
   	ids%ids_properties%homogeneous_time = 1 

	! Time NOT dependent data
	allocate(ids%ids_properties%comment(1))
 	ids%ids_properties%comment(1) = 'IDS put by put_slice'
 	call ids_put_non_timed(idx,"core_profiles",ids)

 	! IDS structure allocation
	allocate(ids%time(1))
	allocate(ids%x%y(1))   
 
    ids%time(1) = VALUE
    ids%x%y(1) = VALUE


	call ids_put_slice(idx, 'core_profiles', ids)
	
	call ids_deallocate(ids)
	
	! Close a pulse file
    call imas_close(idx)
end program

1.1.2. 06.2.2.3 "get" and "getSlice" functions

getgetSlice
IMAS Fortran :: get
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
IMAS Fortran :: getSlice
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
  • No labels