Versions Compared

Key

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

...

Code Block
subroutine distributiondisp(distributionin, output)

  use ids_schemas

  implicit none
 
  type (ids_distribution_sources) :: distributionin
  integer, intent(out)            :: output
 
  output = int( distributionin%time(1) )  ! we are reading data from the IDS and return it back to Kepler
 
  return

end subroutine

As you can see, we don't even access input data, yet. All we have, so far, is the API of the native code.

...

Code Block
# In this sample I will use ifort
# However, depending on target system (where IMAS is installed)
# it might be you have other options as well - e.g.: gfortran, pgi, NAG, etc.

F90      = ifort
COPTS    = -g -O0 -assume no2underscore -fPIC -shared-intel

# Note that you should _always_ use pkg-config to obtain
# flags for compiler and linker
# do not pass hardcoded locations unless it's really unavoidable!

LIBS     = `pkg-config --libs imas-ifort imas-lowlevel`
INCLUDES = `pkg-config --cflags imas-ifort imas-lowlevel`

# It is little bit messy here, but we need two different targets
# for the purpose of the tutorial
# first  - builds very basic code that doesn't touch IDSes data
# second - builds the code that will read IDSed data
#
all: libdistribution_disp.a

libdistribution_disp.a: distribution_disp.o
	ar -rvs $@ $^

distribution_disp.o: distribution_disp.f90
	$(F90) $(COPTS) -c -o $@ $^ ${INCLUDES} $(LIBS)

# try to provide _clean_ target, so you can easily
# cleanup source tree

clean:
  rm -f *.o *.a

...