Gyselalib++
VectorFieldMem< ElementType, IdxRangeType, NDTag, MemSpace > Class Template Reference

Pre-declaration of VectorFieldMem. More...

Inheritance diagram for VectorFieldMem< ElementType, IdxRangeType, NDTag, MemSpace >:
VectorFieldCommon< FieldMem< ElementType, IdxRangeType, MemSpace >, NDTag >

Public Types

using chunk_type = FieldMem< ElementType, IdxRangeType, MemSpace >
 Type describing the object which can be extracted from this VectorFieldMem using the get<> function. More...
 
using Allocator = ddc::KokkosAllocator< ElementType, MemSpace >
 The type of allocator that will be used to allocate the data.
 
using span_type = VectorField< ElementType, IdxRangeType, NDTag, MemSpace, std::experimental::layout_right >
 A type which can hold a reference to this VectorFieldMem. More...
 
using view_type = VectorField< const ElementType, IdxRangeType, NDTag, MemSpace, std::experimental::layout_right >
 A type which can hold a constant reference to this VectorFieldMem. More...
 
using discrete_domain_type = typename base_type::discrete_domain_type
 The type of the index range on which the field is defined. More...
 
using index_range_type = discrete_domain_type
 The IdxRange on which the fields in this object are defined.
 
using memory_space = typename chunk_type::memory_space
 The type of the memory space where the field is saved (CPU vs GPU).
 

Public Member Functions

 VectorFieldMem ()=default
 Empty VectorFieldMem.
 
 VectorFieldMem (index_range_type const &idx_range, Allocator allocator=Allocator())
 Construct a VectorFieldMem on an index range with uninitialized values. More...
 
 VectorFieldMem (VectorFieldMem const &other)=delete
 Deleted: use deepcopy instead.
 
 VectorFieldMem (VectorFieldMem &&other)=default
 Constructs a new VectorFieldMem by move. More...
 
VectorFieldMemoperator= (VectorFieldMem const &other)=delete
 Deleted: use deepcopy instead.
 
VectorFieldMemoperator= (VectorFieldMem &&other)=default
 Move-assigns a new value to this VectorField. More...
 
view_type span_cview () const
 Get a constant reference to this vector field. More...
 
view_type span_view () const
 Get a constant reference to this vector field. More...
 
span_type span_view ()
 Get a modifiable reference to this vector field. More...
 
template<class... ODDims>
element_type operator() (Idx< ODDims > const &... delems) const noexcept
 Element access using a list of Idxs. More...
 
template<class... ODDims, class = std::enable_if_t<sizeof...(ODDims) != 1>>
element_type operator() (Idx< ODDims... > const &delems) const noexcept
 Element access using a multi-dimensional Idx. More...
 
template<class... QueryDDims>
auto operator[] (Idx< QueryDDims... > const &slice_spec) const
 Slice out some dimensions. More...
 
template<class... QueryDDims>
auto operator[] (Idx< QueryDDims... > const &slice_spec)
 Slice out some dimensions. More...
 
template<class... QueryDDims>
auto operator[] (IdxRange< QueryDDims... > const &oidx_range) const
 Slice out some dimensions. More...
 
template<class... QueryDDims>
auto operator[] (IdxRange< QueryDDims... > const &oidx_range)
 Slice out some dimensions. More...
 
template<class QueryTag >
constexpr chunk_span_type get () noexcept
 Get the Field describing the component in the QueryTag direction. More...
 
template<class QueryTag >
constexpr chunk_view_type get () const noexcept
 Get the Field describing the component in the QueryTag direction. More...
 

Detailed Description

template<class ElementType, class IdxRangeType, class NDTag, class MemSpace>
class VectorFieldMem< ElementType, IdxRangeType, NDTag, MemSpace >

Pre-declaration of VectorFieldMem.

A class which describes the storage for a vector field.

A class which describes the storage for a vector field. In other words a class which maps a position on an index range to a vector (x,y,z,...). This is done by storing the values at the positions in individual FieldMems.

Template Parameters
ElementTypeThe data type of a scalar element of the vector field.
IdxRangeType
NDTagA NDTag describing the dimensions described by the scalar elements of a vector field element.
MemSpaceThe type describing where the memory is allocated. See DDC.

