# PhasicFlow: utilities/postprocessPhasicFlow/IncludeMask.hpp Source File

IncludeMask.hpp
Go to the documentation of this file.
/*------------------------------- 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<typename T>
struct greaterThanOp
{
TypeInfoNV("greaterThan");
inline
bool operator()(const T &compVal, const T &val) const {
return val > compVal; }
};
template<typename T>
struct greaterThanEqOp
{
TypeInfoNV("greaterThanEq");
inline
bool operator()(const T &compVal, const T &val) const {
return val >= compVal; }
};
template<typename T>
struct lessThanOp
{
TypeInfoNV("lessThan");
inline
bool operator()(const T &compVal, const T &val) const {
return val < compVal; }
};
template<typename T>
struct lessThanEqOp
{
TypeInfoNV("lessThanEq");
inline
bool operator()(const T &compVal, const T &val) const {
return val <= compVal; }
};
template<typename T>
struct equalOp
{
TypeInfoNV("equal");
inline
bool operator()(const T &compVal, const T &val) const {
return equal(val , compVal); }
};
template<typename T>
struct betweenOp
{
TypeInfoNV("between");
inline
bool operator()(const T &compVal1, const T &compVal2 ,const T &val) const {
return val>compVal1 && val<compVal2; }
};
template<typename T>
struct betweenEqOp
{
TypeInfoNV("betweenEq");
inline
bool operator()(const T &compVal1, const T &compVal2 ,const T &val) const {
return val>=compVal1 && val<=compVal2; }
};
template<typename T>
struct allOp
{
TypeInfoNV("all");
inline
bool operator()() const {return true; }
};
template<typename T, template<class> class Operator>
class compareOne
{
public:
using opertorType = Operator<T>;
protected:
T compValue_{};
opertorType operator_{};
public:
TypeInfoNV(Operator<T>::TYPENAME());
compareOne(const dictionary& dict)
:
compValue_(dict.getVal<T>("value"))
{}
bool operator()(const T& value)const
{
return operator_(compValue_, value);
}
};
template<typename T, template<class> class Operator>
class compareTwo
{
public:
using opertorType = Operator<T>;
protected:
T compValue1_;
T compValue2_;
opertorType operator_{};
public:
TypeInfoNV(opertorType::TYPENAME());
compareTwo(const dictionary& dict)
:
compValue1_(dict.getVal<T>("value1")),
compValue2_(dict.getVal<T>("value2"))
{}
bool operator()(const T& value)const
{
return operator_(compValue1_, compValue2_, value);
}
};
template<typename T, typename Operator>
class compareZero
{
protected:
Operator operator_{};
public:
TypeInfoNV(Operator::TYPENAME());
compareZero(const dictionary& dict);
bool operator()(const T& value) const
{
return operator_();
}
};
template<typename T, typename Operator>
class IncludeMask
:
public includeMask
{
protected:
Operator operator_;
pointField_H<T> field_;
public:
TypeInfoTemplate2("IncludeMask", T, Operator);
IncludeMask(
const dictionary& dict,
const word& opType,
readFromTimeFolder& timeFolder)
:
includeMask(dict, opType, timeFolder),
operator_(dict),
field_(timeFolder.readPointField_H<T>(this->fieldName()))
{}
add_vCtor(
includeMask,
IncludeMask,
dictionary);
bool isIncluded(int32 n)const override
{
return operator_(field_[n]);
}
};
template<typename T>
class IncludeMask<T,allOp<T>>
:
public includeMask
{
public:
TypeInfoTemplate2("IncludeMask", T, allOp<int8>);
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;
}
};
} // pFlow
#endif //__IncludeMask_hpp__
pFlow::lessThanOp::operator()
bool operator()(const T &compVal, const T &val) const
Definition: IncludeMask.hpp:57
pFlow::equalOp::TypeInfoNV
TypeInfoNV("equal")
includeMask.hpp
pFlow::IncludeMask::IncludeMask
IncludeMask(const dictionary &dict, const word &opType, readFromTimeFolder &timeFolder)
Definition: IncludeMask.hpp:195
pFlow::lessThanOp
Definition: IncludeMask.hpp:52
pFlow::compareOne::opertorType
Operator< T > opertorType
Definition: IncludeMask.hpp:119
pFlow::compareTwo::compValue1_
T compValue1_
Definition: IncludeMask.hpp:145
pFlow::readFromTimeFolder
Definition: readFromTimeFolder.hpp:31
pFlow::betweenOp
Definition: IncludeMask.hpp:83
pFlow::betweenOp::operator()
bool operator()(const T &compVal1, const T &compVal2, const T &val) const
Definition: IncludeMask.hpp:88
pFlow::IncludeMask::isIncluded
bool isIncluded(int32 n) const override
Definition: IncludeMask.hpp:210
pFlow::greaterThanEqOp::TypeInfoNV
TypeInfoNV("greaterThanEq")
pFlow::word
std::string word
Definition: builtinTypes.hpp:63
pFlow::greaterThanOp
Definition: IncludeMask.hpp:32
pFlow::compareOne
Definition: IncludeMask.hpp:115
pFlow::includeMask
Definition: includeMask.hpp:33
pFlow::lessThanOp::TypeInfoNV
TypeInfoNV("lessThan")
pFlow::compareTwo
Definition: IncludeMask.hpp:140
pFlow::betweenOp::TypeInfoNV
TypeInfoNV("between")
pFlow::lessThanEqOp::TypeInfoNV
TypeInfoNV("lessThanEq")
pFlow
Definition: demComponent.hpp:28
pFlow::greaterThanOp::TypeInfoNV
TypeInfoNV("greaterThan")
pFlow::compareTwo::compValue2_
T compValue2_
Definition: IncludeMask.hpp:146
pFlow::IncludeMask< T, allOp< T > >::isIncluded
bool isIncluded(int32 n) const override
Definition: IncludeMask.hpp:239
pFlow::IncludeMask
Definition: IncludeMask.hpp:181
pFlow::pointField
Definition: pointField.hpp:35
pFlow::allOp::operator()
bool operator()() const
Definition: IncludeMask.hpp:109
pFlow::compareTwo::operator_
opertorType operator_
Definition: IncludeMask.hpp:147
pFlow::compareTwo::operator()
bool operator()(const T &value) const
Definition: IncludeMask.hpp:158
n
int32 n
Definition: NBSCrossLoop.hpp:24
pFlow::IncludeMask::operator_
Operator operator_
Definition: IncludeMask.hpp:187
pFlow::lessThanEqOp
Definition: IncludeMask.hpp:62
pFlow::int32
int int32
Definition: builtinTypes.hpp:53
pFlow::compareOne::compValue_
T compValue_
Definition: IncludeMask.hpp:122
pFlow::IncludeMask< T, allOp< T > >::IncludeMask
IncludeMask(const dictionary &dict, const word &opType, readFromTimeFolder &timeFolder)
Definition: IncludeMask.hpp:226
pFlow::compareOne::operator_
opertorType operator_
Definition: IncludeMask.hpp:123
pFlow::IncludeMask::add_vCtor
add_vCtor(includeMask, IncludeMask, dictionary)
pFlow::lessThanEqOp::operator()
bool operator()(const T &compVal, const T &val) const
Definition: IncludeMask.hpp:67
pFlow::equalOp::operator()
bool operator()(const T &compVal, const T &val) const
Definition: IncludeMask.hpp:77
pFlow::compareZero::TypeInfoNV
TypeInfoNV(Operator::TYPENAME())
pFlow::allOp
Definition: IncludeMask.hpp:104
pFlow::compareZero::operator_
Operator operator_
Definition: IncludeMask.hpp:168
pFlow::betweenEqOp
Definition: IncludeMask.hpp:94
pFlow::allOp::TypeInfoNV
TypeInfoNV("all")
pFlow::compareZero::compareZero
compareZero(const dictionary &dict)
pFlow::IncludeMask::TypeInfoTemplate2
TypeInfoTemplate2("IncludeMask", T, Operator)
pFlow::greaterThanEqOp::operator()
bool operator()(const T &compVal, const T &val) const
Definition: IncludeMask.hpp:47
pFlow::greaterThanEqOp
Definition: IncludeMask.hpp:42
pFlow::IncludeMask::field_
pointField_H< T > field_
Definition: IncludeMask.hpp:189
pFlow::greaterThanOp::operator()
bool operator()(const T &compVal, const T &val) const
Definition: IncludeMask.hpp:37
pFlow::compareTwo::opertorType
Operator< T > opertorType
Definition: IncludeMask.hpp:143
pFlow::compareOne::operator()
bool operator()(const T &value) const
Definition: IncludeMask.hpp:133
pFlow::equalOp
Definition: IncludeMask.hpp:72
pFlow::betweenEqOp::operator()
bool operator()(const T &compVal1, const T &compVal2, const T &val) const
Definition: IncludeMask.hpp:99
pFlow::compareTwo::compareTwo
compareTwo(const dictionary &dict)
Definition: IncludeMask.hpp:152
pFlow::compareOne::TypeInfoNV
TypeInfoNV(Operator< T >::TYPENAME())
pFlow::betweenEqOp::TypeInfoNV
TypeInfoNV("betweenEq")
pFlow::compareTwo::TypeInfoNV
TypeInfoNV(opertorType::TYPENAME())
pFlow::includeMask::fieldName
word fieldName() const
Definition: includeMask.hpp:66
pFlow::compareOne::compareOne
compareOne(const dictionary &dict)
Definition: IncludeMask.hpp:128
pFlow::equal
INLINE_FUNCTION_HD bool equal(const real &s1, const real &s2)
Definition: bTypesFunctions.hpp:188
pFlow::dictionary
Definition: dictionary.hpp:38
pFlow::compareZero
Definition: IncludeMask.hpp:165
pFlow::timeFolder
Definition: timeFolder.hpp:32
pFlow::compareZero::operator()
bool operator()(const T &value) const
Definition: IncludeMask.hpp:174