本文整理汇总了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;
}
示例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;
}
}
示例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();
}