FlexELA
Loading...
Searching...
No Matches
Classes | Public Member Functions | Protected Attributes | List of all members
fields::Helper< T > Class Template Reference

A helper class to wrap pointers to padded 3D cartesian data. More...

#include <fields.h>

Inheritance diagram for fields::Helper< T >:
fields::Owner< T >

Classes

struct  forward_Iterator
 
struct  Iterator
 An iterator for all data (excluding padding) in Helper<T>. More...
 
struct  reverse_Iterator
 

Public Member Functions

 Helper (T *array, const int n[3], const int pad[6])
 Construct a new Array Helper object pointing to array.
 
Tat (int i, int j, int k) const
 Get the element at (i,j,k)
 
std::size_t size () const
 Return the number of (not pad) cells.
 
Helper< Tslice (int is, int ie, int js, int je, int ks, int ke) const
 Create a slice of the array.
 
forward_Iterator begin () const
 Iterator to the start (0,0,0) of the data.
 
forward_Iterator end () const
 Iterator to the end of the data.
 
reverse_Iterator rbegin () const
 Reverse Iterator to the end (ni-1,nj-1,nk-1) of the data.
 
reverse_Iterator rend () const
 Reverse Iterator end.
 

Protected Attributes

T *const basePtr
 Pointer to start of underlying data.
 
int const n [3]
 \(\left[N_{i},N_{j},N_{k}\right]\)
 
int const pad [6]
 \(\left[n_{i-},n_{i+},n_{j-},n_{j+},n_{k-},n_{k+}\right]\)
 

Detailed Description

template<class T>
class fields::Helper< T >

A helper class to wrap pointers to padded 3D cartesian data.

Template Parameters
TThe class of the field data

Constructor & Destructor Documentation

◆ Helper()

template<class T >
fields::Helper< T >::Helper ( T array,
const int  n[3],
const int  pad[6] 
)
inline

Construct a new Array Helper object pointing to array.

For definitions of n and pad, see fields

Parameters
arrayThe 3D cartesian data
nThe number of (not pad) cells in each direction, \(\left[N_{i},N_{j},N_{k}\right]\)
padThe number of ghost cells in each direction, \(\left[n_{i-},n_{i+},n_{j-},n_{j+},n_{k-},n_{k+}\right]\)

Member Function Documentation

◆ at()

template<class T >
T & fields::Helper< T >::at ( int  i,
int  j,
int  k 
) const
inline

Get the element at (i,j,k)

Note
Negative indices and indices beyond the number of elements are allowed so long as they do no go beyond the pad.
Parameters
iFirst Index
jSecond Index
kThird Index
Returns
T&

◆ begin()

template<class T >
forward_Iterator fields::Helper< T >::begin ( ) const
inline

Iterator to the start (0,0,0) of the data.

Returns
Iterator

◆ end()

template<class T >
forward_Iterator fields::Helper< T >::end ( ) const
inline

Iterator to the end of the data.

Returns
Iterator

◆ rbegin()

template<class T >
reverse_Iterator fields::Helper< T >::rbegin ( ) const
inline

Reverse Iterator to the end (ni-1,nj-1,nk-1) of the data.

Returns
Iterator

◆ rend()

template<class T >
reverse_Iterator fields::Helper< T >::rend ( ) const
inline

Reverse Iterator end.

Returns
Iterator

◆ size()

template<class T >
std::size_t fields::Helper< T >::size ( ) const
inline

Return the number of (not pad) cells.

Returns
\(N_{i} \times N_{j} \times N_{k}\)

◆ slice()

template<class T >
Helper< T > fields::Helper< T >::slice ( int  is,
int  ie,
int  js,
int  je,
int  ks,
int  ke 
) const
inline

Create a slice of the array.

Create a slice of \( i\in [i_s, i_e)\), \( j\in [j_s, j_e)\), and \( k\in [k_s, k_e)\).

  • The returned Helper will have indices \(i'\) which point to the same element as \(i=i'+i_s\) in this Helper
  • The end index is exclusive!
Parameters
is
ie
js
je
ks
ke
Returns
Helper

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