ENH: add exprResult output of a field without dictionary keywords

This commit is contained in:
Mark Olesen
2021-03-29 13:25:18 +02:00
parent 13ea1b70fe
commit 4a3998c698
3 changed files with 73 additions and 27 deletions

View File

@ -624,21 +624,7 @@ void Foam::expressions::exprResult::writeDict
os.writeEntryIfDifferent<Switch>("isPointValue", false, isPointData_);
os.writeEntry<Switch>("isSingleValue", isUniform_);
const bool ok =
(
writeValueFieldChecked<scalar>(os)
|| writeValueFieldChecked<vector>(os)
|| writeValueFieldChecked<tensor>(os)
|| writeValueFieldChecked<symmTensor>(os)
|| writeValueFieldChecked<sphericalTensor>(os)
|| writeValueFieldChecked<bool>(os)
);
if (!ok)
{
WarningInFunction
<< "Unknown data type " << valType_ << endl;
}
this->writeField(os, "value");
}
if (subDict)
@ -650,6 +636,38 @@ void Foam::expressions::exprResult::writeDict
}
void Foam::expressions::exprResult::writeField
(
Ostream& os,
const word& keyword
) const
{
// const auto oldFmt = os.format(IOstream::ASCII);
DebugInFunction
<< Foam::name(this) << nl
<< "Format: "
<< IOstreamOption::formatNames[os.format()] << nl;
const bool ok =
(
writeFieldChecked<scalar>(keyword, os)
|| writeFieldChecked<vector>(keyword, os)
|| writeFieldChecked<tensor>(keyword, os)
|| writeFieldChecked<symmTensor>(keyword, os)
|| writeFieldChecked<sphericalTensor>(keyword, os)
|| writeFieldChecked<label>(keyword, os)
|| writeFieldChecked<bool>(keyword, os)
);
if (!ok)
{
WarningInFunction
<< "Unknown data type " << valType_ << endl;
}
}
void Foam::expressions::exprResult::writeValue
(
Ostream& os