• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ api::IAlgorithm_sptr类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中mantid::api::IAlgorithm_sptr的典型用法代码示例。如果您正苦于以下问题:C++ IAlgorithm_sptr类的具体用法?C++ IAlgorithm_sptr怎么用?C++ IAlgorithm_sptr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了IAlgorithm_sptr类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: exec

/** Run any algorithm with a variable number of parameters
 *
 * @param algorithmName
 * @param count :: number of arguments given.
 * @return the algorithm created
 */
IAlgorithm_sptr FrameworkManagerImpl::exec(const std::string& algorithmName, int count, ...)
{
  // Create the algorithm
  Mantid::API::IAlgorithm_sptr alg;
  alg = Mantid::API::AlgorithmManager::Instance().createUnmanaged(algorithmName, -1);
  alg->initialize();
  if (!alg->isInitialized())
    throw std::runtime_error(algorithmName + " was not initialized.");

  if (count % 2 == 1)
  {
    throw std::runtime_error("Must have an even number of parameter/value string arguments");
  }

  va_list Params;
  va_start(Params, count);
  for(int i = 0; i < count; i += 2 )
  {
    std::string paramName = va_arg(Params, const char *);
    std::string paramValue = va_arg(Params, const char *);
    alg->setPropertyValue(paramName, paramValue);
  }
  va_end(Params);

  alg->execute();
  return alg;
}
开发者ID:trnielsen,项目名称:mantid,代码行数:33,代码来源:FrameworkManager.cpp


示例2: ungroupWorkspaces

void WorkspacePresenter::ungroupWorkspaces() {
  auto view = lockView();
  auto selected = view->getSelectedWorkspaceNames();

  if (selected.size() == 0) {
    view->showCriticalUserMessage("Error Ungrouping Workspaces",
                                  "Select a group workspace to Ungroup.");
    return;
  }

  try {
    // workspace name
    auto wsname = selected[0];

    std::string algName("UnGroupWorkspace");
    Mantid::API::IAlgorithm_sptr alg =
        Mantid::API::AlgorithmManager::Instance().create(algName, -1);
    alg->initialize();
    alg->setProperty("InputWorkspace", wsname);

    // execute the algorithm
    bool bStatus = alg->execute();
    if (!bStatus) {
      view->showCriticalUserMessage("MantidPlot - Algorithm error",
                                    " Error in UnGroupWorkspace algorithm");
    }
  } catch (...) {
    view->showCriticalUserMessage("MantidPlot - Algorithm error",
                                  " Error in UnGroupWorkspace algorithm");
  }
}
开发者ID:rosswhitfield,项目名称:mantid,代码行数:31,代码来源:WorkspacePresenter.cpp


示例3: algName

    /** This method executes the ListInstruments algorithm
     * and fills the instrument box with instrument lists returned by ICat API
     * @return shared pointer to workspace which contains instrument names
     */
    std::vector<std::string> ICatUtils::executeListInstruments()
    {
      QString algName("CatalogListInstruments");
      const int version=-1;
      Mantid::API::IAlgorithm_sptr alg;
      try
      {
        alg = Mantid::API::AlgorithmManager::Instance().create(algName.toStdString(),version);
      }
      catch(...)
      {
        throw std::runtime_error("Error when Populating the instrument list box");

      }

      Poco::ActiveResult<bool> result(alg->executeAsync());
      while( !result.available() )
      {
        QCoreApplication::processEvents();
      }
      if(!alg->isExecuted())
      {
        //if the algorithm failed check the session id passed is valid
        if(!isSessionValid(alg))
        {
          //at this point session is invalid, popup loginbox to login
          if(login())
          {
            //now populate instrument box
            std::vector<std::string> instruments =executeListInstruments();
            return instruments;
          }
          else
          {
            throw std::runtime_error("Please Login to the information catalog using the login menu provided to do the investigation search.");
          }
        }
        else
        {
          return std::vector<std::string>();
        }
      }
      std::vector<std::string>instrlist;
      try
      {

        instrlist= alg->getProperty("InstrumentList");
      }
      catch (Mantid::Kernel::Exception::NotFoundError&)
      {
        throw;
      }
      return instrlist;

    }
开发者ID:trnielsen,项目名称:mantid,代码行数:59,代码来源:ICatUtils.cpp


示例4: add

/** Add a new algorithm to the list monitored
 *
 * @param alg :: algorithm to monitor.
 */
void AlgorithmMonitor::add(Mantid::API::IAlgorithm_sptr alg) {
  lock();
  alg->addObserver(m_finishedObserver);
  alg->addObserver(m_errorObserver);
  alg->addObserver(m_progressObserver);
  m_algorithms.push_back(alg->getAlgorithmID());
  ++m_nRunning;
  emit algorithmStarted(alg->getAlgorithmID());
  emit countChanged();
  unlock();
}
开发者ID:rosswhitfield,项目名称:mantid,代码行数:15,代码来源:AlgorithmMonitor.cpp


示例5: executeGetdataFiles

    /// execute getdatafIles algorithm
    ITableWorkspace_sptr ICatInvestigation::executeGetdataFiles()
    {
      QString algName("CatalogGetDataFiles");
      const int version=1;
      Mantid::API::ITableWorkspace_sptr  ws_sptr;
      Mantid::API::IAlgorithm_sptr alg;
      try
      {
        alg = Mantid::API::AlgorithmManager::Instance().create(algName.toStdString(),version);
      }
      catch(...)
      {
        throw std::runtime_error("Error when loading the data files associated to the selected investigation ");
      }
      try
      {
        alg->setProperty("InvestigationId",m_invstId);
        alg->setProperty("FilterLogFiles",isDataFilesChecked());
        alg->setPropertyValue("OutputWorkspace","datafiles");
      }
      catch(std::invalid_argument& e)
      {
        emit error(e.what());
        return ws_sptr;
      }
      catch (Mantid::Kernel::Exception::NotFoundError& e)
      {
        emit error(e.what());
        return ws_sptr;
      }

      try
      {
        Poco::ActiveResult<bool> result(alg->executeAsync());
        while( !result.available() )
        {
          QCoreApplication::processEvents();
        }
      }
      catch(...)
      {
        return ws_sptr;
      }
      if(AnalysisDataService::Instance().doesExist("datafiles"))
      {
        ws_sptr = boost::dynamic_pointer_cast<Mantid::API::ITableWorkspace>
        (AnalysisDataService::Instance().retrieve("datafiles"));
      }
      return ws_sptr;

    }
开发者ID:trnielsen,项目名称:mantid,代码行数:52,代码来源:ICatInvestigation.cpp


示例6: executeAsynchronously

/**
 * Execute the given algorithm asynchronously.
 * @param algorithm :: The algorithm to execute.
 */
void CatalogHelper::executeAsynchronously(
    const Mantid::API::IAlgorithm_sptr &algorithm) {
  Poco::ActiveResult<bool> result(algorithm->executeAsync());
  while (!result.available()) {
    QCoreApplication::processEvents();
  }
}
开发者ID:liyulun,项目名称:mantid,代码行数:11,代码来源:CatalogHelper.cpp


示例7: updateAlgorithm

/**
     Upadates the non-default algorithm properties in the history.
     @param alg :: Pointer to the algorthm
*/
void InputHistoryImpl::updateAlgorithm(Mantid::API::IAlgorithm_sptr alg)
{
    const std::vector< Property* >& props = alg->getProperties();
    QList< PropertyData > prop_hist_list;
    for(std::vector< Property* >::const_iterator prop=props.begin();prop!=props.end();++prop)
    if (!(*prop)->isDefault())
    {
        PropertyData prop_hist(QString::fromStdString((*prop)->name()),QString::fromStdString((*prop)->value()));
        prop_hist_list.push_back(prop_hist);
    }
    else
    {
        PropertyData prop_hist(QString::fromStdString((*prop)->name()),"");
        prop_hist_list.push_back(prop_hist);
    }
    m_history[QString::fromStdString(alg->name())] = prop_hist_list;
}
开发者ID:jkrueger1,项目名称:mantid,代码行数:21,代码来源:InputHistory.cpp


示例8: setupFit

void ConvFit::setupFit(Mantid::API::IAlgorithm_sptr fitAlgorithm) {
  if (boolSettingValue("UseTempCorrection"))
    m_convFittingModel->setTemperature(doubleSettingValue("TempCorrection"));
  else
    m_convFittingModel->setTemperature(boost::none);
  fitAlgorithm->setProperty("ExtractMembers",
                            boolSettingValue("ExtractMembers"));
  IndirectFitAnalysisTab::setupFit(fitAlgorithm);
}
开发者ID:mantidproject,项目名称:mantid,代码行数:9,代码来源:ConvFit.cpp


