...
Sample, shown below, will access IDS data and print it on console.
Warning | ||
---|---|---|
| ||
Source code for this sample can be found at following location
Note that workflow is running such way it reads data from pulse file of user |
Preparing the code
First of all, we need simple code that will read data. In this sample, we will use very simple code that reads distribution IDS, shows some info, and output scalar value
...
First of all, let's add two ports into actor. Input port - IDS, and output port - integer.
Now, let's take a look how the native code should look like in order to provide correct implementation of the actor's API.
Now, once we know how our interface looks like, we can start developing the code
...
As you recall from previous session (dedicated to FC2K) we have to have library that contains native code we are supposed to run.
Let's prepare it. We will do it, by creating Makefile
project - library will be called libdistribution_disp.a
...
Code Block |
---|
> make first ifort -g -O0 -assume no2underscore -fPIC -shared-intel -c -o distribution_disp.o distribution_disp.f90 `pkg-config --cflags imas-ifort imas-lowlevel` `pkg-config --libs imas-ifort imas-lowlevel` ar -rvs libdistribution_disp.a distribution_disp.o ar: creating libdistribution_disp.a a - distribution_disp.o |
Describing the actor
...
Now, go ahed and take a look at Interface again. You can observe that now, interface is complete and perfectly matches your code (can you spot the difference?).
Choosing compiler
The only thing that is left is to set proper values for the compiler. Make sure we are using Fortran and the vendor is set to Intel
We have all we need to build our first, IMAS based, actor. Press Generate.
...
Now it's time to put all the things together. Start your Kepler and create following workflow.
Now we can run it.
As you can see, the result is exactly the same as we have expected. Now, let's try to get some data from the IDS.
...
we can run workflow again. This time, the value is coming from the IDS.