Cabana 0.8.0-dev
 
Loading...
Searching...
No Matches
Cabana_Grid_IndexSpace.hpp File Reference

Logical grid indexing. More...

#include <Cabana_Utils.hpp>
#include <Kokkos_Core.hpp>
#include <algorithm>
#include <array>
#include <string>
Include dependency graph for Cabana_Grid_IndexSpace.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Cabana::Grid::IndexSpace< N >
 Structured index space. More...
 

Namespaces

namespace  Cabana
 Core: particle data structures and algorithms.
 

Functions

template<class ExecutionSpace>
Kokkos::RangePolicy< ExecutionSpace > Cabana::Grid::createExecutionPolicy (const IndexSpace< 1 > &index_space, const ExecutionSpace &)
 Create a multi-dimensional execution policy over an index space.
 
template<class ExecutionSpace, class WorkTag>
Kokkos::RangePolicy< ExecutionSpace, WorkTag > Cabana::Grid::createExecutionPolicy (const IndexSpace< 1 > &index_space, const ExecutionSpace &, const WorkTag &)
 Create a multi-dimensional execution policy over an index space.
 
template<class IndexSpace_t, class ExecutionSpace>
Kokkos::MDRangePolicy< ExecutionSpace, Kokkos::Rank< IndexSpace_t::Rank > > Cabana::Grid::createExecutionPolicy (const IndexSpace_t &index_space, const ExecutionSpace &)
 Create a multi-dimensional execution policy over an index space.
 
template<class IndexSpace_t, class ExecutionSpace, class WorkTag>
Kokkos::MDRangePolicy< ExecutionSpace, WorkTag, Kokkos::Rank< IndexSpace_t::Rank > > Cabana::Grid::createExecutionPolicy (const IndexSpace_t &index_space, const ExecutionSpace &, const WorkTag &)
 Create a multi-dimensional execution policy over an index space with a work tag.
 
template<class Scalar, class... Params>
Kokkos::View< Scalar *, Params... > Cabana::Grid::createView (const std::string &label, const IndexSpace< 1 > &index_space)
 Given an index space create a view over the extent of that index space.
 
template<class Scalar, class... Params>
Kokkos::View< Scalar *, Params..., Kokkos::MemoryUnmanaged > Cabana::Grid::createView (const IndexSpace< 1 > &index_space, Scalar *data)
 Given an index space and a data pointer create an unmanaged view over the extent of that index space.
 
template<class Scalar, class... Params>
Kokkos::View< Scalar **, Params... > Cabana::Grid::createView (const std::string &label, const IndexSpace< 2 > &index_space)
 Given an index space create a view over the extent of that index space.
 
template<class Scalar, class... Params>
Kokkos::View< Scalar **, Params..., Kokkos::MemoryUnmanaged > Cabana::Grid::createView (const IndexSpace< 2 > &index_space, Scalar *data)
 Given an index space and a data pointer create an unmanaged view over the extent of that index space.
 
template<class Scalar, class... Params>
Kokkos::View< Scalar ***, Params... > Cabana::Grid::createView (const std::string &label, const IndexSpace< 3 > &index_space)
 Given an index space create a view over the extent of that index space.
 
template<class Scalar, class... Params>
Kokkos::View< Scalar ***, Params..., Kokkos::MemoryUnmanaged > Cabana::Grid::createView (const IndexSpace< 3 > &index_space, Scalar *data)
 Given an index space and a data pointer create an unmanaged view over the extent of that index space.
 
template<class Scalar, class... Params>
Kokkos::View< Scalar ****, Params... > Cabana::Grid::createView (const std::string &label, const IndexSpace< 4 > &index_space)
 Given an index space create a view over the extent of that index space.
 
template<class Scalar, class... Params>
Kokkos::View< Scalar ****, Params..., Kokkos::MemoryUnmanaged > Cabana::Grid::createView (const IndexSpace< 4 > &index_space, Scalar *data)
 Given an index space and a data pointer create an unmanaged view over the extent of that index space.
 
template<class ViewType>
KOKKOS_INLINE_FUNCTION auto Cabana::Grid::createSubview (const ViewType &view, const IndexSpace< 1 > &index_space) -> decltype(Kokkos::subview(view, index_space.range(0)))
 Given a view create a subview over the given index space.
 
