ThunderEgg  1.0.0
ThunderEgg::ComponentView< T, D > Class Template Reference

Array for acessing data of a patch. It supports variable striding. More...

#include <ComponentView.h>

Inheritance diagram for ThunderEgg::ComponentView< T, D >:
Collaboration diagram for ThunderEgg::ComponentView< T, D >:

Public Types

using T_ptr = typename View< T, D >::T_ptr
 
- Public Types inherited from ThunderEgg::View< T, D >
using T_ptr = typename std::add_pointer< T >::type
 

Public Member Functions

 ComponentView ()
 Construct a new ComponentView with size 0.
 
 ComponentView (T_ptr data, const std::array< int, D > &strides, const std::array< int, D > &ghost_start, const std::array< int, D > &start, const std::array< int, D > &end, const std::array< int, D > &ghost_end)
 Construct a new View object. More...
 
 ComponentView (T_ptr data, const std::array< int, D > &strides, const std::array< int, D > &lengths, int num_ghost_cells)
 Construct a new View object. More...
 
template<int M>
View< T, M > getSliceOn (Face< D, M > f, const std::array< int, D - M > &offset) const
 Get the slice on a given face. More...
 
template<int M>
View< typename std::remove_const< T >::type, M > getGhostSliceOn (Face< D, M > f, const std::array< size_t, D - M > &offset) const
 Get the gosts slice on a given face. More...
 
 operator ComponentView< std::add_const_t< T >, D > () const
 
- Public Member Functions inherited from ThunderEgg::View< T, D >
 View ()
 Constructs a view of size 0.
 
 View (T_ptr data, const std::array< int, D > &strides, const std::array< int, D > &ghost_start, const std::array< int, D > &start, const std::array< int, D > &end, const std::array< int, D > &ghost_end)
 Construct a new View object. More...
 
T & operator[] (const std::array< int, D > &coord) const
 Get a reference to the element at the specified coordinate. More...
 
template<class... Types>
T & operator() (Types... args) const
 Get a reference to the element at the specified coordinate. More...
 
void set (const std::array< int, D > &coord, T value) const
 Set the value at a coordinate to the specified value. More...
 
const std::array< int, D > & getStrides () const
 Get the strides of the patch in each direction.
 
const std::array< int, D > & getStart () const
 Get the coordinate of the first element.
 
const std::array< int, D > & getEnd () const
 Get the coordinate of the last element.
 
const std::array< int, D > & getGhostStart () const
 Get the coordinate of the first ghost cell element.
 
const std::array< int, D > & getGhostEnd () const
 Get the coordinate of the last ghost cell element.
 
 operator View< std::add_const_t< T >, D > () const
 

Additional Inherited Members

- Protected Member Functions inherited from ThunderEgg::View< T, D >
int getIndex (const std::array< int, D > &coord) const
 
T_ptr getData () const
 

Detailed Description

template<typename T, int D>
class ThunderEgg::ComponentView< T, D >

Array for acessing data of a patch. It supports variable striding.

Template Parameters
Dnumber of cartesian dimensions

Constructor & Destructor Documentation

◆ ComponentView() [1/2]

template<typename T , int D>
ThunderEgg::ComponentView< T, D >::ComponentView ( T_ptr  data,
const std::array< int, D > &  strides,
const std::array< int, D > &  ghost_start,
const std::array< int, D > &  start,
const std::array< int, D > &  end,
const std::array< int, D > &  ghost_end 
)
inline

Construct a new View object.

Parameters
datapointer to the first element in the patch (non-ghost cell element)
stridesthe strides in each direction
lengthsthe lengths in each direction
num_ghost_cellsthe number of ghost cells on each side of the patch
ldmthe local data manager for the data

◆ ComponentView() [2/2]

template<typename T , int D>
ThunderEgg::ComponentView< T, D >::ComponentView ( T_ptr  data,
const std::array< int, D > &  strides,
const std::array< int, D > &  lengths,
int  num_ghost_cells 
)
inline

Construct a new View object.

Parameters
datapointer to the first element in the patch (non-ghost cell element)
stridesthe strides in each direction
lengthsthe lengths in each direction
num_ghost_cellsthe number of ghost cells on each side of the patch
ldmthe local data manager for the data

Member Function Documentation

◆ getGhostSliceOn()

template<typename T , int D>
template<int M>
template View< double, 2 > ThunderEgg::ComponentView< T, D >::getGhostSliceOn ( Face< D, M >  f,
const std::array< size_t, D - M > &  offset 
) const
inline

Get the gosts slice on a given face.

Template Parameters
Mthe dimension of the face
Parameters
fthe face
offsetoffset the offset of the value {0,..,0} first ghost cell slice touching that face face
Returns
View<M> a view to the slice on the face

◆ getSliceOn()

template<typename T , int D>
template<int M>
template View< const double, 2 > ThunderEgg::ComponentView< T, D >::getSliceOn ( Face< D, M >  f,
const std::array< int, D - M > &  offset 
) const
inline

Get the slice on a given face.

Template Parameters
Mthe dimension of the face
Parameters
fthe face
offsetoffset the offset of the value {0,..,0} is the non ghost cell touching the face. {-1,..,-1} is the first ghost cell touching that face
Returns
View<M> a view to the slice on the face

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