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

Partition a one-dimensional domain into subdomains with a fixed block size. More...

Public Member Functions

 block_partitioner (view_domain_type const &domain, size_t block_size, bool ignore=false)
 Create a partition of a domain with a certain block size. More...
 
 block_partitioner (view_domain_type const &domain, block_partitioner const &other)
 Copy constructor using instead the given domain.
 
 block_partitioner (size_t block_size, bool ignore=false)
 Create a partition without a domain with a certain block size. More...
 
void set_domain (view_domain_type const &domain)
 Set the global domain to partition. 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) const
 Returns the index of the partition that contains the gid g. 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 value_type::index_type gid_type
 Type of the GIDs in the subdomains.
 
typedef domain_type::index_type index_type
 Type used to describe the i'th subdomain.
 

Detailed Description

template<typename Dom>
class stapl::block_partitioner< Dom >

Partition a one-dimensional domain into subdomains with a fixed block size.

If the given domain contains the GIDs [0, 1, ..., n-1] and the block size is b, then the number of subdomains generated is n/b. In the case that the number of elements does not evenly divide the block size, the remaining elements will be placed in the last partition or ignored completely, based on a policy specified at construction.

Template Parameters
DomType of the domain to be partitioned

Constructor & Destructor Documentation

◆ block_partitioner() [1/2]

template<typename Dom >
stapl::block_partitioner< Dom >::block_partitioner ( view_domain_type const &  domain,
size_t  block_size,
bool  ignore = false 
)

Create a partition of a domain with a certain block size.

Parameters
domainThe original domain to partition.
block_sizeThe size of each subdomain (except possibly the last subdomain)
ignoreFlag indicating whether the leftover elements should be included in the partition, or stored in the last subdomain. If ignore is false, all subdomains will have the same size.

◆ block_partitioner() [2/2]

template<typename Dom >
stapl::block_partitioner< Dom >::block_partitioner ( size_t  block_size,
bool  ignore = false 
)

Create a partition without a domain with a certain block size.

The partition created will be unusable until a domain is provided via set_domain.

Parameters
block_sizeThe size of each subdomain (except possibly the last subdomain)
ignoreFlag indicating whether the leftover elements should be included in the partition, or stored in the last subdomain. If ignore is false, all subdomains will have the same size.

Member Function Documentation

◆ set_domain()

template<typename Dom >
void stapl::block_partitioner< Dom >::set_domain ( view_domain_type const &  domain)

Set the global domain to partition.

Parameters
domainThe domain to partition

◆ operator[]()

template<typename Dom >
value_type stapl::block_partitioner< Dom >::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.
Returns
The subdomain at idx

◆ find()

template<typename Dom >
index_type stapl::block_partitioner< Dom >::find ( gid_type const &  g) const

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

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

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