本文整理汇总了C++中BoxController_sptr::getSplitInto方法的典型用法代码示例。如果您正苦于以下问题:C++ BoxController_sptr::getSplitInto方法的具体用法?C++ BoxController_sptr::getSplitInto怎么用?C++ BoxController_sptr::getSplitInto使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BoxController_sptr
的用法示例。
在下文中一共展示了BoxController_sptr::getSplitInto方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
/**
* Creates an MD workspace
* @param a : pointer to the first dimension of the MDWorkspace
*@param b : pointer to the second dimension of the MDWorkspace
* @param boxController : controls how the MDWorkspace will be split
*/
boost::shared_ptr<MDEventWorkspace2Lean>
ReflectometryTransform::createMDWorkspace(
Mantid::Geometry::IMDDimension_sptr a,
Mantid::Geometry::IMDDimension_sptr b,
BoxController_sptr boxController) const {
auto ws = boost::make_shared<MDEventWorkspace2Lean>();
ws->addDimension(a);
ws->addDimension(b);
BoxController_sptr wsbc = ws->getBoxController(); // Get the box controller
wsbc->setSplitInto(boxController->getSplitInto(0));
wsbc->setMaxDepth(boxController->getMaxDepth());
wsbc->setSplitThreshold(boxController->getSplitThreshold());
// Initialize the workspace.
ws->initialize();
// Start with a MDGridBox.
ws->splitBox();
return ws;
}
示例2: slice
void SliceMD::slice(typename MDEventWorkspace<MDE, nd>::sptr ws) {
// Create the ouput workspace
typename MDEventWorkspace<OMDE, ond>::sptr outWS(
new MDEventWorkspace<OMDE, ond>());
for (auto &binDimension : m_binDimensions) {
outWS->addDimension(binDimension);
}
outWS->setCoordinateSystem(ws->getSpecialCoordinateSystem());
outWS->initialize();
// Copy settings from the original box controller
BoxController_sptr bc = ws->getBoxController();
// store wrute buffer size for the future
// uint64_t writeBufSize =
// bc->getFileIO()getDiskBuffer().getWriteBufferSize();
// and disable write buffer (if any) for input MD Events for this algorithm
// purposes;
// bc->setCacheParameters(1,0);
BoxController_sptr obc = outWS->getBoxController();
// Use the "number of bins" as the "split into" parameter for the top level
for (size_t od = 0; od < m_binDimensions.size(); od++) {
obc->setSplitTopInto(od, m_binDimensions[od]->getNBins());
obc->setSplitInto(od, bc->getSplitInto(od));
}
obc->setSplitThreshold(bc->getSplitThreshold());
bool bTakeDepthFromInputWorkspace =
getProperty("TakeMaxRecursionDepthFromInput");
int tempDepth = getProperty("MaxRecursionDepth");
size_t maxDepth =
bTakeDepthFromInputWorkspace ? bc->getMaxDepth() : size_t(tempDepth);
obc->setMaxDepth(maxDepth);
// size_t outputSize = writeBufSize;
// obc->setCacheParameters(sizeof(OMDE),outputSize);
obc->resetNumBoxes();
// Perform the first box splitting
outWS->splitBox();
size_t lastNumBoxes = obc->getTotalNumMDBoxes();
// --- File back end ? ----------------
std::string filename = getProperty("OutputFilename");
if (!filename.empty()) {
// First save to the NXS file
g_log.notice() << "Running SaveMD to create file back-end\n";
IAlgorithm_sptr alg = createChildAlgorithm("SaveMD");
alg->setPropertyValue("Filename", filename);
alg->setProperty("InputWorkspace", outWS);
alg->setProperty("MakeFileBacked", true);
alg->executeAsChildAlg();
if (!obc->isFileBacked())
throw std::runtime_error("SliceMD with file-backed output: Can not set "
"up file-backed output workspace ");
auto IOptr = obc->getFileIO();
size_t outBufSize = IOptr->getWriteBufferSize();
// the buffer size for resulting workspace; reasonable size is at least 10
// data chunk sizes (nice to verify)
if (outBufSize < 10 * IOptr->getDataChunk()) {
outBufSize = 10 * IOptr->getDataChunk();
IOptr->setWriteBufferSize(outBufSize);
}
}
// Function defining which events (in the input dimensions) to place in the
// output
MDImplicitFunction *function =
this->getImplicitFunctionForChunk(nullptr, nullptr);
std::vector<API::IMDNode *> boxes;
// Leaf-only; no depth limit; with the implicit function passed to it.
ws->getBox()->getBoxes(boxes, 1000, true, function);
// 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];
//.........这里部分代码省略.........