Commit Graph

4 Commits

Author SHA1 Message Date
Mark Olesen
21720bea12 ENH: support field width for #eval expressions
For example,
```
entry #eval 10 { vector(rand(), 0, 0) };
```

ENH: be more generous and ignore trailing ';' in expressions

STYLE: adjust parse token name for tensor::I
2021-03-29 16:00:11 +02:00
Mark Olesen
31b172217c ENH: support predicate checks for argList (similar to dictionary methods)
- Favour use of argList methods that are more similar to dictionary
  method names with the aim of reducing the cognitive load.

  * Silently deprecate two-parameter get() method in favour of the
    more familiar getOrDefault.
  * Silently deprecate opt() method in favour of get()

  These may be verbosely deprecated in future versions.
2020-06-02 13:51:18 +02:00
Mark Olesen
4107eeefcd ENH: added foamCalc (applications/tools)
Many possibilities:
- use as a simple calculator with vectors, tensors etc.
- test validity of expression syntax

As a calculator:

    foamCalc  '(vector(1,2,3) ^ vector(4,5,6)) * sqrt(34)'

The same, but with debugging:

    foamCalc -debug-switch fieldExpr=6 \
        'mag((vector(1,2,3) ^ vector(4,5,6))) * sqrt(34)'
2019-12-19 22:18:10 +01:00
Mark Olesen
74b12c6afd ENH: improved separation of scanner/parser debug selection
- now use debug 2 for scanner and debug 4 for parser.
  Provided better feedback about what is being parsed (debug mode)

- relocate debug application to applications/tools/foamExprParserInfo
2019-12-19 13:16:26 +01:00