/*------------------------------- phasicFlow --------------------------------- O C enter of O O E ngineering and O O M ultiscale modeling of OOOOOOO F luid flow ------------------------------------------------------------------------------ Copyright (C): www.cemf.ir email: hamid.r.norouzi AT gmail.com ------------------------------------------------------------------------------ Licence: This file is part of phasicFlow code. It is a free software for simulating granular and multiphase flows. You can redistribute it and/or modify it under the terms of GNU General Public License v3 or any other later versions. phasicFlow is distributed to help others in their research in the field of granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -----------------------------------------------------------------------------*/ #ifndef __IncludeMask_hpp__ #define __IncludeMask_hpp__ #include "includeMask.hpp" namespace pFlow { template struct greaterThanOp { TypeInfoNV("greaterThan"); inline bool operator()(const T &compVal, const T &val) const { return val > compVal; } }; template struct greaterThanEqOp { TypeInfoNV("greaterThanEq"); inline bool operator()(const T &compVal, const T &val) const { return val >= compVal; } }; template struct lessThanOp { TypeInfoNV("lessThan"); inline bool operator()(const T &compVal, const T &val) const { return val < compVal; } }; template struct lessThanEqOp { TypeInfoNV("lessThanEq"); inline bool operator()(const T &compVal, const T &val) const { return val <= compVal; } }; template struct equalOp { TypeInfoNV("equal"); inline bool operator()(const T &compVal, const T &val) const { return equal(val , compVal); } }; template struct betweenOp { TypeInfoNV("between"); inline bool operator()(const T &compVal1, const T &compVal2 ,const T &val) const { return val>compVal1 && val struct betweenEqOp { TypeInfoNV("betweenEq"); inline bool operator()(const T &compVal1, const T &compVal2 ,const T &val) const { return val>=compVal1 && val<=compVal2; } }; template struct allOp { TypeInfoNV("all"); inline bool operator()() const {return true; } }; template class Operator> class compareOne { public: using opertorType = Operator; protected: T compValue_{}; opertorType operator_{}; public: TypeInfoNV(Operator::TYPENAME()); compareOne(const dictionary& dict) : compValue_(dict.getVal("value")) {} bool operator()(const T& value)const { return operator_(compValue_, value); } }; template class Operator> class compareTwo { public: using opertorType = Operator; protected: T compValue1_; T compValue2_; opertorType operator_{}; public: TypeInfoNV(opertorType::TYPENAME()); compareTwo(const dictionary& dict) : compValue1_(dict.getVal("value1")), compValue2_(dict.getVal("value2")) {} bool operator()(const T& value)const { return operator_(compValue1_, compValue2_, value); } }; template class compareZero { protected: Operator operator_{}; public: TypeInfoNV(Operator::TYPENAME()); compareZero(const dictionary& dict); bool operator()(const T& value) const { return operator_(); } }; template class IncludeMask : public includeMask { protected: Operator operator_; uniquePtr> fieldPtr_; hostViewType1D field_; public: TypeInfoTemplate12("IncludeMask", T, Operator); IncludeMask( const dictionary& dict, const word& opType, readFromTimeFolder& timeFolder) : includeMask(dict, opType, timeFolder), operator_(dict), fieldPtr_(timeFolder.readPointField_H(this->fieldName())), field_(fieldPtr_().hostView()) { } add_vCtor( includeMask, IncludeMask, dictionary); bool isIncluded(int32 n)const override { return operator_(field_[n]); } uint32 size()const override { return field_.size(); } }; template class IncludeMask> : public includeMask { public: TypeInfoTemplate12("IncludeMask", T, allOp); IncludeMask( const dictionary& dict, const word& opType, readFromTimeFolder& timeFolder) : includeMask(dict, opType, timeFolder) {} add_vCtor( includeMask, IncludeMask, dictionary); bool isIncluded(int32 n)const override { return true; } uint32 size()const override { return 0; } }; } // pFlow #endif //__IncludeMask_hpp__