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
using flag_t = T
 
using value_type = typename GhostLayerField< T, 1 >::value_type
 
using iterator = typename GhostLayerField< T, 1 >::iterator
 
using const_iterator = typename GhostLayerField< T, 1 >::const_iterator
 
using reverse_iterator = typename GhostLayerField< T, 1 >::reverse_iterator
 
using const_reverse_iterator = typename GhostLayerField< T, 1 >::const_reverse_iterator
 
using base_iterator = typename Field< T, 1 >::base_iterator
 
using const_base_iterator = typename Field< T, 1 >::const_base_iterator
 
using Ptr = typename GhostLayerField< T, 1 >::Ptr
 
using ConstPtr = typename GhostLayerField< T, 1 >::ConstPtr
 
- Public Types inherited from walberla::field::GhostLayerField< uint32_t, 1 >
using value_type = typename Field< uint32_t, fSize_ >::value_type
 
using iterator = typename Field< uint32_t, fSize_ >::iterator
 
using const_iterator = typename Field< uint32_t, fSize_ >::const_iterator
 
using reverse_iterator = typename Field< uint32_t, fSize_ >::reverse_iterator
 
using const_reverse_iterator = typename Field< uint32_t, fSize_ >::const_reverse_iterator
 
using base_iterator = typename Field< uint32_t, fSize_ >::base_iterator
 
using const_base_iterator = typename Field< uint32_t, fSize_ >::const_base_iterator
 
using Ptr = typename Field< uint32_t, fSize_ >::Ptr
 
using ConstPtr = typename Field< uint32_t, fSize_ >::ConstPtr
 
using FlattenedField = typename std::conditional< VectorTrait< uint32_t >::F_SIZE !=0, GhostLayerField< typename VectorTrait< uint32_t >::OutputType, VectorTrait< uint32_t >::F_SIZE *fSize_ >, GhostLayerField< uint32_t, fSize_ > >::type
 
- Public Types inherited from walberla::field::Field< uint32_t, fSize_ >
using value_type = uint32_t
 
using iterator = ForwardFieldIterator< uint32_t, fSize_ >
 
using const_iterator = ForwardFieldIterator< const uint32_t, fSize_ >
 
using reverse_iterator = ReverseFieldIterator< uint32_t, fSize_ >
 
using const_reverse_iterator = ReverseFieldIterator< const uint32_t, fSize_ >
 
using base_iterator = FieldIterator< uint32_t, fSize_ >
 
using const_base_iterator = FieldIterator< const uint32_t, fSize_ >
 
using Ptr = FieldPointer< Field< uint32_t, fSize_ >, Field< uint32_t, fSize_ >, uint32_t >
 
using ConstPtr = FieldPointer< Field< uint32_t, fSize_ >, const Field< uint32_t, fSize_ >, const uint32_t >
 
using FlattenedField = typename std::conditional< VectorTrait< uint32_t >::F_SIZE !=0, Field< typename VectorTrait< uint32_t >::OutputType, VectorTrait< uint32_t >::F_SIZE *fSize_ >, Field< uint32_t, fSize_ > >::type
 
using MonitorFunction = std::function< void(cell_idx_t, cell_idx_t, cell_idx_t, cell_idx_t, const uint32_t &)>
 

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...
 
 ~FlagField () override
 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
 
- Public Member Functions inherited from walberla::field::GhostLayerField< uint32_t, 1 >
 GhostLayerField (uint_t xSize, uint_t ySize, uint_t zSize, uint_t gl, const Layout &layout=fzyx, const shared_ptr< FieldAllocator< uint32_t > > &alloc=shared_ptr< FieldAllocator< uint32_t > >())
 Creates an uninitialized field of given size. More...
 
 GhostLayerField (uint_t xSize, uint_t ySize, uint_t zSize, uint_t gl, const uint32_t &initValue, const Layout &layout=fzyx, const shared_ptr< FieldAllocator< uint32_t > > &alloc=shared_ptr< FieldAllocator< uint32_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< uint32_t > &fValues, const Layout &layout=fzyx, const shared_ptr< FieldAllocator< uint32_t > > &alloc=shared_ptr< FieldAllocator< uint32_t > >())
 Creates a field and initializes f coordinate with vector values. More...
 
 ~GhostLayerField () override=default
 
void init (uint_t xSizeWithoutGhostLayer, uint_t ySizeWithoutGhostLayer, uint_t zSizeWithoutGhostLayer, uint_t nrGhostLayers, const Layout &layout=fzyx, const shared_ptr< FieldAllocator< uint32_t > > &alloc=shared_ptr< FieldAllocator< uint32_t > >())
 Initializes a field, must be called exactly once. More...
 
void resize (uint_t xSize, uint_t ySize, uint_t zSize) override
 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< uint32_t, fSize_ > * clone () const
 
GhostLayerField< uint32_t, fSize_ > * cloneUninitialized () const
 
GhostLayerField< uint32_t, fSize_ > * cloneShallowCopy () const
 
FlattenedFieldflattenedShallowCopy () 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 uint32_t &value)
 Sets all entries (including the ghost layer) of the field to given value. More...
 
void setWithGhostLayer (const std::vector< uint32_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
 
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
 
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
 
reverse_iterator rbeginWithGhostLayerXYZ ()
 Iterates only over all cells including ghost layers of XYZ coordinate, f is always 0. More...
 
const_reverse_iterator rbeginWithGhostLayerXYZ () const
 
GhostLayerField< uint32_t, fSize_ > * getSlicedField (const CellInterval &interval) const
 
void slice (const CellInterval &interval) override
 Changes the coordinate system of the field. More...
 
void shiftCoordinates (cell_idx_t cx, cell_idx_t cy, cell_idx_t cz) override
 
uint8_t advanceTimestep ()
 
uint8_t getTimestep () const
 
uint8_t getTimestepPlusOne () const
 
bool isEvenTimeStep () const
 
- Public Member Functions inherited from walberla::field::Field< uint32_t, fSize_ >
 Field (uint_t xSize, uint_t ySize, uint_t zSize, const Layout &layout=fzyx, const shared_ptr< FieldAllocator< uint32_t > > &alloc=shared_ptr< FieldAllocator< uint32_t > >())
 Creates an uninitialized field of given size. More...
 
 Field (uint_t xSize, uint_t ySize, uint_t zSize, const uint32_t &initValue, const Layout &layout=fzyx, const shared_ptr< FieldAllocator< uint32_t > > &alloc=shared_ptr< FieldAllocator< uint32_t > >())
 Creates a field and initializes it with constant. More...
 
 Field (uint_t xSize, uint_t ySize, uint_t zSize, const std::vector< uint32_t > &fValues, const Layout &layout=fzyx, const shared_ptr< FieldAllocator< uint32_t > > &alloc=shared_ptr< FieldAllocator< uint32_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=fzyx, shared_ptr< FieldAllocator< uint32_t > > alloc=shared_ptr< FieldAllocator< uint32_t > >(), uint_t innerGhostLayerSizeForAlignedAlloc=0)
 Initializes the field with a given size, in a given layout. More...
 
Field< uint32_t, fSize_ > * clone () const
 Returns a deep copy of the current field. More...
 
Field< uint32_t, fSize_ > * cloneUninitialized () const
 Creates a new field that has equal size and layout as this field. More...
 
Field< uint32_t, fSize_ > * cloneShallowCopy () const
 Returns a shallow copy of the current field. More...
 
FlattenedFieldflattenedShallowCopy () const
 Returns a flattened shallow copy of the current field. More...
 
uint32_tget (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 uint32_tget (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...
 
uint32_tget (cell_idx_t x, cell_idx_t y, cell_idx_t z, cell_idx_t f)
 Non-Const variant of get() More...
 
const uint32_tget (cell_idx_t x, cell_idx_t y, cell_idx_t z, cell_idx_t f) const
 Accesses the value at given coordinate. More...
 
uint32_tget (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 uint32_tget (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...
 
uint32_tget (const Cell &cell)
 get overload using a cell as input, only possible if fSize=1 More...
 
const uint32_tget (const Cell &cell) const
 get overload using a cell as input, only possible if fSize=1 More...
 
uint32_tget (const Cell &c, cell_idx_t f)
 
const uint32_tget (const Cell &c, cell_idx_t f) const
 
uint32_tget (const Cell &c, uint_t f)
 
const uint32_tget (const Cell &c, uint_t f) const
 
uint32_tget (const base_iterator &iter)
 get overload, where position is specified using an iterator of another field with equal size More...
 
const uint32_tget (const base_iterator &iter) const
 get overload, where position is specified using an iterator of another field with equal size More...
 
uint32_toperator() (cell_idx_t x, cell_idx_t y, cell_idx_t z)
 
const uint32_toperator() (cell_idx_t x, cell_idx_t y, cell_idx_t z) const
 
uint32_toperator() (cell_idx_t x, cell_idx_t y, cell_idx_t z, cell_idx_t f)
 
const uint32_toperator() (cell_idx_t x, cell_idx_t y, cell_idx_t z, cell_idx_t f) const
 
uint32_toperator() (cell_idx_t x, cell_idx_t y, cell_idx_t z, uint_t f)
 
const uint32_toperator() (cell_idx_t x, cell_idx_t y, cell_idx_t z, uint_t f) const
 
uint32_toperator() (const Cell &cell)
 
const uint32_toperator() (const Cell &cell) const
 
uint32_toperator() (const Cell &cell, cell_idx_t f)
 
const uint32_toperator() (const Cell &cell, cell_idx_t f) const
 
uint32_toperator() (const Cell &cell, uint_t f)
 
const uint32_toperator() (const Cell &cell, uint_t f) const
 
uint32_toperator() (const base_iterator &iter)
 
const uint32_toperator() (const base_iterator &iter) const
 
uint32_tgetNeighbor (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 uint32_tgetNeighbor (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...
 
uint32_tgetNeighbor (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 uint32_tgetNeighbor (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...
 
uint32_tgetNeighbor (const Cell &cell, stencil::Direction d)
 get overload using a cell as input, only possible if fSize=1, with neighbor access More...
 
const uint32_tgetNeighbor (const Cell &cell, stencil::Direction d) const
 get overload using a cell as input, only possible if fSize=1, with neighbor access More...
 
uint32_tgetF (uint32_t *const xyz0, const cell_idx_t f)
 
const uint32_tgetF (const uint32_t *const xyz0, const cell_idx_t f) const
 
uint32_tgetF (uint32_t *const xyz0, const uint_t f)
 
const uint32_tgetF (const uint32_t *const xyz0, const uint_t f) const
 
void set (const uint32_t &value)
 Sets all entries of the field to given value. More...
 
void set (const std::vector< uint32_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< uint32_t, fSize_ > &other)
 Copies all entries of the given field to this field. More...
 
void set (const Field< uint32_t, fSize_ > *other)
 
void swapDataPointers (Field< uint32_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< uint32_t, fSize_ > *other)
 
bool operator== (const Field< uint32_t, fSize_ > &other) const
 Equality operator compares element-wise. More...
 
bool operator!= (const Field< uint32_t, fSize_ > &other) const
 Inequality operator compares element-wise. More...
 
bool hasSameAllocSize (const Field< uint32_t, fSize_ > &other) const
 True if allocation sizes of all dimensions match. More...
 
bool hasSameSize (const Field< uint32_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
 
iterator beginXYZ ()
 Iterates only over XYZ coordinate, f is always 0. More...
 
const_iterator beginXYZ () 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)
 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
 
reverse_iterator rbeginXYZ ()
 Iterates only over XYZ coordinate, f is always 0. More...
 
const_reverse_iterator rbeginXYZ () const
 
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
 
int64_t xStride () const
 
int64_t yStride () const
 
int64_t zStride () const
 
int64_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< uint32_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...
 
uint32_tdata ()
 
const uint32_tdata () const
 
uint32_tdataAt (cell_idx_t x, cell_idx_t y, cell_idx_t z, cell_idx_t f)
 
const uint32_tdataAt (cell_idx_t x, cell_idx_t y, cell_idx_t z, cell_idx_t f) const
 
uint32_tdataInner ()
 
const uint32_tdataInner () const
 
shared_ptr< FieldAllocator< uint32_t > > getAllocator () const
 Returns internal data allocator. More...
 
void addMonitoringFunction (const MonitorFunction &func)
 Registers a monitoring function. 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 >
std::remove_const< typename FieldPtrOrIterator::value_type >::type getOredNeighborhood (const FieldPtrOrIterator &i)
 Ores the neighborhood of the specified stencil and returns mask. More...
 
- Friends inherited from walberla::field::GhostLayerField< uint32_t, 1 >
- Friends inherited from walberla::field::Field< uint32_t, fSize_ >

Access Functions

using idx = cell_idx_t
 
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...
 

Slicing

FlagField< T > * getSlicedField (const CellInterval &interval) const
 
 FlagField ()
 Constructor. More...
 

Shallow Copy

RegistrationDatadata_
 
 FlagField (const FlagField< T > &other)
 Private copy constructor that creates a shallow copy of the data. More...
 
Field< T, 1 > * cloneShallowCopyInternal () const override
 

Additional Inherited Members

- Static Public Attributes inherited from walberla::field::Field< uint32_t, fSize_ >
static const uint_t F_SIZE
 
static const const_iterator staticConstEnd
 Const end iterator, see end() More...
 
static const iterator staticEnd
 End iterator, can be used with begin() and beginBlock() More...
 
static const const_reverse_iterator staticConstREnd
 Const end iterator, see end() More...
 
static const reverse_iterator staticREnd
 End iterator, can be used with begin() and beginBlock() More...
 
- Protected Member Functions inherited from walberla::field::GhostLayerField< uint32_t, 1 >
 GhostLayerField ()
 Creates a field of zero size. More...
 
 GhostLayerField (const GhostLayerField< uint32_t, fSize_ > &other)
 Private copy constructor, which does a shallow copy. More...
 
 GhostLayerField (const GhostLayerField< T2, fSize2 > &other)
 Private copy constructor, which does a flattened shallow copy. More...
 
Field< uint32_t, fSize_ > * cloneShallowCopyInternal () const override
 See Field::cloneShallowCopyInternal() Has to be re-implemented because a new GhostLayerField is created. More...
 
Field< uint32_t, fSize_ >::FlattenedFieldflattenedShallowCopyInternal () const override
 See Field::flattenedShallowCopyInternal() Has to be re-implemented because a new GhostLayerField is created. More...
 
- Protected Member Functions inherited from walberla::field::Field< uint32_t, fSize_ >
 Field (const Field &other)
 Private copy constructor that creates a shallow copy i.e. More...
 
 Field (const Field< T2, fSize2 > &other)
 Private copy constructor that creates a flattened shallow copy i.e. More...
 
virtual uint_t referenceCount () const
 Returns the number of objects that internally use the same data. More...
 
 Field ()
 Creates an uninitialized field of size zero (no allocated memory) 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< uint32_t > > allocator () const
 
bool addressInsideAllocedSpace (const uint32_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 inherited from walberla::field::GhostLayerField< uint32_t, 1 >
uint_t gl_
 Number of ghost layers. More...
 
uint8_t timestepCounter_
 

Member Typedef Documentation

◆ base_iterator

template<typename T = uint32_t>
using walberla::field::FlagField< T >::base_iterator = typename Field<T, 1>::base_iterator

◆ const_base_iterator

template<typename T = uint32_t>
using walberla::field::FlagField< T >::const_base_iterator = typename Field<T, 1>::const_base_iterator

◆ const_iterator

template<typename T = uint32_t>
using walberla::field::FlagField< T >::const_iterator = typename GhostLayerField<T, 1>::const_iterator

◆ const_reverse_iterator

template<typename T = uint32_t>
using walberla::field::FlagField< T >::const_reverse_iterator = typename GhostLayerField<T, 1>::const_reverse_iterator

◆ ConstPtr

template<typename T = uint32_t>
using walberla::field::FlagField< T >::ConstPtr = typename GhostLayerField<T, 1>::ConstPtr

◆ flag_t

template<typename T = uint32_t>
using walberla::field::FlagField< T >::flag_t = T

◆ idx

template<typename T = uint32_t>
using walberla::field::FlagField< T >::idx = cell_idx_t

◆ iterator

template<typename T = uint32_t>
using walberla::field::FlagField< T >::iterator = typename GhostLayerField<T, 1>::iterator

◆ Ptr

template<typename T = uint32_t>
using walberla::field::FlagField< T >::Ptr = typename GhostLayerField<T, 1>::Ptr

◆ reverse_iterator

template<typename T = uint32_t>
using walberla::field::FlagField< T >::reverse_iterator = typename GhostLayerField<T, 1>::reverse_iterator

◆ value_type

template<typename T = uint32_t>
using walberla::field::FlagField< T >::value_type = typename GhostLayerField<T, 1>::value_type

Constructor & Destructor Documentation

◆ FlagField() [1/3]

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
xssize of x dimension without ghost layers
yssize of y dimension without ghost layers
zssize of z dimension without ghost layers
glnumber of ghost layers
allocclass that describes how to allocate memory for the field, see FieldAllocator

◆ ~FlagField()

template<typename T >
walberla::field::FlagField< T >::~FlagField
override

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

◆ FlagField() [2/3]

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

Constructor.

Creates a field without data.

To use this field call GhostLayerField::init()

◆ FlagField() [3/3]

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

◆ addFlag() [1/2]

template<typename T = uint32_t>
void walberla::field::FlagField< T >::addFlag ( const Cell cell,
flag_t  f 
)
inline

◆ addFlag() [2/2]

template<typename T = uint32_t>
void walberla::field::FlagField< T >::addFlag ( idx  x,
idx  y,
idx  z,
flag_t  f 
)
inline

◆ addMask() [1/2]

template<typename T = uint32_t>
void walberla::field::FlagField< T >::addMask ( const Cell cell,
flag_t  m 
)
inline

◆ addMask() [2/2]

template<typename T = uint32_t>
void walberla::field::FlagField< T >::addMask ( idx  x,
idx  y,
idx  z,
flag_t  m 
)
inline

◆ clone()

template<typename T >
FlagField< T > * walberla::field::FlagField< T >::clone
inline

◆ cloneShallowCopy()

template<typename T >
FlagField< T > * walberla::field::FlagField< T >::cloneShallowCopy
inline

◆ cloneShallowCopyInternal()

template<typename T >
Field< T, 1 > * walberla::field::FlagField< T >::cloneShallowCopyInternal
overrideprotected

◆ cloneUninitialized()

template<typename T >
FlagField< T > * walberla::field::FlagField< T >::cloneUninitialized
inline

◆ flagExists() [1/2]

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

◆ flagExists() [2/2]

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

◆ getAllRegisteredFlags()

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.

◆ getCellsWhereMaskIsSet()

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
[in]maskbit mask. Test if a cell is added: (content & mask) == true
[out]cvcell vector where the cells are added to, in inner coordinates

◆ getFlag()

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.

◆ getFlagUID()

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.

◆ getMapping()

template<typename T = uint32_t>
const std::map<FlagUID, flag_t>& walberla::field::FlagField< T >::getMapping ( ) const
inline

◆ getMask() [1/2]

template<typename T = uint32_t>
template<typename FlagUIDContainer >
flag_t walberla::field::FlagField< T >::getMask ( const FlagUIDContainer &  uids) const
inline

◆ getMask() [2/2]

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.

◆ getOrRegisterFlag()

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.

◆ getSlicedField()

template<typename T >
FlagField< T > * walberla::field::FlagField< T >::getSlicedField ( const CellInterval interval) const

◆ isFlagSet() [1/2]

template<typename T = uint32_t>
bool walberla::field::FlagField< T >::isFlagSet ( const Cell cell,
flag_t  f 
) const
inline

◆ isFlagSet() [2/2]

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.

◆ isMaskSet() [1/2]

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

◆ isMaskSet() [2/2]

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.

◆ isPartOfMaskSet() [1/2]

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

◆ isPartOfMaskSet() [2/2]

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.

◆ isRegistered()

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.

◆ printCell()

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

◆ printRegistered()

template<typename T >
void walberla::field::FlagField< T >::printRegistered ( std::ostream &  os) const
inline

Prints a list of "bitNr - flagName".

Parameters
osoutput stream

◆ registerFlag() [1/2]

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 for the flag
Returns
Mask, that has exactly one bit set to one.

◆ registerFlag() [2/2]

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
uidUID 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

◆ removeFlag() [1/2]

template<typename T = uint32_t>
void walberla::field::FlagField< T >::removeFlag ( const Cell cell,
flag_t  f 
)
inline

◆ removeFlag() [2/2]

template<typename T = uint32_t>
void walberla::field::FlagField< T >::removeFlag ( idx  x,
idx  y,
idx  z,
flag_t  f 
)
inline

◆ removeMask() [1/2]

template<typename T = uint32_t>
void walberla::field::FlagField< T >::removeMask ( const Cell cell,
flag_t  m 
)
inline

◆ removeMask() [2/2]

template<typename T = uint32_t>
void walberla::field::FlagField< T >::removeMask ( idx  x,
idx  y,
idx  z,
flag_t  m 
)
inline

Friends And Related Function Documentation

◆ addFlag

template<typename T = uint32_t>
template<class FT , typename FieldPtrOrIterator >
void addFlag ( const FieldPtrOrIterator &  it,
FT  flag 
)
friend

◆ addMask

template<typename T = uint32_t>
template<class FT , typename FieldPtrOrIterator >
void addMask ( const FieldPtrOrIterator &  it,
FT  mask 
)
friend

◆ getOredNeighborhood

template<typename T = uint32_t>
template<class Stencil , typename FieldPtrOrIterator >
std::remove_const<typename FieldPtrOrIterator::value_type>::type getOredNeighborhood ( const FieldPtrOrIterator &  i)
friend

Ores the neighborhood of the specified stencil and returns mask.

Parameters
[in]ifield pointer.

◆ isFlagInNeighborhood

template<typename T = uint32_t>
template<class Stencil , typename FieldPtrOrIterator >
bool isFlagInNeighborhood ( const FieldPtrOrIterator &  i,
typename FieldPtrOrIterator::value_t  mask 
)
friend

◆ isFlagSet

template<typename T = uint32_t>
template<class FT , typename FieldPtrOrIterator >
bool isFlagSet ( const FieldPtrOrIterator &  it,
FT  flag 
)
friend

◆ isMaskSet

template<typename T = uint32_t>
template<class FT , typename FieldPtrOrIterator >
bool isMaskSet ( const FieldPtrOrIterator &  it,
FT  mask 
)
friend

◆ isPartOfMaskSet

template<typename T = uint32_t>
template<class FT , typename FieldPtrOrIterator >
bool isPartOfMaskSet ( const FieldPtrOrIterator &  it,
FT  mask 
)
friend

◆ removeFlag

template<typename T = uint32_t>
template<class FT , typename FieldPtrOrIterator >
void removeFlag ( const FieldPtrOrIterator &  it,
FT  flag 
)
friend

◆ removeMask

template<typename T = uint32_t>
template<class FT , typename FieldPtrOrIterator >
void removeMask ( const FieldPtrOrIterator &  it,
FT  mask 
)
friend

Member Data Documentation

◆ data_

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

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