DASH  0.3.0
Multidimensional View Concept
Collaboration diagram for Multidimensional View Concept:

Modules

 Multidimensional View Expressions
 

Classes

struct  dash::view_traits< ViewT >
 View type traits. More...
 

Functions

template<class ViewTypeA , class ViewTypeB >
constexpr auto dash::apply (ViewTypeA &view_a, ViewTypeB &view_b) -> decltype(view_a.apply(view_b))
 Inverse operation to dash::domain. More...
 
template<class ViewType >
constexpr auto dash::apply (const ViewType &view) -> decltype(view.apply())
 
template<class ViewT , typename ViewValueT = typename std::decay<ViewT>::type>
constexpr auto dash::domain (ViewT &&view) -> typename std::enable_if< dash::detail::has_type_domain_type< ViewValueT >::value, decltype(std::forward< ViewT >(view).domain()) >::type
 
template<class ContainerT , typename ContainerValueT = typename std::decay<ContainerT>::type>
constexpr std::enable_if< !dash::detail::has_type_domain_type< ContainerValueT >::value, ContainerT & >::type dash::domain (ContainerT &container)
 
template<class ContainerT , typename ContainerValueT = typename std::decay<ContainerT>::type>
constexpr std::enable_if< !dash::detail::has_type_domain_type< ContainerValueT >::value, const ContainerT & >::type dash::domain (const ContainerT &container)
 
template<class ViewType >
constexpr std::enable_if< dash::view_traits< ViewType >::is_view::value &&dash::view_traits< ViewType >::is_local::value, const typename ViewType::global_type & >::type dash::global (const ViewType &v)
 
template<class ContainerType >
constexpr std::enable_if< !dash::view_traits< ContainerType >::is_view::value||!dash::view_traits< ContainerType >::is_local::value, ContainerType & >::type dash::global (ContainerType &c)
 
template<class ViewType , typename ViewValueT = typename std::decay<ViewType>::type>
constexpr auto dash::local (ViewType &v) -> typename std::enable_if<(std::is_pointer< typename ViewType::iterator >::value||(dash::view_traits< ViewValueT >::is_local::value)), ViewType &>::type
 
template<class ViewType >
constexpr auto dash::local (const ViewType &v) -> typename std::enable_if< dash::view_traits< ViewType >::is_view::value, decltype(v.local()) >::type
 
template<class ViewT >
dash::view_traits< ViewT >::origin_type dash::origin (ViewT &view)
 
template<class ViewType >
constexpr auto dash::remote (dash::team_unit_t unit, const ViewType &v) -> typename std::enable_if< dash::view_traits< ViewType >::is_view::value, decltype(v.local()) >::type
 
template<class ContainerType >
constexpr std::enable_if< !dash::view_traits< ContainerType >::is_view::value, const typename ContainerType::local_type & >::type dash::remote (dash::team_unit_t unit, const ContainerType &c)
 
template<class ViewTypeA , class ViewTypeB >
constexpr auto dash::intersect (const ViewTypeA &va, const ViewTypeB &vb) -> decltype(dash::sub(0, 0, va))
 
template<dim_t SubDim = 0, dim_t NViewDim, class OffsetFirstT , class OffsetFinalT >
constexpr ViewSubMod< ViewOrigin< NViewDim >, SubDim > dash::sub (OffsetFirstT begin, OffsetFinalT end)
 Sub-section, view dimensions maintain domain dimensions. More...
 
template<dim_t SubDim = 0, dim_t NViewDim, class IndexRangeT >
constexpr ViewSubMod< ViewOrigin< NViewDim >, SubDim > dash::sub (const IndexRangeT &range)
 Sub-section, view dimensions maintain domain dimensions. More...
 
template<class Viewable >
constexpr Viewable::domain_type & dash::domain (const Viewable &v)
 Returns a reference to the specified object's domain, or the object itself if it is not a View type. More...
 

Detailed Description

Description

Definitions for multidimensional view expressions. A view expression consumes a view object (its origin) and returns a view object that applies the expression's modification on the consumed origin.

The result of a view expression satisfies the multidimensional Range concept.

See also
Multidimensional Value Concept
Multidimensional Range Concept
Multidimensional Iterator Concept
dash::view_traits
Terminology

A View is a mapping between two index sets, from a Domain space to an Image space in the view's codomain. Views can be chained such that the image obtained from the application of a view expression can again act as the domain of other views. In effect, a view expression can be understood as a composite function on an index set. The Origin of a view is the first domain in the view chain that has not been created by a view expression; simply put, a view origin is usually a container.

