Commit 0e6df58c authored by Mark Olesen's avatar Mark Olesen

STYLE: simpler construct for empty tmp field in volFieldValue

- originally (incorrectly) was a Field(0.0), which was generalized
  to Field(Zero), but Field() is the correct form

STYLE: rename 'mustGet' to more standard 'mandatory' variable
parent b2feb6a8
......@@ -233,7 +233,7 @@ protected:
// Checks for availability on any processor.
inline bool canWeight(const scalarField& weightField) const;
//- Return true if the field name is valid
//- True if the field name is valid (exists, and a supported type)
template<class Type>
bool validField(const word& fieldName) const;
......@@ -242,7 +242,7 @@ protected:
tmp<Field<Type>> getFieldValues
(
const word& fieldName,
const bool mustGet = false
const bool mandatory = false
) const;
//- Apply the 'operation' to the values
......
......@@ -40,16 +40,11 @@ bool Foam::functionObjects::fieldValues::volFieldValue::validField
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
typedef typename VolFieldType::Internal IntVolFieldType;
if
return
(
obr_.foundObject<VolFieldType>(fieldName)
|| obr_.foundObject<IntVolFieldType>(fieldName)
)
{
return true;
}
return false;
);
}
......@@ -58,7 +53,7 @@ Foam::tmp<Foam::Field<Type>>
Foam::functionObjects::fieldValues::volFieldValue::getFieldValues
(
const word& fieldName,
const bool mustGet
const bool mandatory
) const
{
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
......@@ -73,14 +68,14 @@ Foam::functionObjects::fieldValues::volFieldValue::getFieldValues
return filterField(obr_.lookupObject<IntVolFieldType>(fieldName));
}
if (mustGet)
if (mandatory)
{
FatalErrorInFunction
<< "Field " << fieldName << " not found in database"
<< abort(FatalError);
}
return tmp<Field<Type>>::New(Zero);
return tmp<Field<Type>>::New();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment