本文整理汇总了C++中api::MatrixWorkspace_const_sptr::isHistogramData方法的典型用法代码示例。如果您正苦于以下问题:C++ MatrixWorkspace_const_sptr::isHistogramData方法的具体用法?C++ MatrixWorkspace_const_sptr::isHistogramData怎么用?C++ MatrixWorkspace_const_sptr::isHistogramData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类api::MatrixWorkspace_const_sptr
的用法示例。
在下文中一共展示了MatrixWorkspace_const_sptr::isHistogramData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createOutputWorkspace
/**
* Creates the output workspace for this algorithm
* @param inputWorkspace A parent workspace to initialize from.
* @return A pointer to the output workspace.
*/
API::MatrixWorkspace_sptr Transpose::createOutputWorkspace(
API::MatrixWorkspace_const_sptr inputWorkspace) {
Mantid::API::Axis *yAxis = getVerticalAxis(inputWorkspace);
const size_t oldNhist = inputWorkspace->getNumberHistograms();
const MantidVec &inX = inputWorkspace->readX(0);
const size_t oldYlength = inputWorkspace->blocksize();
const size_t oldVerticalAxislength = yAxis->length();
// The input Y axis may be binned so the new X data should be too
size_t newNhist(oldYlength), newXsize(oldVerticalAxislength),
newYsize(oldNhist);
MatrixWorkspace_sptr outputWorkspace = WorkspaceFactory::Instance().create(
inputWorkspace, newNhist, newXsize, newYsize);
// Create a new numeric axis for Y the same length as the old X array
// Values come from input X
API::NumericAxis *newYAxis(nullptr);
if (inputWorkspace->isHistogramData()) {
newYAxis = new API::BinEdgeAxis(inX);
} else {
newYAxis = new API::NumericAxis(inX);
}
newYAxis->unit() = inputWorkspace->getAxis(0)->unit();
outputWorkspace->getAxis(0)->unit() = inputWorkspace->getAxis(1)->unit();
outputWorkspace->replaceAxis(1, newYAxis);
setProperty("OutputWorkspace", outputWorkspace);
return outputWorkspace;
}
示例2: createOutputWorkspace
/**
* Creates the output workspace for this algorithm
* @param inputWorkspace A parent workspace to initialize from.
* @return A pointer to the output workspace.
*/
API::MatrixWorkspace_sptr Transpose::createOutputWorkspace(
API::MatrixWorkspace_const_sptr inputWorkspace) {
Mantid::API::Axis *yAxis = getVerticalAxis(inputWorkspace);
const size_t oldNhist = inputWorkspace->getNumberHistograms();
const auto &inX = inputWorkspace->x(0);
const size_t oldYlength = inputWorkspace->blocksize();
const size_t oldVerticalAxislength = yAxis->length();
// The input Y axis may be binned so the new X data should be too
size_t newNhist(oldYlength), newXsize(oldVerticalAxislength),
newYsize(oldNhist);
MatrixWorkspace_sptr outputWorkspace = inputWorkspace->cloneEmpty();
outputWorkspace->initialize(newNhist, newXsize, newYsize);
outputWorkspace->setTitle(inputWorkspace->getTitle());
outputWorkspace->setComment(inputWorkspace->getComment());
outputWorkspace->copyExperimentInfoFrom(inputWorkspace.get());
outputWorkspace->setYUnit(inputWorkspace->YUnit());
outputWorkspace->setYUnitLabel(inputWorkspace->YUnitLabel());
outputWorkspace->setDistribution(inputWorkspace->isDistribution());
// Create a new numeric axis for Y the same length as the old X array
// Values come from input X
API::NumericAxis *newYAxis(nullptr);
if (inputWorkspace->isHistogramData()) {
newYAxis = new API::BinEdgeAxis(inX.rawData());
} else {
newYAxis = new API::NumericAxis(inX.rawData());
}
newYAxis->unit() = inputWorkspace->getAxis(0)->unit();
outputWorkspace->getAxis(0)->unit() = inputWorkspace->getAxis(1)->unit();
outputWorkspace->replaceAxis(1, newYAxis);
setProperty("OutputWorkspace", outputWorkspace);
return outputWorkspace;
}