walberla::field::FlagField< T > Class Template Reference

Detailed Description

template<typename T = uint32_t>
class walberla::field::FlagField< T >

GhostLayerField that stores bit masks.

Two main functionalities:

  • Flag access functions: add/remove flags
  • Registration/Mapping of strings to bits and vice versa

Registration and UID Mechanism:

  • Each bit of the flag type is assigned a UID which is basically just a number representing a string UID's are used here to avoid string comparisons, and to do integer comparisons instead. The FlagUID class internally holds a uint_t and has a static map that maps the uint_t to a string
  • Each registration function exists also in a variant that takes a string. These functions generated the UID internally.
  • All registration data structures are held indirectly by a pointer to allow for a shallow copy of the FlagField

Flag / Mask operations:

  • Difference Mask/Flag: Flag is a mask where exactly one bit is set. All functions that have "Flag" in their name, enforce this restriction in debug-mode. In release mode they are equivalent to their "Mask" counterparts.
  • Mask operations are function to add, remove and query for bits in a bit-mask. There are three groups of them:
    • There are free functions in FlagFunctions.h that take the mask/flag and the value to modify. Since they are free functions they cannot check, if the bits they operate one, have been registered. Intended use case are constructs like: addFlag( fieldIterator.neighbor(d), someFlag )
    • The second group takes an iterator, instead of a value. The iterator holds the corresponding flagField and therefore these functions can do more checks, and should be favored to "free" ones. Example: addFlag ( fieldIterator, someFlag) Note that the iterator is not dereferenced here! When dereferenced the first group of functions would be used
    • The third group are the member functions of the FlagField, taking (x,y,z) coordinates. They of course can also do all checks that the second group can do.

See also Overview of Field Module

#include <FlagField.h>

+ Inheritance diagram for walberla::field::FlagField< T >:

Classes

struct  RegistrationData
 

Public Types

Type Definitions
typedef T flag_t
 
typedef GhostLayerField< T, 1 >::value_type value_type
 
typedef GhostLayerField< T, 1 >::iterator iterator
 
typedef GhostLayerField< T, 1 >::const_iterator const_iterator
 
typedef GhostLayerField< T, 1 >::reverse_iterator reverse_iterator
 
typedef GhostLayerField< T, 1 >::const_reverse_iterator const_reverse_iterator
 
typedef Field< T, 1 >::base_iterator base_iterator
 
typedef Field< T, 1 >::const_base_iterator const_base_iterator
 
typedef GhostLayerField< T, 1 >::Ptr Ptr
 
typedef GhostLayerField< T, 1 >::ConstPtr ConstPtr
 
- Public Types inherited from walberla::field::GhostLayerField< T, 1 >
typedef Field< T, fSize_ >::value_type value_type
 
typedef Field< T, fSize_ >::iterator iterator
 
typedef Field< T, fSize_ >::const_iterator const_iterator
 
typedef Field< T, fSize_ >::reverse_iterator reverse_iterator
 
typedef Field< T, fSize_ >::const_reverse_iterator const_reverse_iterator
 
typedef Field< T, fSize_ >::base_iterator base_iterator
 
typedef Field< T, fSize_ >::const_base_iterator const_base_iterator
 
typedef Field< T, fSize_ >::Ptr Ptr
 
typedef Field< T, fSize_ >::ConstPtr ConstPtr
 
- Public Types inherited from walberla::field::Field< T, fSize_ >
typedef T value_type
 
typedef ForwardFieldIterator< T, fSize_ > iterator
 
typedef ForwardFieldIterator< const T, fSize_ > const_iterator
 
typedef ReverseFieldIterator< T, fSize_ > reverse_iterator
 
typedef ReverseFieldIterator< const T, fSize_ > const_reverse_iterator
 
typedef FieldIterator< T, fSize_ > base_iterator
 
typedef FieldIterator< const T, fSize_ > const_base_iterator
 
typedef FieldPointer< Field< T, fSize_ >, Field< T, fSize_ >, T > Ptr
 
typedef FieldPointer< Field< T, fSize_ >, const Field< T, fSize_ >, const T > ConstPtr
 
typedef boost::function< void(cell_idx_t x, cell_idx_t y, cell_idx_t z, cell_idx_t f, const T &value) > MonitorFunction
 

Public Member Functions

template<typename FlagUIDContainer >
getMask (const FlagUIDContainer &uids) const
 Returns the flag mask for a given container of UIDs. More...
 
Construction & Destruction
 FlagField (uint_t xSize, uint_t ySize, uint_t zSize, uint_t gl, const shared_ptr< FieldAllocator< T > > &alloc=make_shared< StdFieldAlloc< T > >())
 Constructor. More...
 
virtual ~FlagField ()
 Explicitly declared destructor, needed for handling the shallow copied Registration Data. More...
 
FlagField< T > * clone () const
 
FlagField< T > * cloneUninitialized () const
 