template<class ViewType>
KOKKOS_INLINE_FUNCTION auto Cabana::Grid::createSubview (const ViewType &view, const IndexSpace< 2 > &index_space) -> decltype(Kokkos::subview(view, index_space.range(0), index_space.range(1)))
 Given a view create a subview over the given index space.
 
template<class ViewType>
KOKKOS_INLINE_FUNCTION auto Cabana::Grid::createSubview (const ViewType &view, const IndexSpace< 3 > &index_space) -> decltype(Kokkos::subview(view, index_space.range(0), index_space.range(1), index_space.range(2)))
 Given a view create a subview over the given index space.
 
template<class ViewType>
KOKKOS_INLINE_FUNCTION auto Cabana::Grid::createSubview (const ViewType &view, const IndexSpace< 4 > &index_space) -> decltype(Kokkos::subview(view, index_space.range(0), index_space.range(1), index_space.range(2), index_space.range(3)))
 Given a view create a subview over the given index space.
 
template<long N>
IndexSpace< N+1 > Cabana::Grid::appendDimension (const IndexSpace< N > &index_space, const long size)
 Given an N-dimensional index space append an additional dimension with the given size.
 
template<long N>
IndexSpace< N+1 > Cabana::Grid::appendDimension (const IndexSpace< N > &index_space, const long min, const long max)
 Given an N-dimensional index space append an additional dimension with the given range.
 

Detailed Description

Logical grid indexing.

Function Documentation

◆ appendDimension() [1/2]

template<long N>
IndexSpace< N+1 > Cabana::Grid::appendDimension ( const IndexSpace< N > & index_space,
const long min,
const long max )

Given an N-dimensional index space append an additional dimension with the given range.

Returns
IndexSpace with dimension N+1.

◆ appendDimension() [2/2]

template<long N>
IndexSpace< N+1 > Cabana::Grid::appendDimension ( const IndexSpace< N > & index_space,
const long size )

Given an N-dimensional index space append an additional dimension with the given size.

Returns
IndexSpace with dimension N+1.

◆ createExecutionPolicy() [1/4]

template<class ExecutionSpace>
Kokkos::RangePolicy< ExecutionSpace > Cabana::Grid::createExecutionPolicy ( const IndexSpace< 1 > & index_space,
const ExecutionSpace &  )

Create a multi-dimensional execution policy over an index space.

Returns
Kokkos::RangePolicy Rank-1 specialization.

◆ createExecutionPolicy() [2/4]

template<class ExecutionSpace, class WorkTag>
Kokkos::RangePolicy< ExecutionSpace, WorkTag > Cabana::Grid::createExecutionPolicy ( const IndexSpace< 1 > & index_space,
const ExecutionSpace & ,
const WorkTag &  )

Create a multi-dimensional execution policy over an index space.

Returns
Kokkos::RangePolicy

Rank-1 specialization with a work tag.

◆ createExecutionPolicy() [3/4]

template<class IndexSpace_t, class ExecutionSpace>
Kokkos::MDRangePolicy< ExecutionSpace, Kokkos::Rank< IndexSpace_t::Rank > > Cabana::Grid::createExecutionPolicy ( const IndexSpace_t & index_space,
const ExecutionSpace &  )

Create a multi-dimensional execution policy over an index space.

Returns
Kokkos::MDRangePolicy

◆ createExecutionPolicy() [4/4]

template<class IndexSpace_t, class ExecutionSpace, class WorkTag>
Kokkos::MDRangePolicy< ExecutionSpace, WorkTag, Kokkos::Rank< IndexSpace_t::Rank > > Cabana::Grid::createExecutionPolicy ( const IndexSpace_t & index_space,
const ExecutionSpace & ,
const WorkTag &  )

Create a multi-dimensional execution policy over an index space with a work tag.

Returns
Kokkos::MDRangePolicy

◆ createSubview() [1/4]

template<class ViewType>
KOKKOS_INLINE_FUNCTION auto Cabana::Grid::createSubview ( const ViewType & view,
const IndexSpace< 1 > & index_space ) -> decltype( Kokkos::subview( view, index_space.range( 0 ) ) )

Given a view create a subview over the given index space.

Returns
subview of the original Kokkos::View

Rank-1 specialization.

