#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");
//Create a new instance of database
IdsNs::IDS imas(shot, run, -1, -1);
imas.createEnv(userName, database, imasVersion);
ids = imas._core_profiles;
// Mandatory to define this property
ids.ids_properties.homogeneous_time = IDS_TIME_MODE_HOMOGENEOUS;
// allocate the CPO structures
ids.time.resize(10);
ids.global_quantities.ip.resize(10);
// Fill IDS time-independent fields
ids.ids_properties.comment = "IDS stored by put (CPP)";
// Fill IDS time-dependent fields
for(int i=0; i < 10; i++)
{
// Do not forget time!!
ids.time(i) = i;
// Setting values of data
ids.global_quantities.ip(i) = 2*i;
}
// Save data in the database
ids.put();
// Close the pulse file
imas.close();
} |