walberla::field::FieldClone< WorkField, constSize > Class Template Reference

Detailed Description

template<typename WorkField, bool constSize = false>
class walberla::field::FieldClone< WorkField, constSize >

Helper class for the common scenario where a 'scratch field' is needed.

Consider for example a LBM stream operation: Usually two fields are used, one source field to read the values and one destination field where the result is written to. In the end both fields are swapped. Now if one has multiple fields per block one scratch field is enough if all fields have the same size.

This class helps in this scenario by providing that extra scratch field. The first time get() is called, a clone of the field is created and returned. Further calls return the same scratch field.

If fields have different sizes one scratch field is held for each size.

Template Parameters
WorkFieldfield that has to be derived from GhostLayerField
constSizehave all fields the same size?

#include <FieldClone.h>

Public Member Functions

 FieldClone (ConstBlockDataID fieldID)
 
 ~FieldClone ()
 
WorkField * get (IBlock *block)
 
WorkField * get (IBlock *block, bool &created)
 

Private Attributes

const BlockDataID fieldID_
 field which is processed More...
 
WorkField * dstField_
 field pointer for constant size More...
 
std::set< WorkField *, SwapableCompare< WorkField * > > dstFieldSet_
 dst field for every field-size occurring on this process More...
 

Constructor & Destructor Documentation

◆ FieldClone()

template<typename WorkField , bool constSize = false>
walberla::field::FieldClone< WorkField, constSize >::FieldClone ( ConstBlockDataID  fieldID)
inline

◆ ~FieldClone()

template<typename WorkField , bool constSize = false>
walberla::field::FieldClone< WorkField, constSize >::~FieldClone ( )
inline

Member Function Documentation

◆ get() [1/2]

template<typename WorkField , bool constSize = false>
WorkField* walberla::field::FieldClone< WorkField, constSize >::get ( IBlock block)
inline

◆ get() [2/2]

template<typename WorkField , bool constSize = false>
WorkField* walberla::field::FieldClone< WorkField, constSize >::get ( IBlock block,
bool &  created 
)
inline

Member Data Documentation

◆ dstField_

template<typename WorkField , bool constSize = false>
WorkField* walberla::field::FieldClone< WorkField, constSize >::dstField_
private

field pointer for constant size

◆ dstFieldSet_

template<typename WorkField , bool constSize = false>
std::set< WorkField*, SwapableCompare<WorkField*> > walberla::field::FieldClone< WorkField, constSize >::dstFieldSet_
private

dst field for every field-size occurring on this process

◆ fieldID_

template<typename WorkField , bool constSize = false>
const BlockDataID walberla::field::FieldClone< WorkField, constSize >::fieldID_
private

field which is processed


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