Versions Compared

Key

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

...

CHEAT SHEET
ITMIMAS
#include "UALClasses.h"#include "UALClasses.h"
using namespace ItmNs;
using namespace IdsNs;
ItmNs::Itm itm(123,1,123,0);
  IdsNs::Ids ids(shot,run,refshot,refrun);
  
  
  
  
  
  
  
  
  
  
  
  
  

 

...

put() CPO vs IDS
Code Block
titleITM
linenumberstrue
 #include "UALClasses.h"
using namespace ItmNs;
int main(int argc, char *argv[])
{
	int number = 10; //number of elements

    ItmNs::Itm itm(123, 1, 123, 1);
    itm.create(); //Create a new instance of database

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

    cpoArray.array.resize(number);
    //Fill some fields of the CPO arrayinstances
    for(int k = 0; k < number; k++)
    {
           cpoArray(k).codeparam.parameters.assign("xmltoken");
            //Never forget to store the time for time dependent CPOs!!
            cpoArray(k).time = k;
    }
    //Now the CPO array is filled, we store in the database via method put()
    cpoArray.put();
    itm.close();
}
Code Block
titleIMAS
linenumberstrue
 #include "UALClasses.h"
using namespace IdsNs;
int main(int argc, char *argv[])
{
	int number = 10; //number of elements
  	
  	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.comment = "This is a test ids V3 Put by C++";
 	ids.time.resize(10);
	ids.global_quantities.ip.resize(10);
	for(int i=0; i < 10; i++)
	{
  		ids.global_quantities.ip(i) = i * 10 ;
  		ids.time(i) = i;
	}
 	printf("\nStart Putting the core_profiles IDS\n");
 	ids.put();
 	printf("core_profiles IDS shot:%d, run:%d, refshot:%d, refrun:%d saved\n", shot, run, refshot, refrun);
 	vi imas.close();
}

 

 

3.2.3 CPO/IDS putSlice

 

...

get() CPO vs IDS
Code Block
titleITM
linenumberstrue
  #include "UALClasses.h"
//This routine writes an array of pfsystems CPOs in the database, filling some fields of the CPOS
int main(int argc, char *argv[])
{
    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._pfsystemsArray(i).pfsupplies.voltage.value <<"\n";
     }
     itm.close();
}
Code Block
titleIMAS
linenumberstrue
pr#include "UALClasses.h"
using namespace IdsNs;
int main(int argc, char *argv[])
{
   int number;
   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("IP: %g",ids.global_quantities.ip(j));
   puts("");
   }
    imas.close();
}

 

3.2.5 CPO/IDS getSlice

 getSlice() CPO vs IDS
Code Block
languagecpp
titleITM
linenumberstrue
pro
Code Block
titleIMAS
linenumberstrue
p