11 #ifndef __GA_PageIterator__
12 #define __GA_PageIterator__
33 , myPageCount(range.getPageCount())
36 myCurr = myJobInfo->nextTask();
39 : myRange(pit.myRange)
40 , myJobInfo(pit.myJobInfo)
42 , myPageCount(pit.myPageCount)
50 myRange = src.myRange;
51 myJobInfo = src.myJobInfo;
53 myPageCount = src.myPageCount;
59 return myRange == src.myRange &&
60 myJobInfo == src.myJobInfo &&
61 myCurr == src.myCurr &&
62 myPageCount == src.myPageCount;
65 {
return !(*
this ==
src); }
71 return myRange.getFirstOffsetInPage(myCurr);
81 bool atEnd()
const {
return myCurr >= myPageCount; }
85 myCurr = myJobInfo->nextTask();
96 myRange.getPageElementRange(myCurr)); }
97 auto end()
const {
return myRange.end(); }
115 template <
typename Body>
122 for ( ; !page_iterator.
atEnd(); ++page_iterator)
157 template <
typename Body>
171 nworkers =
SYSmin(nworkers, npages);
172 if (!shouldthread || nworkers == 1)
190 for (
int jobid : range.
items())
192 UT_JobInfo info(jobid, nworkers,
nullptr, &nextpage);
207 #define GA_FOR_INFORANGE(info, full_range, IT_NAME) \
208 GA_SplittableRange lcl_prange(full_range); \
209 for (GA_PageIterator pit=lcl_prange.beginPages(info); \
210 !pit.atEnd(); ++pit) \
211 for (GA_Iterator IT_NAME = pit.begin(); !IT_NAME.atEnd(); ++IT_NAME)
215 #define GA_FOR_INFORANGE_BOSS(info, full_range, IT_NAME, boss) \
216 GA_SplittableRange lcl_prange(full_range); \
217 for (GA_PageIterator pit=lcl_prange.beginPages(info); \
218 !pit.atEnd() && !boss->opInterrupt(); ++pit) \
219 for (GA_Iterator IT_NAME = pit.begin(); !IT_NAME.atEnd(); ++IT_NAME)
222 #define GA_FOR_INFO_ALLPOINTS(gdp, info, IT_NAME) \
223 GA_SplittableRange lcl_prange(gdp->getPointRange()); \
224 for (GA_PageIterator pit=lcl_prange.beginPages(info); \
225 !pit.atEnd(); ++pit) \
226 for (GA_Iterator IT_NAME = pit.begin(); !IT_NAME.atEnd(); ++IT_NAME)
229 #define GA_FOR_INFO_ALLPOINTS_BOSS(gdp, info, IT_NAME, boss) \
230 GA_SplittableRange lcl_prange(gdp->getPointRange()); \
231 for (GA_PageIterator pit=lcl_prange.beginPages(info); \
232 !pit.atEnd() && !boss->opInterrupt(); ++pit) \
233 for (GA_Iterator IT_NAME = pit.begin(); !IT_NAME.atEnd(); ++IT_NAME)
237 #define GA_FOR_INFO_GROUP_POINTS_BOSS(gdp, pointgrp, info, IT_NAME, boss) \
238 GA_SplittableRange lcl_prange(gdp->getPointRange(pointgrp)); \
239 for (GA_PageIterator pit=lcl_prange.beginPages(info); \
240 !pit.atEnd() && !boss->opInterrupt(); ++pit) \
241 for (GA_Iterator IT_NAME = pit.begin(); !IT_NAME.atEnd(); ++IT_NAME)
void UTparallelFor(const Range &range, const Body &body, const int subscribe_ratio=2, const int min_grain_size=1, const bool force_use_task_scope=true)
**void GAforEachPageBlock(GA_PageIterator &page_iterator, const Body &body)
GA_PageIterator(const GA_PageIterator &pit)
Iteration over a range of elements.
GA_Size getPageCount() const
Return the number of pages.
bool blockAdvance(GA_Offset &start, GA_Offset &end)
GA_PageIterator & operator=(const GA_PageIterator &src)
Assignment operator.
exint GA_Size
Defines the bit width for index and offset types in GA.
A range of elements in an index-map.
GA_Offset getFirstOffsetInPage() const
GA_Offset operator*() const
bool operator!=(const GA_PageIterator &src) const
static int getNumProcessors()
GA_PageIterator(const GA_SplittableRange &range, const UT_JobInfo *jobinfo=NULL)
bool operator==(const GA_PageIterator &src) const
Equality operator.
re build pagehandles inside this loop For non *trivial loops binding may be safer *void GAparallelForEachPage(const GA_Range &range, bool shouldthread, const Body &body)
GA_PageIterator & operator++()