STAPL API Reference          
Overview   Containers   Algorithms   Views   Skeletons   Run-Time System
Modules     Classes    
List of all members | Public Member Functions | Public Types
stapl::functor_container< Func, n > Struct Template Reference

Generator container whose value for the element at an index is the application of a functor on the index itself. More...

Public Member Functions

 functor_container (size_type size, Func const &func)
 Create the container by initializing the functor and providing a size. More...
 
distribution_typedistribution ()
 
value_type get_element (gid_type const &i) const
 Retrieve the value associated with a particular index. More...
 
template<typename F >
value_type apply_get (gid_type const &idx, F const &f)
 Apply an arbitrary functor to the computed value at a particular index. More...
 
reference operator[] (gid_type const &i) const
 Construct a reference to the value of a particular index. More...
 
reference make_reference (gid_type const &i) const
 Construct a reference to the value of a particular index. More...
 
size_type size (void) const
 Return the size of this container.
 
domain_type domain (void) const
 Create a linear domain of the GIDs in this container.
 
locality_info locality (gid_type const &) const
 

Public Types

typedef Func::index_type gid_type
 
typedef Func::result_type value_type
 
typedef boost::result_of< Func(gid_type)>::type reference
 
typedef reference const_reference
 
typedef functor_container_domain_type< n >::type domain_type
 
typedef std::integral_constant< int, n > dimension_type
 
typedef domain_type::size_type size_type
 
typedef size_t cid_type
 TODO: cid_type should be changed based on the coarsening method.
 
typedef view_impl::functor_container_distribution< domain_type, Func, n > distribution_type
 
typedef metadata::generator_extractor< functor_containerloc_dist_metadata
 

Detailed Description

template<typename Func, int n>
struct stapl::functor_container< Func, n >

Generator container whose value for the element at an index is the application of a functor on the index itself.

If we have a functor_container c, then c[i] == f(i) must be true. Note that the functor must publicly export a nested trait for the index_type (which is the input to the functor) and a nested trait for the result_type (which is the result of applying the functor on the index_type). In addition, the functor's operator must be declared const.

Template Parameters
FuncFunction object

Constructor & Destructor Documentation

◆ functor_container()

template<typename Func, int n>
stapl::functor_container< Func, n >::functor_container ( size_type  size,
Func const &  func 
)

Create the container by initializing the functor and providing a size.

Parameters
sizeSize of this container
funcThe functor to be applied

Member Function Documentation

◆ get_element()

template<typename Func, int n>
value_type stapl::functor_container< Func, n >::get_element ( gid_type const &  i) const

Retrieve the value associated with a particular index.

Parameters
iIndex of the value to compute
Returns
The result of applying the functor on i

◆ apply_get()

template<typename Func, int n>
template<typename F >
value_type stapl::functor_container< Func, n >::apply_get ( gid_type const &  idx,
F const &  f 
)

Apply an arbitrary functor to the computed value at a particular index.

Parameters
idxIndex of the value to compute
fA functor to apply to the value at index idx. Note that f's function operator must be declared const.
Returns
The result of applying the functor to the element at idx

◆ operator[]()

template<typename Func, int n>
reference stapl::functor_container< Func, n >::operator[] ( gid_type const &  i) const

Construct a reference to the value of a particular index.

Parameters
iIndex of the value to retrieve
Returns
Proxy of the index

◆ make_reference()

template<typename Func, int n>
reference stapl::functor_container< Func, n >::make_reference ( gid_type const &  i) const

Construct a reference to the value of a particular index.

Parameters
iIndex of the value to retrieve
Returns
Proxy of the index

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