Expressions
View Specifier Synopsis
dash::sub Subrange of domain in a specified dimension
dash::intersect View from intersection of two domains
dash::difference View from difference of two domains
dash::combine Composite view of two possibply unconnected domains
dash::local Local subspace of domain
dash::global Maps subspace to elements in global domain
dash::apply Obtain image of domain view (inverse of domain)
dash::domain Obtain domain of view image (inverse of apply)
dash::origin Obtain the view origin (root domain)
dash::blocks Decompose domain into blocks
dash::block Subspace of decomposed domain in a specific block
dash::index Returns a view's index set
Examples
auto matrix_rect = dash::sub<0>(10,20,
dash::sub<1>(30,40,
matrix));
auto matrix_rect_size = dash::size(matrix_rect);
// -> 10x10 = 100
auto matrix_rect_begin_gidx = dash::index(dash::begin(matrix_rect));
auto matrix_rect_end_gidx = dash::index(dash::end(matrix_rect));
for (auto elem : matrix_rect) {
// ...
}

Function Documentation

◆ apply() [1/2]

template<class ViewTypeA , class ViewTypeB >
constexpr auto dash::apply ( ViewTypeA &  view_a,
ViewTypeB &  view_b 
) -> decltype(view_a.apply(view_b))

#include </tmp/tmporruphar/dash/include/dash/view/Apply.h>

Inverse operation to dash::domain.

Implemented concept:
Multidimensional View Concept

Definition at line 18 of file Apply.h.

20  {
21  return view_a.apply(view_b);
22 }

◆ apply() [2/2]

template<class ViewType >
constexpr auto dash::apply ( const ViewType &  view) -> decltype(view.apply())

#include </tmp/tmporruphar/dash/include/dash/view/Apply.h>

Implemented concept:
Multidimensional View Concept

Definition at line 28 of file Apply.h.

29  {
30  return view.apply();
31 }

◆ domain() [1/4]

template<class Viewable >
constexpr Viewable::domain_type& dash::domain ( const Viewable &  v)

#include </tmp/tmporruphar/dash/include/dash/view/ViewTraits.h>

Returns a reference to the specified object's domain, or the object itself if it is not a View type.

Inverse operation to dash::apply.

Implemented concept:
Multidimensional View Concept

◆ domain() [2/4]

template<class ViewT , typename ViewValueT = typename std::decay<ViewT>::type>
constexpr auto dash::domain ( ViewT &&  view) -> typename std::enable_if< dash::detail::has_type_domain_type<ViewValueT>::value, decltype(std::forward<ViewT>(view).domain()) >::type

#include </tmp/tmporruphar/dash/include/dash/view/Domain.h>

Implemented concept:
Multidimensional View Concept

Definition at line 23 of file Domain.h.

Referenced by dash::sub(), and dash::ViewLocalMod< DomainType, NDim >::ViewLocalMod().

28  {
29  return std::forward<ViewT>(view).domain();
30 }
constexpr std::enable_if< !dash::detail::has_type_domain_type< ContainerValueT >::value, const ContainerT & >::type domain(const ContainerT &container)
Definition: Domain.h:76

◆ domain() [3/4]

template<class ContainerT , typename ContainerValueT = typename std::decay<ContainerT>::type>
constexpr std::enable_if< !dash::detail::has_type_domain_type<ContainerValueT>::value, ContainerT &>::type dash::domain ( ContainerT &  container)

#include </tmp/tmporruphar/dash/include/dash/view/Domain.h>

Implemented concept:
Multidimensional View Concept

Definition at line 60 of file Domain.h.

60  {
61  return container;
62 }

◆ domain() [4/4]

template<class ContainerT , typename ContainerValueT = typename std::decay<ContainerT>::type>
constexpr std::enable_if< !dash::detail::has_type_domain_type<ContainerValueT>::value, const ContainerT &>::type dash::domain ( const ContainerT &  container)

#include </tmp/tmporruphar/dash/include/dash/view/Domain.h>

Implemented concept:
Multidimensional View Concept

Definition at line 76 of file Domain.h.

76  {
77  return container;
78 }

◆ global() [1/2]

template<class ViewType >
constexpr std::enable_if< dash::view_traits<ViewType>::is_view::value && dash::view_traits<ViewType>::is_local::value, const typename ViewType::global_type &>::type dash::global ( const ViewType &  v)

◆ global() [2/2]

template<class ContainerType >
constexpr std::enable_if< !dash::view_traits<ContainerType>::is_view::value || !dash::view_traits<ContainerType>::is_local::value, ContainerType &>::type dash::global ( ContainerType &  c)

#include </tmp/tmporruphar/dash/include/dash/view/Global.h>

Implemented concept:
Multidimensional View Concept

Definition at line 33 of file Global.h.

33  {
34  return c;
35 }

◆ intersect()

template<class ViewTypeA , class ViewTypeB >
constexpr auto dash::intersect ( const ViewTypeA &  va,
const ViewTypeB &  vb 
) -> decltype(dash::sub(0, 0, va))

#include </tmp/tmporruphar/dash/include/dash/view/SetIntersect.h>

