mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: add/subtract/multiply: validate minimum field count requirement
This commit is contained in:
@ -61,6 +61,14 @@ Foam::functionObjects::add::add
|
||||
fieldsExpression(name, runTime, dict)
|
||||
{
|
||||
setResultName("add");
|
||||
|
||||
if (fieldNames_.size() < 2)
|
||||
{
|
||||
FatalIOErrorInFunction(dict)
|
||||
<< "At least two field names are required, but only "
|
||||
<< fieldNames_.size() << " provided." << nl
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -51,6 +51,14 @@ Foam::functionObjects::multiply::multiply
|
||||
fieldsExpression(name, runTime, dict)
|
||||
{
|
||||
setResultName("multiply");
|
||||
|
||||
if (fieldNames_.size() < 2)
|
||||
{
|
||||
FatalIOErrorInFunction(dict)
|
||||
<< "At least two field names are required, but only "
|
||||
<< fieldNames_.size() << " provided." << nl
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -61,6 +61,14 @@ Foam::functionObjects::subtract::subtract
|
||||
fieldsExpression(name, runTime, dict)
|
||||
{
|
||||
setResultName("subtract");
|
||||
|
||||
if (fieldNames_.size() < 2)
|
||||
{
|
||||
FatalIOErrorInFunction(dict)
|
||||
<< "At least two field names are required, but only "
|
||||
<< fieldNames_.size() << " provided." << nl
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user