Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
scalars Class Reference

A list of unary predicates (tests) on scalars. Includes a number of standard comparison predicates (eg, "less", "greater", ...) More...

Inheritance diagram for scalars:
Inheritance graph
[legend]
Collaboration diagram for scalars:
Collaboration graph
[legend]

Public Types

enum  opType {
  EQUAL, NOT_EQUAL, LESS, LESS_EQ,
  GREATER, GREATER_EQ, ALWAYS, NEVER
}
 
typedef std::function< bool(Foam::scalar)> unary
 
- Public Types inherited from List< std::function< bool(Foam::scalar)> >
typedef SubList< TsubList
 

Public Member Functions

 scalars (std::initializer_list< std::pair< word, scalar >> entries)
 
 scalars (const UList< Tuple2< word, scalar >> &entries)
 
 scalars (Istream &is)
 
 ~scalars ()=default
 
label find (const scalar value, label pos=0) const
 
label rfind (const scalar value, label pos=-1) const
 
bool found (const scalar value, label pos=0) const
 
bool match (const scalar &value) const
 
bool matchAny (const scalar &value) const
 
bool matchAll (const scalar &value) const
 
labelList matching (const scalar &value) const
 
labelList matching (const UList< scalar > &input, const bool invert=false) const
 
bool operator() (const scalar &value) const
 
- Public Member Functions inherited from List< std::function< bool(Foam::scalar)> >
constexpr List () noexcept
 
 List (const label len)
 
 List (const label len, const T &val)
 
 List (const label len, const Foam::zero)
 
 List (const Foam::one, const T &val)
 
 List (const Foam::one, T &&val)
 
 List (const Foam::one, const Foam::zero)
 
 List (const List< T > &a)
 
 List (const UList< T > &a)
 
 List (List< T > &a, bool reuse)
 
 List (const UList< T > &list, const labelUList &indices)
 
 List (const UList< T > &list, const FixedList< label, N > &indices)
 
 List (const FixedList< T, N > &list)
 
 List (const PtrList< T > &list)
 
 List (const SLList< T > &list)
 
 List (const IndirectListBase< T, Addr > &list)
 
 List (std::initializer_list< T > list)
 
 List (List< T > &&list)
 
 List (DynamicList< T, SizeMin > &&list)
 
 List (SortableList< T > &&list)
 
 List (SLList< T > &&list)
 
 List (Istream &is)
 
 List (const label len)
 
 List (const label len, const T &val)
 
 List (const label len, const Foam::zero)
 
 List (const Foam::one, const T &val)
 
 List (const Foam::one, T &&val)
 
 List (const Foam::one, const Foam::zero)
 
 List (const UList< T > &a)
 
 List (const List< T > &a)
 
 List (List< T > &a, bool reuse)
 
 List (const UList< T > &list, const labelUList &indices)
 
 List (const PtrList< T > &list)
 
 List (const SLList< T > &list)
 
 List (std::initializer_list< T > list)
 
 List (List< T > &&list)
 
 List (SortableList< T > &&list)
 
 List (SLList< T > &&list)
 
constexpr List () noexcept
 
 List (Istream &is)
 
autoPtr< List< T > > clone () const
 
 ~List ()
 
void clear ()
 
void resize (const label len)
 
void resize (const label len, const T &val)
 
void resize (const label newLen)
 
void resize_nocopy (const label len)
 
void setSize (const label n)
 
void setSize (const label n, const T &val)
 
void append (const T &val)
 
void append (T &&val)
 
void append (const UList< T > &list)
 
void append (const IndirectListBase< T, Addr > &list)
 
void append (const T &val)
 
void append (T &&val)
 
void append (const UList< T > &list)
 
label appendUniq (const T &val)
 
void transfer (List< T > &list)
 
void transfer (DynamicList< T, SizeMin > &list)
 
void transfer (SortableList< T > &list)
 
void transfer (List< T > &list)
 
void transfer (SortableList< T > &list)
 
TnewElmt (const label i)
 
void operator= (const UList< T > &a)
 
void operator= (const List< T > &list)
 
void operator= (const SLList< T > &list)
 
void operator= (const IndirectListBase< T, Addr > &list)
 
void operator= (const FixedList< T, N > &list)
 
void operator= (std::initializer_list< T > list)
 
void operator= (const T &val)
 
void operator= (const Foam::zero)
 
void operator= (List< T > &&list)
 