Implemented concept:
Multidimensional View Concept

Definition at line 19 of file SetIntersect.h.

References dash::begin(), dash::end(), and dash::index().

23 {
24  return dash::sub(
25  dash::index(va).pre()[
26  std::max(
29  )
30  ],
31  dash::index(va).pre()[
32  std::min(
33  *dash::end(dash::index(va)),
35  )
36  ],
37  va
38  );
39 }
constexpr std::enable_if< std::is_integral< IndexType >::value, IndexType >::type index(IndexType idx)
Definition: Iterator.h:60
constexpr auto end(RangeType &&range) -> decltype(std::forward< RangeType >(range).end())
Definition: Range.h:98
constexpr auto begin(RangeType &&range) -> decltype(std::forward< RangeType >(range).begin())
Definition: Range.h:89

◆ local() [1/2]

template<class ViewType , typename ViewValueT = typename std::decay<ViewType>::type>
constexpr auto dash::local ( ViewType &  v) -> typename std::enable_if< ( std::is_pointer< typename ViewType::iterator >::value || ( dash::view_traits<ViewValueT>::is_local::value ) ), ViewType & >::type

◆ local() [2/2]

template<class ViewType >
constexpr auto dash::local ( const ViewType &  v) -> typename std::enable_if< dash::view_traits<ViewType>::is_view::value, decltype(v.local()) >::type

#include </tmp/tmporruphar/dash/include/dash/view/Local.h>

Implemented concept:
Multidimensional View Concept

Definition at line 92 of file Local.h.

References dash::local().

96  {
97  return v.local();
98 }

◆ origin()

template<class ViewT >
dash::view_traits<ViewT>::origin_type dash::origin ( ViewT &  view)

#include </tmp/tmporruphar/dash/include/dash/view/Origin.h>

Implemented concept:
Multidimensional View Concept

Referenced by dash::block().

◆ remote() [1/2]

template<class ViewType >
constexpr auto dash::remote ( dash::team_unit_t  unit,
const ViewType &  v 
) -> typename std::enable_if< dash::view_traits<ViewType>::is_view::value, decltype(v.local()) >::type

#include </tmp/tmporruphar/dash/include/dash/view/Remote.h>

Implemented concept:
Multidimensional View Concept

Definition at line 17 of file Remote.h.

22  {
23  return v.local();
24 }

◆ remote() [2/2]

template<class ContainerType >
constexpr std::enable_if< !dash::view_traits<ContainerType>::is_view::value, const typename ContainerType::local_type &>::type dash::remote ( dash::team_unit_t  unit,
const ContainerType &  c 
)

#include </tmp/tmporruphar/dash/include/dash/view/Remote.h>

Implemented concept:
Multidimensional View Concept

Definition at line 35 of file Remote.h.

35  {
36  return c.local;
37 }

◆ sub() [1/2]

template<dim_t SubDim = 0, dim_t NViewDim, class OffsetFirstT , class OffsetFinalT >
constexpr ViewSubMod<ViewOrigin<NViewDim>, SubDim> dash::sub ( OffsetFirstT  begin,
OffsetFinalT  end 
)

#include </tmp/tmporruphar/dash/include/dash/view/Sub.h>

Sub-section, view dimensions maintain domain dimensions.

Implemented concept:
Multidimensional View Concept

Definition at line 27 of file Sub.h.

References dash::begin(), and dash::end().

Referenced by dash::LocalMatrixRef< ElementT, NumDimensions, NumDimensions, PatternT, LocalMemSpaceT >::LocalMatrixRef().

28  {
29  return ViewSubMod<ViewOrigin<NViewDim>, SubDim>(begin, end);
30 }
constexpr auto end(RangeType &&range) -> decltype(std::forward< RangeType >(range).end())
Definition: Range.h:98
constexpr auto begin(RangeType &&range) -> decltype(std::forward< RangeType >(range).begin())
Definition: Range.h:89

◆ sub() [2/2]

template<dim_t SubDim = 0, dim_t NViewDim, class IndexRangeT >
constexpr ViewSubMod<ViewOrigin<NViewDim>, SubDim> dash::sub ( const IndexRangeT &  range)

#include </tmp/tmporruphar/dash/include/dash/view/Sub.h>

Sub-section, view dimensions maintain domain dimensions.

Implemented concept:
Multidimensional View Concept

Definition at line 42 of file Sub.h.

References dash::begin(), dash::domain(), and dash::end().

42  {
43  return sub<SubDim>(dash::begin(range),
44  dash::end(range));
45 }
constexpr auto end(RangeType &&range) -> decltype(std::forward< RangeType >(range).end())
Definition: Range.h:98
constexpr auto begin(RangeType &&range) -> decltype(std::forward< RangeType >(range).begin())
Definition: Range.h:89