Commit Graph

7 Commits

Author SHA1 Message Date
Mark Olesen
e623e6a865 STYLE: favour include word.H instead of string.H
- in many places the string.H include is redundant anyhow.
  May wish to change to foamString.H (or equiv) in the future
2023-02-27 15:41:25 +01:00
Mark Olesen
851be8ea33 ENH: use consistent naming when toggling exception throwing on/off 2021-11-02 21:14:41 +01:00
Mark Olesen
17d9969ae5 ENH: stringOps::findTrim helper
- finds beg/end indices of string trimmed of leading/trailing whitespace
2019-12-13 12:10:53 +01:00
Mark Olesen
eb4fec371a ENH: unified some common parser static methods
COMP: delay evaluation of fieldToken enumeration types

- lazy evaluation at runTime instead of compile-time to make the code
  independent of initialization order.
  Otherwise triggers problems on gcc-4.8.5 on some systems where
  glibc is the same age, or older.
2019-12-11 13:32:36 +01:00
Mark Olesen
c2123452b1 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.
2019-12-09 19:44:23 +01:00
Mark Olesen
46225279c0 ENH: improvements to stringOps::expand operations
- add toScalar evaluation, embedded as "${{EXPR}}".

  For example,

    "repeat ${{5 * 7}} times or ${{ pow(3, 10) }}"

- use direct string concatenation if primitive entry is only a string
  type. This prevents spurious quotes from appearing in the expansion.

     radius  "(2+4)";
     angle   "3*15";
     #eval   "$radius*sin(degToRad($angle))";

     We want to have
         '(2+4)*sin(degToRad(3*15))'
     and not
         '"(2+4)"*sin(degToRad("3*15"))'

ENH: code refactoring

- refactored expansion code with low-level service routines now
  belonging to file-scope. All expansion routines use a common
  multi-parameter backend to handle with/without dictionary etc.
  This removes a large amount of code duplication.
2019-10-07 08:27:19 +02:00
Mark Olesen
d9d29e5a8f STYLE: split off Test-string2 2019-10-04 17:52:08 +02:00