Commit Graph

23 Commits

Author SHA1 Message Date
Andrew Heather
a2014242cf RELEASE: Updated headers for v2112 2021-12-20 14:18:01 +00:00
Mark Olesen
1804d3fed5 ENH: additional #word and #message dictionary directives (#2276)
- use `#word` to concatenate, expand content with the resulting string
  being treated as a word token. Can be used in dictionary or
  primitive context.

  In dictionary context, it fills the gap for constructing dictionary
  names on-the-fly. For example,

  ```
  #word "some_prefix_solverInfo_${application}"
  {
      type    solverInfo;
      libs    (utilityFunctionObjects);
      ...
  }
  ```

  The '#word' directive will automatically squeeze out non-word
  characters. In the block content form, it will also strip out
  comments. This means that this type of content should also work:

  ```
  #word {
     some_prefix_solverInfo
     /* Appended with application name (if defined) */
     ${application:+_}  // Use '_' separator
     ${application}     // The application
  }
  {
      type    solverInfo;
      libs    (utilityFunctionObjects);
      ...
  }
  ```
  This is admittedly quite ugly, but illustrates its capabilities.

- use `#message` to report expanded string content to stderr.
  For example,

  ```
  T
  {
     solver          PBiCG;
     preconditioner  DILU;
     tolerance       1e-10;
     relTol          0;
     #message "using solver: $solver"
  }
  ```
  Only reports on the master node.
2021-11-25 17:05:37 +01:00
Andrew Heather
e3796745ed CONFIG: Updated headers to v2106
Minor clean-up
2021-06-28 09:14:42 +01:00
Mark Olesen
96a1b86fb9 ENH: consistency improvements for keyType and wordRe
- simplify compile/uncompile, reading, assignment

- implicit construct wordRe from keyType (was explicit) to simplify
  future API changes.

- make Foam::isspace consistent with std::isspace (C-locale)
  by including vertical tab and form feed

ENH: improve #ifeq float/label comparisons
2021-04-19 16:33:42 +00:00
Andrew Heather
79e353b84e RELEASE: Updated version to v2012 2020-12-23 10:01:39 +01:00
Mark Olesen
44052de594 TUT: skip some tutorials when dynamicCode is not available
- silence failed restoration of controlDict from controlDict.orig
  (idempotent?)
2020-08-06 19:34:20 +02:00
Andrew Heather
538d749220 REL: Updated headers to version v2006 2020-06-29 17:27:54 +01:00
Mark Olesen
083181cac4 ENH: handle entry alternatives outside of string expansion
- string expansions have supported "${var:-default}" syntax for
  several versions, but this did not apply plain dictionary expansions.

  Eg, the following did not parse

     massFlow  ${entry1:-100};

ENH: remove content and length restriction on '${..}' quoted variables

- allows this type of content:

     velocity2  ${velocity1:- ( 0 -100 10) };

- accept empty parameter strings for entries. This allows the
  following expansion to work as expected:

      hex (n1 n2..)  ${inletBlock:-} (10 10 10) simpleGrading (1 1 1)

  ie, optionally define the cellZone name for a given block

ENH: add single parameter dictionary writeEntry method.

- the dictionary knows its own name (dictName), which can be used
  when writing content
2020-02-21 14:37:11 +01:00
Andrew Heather
ae2ab06312 REL: Release preparations 2019-12-23 09:49:23 +00: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
9e6683f7bc ENH: add conditionals to #eval (string to scalar)
Example,

     ($radius > 10) ? sin(degToRad(45)) : cos(degToRad(30))

- protect division and modulo against zero-divide.

- add scanner/parser debugging switches in the namespace,
  selectable as "stringToScalar". For example,

    debug parser:  foamDictionary -debug-switch stringToScalar=2
    debug scanner: foamDictionary -debug-switch stringToScalar=4
    debug both:    foamDictionary -debug-switch stringToScalar=6
2019-11-19 14:22:03 +01:00
Mark Olesen
a5a222f7cf ENH: support scalar tokens when testing #if, #ifeq
- this allows use of #eval results in the tests
2019-11-19 09:00:00 +01:00
Mark Olesen
98467036b3 STYLE: regularize quoting and exit on failed 'cd' 2019-11-13 13:19:16 +01:00
Mark Olesen
e6dfb39c66 STYLE: remove unnecessary stdout, stderr /dev/null redirects
- no stderr redirect needed:
    * 'command -v'

- no stdout/stderr redirect needed:
    * 'rm -f'

STYLE: consistent spacing after redirects
2019-11-06 10:44:36 +01:00
Mark Olesen
ec7e3c88e4 ENH: test for WM_PROJECT_DIR being set/unset in scripts 2019-11-06 09:18:51 +01:00
Andrew Heather
be44dcaf1f RELEASE: Version clean-up for release 2019-06-25 11:51:19 +01:00
Mark Olesen
966fc4c503 TUT: add missing fields 2019-02-12 16:46:40 +01:00
Mattijs Janssens
e6f8dfecec Feature merge OpenFOAM.org 2019-01-10 10:10:06 +00:00
Andrew Heather
9231534efa STYLE: Updating version to v1812 2018-12-19 18:07:52 +00:00
Mark Olesen
b5d4d59ff1 TUT: add Alltest for IO/dictionary
- runs in non-verbose mode to avoid spurious detection of FatalError
2018-11-27 11:11:47 +01:00
Mark Olesen
4d03e4386d STYLE: update version info in some tutorial files 2018-08-14 11:58:52 +02:00
Mark Olesen
109a791d35 TUT: adjust dictionary parsing tests 2018-07-05 11:09:40 +02:00
Mark Olesen
f3f30c94b4 ENH: improve detection of EOF missing/additional braces (issue #762)
- stricter checking for common dictionary input errors such as a
  missing ';' for primitive entries, extra or missing closing '}' etc.
2018-07-04 09:24:43 +02:00