FlagField< T > * cloneShallowCopy () const
 
Flag Registration
flag_t registerFlag (const FlagUID &uid)
 Registers a flag. More...
 
flag_t registerFlag (const FlagUID &uid, uint_t bitNr)
 Registers a flag and forces it to a given bitNr. More...
 
flag_t getFlag (const FlagUID &uid) const
 Returns the flag mask for a given UID. More...
 
const FlagUID & getFlagUID (const flag_t flag) const
 Returns the flag UID for a given mask. More...
 
flag_t getOrRegisterFlag (const FlagUID &uid)
 Returns the flag mask for a given UID if already registered, otherwise registers flag. More...
 
template<typename FlagUIDContainer >
flag_t getMask (const FlagUIDContainer &uids) const
 
bool flagExists (const FlagUID &uid) const
 Test if flag was already registered. More...
 
bool flagExists (uint_t bitNr) const
 Test if flag was already registered. More...
 
void printRegistered (std::ostream &os) const
 Prints a list of "bitNr - flagName". More...
 
void printCell (std::ostream &os, const Cell &cell) const
 Prints a list of set flags in the given cell. More...
 
bool isRegistered (flag_t mask) const
 True, if all bits that are set in the mask have been registered at this FlagField. More...
 
void getAllRegisteredFlags (std::vector< FlagUID > &out) const
 Appends the string representation of all registered flags at the given vector. More...
 
const std::map< FlagUID, flag_t > & getMapping () const
 
Slicing
FlagField< T > * getSlicedField (const CellInterval &interval) const
 
- Public Member Functions inherited from walberla::field::GhostLayerField< T, 1 >
 GhostLayerField (uint_t xSize, uint_t ySize, uint_t zSize, uint_t gl, const Layout &layout=zyxf, const shared_ptr< FieldAllocator< T > > &alloc=shared_ptr< FieldAllocator< T > >())
 Creates an uninitialized field of given size. More...
 
 GhostLayerField (uint_t xSize, uint_t ySize, uint_t zSize, uint_t gl, const T &initValue, const Layout &layout=zyxf, const shared_ptr< FieldAllocator< T > > &alloc=shared_ptr< FieldAllocator< T > >())
 Creates a field and initializes it with constant value. More...
 
 GhostLayerField (uint_t xSize, uint_t ySize, uint_t zSize, uint_t gl, const std::vector< T > &fValues, const Layout &layout=zyxf, const shared_ptr< FieldAllocator< T > > &alloc=shared_ptr< FieldAllocator< T > >())
 Creates a field and initializes f coordinate with vector values. More...
 
virtual ~GhostLayerField ()
 
void init (uint_t xSizeWithoutGhostLayer, uint_t ySizeWithoutGhostLayer, uint_t zSizeWithoutGhostLayer, uint_t nrGhostLayers, const Layout &layout=zyxf, const shared_ptr< FieldAllocator< T > > &alloc=shared_ptr< FieldAllocator< T > >())
 Initializes a field, must be called exactly once. More...
 
virtual void resize (uint_t xSize, uint_t ySize, uint_t zSize)
 Deletes all stored data, and resizes the field. More...
 
void resize (uint_t xSize, uint_t ySize, uint_t zSize, uint_t gl)
 Deletes all stored data, and resizes the field. More...
 
GhostLayerField< T, fSize_ > * clone () const
 
GhostLayerField< T, fSize_ > * cloneUninitialized () const
 
GhostLayerField< T, fSize_ > * cloneShallowCopy () const
 
uint_t xSizeWithGhostLayer () const
 
uint_t ySizeWithGhostLayer () const
 
uint_t zSizeWithGhostLayer () const
 
uint_t sizeWithGhostLayer (uint_t i) const
 
uint_t nrOfGhostLayers () const
 
CellInterval xyzSizeWithGhostLayer () const
 Returns the x/y/z Size of the field with ghost layers. More...
 
void setWithGhostLayer (const T &value)
 Sets all entries (including the ghost layer) of the field to given value. More...
 
void setWithGhostLayer (const std::vector< T > &fValues)
 Initializes the f coordinate to values from vector, in all cells including the ghost layers Sets the entry (x,y,z,f) to fValues[f]. More...
 
iterator beginWithGhostLayer ()
 Iterator over all cells, including the ghost layers. More...
 
const_iterator beginWithGhostLayer () const
 Returns const_iterator, see beginWithGhostLayer() More...
 
iterator beginWithGhostLayer (cell_idx_t numGhostLayers)
 
const_iterator beginWithGhostLayer (cell_idx_t numGhostLayers) const
 
iterator beginWithGhostLayerXYZ ()
 Iterates only over all cells including ghost layers of XYZ coordinate, f is always 0. More...
 
const_iterator beginWithGhostLayerXYZ () const
 Const version of beginWithGhostLayerXYZ() More...
 
iterator beginWithGhostLayerXYZ (cell_idx_t numGhostLayers)
 
const_iterator beginWithGhostLayerXYZ (cell_idx_t numGhostLayers) const
 
iterator beginGhostLayerOnly (stencil::Direction dir, bool fullSlice=false)
 Iterates only over ghost layers of a given direction. More...
 
const_iterator beginGhostLayerOnly (stencil::Direction dir, bool fullSlice=false) const
 Const version of beginGhostLayersOnly() More...
 
iterator beginGhostLayerOnly (uint_t thickness, stencil::Direction dir, bool fullSlice=false)
 Iterates only over specified number of ghost layers of a given direction. More...
 
const_iterator beginGhostLayerOnly (uint_t thickness, stencil::Direction dir, bool fullSlice=false) const
 Const version of beginGhostLayersOnly(uint_t thickness, stencil::Direction) More...
 
iterator beginGhostLayerOnlyXYZ (stencil::Direction dir, cell_idx_t f=0, bool fullSlice=false)
 Iterates only over ghost layers of a given direction, only over xyz coordinates, f is fixed. More...
 
const_iterator beginGhostLayerOnlyXYZ (stencil::Direction dir, cell_idx_t f=0, bool fullSlice=false) const
 Const version of beginGhostLayersOnlyXYZ() More...
 
iterator beginGhostLayerOnlyXYZ (uint_t thickness, stencil::Direction dir, cell_idx_t f=0, bool fullSlice=false)
 Iterates only over ghost layers of a given direction, only over xyz coordinates, f is fixed. More...
 
const_iterator beginGhostLayerOnlyXYZ (uint_t thickness, stencil::Direction dir, cell_idx_t f=0, bool fullSlice=false) const
 Const version of beginGhostLayersOnlyXYZ() More...
 
iterator beginSliceBeforeGhostLayer (stencil::Direction dir, cell_idx_t thickness=1, bool fullSlice=false)
 Iterates only over the last slice before ghost layer. More...
 
const_iterator beginSliceBeforeGhostLayer (stencil::Direction dir, cell_idx_t thickness=1, bool fullSlice=false) const
 Const version of beginSliceBeforeGhostLayer() More...
 
iterator beginSliceBeforeGhostLayerXYZ (stencil::Direction dir, cell_idx_t thickness=1, cell_idx_t f=0, bool fullSlice=false)
 Iterates only over the last slice before ghost layer, only in XYZ direction, f is fixed. More...
 
const_iterator beginSliceBeforeGhostLayerXYZ (stencil::Direction dir, cell_idx_t thickness=1, cell_idx_t f=0, bool fullSlice=false) const
 Const version of beginSliceBeforeGhostLayerXYZ() More...
 
void getGhostRegion (stencil::Direction dir, CellInterval &ghostAreaOut, cell_idx_t thickness, bool fullSlice=false) const
 
void getSliceBeforeGhostLayer (stencil::Direction d, CellInterval &ci, cell_idx_t thickness=1, bool fullSlice=false) const
 
bool isInInnerPart (const Cell &cell) const
 Checks if a given cell is in the inner part of the field ( not in ghost region or outside ) More...
 
reverse_iterator rbeginWithGhostLayer ()
 Reverse Iterator over all cells, including the ghost layers. More...
 
const_reverse_iterator rbeginWithGhostLayer () const
 Returns const_iterator, see beginWithGhostLayer() More...
 
reverse_iterator rbeginWithGhostLayerXYZ ()
 Iterates only over all cells including ghost layers of XYZ coordinate, f is always 0. More...
 
const_reverse_iterator rbeginWithGhostLayerXYZ () const
 Const version of beginWithGhostLayerXYZ() More...
 
GhostLayerField< T, fSize_ > * getSlicedField (const CellInterval &interval) const
 
virtual void slice (const CellInterval &interval)
 Changes the coordinate system of the field. More...
 
virtual void shiftCoordinates (cell_idx_t cx, cell_idx_t cy, cell_idx_t cz)
 
- Public Member Functions inherited from walberla::field::Field< T, fSize_ >
 Field (uint_t xSize, uint_t ySize, uint_t zSize, const Layout &layout=zyxf, const shared_ptr< FieldAllocator< T > > &alloc=shared_ptr< FieldAllocator< T > >())
 Creates an uninitialized field of given size. More...
 
 Field (uint_t xSize, uint_t ySize, uint_t zSize, const T &initValue, const Layout &layout=zyxf, const shared_ptr< FieldAllocator< T > > &alloc=shared_ptr< FieldAllocator< T > >())
 Creates a field and initializes it with constant. More...
 
 Field (uint_t xSize, uint_t ySize, uint_t zSize, const std::vector< T > &fValues, const Layout &layout=zyxf, const shared_ptr< FieldAllocator< T > > &alloc=shared_ptr< FieldAllocator< T > >())
 Creates a field and initializes f coordinate with vector values. More...
 
