mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
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
This commit is contained in:
@ -233,7 +233,7 @@ protected:
|
|||||||
// Checks for availability on any processor.
|
// Checks for availability on any processor.
|
||||||
inline bool canWeight(const scalarField& weightField) const;
|
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>
|
template<class Type>
|
||||||
bool validField(const word& fieldName) const;
|
bool validField(const word& fieldName) const;
|
||||||
|
|
||||||
@ -242,7 +242,7 @@ protected:
|
|||||||
tmp<Field<Type>> getFieldValues
|
tmp<Field<Type>> getFieldValues
|
||||||
(
|
(
|
||||||
const word& fieldName,
|
const word& fieldName,
|
||||||
const bool mustGet = false
|
const bool mandatory = false
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Apply the 'operation' to the values
|
//- Apply the 'operation' to the values
|
||||||
|
|||||||
@ -40,16 +40,11 @@ bool Foam::functionObjects::fieldValues::volFieldValue::validField
|
|||||||
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
|
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
|
||||||
typedef typename VolFieldType::Internal IntVolFieldType;
|
typedef typename VolFieldType::Internal IntVolFieldType;
|
||||||
|
|
||||||
if
|
return
|
||||||
(
|
(
|
||||||
obr_.foundObject<VolFieldType>(fieldName)
|
obr_.foundObject<VolFieldType>(fieldName)
|
||||||
|| obr_.foundObject<IntVolFieldType>(fieldName)
|
|| obr_.foundObject<IntVolFieldType>(fieldName)
|
||||||
)
|
);
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -58,7 +53,7 @@ Foam::tmp<Foam::Field<Type>>
|
|||||||
Foam::functionObjects::fieldValues::volFieldValue::getFieldValues
|
Foam::functionObjects::fieldValues::volFieldValue::getFieldValues
|
||||||
(
|
(
|
||||||
const word& fieldName,
|
const word& fieldName,
|
||||||
const bool mustGet
|
const bool mandatory
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
|
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
|
||||||
@ -73,14 +68,14 @@ Foam::functionObjects::fieldValues::volFieldValue::getFieldValues
|
|||||||
return filterField(obr_.lookupObject<IntVolFieldType>(fieldName));
|
return filterField(obr_.lookupObject<IntVolFieldType>(fieldName));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mustGet)
|
if (mandatory)
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Field " << fieldName << " not found in database"
|
<< "Field " << fieldName << " not found in database"
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
return tmp<Field<Type>>::New(Zero);
|
return tmp<Field<Type>>::New();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user