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:
parent
d138fb9162
commit
912d801aa9
1 changed files with 14 additions and 0 deletions
|
@ -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
|
||||
|
|
Reference in a new issue