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  ItmNs::of database
    Itm itm(123, 1, 123, 1);
    itm.create(); //Create a new instance of database

  	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();
	 //
	//! Fill the ids fields with data
  	IdsNs::IDS::core_profiles ids = imas._core_profiles;
	
  	ids.ids_properties.homogeneous_time = 1; //! Mandatory to define this property
	ids.ids_properties.commenthomogeneous_time = "This is a test ids V3 Put by C++";
 1; 
	
	// allocate the CPO structures
	ids.time.resize(10number);
	ids.global_quantities.ip.resize(10number);

	// Fill IDS time-independent fields
	ids.ids_properties.comment = "IDS created by C++ PUT";
	
	// Fill IDS time-dependent fields
 	for(int i=0; i < 10number; 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();
 	printf("core_profiles IDS shot:%d, run:%d, refshot:%d, refrun:%d saved\n", shot, run, refshot, refrun);
 	vi 	
	// Close the pulse file
 	imas.close();
}

 

 

3.2.3 CPO/IDS putSlice

 

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

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

	Itm::pfsystems cpo = itm._pfsystems




	// Fill IDS time-independent fields
    cpo.datainfo.dataprovider.assign("USER");
	cpo.putNonTimed();
	
	// Fill IDS time-dependent fields
	 cpo.x.y = VALUE;




    //Do not forget time!!
	cpo.time = TIME;
	

	// Save data in the database
    cpo.putSlice();
	
	// Close the pulse file
	itm.close();
}
Code Block
languagecpp
titleIMAS
linenumberstrue
#include "UALClasses.h"
using namespace IdsNs;

 3
  4 using namespace IdsNs;
  5
  6
  7 int main(int argc, char *argv[])
  8 {
	//Create a 9
new 10instance  IdsNs::of database
	IDS imas(12, 2, -1, -1);
 11  	imas.create();
 12
 13
 14 IdsNs:
	IDS::core_profiles ids = imas._core_profiles;
 15 	
	//! Mandatory to define this property
	ids.ids_properties.homogeneous_time = 1; 

	//! MandatoryFill toIDS define this property
 16 time-independent fields
	ids.ids_properties.comment = "This is a test ids V3 Put_sliceIDS created by C++";
 17
 18  puts("Start Put non-timed") PUT";
 19  	ids.putNonTimed();
 20	
	// Fill puts("Completed Put non-timed");
 21
 22  ids.timeIDS time-dependent fields
	ids.global_quantities.ip.resize(1); 
 23  	ids.global_quantities.ip.resize(10); // Allocate all variables, time coordinate of size 1
 24
 25   //
 26    ids.global_quantities.ip(0) = 11;
 27    = VALUE;
	
	

	// Do not forget time!!
	ids.time.resize(1);
	ids.time(0) = 1TIME;
 28
	// 29Save data in the database
 	ids.putSlice();

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

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 = " << itm._pfsystemsArrayprintf("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
Code Block
languagecpp
titleITM
linenumberstrue
pro
#include "UALClasses.h"
using namespace ItmNs;

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

	Itm::pfsystems cpo = itm._pfsystems;

    //Get the slice corresponding to the passed time
    cpo.getSlice(1.0, 2);

    printf("Time %g ",cpo.time);
 	printf("Value %g",cpo.x.y);

    // Close the pulse file
 	itm.close();
}
Code Block
languagecpp
titleIMAS
linenumberstrue
p#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();
 }