Added ifEqEqAssignFirstOp into ops.H

Basically compares the two values and if they are not equal, assigns default
value to the first argument. Needed for syncing processor data in
polyhedralRefinement.
This commit is contained in:
Vuko Vukcevic 2018-01-16 15:00:12 +01:00
parent d138fb9162
commit 912d801aa9

View file

@ -377,6 +377,20 @@ template<class T>
class greaterEqOp
{ public: T operator()(const T& x, const T& y) const { return x >= y; } };
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class T, int defaultValue>
class ifEqEqAssignFirstOp
{
public:
void operator()(T& x, const T& y) const
{
x = (x == y) ? x : defaultValue;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam