One dimensional array view. More...
Public Member Functions | |
array_view (view_container_type *vcont, domain_type const &dom, map_func_type mfunc=map_function()) | |
Constructor used to pass ownership of the container to the view. More... | |
array_view (view_container_type *vcont, domain_type const &dom, map_func_type mfunc, array_view const &) | |
Constructor used to pass ownership of the container to the view. More... | |
array_view (view_container_type const &vcont, domain_type const &dom, map_func_type mfunc=map_function()) | |
Constructor that does not takes ownership over the passed container. More... | |
array_view (view_container_type const &vcont, domain_type const &dom, map_func_type mfunc, array_view const &) | |
Constructor that does not takes ownership over the passed container. More... | |
array_view (view_container_type *vcont) | |
Constructs a view that can reference all the elements of the passed container. The view takes ownership of the container. More... | |
array_view (view_container_type &vcont) | |
Constructs a view that can reference all the elements of the passed container. More... | |
template<typename ... OtherOptionalParams> | |
array_view (array_view< C, OtherOptionalParams... > const &other) | |
Copy constructor when the passed view is not the most derived view. More... | |
void | resize (size_t size) |
Update the underlying container to hold the specified number of elements. All previous information is lost. | |
template<typename DistSpecView > | |
std::enable_if< is_distribution_view< DistSpecView >::value||detail::has_is_composed_dist_spec< DistSpecView >::value >::type | redistribute (DistSpecView const &dist_view) |
Update the underlying container to have the distribution specified. More... | |
bool | is_valid (void) const |
view_container_type * | get_container (void) const |
view_container_type & | container (void) |
view_container_type & | container (void) const |
domain_type const & | domain (void) const |
domain_type & | domain (void) |
void | set_domain (domain_type const &dom) |
map_func_type const & | mapfunc (void) const |
size_type | size (void) const |
Returns the number of elements referenced for the view. | |
bool | empty (void) const |
Returns true if the view does not reference any element. | |
void | set_elements (SourceView &&source_view) |
View Read Operations | |
value_type | get_element (index_t const &index) const |
Get the element index from the container. More... | |
future< value_type > | get_element_split (index_t const &index) const |
Get the element index from the container. More... | |
template<class Functor > | |
Functor::result_type | apply_get (index_t const &index, Functor f) |
Applies the provided function to the value referenced for the given index and returns the result of the operation. More... | |
template<class Functor > | |
Functor::result_type | apply_get (index_t const &index, Functor f) const |
Applies the provided function to the value referenced for the given index and returns the result of the operation. More... | |
View Write Operations | |
void | set_element (index_t const &index, value_t const &value) |
Set the element index in the container to value value . More... | |
template<class Functor > | |
void | apply_set (index_t const &index, Functor f) |
Applies the provided function to the value referenced for the given index and mutates the element with the resulting value. More... | |
View Subscript Operations | |
reference_t | operator[] (index_t const &index) const |
The bracket operator is the basic access method. | |
reference_t | make_reference (index_t const &index) const |
Sequence Iterator | |
| |
iterator | begin (void) |
const_iterator | begin (void) const |
iterator | end (void) |
const_iterator | end (void) const |
iterator | make_iterator (index_t i) |
index_t | next (index_t const &index) const |
Computes the next index based on the given index . More... | |
index_t | prev (index_t const &index) const |
Computes the previous index based on the given index . More... | |
index_t | advance (index_t const &index, Distance n) const |
Computes the new index after advance n positions from the given index . More... | |
long | distance (index_t const &index1, index_t const &index2) const |
bool | less_than (index_t const &index1, index_t const &index2) const |
Public Types | |
using | iterator = typename sequence_op_type::iterator |
using | const_iterator = typename sequence_op_type::const_iterator |
typedef C | view_container_type |
typedef view_traits< array_view< C, OptionalParams... > >::domain_type | domain_type |
typedef view_traits< array_view< C, OptionalParams... > >::map_function | map_func_type |
typedef mf_type_helper::index_type | index_type |
typedef mf_type_helper::gid_type | gid_type |
typedef std::size_t | size_type |
using | reference_t = typename view_traits< array_view< C, OptionalParams... > >::reference |
typedef detail::make_iterator< view_traits< array_view< C, OptionalParams... > >::derived_type, iterator > | make_iterator_t |
using | set_elements_type = std::true_type |
Public Attributes | |
C * | m_ptr |
sptr_type | m_sptr |
Protected Member Functions | |
C * | container_ptr (void) const |
Returns the container's pointer. | |
One dimensional array view.
Provides the operations that are commonly present in an array (random access, iteration).
C | Container type. |
Dom | Domain type. By default uses the same domain type provided for the container. |
Mapping | function type (default: identity mapping function) |
Derived | Type of the most derived class (default: itself) |
stapl::array_view< C, OptionalParams >::array_view | ( | view_container_type * | vcont, |
domain_type const & | dom, | ||
map_func_type | mfunc = map_function() |
||
) |
Constructor used to pass ownership of the container to the view.
vcont | Pointer to the container used to forward the operations. |
dom | Domain to be used by the view. |
mfunc | Mapping function to transform view indices to container gids. |
stapl::array_view< C, OptionalParams >::array_view | ( | view_container_type * | vcont, |
domain_type const & | dom, | ||
map_func_type | mfunc, | ||
array_view< C, OptionalParams > const & | |||
) |
Constructor used to pass ownership of the container to the view.
vcont | Pointer to the container used to forward the operations. |
dom | Domain to be used by the view. |
mfunc | Mapping function to transform view indices to container gids. |
other | View to copy from. |
stapl::array_view< C, OptionalParams >::array_view | ( | view_container_type const & | vcont, |
domain_type const & | dom, | ||
map_func_type | mfunc = map_function() |
||
) |
Constructor that does not takes ownership over the passed container.
vcont | Reference to the container used to forward the operations. |
dom | Domain to be used by the view. |
mfunc | Mapping function to transform view indices to container gids. |
stapl::array_view< C, OptionalParams >::array_view | ( | view_container_type const & | vcont, |
domain_type const & | dom, | ||
map_func_type | mfunc, | ||
array_view< C, OptionalParams > const & | |||
) |
Constructor that does not takes ownership over the passed container.
vcont | Reference to the container used to forward the operations. |
dom | Domain to be used by the view. |
mfunc | Mapping function to transform view indices to container gids. |
other | View to copy from (ignored for array_view) |
stapl::array_view< C, OptionalParams >::array_view | ( | view_container_type * | vcont | ) |
Constructs a view that can reference all the elements of the passed container. The view takes ownership of the container.
vcont | Pointer to the container used to forward the operations. |
stapl::array_view< C, OptionalParams >::array_view | ( | view_container_type & | vcont | ) |
Constructs a view that can reference all the elements of the passed container.
vcont | Reference to the container used to forward the operations. |
stapl::array_view< C, OptionalParams >::array_view | ( | array_view< C, OtherOptionalParams... > const & | other | ) |
Copy constructor when the passed view is not the most derived view.
std::enable_if< is_distribution_view<DistSpecView>::value || detail::has_is_composed_dist_spec<DistSpecView>::value>::type stapl::array_view< C, OptionalParams >::redistribute | ( | DistSpecView const & | dist_view | ) |
Update the underlying container to have the distribution specified.
This function is primarily called when container instances in composed container instances are redistributed.
dist_view | Specification of the desired container distribution, including the distribution of any nested containers in the case of a composed container instance. |
|
inherited |
|
inherited |
|
inherited |
Get the element index
from the container.
index | of element to get |
|
inherited |
Get the element index
from the container.
index | of element to get |
|
inherited |
Applies the provided function to the value referenced for the given index and returns the result of the operation.
index | of element to apply the function |
f | function to apply |
|
inherited |
|
inherited |
Set the element index
in the container to value value
.
index | Index of element to set. |
value | New value to set. |
|
inherited |
Applies the provided function to the value referenced for the given index and mutates the element with the resulting value.
index | of element to apply the function |
f | function to apply |
|
inherited |
Computes the next index based on the given index
.
Overwriting this method allows produce a different way to traverse the elements referenced by the view.
|
inherited |
Computes the previous index based on the given index
.
Overwriting this method allows produce a different way to traverse the elements referenced by the view.
|
inherited |
Computes the new index after advance n
positions from the given index
.
Overwriting this method allows produce a different way to traverse the elements referenced by the view.