Versions Compared

Key

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

...

getgetSlice


Code Block
titleIMAS Fortran :: get
linenumberstrue
program test
    use ids_schemas
    use ids_routines
    implicit none


    type (ids_core_profiles) :: ids ! <= IDS object

    character(len=3)    :: treename = 'ids'
    character(len=20)   :: database = 'test'
    integer             :: shot = 12
    integer             :: run = 22
    character(len=20)   :: usr
    character(len=20)   :: imasVersion
    integer             :: idx

    integer :: i

    ! Gets user name and data version
    call get_environment_variable("USER",usr)
    call get_environment_variable("IMAS_VERSION", imasVersion)

    ! Open a database
    call imas_open_env(treename, shot, run, idx, usr, database, imasVersion)


    ! Get data
    call ids_get(idx, 'core_profiles', ids)

    write (*,*) "Time : ", ids%time
    write (*,*) "Value: ", ids%global_quantities%ip

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



Code Block
titleIMAS Fortran :: getSlice
linenumberstrue
program test
    use ids_schemas
    use ids_routines
    implicit none


    type (ids_core_profiles) :: ids ! <= IDS object

    character(len=3)    :: treename = 'ids'
    character(len=20)   :: database = 'test'
    integer             :: shot = 12
    integer             :: run = 22
    character(len=20)   :: usr
    character(len=20)   :: imasVersion
    integer             :: idx

    integer :: i

    ! Gets user name and data version
    call get_environment_variable("USER",usr)
    call get_environment_variable("IMAS_VERSION", imasVersion)

    ! Open a database
    call imas_open_env(treename, shot, run, idx, usr, database, imasVersion)

    ! Get data
    call ids_get_slice(idx, 'core_profiles', ids, 3.0, 1)

    write (*,*) "Time  : ", ids%time
    write (*,*) "Value : ", ids%global_quantities%ip

    ! Memory clean-up
    call ids_deallocate(ids)

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





Code Block
languagebash
titleBuilding the code
F90_ifort=ifort
COPTS_ifort = -r8 `pkg-config imas-ifort --cflags` 
LIBS_ifort=`pkg-config imas-ifort --libs` 

all: ids_get.exe ids_put.exe ids_getSlice.exe ids_putSlice.exe

%.exe: %.f90
	$(F90_ifort) $(COPTS_ifort) -o $@ $< $(LIBS_ifort)

clean:
	rm -f *.o *.exe