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

View for accessing data of a patch. It supports variable striding. More...

#include <PatchView.h>

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

Public Types

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

Public Member Functions

 PatchView ()
 Construct a new PatchView with size 0.
 
 PatchView (T_ptr data, const std::array< int, D+1 > &strides, const std::array< int, D+1 > &ghost_start, const std::array< int, D+1 > &start, const std::array< int, D+1 > &end, const std::array< int, D+1 > &ghost_end)
 Construct a new View object. More...
 
 PatchView (T_ptr data, const std::array< int, D+1 > &strides, const std::array< int, D+1 > &lengths, int num_ghost_cells)
 Construct a new View object. More...
 
template<int M>
View< T, M+1 > 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+1 > getGhostSliceOn (Face< D, M > f, const std::array< size_t, D - M > &offset) const
 Get the gosts slice on a given face. More...
 
ComponentView< T, D > getComponentView (int component_index) const
 
 operator PatchView< std::add_const_t< T >, D > () const
 
- Public Member Functions inherited from ThunderEgg::View< T, D+1 >
 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...
 
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+1 >
int getIndex (const std::array< int, D > &coord) const
 
T_ptr getData () const
 

Detailed Description

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

View for accessing data of a patch. It supports variable striding.

Template Parameters
Dnumber of cartesian dimensions

Constructor & Destructor Documentation

◆ PatchView() [1/2]

template<typename T , int D>
ThunderEgg::PatchView< T, D >::PatchView ( T_ptr  data,
const std::array< int, D+1 > &  strides,
const std::array< int, D+1 > &  ghost_start,
const std::array< int, D+1 > &  start,
const std::array< int, D+1 > &  end,
const std::array< int, D+1 > &  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

◆ PatchView() [2/2]

template<typename T , int D>
ThunderEgg::PatchView< T, D >::PatchView ( T_ptr  data,
const std::array< int, D+1 > &  strides,
const std::array< int, D+1 > &  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, 3 > ThunderEgg::PatchView< 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<typename std::remove_const<T>::type, M + 1>

◆ getSliceOn()

template<typename T , int D>
template<int M>
template View< const double, 3 > ThunderEgg::PatchView< 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<T,M+1> a view to the slice on the face

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