libMesh
|
Blocked range which can be subdivided and executed in parallel. More...
#include <threads.h>
Public Types | |
typedef T | const_iterator |
Allows an StoredRange to behave like an STL container. More... | |
Public Member Functions | |
BlockedRange (const unsigned int new_grainsize=1000) | |
Constructor. More... | |
BlockedRange (const const_iterator first, const const_iterator last, const unsigned int new_grainsize=1000) | |
Constructor. More... | |
BlockedRange (const BlockedRange< T > &r) | |
Copy constructor. More... | |
BlockedRange (BlockedRange< T > &r, Threads::split) | |
Splits the range r . More... | |
void | reset (const const_iterator first, const const_iterator last) |
Resets the StoredRange to contain [first,last). More... | |
const_iterator | begin () const |
Beginning of the range. More... | |
const_iterator | end () const |
End of the range. More... | |
unsigned int | grainsize () const |
The grain size for the range. More... | |
void | grainsize (const unsigned int &gs) |
Set the grain size. More... | |
int | size () const |
bool | empty () const |
bool | is_divisible () const |
Private Attributes | |
const_iterator | _end |
const_iterator | _begin |
unsigned int | _grainsize |
Blocked range which can be subdivided and executed in parallel.
typedef T libMesh::Threads::BlockedRange< T >::const_iterator |
Allows an StoredRange
to behave like an STL container.
|
inlineexplicit |
|
inline |
Constructor.
Takes the beginning and end of the range. Optionally takes the grainsize
parameter, which is the smallest chunk the range may be broken into for parallel execution.
Definition at line 166 of file threads.h.
References libMesh::Threads::BlockedRange< T >::reset().
|
inline |
Copy constructor.
The StoredRange
can be copied into subranges for parallel execution. In this way the initial StoredRange
can be thought of as the root of a binary tree. The root element is the only element which interacts with the user. It takes a specified range of objects and packs it into a contiguous vector which can be split efficiently. However, there is no need for the child ranges to contain this vector, so long as the parent outlives the children. So we implement the copy constructor to specifically omit the _objs
vector.
Definition at line 187 of file threads.h.
|
inline |
Splits the range r
.
The first half of the range is left in place, the second half of the range is placed in *this.
Definition at line 198 of file threads.h.
References libMesh::Threads::BlockedRange< T >::_begin, and libMesh::Threads::BlockedRange< T >::_end.
|
inline |
Beginning of the range.
Definition at line 224 of file threads.h.
References libMesh::Threads::BlockedRange< T >::_begin.
|
inline |
true
if the range is empty. Definition at line 254 of file threads.h.
References libMesh::Threads::BlockedRange< T >::_begin, and libMesh::Threads::BlockedRange< T >::_end.
|
inline |
End of the range.
Definition at line 229 of file threads.h.
References libMesh::Threads::BlockedRange< T >::_end.
|
inline |
The grain size for the range.
The range will be subdivided into subranges not to exceed the grain size.
Definition at line 235 of file threads.h.
References libMesh::Threads::BlockedRange< T >::_grainsize.
Referenced by libMesh::Threads::BlockedRange< T >::is_divisible().
|
inline |
Set the grain size.
Definition at line 240 of file threads.h.
References libMesh::Threads::BlockedRange< T >::_grainsize.
|
inline |
true
if the range can be subdivided. Definition at line 259 of file threads.h.
References libMesh::Threads::BlockedRange< T >::_begin, libMesh::Threads::BlockedRange< T >::_end, and libMesh::Threads::BlockedRange< T >::grainsize().
|
inline |
Resets the StoredRange
to contain [first,last).
Definition at line 214 of file threads.h.
References libMesh::Threads::BlockedRange< T >::_begin, and libMesh::Threads::BlockedRange< T >::_end.
Referenced by libMesh::Threads::BlockedRange< T >::BlockedRange().
|
inline |
Definition at line 245 of file threads.h.
References libMesh::Threads::BlockedRange< T >::_begin, and libMesh::Threads::BlockedRange< T >::_end.
|
private |
Definition at line 264 of file threads.h.
Referenced by libMesh::Threads::BlockedRange< T >::begin(), libMesh::Threads::BlockedRange< T >::BlockedRange(), libMesh::Threads::BlockedRange< T >::empty(), libMesh::Threads::BlockedRange< T >::is_divisible(), libMesh::Threads::BlockedRange< T >::reset(), and libMesh::Threads::BlockedRange< T >::size().
|
private |
Definition at line 263 of file threads.h.
Referenced by libMesh::Threads::BlockedRange< T >::BlockedRange(), libMesh::Threads::BlockedRange< T >::empty(), libMesh::Threads::BlockedRange< T >::end(), libMesh::Threads::BlockedRange< T >::is_divisible(), libMesh::Threads::BlockedRange< T >::reset(), and libMesh::Threads::BlockedRange< T >::size().
|
private |
Definition at line 265 of file threads.h.
Referenced by libMesh::Threads::BlockedRange< T >::grainsize().