示例9: index

/**
* Create a list of file extensions from the given algorithm
* @param algName :: The name of the algorithm
* @param propName :: The name of the property
* @returns A list of file extensions
*/
QStringList
MWRunFiles::getFileExtensionsFromAlgorithm(const QString &algName,
                                           const QString &propName) {
  Mantid::API::IAlgorithm_sptr algorithm =
      Mantid::API::AlgorithmManager::Instance().createUnmanaged(
          algName.toStdString());
  QStringList fileExts;
  if (!algorithm)
    return fileExts;
  algorithm->initialize();
  Property *prop = algorithm->getProperty(propName.toStdString());
  FileProperty *fileProp = dynamic_cast<FileProperty *>(prop);
  MultipleFileProperty *multiFileProp =
      dynamic_cast<MultipleFileProperty *>(prop);

  std::vector<std::string> allowed;
  QString preferredExt;

  if (fileProp) {
    allowed = fileProp->allowedValues();
    preferredExt = QString::fromStdString(fileProp->getDefaultExt());
  } else if (multiFileProp) {
    allowed = multiFileProp->allowedValues();
    preferredExt = QString::fromStdString(multiFileProp->getDefaultExt());
  } else {
    return fileExts;
  }

  std::vector<std::string>::const_iterator iend = allowed.end();
  int index(0);
  for (std::vector<std::string>::const_iterator it = allowed.begin();
       it != iend; ++it) {
    if (!it->empty()) {
      QString ext = QString::fromStdString(*it);
      fileExts.append(ext);
      if (ext == preferredExt) {
        fileExts.move(index, 0);
      }
      ++index;
    }
  }

  return fileExts;
}
开发者ID:rosswhitfield,项目名称:mantid,代码行数:50,代码来源:MWRunFiles.cpp


示例10: setSearchProperties

    /**
     * Set the "search" properties to their related input fields.
     * @param catalogAlgorithm :: Algorithm to set the search properties for.
     * @param userInputFields  :: The search properties to set against the algorithm.
     */
    void CatalogHelper::setSearchProperties(const Mantid::API::IAlgorithm_sptr &catalogAlgorithm,
        const std::map<std::string, std::string> &userInputFields)
    {
      // This will be the workspace where the content of the search result is output to.
      catalogAlgorithm->setProperty("OutputWorkspace", "__searchResults");

      // Iterate over the provided map of user input fields. For each field that isn't empty (e.g. a value was input by the user)
      // then we will set the algorithm property with the key and value of that specific value.
      for (auto it = userInputFields.begin(); it != userInputFields.end(); it++)
      {
        std::string value = it->second;
        // If the user has input any search terms.
        if (!value.empty())
        {
          // Set the property that the search algorithm uses to: (key => FieldName, value => FieldValue) (e.g., (Keywords, bob))
          catalogAlgorithm->setProperty(it->first, value);
        }
      }
    }
开发者ID:Mantid-Test-Account,项目名称:mantid,代码行数:24,代码来源:CatalogHelper.cpp


示例11: plusWs

/**
 * Plus two workspaces together, "in place".
 *
 * @param ws1 :: The first workspace.
 * @param ws2 :: The second workspace.
 *
 * @returns a pointer to the result (the first workspace).
 */
