本文整理汇总了C++中mantid::api::IAlgorithm_sptr::setRethrows方法的典型用法代码示例。如果您正苦于以下问题:C++ IAlgorithm_sptr::setRethrows方法的具体用法?C++ IAlgorithm_sptr::setRethrows怎么用?C++ IAlgorithm_sptr::setRethrows使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mantid::api::IAlgorithm_sptr
的用法示例。
在下文中一共展示了IAlgorithm_sptr::setRethrows方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: viewablePeaks
/**
* Get the viewable peaks. Essentially copied from the slice viewer.
* @returns A vector indicating which of the peaks are viewable.
*/
std::vector<bool> ConcretePeaksPresenterVsi::getViewablePeaks() const {
// Need to apply a transform.
// Don't bother to find peaks in the region if there are no peaks to find.
Mantid::API::ITableWorkspace_sptr outTable;
if (this->m_peaksWorkspace->getNumberPeaks() >= 1) {
double effectiveRadius = 1e-2;
std::string viewable = m_viewableRegion->toExtentsAsString();
Mantid::API::IPeaksWorkspace_sptr peaksWS = m_peaksWorkspace;
Mantid::API::IAlgorithm_sptr alg =
Mantid::API::AlgorithmManager::Instance().create("PeaksInRegion");
alg->setChild(true);
alg->setRethrows(true);
alg->initialize();
alg->setProperty("InputWorkspace", peaksWS);
alg->setProperty("OutputWorkspace", peaksWS->name() + "_peaks_in_region");
alg->setProperty("Extents", viewable);
alg->setProperty("CheckPeakExtents", true);
alg->setProperty("PeakRadius", effectiveRadius);
alg->setPropertyValue("CoordinateFrame", m_frame);
alg->execute();
outTable = alg->getProperty("OutputWorkspace");
std::vector<bool> viewablePeaks(outTable->rowCount());
for (size_t i = 0; i < outTable->rowCount(); ++i) {
viewablePeaks[i] = outTable->cell<Mantid::API::Boolean>(i, 1);
}
m_viewablePeaks = viewablePeaks;
} else {
// No peaks will be viewable
m_viewablePeaks = std::vector<bool>();
}
return m_viewablePeaks;
}
示例2: 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();
}
示例3: deletePeaksIn
bool ConcretePeaksPresenter::deletePeaksIn(PeakBoundingBox box) {
Left left(box.left());
Right right(box.right());
Bottom bottom(box.bottom());
Top top(box.top());
SlicePoint slicePoint(box.slicePoint());
if (slicePoint() < 0) { // indicates that it should not be used.
slicePoint = SlicePoint(m_slicePoint.slicePoint());
}
PeakBoundingBox accurateBox(
left, right, top, bottom,
slicePoint /*Use the current slice position, previously unknown.*/);
// Tranform box from plot coordinates into orderd HKL, Qx,Qy,Qz etc, then find
// the visible peaks.
std::vector<size_t> deletionIndexList = findVisiblePeakIndexes(accurateBox);
// If we have things to remove, do that in one-step.
if (!deletionIndexList.empty()) {
Mantid::API::IPeaksWorkspace_sptr peaksWS =
boost::const_pointer_cast<Mantid::API::IPeaksWorkspace>(
this->m_peaksWS);
// Sort the Peaks in-place.
Mantid::API::IAlgorithm_sptr alg =
AlgorithmManager::Instance().create("DeleteTableRows");
alg->setChild(true);
alg->setRethrows(true);
alg->initialize();
alg->setProperty("TableWorkspace", peaksWS);
alg->setProperty("Rows", deletionIndexList);
alg->execute();
// 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 !deletionIndexList.empty();
}
示例4: 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();
}
示例5:
std::vector<size_t>
ConcretePeaksPresenter::findVisiblePeakIndexes(const PeakBoundingBox &box) {
std::vector<size_t> indexes;
// Don't bother to find peaks in the region if there are no peaks to find.
if (this->m_peaksWS->getNumberPeaks() >= 1) {
double radius =
m_viewPeaks
->getRadius(); // Effective radius of each peak representation.
Mantid::API::IPeaksWorkspace_sptr peaksWS =
boost::const_pointer_cast<Mantid::API::IPeaksWorkspace>(
this->m_peaksWS);
PeakBoundingBox transformedViewableRegion = box.makeSliceBox(radius);
transformedViewableRegion.transformBox(m_transform);
Mantid::API::IAlgorithm_sptr alg =
AlgorithmManager::Instance().create("PeaksInRegion");
alg->setChild(true);
alg->setRethrows(true);
alg->initialize();
alg->setProperty("InputWorkspace", peaksWS);
alg->setProperty("OutputWorkspace", peaksWS->name() + "_peaks_in_region");
alg->setProperty("Extents", transformedViewableRegion.toExtents());
alg->setProperty("CheckPeakExtents", false); // consider all peaks as points
alg->setProperty("PeakRadius", radius);
alg->setPropertyValue("CoordinateFrame", m_transform->getFriendlyName());
alg->execute();
ITableWorkspace_sptr outTable = alg->getProperty("OutputWorkspace");
for (size_t i = 0; i < outTable->rowCount(); ++i) {
const bool insideRegion = outTable->cell<Boolean>(i, 1);
if (insideRegion) {
indexes.push_back(i);
}
}
}
return indexes;
}
示例6: 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();
}
示例7: sortPeaksWorkspace
void ConcretePeaksPresenter::sortPeaksWorkspace(const std::string &byColumnName,
const bool ascending) {
Mantid::API::IPeaksWorkspace_sptr peaksWS =
boost::const_pointer_cast<Mantid::API::IPeaksWorkspace>(this->m_peaksWS);
// Sort the Peaks in-place.
Mantid::API::IAlgorithm_sptr alg =
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();
// Reproduce the views.
this->produceViews();
// Give the new views the current slice point.
m_viewPeaks->setSlicePoint(this->m_slicePoint.slicePoint(), m_viewablePeaks);
}