◆ createSubview() [2/4]

template<class ViewType>
KOKKOS_INLINE_FUNCTION auto Cabana::Grid::createSubview ( const ViewType & view,
const IndexSpace< 2 > & index_space ) -> decltype( Kokkos::subview( view, index_space.range( 0 ), index_space.range( 1 ) ) )

Given a view create a subview over the given index space.

Returns
subview of the original Kokkos::View

Rank-2 specialization.

◆ createSubview() [3/4]

template<class ViewType>
KOKKOS_INLINE_FUNCTION auto Cabana::Grid::createSubview ( const ViewType & view,
const IndexSpace< 3 > & index_space ) -> decltype( Kokkos::subview( view, index_space.range( 0 ), index_space.range( 1 ), index_space.range( 2 ) ) )

Given a view create a subview over the given index space.

Returns
subview of the original Kokkos::View

Rank-3 specialization.

◆ createSubview() [4/4]

template<class ViewType>
KOKKOS_INLINE_FUNCTION auto Cabana::Grid::createSubview ( const ViewType & view,
const IndexSpace< 4 > & index_space ) -> decltype( Kokkos::subview( view, index_space.range( 0 ), index_space.range( 1 ), index_space.range( 2 ), index_space.range( 3 ) ) )

Given a view create a subview over the given index space.

Returns
subview of the original Kokkos::View

Rank-4 specialization.

◆ createView() [1/8]

template<class Scalar, class... Params>
Kokkos::View< Scalar *, Params..., Kokkos::MemoryUnmanaged > Cabana::Grid::createView ( const IndexSpace< 1 > & index_space,
Scalar * data )

Given an index space and a data pointer create an unmanaged view over the extent of that index space.

Returns
Unmanaged Kokkos::View

Rank-1 specialization.

◆ createView() [2/8]

template<class Scalar, class... Params>
Kokkos::View< Scalar **, Params..., Kokkos::MemoryUnmanaged > Cabana::Grid::createView ( const IndexSpace< 2 > & index_space,
Scalar * data )

Given an index space and a data pointer create an unmanaged view over the extent of that index space.

Returns
Unmanaged Kokkos::View

Rank-2 specialization.

◆ createView() [3/8]

template<class Scalar, class... Params>
Kokkos::View< Scalar ***, Params..., Kokkos::MemoryUnmanaged > Cabana::Grid::createView ( const IndexSpace< 3 > & index_space,
Scalar * data )

Given an index space and a data pointer create an unmanaged view over the extent of that index space.

Returns
Unmanaged Kokkos::View

Rank-3 specialization.

◆ createView() [4/8]

template<class Scalar, class... Params>
Kokkos::View< Scalar ****, Params..., Kokkos::MemoryUnmanaged > Cabana::Grid::createView ( const IndexSpace< 4 > & index_space,
Scalar * data )

Given an index space and a data pointer create an unmanaged view over the extent of that index space.

Returns
Unmanaged Kokkos::View

Rank-4 specialization.

◆ createView() [5/8]

template<class Scalar, class... Params>
Kokkos::View< Scalar *, Params... > Cabana::Grid::createView ( const std::string & label,
const IndexSpace< 1 > & index_space )

Given an index space create a view over the extent of that index space.

Returns
Uninitialized Kokkos::View

Rank-1 specialization.

◆ createView() [6/8]

template<class Scalar, class... Params>
Kokkos::View< Scalar **, Params... > Cabana::Grid::createView ( const std::string & label,
const IndexSpace< 2 > & index_space )

Given an index space create a view over the extent of that index space.

Returns
Uninitialized Kokkos::View

Rank-2 specialization.

◆ createView() [7/8]

template<class Scalar, class... Params>
Kokkos::View< Scalar ***, Params... > Cabana::Grid::createView ( const std::string & label,
const IndexSpace< 3 > & index_space )

Given an index space create a view over the extent of that index space.

Returns
Uninitialized Kokkos::View

Rank-3 specialization.

◆ createView() [8/8]

template<class Scalar, class... Params>
Kokkos::View< Scalar ****, Params... > Cabana::Grid::createView ( const std::string & label,
const IndexSpace< 4 > & index_space )

Given an index space create a view over the extent of that index space.

Returns
Uninitialized Kokkos::View

Rank-4 specialization.