waLBerla 7.3
Loading...
Searching...
No Matches
FlagFunctions.h File Reference

Detailed Description

Bit operations on integer data types.

Author
Martin Bauer marti.nosp@m.n.ba.nosp@m.uer@f.nosp@m.au.d.nosp@m.e
#include "core/DataTypes.h"
#include "core/debug/Debug.h"

Namespaces

namespace  walberla
 Storage for detected contacts which can be used to perform actions for all contacts, e.g.
namespace  walberla::field

Functions

template<typename T, typename FieldPtrOrIterator>
void walberla::addMask (const FieldPtrOrIterator &it, T mask)
template<class T, typename FieldPtrOrIterator>
void walberla::removeMask (const FieldPtrOrIterator &it, T mask)
template<class T, typename FieldPtrOrIterator>
bool walberla::isMaskSet (const FieldPtrOrIterator &it, T mask)
template<class T, typename FieldPtrOrIterator>
bool walberla::isPartOfMaskSet (const FieldPtrOrIterator &it, T mask)
template<typename T, typename FieldPtrOrIterator>
void walberla::addFlag (const FieldPtrOrIterator &it, T flag)
template<class T, typename FieldPtrOrIterator>
void walberla::removeFlag (const FieldPtrOrIterator &it, T flag)
template<class T, typename FieldPtrOrIterator>
bool walberla::isFlagSet (const FieldPtrOrIterator &it, T flag)
Operations on bit-masks
template<class T>
void walberla::field::addMask (T &val, T mask)
template<class T>
void walberla::field::removeMask (T &val, T mask)
template<class T>
bool walberla::field::isMaskSet (const T &val, T mask)
template<class T>
bool walberla::field::isPartOfMaskSet (const T &val, T mask)

Operations on bit-masks using flags

Flag is defined as a mask, where exactly one bit is set.

This restriction is enforced in debug mode using asserts. In release mode the following functions are equivalent to their Mask variants.

#define F_MSG   "Second parameter f=" << f << " has to be a flag (only one bit is 1)"
template<class T>
bool walberla::field::isFlag (T f)
template<class T>
void walberla::field::addFlag (T &v, T f)
template<class T>
void walberla::field::removeFlag (T &v, T f)
template<class T>
bool walberla::field::isFlagSet (const T &v, T f)

Macro Definition Documentation

◆ F_MSG

#define F_MSG   "Second parameter f=" << f << " has to be a flag (only one bit is 1)"