virtual ~Field ()
 Destructor, using Allocator template parameter. More...
 
void init (uint_t xSize, uint_t ySize, uint_t zSize, const Layout &layout=zyxf, shared_ptr< FieldAllocator< T > > alloc=shared_ptr< FieldAllocator< T > >(), uint_t innerGhostLayerSizeForAlignedAlloc=0)
 Initializes the field with a given size, in a given layout. More...
 
Field< T, fSize_ > * clone () const
 Returns a deep copy of the current field. More...
 
Field< T, fSize_ > * cloneUninitialized () const
 Creates a new field that has equal size and layout as this field. More...
 
Field< T, fSize_ > * cloneShallowCopy () const
 Returns a shallow copy of the current field. More...
 
T & get (cell_idx_t x, cell_idx_t y, cell_idx_t z)
 get function with only (x,y,z) coordinates, assumes fSize=1 More...
 
const T & get (cell_idx_t x, cell_idx_t y, cell_idx_t z) const
 get function with only (x,y,z) coordinates, assumes fSize=1 More...
 
T & get (cell_idx_t x, cell_idx_t y, cell_idx_t z, cell_idx_t f)
 Non-Const variant of get() More...
 
const T & get (cell_idx_t x, cell_idx_t y, cell_idx_t z, cell_idx_t f) const
 Accesses the value at given coordinate. More...
 
T & get (cell_idx_t x, cell_idx_t y, cell_idx_t z, uint_t f)
 get() variant which takes a uint_t as last coordinate, as for example Stencil::toIdx() returns More...
 
const T & get (cell_idx_t x, cell_idx_t y, cell_idx_t z, uint_t f) const
 get() variant which takes a uint_t as last coordinate, as for example Stencil::toIdx() returns More...
 
T & get (const Cell &cell)
 get overload using a cell as input, only possible if fSize=1 More...
 
const T & get (const Cell &cell) const
 get overload using a cell as input, only possible if fSize=1 More...
 
T & get (const Cell &c, cell_idx_t f)
 
const T & get (const Cell &c, cell_idx_t f) const
 
T & get (const Cell &c, uint_t f)
 
const T & get (const Cell &c, uint_t f) const
 
T & get (const base_iterator &iter)
 get overload, where position is specified using an iterator of another field with equal size More...
 
const T & get (const base_iterator &iter) const
 get overload, where position is specified using an iterator of another field with equal size More...
 
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) 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, 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() (cell_idx_t x, cell_idx_t y, cell_idx_t z, uint_t f) const
 
T & operator() (const Cell &cell)
 
const T & operator() (const Cell &cell) const
 
T & operator() (const Cell &cell, cell_idx_t f)
 
const T & operator() (const Cell &cell, cell_idx_t f) const
 
T & operator() (const Cell &cell, uint_t f)
 
const T & operator() (const Cell &cell, uint_t f) const
 
T & operator() (const base_iterator &iter)
 
const T & operator() (const base_iterator &iter) const
 
T & getNeighbor (cell_idx_t x, cell_idx_t y, cell_idx_t z, stencil::Direction d)
 returns neighboring value of cell in the given direction More...
 
const T & getNeighbor (cell_idx_t x, cell_idx_t y, cell_idx_t z, stencil::Direction d) const
 returns neighboring value of cell in the given direction More...
 
T & getNeighbor (cell_idx_t x, cell_idx_t y, cell_idx_t z, uint_t f, stencil::Direction d)
 returns neighboring value of cell in the given direction More...
 
const T & getNeighbor (cell_idx_t x, cell_idx_t y, cell_idx_t z, uint_t f, stencil::Direction d) const
 returns neighboring value of cell in the given direction More...
 
T & getNeighbor (const Cell &cell, stencil::Direction d)
 get overload using a cell as input, only possible if fSize=1, with neighbor access More...
 
const T & getNeighbor (const Cell &cell, stencil::Direction d) const
 get overload using a cell as input, only possible if fSize=1, with neighbor access More...
 
T & getF (T *const xyz0, const cell_idx_t f)
 
const T & getF (const T *const xyz0, const cell_idx_t f) const
 
T & getF (T *const xyz0, const uint_t f)
 
const T & getF (const T *const xyz0, const uint_t f) const
 
void set (const T &value)
 Sets all entries of the field to given value. More...
 
void set (const std::vector< T > &fValues)
 Initializes the f coordinate to values from vector Sets the entry (x,y,z,f) to fValues[f]. More...
 
void set (const Field< T, fSize_ > &other)
 Copies all entries of the given field to this field. More...
 
void set (const Field< T, fSize_ > *other)
 
void swapDataPointers (Field< T, fSize_ > &other)
 Swap two fields efficiently by exchanging only values_ pointer The two fields have to have identical sizes and same layout. More...
 
void swapDataPointers (Field< T, fSize_ > *other)
 
bool operator== (const Field< T, fSize_ > &other) const
 Equality operator compares element-wise. More...
 
bool operator!= (const Field< T, fSize_ > &other) const
 Inequality operator compares element-wise. More...
 
bool hasSameAllocSize (const Field< T, fSize_ > &other) const
 True if allocation sizes of all dimensions match. More...
 
bool hasSameSize (const Field< T, fSize_ > &other) const
 True if sizes of all dimensions match. More...
 
iterator begin ()
 Returns iterator, which can iterate over complete field in a suitable order depending on layout. More...
 
const_iterator begin () const
 Returns const_iterator, see begin() More...
 
iterator beginXYZ ()
 Iterates only over XYZ coordinate, f is always 0. More...
 
const_iterator beginXYZ () const
 Const version of beginXYZ() More...
 
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)
 Returns iterator which iterates over a sub-block of the field. More...
 
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 variant of beginSlice() More...
 
iterator beginSliceXYZ (const CellInterval &interval, cell_idx_t f=0)
 Returns iterator which iterates over a slice, but only in x,y,z coordinates. More...
 
const_iterator beginSliceXYZ (const CellInterval &interval, cell_idx_t f=0) const
 Const variant of beginSliceXYZ() More...
 
const iteratorend ()
 
const const_iteratorend () const
 
reverse_iterator rbegin ()
 Returns reverse iterator, which can iterate over complete field in a suitable order depending on layout. More...
 
const_reverse_iterator rbegin () const
 Returns const_reverse_iterator, see begin() More...
 
reverse_iterator rbeginXYZ ()
 Iterates only over XYZ coordinate, f is always 0. More...
 
const_reverse_iterator rbeginXYZ () const
 Const version of beginXYZ() More...
 
const reverse_iteratorrend ()
 
const const_reverse_iteratorrend () const
 
uint_t xSize () const
 
uint_t ySize () const
 
uint_t zSize () const
 
uint_t fSize () const
 
uint_t size (uint_t coord) 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
 
Layout layout () const
 
cell_idx_t xStride () const
 
cell_idx_t yStride () const
 
cell_idx_t zStride () const
 
cell_idx_t fStride () const
 
cell_idx_t xOff () const
 
cell_idx_t yOff () const
 
cell_idx_t zOff () const
 
bool coordinatesValid (cell_idx_t x, cell_idx_t y, cell_idx_t z, cell_idx_t f) const
 
Field< T, fSize_ > * getSlicedField (const CellInterval &interval) const
 Create a different "view" of the field, where the created field has the size of the given sliceInterval. More...
 
T * data ()
 
const T * data () const
 
T * dataInner ()
 
const T * dataInner () const
 
shared_ptr< FieldAllocator< T > > getAllocator () const
 Returns internal data allocator. More...
 
void addMonitoringFunction (const MonitorFunction &func)
 Registers a monitoring function. More...
 

Protected Member Functions

 FlagField ()
 Constructor. More...
 
Shallow Copy
 FlagField (const FlagField< T > &other)
 Private copy constructor that creates a shallow copy of the data. More...
 
virtual Field< T, 1 > * cloneShallowCopyInternal () const
 See Field::cloneShallowCopyInternal() Has to be re-implemented because a new GhostLayerField is created. More...
 
- Protected Member Functions inherited from walberla::field::GhostLayerField< T, 1 >
 GhostLayerField ()
 Creates a field of zero size. More...
 
 GhostLayerField (const GhostLayerField< T, fSize_ > &other)
 Private copy constructor, which does a shallow copy. More...
 
- Protected Member Functions inherited from walberla::field::Field< T, fSize_ >
 Field ()
 Creates an uninitialized field of size zero (no allocated memory) More...
 
 Field (const Field &other)
 Private copy constructor that creates a shallow copy i.e. More...
 
virtual uint_t referenceCount () const
 Returns the number of objects that internally use the same data. More...
 
void setOffsets (uint_t xOffset, uint_t xSize, uint_t yOffset, uint_t ySize, uint_t zOffset, uint_t zSizes)
 Moves the coordinate system of the field. More...
 
shared_ptr< FieldAllocator< T > > allocator () const
 
bool addressInsideAllocedSpace (const T *const value) const
 
void assertValidCoordinates (cell_idx_t x, cell_idx_t y, cell_idx_t z, cell_idx_t f) const
 

Protected Attributes

RegistrationDatadata_
 
- Protected Attributes inherited from walberla::field::GhostLayerField< T, 1 >
uint_t gl_
 Number of ghost layers. More...
 

Friends

Free Iterator Access functions friend
template<class FT , typename FieldPtrOrIterator >
void addMask (const FieldPtrOrIterator &it, FT mask)
 
template<class FT , typename FieldPtrOrIterator >
void addFlag (const FieldPtrOrIterator &it, FT flag)
 
