template class rgpot::PairTerms¶
Overview¶
Width doubles for each pair of a first pass, in visit order. More…
#include <PairTerms.hpp>
template <std::size_t Width>
class PairTerms {
public:
// fields
static std::size_t kDefaultLimit =(std::size_t{32}<<20) /(Width* sizeof(double));
// methods
void record(std::size_t expected);
double* push();
void replay();
const double* next();
std::size_t size() const;
std::size_t limit() const;
void setLimit(std::size_t pairs);
void release();
};
Detailed Documentation¶
Width doubles for each pair of a first pass, in visit order.
A pass keeps pairs until the room that record made is full. Past it push and next return null and the second pass computes its terms again. Nothing is allocated during a pass, so a pair loop holds no call; the next record makes room for every pair the last pass saw, up to limit(). The block is kept from one evaluation to the next, so a potential that outlives a call refills the same memory.
Fields¶
static std::size_t kDefaultLimit =(std::size_t{32}<<20) /(Width* sizeof(double))
Pairs kept by default: 32 MiB of terms.
Methods¶
void record(std::size_t expected)
Starts a first pass with room for expected pairs or for every pair the last pass saw, whichever is more, capped at the limit.
double* push()
Room for the terms of the next pair, or null once the pass is out of room. The pointer is good until the next record.
void replay()
Starts the second pass.
const double* next()
The terms of the next pair, or null past the pairs kept.
std::size_t size() const
Pairs the last first pass kept.
void setLimit(std::size_t pairs)
Pairs to keep from the next record on. 0 keeps none.
void release()
Frees the block.