Changeset c9b843 for src/Fragmentation/Summation/SetValues/SamplingGrid.cpp
- Timestamp:
- May 18, 2016, 10:03:09 PM (9 years ago)
- Children:
- c805f7
- Parents:
- 706d48
- git-author:
- Frederik Heber <heber@…> (03/10/16 14:52:28)
- git-committer:
- Frederik Heber <heber@…> (05/18/16 22:03:09)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Fragmentation/Summation/SetValues/SamplingGrid.cpp
r706d48 rc9b843 272 272 return 0.; 273 273 } 274 275 double SamplingGrid::getNearestLowerGridPoint(276 const double value, const size_t axis) const277 {278 const double length = getTotalLengthPerAxis(axis);279 if ((fabs(length) < std::numeric_limits<double>::epsilon()) || (getGridPointsPerAxis() == 0))280 return begin[axis];281 if ((value - end[axis]) > -std::numeric_limits<double>::epsilon()*1.e4)282 return end[axis];283 const double offset = value - begin[axis];284 if (offset < std::numeric_limits<double>::epsilon()*1.e4)285 return begin[axis];286 // modify value a little if value actually has been on a grid point but287 // perturbed by numerical rounding: here up, as we always go lower288 const double factor =289 floor((double)getGridPointsPerAxis()*(offset/length)290 +std::numeric_limits<double>::epsilon()*1.e4);291 return begin[axis]+factor*getDeltaPerAxis(axis);292 }293 294 double SamplingGrid::getNearestHigherGridPoint(295 const double value, const size_t axis) const296 {297 const double length = getTotalLengthPerAxis(axis);298 if ((fabs(length) < std::numeric_limits<double>::epsilon()) || (getGridPointsPerAxis() == 0))299 return end[axis];300 if ((value - end[axis]) > -std::numeric_limits<double>::epsilon()*1.e4)301 return end[axis];302 const double offset = value - begin[axis];303 if (offset < std::numeric_limits<double>::epsilon()*1.e4)304 return begin[axis];305 // modify value a little if value actually has been on a grid point but306 // perturbed by numerical rounding: here down, as we always go higher307 const double factor =308 ceil((double)getGridPointsPerAxis()*(offset/length)309 -std::numeric_limits<double>::epsilon()*1.e4);310 return begin[axis]+factor*getDeltaPerAxis(axis);311 }312 313 274 void SamplingGrid::setWindowSize( 314 275 const double _begin_window[3],
Note:
See TracChangeset
for help on using the changeset viewer.
