Skip to content
  • Mark OLESEN's avatar
    ENH: additional #word and #message dictionary directives (#2276) · 1804d3fe
    Mark OLESEN authored
    - 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.
    1804d3fe