NEML2 2.0.0
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
SliceGenerator Class Reference

#include <SliceGenerator.h>

Inheritance diagram for SliceGenerator:

Public Member Functions

 SliceGenerator (std::size_t start, std::size_t stop)
 
std::size_t total () const override
 Total (fixed) number of batches that will be generated.
 
- Public Member Functions inherited from FixedSizeWorkGenerator< indexing::Slice >
bool has_more () const override
 Whether the generator has more work to generate.
 
- Public Member Functions inherited from WorkGenerator< indexing::Slice >
 WorkGenerator ()=default
 
 WorkGenerator (WorkGenerator &&) noexcept=default
 
 WorkGenerator (const WorkGenerator &)=default
 
WorkGeneratoroperator= (WorkGenerator &&) noexcept=default
 
WorkGeneratoroperator= (const WorkGenerator &)=default
 
virtual ~WorkGenerator ()=default
 
std::pair< std::size_t, indexing::Slice > next (std::size_t n)
 Generate the next n batches of work.
 
std::size_t offset () const
 Return the current offset, i.e., the number of batches that have been generated.
 

Protected Member Functions

std::pair< std::size_t, indexing::Slice > generate (std::size_t n) override
 Generate the next n batches of work.
 

Constructor & Destructor Documentation

◆ SliceGenerator()

SliceGenerator ( std::size_t start,
std::size_t stop )

Member Function Documentation

◆ generate()

std::pair< std::size_t, indexing::Slice > generate ( std::size_t n)
overrideprotectedvirtual

Generate the next n batches of work.

Note that in the case of insufficient remaining work, it is possible that the number of batches generated is less than n.

Parameters
nNumber of batches to generate
Returns
std::pair<std::size_t, T> Number of batches generated (m) and the next m batches of work

Implements WorkGenerator< indexing::Slice >.

◆ total()

std::size_t total ( ) const
overridevirtual

Total (fixed) number of batches that will be generated.

Implements FixedSizeWorkGenerator< indexing::Slice >.