void operator= (DynamicList< T, SizeMin > &&list)
 
void operator= (SortableList< T > &&list)
 
void operator= (SLList< T > &&list)
 
void operator= (const UList< T > &a)
 
void operator= (const List< T > &list)
 
void operator= (const SLList< T > &list)
 
void operator= (std::initializer_list< T > list)
 
void operator= (List< T > &&list)
 
void operator= (SortableList< T > &&list)
 
void operator= (SLList< T > &&list)
 
void operator= (const T &val)
 
void operator= (const Foam::zero)
 
IstreamreadList (Istream &is)
 
IstreamreadList (Istream &is)
 
IstreamreadList (Istream &is)
 
void shallowCopy (const UList< T > &)=delete
 
std::enable_if< std::is_same< bool, TypeT >::value, bool >::type set (const label i, bool val=true)
 

Static Public Member Functions

static unary equalOp (const scalar opVal, const scalar tol=VSMALL)
 
static unary notEqualOp (const scalar opVal, const scalar tol=VSMALL)
 
static unary lessOp (const scalar opVal)
 
static unary lessEqOp (const scalar opVal)
 
static unary greaterOp (const scalar opVal)
 
static unary greaterEqOp (const scalar opVal)
 
static unary trueOp ()
 
static unary falseOp ()
 
static unary andOp (const unary &test1, const unary &test2)
 
static unary orOp (const unary &test1, const unary &test2)
 
static unary operation (const opType op, const scalar opVal, const scalar tol=VSMALL)
 
static unary operation (const word &opName, const scalar opVal, const scalar tol=VSMALL)
 
static unary operation (const Tuple2< word, scalar > &op, const scalar tol=VSMALL)
 
static unary operation (const std::pair< word, scalar > &op, const scalar tol=VSMALL)
 
- Static Public Member Functions inherited from List< std::function< bool(Foam::scalar)> >
static const List< T > & null ()
 

Static Public Attributes

static const Enum< opTypeopNames
 

Detailed Description

A list of unary predicates (tests) on scalars. Includes a number of standard comparison predicates (eg, "less", "greater", ...)

Note
This class is still subject to larger changes (2018-11) as it matures.
See also
Foam::scalarRange, Foam::scalarRanges
Source files

Definition at line 62 of file scalarPredicates.H.

Member Typedef Documentation

◆ unary

typedef std::function<bool(Foam::scalar)> unary

Definition at line 71 of file scalarPredicates.H.

Member Enumeration Documentation

◆ opType

enum opType
Enumerator
EQUAL 

"eq", "equal"

NOT_EQUAL 

"neq", "notEqual"

LESS 

"lt", "less"

LESS_EQ 

"le", "lessEq"

GREATER 

"gt", "greater"

GREATER_EQ 

"ge", "greaterEq"

ALWAYS 

Always matches.

NEVER 

Never matches.

Definition at line 74 of file scalarPredicates.H.

Constructor & Destructor Documentation

◆ scalars() [1/3]

scalars ( std::initializer_list< std::pair< word, scalar >>  entries)
explicit

Definition at line 175 of file scalarPredicates.C.

References Foam::exit(), Foam::FatalError, FatalErrorInFunction, Foam::hasBadEntries(), scalars::operation(), and Foam::printBadEntries().

Here is the call graph for this function:

◆ scalars() [2/3]

scalars ( const UList< Tuple2< word, scalar >> &  entries)
explicit

Definition at line 206 of file scalarPredicates.C.

References Foam::exit(), Foam::FatalError, FatalErrorInFunction, Foam::hasBadEntries(), scalars::operation(), and Foam::printBadEntries().

Here is the call graph for this function:

◆ scalars() [3/3]

scalars ( Istream is)
explicit

Definition at line 236 of file scalarPredicates.C.

◆ ~scalars()

~scalars ( )
default

Member Function Documentation

◆ equalOp()

static unary equalOp ( const scalar  opVal,
const scalar  tol = VSMALL 
)
inlinestatic

Definition at line 94 of file scalarPredicates.H.

References Foam::mag().

Here is the call graph for this function:

◆ notEqualOp()

static unary notEqualOp ( const scalar  opVal,
const scalar  tol = VSMALL 
)
inlinestatic

Definition at line 108 of file scalarPredicates.H.

References Foam::mag().

Here is the call graph for this function:

◆ lessOp()

static unary lessOp ( const scalar  opVal)
inlinestatic

Definition at line 121 of file scalarPredicates.H.

◆ lessEqOp()

static unary lessEqOp ( const scalar  opVal)
inlinestatic

Definition at line 131 of file scalarPredicates.H.

◆ greaterOp()

static unary greaterOp ( const scalar  opVal)
inlinestatic

Definition at line 142 of file scalarPredicates.H.

◆ greaterEqOp()

static unary greaterEqOp ( const scalar  opVal)
inlinestatic

Definition at line 152 of file scalarPredicates.H.

◆ trueOp()

static unary trueOp ( )
inlinestatic

Definition at line 164 of file scalarPredicates.H.

◆ falseOp()

static unary falseOp ( )
inlinestatic

Definition at line 170 of file scalarPredicates.H.

◆ andOp()

static unary andOp ( const unary test1,
const unary test2 
)
inlinestatic

Definition at line 179 of file scalarPredicates.H.

Referenced by parcelSelection::calculateFilter().

Here is the caller graph for this function:

◆ orOp()

static unary orOp ( const unary test1,
const unary test2 
)
inlinestatic

Definition at line 188 of file scalarPredicates.H.

Referenced by parcelSelection::calculateFilter().

Here is the caller graph for this function:

◆ operation() [1/4]

static unary operation ( const opType  op,
const scalar  opVal,
const scalar  tol = VSMALL 
)
static

Referenced by parcelSelection::calculateFilter(), Foam::operator>>(), and scalars::scalars().

Here is the caller graph for this function:

◆ operation() [2/4]

Foam::predicates::scalars::unary operation ( const word opName,
const scalar  opVal,
const scalar  tol = VSMALL 
)
inlinestatic

Definition at line 24 of file scalarPredicatesI.H.

◆ operation() [3/4]

Foam::predicates::scalars::unary operation ( const Tuple2< word, scalar > &  op,
const scalar  tol = VSMALL 
)
inlinestatic

Definition at line 35 of file scalarPredicatesI.H.

References Tuple2::first(), and Tuple2::second().

Here is the call graph for this function:

◆ operation() [4/4]

Foam::predicates::scalars::unary operation ( const std::pair< word, scalar > &  op,
const scalar  tol = VSMALL 
)
inlinestatic

Definition at line 45 of file scalarPredicatesI.H.

◆ find()

Foam::label find ( const scalar  value,
label  pos = 0 
) const

Definition at line 247 of file scalarPredicates.C.

References Foam::pos().

Here is the call graph for this function:

◆ rfind()

Foam::label rfind ( const scalar  value,
label  pos = -1 
) const

Definition at line 274 of file scalarPredicates.C.

References Foam::pos().

Here is the call graph for this function:

◆ found()

bool found ( const scalar  value,
label  pos = 0 
) const
inline

Definition at line 57 of file scalarPredicatesI.H.

References Foam::ListOps::find(), and Foam::pos().

Here is the call graph for this function:

◆ match()

bool match ( const scalar &  value) const
inline

Definition at line 66 of file scalarPredicatesI.H.

References scalars::matchAny().

Here is the call graph for this function:

◆ matchAny()

bool matchAny ( const scalar &  value) const
inline

Definition at line 72 of file scalarPredicatesI.H.

Referenced by scalars::match().

Here is the caller graph for this function:

◆ matchAll()

bool matchAll ( const scalar &  value) const
inline

Definition at line 86 of file scalarPredicatesI.H.

◆ matching() [1/2]

Foam::labelList matching ( const scalar &  value) const
inline

Definition at line 101 of file scalarPredicatesI.H.

References Foam::BitOps::count(), and List::resize().

Here is the call graph for this function:

◆ matching() [2/2]

Foam::labelList matching ( const UList< scalar > &  input,
const bool  invert = false 
) const
inline

Definition at line 124 of file scalarPredicatesI.H.

References Foam::BitOps::count(), Foam::input(), Foam::invert(), Foam::stringOps::match(), and List::resize().

Here is the call graph for this function:

◆ operator()()

bool operator() ( const scalar &  value) const
inline

Definition at line 150 of file scalarPredicatesI.H.

References found.

Member Data Documentation

◆ opNames

Definition at line 87 of file scalarPredicates.H.

Referenced by Foam::hasBadEntries(), and Foam::printBadEntries().


The documentation for this class was generated from the following files: