walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease > Class Template Reference

Detailed Description

template<typename Functor, uint_t glDecrease>
class walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >

Adaptor for walberla::field::GhostLayerField.

Motivation:

  • assume you have a LBM PDF field and you want to print / view / process the velocities which can be (easily) computed from the values of the PDF field
  • one could create a second field, filled with the velocities, that is updated every time the pdfs changed
  • the storage saving solution would be to create an adaptor that behaves just as a field, but holds no data. Instead the data is computed when it is requested.

Features:

  • The GhostLayerFieldAdaptor implements (almost) the same members as a GhostLayerField -> it can be passed to any templated function that expects a GhostLayerField
  • The GhostLayerFieldAdaptor wraps one base-field, which in the example above would have been the pdf field
  • the adaptor has automatically the same x,y,z size as the base-field.
  • the adaptor can have a different fSize and a smaller or equal number of ghost layers

Usage

  • The customization of the adaptor (i.e. what it should compute) is done using a AdaptorFunctor that has to implement the following concept:
    class AdaptorFunctor
    {
    // required: type of the basis-field
    typedef Field_T basefield_t;
    // required: f-size of the adaptor, can be different than basefield_t::F_SIZE
    static const uint_t F_SIZE = 1 ;
    // required: function that takes an iterator of the base_field and returns a transformed value
    typedef typename Field_T::value_type value_type;
    value_type operator() ( const basefield_iterator & it ) const {
    // for example: return lbm::calcRho( it );
    }
    // required: same as above, but taking coordinates instead of iterator
    value_type operator() ( const basefield_t & baseField,
    cell_idx_t x, cell_idx_t y, cell_idx_t z, cell_idx_t f = 0 ) const
    {
    // can be implemented like this: (but more efficient version may be possible)
    return (*this) ( basefield_t::Ptr( baseField, x,y,z,f ) );
    }
    };

#include <GhostLayerFieldAdaptor.h>

Public Member Functions

Equality Checks
bool operator== (const OwnType &other) const
 
bool hasSameAllocSize (const OwnType &other) const
 
bool hasSameSize (const OwnType &other) const
 
Iterators
const_iterator beginXYZ () const
 
const_iterator beginSlice (cell_idx_t xBeg, cell_idx_t yBeg, cell_idx_t zBeg, cell_idx_t fBeg, cell_idx_t xEnd, cell_idx_t yEnd, cell_idx_t zEnd, cell_idx_t fEnd) const
 
const_iterator beginSliceXYZ (const CellInterval &interval, cell_idx_t f=0) const
 
const const_iterator end () const
 
const_iterator beginWithGhostLayer () const
 
const_iterator beginWithGhostLayerXYZ () const
 
const_iterator beginGhostLayerOnly (stencil::Direction dir) const
 
const_iterator beginGhostLayerOnlyXYZ (stencil::Direction dir, cell_idx_t f=0) const
 
const_iterator beginSliceBeforeGhostLayer (stencil::Direction dir, cell_idx_t width=1) const
 
const_iterator beginSliceBeforeGhostLayerXYZ (stencil::Direction dir, cell_idx_t width=1, cell_idx_t f=0) const
 
void getGhostRegion (stencil::Direction dir, CellInterval &ci) const
 
void getSliceBeforeGhostLayer (stencil::Direction d, CellInterval &ci, cell_idx_t width=1) const
 
Adaptors for Field


uint_t xSize () const
 
uint_t ySize () const
 
uint_t zSize () const
 
uint_t fSize () const
 
uint_t xAllocSize () const
 
uint_t yAllocSize () const
 
uint_t zAllocSize () const
 
uint_t fAllocSize () const
 
uint_t allocSize () const
 
CellInterval xyzSize () const
 
CellInterval xyzAllocSize () const
 
bool coordinatesValid (cell_idx_t x, cell_idx_t y, cell_idx_t z, cell_idx_t f) const
 
Layout layout () const
 
T operator() (cell_idx_t x, cell_idx_t y, cell_idx_t z) const
 
T operator() (cell_idx_t x, cell_idx_t y, cell_idx_t z, cell_idx_t f) const
 
T operator() (cell_idx_t x, cell_idx_t y, cell_idx_t z, uint_t f) const
 
T operator() (const Cell &c) const
 
T operator() (const Cell &c, cell_idx_t f) const
 
T operator() (const Cell &c, uint_t f) const
 
T get (cell_idx_t x, cell_idx_t y, cell_idx_t z) const
 
T get (cell_idx_t x, cell_idx_t y, cell_idx_t z, cell_idx_t f) const
 
T get (cell_idx_t x, cell_idx_t y, cell_idx_t z, uint_t f) const
 
T get (const Cell &c) const
 
