ENH: generalize string expression evaluation

- replace stringOps::toScalar with a more generic stringOps::evaluate
  method that handles scalars, vectors etc.

- improve #eval to handle various mathematical operations.
  Previously only handled scalars. Now produce vectors, tensors etc
  for the entries. These tokens are streamed directly into the entry.
This commit is contained in:
Mark Olesen
2019-12-09 14:10:41 +01:00
parent f84ebb9ad3
commit c2123452b1
19 changed files with 141 additions and 3409 deletions

View File

@ -46,10 +46,9 @@ SourceFiles
#include "dictionary.H"
#include "HashTable.H"
#include "stringOpsSort.H"
#include "stringOpsEvaluate.H"
#include "wordRes.H"
#include "evalStringToScalar.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
@ -137,7 +136,7 @@ namespace stringOps
// - \c ${VAR}
// - \c ${VAR:-defValue}
// - \c ${VAR:+altValue}
// -# numeric (scalar) evaluation using stringOps::toScalar
// -# mathematical evaluation using stringOps::evaluate
// - \c ${{EXPR}}
// -# current directory
// - leading "./"
@ -183,7 +182,7 @@ namespace stringOps
// \param sigil The leading sigil. Can be changed to avoid conflict
// with other string expansions. (default: '$')
//
// \sa Foam::findEtcEntry(), Foam::findEtcEntries(), stringOps::toScalar()
// \sa Foam::findEtcEntry(), Foam::findEtcEntries(), stringOps::evaluate()
//
// \note this function has too many parameters and should generally
// be avoided in user coding.