20 #ifndef LIBMESH_STORED_RANGE_H 21 #define LIBMESH_STORED_RANGE_H 24 #include "libmesh/threads.h" 53 template <
typename iterator_type,
typename object_type>
60 typedef typename std::vector<object_type>
vec_type;
62 typedef typename std::unique_ptr<vec_type, std::function<void (vec_type *)>>
ptr_type;
85 const iterator_type & last,
86 const unsigned int new_grainsize = 1000) :
94 this->
reset(first, last);
108 const unsigned int new_grainsize = 1000) :
198 half = first + (last-first)/2u;
216 const iterator_type & last)
223 for (iterator_type it=first; it!=last; ++it)
224 _objs->push_back(*it);
320 #endif // LIBMESH_STORED_RANGE_H StoredRange(const unsigned int new_grainsize=1000)
Constructor.
StoredRange(vec_type *objs, const unsigned int new_grainsize=1000)
Constructor.
std::unique_ptr< vec_type, std::function< void(vec_type *)> > ptr_type
StoredRange(const StoredRange< iterator_type, object_type > &er)
Copy constructor.
~StoredRange()=default
Destructor.
Dummy "splitting object" used to distinguish splitting constructors from copy constructors.
std::size_t first_idx() const
Index in the stored vector of the first object.
The StoredRange class defines a contiguous, divisible set of objects.
The libMesh namespace provides an interface to certain functionality in the library.
StoredRange(StoredRange< iterator_type, object_type > &r, Threads::split)
Splits the range r.
bool is_divisible() const
std::size_t grainsize() const
The grain size for the range.
Real distance(const Point &p)
StoredRange(const StoredRange< iterator_type, object_type > &er, const const_iterator &begin_range, const const_iterator &end_range)
NOTE: When using pthreads this constructor is MANDATORY!!!
StoredRange(const iterator_type &first, const iterator_type &last, const unsigned int new_grainsize=1000)
Constructor.
const_iterator end() const
End of the range.
std::vector< object_type > vec_type
Allows an StoredRange to behave like an STL container.
StoredRange< iterator_type, object_type > & reset(const iterator_type &first, const iterator_type &last)
Resets the StoredRange to contain [first,last).
vec_type::const_iterator const_iterator
const_iterator begin() const
Beginning of the range.
void grainsize(const unsigned int &gs)
Set the grain size.
std::size_t last_idx() const
Index in the stored vector of the last object.
StoredRange< iterator_type, object_type > & reset()
Resets the range to the last specified range.