void SimpleMCModelerWidget::on_numstatesEdit_valueChanged(const QString & newText)
{
	ComputationParameters params = modeler->getParameters();
	params.setInt(SimpleMCModeler::PARAM_NUMSTATES, newText.toInt());
	modeler->setParameters(params);

	saveInt(SimpleMCModeler::PARAM_NUMSTATES, newText.toInt());
}
void AutoSMPModelerWidget::on_numdstepsEdit_valueChanged(const QString & newText)
{
	ComputationParameters params = modeler->getParameters();
	params.setInt(AutoSMPModeler::PARAM_NUMDSTEPS, newText.toInt());
	modeler->setParameters(params);
	
	saveInt(AutoSMPModeler::PARAM_NUMDSTEPS, newText.toInt());
}
Beispiel #3
0
Magic3D::XMLElement* Magic3D::Object::save(XMLElement* root)
{
    if (root)
    {
        saveString(root, M3D_OBJECT_XML_NAME,        getName());
        saveString(root, M3D_OBJECT_XML_SCRIPT,      getScript());
        saveString(root, M3D_OBJECT_XML_PARENT,      getParent() ? getParent()->getName().c_str() : M3D_XML_NULL);
        saveString(root, M3D_OBJECT_XML_PARENT_BONE, getParentBone() ? getParentBone()->getName().c_str() : M3D_XML_NULL);

        saveBool(root,   M3D_OBJECT_XML_PARENT_POSITION, isParentPosition());
        saveBool(root,   M3D_OBJECT_XML_PARENT_ROTATION, isParentRotation());
        saveBool(root,   M3D_OBJECT_XML_PARENT_SCALE, isParentScale());

        saveInt(root,    M3D_OBJECT_XML_RENDER,    getRender());
        saveInt(root,    M3D_OBJECT_XML_TYPE,      getType());
        saveInt(root,    M3D_OBJECT_XML_FLAG,      getFlag());
        saveInt(root,    M3D_OBJECT_XML_BILLBOARD, getBillboard());

        saveBool(root,   M3D_OBJECT_XML_ENABLED,  isEnabled());
        saveBool(root,   M3D_OBJECT_XML_VISIBLE,  isVisible());
        saveBool(root,   M3D_OBJECT_XML_ZORDER,   isZOrder());
        saveBool(root,   M3D_OBJECT_XML_PICK,     isPickable());

        saveVector3(root, M3D_OBJECT_XML_POSITION, getPosition());
        saveVector4(root, M3D_OBJECT_XML_ROTATION, Vector4(getRotation()));
        saveVector3(root, M3D_OBJECT_XML_SCALE,    getScale());

        saveBool(root,    M3D_OBJECT_XML_SCRIPTED,  isScripted());

        std::vector<Mesh*>::const_iterator it_m = meshes.begin();
        while (it_m != meshes.end())
        {
            Mesh* mesh = *it_m++;

            XMLElement* meshtXML = root->GetDocument()->NewElement( M3D_MESH_XML );
            meshtXML->SetAttribute("materials", (int)mesh->getMaterials()->size());
            root->LinkEndChild( meshtXML );

            mesh->save(meshtXML);
        }

        PhysicsObject::save(root);
    }
    return root;
}
void WienerHopfLVWidget::initModel()
{
	// Create new parameter object
	ComputationParameters params;

	// Set default values
	params.setReal(SMPWienerHopf::PARAM_EPSILON, 1e-15);
	params.setInt(SMPWienerHopf::PARAM_NUMITERATIONS, 200);
	params.setInt(SMPWienerHopf::PARAM_RELAXATIONSTEPS, 0);

	// Use saveXXX methods to set to XML data.
	saveReal(SMPWienerHopf::PARAM_EPSILON, params.getReal(SMPWienerHopf::PARAM_EPSILON));
	saveInt(SMPWienerHopf::PARAM_NUMITERATIONS, params.getInt(SMPWienerHopf::PARAM_NUMITERATIONS));

	// Get parent data
	const SSMPQueue *queue = ((SSMPQueueDisplayWidget*) parentModule)->getSSMPQueue();

	whComputation = new SMPWienerHopfLV(queue, params);
}
Beispiel #5
0
Magic3D::XMLElement* Magic3D::TextData::save(XMLElement* root)
{
    if (root)
    {
        saveString(root, M3D_TEXT_XML_TEXT, text);
        if (font)
        {
            saveString(root, M3D_TEXT_XML_FONT, font->getName());
        }
        else
        {
            saveString(root, M3D_TEXT_XML_FONT, M3D_DEFAULT_FONT);
        }
        saveInt(root, M3D_TEXT_XML_ALIGNMENT, textAlignment);
        saveColorRGBA(root, M3D_TEXT_XML_COLOR, textColor);
        saveFloat(root, M3D_TEXT_XML_SIZE, textSize);
    }
    return root;
}
void GeneticFrameModelerWidget::postCreation(){
	ComputationParameters params = this->modeler->getParameters();

	saveInt( GeneticFrameModeler::PARAM_NUMDSTEPS , params.getInt( GeneticFrameModeler::PARAM_NUMDSTEPS ) );
	saveInt( GeneticFrameModeler::PARAM_NUMSTATES , params.getInt( GeneticFrameModeler::PARAM_NUMSTATES ) );
	saveInt( GeneticFrameModeler::PARAM_AUTOC , params.getInt( GeneticFrameModeler::PARAM_AUTOC ) );
	saveInt( GeneticFrameModeler::PARAM_NUMITERATIONS , params.getInt( GeneticFrameModeler::PARAM_NUMITERATIONS ) );
	saveInt( GeneticFrameModeler::PARAM_NUMPOOLSIZE , params.getInt( GeneticFrameModeler::PARAM_NUMPOOLSIZE ) );
	saveReal( GeneticFrameModeler::PARAM_MUTBLOCK , params.getReal( GeneticFrameModeler::PARAM_MUTBLOCK ) );
	saveReal( GeneticFrameModeler::PARAM_MUTINVERSE , params.getReal( GeneticFrameModeler::PARAM_MUTINVERSE ) );
	saveReal( GeneticFrameModeler::PARAM_MUTSHUFFLE , params.getReal( GeneticFrameModeler::PARAM_MUTSHUFFLE ) );
	saveReal( GeneticFrameModeler::PARAM_MUTSWAP , params.getReal( GeneticFrameModeler::PARAM_MUTSWAP ) );
	saveReal( GeneticFrameModeler::PARAM_MUTCROSSOVER , params.getReal( GeneticFrameModeler::PARAM_MUTCROSSOVER ) );
	saveInt( GeneticFrameModeler::PARAM_FRAMELEVEL, params.getInt( GeneticFrameModeler::PARAM_FRAMELEVEL ) );
}
Beispiel #7
0
/** Execute the algorithm. Currently just calls SaveISISNexusProcessed but could
 *  call write other formats if support added
 *
 *  @throw runtime_error Thrown if algorithm cannot execute
 */
