Versions Compared

Key

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

...

getgetSlice


Code Block
languagecpp
titleIMAS C++ :: get
linenumberstrue
#include "UALClasses.h"
using namespace IdsNs;

int main(int argc, char *argv[])
{
   int number;
	//Open the database
 	IdsNs::IDS imas(12, 2, -1, -1);
	imas.open(); //Open the database
    
	IdsNs::IDS::core_profiles ids = imas._core_profiles;
   ids.get();

   number = ids.time.extent(0);
 
   for (int j=0; j< number; j++)
   {
     printf("Time:  %g",ids.time(j));
     printf("Value: %g",ids.x.y(j));
   }
// Close the pulse file
 imas.close();
}



Code Block
languagecpp
titleIMAS C++ :: getSlice
linenumberstrue
#include "UALClasses.h"
using namespace IdsNs;

int main(int argc, char *argv[])
{
	//Open the database
	IDS imas(12, 2, -1, -1);
   	imas.open(); 
   	
	IDS::core_profiles ids = imas._core_profiles;
   	
	//Get the slice corresponding to the passed time
	ids.getSlice(1.0, 2);
	
	printf("Time %g",ids.time(0));
  	printf("Value: %g",ids.x.y(0));
	
	// 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

Unknown macro: {source}