STAPL API Reference          
Overview   Containers   Algorithms   Views   Skeletons   Run-Time System
Modules     Classes    
List of all members | Public Member Functions | Public Types | Protected Member Functions | Protected Types | Protected Attributes
stapl::view_based_partition< DistributionView, PartitionInfoContainer > Struct Template Reference

Partition which takes the functor mapping pContainer GIDs to partition ids from the distribution_view provided to the pContainer constructor. More...

Public Member Functions

 view_based_partition (value_type const &, unsigned int)
 
 view_based_partition (view_based_partition const &other)
 
 view_based_partition (std::shared_ptr< DistributionView > dist_view, PartitionInfoContainer const *const arb_part_info=nullptr)
 Construct the partitioner instance for an arbitrary distribution specified by a container of instances. More...
 
view_based_partitionoperator= (view_based_partition const &other)
 Assignment operator used during container redistribution to replace the mapping functions of the views implementing the distribution specification. More...
 
std::shared_ptr< DistributionView > const get_dist_view (void) const
 Return the pointer to the underlying distribution specification. More...
 
domain_type domain () const
 Get the partition's domain [0, .., p-1].
 
size_type size () const
 Return the number of partitions generated.
 
value_type const & global_domain () const
 Return the original domain that was used to create subdomains.
 
PartitionInfoContainer const * get_arb_part_info (void) const
 Return the pointer to the container with arbitrary distribution information.
 
std::tuple< index_type, location_type, loc_qualfind (gid_type g) const
 Returns the index of the partition that contains the gid g. More...
 
boost::optional< value_typetry_get_domain (index_type pid) const
 Returns the domain of gids that map to the specified partition if the mapping from GID to partition id is recognized. More...
 
template<typename ODom , typename MFG >
std::vector< std::pair< typename detail::strip_deferred_domain< value_type >::type, bool > > contained_in (ODom const &dom, MFG const &mfg)
 Determine which partition has the elements referenced for the given domain. More...
 
template<typename Info >
void update (Info const &info)
 Update the domain of GIDs and the mapping function from GID to partition id with mapping information on elements to be inserted in the container. More...
 

Public Types

typedef DistributionView::view_container_type::domain_type domain_type
 The domain of the partitioner itself (i.e., the domain [0, ..., p-1])
 
typedef domain_type::index_type index_type
 Type used to describe the i'th subdomain.
 
typedef DistributionView::domain_type 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 size_t size_type
 Type used to report the number of partitions.
 
typedef DistributionView distribution_view_type
 

Protected Member Functions

void populate_directory (const int *)
 
template<typename PartInfoContainer >
void populate_directory (PartInfoContainer *part_cont)
 

Protected Types

typedef DistributionView::map_func_type map_func_type
 

Protected Attributes

std::shared_ptr< DistributionView > m_dist_view
 
PartitionInfoContainer const * m_arb_part_info
 
value_typem_domain
 The domain to partition.
 
std::shared_ptr< map_func_type > m_map_func
 The function used to map a GID to a partition id.
 
std::shared_ptr< directory< gid_type > > m_directory
 

Detailed Description

template<typename DistributionView, typename PartitionInfoContainer = int>
struct stapl::view_based_partition< DistributionView, PartitionInfoContainer >

Partition which takes the functor mapping pContainer GIDs to partition ids from the distribution_view provided to the pContainer constructor.

The functor is user-defined and as such no assumptions other than it implementing a many-to-one mapping can be made.

This struct is used in tandem with view_based_mapper to allow users to describe the data distribution of a pContainer using a pView.

Template Parameters
DistributionViewType of the view describing a distribution.
PartitionInfoContainerType of the container holding arbitrary distribution information

Constructor & Destructor Documentation

◆ view_based_partition()

template<typename DistributionView , typename PartitionInfoContainer = int>
stapl::view_based_partition< DistributionView, PartitionInfoContainer >::view_based_partition ( std::shared_ptr< DistributionView >  dist_view,
PartitionInfoContainer const *const  arb_part_info = nullptr 
)

Construct the partitioner instance for an arbitrary distribution specified by a container of instances.

The pointer to the container holding the arbitrary partition information is ignored as it is not needed. It is passed to the constructor to allow the initialized_deferred call to be invoked with the flag to avoid attempting to initialize the mapping functions in dist_view because they're not deferred_map instances.

Parameters
dist_viewView-based specification of the distribution that will be used to map GIDs to partition ids

Member Function Documentation

◆ operator=()

template<typename DistributionView , typename PartitionInfoContainer = int>
view_based_partition& stapl::view_based_partition< DistributionView, PartitionInfoContainer >::operator= ( view_based_partition< DistributionView, PartitionInfoContainer > const &  other)

Assignment operator used during container redistribution to replace the mapping functions of the views implementing the distribution specification.

Parameters
otherview-based partition representing the partition of the new data distribution.

◆ get_dist_view()

template<typename DistributionView , typename PartitionInfoContainer = int>
std::shared_ptr<DistributionView> const stapl::view_based_partition< DistributionView, PartitionInfoContainer >::get_dist_view ( void  ) const

Return the pointer to the underlying distribution specification.

This function is called from is_arbitrary_view_based::operator() to determine when the data distribution is arbitrary.

◆ find()

template<typename DistributionView , typename PartitionInfoContainer = int>
std::tuple<index_type, location_type, loc_qual> stapl::view_based_partition< DistributionView, PartitionInfoContainer >::find ( gid_type  g) const

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

Parameters
ggid to map to a partition id
Returns
The index of the partition that contains g

◆ try_get_domain()

template<typename DistributionView , typename PartitionInfoContainer = int>
boost::optional<value_type> stapl::view_based_partition< DistributionView, PartitionInfoContainer >::try_get_domain ( index_type  pid) const

Returns the domain of gids that map to the specified partition if the mapping from GID to partition id is recognized.

Parameters
pidid of the partition whose domain is required

◆ contained_in()

template<typename DistributionView , typename PartitionInfoContainer = int>
template<typename ODom , typename MFG >
std::vector< std::pair<typename detail::strip_deferred_domain<value_type>::type, bool> > stapl::view_based_partition< DistributionView, PartitionInfoContainer >::contained_in ( ODom const &  dom,
MFG const &  mfg 
)

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.

◆ update()

template<typename DistributionView , typename PartitionInfoContainer = int>
template<typename Info >
void stapl::view_based_partition< DistributionView, PartitionInfoContainer >::update ( Info const &  info)

Update the domain of GIDs and the mapping function from GID to partition id with mapping information on elements to be inserted in the container.

Parameters
infovector of tuples, each of which specifies a contiguous set of GIDs, the partition id they map to, and the location id to which the partition id maps.

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