Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
addSubtract Class Reference

adds/subtracts a field or value to/from a base field. More...

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

Public Types

enum  calcTypes { FIELD, VALUE }
 
enum  calcModes { ADD, SUBTRACT }
 

Public Member Functions

 TypeName ("addSubtract")
 Runtime type information. More...
 
 addSubtract ()
 Construct null. More...
 
virtual ~addSubtract ()
 Destructor. More...
 
- Public Member Functions inherited from calcType
 TypeName ("calcType")
 Runtime type information. More...
 
 declareRunTimeSelectionTable (autoPtr, calcType, dictionary,(),())
 
 calcType ()
 Construct null. More...
 
virtual ~calcType ()
 Destructor. More...
 
void tryInit ()
 Initialise - typically setting static variables,. More...
 
void tryPreCalc (const argList &args, const Time &runTime, const fvMesh &mesh)
 Pre-time loop calculations. More...
 
void tryCalc (const argList &args, const Time &runTime, const fvMesh &mesh)
 Time loop calculations. More...
 
void tryPostCalc (const argList &args, const Time &runTime, const fvMesh &mesh)
 Post-time loop calculations. More...
 

Protected Member Functions

virtual void init ()
 Initialise - typically setting static variables,. More...
 
virtual void preCalc (const argList &args, const Time &runTime, const fvMesh &mesh)
 Pre-time loop calculations. More...
 
virtual void calc (const argList &args, const Time &runTime, const fvMesh &mesh)
 Time loop calculations. More...
 
template<class Type >
void writeAddSubtractField (const IOobject &baseHeader, const IOobject &addSubtractHeader, const fvMesh &mesh, bool &processed)
 Write addSubtract field. More...
 
template<class Type >
void writeAddSubtractValue (const IOobject &baseHeader, const string &valueStr, const fvMesh &mesh, bool &processed)
 Write addSubtract value. More...
 
- Protected Member Functions inherited from calcType
virtual void postCalc (const argList &args, const Time &runTime, const fvMesh &mesh)
 Post-time loop calculations. More...
 

Private Member Functions

void writeAddSubtractFields (const Time &runTime, const fvMesh &mesh, const IOobject &baseFieldHeader)
 Calc and output field addSubtractitions. More...
 
void writeAddSubtractValues (const Time &runTime, const fvMesh &mesh, const IOobject &baseFieldHeader)
 Calc and output field and value addSubtractitions. More...
 
 addSubtract (const addSubtract &)
 Disallow default bitwise copy construct. More...
 
void operator= (const addSubtract &)
 Disallow default bitwise assignment. More...
 

Private Attributes

word baseFieldName_
 Name of base field (to addSubtract to) More...
 
calcTypes calcType_
 Calc type as given by enumerations above. More...
 
word addSubtractFieldName_
 Name of field to add/subtract. More...
 
string addSubtractValueStr_
 String representation of value to add/subtract. More...
 
word resultName_
 Name of result field. More...
 
calcModes calcMode_
 Mode - addSubtract/subtract. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from calcType
static autoPtr< calcTypeNew (const word &calcTypeName)
 

Detailed Description

adds/subtracts a field or value to/from a base field.

New field name specified by -resultName option, or automatically as: <baseFieldName>_add_<addSubtractFieldName> <baseFieldName>_add_value <baseFieldName>_subtract_<addSubtractFieldName> <baseFieldName>_subtract_value

Example usage: addSubtract p add -value 100000 -resultName pAbs addSubtract U subtract -field U0

Source files

Definition at line 63 of file addSubtract.H.

Member Enumeration Documentation

◆ calcTypes

enum calcTypes
Enumerator
FIELD 
VALUE 

Definition at line 69 of file addSubtract.H.

◆ calcModes

enum calcModes
Enumerator
ADD 
SUBTRACT 

Definition at line 75 of file addSubtract.H.

Constructor & Destructor Documentation

◆ addSubtract() [1/2]

addSubtract ( const addSubtract )
private

Disallow default bitwise copy construct.

◆ addSubtract() [2/2]

Construct null.

Definition at line 177 of file addSubtract.C.

◆ ~addSubtract()

~addSubtract ( )
virtual

Destructor.

Definition at line 191 of file addSubtract.C.

Member Function Documentation

◆ writeAddSubtractFields()

void writeAddSubtractFields ( const Time runTime,
const fvMesh mesh,
const IOobject baseFieldHeader 
)
private

Calc and output field addSubtractitions.

Definition at line 44 of file addSubtract.C.

References Foam::exit(), Foam::FatalError, FatalErrorInFunction, IOobject::headerClassName(), IOobject::headerOk(), mesh, Foam::nl, and Time::timeName().

Here is the call graph for this function:

◆ writeAddSubtractValues()

void writeAddSubtractValues ( const Time runTime,
const fvMesh mesh,
const IOobject baseFieldHeader 
)
private

Calc and output field and value addSubtractitions.

Definition at line 119 of file addSubtract.C.

References Foam::exit(), Foam::FatalError, FatalErrorInFunction, IOobject::headerClassName(), mesh, and Foam::nl.

Here is the call graph for this function:

◆ operator=()

void operator= ( const addSubtract )
private

Disallow default bitwise assignment.

◆ init()

void init ( )
protectedvirtual

Initialise - typically setting static variables,.

e.g. command line arguments

Reimplemented from calcType.

Definition at line 197 of file addSubtract.C.

References argList::validArgs, and argList::validOptions.

◆ preCalc()

void preCalc ( const argList args,
const Time runTime,
const fvMesh mesh 
)
protectedvirtual

Pre-time loop calculations.

Reimplemented from calcType.

Definition at line 209 of file addSubtract.C.

References args, Foam::exit(), Foam::FatalError, FatalErrorInFunction, Foam::nl, and argList::optionReadIfPresent().

Here is the call graph for this function:

◆ calc()

void calc ( const argList args,
const Time runTime,
const fvMesh mesh 
)
protectedvirtual

Time loop calculations.

Reimplemented from calcType.

Definition at line 254 of file addSubtract.C.

References Foam::abort(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, IOobject::headerOk(), mesh, IOobject::MUST_READ, Foam::nl, and Time::timeName().

Here is the call graph for this function:

◆ writeAddSubtractField()

void writeAddSubtractField ( const IOobject baseHeader,
const IOobject addSubtractHeader,
const fvMesh mesh,
bool &  processed 
)
protected

Write addSubtract field.

Definition at line 28 of file writeAddSubtractField.C.

References Foam::endl(), IOobject::headerClassName(), Foam::Info, mesh, IOobject::name(), and Foam::nl.

Here is the call graph for this function:

◆ writeAddSubtractValue()

void writeAddSubtractValue ( const IOobject baseHeader,
const string valueStr,
const fvMesh mesh,
bool &  processed 
)
protected

Write addSubtract value.

Definition at line 28 of file writeAddSubtractValue.C.

References Foam::endl(), IOobject::headerClassName(), Foam::Info, mesh, and IOobject::name().

Here is the call graph for this function:

◆ TypeName()

TypeName ( "addSubtract"  )

Runtime type information.

Field Documentation

◆ baseFieldName_

word baseFieldName_
private

Name of base field (to addSubtract to)

Definition at line 87 of file addSubtract.H.

◆ calcType_

calcTypes calcType_
private

Calc type as given by enumerations above.

Definition at line 90 of file addSubtract.H.

◆ addSubtractFieldName_

word addSubtractFieldName_
private

Name of field to add/subtract.

Definition at line 93 of file addSubtract.H.

◆ addSubtractValueStr_

string addSubtractValueStr_
private

String representation of value to add/subtract.

Definition at line 96 of file addSubtract.H.

◆ resultName_

word resultName_
private

Name of result field.

Definition at line 99 of file addSubtract.H.

◆ calcMode_

calcModes calcMode_
private

Mode - addSubtract/subtract.

Definition at line 102 of file addSubtract.H.


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