Versions Compared

Key

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

Table of Contents

 

3.2.1 Changes

CHEAT SHEET
ITMIMAS
#include "UALClasses.h"#include "UALClasses.h"
using namespace ItmNs;
using namespace IdsNs;
ItmNs::Itm itm(123shot,1run,123refshot,0refrun);
  IdsNs::IdsIDS idsimas(shot,run,refshot,refrun);
  
ItmNs::Itm::<cpo_name>Array cpoArray
IdsNs::IDS::<ids_name> ids
ItmNs::Itm::<cpo_name> cpo
IdsNs::IDS::<ids_name> ids
  
  

 

...

 

3.2.2 CPO/IDS put

put() CPO vs IDS
Code Block
languagecpp
titleITM
linenumberstrue
#include "UALClasses.h"
using namespace ItmNs;

int main(int argc, char *argv[])
{
	int number = 10; //number of elements
	
	//Create a new instance of database
    ItmNs::Itm itm(123, 1, 123, 1);
    itm.create(); 

  	ItmNs::Itm::equilibriumArray cpoArray = itm._equilibriumArray;





	

	// allocate the CPO structures
    cpoArray.array.resize(number);
    




	//Fill someCPO fields of the CPO arrayinstances
    for(int k = 0; k < number; k++)
    {
           		cpoArray(k).codeparam.parameters.assign("xmltoken")x.y = VALUE;
            
		//Never forgetDo to store the time for time dependent CPOsnot forget time!!
            cpoArray(k).time = kTIME;
    }

    	//Now theSave CPO array is filled, we store data in the database via method put()
    cpoArray.put();
	
	// Close the pulse file
 	itm.close();
}
Code Block
languagecpp
titleIMAS
linenumberstrue
#include "UALClasses.h"
using namespace IdsNs;

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

	//Create a new instance of database
  	IdsNs::IDS imas(123, 1, 123, 1);
  	imas.create();
	
  	IdsNs::IDS::core_profiles ids = imas._core_profiles;
	
	//! Mandatory to define this property
	ids.ids_properties.homogeneous_time = 1; 
	
	//! Fillallocate the CPO structures
	ids.time.resize(number);
	ids fields with data.global_quantities.ip.resize(number);

	// Fill IDS time-independent fields
	ids.ids_properties.comment = "ThisIDS is a test ids V3 Put created by C++ PUT";
	
	// allocateFill theIDS CPOtime-dependent structuresfields
	ids.time.resize(number);
	ids.global_quantities.ip.resize(number);
	 	for(int i=0; i < number; i++)
	{
  		ids.global_quantitiesx.ipy(i) = VALUE(i * 10 ;
  ) ;
		
		// Do not forget time!!
 		ids.time(i) = iTIME;
	}
 	printf("\nStart Putting the core_profiles IDS\n");
	// Save data in the database
 	ids.put();
 	
	// Close the pulse file
 	imas.close();
}

 

 

3.2.3 CPO/IDS putSlice

 

putSlice() CPO vs IDS
Code Block
languagecpp
titleITM
linenumberstrue
 #include#include "UALClasses.h"
 int
using namespace ItmNs;

int main(int argc, char *argv[])
{

	//Create a new instance of database
    ItmNs::Itm itm(12312, 2,123,0 -1, -1);
        //Create a new instance of database
        itm.create();
        itm._pfsystemsitm.create();

	Itm::pfsystems cpo = itm._pfsystems




	// Fill IDS time-independent fields
    cpo.datainfo.dataprovider.assign("USER");
        itm._pfsystems	cpo.putNonTimed();
	
	// Fill IDS      itm._pfsystems.pfsupplies.voltage.value(i) = 111*(i+1)+1000*k;
        time-dependent fields
	 cpo.x.y = VALUE;




    //Do not forget time!!
            itm._pfsystems.	cpo.time = kTIME;
            
	

	//Append thisSave slicedata in the database
            itm._pfsystemscpo.putSlice();
	
	// Close the      pulse file
	itm.close();
}
Code Block
languagecpp
titleIMAS
linenumberstrue
  
 //Definition of the class structures in file UALClasses.h
#include "UALClasses.h"
using namespace IdsNs;

int main(int argc, char *argv[])
{
 IdsNs::	//Create a new instance of database
	IDS imas(12, 2, -1, -1);
 	imas.create();
IdsNs:
	IDS::core_profiles ids = imas._core_profiles;
	
	//! Mandatory to define this property
	ids.ids_properties.homogeneous_time = 1; 

	//! MandatoryFill toIDS define this property
time-independent fields
	ids.ids_properties.comment = "ThisIDS is a test ids V3 Put_slice created by C++";
 puts("Start Put non-timed") PUT";
 	ids.putNonTimed();
 	
 puts("Completed Put non-timed");
 ids.time.resize(1);
 	// Fill IDS time-dependent fields
	ids.global_quantities.ip.resize(1); // Allocate all variables, time coordinate of size 1
  //
   	ids.global_quantities.ip(0) = 11VALUE;
	
	

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

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

	// Close the printf("PutSlice core_profiles IDS ");pulse file
 	imas.close();
}

3.2.4 CPO/IDS get

get() CPO vs IDS
Code Block
languagecpp
titleITM
linenumberstrue
 #include#include "UALClasses.h"
//Thisusing routine writes an array of pfsystems CPOs in the database, filling some fields of the CPOS
intnamespace ItmNs;

 int main(int argc, char *argv[])
{	
 	int number;
	//Open the database
    ItmNs::Itm itm(12, 2, 12, 2);
    itm.open(); //Open the database
    //Read the whole array of pfsupplies CPOs
        ItmNs::Itm::pfsystemsArray  cpoArray = itm._pfsystemsArray;
        cpoArray.get();
     //field array of inner class _equilbriumArray is a blitz array containing the array of CPOs
     //(objects of class _equilibrium)
     number = cpoArray.array.extent(0);
     //Print the contents of fields time and pfsupplies.voltage.value
     for(int i = 0; i < number; i++)
     {
        printf("Time:  %g",cpoArray(i).time);
        profiles_1d.F_dia = " << printf("Value: %g",cpoArray(i).pfsupplies.voltage.value <<"\n"x.y);
     }
     itm
	
	 itm.close();
}
Code Block
languagecpp
titleIMAS
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();
   printf("ids_properties= comment:%s,"  " Homogeneous:%d\n",
       ids.ids_properties.comment.c_str(),
       ids.ids_properties.homogeneous_time );
   number = ids.time.extent(0);
   printf("Main IDS time:");
   for (int j=0; j< number; j++)
   {
     printf("Time:  %g",ids.time(j));
     printf("IPValue: %g",ids.global_quantitiesx.ipy(j));
   puts("");
   }
// Close the pulse imasfile
 imas.close();
}

 

3.2.5 CPO/IDS getSlice

 getSlice() CPO vs IDS
Code Block
languagecpp
titleITM
linenumberstrue
#include "UALClasses.h"
using namespace ItmNs;

int main(int argc, char *argv[])
{
	//Open the   database
	ItmNs::Itm itm(123,2,123,1);
    itm.open(); //Open the database

	ItmNs::Itm::pfsystems cpo = itm._pfsystems;

    //Get the  CPO slice corresponding to the passed time
    cpo.getSlice(1.0, 2);
    //Dump the whole returned CPO
    printf("Time %g ",cpo.time);
 	printf("Value %g",cpo.x.y);

    // Close the pulse file
  	itm.close();
}
Code Block
languagecpp
titleIMAS
linenumberstrue
//Definition of the class structures in file UALClasses.h
#include "UALClasses.h"
using namespace IdsNs;

int main(int argc, char *argv[])
{
	//Open   IdsNs::the database
	IDS imas(12, 2, -1, -1);
   	imas.open(); //Open the database
   IdsNs::	
	IDS::core_profiles ids = imas._core_profiles;
   	
	//Get the slice corresponding to the passed time
	ids.getSlice(1.0, 2);
   printf("Homogeneous: %d\n",ids.ids_properties.homogeneous_time);
   printf("Comment:     %s\n",ids.ids_properties.comment.c_str());
  printf(" 	
	printf("Time %g",ids.time(0));
  	printf("Value: %g\n",ids.global_quantitiesx.ipy(0));
	
	// Close the pulse file
 	imas.close();
 }