API::Workspace_sptr Load::plusWs(Workspace_sptr ws1, Workspace_sptr ws2) {
  WorkspaceGroup_sptr group1 = boost::dynamic_pointer_cast<WorkspaceGroup>(ws1);
  WorkspaceGroup_sptr group2 = boost::dynamic_pointer_cast<WorkspaceGroup>(ws2);

  if (group1 && group2) {
    // If we're dealing with groups, then the child workspaces must be added
    // separately - setProperty
    // wont work otherwise.
    std::vector<std::string> group1ChildWsNames = group1->getNames();
    std::vector<std::string> group2ChildWsNames = group2->getNames();

    if (group1ChildWsNames.size() != group2ChildWsNames.size())
      throw std::runtime_error("Unable to add group workspaces with different "
                               "number of child workspaces.");

    auto group1ChildWsName = group1ChildWsNames.begin();
    auto group2ChildWsName = group2ChildWsNames.begin();

    for (; group1ChildWsName != group1ChildWsNames.end();
         ++group1ChildWsName, ++group2ChildWsName) {
      Workspace_sptr group1ChildWs = group1->getItem(*group1ChildWsName);
      Workspace_sptr group2ChildWs = group2->getItem(*group2ChildWsName);

      Mantid::API::IAlgorithm_sptr plusAlg = createChildAlgorithm("Plus", 1);
      plusAlg->setProperty<Workspace_sptr>("LHSWorkspace", group1ChildWs);
      plusAlg->setProperty<Workspace_sptr>("RHSWorkspace", group2ChildWs);
      plusAlg->setProperty<Workspace_sptr>("OutputWorkspace", group1ChildWs);
      plusAlg->executeAsChildAlg();
    }
  } else if (!group1 && !group2) {
    Mantid::API::IAlgorithm_sptr plusAlg = createChildAlgorithm("Plus", 1);
    plusAlg->setProperty<Workspace_sptr>("LHSWorkspace", ws1);
    plusAlg->setProperty<Workspace_sptr>("RHSWorkspace", ws2);
    plusAlg->setProperty<Workspace_sptr>("OutputWorkspace", ws1);
    plusAlg->executeAsChildAlg();
  } else {
    throw std::runtime_error(
        "Unable to add a group workspace to a non-group workspace");
  }

  return ws1;
}
开发者ID:mantidproject,项目名称:mantid,代码行数:50,代码来源:Load.cpp


示例12: setAlgorithm

/**
 * Set the algorithm pointer
 * @param alg :: A pointer to the algorithm
 */
void AlgorithmDialog::setAlgorithm(Mantid::API::IAlgorithm_sptr alg) {
  m_algorithm = alg;
  m_algName = QString::fromStdString(alg->name());
  m_algProperties.clear();
  m_tied_properties.clear();
  std::vector<Mantid::Kernel::Property *>::const_iterator iend =
      alg->getProperties().end();
  for (std::vector<Mantid::Kernel::Property *>::const_iterator itr =
           alg->getProperties().begin();
       itr != iend; ++itr) {
    Mantid::Kernel::Property *p = *itr;
    if (dynamic_cast<Mantid::API::IWorkspaceProperty *>(p) ||
        p->direction() != Mantid::Kernel::Direction::Output) {
      m_algProperties.append(QString::fromStdString(p->name()));
    }
  }

  m_validators.clear();
  m_noValidation.clear();
}
开发者ID:DanNixon,项目名称:mantid,代码行数:24,代码来源:AlgorithmDialog.cpp


示例13: optLattice

/**
  @param  inname       Name of workspace containing peaks
  @param  params       optimized cell parameters
  @param  out          residuals from optimization
*/
void OptimizeLatticeForCellType::optLattice(std::string inname,
                                            std::vector<double> &params,
                                            double *out) {
  PeaksWorkspace_sptr ws = boost::dynamic_pointer_cast<PeaksWorkspace>(
      AnalysisDataService::Instance().retrieve(inname));
  const std::vector<Peak> &peaks = ws->getPeaks();
  size_t n_peaks = ws->getNumberPeaks();
  std::vector<V3D> q_vector;
  std::vector<V3D> hkl_vector;

  for (size_t i = 0; i < params.size(); i++)
    params[i] = std::abs(params[i]);
  for (size_t i = 0; i < n_peaks; i++) {
    q_vector.push_back(peaks[i].getQSampleFrame());
    hkl_vector.push_back(peaks[i].getHKL());
  }

  Mantid::API::IAlgorithm_sptr alg = createChildAlgorithm("CalculateUMatrix");
  alg->setPropertyValue("PeaksWorkspace", inname);
  alg->setProperty("a", params[0]);
  alg->setProperty("b", params[1]);
  alg->setProperty("c", params[2]);
  alg->setProperty("alpha", params[3]);
  alg->setProperty("beta", params[4]);
  alg->setProperty("gamma", params[5]);
  alg->executeAsChildAlg();

  ws = alg->getProperty("PeaksWorkspace");
  OrientedLattice latt = ws->mutableSample().getOrientedLattice();
  DblMatrix UB = latt.getUB();
  DblMatrix A = aMatrix(params);
  DblMatrix Bc = A;
  Bc.Invert();
  DblMatrix U1_B1 = UB * A;
  OrientedLattice o_lattice;
  o_lattice.setUB(U1_B1);
  DblMatrix U1 = o_lattice.getU();
  DblMatrix U1_Bc = U1 * Bc;

  for (size_t i = 0; i < hkl_vector.size(); i++) {
    V3D error = U1_Bc * hkl_vector[i] - q_vector[i] / (2.0 * M_PI);
    out[i] = error.norm2();
  }

  return;
}
开发者ID:mkoennecke,项目名称:mantid,代码行数:51,代码来源:OptimizeLatticeForCellType.cpp


