Loading...
Searching...
No Matches
Foam::FieldOps Namespace Reference

Various utility functions to work on Fields. More...

Functions

template<class Tout, class T1, class UnaryOp>
void assign (Field< Tout > &result, const Field< T1 > &a, const UnaryOp &op)
 Populate a field as the result of a unary operation on an input.
template<class Tout, class T1, class T2, class BinaryOp>
void assign (Field< Tout > &result, const Field< T1 > &a, const Field< T2 > &b, const BinaryOp &bop)
 Populate a field as the result of a binary operation on two inputs.
template<class T, class BinaryOp>
void ternary (Field< T > &result, const Field< T > &a, const Field< T > &b, const BinaryOp &bop)
 Emulate a ternary operation, selecting values from a or b depending on the binary predicate.
template<class T, class BoolListType, class FlipOp>
void ternarySelect (Field< T > &result, const BoolListType &cond, const Field< T > &a, const Field< T > &b, const FlipOp &flip)
 Emulate a ternary operation, selecting values from a or b depending on the conditional.
template<class T, class FlipOp>
void ternarySelect (Field< T > &result, const bitSet &cond, const Field< T > &a, const Field< T > &b, const FlipOp &flip)
 Emulate a ternary operation, selecting values from a or b depending on the conditional.
template<class T, class BoolListType>
void ternarySelect (Field< T > &result, const BoolListType &cond, const Field< T > &a, const Field< T > &b)
 Emulated ternary operation, without condition flipping.
template<class T>
void ternarySelect (Field< T > &result, const bitSet &cond, const Field< T > &a, const Field< T > &b)
 Emulated ternary operation, without condition flipping.
template<class T1, class T2>
Tuple2< T1, T2 > findMinData (const Field< T1 > &vals, const Field< T2 > &data)
 Locate the min value in a field and return it and associated data.
template<class T1, class T2>
Tuple2< T1, T2 > findMaxData (const Field< T1 > &vals, const Field< T2 > &data)
 Locate the max value in a field and return it and associated data.
template<class Tout, class T1, class UnaryOp, template< class > class PatchField, class GeoMesh>
void assign (GeometricField< Tout, PatchField, GeoMesh > &result, const GeometricField< T1, PatchField, GeoMesh > &a, const UnaryOp &op)
 Populate a geometric field as the result of a unary operation on an input.
template<class Tout, class T1, class T2, class BinaryOp, template< class > class PatchField, class GeoMesh>
void assign (GeometricField< Tout, PatchField, GeoMesh > &result, const GeometricField< T1, PatchField, GeoMesh > &a, const GeometricField< T2, PatchField, GeoMesh > &b, const BinaryOp &bop)
 Populate a geometric field from the binary operation on two inputs.
template<class T, class BinaryOp, template< class > class PatchField, class GeoMesh>
void ternary (GeometricField< T, PatchField, GeoMesh > &result, const GeometricField< T, PatchField, GeoMesh > &a, const GeometricField< T, PatchField, GeoMesh > &b, const BinaryOp &bop)
 Emulate a ternary operation, selecting values from a or b depending on the binary predicate.
template<class T, class BoolType, class FlipOp, template< class > class PatchField, class GeoMesh>
void ternarySelect (GeometricField< T, PatchField, GeoMesh > &result, const GeometricField< BoolType, PatchField, GeoMesh > &cond, const GeometricField< T, PatchField, GeoMesh > &a, const GeometricField< T, PatchField, GeoMesh > &b, const FlipOp &flip)
 Emulate a ternary operation, selecting field values from a or b depending on the conditional.
template<class Tout, class T1, class UnaryOp>
void assign (pointPatchField< Tout > &result, const pointPatchField< T1 > &a, const UnaryOp &op)
template<class Tout, class T1, class T2, class BinaryOp>
void assign (pointPatchField< Tout > &result, const pointPatchField< T1 > &a, const pointPatchField< T2 > &b, const BinaryOp &bop)
template<class T, class BinaryOp>
void ternary (pointPatchField< T > &result, const pointPatchField< T > &a, const pointPatchField< T > &b, const BinaryOp &bop)
template<class T, class BoolType, class FlipOp>
void ternarySelect (pointPatchField< T > &result, const pointPatchField< BoolType > &cond, const pointPatchField< T > &a, const pointPatchField< T > &b, const FlipOp &flip)

Detailed Description

Various utility functions to work on Fields.

Source files

Function Documentation

◆ assign() [1/6]

template<class Tout, class T1, class UnaryOp>
void assign ( Field< Tout > & result,
const Field< T1 > & a,
const UnaryOp & op )

Populate a field as the result of a unary operation on an input.

It is permissible for inputs/outputs to refer to the same field(s), but partially overlapping regions are ill-defined.

Examples,

boolField result(sfield1.size());
FieldOps::assign(result, sfield1, lessOp1<scalar>(0.5));
FieldOps::assign(result, lfield1, std::logical_not<bool>());
void assign(Field< Tout > &result, const Field< T1 > &a, const UnaryOp &op)
Populate a field as the result of a unary operation on an input.
Definition FieldOps.C:28
Field< bool > boolField
Specialisation of Field<T> for bool.
Definition boolField.H:47

Example of using the Random::uniformGeneratorOp unary operator to populate a random field,

(
sfield,
sfield,
);
A generator class returning a uniformly distributed random number on the given interval.
Definition Random.H:259
Note
wraps std::transform

Definition at line 27 of file FieldOps.C.

References Foam::abort(), UList< T >::begin(), UList< T >::cbegin(), UList< T >::cend(), Foam::FatalError, FatalErrorInFunction, Foam::nl, and UList< T >::size().

Referenced by assign(), assign(), exprDriver::fill_random(), and parseDriver::setInternalFieldResult().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ assign() [2/6]

template<class Tout, class T1, class T2, class BinaryOp>
void assign ( Field< Tout > & result,
const Field< T1 > & a,
const Field< T2 > & b,
const BinaryOp & bop )

Populate a field as the result of a binary operation on two inputs.

It is permissible for inputs/outputs to refer to the same field(s), but partially overlapping regions are ill-defined.

Examples,

FieldOps::assign(result, sfield1, sfield2, std::less<scalar>());
FieldOps::assign(result, lfield1, lfield2, std::logical_or<bool>());
Note
wraps std::transform

Definition at line 49 of file FieldOps.C.

References Foam::abort(), b, UList< T >::begin(), UList< T >::cbegin(), UList< T >::cend(), Foam::FatalError, FatalErrorInFunction, Foam::nl, and UList< T >::size().

Here is the call graph for this function:

◆ ternary() [1/3]

template<class T, class BinaryOp>
void ternary ( Field< T > & result,
const Field< T > & a,
const Field< T > & b,
const BinaryOp & bop )

Emulate a ternary operation, selecting values from a or b depending on the binary predicate.

Examples,

FieldOps::ternary(result, sfield1, sfield2, std::less<scalar>());
void ternary(Field< T > &result, const Field< T > &a, const Field< T > &b, const BinaryOp &bop)
Emulate a ternary operation, selecting values from a or b depending on the binary predicate.
Definition FieldOps.C:73

Definition at line 72 of file FieldOps.C.

References Foam::abort(), b, Foam::FatalError, FatalErrorInFunction, forAll, Foam::nl, and UList< T >::size().

Referenced by ternary().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ternarySelect() [1/6]

template<class T, class BoolListType, class FlipOp>
void ternarySelect ( Field< T > & result,
const BoolListType & cond,
const Field< T > & a,
const Field< T > & b,
const FlipOp & flip )

Emulate a ternary operation, selecting values from a or b depending on the conditional.

The meaning of the conditional is adjusted by the flip operation, which is typically Foam::identityOp() or Foam::flipBoolOp()

Similar parameter requirements as Foam::subset()

Examples,

FieldOps::ternarySelect(result, selector, sfield1, sfield2);
void ternarySelect(Field< T > &result, const BoolListType &cond, const Field< T > &a, const Field< T > &b, const FlipOp &flip)
Emulate a ternary operation, selecting values from a or b depending on the conditional.
Definition FieldOps.C:99

Definition at line 98 of file FieldOps.C.

References Foam::abort(), b, Foam::FatalError, FatalErrorInFunction, forAll, Foam::nl, and UList< T >::size().

Referenced by ternarySelect(), ternarySelect(), and ternarySelect().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ternarySelect() [2/6]

template<class T, class FlipOp>
void ternarySelect ( Field< T > & result,
const bitSet & cond,
const Field< T > & a,
const Field< T > & b,
const FlipOp & flip )

Emulate a ternary operation, selecting values from a or b depending on the conditional.

The meaning of the conditional is adjusted by the flip operation, which is typically Foam::identityOp() or Foam::flipBoolOp()

Definition at line 125 of file FieldOps.C.

References Foam::abort(), b, Foam::FatalError, FatalErrorInFunction, forAll, Foam::nl, and UList< T >::size().

Here is the call graph for this function:

◆ ternarySelect() [3/6]

template<class T, class BoolListType>
void ternarySelect ( Field< T > & result,
const BoolListType & cond,
const Field< T > & a,
const Field< T > & b )

Emulated ternary operation, without condition flipping.

Definition at line 180 of file FieldOps.H.

References b, and ternarySelect().

Here is the call graph for this function:

◆ ternarySelect() [4/6]

template<class T>
void ternarySelect ( Field< T > & result,
const bitSet & cond,
const Field< T > & a,
const Field< T > & b )

Emulated ternary operation, without condition flipping.

Definition at line 196 of file FieldOps.H.

References b, and ternarySelect().

Here is the call graph for this function:

◆ findMinData()

template<class T1, class T2>
Tuple2< T1, T2 > findMinData ( const Field< T1 > & vals,
const Field< T2 > & data )

Locate the min value in a field and return it and associated data.

This can be used, for example, to return a value/position combination.

Referenced by exprDriver::getPositionOfMinimum().

Here is the caller graph for this function:

◆ findMaxData()

template<class T1, class T2>
Tuple2< T1, T2 > findMaxData ( const Field< T1 > & vals,
const Field< T2 > & data )

Locate the max value in a field and return it and associated data.

This can be used, for example, to return a value/position combination.

Referenced by exprDriver::getPositionOfMaximum().

Here is the caller graph for this function:

◆ assign() [3/6]

template<class Tout, class T1, class UnaryOp, template< class > class PatchField, class GeoMesh>
void assign ( GeometricField< Tout, PatchField, GeoMesh > & result,
const GeometricField< T1, PatchField, GeoMesh > & a,
const UnaryOp & op )

◆ assign() [4/6]

template<class Tout, class T1, class T2, class BinaryOp, template< class > class PatchField, class GeoMesh>
void assign ( GeometricField< Tout, PatchField, GeoMesh > & result,
const GeometricField< T1, PatchField, GeoMesh > & a,
const GeometricField< T2, PatchField, GeoMesh > & b,
const BinaryOp & bop )

◆ ternary() [2/3]

template<class T, class BinaryOp, template< class > class PatchField, class GeoMesh>
void ternary ( GeometricField< T, PatchField, GeoMesh > & result,
const GeometricField< T, PatchField, GeoMesh > & a,
const GeometricField< T, PatchField, GeoMesh > & b,
const BinaryOp & bop )

◆ ternarySelect() [5/6]

template<class T, class BoolType, class FlipOp, template< class > class PatchField, class GeoMesh>
void ternarySelect ( GeometricField< T, PatchField, GeoMesh > & result,
const GeometricField< BoolType, PatchField, GeoMesh > & cond,
const GeometricField< T, PatchField, GeoMesh > & a,
const GeometricField< T, PatchField, GeoMesh > & b,
const FlipOp & flip )

◆ assign() [5/6]

template<class Tout, class T1, class UnaryOp>
void assign ( pointPatchField< Tout > & result,
const pointPatchField< T1 > & a,
const UnaryOp & op )
inline

Definition at line 352 of file pointPatchFieldFunctions.H.

◆ assign() [6/6]

template<class Tout, class T1, class T2, class BinaryOp>
void assign ( pointPatchField< Tout > & result,
const pointPatchField< T1 > & a,
const pointPatchField< T2 > & b,
const BinaryOp & bop )
inline

Definition at line 362 of file pointPatchFieldFunctions.H.

References b.

◆ ternary() [3/3]

template<class T, class BinaryOp>
void ternary ( pointPatchField< T > & result,
const pointPatchField< T > & a,
const pointPatchField< T > & b,
const BinaryOp & bop )
inline

Definition at line 372 of file pointPatchFieldFunctions.H.

References b.

◆ ternarySelect() [6/6]

template<class T, class BoolType, class FlipOp>
void ternarySelect ( pointPatchField< T > & result,
const pointPatchField< BoolType > & cond,
const pointPatchField< T > & a,
const pointPatchField< T > & b,
const FlipOp & flip )
inline

Definition at line 382 of file pointPatchFieldFunctions.H.

References b.