Class
Splitter
Splits an interval into subintervals.
This class divides an interval into the disjoint union of subintervals and enumerates its boundaries. It can be used to parallelize large for-loops that iterate over a contiguous range of elements. The interval and the number of subintervals can be set in the constructor Splitter. length and resize can be used to retrieve or change the number of subintervals later. In contrast to other containers the Splitter allows to access one more element than its length would imply to allow to retrieve the right boundary of each subinterval (see example code below).
Splitter<TValue, TSpec>
Include Headers
seqan/parallel.h
Parameters
TValue
Type of the interval boundaries.
TSpec
Tag to select the way the values are sampled.
Default: Equidistant Splitter
Specializations
Equidistant SplitterSplits an interval into equal-sized subintervals.
Metafunctions
SizeType of an object that is suitable to hold size information.
ValueType of the items in the container or behind an iterator.
Member Functions
SplitterConstructor
Functions
lengthThe number of items/characters.
resizeResizes a container. If the new length exceeds the old length the new elements are filled with copies of value.
Examples
Simple example for equidistant (default) splitting.
1#include <iostream>
2#include <seqan/parallel.h>
3
4using namespace seqan;
5
6int main ()
7{
8    // instantiate a Splitter to divide the interval [10,20) in 3 subintervals
9    Splitter<unsigned> splitter(10, 20, 3);
10
11    // output all subintervals
12    for (unsigned i = 0; i < length(splitter); ++i)
13        std::cout << '[' << splitter[i] << ',' << splitter[i + 1] << ')' << std::endl;
14
15    return 0;
16}
[10,14)
[14,17)
[17,20)
SeqAn - Sequence Analysis Library - www.seqan.de
 

Page built @2013/07/11 09:12:35