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


C++ MatrixWorkspace_const_sptr::blocksize方法代码示例

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


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

示例1: setup

void MantidMatrix::setup(Mantid::API::MatrixWorkspace_const_sptr ws, int start,
                         int end) {
  if (!ws) {
    QMessageBox::critical(0, "WorkspaceMatrixModel error",
                          "2D workspace expected.");
    m_rows = 0;
    m_cols = 0;
    m_startRow = 0;
    m_endRow = 0;
    return;
  }

  m_workspace = ws;
  m_workspaceTotalHist = static_cast<int>(ws->getNumberHistograms());
  m_startRow = (start < 0 || start >= m_workspaceTotalHist) ? 0 : start;
  m_endRow = (end < 0 || end >= m_workspaceTotalHist || end < start)
                 ? m_workspaceTotalHist - 1
                 : end;
  m_rows = m_endRow - m_startRow + 1;
  m_cols = static_cast<int>(ws->blocksize());
  if (ws->isHistogramData())
    m_histogram = true;
  connect(this, SIGNAL(needsUpdating()), this, SLOT(repaintAll()));

  m_bk_color = QColor(128, 255, 255);
  m_matrix_icon = getQPixmap("mantid_matrix_xpm");
  m_column_width = 100;
}
开发者ID:mducle,项目名称:mantid,代码行数:28,代码来源:MantidMatrix.cpp

示例2: plotMiniplot

  /**
   * Creates and returns a "mini plot", from the given QwtPlot and QwtPlotCurve objects, as well as the given workspace
   * and workspace index.
   *
   * @param plot      :: the QwtPlot object
   * @param curve     :: the QwtPlotCurve object
   * @param workspace :: the workspace to use
   * @param wsIndex   :: the workspace index
   *
   * @returns the resulting QwtPlotCurve object
   */
  QwtPlotCurve* IDATab::plotMiniplot(QwtPlot* plot, QwtPlotCurve* curve, const std::string & workspace, size_t wsIndex)
  {
    if ( curve != NULL )
    {
      curve->attach(0);
      delete curve;
      curve = 0;
    }

    Mantid::API::MatrixWorkspace_const_sptr ws = boost::dynamic_pointer_cast<Mantid::API::MatrixWorkspace>(Mantid::API::AnalysisDataService::Instance().retrieve(workspace));

    size_t nhist = ws->getNumberHistograms();
    if ( wsIndex >= nhist )
    {
      showInformationBox("Error: Workspace index out of range.");
      return NULL;
    }

    using Mantid::MantidVec;
    const MantidVec & dataX = ws->readX(wsIndex);
    const MantidVec & dataY = ws->readY(wsIndex);

    curve = new QwtPlotCurve();
    curve->setData(&dataX[0], &dataY[0], static_cast<int>(ws->blocksize()));
    curve->attach(plot);

    plot->replot();

    return curve;
  }
开发者ID:trnielsen,项目名称:mantid,代码行数:41,代码来源:IDATab.cpp

示例3: sumDetectors

/**
 * Sum counts in detectors for purposes of rough plotting against the units on the x-axis.
 * Checks (approximately) if the workspace is ragged or not and uses the appropriate summation
 * method.
 *
 * @param dets :: A list of detector IDs to sum.
 * @param x :: (output) Time of flight values (or whatever values the x axis has) to plot against.
 * @param y :: (output) The sums of the counts for each bin.
 * @param size :: (optional input) Size of the output vectors. If not given it will be determined automatically.
 */
void InstrumentActor::sumDetectors(QList<int> &dets, std::vector<double> &x, std::vector<double> &y, size_t size) const
{
    Mantid::API::MatrixWorkspace_const_sptr ws = getWorkspace();
    if ( size > ws->blocksize() || size == 0 )
    {
        size = ws->blocksize();
    }

    if ( m_ragged )
    {
        // could be slower than uniform
        sumDetectorsRagged( dets, x, y, size );
    }
    else
    {
        // should be faster than ragged
        sumDetectorsUniform( dets, x, y );
    }
}
开发者ID:stothe2,项目名称:mantid,代码行数:29,代码来源:InstrumentActor.cpp


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