Skip to content

Commit

Permalink
refs #4572 Changed Box-controller validators to accept values from 1
Browse files Browse the repository at this point in the history
apparently this is needed for correct box controller operations.
  • Loading branch information
abuts committed Jan 22, 2012
1 parent 089842d commit d0c178e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
10 changes: 7 additions & 3 deletions Code/Mantid/Framework/MDAlgorithms/src/ConvertToMDEvents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,12 @@ ConvertToMDEvents::init()
// Box controller properties. These are the defaults
this->initBoxControllerProps("5" /*SplitInto*/, 1500 /*SplitThreshold*/, 20 /*MaxRecursionDepth*/);
// additional box controller settings property.
BoundedValidator<int> *mustBeMoreThen1 = new BoundedValidator<int> ();
mustBeMoreThen1->setLower(1);

declareProperty(
new PropertyWithValue<int>("MinRecursionDepth", 0),
"Optional. If specified, then all the boxes will be split to this minimum recursion depth. 0 = no splitting, 1 = one level of splitting, etc.\n"
new PropertyWithValue<int>("MinRecursionDepth", 1,mustBeMoreThen1),
"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());
Expand Down Expand Up @@ -351,7 +354,8 @@ void ConvertToMDEvents::exec()
spws->splitBox();
// Do we split more due to MinRecursionDepth?
int minDepth = this->getProperty("MinRecursionDepth");
if (minDepth<0) throw std::invalid_argument("MinRecursionDepth must be >= 0.");
int maxDepth = this->getProperty("MaxRecursionDepth");
if (minDepth<maxDepth) throw std::invalid_argument("MinRecursionDepth must be >= MaxRecursionDepth and ");
spws->setMinRecursionDepth(size_t(minDepth));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ namespace MDEvents
{
BoundedValidator<int> *mustBePositive = new BoundedValidator<int> ();
mustBePositive->setLower(0.0);
BoundedValidator<int> *mustBeMoreThen1 = new BoundedValidator<int> ();
mustBeMoreThen1->setLower(1);


// Split up comma-separated properties
std::vector<int> value;
Expand All @@ -58,7 +61,7 @@ namespace MDEvents
"How many events in a box before it should be split. Default " + Strings::toString(SplitThreshold) + ".");

declareProperty(
new PropertyWithValue<int>("MaxRecursionDepth", MaxRecursionDepth, mustBePositive),
new PropertyWithValue<int>("MaxRecursionDepth", MaxRecursionDepth, mustBeMoreThen1),
"How many levels of box splitting recursion are allowed. \n"
"The smallest box will have each side length l = (extents) / (SplitInto ^ MaxRecursionDepth). "
"Default " + Strings::toString(MaxRecursionDepth) + ".");
Expand Down

0 comments on commit d0c178e

Please sign in to comment.