Versions Compared

Key

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

...

putputSlice


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

int main(int argc, char *argv[])
{
	int number = 10; //number of elements

	
    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(123shot, 1run, 123-1, -1);

    	imas.create(createEnv(userName, database, imasVersion);
	
   	IDS::core_profiles ids = imas._core_profiles;
	
	    // Mandatory to define this property
	    ids.ids_properties.homogeneous_time = 1; 
	
	IDS_TIME_MODE_HOMOGENEOUS;

    // allocate the CPO structures
	    ids.time.resize(number10);
	    ids.global_quantities.ip.resize(number10);

	    // Fill IDS time-independent fields
	    ids.ids_properties.comment = "IDS createdstored by C++ PUTput (CPP)";
	
	    // Fill IDS time-dependent fields
 	    for(int i=0; i < number10; i++)
	{
  		ids.x.y    {
        // Do not forget time!!
        ids.time(i) = VALUE(i) ;
		
		
        // DoSetting notvalues forgetof time!!
 		ids.timedata
        ids.global_quantities.ip(i) = TIME2*i;
	    }

    	
	// Save data in the database
    	ids.put();
 	
	
    // Close the pulse file
   	 imas.close();
}



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

int main(int argc, char *argv[])
{
	//Create a new instance of database
	IDS imas(12, 2, -1, -1);
 	imas.create();

	IDS::core_profiles ids = imas._core_profiles;
	
	//! Mandatory to define this property
	ids.ids_properties.homogeneous_time = 1; 

	// Fill IDS time-independent fields
	ids.ids_properties.comment = "IDS created by C++ PUT";
 	ids.putNonTimed();
 	
	// Fill IDS time-dependent fields
	ids.global_quantities.ip.resize(1); 
   	ids.global_quantities.ip(0) = VALUE;
	
	

	// Do not forget time!!
	ids.time.resize(1);
	ids.time(0) = TIME;

	// Save data in the database
 	ids.putSlice();

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


...