Versions Compared

Key

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

...

putSlice() CPO vs IDS
Code Block
titleITM
linenumberstrue
 
Code Block
titleIMAS
linenumberstrue
  2 
 //Definition of the class structures in file UALClasses.h
#include "UALClasses.h"
  3
  4 using namespace IdsNs;
  5
  6
  7 int main(int argc, char *argv[])
  8 {
  9
 10  IdsNs::IDS imas(12, 2, -1, -1);
 11  imas.create();
 12
 13
 14 IdsNs:IDS::core_profiles ids = imas._core_profiles;
 15 ids.ids_properties.homogeneous_time = 1; //! Mandatory to define this property
 16 ids.ids_properties.comment = "This is a test ids V3 Put_slice by C++";
 17
 18  puts("Start Put non-timed");
 19  ids.putNonTimed();
 20  puts("Completed Put non-timed");
 21
 22  ids.time.resize(1);
 23  ids.global_quantities.ip.resize(1); // Allocate all variables, time coordinate of size 1
 24
 25   //
 26    ids.global_quantities.ip(0) = 11;
 27    ids.time(0) = 1;
 28
 29    ids.putSlice();
 30    printf("PutSlice core_profiles IDS ");
 31
 32  imas.close();
 33 }

3.2.4 CPO/IDS get

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
#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();
}

...