ENH: add/subtract/multiply: validate minimum field count requirement

This commit is contained in:
Kutalmis Bercin
2025-09-20 18:51:34 +01:00
parent 8be698528a
commit d4019e497d
3 changed files with 24 additions and 0 deletions

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}