Changeset 26f238 for src/Fragmentation/Summation/SetValues/SamplingGrid.cpp
- Timestamp:
- Jun 9, 2016, 5:55:43 AM (9 years ago)
- Children:
- 52ecd0
- Parents:
- 6c0b3f
- git-author:
- Frederik Heber <heber@…> (05/26/16 15:36:26)
- git-committer:
- Frederik Heber <heber@…> (06/09/16 05:55:43)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Fragmentation/Summation/SetValues/SamplingGrid.cpp
r6c0b3f r26f238 780 780 } 781 781 782 void SamplingGrid::padWithZerosForEvenNumberedSamples() 783 { 784 size_t wbegin_index[NDIM]; 785 size_t wend_index[NDIM]; 786 size_t wlength_index[NDIM]; 787 getDiscreteWindowIndices(wbegin_index, wlength_index, wend_index); 788 789 // calculate new window (always extend it such that both indices are even) 790 bool changed = false; 791 size_t wnewbegin_index[NDIM]; 792 size_t wnewend_index[NDIM]; 793 for(size_t i=0;i<NDIM;++i) { 794 // We require begin and end of window on even indices (and inside grid). 795 wnewbegin_index[i] = wbegin_index[i]; 796 if ((wnewbegin_index[i] % (size_t)2) != 0) { 797 if (wnewbegin_index[i] > 0) 798 --wnewbegin_index[i]; 799 else 800 wnewbegin_index[i] = 0; 801 changed = true; 802 } 803 wnewend_index[i] = wend_index[i]; 804 if ((wnewend_index[i] % (size_t)2) != 0) { 805 if (wnewend_index[i] < getGridPointsPerAxis()) 806 ++wnewend_index[i]; 807 else 808 wnewend_index[i] = getGridPointsPerAxis(); 809 changed = true; 810 } 811 ASSERT( (wbegin_index[i] >= 0) && (wend_index[i] <= getGridPointsPerAxis()), 812 "SamplingGrid::padWithZerosForEvenNumberedSamples() - indices " 813 +toString(wbegin_index[i])+" and "+toString(wend_index[i])+" larger than grid " 814 +toString(getGridPointsPerAxis())+"."); 815 } 816 if (changed) { 817 double begin_newwindow[NDIM]; 818 double end_newwindow[NDIM]; 819 for(size_t i=0;i<NDIM;++i) { 820 const double delta = getDeltaPerAxis(i); 821 begin_newwindow[i] = begin[i]+delta*wnewbegin_index[i]; 822 end_newwindow[i] = begin[i]+delta*wnewend_index[i]; 823 } 824 // extend window 825 extendWindow(begin_newwindow, end_newwindow); 826 } 827 ASSERT( getWindowGridPoints() % (size_t)8 == 0, 828 "SamplingGrid::padWithZerosForEvenNumberedSamples() - new size " 829 +toString(getWindowGridPoints())+" is still not divisible by 8."); 830 } 831 782 832 void SamplingGrid::downsample( 783 833 SamplingGrid& instance,
Note:
See TracChangeset
for help on using the changeset viewer.