Member Typedef Documentation

◆ chunk_type

template<class ElementType , class IdxRangeType , class NDTag , class MemSpace >
using VectorFieldMem< ElementType, IdxRangeType, NDTag, MemSpace >::chunk_type = FieldMem<ElementType, IdxRangeType, MemSpace>

Type describing the object which can be extracted from this VectorFieldMem using the get<> function.

This is a DDC keyword used to make this class interchangeable with Field. In DDC FieldMem types are referred to as Chunk types and Field types are referred to as ChunkSpan/ChunkView.

◆ span_type

template<class ElementType , class IdxRangeType , class NDTag , class MemSpace >
using VectorFieldMem< ElementType, IdxRangeType, NDTag, MemSpace >::span_type = VectorField< ElementType, IdxRangeType, NDTag, MemSpace, std::experimental::layout_right>

A type which can hold a reference to this VectorFieldMem.

This is a DDC keyword used to make this class interchangeable with Field.

◆ view_type

template<class ElementType , class IdxRangeType , class NDTag , class MemSpace >
using VectorFieldMem< ElementType, IdxRangeType, NDTag, MemSpace >::view_type = VectorField< const ElementType, IdxRangeType, NDTag, MemSpace, std::experimental::layout_right>

A type which can hold a constant reference to this VectorFieldMem.

This is a DDC keyword used to make this class interchangeable with Field.

◆ discrete_domain_type

template<class ElementType , class IdxRangeType , class NDTag , class MemSpace >
using VectorFieldMem< ElementType, IdxRangeType, NDTag, MemSpace >::discrete_domain_type = typename base_type::discrete_domain_type

The type of the index range on which the field is defined.

This is a DDC keyword used to make this class interchangeable with Field. In DDC IdxRange types are referred to as DiscreteDomain types.

Constructor & Destructor Documentation

◆ VectorFieldMem() [1/2]

template<class ElementType , class IdxRangeType , class NDTag , class MemSpace >
VectorFieldMem< ElementType, IdxRangeType, NDTag, MemSpace >::VectorFieldMem ( index_range_type const &  idx_range,
Allocator  allocator = Allocator() 
)
inlineexplicit

Construct a VectorFieldMem on an index range with uninitialized values.

Parameters
[in]idx_rangeThe index range on which the chunk will be defined.
[in]allocatorAn optional allocator used to create the chunks.

◆ VectorFieldMem() [2/2]

template<class ElementType , class IdxRangeType , class NDTag , class MemSpace >
VectorFieldMem< ElementType, IdxRangeType, NDTag, MemSpace >::VectorFieldMem ( VectorFieldMem< ElementType, IdxRangeType, NDTag, MemSpace > &&  other)
default

Constructs a new VectorFieldMem by move.

Parameters
otherthe VectorFieldMem to move

Member Function Documentation

◆ operator=()

template<class ElementType , class IdxRangeType , class NDTag , class MemSpace >
VectorFieldMem& VectorFieldMem< ElementType, IdxRangeType, NDTag, MemSpace >::operator= ( VectorFieldMem< ElementType, IdxRangeType, NDTag, MemSpace > &&  other)
default

Move-assigns a new value to this VectorField.

Parameters
otherthe VectorField to move
Returns
*this

◆ span_cview()

template<class ElementType , class IdxRangeType , class NDTag , class MemSpace >
view_type VectorFieldMem< ElementType, IdxRangeType, NDTag, MemSpace >::span_cview ( ) const
inline

Get a constant reference to this vector field.

This function is designed to match the equivalent function in DDC. In Gysela it should not be called directly. Instead the global function get_const_field should be used.

Returns
A constant reference to this vector field.

◆ span_view() [1/2]

template<class ElementType , class IdxRangeType , class NDTag , class MemSpace >
view_type VectorFieldMem< ElementType, IdxRangeType, NDTag, MemSpace >::span_view ( ) const
inline

Get a constant reference to this vector field.

This function is designed to match the equivalent function in DDC. In Gysela it should not be called directly. Instead the global function get_field should be used.

Returns
A constant reference to this vector field.

◆ span_view() [2/2]

template<class ElementType , class IdxRangeType , class NDTag , class MemSpace >
span_type VectorFieldMem< ElementType, IdxRangeType, NDTag, MemSpace >::span_view ( )
inline

Get a modifiable reference to this vector field.

This function is designed to match the equivalent function in DDC. In Gysela it should not be called directly. Instead the global function get_field should be used.

Returns
A modifiable reference to this vector field.

◆ operator()() [1/2]

template<class ElementType , class IdxRangeType , class NDTag , class MemSpace >
template<class... ODDims>
element_type VectorFieldMem< ElementType, IdxRangeType, NDTag, MemSpace >::operator() ( Idx< ODDims > const &...  delems) const
inlinenoexcept

Element access using a list of Idxs.

Parameters
delems1D discrete coordinates
Returns
copy of this element

◆ operator()() [2/2]

template<class ElementType , class IdxRangeType , class NDTag , class MemSpace >
template<class... ODDims, class = std::enable_if_t<sizeof...(ODDims) != 1>>
element_type VectorFieldMem< ElementType, IdxRangeType, NDTag, MemSpace >::operator() ( Idx< ODDims... > const &  delems) const
inlinenoexcept

Element access using a multi-dimensional Idx.

Parameters
delemsdiscrete coordinates
Returns
copy of this element

◆ operator[]() [1/4]

template<class ElementType , class IdxRangeType , class NDTag , class MemSpace >
template<class... QueryDDims>
auto VectorFieldMem< ElementType, IdxRangeType, NDTag, MemSpace >::operator[] ( Idx< QueryDDims... > const &  slice_spec) const
inline

Slice out some dimensions.

Get the VectorFieldMem on the reduced index range which is obtained by indexing the dimensions QueryDDims at the position slice_spec.

Parameters
[in]slice_specThe slice describing the index range of interest.
Returns
A constant reference to the vector field on the sliced index range.

◆ operator[]() [2/4]

template<class ElementType , class IdxRangeType , class NDTag , class MemSpace >
template<class... QueryDDims>
auto VectorFieldMem< ElementType, IdxRangeType, NDTag, MemSpace >::operator[] ( Idx< QueryDDims... > const &  slice_spec)
inline

Slice out some dimensions.

Get the VectorFieldMem on the reduced index range which is obtained by indexing the dimensions QueryDDims at the position slice_spec.

Parameters
[in]slice_specThe slice describing the index range of interest.
Returns
A modifiable reference to the vector field on the sliced index range.

◆ operator[]() [3/4]

template<class ElementType , class IdxRangeType , class NDTag , class MemSpace >
template<class... QueryDDims>
auto VectorFieldMem< ElementType, IdxRangeType, NDTag, MemSpace >::operator[] ( IdxRange< QueryDDims... > const &  oidx_range) const
inline

Slice out some dimensions.

Get the VectorFieldMem on the reduced index range passed as an argument.

Parameters
[in]oidx_rangeThe index range of interest.
Returns
A modifiable reference to the vector field on the sliced index range.

◆ operator[]() [4/4]

template<class ElementType , class IdxRangeType , class NDTag , class MemSpace >
template<class... QueryDDims>
auto VectorFieldMem< ElementType, IdxRangeType, NDTag, MemSpace >::operator[] ( IdxRange< QueryDDims... > const &  oidx_range)
inline

Slice out some dimensions.

Get the VectorFieldMem on the reduced index range passed as an argument.

Parameters
[in]oidx_rangeThe index range of interest.
Returns
A modifiable reference to the vector field on the sliced index range.

◆ get() [1/2]

template<class ElementType , class IdxRangeType , class NDTag , class MemSpace >
template<class QueryTag >
constexpr chunk_span_type VectorFieldMem< ElementType, IdxRangeType, NDTag, MemSpace >::get ( )
inlineconstexprnoexcept

Get the Field describing the component in the QueryTag direction.

Returns
The field in the specified direction.

◆ get() [2/2]

template<class ElementType , class IdxRangeType , class NDTag , class MemSpace >
template<class QueryTag >
constexpr chunk_view_type VectorFieldMem< ElementType, IdxRangeType, NDTag, MemSpace >::get ( ) const
inlineconstexprnoexcept

Get the Field describing the component in the QueryTag direction.

Returns
The constant field in the specified direction.

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