Versions Compared

Key

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

...

getgetSlice


Code Block
languagecpp
titleIMAS C++ :: get
linenumberstrue
#include  <iostream>

#include "UALClasses.h"
using namespace IdsNs;

int main(int argc, char *argv[])
{
    IDS::core_profiles ids;  // <= IDS object

    const char* treename = "ids";
    const char* database = "test";
    int number;
	 shot = 13;
    int run = 22;
    char*  userName;
    char*  imasVersion;


    // Gets user name and data version
    userName = getenv("USER");
    imasVersion = getenv("IMAS_VERSION");

    //Open the database
 	    IdsNs::IDS imas(12shot, 2run, -1, -1);
	    imas.open(); //Open the databaseopenEnv(userName, database, imasVersion);
    
	IdsNs::IDS::core_profiles ids = imas._core_profiles;
   ids.get();

   number = ids.time.extentget(0);
 
   for (int j=0; j< number; j++)
   {
     printf(cout << "Time: " << %g",ids.time(j)) << endl;
    cout printf(<< "Value: %g", " << ids.x.y(j))global_quantities.ip << endl;

   }
 // Close the pulse file
 imas    imas.close();
}



Code Block
languagecpp
titleIMAS C++ :: getSlice
linenumberstrue
#include  <iostream>

#include "UALClasses.h"
using namespace IdsNs;

int main(int argc, char *argv[])
{
	
    IDS::core_profiles ids;  // <= IDS object

    const char* treename = "ids";
    const char* database = "test";
    int shot = 13;
    int run = 22;
    char*  userName;
    char*  imasVersion;


    // Gets user name and data version
    userName = getenv("USER");
    imasVersion = getenv("IMAS_VERSION");

    //Open the database
	    IdsNs::IDS imas(12shot, 2run, -1, -1);
   	 imas.open(openEnv(userName, database, imasVersion); 
   	
	IDS::core_profiles ids = imas._core_profiles;

   	
	 //Get the slice corresponding to the passed time
	    ids.getSlice(12.0, 2);
	
	printf("Time %g",ids.time(0));
  	printf("Value: %g",ids.x.y(0));
	
	
    cout << "Time: " << ids.time << endl;
    cout << "Value: " << ids.global_quantities.ip << endl;

    // Close the pulse file
 	    imas.close();
 }



Code Block
languagecpp
titleBuilding the code
linenumberstrue
CXX=g++
COPTS = -g `pkg-config imas-cpp --cflags`
LIBS =`pkg-config imas-cpp --libs`

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

%.exe: %.cpp
$(CXX) $(COPTS) -o $@ $< $(LIBS)

clean:
rm -f *.o *.exe

...