Skip to content

Commit

Permalink
refs #5021: MinRecursionDepth option for ConvertToDiffractionMD
Browse files Browse the repository at this point in the history
  • Loading branch information
Janik Zikovsky committed Apr 19, 2012
1 parent cefd6c4 commit f0877ae
Showing 1 changed file with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,22 @@ namespace MDEvents
"Correct the weights of events with by multiplying by the Lorentz formula: sin(theta)^2 / lambda^4");

// Box controller properties. These are the defaults
this->initBoxControllerProps("5" /*SplitInto*/, 1500 /*SplitThreshold*/, 20 /*MaxRecursionDepth*/);
this->initBoxControllerProps("2" /*SplitInto*/, 1500 /*SplitThreshold*/, 20 /*MaxRecursionDepth*/);

declareProperty(
new PropertyWithValue<int>("MinRecursionDepth", 0),
"Optional. If specified, then all the boxes will be split to this minimum recursion depth. 1 = one level of splitting, etc.\n"
"Be careful using this since it can quickly create a huge number of boxes = (SplitInto ^ (MinRercursionDepth * NumDimensions)).\n"
"But setting this property equal to MaxRecursionDepth property is necessary if one wants to generate multiple file based workspaces in order to merge them later\n");
setPropertyGroup("MinRecursionDepth", getBoxSettingsGroupName());

std::vector<double> extents(2,0);
extents[0]=-50;extents[1]=+50;
declareProperty(
new ArrayProperty<double>("Extents", extents),
"A comma separated list of min, max for each dimension,\n"
"specifying the extents of each dimension. Optional, default +-50 in each dimension.");

setPropertyGroup("Extents", getBoxSettingsGroupName());
}


Expand Down Expand Up @@ -447,6 +454,12 @@ namespace MDEvents
this->setBoxController(bc);
// We always want the box to be split (it will reject bad ones)
ws->splitBox();

// Perform minimum recursion depth splitting
int minDepth = this->getProperty("MinRecursionDepth");
int maxDepth = this->getProperty("MaxRecursionDepth");
if (minDepth>maxDepth) throw std::invalid_argument("MinRecursionDepth must be <= MaxRecursionDepth ");
ws->setMinRecursionDepth(size_t(minDepth));
}

ws->splitBox();
Expand Down

0 comments on commit f0877ae

Please sign in to comment.