本文整理汇总了C++中MantidVecPtr::size方法的典型用法代码示例。如果您正苦于以下问题:C++ MantidVecPtr::size方法的具体用法?C++ MantidVecPtr::size怎么用?C++ MantidVecPtr::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MantidVecPtr
的用法示例。
在下文中一共展示了MantidVecPtr::size方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BinEdgeAxis
/** Creates the output workspace, setting the axes according to the input
* binning parameters
* @param[in] inputWorkspace The input workspace
* @param[in] binParams The bin parameters from the user
* @param[out] newAxis The 'vertical' axis defined by the given
* parameters
* @return A pointer to the newly-created workspace
*/
API::MatrixWorkspace_sptr
SofQW::setUpOutputWorkspace(API::MatrixWorkspace_const_sptr inputWorkspace,
const std::vector<double> &binParams,
std::vector<double> &newAxis) {
// Create vector to hold the new X axis values
MantidVecPtr xAxis;
xAxis.access() = inputWorkspace->readX(0);
const int xLength = static_cast<int>(xAxis->size());
// Create a vector to temporarily hold the vertical ('y') axis and populate
// that
const int yLength = static_cast<int>(
VectorHelper::createAxisFromRebinParams(binParams, newAxis));
// Create the output workspace
MatrixWorkspace_sptr outputWorkspace = WorkspaceFactory::Instance().create(
inputWorkspace, yLength - 1, xLength, xLength - 1);
// Create a numeric axis to replace the default vertical one
Axis *const verticalAxis = new BinEdgeAxis(newAxis);
outputWorkspace->replaceAxis(1, verticalAxis);
// Now set the axis values
for (int i = 0; i < yLength - 1; ++i) {
outputWorkspace->setX(i, xAxis);
}
// Set the axis units
verticalAxis->unit() = UnitFactory::Instance().create("MomentumTransfer");
verticalAxis->title() = "|Q|";
// Set the X axis title (for conversion to MD)
outputWorkspace->getAxis(0)->title() = "Energy transfer";
return outputWorkspace;
}