template<class FT , typename FieldPtrOrIterator >
void removeMask (const FieldPtrOrIterator &it, FT mask)
 
template<class FT , typename FieldPtrOrIterator >
void removeFlag (const FieldPtrOrIterator &it, FT flag)
 
template<class FT , typename FieldPtrOrIterator >
bool isMaskSet (const FieldPtrOrIterator &it, FT mask)
 
template<class FT , typename FieldPtrOrIterator >
bool isFlagSet (const FieldPtrOrIterator &it, FT flag)
 
template<class FT , typename FieldPtrOrIterator >
bool isPartOfMaskSet (const FieldPtrOrIterator &it, FT mask)
 
template<class Stencil , typename FieldPtrOrIterator >
bool isFlagInNeighborhood (const FieldPtrOrIterator &i, typename FieldPtrOrIterator::value_t mask)
 
template<class Stencil , typename FieldPtrOrIterator >
boost::remove_const< typename FieldPtrOrIterator::value_type >::type getOredNeighborhood (const FieldPtrOrIterator &i)
 Ores the neighborhood of the specified stencil and returns mask. More...
 

Access Functions

typedef cell_idx_t idx
 
void addMask (idx x, idx y, idx z, flag_t m)
 
void addFlag (idx x, idx y, idx z, flag_t f)
 
void addMask (const Cell &cell, flag_t m)
 
void addFlag (const Cell &cell, flag_t f)
 
void removeMask (idx x, idx y, idx z, flag_t m)
 
void removeFlag (idx x, idx y, idx z, flag_t f)
 
void removeMask (const Cell &cell, flag_t m)
 
void removeFlag (const Cell &cell, flag_t f)
 
bool isMaskSet (idx x, idx y, idx z, flag_t m) const
 Equivalent to field::isMaskSet() with debug checks. More...
 
bool isFlagSet (idx x, idx y, idx z, flag_t f) const
 Equivalent to field::isFlagSet() with debug checks. More...
 
bool isPartOfMaskSet (idx x, idx y, idx z, flag_t m) const
 Equivalent to field::isPartOfMaskSet() with debug checks. More...
 
bool isMaskSet (const Cell &cell, flag_t m) const
 
bool isFlagSet (const Cell &cell, flag_t f) const
 
bool isPartOfMaskSet (const Cell &cell, flag_t m) const
 
void getCellsWhereMaskIsSet (flag_t mask, CellVector &out) const
 Adds every (inner) cell where at least all bits of mask are set to the CellVector (in inner coordinates) More...
 

Additional Inherited Members

- Static Public Attributes inherited from walberla::field::Field< T, fSize_ >
static const const_iterator staticConstEnd = ForwardFieldIterator<const T,fSize_>()
 Const end iterator, see end() More...
 
static const iterator staticEnd = ForwardFieldIterator<T,fSize_>()
 End iterator, can be used with begin() and beginBlock() More...
 
static const const_reverse_iterator staticConstREnd = ReverseFieldIterator<const T,fSize_>()
 Const end iterator, see end() More...
 
static const reverse_iterator staticREnd = ReverseFieldIterator<T,fSize_>()
 End iterator, can be used with begin() and beginBlock() More...
 
static const uint_t F_SIZE = fSize_
 

Member Typedef Documentation

template<typename T = uint32_t>
typedef Field<T,1>::base_iterator walberla::field::FlagField< T >::base_iterator
template<typename T = uint32_t>
typedef Field<T,1>::const_base_iterator walberla::field::FlagField< T >::const_base_iterator
template<typename T = uint32_t>
typedef GhostLayerField<T,1>::const_iterator walberla::field::FlagField< T >::const_iterator
template<typename T = uint32_t>
typedef GhostLayerField<T,1>::const_reverse_iterator walberla::field::FlagField< T >::const_reverse_iterator
template<typename T = uint32_t>
typedef GhostLayerField<T,1>::ConstPtr walberla::field::FlagField< T >::ConstPtr
template<typename T = uint32_t>
typedef T walberla::field::FlagField< T >::flag_t
template<typename T = uint32_t>
typedef cell_idx_t walberla::field::FlagField< T >::idx
template<typename T = uint32_t>
typedef GhostLayerField<T,1>::iterator walberla::field::FlagField< T >::iterator
template<typename T = uint32_t>
typedef GhostLayerField<T,1>::Ptr walberla::field::FlagField< T >::Ptr
template<typename T = uint32_t>
typedef GhostLayerField<T,1>::reverse_iterator walberla::field::FlagField< T >::reverse_iterator
template<typename T = uint32_t>
typedef GhostLayerField<T,1>::value_type walberla::field::FlagField< T >::value_type

Constructor & Destructor Documentation

template<typename T >
walberla::field::FlagField< T >::FlagField ( uint_t  xs,
uint_t  ys,
uint_t  zs,
uint_t  gl,
const shared_ptr< FieldAllocator< T > > &  alloc = make_shared<StdFieldAlloc<T> >() 
)

Constructor.

Initializes field with 0 (no flags set).

Parameters
xSizesize of x dimension without ghost layers
ySizesize of y dimension without ghost layers
zSizesize of z dimension without ghost layers
glnumber of ghost layers
allocclass that describes how to allocate memory for the field, see FieldAllocator
template<typename T >
walberla::field::FlagField< T >::~FlagField ( )
virtual

Explicitly declared destructor, needed for handling the shallow copied Registration Data.

template<typename T >
walberla::field::FlagField< T >::FlagField ( )
protected

Constructor.

Creates a field without data.

To use this field call GhostLayerField::init()

template<typename T >
walberla::field::FlagField< T >::FlagField ( const FlagField< T > &  other)
protected

Private copy constructor that creates a shallow copy of the data.

Member Function Documentation

template<typename T = uint32_t>
void walberla::field::FlagField< T >::addFlag ( idx  x,
idx  y,
idx  z,
flag_t  f 
)
inline
template<typename T = uint32_t>
void walberla::field::FlagField< T >::addFlag ( const Cell &  cell,
flag_t  f 
)
inline
template<typename T = uint32_t>
void walberla::field::FlagField< T >::addMask ( idx  x,
idx  y,
idx  z,
flag_t  m 
)
inline
template<typename T = uint32_t>
void walberla::field::FlagField< T >::addMask ( const Cell &  cell,
flag_t  m 
)
inline
template<typename T >
FlagField< T > * walberla::field::FlagField< T >::clone ( ) const
inline
template<typename T >
FlagField< T > * walberla::field::FlagField< T >::cloneShallowCopy ( ) const
inline
template<typename T >
Field< T, 1 > * walberla::field::FlagField< T >::cloneShallowCopyInternal ( ) const
protectedvirtual

See Field::cloneShallowCopyInternal() Has to be re-implemented because a new GhostLayerField is created.

Reimplemented from walberla::field::GhostLayerField< T, 1 >.

template<typename T >
FlagField< T > * walberla::field::FlagField< T >::cloneUninitialized ( ) const
inline
template<typename T >
bool walberla::field::FlagField< T >::flagExists ( const FlagUID &  uid) const
inline

Test if flag was already registered.

Parameters
uidUID for the flag
Returns
boolean indicating if flag was already registered
template<typename T >
bool walberla::field::FlagField< T >::flagExists ( uint_t  bitNr) const
inline

Test if flag was already registered.

Parameters
bitNrbit number (not mask!) of the flag
Returns
boolean indicating if flag was already registered
template<typename T >
void walberla::field::FlagField< T >::getAllRegisteredFlags ( std::vector< FlagUID > &  out) const
inline

Appends the string representation of all registered flags at the given vector.

template<typename T >
void walberla::field::FlagField< T >::getCellsWhereMaskIsSet ( flag_t  mask,
CellVector &  cv 
) const
inline

Adds every (inner) cell where at least all bits of mask are set to the CellVector (in inner coordinates)

Parameters
mask[in] bit mask. Test if a cell is added: (content & mask) == true
cv[out] cell vector where the cells are added to, in inner coordinates
template<typename T >
T walberla::field::FlagField< T >::getFlag ( const FlagUID &  uid) const
inline

Returns the flag mask for a given UID.

Parameters
uidUID for the flag
Returns
Mask of this flag.
template<typename T >
const FlagUID & walberla::field::FlagField< T >::getFlagUID ( const flag_t  flag) const
inline

Returns the flag UID for a given mask.

Parameters
flagmask for the flag (only one bit may be set)
Returns
UID of this flag.
template<typename T = uint32_t>
const std::map<FlagUID, flag_t>& walberla::field::FlagField< T >::getMapping ( ) const
inline
template<typename T = uint32_t>
template<typename FlagUIDContainer >
flag_t walberla::field::FlagField< T >::getMask ( const FlagUIDContainer &  uids) const
inline
template<typename T = uint32_t>
template<typename FlagUIDContainer >
T walberla::field::FlagField< T >::getMask ( const FlagUIDContainer &  uids) const

Returns the flag mask for a given container of UIDs.

Parameters
uidscontainer of UIDs for the flag (has to provide begin() and end())
Returns
Mask of this all flags.
template<typename T >
T walberla::field::FlagField< T >::getOrRegisterFlag ( const FlagUID &  uid)
inline

Returns the flag mask for a given UID if already registered, otherwise registers flag.

Parameters
uidUID for the flag
Returns
Mask of this flag.
template<typename T >
FlagField< T > * walberla::field::FlagField< T >::getSlicedField ( const CellInterval &  interval) const
template<typename T >
bool walberla::field::FlagField< T >::isFlagSet ( idx  x,
idx  y,
idx  z,
flag_t  f 
) const

Equivalent to field::isFlagSet() with debug checks.

template<typename T = uint32_t>
bool walberla::field::FlagField< T >::isFlagSet ( const Cell &  cell,
flag_t  f 
) const
inline
template<typename T >
bool walberla::field::FlagField< T >::isMaskSet ( idx  x,
idx  y,
idx  z,
flag_t  m 
) const

Equivalent to field::isMaskSet() with debug checks.

template<typename T = uint32_t>
bool walberla::field::FlagField< T >::isMaskSet ( const Cell &  cell,
flag_t  m 
) const
inline
template<typename T >
bool walberla::field::FlagField< T >::isPartOfMaskSet ( idx  x,
idx  y,
idx  z,
flag_t  m 
) const

Equivalent to field::isPartOfMaskSet() with debug checks.

template<typename T = uint32_t>
bool walberla::field::FlagField< T >::isPartOfMaskSet ( const Cell &  cell,
flag_t  m 
) const
inline
template<typename T >
bool walberla::field::FlagField< T >::isRegistered ( flag_t  mask) const
inline

True, if all bits that are set in the mask have been registered at this FlagField.

template<typename T >
void walberla::field::FlagField< T >::printCell ( std::ostream &  os,
const Cell &  cell 
) const
inline

Prints a list of set flags in the given cell.

Parameters
osoutput stream
cellall set flags of this cell are printed
template<typename T >
void walberla::field::FlagField< T >::printRegistered ( std::ostream &  os) const
inline

Prints a list of "bitNr - flagName".

Parameters
osoutput stream
template<typename T >
T walberla::field::FlagField< T >::registerFlag ( const FlagUID &  uid)
inline

Registers a flag.

Uses the next free bit in the field.

Parameters
uiduid of the flag
Returns
Mask, that has exactly one bit set to one.
template<typename T >
T walberla::field::FlagField< T >::registerFlag ( const FlagUID &  uid,
uint_t  bitNr 
)
inline

Registers a flag and forces it to a given bitNr.

If bitNr is not important use registerFlag(name) which assigns the next free bit to the flag.

Parameters
namestring identifier for the flag
bitNrThe bit nr associated with the flag (NOT the mask!). Has to be smaller than sizeof(flag_type)*8 There exists also a function where this information is not needed, and the next free bit is used.
Returns
Mask, that has the given bit set to one i.e. 1 << bitNr
template<typename T = uint32_t>
void walberla::field::FlagField< T >::removeFlag ( idx  x,
idx  y,
idx  z,
flag_t  f 
)
inline
template<typename T = uint32_t>
void walberla::field::FlagField< T >::removeFlag ( const Cell &  cell,
flag_t  f 
)
inline
template<typename T = uint32_t>
void walberla::field::FlagField< T >::removeMask ( idx  x,
idx  y,
idx  z,
flag_t  m 
)
inline
template<typename T = uint32_t>
void walberla::field::FlagField< T >::removeMask ( const Cell &  cell,
flag_t  m 
)
inline

Friends And Related Function Documentation

template<typename T = uint32_t>
template<class FT , typename FieldPtrOrIterator >
void addFlag ( const FieldPtrOrIterator &  it,
FT  flag 
)
friend
template<typename T = uint32_t>
template<class FT , typename FieldPtrOrIterator >
void addMask ( const FieldPtrOrIterator &  it,
FT  mask 
)
friend
template<typename T = uint32_t>
template<class Stencil , typename FieldPtrOrIterator >
boost::remove_const<typename FieldPtrOrIterator::value_type>::type getOredNeighborhood ( const FieldPtrOrIterator &  i)
friend

Ores the neighborhood of the specified stencil and returns mask.

template<typename T = uint32_t>
template<class Stencil , typename FieldPtrOrIterator >
bool isFlagInNeighborhood ( const FieldPtrOrIterator &  i,
typename FieldPtrOrIterator::value_t  mask 
)
friend
template<typename T = uint32_t>
template<class FT , typename FieldPtrOrIterator >
bool isFlagSet ( const FieldPtrOrIterator &  it,
FT  flag 
)
friend
template<typename T = uint32_t>
template<class FT , typename FieldPtrOrIterator >
bool isMaskSet ( const FieldPtrOrIterator &  it,
FT  mask 
)
friend
template<typename T = uint32_t>
template<class FT , typename FieldPtrOrIterator >
bool isPartOfMaskSet ( const FieldPtrOrIterator &  it,
FT  mask 
)
friend
template<typename T = uint32_t>
template<class FT , typename FieldPtrOrIterator >
void removeFlag ( const FieldPtrOrIterator &  it,
FT  flag 
)
friend
template<typename T = uint32_t>
template<class FT , typename FieldPtrOrIterator >
void removeMask ( const FieldPtrOrIterator &  it,
FT  mask 
)
friend

Member Data Documentation

template<typename T = uint32_t>
RegistrationData* walberla::field::FlagField< T >::data_
protected

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