T get (const Cell &c, cell_idx_t f) const
 
T get (const Cell &c, uint_t f) const
 

Type Definitions

using functor_t = Functor
 
using basefield_t = typename Functor::basefield_t
 
using value_type = typename Functor::value_type
 
using T = typename Functor::value_type
 
using adapted_base_iterator = typename basefield_t::const_base_iterator
 
using adapted_iterator = typename basefield_t::const_iterator
 
using adapted_reverse_iterator = typename basefield_t::const_reverse_iterator
 
using OwnType = GhostLayerFieldAdaptor< Functor, glDecrease >
 
using const_base_iterator = AdaptorIterator< adapted_base_iterator, OwnType >
 
using const_iterator = AdaptorIterator< adapted_iterator, OwnType >
 
using const_reverse_iterator = AdaptorIterator< adapted_reverse_iterator, OwnType >
 
using ConstPtr = FieldPointer< OwnType, const OwnType, const T >
 
static const uint_t F_SIZE = Functor::F_SIZE
 
 GhostLayerFieldAdaptor (const basefield_t &field, const Functor &func=Functor())
 
virtual ~GhostLayerFieldAdaptor ()=default
 
const functor_tgetFunctor () const
 
const basefield_tgetAdaptedField () const
 

Adaptors for GhostLayerField


const Functor functor_
 
const basefield_tglField_
 
uint_t xSizeWithGhostLayer () const
 
uint_t ySizeWithGhostLayer () const
 
uint_t zSizeWithGhostLayer () const
 
uint_t nrOfGhostLayers () const
 
CellInterval xyzSizeWithGhostLayer () const
 

Member Typedef Documentation

◆ adapted_base_iterator

template<typename Functor , uint_t glDecrease>
using walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::adapted_base_iterator = typename basefield_t::const_base_iterator

◆ adapted_iterator

template<typename Functor , uint_t glDecrease>
using walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::adapted_iterator = typename basefield_t::const_iterator

◆ adapted_reverse_iterator

template<typename Functor , uint_t glDecrease>
using walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::adapted_reverse_iterator = typename basefield_t::const_reverse_iterator

◆ basefield_t

template<typename Functor , uint_t glDecrease>
using walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::basefield_t = typename Functor::basefield_t

◆ const_base_iterator

template<typename Functor , uint_t glDecrease>
using walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::const_base_iterator = AdaptorIterator<adapted_base_iterator, OwnType>

◆ const_iterator

template<typename Functor , uint_t glDecrease>
using walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::const_iterator = AdaptorIterator<adapted_iterator, OwnType>

◆ const_reverse_iterator

template<typename Functor , uint_t glDecrease>
using walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::const_reverse_iterator = AdaptorIterator<adapted_reverse_iterator, OwnType>

◆ ConstPtr

template<typename Functor , uint_t glDecrease>
using walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::ConstPtr = FieldPointer<OwnType, const OwnType, const T>

◆ functor_t

template<typename Functor , uint_t glDecrease>
using walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::functor_t = Functor

◆ OwnType

template<typename Functor , uint_t glDecrease>
using walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::OwnType = GhostLayerFieldAdaptor<Functor, glDecrease>

◆ T

template<typename Functor , uint_t glDecrease>
using walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::T = typename Functor::value_type

◆ value_type

template<typename Functor , uint_t glDecrease>
using walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::value_type = typename Functor::value_type

Constructor & Destructor Documentation

◆ GhostLayerFieldAdaptor()

template<typename Functor , uint_t glDecrease>
walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::GhostLayerFieldAdaptor ( const basefield_t field,
const Functor &  func = Functor() 
)
inline

◆ ~GhostLayerFieldAdaptor()

template<typename Functor , uint_t glDecrease>
virtual walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::~GhostLayerFieldAdaptor ( )
virtualdefault

Member Function Documentation

◆ allocSize()

template<typename Functor , uint_t glDecrease>
uint_t walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::allocSize ( ) const
inline

◆ beginGhostLayerOnly()

template<typename Functor , uint_t glD>
GhostLayerFieldAdaptor< Functor, glD >::const_iterator walberla::field::GhostLayerFieldAdaptor< Functor, glD >::beginGhostLayerOnly ( stencil::Direction  dir) const
inline

◆ beginGhostLayerOnlyXYZ()

template<typename Functor , uint_t glD>
GhostLayerFieldAdaptor< Functor, glD >::const_iterator walberla::field::GhostLayerFieldAdaptor< Functor, glD >::beginGhostLayerOnlyXYZ ( stencil::Direction  dir,
cell_idx_t  f = 0 
) const
inline

◆ beginSlice()

template<typename Functor , uint_t glD>
GhostLayerFieldAdaptor< Functor, glD >::const_iterator walberla::field::GhostLayerFieldAdaptor< Functor, glD >::beginSlice ( cell_idx_t  xBeg,
cell_idx_t  yBeg,
cell_idx_t  zBeg,
cell_idx_t  fBeg,
cell_idx_t  xEnd,
cell_idx_t  yEnd,
cell_idx_t  zEnd,
cell_idx_t  fEnd 
) const
inline

◆ beginSliceBeforeGhostLayer()

template<typename Functor , uint_t glD>
GhostLayerFieldAdaptor< Functor, glD >::const_iterator walberla::field::GhostLayerFieldAdaptor< Functor, glD >::beginSliceBeforeGhostLayer ( stencil::Direction  dir,
cell_idx_t  width = 1 
) const
inline

◆ beginSliceBeforeGhostLayerXYZ()

template<typename Functor , uint_t glD>
GhostLayerFieldAdaptor< Functor, glD >::const_iterator walberla::field::GhostLayerFieldAdaptor< Functor, glD >::beginSliceBeforeGhostLayerXYZ ( stencil::Direction  dir,
cell_idx_t  width = 1,
cell_idx_t  f = 0 
) const
inline

◆ beginSliceXYZ()

template<typename Functor , uint_t glD>
GhostLayerFieldAdaptor< Functor, glD >::const_iterator walberla::field::GhostLayerFieldAdaptor< Functor, glD >::beginSliceXYZ ( const CellInterval interval,
cell_idx_t  f = 0 
) const
inline

◆ beginWithGhostLayer()

template<typename Functor , uint_t glD>
GhostLayerFieldAdaptor< Functor, glD >::const_iterator walberla::field::GhostLayerFieldAdaptor< Functor, glD >::beginWithGhostLayer
inline

◆ beginWithGhostLayerXYZ()

template<typename Functor , uint_t glD>
GhostLayerFieldAdaptor< Functor, glD >::const_iterator walberla::field::GhostLayerFieldAdaptor< Functor, glD >::beginWithGhostLayerXYZ
inline

◆ beginXYZ()

template<typename Functor , uint_t glD>
GhostLayerFieldAdaptor< Functor, glD >::const_iterator walberla::field::GhostLayerFieldAdaptor< Functor, glD >::beginXYZ
inline

◆ coordinatesValid()

template<typename Functor , uint_t glD>
bool walberla::field::GhostLayerFieldAdaptor< Functor, glD >::coordinatesValid ( cell_idx_t  x,
cell_idx_t  y,
cell_idx_t  z,
cell_idx_t  f 
) const

◆ end()

template<typename Functor , uint_t glD>
const GhostLayerFieldAdaptor< Functor, glD >::const_iterator walberla::field::GhostLayerFieldAdaptor< Functor, glD >::end
inline

◆ fAllocSize()

template<typename Functor , uint_t glDecrease>
uint_t walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::fAllocSize ( ) const
inline

◆ fSize()

template<typename Functor , uint_t glDecrease>
uint_t walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::fSize ( ) const
inline

◆ get() [1/6]

template<typename Functor , uint_t glDecrease>
T walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::get ( cell_idx_t  x,
cell_idx_t  y,
cell_idx_t  z 
) const
inline

◆ get() [2/6]

template<typename Functor , uint_t glDecrease>
T walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::get ( cell_idx_t  x,
cell_idx_t  y,
cell_idx_t  z,
cell_idx_t  f 
) const
inline

◆ get() [3/6]

template<typename Functor , uint_t glDecrease>
T walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::get ( cell_idx_t  x,
cell_idx_t  y,
cell_idx_t  z,
uint_t  f 
) const
inline

◆ get() [4/6]

template<typename Functor , uint_t glDecrease>
T walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::get ( const Cell c) const
inline

◆ get() [5/6]

template<typename Functor , uint_t glDecrease>
T walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::get ( const Cell c,
cell_idx_t  f 
) const
inline

◆ get() [6/6]

template<typename Functor , uint_t glDecrease>
T walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::get ( const Cell c,
uint_t  f 
) const
inline

◆ getAdaptedField()

template<typename Functor , uint_t glDecrease>
const basefield_t& walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::getAdaptedField ( ) const
inline

◆ getFunctor()

template<typename Functor , uint_t glDecrease>
const functor_t& walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::getFunctor ( ) const
inline

◆ getGhostRegion()

template<typename Functor , uint_t glD>
void walberla::field::GhostLayerFieldAdaptor< Functor, glD >::getGhostRegion ( stencil::Direction  dir,
CellInterval ci 
) const
inline

◆ getSliceBeforeGhostLayer()

