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

 GhostLayerFieldAdaptor (const basefield_t &field, const Functor &func=Functor())
 
virtual ~GhostLayerFieldAdaptor ()
 
const functor_tgetFunctor () const
 
const basefield_tgetAdaptedField () const
 
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 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
 
Adaptors for GhostLayerField
uint_t xSizeWithGhostLayer () const
 
uint_t ySizeWithGhostLayer () const
 
uint_t zSizeWithGhostLayer () const
 
uint_t nrOfGhostLayers () const
 
CellInterval xyzSizeWithGhostLayer () const
 

Protected Attributes

const Functor functor_
 
const basefield_tglField_
 

Type Definitions

typedef Functor functor_t
 
typedef Functor::basefield_t basefield_t
 
typedef Functor::value_type value_type
 
typedef Functor::value_type T
 
typedef basefield_t::const_base_iterator adapted_base_iterator
 
typedef basefield_t::const_iterator adapted_iterator
 
typedef basefield_t::const_reverse_iterator adapted_reverse_iterator
 
typedef GhostLayerFieldAdaptor< Functor, glDecrease > OwnType
 
typedef AdaptorIterator< adapted_base_iterator, OwnTypeconst_base_iterator
 
typedef AdaptorIterator< adapted_iterator, OwnTypeconst_iterator
 
typedef AdaptorIterator< adapted_reverse_iterator, OwnTypeconst_reverse_iterator
 
typedef FieldPointer< OwnType, const OwnType, const TConstPtr
 
static const uint_t F_SIZE = Functor::F_SIZE
 

Member Typedef Documentation

template<typename Functor, uint_t glDecrease>
typedef basefield_t::const_base_iterator walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::adapted_base_iterator
template<typename Functor, uint_t glDecrease>
typedef basefield_t::const_iterator walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::adapted_iterator
template<typename Functor, uint_t glDecrease>
typedef basefield_t::const_reverse_iterator walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::adapted_reverse_iterator
template<typename Functor, uint_t glDecrease>
typedef Functor::basefield_t walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::basefield_t
template<typename Functor, uint_t glDecrease>
typedef AdaptorIterator<adapted_base_iterator, OwnType > walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::const_base_iterator
template<typename Functor, uint_t glDecrease>
typedef AdaptorIterator<adapted_iterator, OwnType > walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::const_iterator
template<typename Functor, uint_t glDecrease>
typedef AdaptorIterator<adapted_reverse_iterator,OwnType > walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::const_reverse_iterator
template<typename Functor, uint_t glDecrease>
typedef FieldPointer<OwnType, const OwnType, const T > walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::ConstPtr
template<typename Functor, uint_t glDecrease>
typedef Functor walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::functor_t
template<typename Functor, uint_t glDecrease>
typedef GhostLayerFieldAdaptor<Functor,glDecrease> walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::OwnType
template<typename Functor, uint_t glDecrease>
typedef Functor::value_type walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::T
template<typename Functor, uint_t glDecrease>
typedef Functor::value_type walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::value_type

Constructor & Destructor Documentation

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

Member Function Documentation

template<typename Functor, uint_t glDecrease>
uint_t walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::allocSize ( ) const
inline
template<typename Functor , uint_t glD>
GhostLayerFieldAdaptor< Functor, glD >::const_iterator walberla::field::GhostLayerFieldAdaptor< Functor, glD >::beginGhostLayerOnly ( stencil::Direction  dir) const
inline
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
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
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
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
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
template<typename Functor , uint_t glD>
GhostLayerFieldAdaptor< Functor, glD >::const_iterator walberla::field::GhostLayerFieldAdaptor< Functor, glD >::beginWithGhostLayer ( ) const
inline
template<typename Functor , uint_t glD>
GhostLayerFieldAdaptor< Functor, glD >::const_iterator walberla::field::GhostLayerFieldAdaptor< Functor, glD >::beginWithGhostLayerXYZ ( ) const
inline
template<typename Functor , uint_t glD>
GhostLayerFieldAdaptor< Functor, glD >::const_iterator walberla::field::GhostLayerFieldAdaptor< Functor, glD >::beginXYZ ( ) const
inline
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
template<typename Functor , uint_t glD>
const GhostLayerFieldAdaptor< Functor, glD >::const_iterator walberla::field::GhostLayerFieldAdaptor< Functor, glD >::end ( ) const
inline
template<typename Functor, uint_t glDecrease>
uint_t walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::fAllocSize ( ) const
inline
template<typename Functor, uint_t glDecrease>
uint_t walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::fSize ( ) const
inline
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
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
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
template<typename Functor, uint_t glDecrease>
T walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::get ( const Cell &  c) const
inline
template<typename Functor, uint_t glDecrease>
T walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::get ( const Cell &  c,
cell_idx_t  f 
) const
inline
template<typename Functor, uint_t glDecrease>
const basefield_t& walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::getAdaptedField ( ) const
inline
template<typename Functor, uint_t glDecrease>
const functor_t& walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::getFunctor ( ) const
inline
template<typename Functor , uint_t glD>
void walberla::field::GhostLayerFieldAdaptor< Functor, glD >::getGhostRegion ( stencil::Direction  dir,
CellInterval &  ci 
) const
inline
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
template<typename Functor, uint_t glDecrease>
bool walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::hasSameAllocSize ( const OwnType other) const
inline
template<typename Functor, uint_t glDecrease>
bool walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::hasSameSize ( const OwnType other) const
inline
template<typename Functor, uint_t glDecrease>
Layout walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::layout ( ) const
inline
template<typename Functor, uint_t glDecrease>
uint_t walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::nrOfGhostLayers ( ) const
inline
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
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
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
template<typename Functor, uint_t glDecrease>
T walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::operator() ( const Cell &  c) const
inline
template<typename Functor, uint_t glDecrease>
T walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::operator() ( const Cell &  c,
cell_idx_t  f 
) const
inline
template<typename Functor, uint_t glDecrease>
bool walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::operator== ( const OwnType other) const
inline
template<typename Functor, uint_t glDecrease>
uint_t walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::xAllocSize ( ) const
inline
template<typename Functor, uint_t glDecrease>
uint_t walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::xSize ( ) const
inline
template<typename Functor, uint_t glDecrease>
uint_t walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::xSizeWithGhostLayer ( ) const
inline
template<typename Functor, uint_t glDecrease>
CellInterval walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::xyzAllocSize ( ) const
inline
template<typename Functor, uint_t glDecrease>
CellInterval walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::xyzSize ( ) const
inline
template<typename Functor , uint_t glD>
CellInterval walberla::field::GhostLayerFieldAdaptor< Functor, glD >::xyzSizeWithGhostLayer ( ) const
inline
template<typename Functor, uint_t glDecrease>
uint_t walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::yAllocSize ( ) const
inline
template<typename Functor, uint_t glDecrease>
uint_t walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::ySize ( ) const
inline
template<typename Functor, uint_t glDecrease>
uint_t walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::ySizeWithGhostLayer ( ) const
inline
template<typename Functor, uint_t glDecrease>
uint_t walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::zAllocSize ( ) const
inline
template<typename Functor, uint_t glDecrease>
uint_t walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::zSize ( ) const
inline
template<typename Functor, uint_t glDecrease>
uint_t walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::zSizeWithGhostLayer ( ) const
inline

Member Data Documentation

template<typename Functor, uint_t glDecrease>
const uint_t walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::F_SIZE = Functor::F_SIZE
static
template<typename Functor, uint_t glDecrease>
const Functor walberla::field::GhostLayerFieldAdaptor< Functor, glDecrease >::functor_
protected
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: