Cell source variant of field value function object. Values of user- specified fields reported for collections of cells. More...
#include <fieldFunctionObjects/cellSource.H>
Cell source variant of field value function object. Values of user- specified fields reported for collections of cells.
cellObj1// Name also used to identify output folder { typecellSource; functionObjectLibs ("libfieldValueFunctionObjects.so"); enabled true; outputControl outputTime; log true; // log to screen? valueOutput true; // Write values at run-time output times? source cellZone; // Type of cell source sourceName c0; operation volAverage; fields ( p U ); }
where operation is one of:
Definition at line 80 of file cellSource.H.
Public Types | |
enum | sourceType { stCellZone, stAll } |
Source type enumeration. More... | |
enum | operationType { opNone, opSum, opVolAverage, opVolIntegrate, opWeightedAverage, opMin, opMax } |
Operation type enumeration. More... | |
Public Member Functions | |
TypeName ("cellSource") | |
Run-time type information.
| |
cellSource (const word &name, const objectRegistry &obr, const dictionary &dict, const bool loadFromFiles=false) | |
Construct from components.
| |
virtual | ~cellSource () |
Destructor.
| |
const sourceType & | source () const |
Return the source type.
| |
const labelList & | cellId () const |
Return the local list of cell IDs.
| |
virtual void | read (const dictionary &) |
Read from dictionary.
| |
virtual void | write () |
Calculate and write.
| |
template<class Type > | |
bool | writeValues (const word &fieldName) |
Templated helper function to output field values.
| |
template<class Type > | |
tmp< Field< Type > > | filterField (const Field< Type > &field) const |
Filter a field according to cellIds.
| |
Static Public Attributes | |
static const NamedEnum < sourceType, 2 > | sourceTypeNames_ |
Source type names.
| |
static const NamedEnum < operationType, 7 > | operationTypeNames_ |
Operation type names.
| |
Protected Member Functions | |
void | initialise (const dictionary &dict) |
Initialise, e.g. cell addressing.
| |
template<class Type > | |
bool | validField (const word &fieldName) const |
Return true if the field name is valid.
| |
template<class Type > | |
tmp< Field< Type > > | setFieldValues (const word &fieldName) const |
Insert field values into values list.
| |
template<class Type > | |
Type | processValues (const Field< Type > &values, const scalarField &V, const scalarField &weightField) const |
Apply the 'operation' to the values.
| |
virtual void | writeFileHeader () |
Output file header information.
| |
Protected Attributes | |
sourceType | source_ |
Source type.
| |
operationType | operation_ |
Operation to apply to values.
| |
label | nCells_ |
Global number of cells.
| |
labelList | cellId_ |
Local list of cell IDs.
| |
word | weightFieldName_ |
Weight field name - only used for opWeightedAverage mode.
|
enum sourceType |
enum operationType |
Operation type enumeration.
Definition at line 101 of file cellSource.H.
cellSource | ( | const word & | name, |
const objectRegistry & | obr, | ||
const dictionary & | dict, | ||
const bool | loadFromFiles = false
|
||
) |
Construct from components.
Definition at line 166 of file cellSource.C.
~cellSource | ( | ) | [virtual]
|
Destructor.
Definition at line 185 of file cellSource.C.
void initialise | ( | const dictionary & | dict ) | [protected]
|
Initialise, e.g. cell addressing.
Definition at line 108 of file cellSource.C.
References Foam::endl(), Foam::exit(), Foam::FatalError, FatalErrorIn, Foam::gSum(), Foam::Info, dictionary::lookup(), mesh, Foam::nl, Foam::type(), and Field< scalar >::typeName.
bool validField | ( | const word & | fieldName ) | const [protected]
|
Return true if the field name is valid.
Definition at line 33 of file cellSourceTemplates.C.
References objectRegistry::foundObject(), and fieldValue::obr_.
Foam::tmp< Foam::Field< Type > > setFieldValues | ( | const word & | fieldName ) | const [protected]
|
Insert field values into values list.
Definition at line 48 of file cellSourceTemplates.C.
Type processValues | ( | const Field< Type > & | values, |
const scalarField & | V, | ||
const scalarField & | weightField | ||
) | const [protected]
|
Apply the 'operation' to the values.
Definition at line 65 of file cellSourceTemplates.C.
References Foam::max(), Foam::min(), and Foam::sum().
void writeFileHeader | ( | ) | [protected, virtual]
|
Output file header information.
Implements fieldValue.
Definition at line 142 of file cellSource.C.
References Foam::endl(), forAll, Foam::nl, and Foam::tab.
TypeName | ( | "cellSource" | ) |
Run-time type information.
const Foam::fieldValues::cellSource::sourceType & source | ( | ) | const [inline]
|
Return the source type.
Definition at line 31 of file cellSourceI.H.
References cellSource::source_.
const Foam::labelList & cellId | ( | ) | const [inline]
|
Return the local list of cell IDs.
Definition at line 38 of file cellSourceI.H.
void read | ( | const dictionary & | dict ) | [virtual]
|
Read from dictionary.
Reimplemented from fieldValue.
Definition at line 191 of file cellSource.C.
References fieldValue::read().
void write | ( | ) | [virtual]
|
Calculate and write.
Reimplemented from fieldValue.
Definition at line 203 of file cellSource.C.
References Foam::endl(), forAll, Foam::Info, Pstream::master(), mesh, Foam::sum(), Foam::tab, and fieldValue::write().
bool writeValues | ( | const word & | fieldName ) |
Templated helper function to output field values.
Definition at line 117 of file cellSourceTemplates.C.
References Foam::endl(), Foam::Info, Pstream::master(), mesh, IOobject::NO_READ, IOobject::NO_WRITE, Foam::tab, and regIOobject::write().
Foam::tmp< Foam::Field< Type > > filterField | ( | const Field< Type > & | field ) | const |
Filter a field according to cellIds.
Definition at line 169 of file cellSourceTemplates.C.
const NamedEnum< fieldValues::cellSource::sourceType, 2 > sourceTypeNames_ [static]
|
Source type names.
Definition at line 97 of file cellSource.H.
const NamedEnum< fieldValues::cellSource::operationType, 7 > operationTypeNames_ [static]
|
Operation type names.
Definition at line 113 of file cellSource.H.
sourceType source_ [protected]
|
operationType operation_ [protected]
|
Operation to apply to values.
Definition at line 135 of file cellSource.H.
label nCells_ [protected]
|
Global number of cells.
Definition at line 138 of file cellSource.H.
Local list of cell IDs.
Definition at line 141 of file cellSource.H.
word weightFieldName_ [protected]
|
Weight field name - only used for opWeightedAverage mode.
Definition at line 144 of file cellSource.H.