HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GA_PageIterator.h File Reference
#include "GA_API.h"
#include "GA_Iterator.h"
#include "GA_Range.h"
#include "GA_SplittableRange.h"
#include "GA_Types.h"
#include <UT/UT_ThreadedAlgorithm.h>
#include <stddef.h>
+ Include dependency graph for GA_PageIterator.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  GA_PageIterator
 

Macros

#define GA_FOR_INFORANGE(info, full_range, IT_NAME)
 
#define GA_FOR_INFORANGE_BOSS(info, full_range, IT_NAME, boss)
 
#define GA_FOR_INFO_ALLPOINTS(gdp, info, IT_NAME)
 Iterate over all points for the given info. More...
 
#define GA_FOR_INFO_ALLPOINTS_BOSS(gdp, info, IT_NAME, boss)
 Iterate over all points for the given info with a UT_Interrupt. More...
 
#define GA_FOR_INFO_GROUP_POINTS_BOSS(gdp, pointgrp, info, IT_NAME, boss)
 Iterate over all points for the given info with a UT_Interrupt. More...
 

Functions

template<typename Body >
**void GAforEachPageBlock (GA_PageIterator &page_iterator, const Body &body)
 
GAforEachPageBlock (pit, [&](GA_Offset start, GA_Offset end)*{*pagehandle.setPage(start);*for(GA_Offset off=start;off< end;off++)*{}*})
 
template<typename Body >
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)
 

Variables

*UT_IntArray scratchpad
 
*GA_ROPageHandleF pagehandle
 
*** NOTE
 

Macro Definition Documentation

#define GA_FOR_INFO_ALLPOINTS (   gdp,
  info,
  IT_NAME 
)
Value:
GA_SplittableRange lcl_prange(gdp->getPointRange()); \
for (GA_PageIterator pit=lcl_prange.beginPages(info); \
!pit.atEnd(); ++pit) \
for (GA_Iterator IT_NAME = pit.begin(); !IT_NAME.atEnd(); ++IT_NAME)
Iteration over a range of elements.
Definition: GA_Iterator.h:28
bool atEnd() const
Definition: GA_Iterator.h:100
bool atEnd() const
* for(int i=0;i< n_subtasks;++i)*tasks.push(pool-> push(myfunc))
Definition: UT_RTreeImpl.h:685

Iterate over all points for the given info.

Definition at line 229 of file GA_PageIterator.h.

#define GA_FOR_INFO_ALLPOINTS_BOSS (   gdp,
  info,
  IT_NAME,
  boss 
)
Value:
GA_SplittableRange lcl_prange(gdp->getPointRange()); \
for (GA_PageIterator pit=lcl_prange.beginPages(info); \
!pit.atEnd() && !boss->opInterrupt(); ++pit) \
for (GA_Iterator IT_NAME = pit.begin(); !IT_NAME.atEnd(); ++IT_NAME)
Iteration over a range of elements.
Definition: GA_Iterator.h:28
bool atEnd() const
Definition: GA_Iterator.h:100
bool atEnd() const
* for(int i=0;i< n_subtasks;++i)*tasks.push(pool-> push(myfunc))
Definition: UT_RTreeImpl.h:685

Iterate over all points for the given info with a UT_Interrupt.

Definition at line 236 of file GA_PageIterator.h.

#define GA_FOR_INFO_GROUP_POINTS_BOSS (   gdp,
  pointgrp,
  info,
  IT_NAME,
  boss 
)
Value:
GA_SplittableRange lcl_prange(gdp->getPointRange(pointgrp)); \
for (GA_PageIterator pit=lcl_prange.beginPages(info); \
!pit.atEnd() && !boss->opInterrupt(); ++pit) \
for (GA_Iterator IT_NAME = pit.begin(); !IT_NAME.atEnd(); ++IT_NAME)
Iteration over a range of elements.
Definition: GA_Iterator.h:28
bool atEnd() const
Definition: GA_Iterator.h:100
bool atEnd() const
* for(int i=0;i< n_subtasks;++i)*tasks.push(pool-> push(myfunc))
Definition: UT_RTreeImpl.h:685

Iterate over all points for the given info with a UT_Interrupt.

Definition at line 244 of file GA_PageIterator.h.

#define GA_FOR_INFORANGE (   info,
  full_range,
  IT_NAME 
)
Value:
GA_SplittableRange lcl_prange(full_range); \
for (GA_PageIterator pit=lcl_prange.beginPages(info); \
!pit.atEnd(); ++pit) \
for (GA_Iterator IT_NAME = pit.begin(); !IT_NAME.atEnd(); ++IT_NAME)
Iteration over a range of elements.
Definition: GA_Iterator.h:28
bool atEnd() const
Definition: GA_Iterator.h:100
bool atEnd() const
* for(int i=0;i< n_subtasks;++i)*tasks.push(pool-> push(myfunc))
Definition: UT_RTreeImpl.h:685

Define macros roughly equivalent to FOR_INFOTASKS (in UT_ThreadedAlgorithm). This will break up the full range into a load balanced iteration over pages. For example: GA_FOR_INFOTASKS(info, gdp->getPointRange(), it) { doSomething(it.getOrder()); // Use point number doSomething(it.getOffset()); // Use point offset }

Definition at line 214 of file GA_PageIterator.h.

#define GA_FOR_INFORANGE_BOSS (   info,
  full_range,
  IT_NAME,
  boss 
)
Value:
GA_SplittableRange lcl_prange(full_range); \
for (GA_PageIterator pit=lcl_prange.beginPages(info); \
!pit.atEnd() && !boss->opInterrupt(); ++pit) \
for (GA_Iterator IT_NAME = pit.begin(); !IT_NAME.atEnd(); ++IT_NAME)
Iteration over a range of elements.
Definition: GA_Iterator.h:28
bool atEnd() const
Definition: GA_Iterator.h:100
bool atEnd() const
* for(int i=0;i< n_subtasks;++i)*tasks.push(pool-> push(myfunc))
Definition: UT_RTreeImpl.h:685

Like FOR_INFOTASKS_BOSS, iterate with an optional opInterrupt for every block completed.

Definition at line 222 of file GA_PageIterator.h.

Function Documentation

template<typename Body >
* * void GAforEachPageBlock ( GA_PageIterator page_iterator,
const Body &  body 
)

Invokes a body across each block within a page iterator, avoiding the double loop you normally needed. Usage: GA_PageIterator pit(...); GAforEachPageBlock(pit, [&](GA_Offset start, GA_Offset end) { for (GA_Offset off = start; off < end; off++) { /* work with off

Definition at line 124 of file GA_PageIterator.h.

* GAforEachPageBlock ( pit  ,
[&] (GA_Offset start, GA_Offset end)*{*pagehandle.setPage(start);*for(GA_Offset off=start;off< end;off++)*{}*}   
)
template<typename Body >
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 
)
explicit

Definition at line 166 of file GA_PageIterator.h.

Variable Documentation

* * * NOTE

Definition at line 158 of file GA_PageIterator.h.

* GA_ROPageHandleF pagehandle

Definition at line 151 of file GA_PageIterator.h.

* UT_IntArray scratchpad

Invokes the body approximately once per worker thread with a shared atomic int to provide load-balanced iteration over the pages in the range. shouldthread allows you to easily disable threading, for example if you know some cases are not threadsafe or you have a larger grain size. Body Signature: void body(GA_PageIterator page_iterator) Usage: GAparallelForEachPage(range, shouldthread, [&](GA_PageIterator pit) { /* Thread local data structures / scratchpads

Definition at line 150 of file GA_PageIterator.h.