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


C++ IMDDimension_const_sptr::getName方法代码示例

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


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

示例1: exec

//----------------------------------------------------------------------------------------------
/// Run the algorithm
void QueryMDWorkspace::exec() {
    // Extract the required normalisation.
    std::string strNormalisation = getPropertyValue("Normalisation");
    MDNormalization requestedNormalisation = whichNormalisation(strNormalisation);

    IMDWorkspace_sptr input = getProperty("InputWorkspace");

    const bool transformCoordsToOriginal = getProperty("TransformCoordsToOriginal");

    // Define a table workspace with a specific column schema.
    ITableWorkspace_sptr output = WorkspaceFactory::Instance().createTable();
    const std::string signalColumnName = "Signal/" + strNormalisation;
    const std::string errorColumnName = "Error/" + strNormalisation;
    output->addColumn("double", signalColumnName);
    output->addColumn("double", errorColumnName);
    output->addColumn("int", "Number of Events");

    const size_t ndims = input->getNumDims();
    for (size_t index = 0; index < ndims; ++index) {
        Mantid::Geometry::IMDDimension_const_sptr dim = input->getDimension(index);
        std::string dimInUnit = dim->getName() + "/" + dim->getUnits().ascii();
        output->addColumn("double", dimInUnit);
        // Magic numbers required to configure the X axis.
        output->getColumn(dimInUnit)->setPlotType(1);
    }

    // Magic numbers required to configure the Y axis.
    output->getColumn(signalColumnName)->setPlotType(2);
    output->getColumn(errorColumnName)->setPlotType(5);

    IMDIterator *it = input->createIterator();
    it->setNormalization(requestedNormalisation);

    bool bLimitRows = getProperty("LimitRows");
    int maxRows = 0;
    if (bLimitRows) {
        maxRows = getProperty("MaximumRows");
    }

    // Use the iterator to loop through each MDBoxBase and create a row for each
    // entry.
    int rowCounter = 0;

    Progress progress(this, 0, 1, int64_t(input->getNPoints()));
    while (true) {
        size_t cellIndex = 0;
        output->appendRow();
        output->cell<double>(rowCounter, cellIndex++) = it->getNormalizedSignal();
        output->cell<double>(rowCounter, cellIndex++) = it->getNormalizedError();
        output->cell<int>(rowCounter, cellIndex++) = int(it->getNumEvents());
        VMD center = it->getCenter();
        const size_t numberOriginal = input->getNumberTransformsToOriginal();
        if (transformCoordsToOriginal && numberOriginal > 0) {
            const size_t index = numberOriginal - 1;
            CoordTransform const *transform = input->getTransformToOriginal(index);
            VMD temp = transform->applyVMD(center);
            center = temp;
        }

        for (size_t index = 0; index < ndims; ++index) {
            output->cell<double>(rowCounter, cellIndex++) = center[index];
        }

        progress.report();
        if (!it->next() || (bLimitRows && ((rowCounter + 1) >= maxRows))) {
            break;
        }
        rowCounter++;
    }
    setProperty("OutputWorkspace", output);
    delete it;

    //
    IMDEventWorkspace_sptr mdew;
    CALL_MDEVENT_FUNCTION(this->getBoxData, input);
}
开发者ID:nimgould,项目名称:mantid,代码行数:78,代码来源:QueryMDWorkspace.cpp

示例2: setYDim

/** Set the labels for the Y dimensions
 * @param dim : IMDDimension */
void XYLimitsDialog::setYDim(Mantid::Geometry::IMDDimension_const_sptr dim)
{
  ui.lblYName->setText( QString::fromStdString(dim->getName()) );
  ui.lblYUnits->setText( QString::fromStdString(dim->getUnits()) );
}
开发者ID:trnielsen,项目名称:mantid,代码行数:7,代码来源:XYLimitsDialog.cpp

示例3: setXDim

/** Set the labels for the X dimensions
 * @param dim : IMDDimension */
void XYLimitsDialog::setXDim(Mantid::Geometry::IMDDimension_const_sptr dim) {
  ui.lblXName->setText(QString::fromStdString(dim->getName()));
  ui.lblXUnits->setText(toQStringInternal(dim->getUnits().utf8()));
}
开发者ID:mantidproject,项目名称:mantid,代码行数:6,代码来源:XYLimitsDialog.cpp


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