示例14: isSessionValid

    bool ICatUtils::isSessionValid(const Mantid::API::IAlgorithm_sptr& alg)
    {
      try
      {
        return  alg->getProperty("IsValid");
      }
      catch (Mantid::Kernel::Exception::NotFoundError&)
      {
        throw;
      }

    }
开发者ID:trnielsen,项目名称:mantid,代码行数:12,代码来源:ICatUtils.cpp


示例15: loadFileToWs

/**
 * Loads a file into a *hidden* workspace.
 *
 * @param fileName :: file name to load.
 * @param wsName   :: workspace name, which will be prefixed by a "__"
 *
 * @returns a pointer to the loaded workspace
 */
API::Workspace_sptr Load::loadFileToWs(const std::string &fileName,
                                       const std::string &wsName) {
  Mantid::API::IAlgorithm_sptr loadAlg = createChildAlgorithm("Load", 1);

  // Get the list properties for the concrete loader load algorithm
  const std::vector<Kernel::Property *> &props = getProperties();

  // Loop through and set the properties on the Child Algorithm
  for (auto prop : props) {
    const std::string &propName = prop->name();

    if (this->existsProperty(propName)) {
      if (propName == "Filename") {
        loadAlg->setPropertyValue("Filename", fileName);
      } else if (propName == "OutputWorkspace") {
        loadAlg->setPropertyValue("OutputWorkspace", wsName);
      } else {
        loadAlg->setPropertyValue(propName, getPropertyValue(propName));
      }
    }
  }

  loadAlg->executeAsChildAlg();

  Workspace_sptr ws = loadAlg->getProperty("OutputWorkspace");
  // ws->setName(wsName);
  AnalysisDataService::Instance().addOrReplace(wsName, ws);
  return ws;
}
开发者ID:mantidproject,项目名称:mantid,代码行数:37,代码来源:Load.cpp


示例16: runAlgorithm

/**
 * Runs an algorithm async
 *
 * @param algorithm :: The algorithm to be run
 */
void IndirectTab::runAlgorithm(const Mantid::API::IAlgorithm_sptr algorithm) {
  algorithm->setRethrows(true);

  // There should never really be unexecuted algorithms in the queue, but it is
  // worth warning in case of possible weirdness
  size_t batchQueueLength = m_batchAlgoRunner->queueLength();
  if (batchQueueLength > 0)
    g_log.warning() << "Batch queue already contains " << batchQueueLength
                    << " algorithms!\n";

  m_batchAlgoRunner->addAlgorithm(algorithm);
  m_batchAlgoRunner->executeBatchAsync();
}
开发者ID:mducle,项目名称:mantid,代码行数:18,代码来源:IndirectTab.cpp


示例17: login

    bool ICatUtils::login()
    {
      QString algName("CatalogLogin");
      const int version =-1;
      Mantid::API::IAlgorithm_sptr alg;
      try
      {
        alg = Mantid::API::AlgorithmManager::Instance().create(algName.toStdString(),version);
      }
      catch(...)
      {
        throw std::runtime_error("Error when Populating the instrument list box");
      }
      if(!m_applicationWindow)
      {return false;}

      MantidQt::API::InterfaceManager interfaceManager;
      MantidQt::API::AlgorithmDialog *dlg = interfaceManager.createDialog(alg.get(), m_applicationWindow);
      if(!dlg) return false;
      if(dlg->exec()==QDialog::Accepted)
      {
        delete dlg;
        Poco::ActiveResult<bool> result(alg->executeAsync());
        while( !result.available() )
        {
          QCoreApplication::processEvents();
        }

        if(!alg->isExecuted())
        {
          return false;
        }
        return true;
      }
      else
      {
        return false;
      }
    }
开发者ID:trnielsen,项目名称:mantid,代码行数:39,代码来源:ICatUtils.cpp


示例18: sortPeaksWorkspace

/**
 * Sorts the peak workspace by a specified column name in ascending or
 * descending order.
 * @param byColumnName The column by which the workspace is to be sorted.
 * @param ascending If the workspace is to be sorted in a ascending or
 * descending manner.
 */
void ConcretePeaksPresenterVsi::sortPeaksWorkspace(
    const std::string &byColumnName, const bool ascending) {
  Mantid::API::IPeaksWorkspace_sptr peaksWS =
      boost::const_pointer_cast<Mantid::API::IPeaksWorkspace>(
          this->m_peaksWorkspace);

  // Sort the Peaks in-place.
  Mantid::API::IAlgorithm_sptr alg =
      Mantid::API::AlgorithmManager::Instance().create("SortPeaksWorkspace");
  alg->setChild(true);
  alg->setRethrows(true);
  alg->initialize();
  alg->setProperty("InputWorkspace", peaksWS);
  alg->setPropertyValue("OutputWorkspace", "SortedPeaksWorkspace");
  alg->setProperty("OutputWorkspace", peaksWS);
  alg->setProperty("SortAscending", ascending);
  alg->setPropertyValue("ColumnNameToSortBy", byColumnName);
  alg->execute();
}
开发者ID:liyulun,项目名称:mantid,代码行数:26,代码来源:ConcretePeaksPresenterVsi.cpp


示例19: groupWorkspaces

void WorkspacePresenter::groupWorkspaces() {
  auto view = lockView();
  auto selected = view->getSelectedWorkspaceNames();

  std::string groupName("NewGroup");
  // get selected workspaces
  if (selected.size() < 2) {
    view->showCriticalUserMessage("Cannot Group Workspaces",
                                  "Select at least two workspaces to group ");
    return;
  }

  if (m_adapter->doesWorkspaceExist(groupName)) {
    if (!view->askUserYesNo("",
                            "Workspace " + groupName +
                                " already exists. Do you want to replace it?"))
      return;
  }

  try {
    std::string algName("GroupWorkspaces");
    Mantid::API::IAlgorithm_sptr alg =
        Mantid::API::AlgorithmManager::Instance().create(algName, -1);
    alg->initialize();
    alg->setProperty("InputWorkspaces", selected);
    alg->setPropertyValue("OutputWorkspace", groupName);
    // execute the algorithm
    bool bStatus = alg->execute();
    if (!bStatus) {
      view->showCriticalUserMessage("MantidPlot - Algorithm error",
                                    " Error in GroupWorkspaces algorithm");
    }
  } catch (...) {
    view->showCriticalUserMessage("MantidPlot - Algorithm error",
                                  " Error in GroupWorkspaces algorithm");
  }
}
开发者ID:rosswhitfield,项目名称:mantid,代码行数:37,代码来源:WorkspacePresenter.cpp


示例20: getFilesFromAlgorithm

/**
 * Create a list of files from the given algorithm property.
 */
void FindFilesThread::getFilesFromAlgorithm() {
  Mantid::API::IAlgorithm_sptr algorithm =
      Mantid::API::AlgorithmManager::Instance().createUnmanaged(
          m_algorithm.toStdString());

  if (!algorithm)
    throw std::invalid_argument("Cannot create algorithm " +
                                m_algorithm.toStdString() + ".");

  algorithm->initialize();
  const std::string propName = m_property.toStdString();
  algorithm->setProperty(propName, m_text);

  Property *prop = algorithm->getProperty(propName);
  m_valueForProperty = QString::fromStdString(prop->value());

  FileProperty *fileProp = dynamic_cast<FileProperty *>(prop);
  MultipleFileProperty *multiFileProp =
      dynamic_cast<MultipleFileProperty *>(prop);

  if (fileProp) {
    m_filenames.push_back(fileProp->value());
  } else if (multiFileProp) {
    // This flattens any summed files to a set of single files so that you lose
    // the information about
    // what was summed
    std::vector<std::vector<std::string>> filenames =
        algorithm->getProperty(propName);
    std::vector<std::string> flattenedNames =
        VectorHelper::flattenVector(filenames);

    for (auto filename = flattenedNames.begin();
         filename != flattenedNames.end(); ++filename) {
      m_filenames.push_back(*filename);
    }
  }
}
开发者ID:rosswhitfield,项目名称:mantid,代码行数:40,代码来源:MWRunFiles.cpp



注:本文中的mantid::api::IAlgorithm_sptr类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ api::MatrixWorkspace_const_sptr类代码示例发布时间:2022-05-31
下一篇:
C++ mangle::Mangler类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap