1.1.1. 3.2.1 Changes
CHEAT SHEET | |
ITM | IMAS |
---|---|
#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); |
1.1.2. 3.2.2 CPO/IDS put
put() CPO vs IDS | |
---|---|
ITM #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 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(); } | IMAS #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; //! Fill the ids fields with data ids.ids_properties.comment = "This is a test ids V3 Put by C++"; // allocate the CPO structures ids.time.resize(number); ids.global_quantities.ip.resize(number); for(int i=0; i < number; i++) { ids.global_quantities.ip(i) = i * 10 ; ids.time(i) = i; } printf("\nStart Putting the core_profiles IDS\n"); ids.put(); imas.close(); } |
1.1.3. 3.2.3 CPO/IDS putSlice
putSlice() CPO vs IDS | |
---|---|
ITM #include "UALClasses.h" int main(int argc, char *argv[]) { ItmNs::Itm itm(123,2,123,0); //Create a new instance of database itm.create(); itm._pfsystems.datainfo.dataprovider.assign("USER"); itm._pfsystems.putNonTimed(); itm._pfsystems.pfsupplies.voltage.value(i) = 111*(i+1)+1000*k; //Do not forget time!! itm._pfsystems.time = k; //Append this slice in the database itm._pfsystems.putSlice(); itm.close(); } | IMAS //Definition of the class structures in file UALClasses.h #include "UALClasses.h" using namespace IdsNs; int main(int argc, char *argv[]) { IdsNs::IDS imas(12, 2, -1, -1); imas.create(); 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_slice by C++"; puts("Start Put non-timed"); ids.putNonTimed(); puts("Completed Put non-timed"); ids.time.resize(1); ids.global_quantities.ip.resize(1); // Allocate all variables, time coordinate of size 1 // ids.global_quantities.ip(0) = 11; ids.time(0) = 1; ids.putSlice(); printf("PutSlice core_profiles IDS "); imas.close(); } |
1.1.4. 3.2.4 CPO/IDS get
get() CPO vs IDS | |
---|---|
ITM #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 = " << cpoArray(i).pfsupplies.voltage.value <<"\n"; } itm.close(); } | IMAS #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(); } |
1.1.5. 3.2.5 CPO/IDS getSlice
getSlice() CPO vs IDS | |
---|---|
ITM #include "UALClasses.h" int main(int argc, char *argv[]) { 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); itm.close(); } | IMAS //Definition of the class structures in file UALClasses.h #include "UALClasses.h" using namespace IdsNs; int main(int argc, char *argv[]) { IdsNs::IDS imas(12,2, -1, -1); imas.open(); //Open the database IdsNs::IDS::core_profiles ids = imas._core_profiles; 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(" %g",ids.time(0)); printf(" %g\n",ids.global_quantities.ip(0)); imas.close(); } |