STAPL API Reference          
Overview   Containers   Algorithms   Views   Skeletons   Run-Time System
Modules     Classes    
List of all members | Public Member Functions | Public Types | Public Attributes | Protected Member Functions
stapl::splitter_partition< Dom, SplitterType > Class Template Reference

Partition a one-dimensional domain explicitly into subdomains based on a fixed set of splitter GIDs. More...

Public Member Functions

 splitter_partition (Dom const &original_dom, vec_dom_type const &vdom, bool allow_empties=false)
 Create a partition of a domain based on splitters. More...
 
value_type operator[] (index_type idx) const
 Return the subdomain at a given index. This is the inverse of find. More...
 
size_t size () const
 Return the number of partitions generated.
 
domain_type domain () const
 Get the partition's domain [0, .., p-1].
 
value_type const & global_domain () const
 Return the original domain that was used to create subdomains.
 
index_type find (gid_type const &g)
 Returns the index of the partition that contains the gid g. More...
 
template<typename ODom , typename MFG >
std::vector< std::pair< domain_type, bool > > contained_in (ODom const &dom, MFG x)
 Determine which partition has the elements referenced for the given domain. More...
 

Public Types

typedef Dom view_domain_type
 The original domain to partition.
 
typedef indexed_domain< size_t > domain_type
 The domain of the partitioner itself (i.e., the domain [0, ..., p-1])
 
typedef Dom value_type
 Type of the subdomains produced by the partition.
 
typedef Dom::index_type gid_type
 Type of the GIDs in the subdomains.
 
typedef size_t index_type
 Type used to describe the i'th subdomain.
 

Public Attributes

vec_dom_type m_part
 Container of splitters.
 
view_domain_type m_domain
 Original domain.
 
bool m_allow_empties
 Flag indicating whether or not empty subdomains are allowed.
 

Protected Member Functions

index_type in_domain (gid_type const &g, bool left)
 Returns the index of the partition that contains the gid g. More...
 

Detailed Description

template<typename Dom, typename SplitterType = std::vector<typename Dom::index_type>>
class stapl::splitter_partition< Dom, SplitterType >

Partition a one-dimensional domain explicitly into subdomains based on a fixed set of splitter GIDs.

If the original domain is [0..99] and the set of splitters is {6, 25, 88}, then the resulting subdomains produced will be [0..5], [6..24], [25..87], [88..99].

Template Parameters
DomType of the domain to be partitioned
SplitterTypeContainer that explicitly stores the splitters

Constructor & Destructor Documentation

◆ splitter_partition()

template<typename Dom , typename SplitterType = std::vector<typename Dom::index_type>>
stapl::splitter_partition< Dom, SplitterType >::splitter_partition ( Dom const &  original_dom,
vec_dom_type const &  vdom,
bool  allow_empties = false 
)

Create a partition of a domain based on splitters.

The container of splitters must be nonempty and sorted. In addition, if allow_empties is not set, there must be no duplicate splitters.

Parameters
original_domThe original domain to partition.
vdomA vector of splitters
allow_emptiesFlag indicating whether empty domains is allowed. Effectively, the same splitter may not appear twice if allow_empties is false.

Member Function Documentation

◆ operator[]()

template<typename Dom , typename SplitterType = std::vector<typename Dom::index_type>>
value_type stapl::splitter_partition< Dom, SplitterType >::operator[] ( index_type  idx) const

Return the subdomain at a given index. This is the inverse of find.

Parameters
idxThe index of the subdomain, which should be from 0 to size() - 1.

◆ in_domain()

template<typename Dom , typename SplitterType = std::vector<typename Dom::index_type>>
index_type stapl::splitter_partition< Dom, SplitterType >::in_domain ( gid_type const &  g,
bool  left 
)
protected

Returns the index of the partition that contains the gid g.

Parameters
ggid to find
leftWhether we should search left-to-right or right-to-left in the partition list. If left is true, the index is with respect to the first partition. Otherwise, the index is with respect to the last partition, traversing backward.
Returns
The index of the subdomain that contains g

◆ find()

template<typename Dom , typename SplitterType = std::vector<typename Dom::index_type>>
index_type stapl::splitter_partition< Dom, SplitterType >::find ( gid_type const &  g)

Returns the index of the partition that contains the gid g.

Parameters
ggid to find
Returns
The index of the subdomain that contains g

◆ contained_in()

template<typename Dom , typename SplitterType = std::vector<typename Dom::index_type>>
template<typename ODom , typename MFG >
std::vector<std::pair<domain_type,bool> > stapl::splitter_partition< Dom, SplitterType >::contained_in ( ODom const &  dom,
MFG  x 
)

Determine which partition has the elements referenced for the given domain.

The returned information is a collection (possibly empty) of pairs. Each pair contains information about which partitions are included in the given domain and how they are included (True: if is fully contained, False: if is partially included). The returned collection only has elements if there is at least one partition that contains elements on the given domain.

Example:
Partition: [0..3],[4..6],[7..9],[10..13]
Given domain: [2..9]
Returns: {([0..0],False),([1..2],True)}
Parameters
domDomain to compare
mfgMapping function generator used to get the associated mapping function to each partition. The generated mapping function is used to project generated partitioned domains into the given domain.
Returns
a vector of pairs.

The documentation for this class was generated from the following file: