Skip to content

Commit

Permalink
refs #5849 Better fake regular data
Browse files Browse the repository at this point in the history
  • Loading branch information
abuts committed Jan 21, 2013
1 parent 1511574 commit 5780c74
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Code/Mantid/Framework/MDAlgorithms/src/FakeMDEventData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,11 +358,14 @@ namespace MDAlgorithms
startPoint[d] = min+shift;
if ((startPoint[d] < min)||(startPoint[d] >= max)) throw std::invalid_argument("RegularData: starting point must be within the box for all dimensions.");

delta[d] = step;
if(step<=0)
throw(std::invalid_argument("Step of the regular grid is less or equal to 0"));

indexMax[d] = size_t((max-min)/step)+1;
// deal with round-off errors
while( (startPoint[d]+(indexMax[d]-1)*step) >= max ) step*=(1-FLT_EPSILON);

delta[d] = step;

gridSize*=indexMax[d];

Expand Down

0 comments on commit 5780c74

Please sign in to comment.