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


C++ typenameMDEventWorkspace::displayNormalization方法代码示例

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


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

示例1: slice


//.........这里部分代码省略.........
  // Sort boxes by file position IF file backed. This reduces seeking time,
  // hopefully.
  bool fileBackedWS = bc->isFileBacked();
  if (fileBackedWS)
    API::IMDNode::sortObjByID(boxes);

  auto prog = new Progress(this, 0.0, 1.0, boxes.size());

  // The root of the output workspace
  MDBoxBase<OMDE, ond> *outRootBox = outWS->getBox();

  // if target workspace has events, we should count them as added
  uint64_t totalAdded = outWS->getNEvents();
  uint64_t numSinceSplit = 0;

  // Go through every box for this chunk.
  // PARALLEL_FOR_IF( !bc->isFileBacked() )
  for (int i = 0; i < int(boxes.size()); i++) {
    MDBox<MDE, nd> *box = dynamic_cast<MDBox<MDE, nd> *>(boxes[i]);
    // Perform the binning in this separate method.
    if (box && !box->getIsMasked()) {
      // An array to hold the rotated/transformed coordinates
      coord_t outCenter[ond];

      const std::vector<MDE> &events = box->getConstEvents();

      for (auto it = events.cbegin(); it != events.cend(); ++it) {
        // Cache the center of the event (again for speed)
        const coord_t *inCenter = it->getCenter();

        if (function->isPointContained(inCenter)) {
          // Now transform to the output dimensions
          m_transformFromOriginal->apply(inCenter, outCenter);

          // Create the event
          OMDE newEvent(it->getSignal(), it->getErrorSquared(), outCenter);
          // Copy extra data, if any
          copyEvent(*it, newEvent);
          // Add it to the workspace
          if (outRootBox->addEvent(newEvent))
            numSinceSplit++;
        }
      }
      box->releaseEvents();

      // Ask BC if one needs to split boxes
      if (obc->shouldSplitBoxes(totalAdded, numSinceSplit, lastNumBoxes))
      // if (numSinceSplit > 20000000 || (i == int(boxes.size()-1)))
      {
        // This splits up all the boxes according to split thresholds and sizes.
        Kernel::ThreadScheduler *ts = new ThreadSchedulerFIFO();
        ThreadPool tp(ts);
        outWS->splitAllIfNeeded(ts);
        tp.joinAll();
        // Accumulate stats
        totalAdded += numSinceSplit;
        numSinceSplit = 0;
        lastNumBoxes = obc->getTotalNumMDBoxes();
        // Progress reporting
        if (!fileBackedWS)
          prog->report(i);
      }
      if (fileBackedWS) {
        if (!(i % 10))
          prog->report(i);
      }
    } // is box

  } // for each box in the vector
  prog->report();

  outWS->splitAllIfNeeded(nullptr);
  // Refresh all cache.
  outWS->refreshCache();

  // Account for events that were added after the last split
  totalAdded += numSinceSplit;
  g_log.notice() << totalAdded << " " << OMDE::getTypeName()
                 << "s added to the output workspace.\n";

  if (outWS->isFileBacked()) {
    // Update the file-back-end
    g_log.notice() << "Running SaveMD\n";
    IAlgorithm_sptr alg = createChildAlgorithm("SaveMD");
    alg->setProperty("UpdateFileBackEnd", true);
    alg->setProperty("InputWorkspace", outWS);
    alg->executeAsChildAlg();
  }

  // Pass on the display normalization from the input event workspace to the
  // output event workspace
  IMDEventWorkspace_sptr outEvent =
      boost::dynamic_pointer_cast<IMDEventWorkspace>(outWS);
  outEvent->setDisplayNormalization(ws->displayNormalization());
  outEvent->setDisplayNormalizationHisto(ws->displayNormalizationHisto());
  // return the size of the input workspace write buffer to its initial value
  // bc->setCacheParameters(sizeof(MDE),writeBufSize);
  this->setProperty("OutputWorkspace", outEvent);
  delete prog;
}
开发者ID:liyulun,项目名称:mantid,代码行数:101,代码来源:SliceMD.cpp


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