void SaveISISNexus::exec() {
  // Retrieve the filename from the properties
  inputFilename = getPropertyValue("InputFileName");

  m_isisRaw = new ISISRAW2;
  rawFile = fopen(inputFilename.c_str(), "rb");
  if (rawFile == nullptr) {
    throw Exception::FileError("Cannot open file ", inputFilename);
  }
  m_isisRaw->ioRAW(rawFile, true);

  nper = m_isisRaw->t_nper; // number of periods
  nsp = m_isisRaw->t_nsp1;  // number of spectra
  ntc = m_isisRaw->t_ntc1;  // number of time channels
  nmon = m_isisRaw->i_mon;  // number of monitors
  ndet = m_isisRaw->i_det;  // number of detectors

  std::string outputFilename = getPropertyValue("OutputFileName");

  NXstatus status;
  float flt;

  status = NXopen(outputFilename.c_str(), NXACC_CREATE5, &handle);
  if (status != NX_OK) {
    throw std::runtime_error("Cannot open file " + outputFilename +
                             " for writing.");
  }
  NXmakegroup(handle, "raw_data_1", "NXentry");
  NXopengroup(handle, "raw_data_1", "NXentry");
  write_isis_vms_compat();
  saveString("beamline", " ");

  flt = static_cast<float>(m_isisRaw->rpb.r_dur); // could be wrong
  saveFloatOpen("collection_time", &flt, 1);
  putAttr("units", "second");
  close();

  saveStringOpen("definition", "TOFRAW");
  putAttr("version", "1.0");
  putAttr("url",
          "http://definition.nexusformat.org/instruments/TOFRAW/?version=1.0");
  close();

  saveStringOpen("definition_local", "ISISTOFRAW");
  putAttr("version", "1.0");
  putAttr("url",
          "http://svn.isis.rl.ac.uk/instruments/ISISTOFRAW/?version=1.0");
  close();

  flt = static_cast<float>(m_isisRaw->rpb.r_dur);
  saveFloatOpen("duration", &flt, 1);
  putAttr("units", "second");
  close();

  start_time_str.assign(m_isisRaw->hdr.hd_date, m_isisRaw->hdr.hd_date + 12);
  toISO8601(start_time_str);
  start_time_str += 'T';
  start_time_str +=
      std::string(m_isisRaw->hdr.hd_time, m_isisRaw->hdr.hd_time + 8);
  saveCharOpen("start_time", &start_time_str[0], 19);
  putAttr("units", "ISO8601");
  close();

  std::string str;
  str.assign(m_isisRaw->rpb.r_enddate, m_isisRaw->rpb.r_enddate + 12);
  toISO8601(str);
  str += 'T';
  str += std::string(m_isisRaw->rpb.r_endtime, m_isisRaw->rpb.r_endtime + 8);
  saveCharOpen("end_time", &str[0], 19);
  putAttr("units", "ISO8601");
  close();

  saveChar("title", m_isisRaw->r_title, 80);
  saveInt("good_frames", &m_isisRaw->rpb.r_goodfrm);

  std::string experiment_identifier = std::to_string(m_isisRaw->rpb.r_prop);
  saveChar("experiment_identifier", &experiment_identifier[0],
           static_cast<int>(experiment_identifier.size()));
  int tmp_int(0);
  saveInt("measurement_first_run", &tmp_int);
  saveString("measurement_id", " ");
  saveString("measurement_label", " ");
  saveString("measurement_subid", " ");
  saveString("measurement_type", " ");

  saveCharOpen("name", &m_isisRaw->i_inst, 8);
  putAttr("short_name", m_isisRaw->hdr.inst_abrv, 3);
  close();

  logNotes();

  saveString("program_name", "isisicp");

  saveFloatOpen("proton_charge", &m_isisRaw->rpb.r_gd_prtn_chrg, 1);
  putAttr("units", "uamp.hour");
  close();

  saveFloatOpen("proton_charge_raw", &m_isisRaw->rpb.r_tot_prtn_chrg, 1);
  putAttr("units", "uamp.hour");
  close();

  saveInt("raw_frames", &m_isisRaw->rpb.r_rawfrm);

  run_cycle();

  saveInt("run_number", &m_isisRaw->r_number);

  // script_name
  // seci_config

  instrument();

  make_detector_1_link();

  write_monitors();

  user();

  sample();

  runlog();

  selog();

  NXclosegroup(handle); // raw_data_1
  status = NXclose(&handle);

  delete m_isisRaw;
}
Beispiel #8
0
/// Write isis_vms_compat
void SaveISISNexus::write_isis_vms_compat() {
  NXmakegroup(handle, "isis_vms_compat", "IXvms");
  NXopengroup(handle, "isis_vms_compat", "IXvms");
  int ndet = m_isisRaw->i_det;
  int nmon = m_isisRaw->i_mon;

  saveInt("ADD", &m_isisRaw->add, 9);
  saveInt("CODE", m_isisRaw->code, ndet);
  saveInt("CRAT", m_isisRaw->crat, ndet);

  write_rpb();
  write_spb();
  write_vpb();
  saveInt("DAEP", &m_isisRaw->daep, 64);
  saveInt("DELT", m_isisRaw->delt, ndet);
  saveInt("FORM", &m_isisRaw->data_format);
  saveChar("HDR", &m_isisRaw->hdr, 80);
  saveFloat("LEN2", m_isisRaw->len2, ndet);
  saveInt("MDET", m_isisRaw->mdet, nmon);
  saveInt("MODN", m_isisRaw->modn, ndet);
  saveInt("MONP", m_isisRaw->monp, nmon);
  saveInt("MPOS", m_isisRaw->mpos, ndet);
  saveChar("NAME", m_isisRaw->i_inst, 8);
  saveInt("NDET", &ndet);
  saveInt("NFPP", &m_isisRaw->t_nfpp);
  saveInt("NMON", &nmon);
  saveInt("NPER", &m_isisRaw->t_nper);
  saveInt("NSER", &m_isisRaw->e_nse);
  saveInt("NSP1", &m_isisRaw->t_nsp1);
  saveInt("NTC1", &m_isisRaw->t_ntc1);
  saveInt("NTRG", &m_isisRaw->t_ntrg);
  saveInt("NUSE", &m_isisRaw->i_use);
  saveInt("PMAP", &m_isisRaw->t_pmap, 256);
  saveInt("PRE1", &m_isisRaw->t_pre1);
  saveInt("RUN", &m_isisRaw->r_number);
  saveInt("SPEC", m_isisRaw->spec, ndet);
  saveInt("TCM1", &m_isisRaw->t_tcm1);
  saveFloat("TCP1", m_isisRaw->t_tcp1, 20);
  saveInt("TIMR", m_isisRaw->timr, ndet);
  saveChar("TITL", m_isisRaw->r_title, 80);
  saveFloat("TTHE", m_isisRaw->tthe, ndet);
  saveInt("UDET", m_isisRaw->udet, ndet);
  saveInt("ULEN", &m_isisRaw->u_len);
  std::string user_info(160, ' ');
  if (m_isisRaw->u_len > 0) {
    std::copy(reinterpret_cast<char *>(&m_isisRaw->user),
              reinterpret_cast<char *>(&m_isisRaw->user) + m_isisRaw->u_len,
              user_info.begin());
  }
  saveString("USER", user_info);
  saveInt("VER1", &m_isisRaw->frmt_ver_no);
  saveInt("VER2", &m_isisRaw->ver2);
  saveInt("VER3", &m_isisRaw->ver3);
  saveInt("VER4", &m_isisRaw->ver4);
  saveInt("VER5", &m_isisRaw->ver5);
  saveInt("VER6", &m_isisRaw->ver6);
  saveInt("VER7", &m_isisRaw->ver7);
  saveInt("VER8", &m_isisRaw->ver8);
  int tmp_int(0);
  saveInt("VER9", &tmp_int);

  int n = m_isisRaw->logsect.nlines;
  log_notes.resize(n);
  for (int i = 0; i < n; ++i) {
    log_notes[i].assign(m_isisRaw->logsect.lines[i].data,
                        m_isisRaw->logsect.lines[i].len);
  }
  int ll = saveStringVectorOpen("NOTE", log_notes);
  saveInt("NTNL", &n);
  saveInt("NTLL", &ll);

  NXclosegroup(handle); // isis_vms_compat
}
Beispiel #9
0
void VNCOptions::Save(char *fname)
{
  for (int i = rfbEncodingRaw; i<= LASTENCODING; i++) {
    char buf[128];
    sprintf(buf, "use_encoding_%d", i);
    saveInt(buf, m_UseEnc[i], fname);
  }
  saveInt("preferred_encoding",	m_PreferredEncoding,fname);
  saveInt("restricted",			m_restricted,		fname);
  saveInt("viewonly",				m_ViewOnly,			fname);
  saveInt("nostatus",				m_NoStatus,			fname);
  saveInt("nohotkeys",				m_NoHotKeys,		fname);
  saveInt("showtoolbar",			m_ShowToolbar,		fname);
  saveInt("AutoScaling",            m_fAutoScaling,     fname);
  saveInt("fullscreen",			m_FullScreen,		fname);
  saveInt("autoDetect", autoDetect, fname);
  saveInt("8bit",					m_Use8Bit,			fname);
  saveInt("shared",				m_Shared,			fname);
  saveInt("swapmouse",			m_SwapMouse,		fname);
  saveInt("belldeiconify",		m_DeiconifyOnBell,	fname);
  saveInt("emulate3",				m_Emul3Buttons,		fname);
  saveInt("JapKeyboard",				m_JapKeyboard,		fname);
  saveInt("emulate3timeout",		m_Emul3Timeout,		fname);
  saveInt("emulate3fuzz",			m_Emul3Fuzz,		fname);
  saveInt("disableclipboard",		m_DisableClipboard, fname);
  saveInt("localcursor",			m_localCursor,		fname);
  saveInt("Scaling",				m_scaling,		fname);
  saveInt("AutoScaling",			m_fAutoScaling,		fname);
  saveInt("scale_num",			m_scale_num,		fname);
  saveInt("scale_den",			m_scale_den,		fname);
  // Tight Specific
  saveInt("cursorshape",			m_requestShapeUpdates, fname);
  saveInt("noremotecursor",		m_ignoreShapeUpdates, fname);
  if (m_useCompressLevel) {
	saveInt("compresslevel",	m_compressLevel,	fname);
  }
  if (m_enableJpegCompression) {
	saveInt("quality",			m_jpegQualityLevel,	fname);
  }

  // Modif sf@2002
  saveInt("ServerScale",			m_nServerScale,		fname);
  saveInt("Reconnect",				m_reconnectcounter,		fname);
  saveInt("EnableCache",			m_fEnableCache,		fname);
  saveInt("QuickOption",			m_quickoption,	fname);
  saveInt("UseDSMPlugin",			m_fUseDSMPlugin,	fname);
  saveInt("UseProxy",				m_fUseProxy,	fname);
  saveInt("sponsor",				g_disable_sponsor,	fname);

  WritePrivateProfileString("options", "DSMPlugin", m_szDSMPluginFilename, fname);
  //saveInt("AutoReconnect", m_autoReconnect,	fname);
 
  saveInt("ExitCheck",				m_fExitCheck,	fname); //PGM @ Advantig
  saveInt("FileTransferTimeout",    m_FTTimeout,    fname);
  saveInt("KeepAliveInterval",      m_keepAliveInterval,    fname);
}
void SimpleMCModelerWidget::postCreation()
{
	ComputationParameters params = modeler->getParameters();
	saveInt( SimpleMCModeler::PARAM_NUMDSTEPS, params.getInt( SimpleMCModeler::PARAM_NUMDSTEPS ) );
	saveInt( SimpleMCModeler::PARAM_NUMSTATES, params.getInt( SimpleMCModeler::PARAM_NUMSTATES ) );
}
void VNCOptions::Save(char *fname)
{
	for (int i = rfbEncodingRaw; i<= LASTENCODING; i++) {
		char buf[128];
		sprintf(buf, "use_encoding_%d", i);
		saveInt(buf, m_UseEnc[i], fname);
	}
	saveInt("preferred_encoding",	m_PreferredEncoding,fname);
	saveInt("restricted",			m_restricted,		fname);
	saveInt("viewonly",				m_ViewOnly,			fname);
	saveInt("fullscreen",			m_FullScreen,		fname);
	saveInt("8bit",					m_Use8Bit,			fname);
	saveInt("shared",				m_Shared,			fname);
	saveInt("swapmouse",			m_SwapMouse,		fname);
	saveInt("belldeiconify",		m_DeiconifyOnBell,	fname);
	saveInt("emulate3",				m_Emul3Buttons,		fname);
	saveInt("emulate3timeout",		m_Emul3Timeout,		fname);
	saveInt("emulate3fuzz",			m_Emul3Fuzz,		fname);
	saveInt("disableclipboard",		m_DisableClipboard, fname);
	saveInt("localcursor",			m_localCursor,		fname);
	saveInt("scale_num",			m_scale_num,		fname);
	saveInt("scale_den",			m_scale_den,		fname);
}
void PartitionModelerWidget::postCreation() {
    ComputationParameters params = this->modeler->getParameters();

    saveInt(PartitionModeler::PARAM_NUMDSTEPS , params.getInt( PartitionModeler::PARAM_NUMDSTEPS ) );
    saveInt(PartitionModeler::PARAM_NUMSTATES , params.getInt( PartitionModeler::PARAM_NUMSTATES ) );
}