当前位置: 首页>>代码示例>>C++>>正文


C++ IAlgorithm_sptr::isExecuted方法代码示例

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


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

示例1: 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

示例2: 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

示例3: addPeakAt

bool ConcretePeaksPresenter::addPeakAt(double plotCoordsPointX,
                                       double plotCoordsPointY) {
  V3D plotCoordsPoint(plotCoordsPointX, plotCoordsPointY,
                      m_slicePoint.slicePoint());
  V3D hkl = m_transform->transformBack(plotCoordsPoint);

  Mantid::API::IPeaksWorkspace_sptr peaksWS =
      boost::const_pointer_cast<Mantid::API::IPeaksWorkspace>(this->m_peaksWS);

  Mantid::API::IAlgorithm_sptr alg =
      AlgorithmManager::Instance().create("AddPeakHKL");
  alg->setChild(true);
  alg->setRethrows(true);
  alg->initialize();
  alg->setProperty("Workspace", peaksWS);
  alg->setProperty("HKL", std::vector<double>(hkl));

  // Execute the algorithm
  try {
    alg->execute();
  } catch (...) {
    g_log.warning("ConcretePeaksPresenter: Could not add the peak. Make sure "
                  "that it is added within a valid workspace region");
  }

  // Reproduce the views. Proxy representations recreated for all peaks.
  this->produceViews();

  // Refind visible peaks and Set the proxy representations to be visible or
  // not.
  doFindPeaksInRegion();

  // Upstream controls need to be regenerated.
  this->informOwnerUpdate();

  return alg->isExecuted();
}
开发者ID:liyulun,项目名称:mantid,代码行数:37,代码来源:ConcretePeaksPresenter.cpp


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