template<typename Functor , uint_t glD>
void walberla::field::GhostLayerFieldAdaptor< Functor, glD >::getSliceBeforeGhostLayer ( stencil::Direction  d,
CellInterval ci,
cell_idx_t  width = 1 
) const
inline

◆ hasSameAllocSize()

template<typename Functor , uint_t glDecrease>
bool walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::hasSameAllocSize ( const OwnType other) const
inline

◆ hasSameSize()

template<typename Functor , uint_t glDecrease>
bool walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::hasSameSize ( const OwnType other) const
inline

◆ layout()

template<typename Functor , uint_t glDecrease>
Layout walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::layout ( ) const
inline

◆ nrOfGhostLayers()

template<typename Functor , uint_t glDecrease>
uint_t walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::nrOfGhostLayers ( ) const
inline

◆ operator()() [1/6]

template<typename Functor , uint_t glDecrease>
T walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::operator() ( cell_idx_t  x,
cell_idx_t  y,
cell_idx_t  z 
) const
inline

◆ operator()() [2/6]

template<typename Functor , uint_t glDecrease>
T walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::operator() ( cell_idx_t  x,
cell_idx_t  y,
cell_idx_t  z,
cell_idx_t  f 
) const
inline

◆ operator()() [3/6]

template<typename Functor , uint_t glDecrease>
T walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::operator() ( cell_idx_t  x,
cell_idx_t  y,
cell_idx_t  z,
uint_t  f 
) const
inline

◆ operator()() [4/6]

template<typename Functor , uint_t glDecrease>
T walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::operator() ( const Cell c) const
inline

◆ operator()() [5/6]

template<typename Functor , uint_t glDecrease>
T walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::operator() ( const Cell c,
cell_idx_t  f 
) const
inline

◆ operator()() [6/6]

template<typename Functor , uint_t glDecrease>
T walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::operator() ( const Cell c,
uint_t  f 
) const
inline

◆ operator==()

template<typename Functor , uint_t glDecrease>
bool walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::operator== ( const OwnType other) const
inline

◆ xAllocSize()

template<typename Functor , uint_t glDecrease>
uint_t walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::xAllocSize ( ) const
inline

◆ xSize()

template<typename Functor , uint_t glDecrease>
uint_t walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::xSize ( ) const
inline

◆ xSizeWithGhostLayer()

template<typename Functor , uint_t glDecrease>
uint_t walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::xSizeWithGhostLayer ( ) const
inline

◆ xyzAllocSize()

template<typename Functor , uint_t glDecrease>
CellInterval walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::xyzAllocSize ( ) const
inline

◆ xyzSize()

template<typename Functor , uint_t glDecrease>
CellInterval walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::xyzSize ( ) const
inline

◆ xyzSizeWithGhostLayer()

template<typename Functor , uint_t glD>
CellInterval walberla::field::GhostLayerFieldAdaptor< Functor, glD >::xyzSizeWithGhostLayer
inline

◆ yAllocSize()

template<typename Functor , uint_t glDecrease>
uint_t walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::yAllocSize ( ) const
inline

◆ ySize()

template<typename Functor , uint_t glDecrease>
uint_t walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::ySize ( ) const
inline

◆ ySizeWithGhostLayer()

template<typename Functor , uint_t glDecrease>
uint_t walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::ySizeWithGhostLayer ( ) const
inline

◆ zAllocSize()

template<typename Functor , uint_t glDecrease>
uint_t walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::zAllocSize ( ) const
inline

◆ zSize()

template<typename Functor , uint_t glDecrease>
uint_t walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::zSize ( ) const
inline

◆ zSizeWithGhostLayer()

template<typename Functor , uint_t glDecrease>
uint_t walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::zSizeWithGhostLayer ( ) const
inline

Member Data Documentation

◆ F_SIZE

template<typename Functor , uint_t glDecrease>
const uint_t walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::F_SIZE = Functor::F_SIZE
static

◆ functor_

template<typename Functor , uint_t glDecrease>
const Functor walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::functor_
protected

◆ glField_

template<typename Functor , uint_t glDecrease>
const basefield_t& walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::glField_
protected

The documentation for this class was generated from the following file:
typename Functor::value_type value_type
Definition: GhostLayerFieldAdaptor.h:90
typename Functor::basefield_t basefield_t
Definition: GhostLayerFieldAdaptor.h:89
static const uint_t F_SIZE
Definition: GhostLayerFieldAdaptor.h:93
int cell_idx_t
Definition: DataTypes.h:151
std::size_t uint_t
Definition: DataTypes.h:133
T operator()(cell_idx_t x, cell_idx_t y, cell_idx_t z) const
Definition: GhostLayerFieldAdaptor.h:181