Commit Graph

17 Commits

Author SHA1 Message Date
Mark Olesen
0fb2c8eb1c STYLE: update applications/tests to use SpanStream/CharStream 2023-10-11 18:11:37 +00:00
Mark Olesen
4412566c58 ENH: support command-line specification of MPI threads (#2791)
- MPI_THREAD_MULTIPLE is usually undesirable for performance reasons,
  but in some cases may be necessary if a linked library expects it.
  Provide a '-mpi-threads' option to explicitly request it.

ENH: consolidate some looping logic within argList
2023-06-19 17:05:45 +02:00
Mark Olesen
5a121119e6 ENH: add -verbose support into argList
- similar to -dry-run handling, can be interrogated from argList,
  which makes it simpler to add into utilities.

- support multiple uses of -dry-run and -verbose to increase the
  level. For example, could have

    someApplication -verbose -verbose

 and inside of the application:

    if (args.verbose() > 2) ...

BUG: error with empty distributed roots specification (fixes #2196)

- previously used the size of distributed roots to transmit if the
  case was running in distributed mode, but this behaves rather poorly
  with bad input. Specifically, the following questionable setup:

      distributed true;
      roots ( /*none*/ );

  Now transmit the ParRunControl distributed() value instead,
  and also emit a gentle warning for the user:

      WARNING: running distributed but did not specify roots!
2021-11-09 15:44:54 +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
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
1310e85225 ENH: support 'get()' for retrieving argList options
- previously only had 'opt<..>()' for options, but 'get<..>()'
  provides more similarity with dictionary methods.
  The 'opt<..>()' method is retained.
2019-11-26 21:07:11 +01:00
OpenFOAM bot
e9219558d7 GIT: Header file updates 2019-10-31 14:48:44 +00:00
Mark Olesen
e9323ecbbb STYLE: use finiteVolume in Make/options placeholder 2019-02-24 17:32:13 +01:00
Mark Olesen
455c8ef540 ENH: simplify use of case-relative paths
- provide relativePath() for argList and for Time.
  These are relative to the case globalPath().
  Eg,

     Info<< "output: " << runTime.relativePath(outputFile) << nl;
2018-12-15 13:26:55 +01:00
Mark Olesen
5d9e278e92 ENH: consolidate handling of mandatory/optional command arguments
- for some special cases we wish to mark command-line arguments as
  being optional, in order to do our own treatment. For example,
  when an arbitrary number of arguments should be allowed.

  Now tag this situation with argList::noMandatoryArgs().
  The argList::argsMandatory() query can then be used in any further
  logic, including the standard default argument checking.

- with the new default check, can consolidate the special-purpose

      "setRootCaseNonMandatoryArgs.H"

  into the regular

      "setRootCase.H"

- revert to a simple "setRootCase.H" and move all the listing related
  bits to a "setRootCaseLists.H" file. This leaves the information
  available for solvers, or whoever else wishes, without being
  introduced everywhere.

- add include guards and scoping to the listing files and rename to
  something less generic.

     listOptions.H -> setRootCaseListOptions.H
     listOutput.H  -> setRootCaseListOutput.H
2018-12-13 01:45:09 +01:00
Mark Olesen
f7c85b034b STYLE: clearer handling of argList -case internals (issue #1037) 2018-10-11 08:32:43 +02:00
Mark Olesen
ae36f5f504 ENH: change argList get<> and getList<> from read<>, readList<>
- more consistent with dictionary method naming. The get<> or
  getList<> returns a value, doesn't read into a existing location.
2018-08-09 11:27:36 +02:00
Mark Olesen
adbbd0e678 ENH: add argList option ignoring for compatibility upgrades
- can be used to handle when options become redundant, but it is
  undesirable to treat its presence as an error. Can now tag it as
  being ignored.

     argList::ignoreOptionCompat({"oldOption", 1706}, true);
     argList::ignoreOptionCompat({"oldBoolOpttion", 1706}, false);

     command  -oldOption xyz -oldBoolOpttion
2018-01-08 16:25:27 +01:00
Mark Olesen
345a2a42f1 ENH: simplify method names for reading argList options and arguments
- use succincter method names that more closely resemble dictionary
  and HashTable method names. This improves method name consistency
  between classes and also requires less typing effort:

    args.found(optName)        vs.  args.optionFound(optName)
    args.readIfPresent(..)     vs.  args.optionReadIfPresent(..)
    ...
    args.opt<scalar>(optName)  vs.  args.optionRead<scalar>(optName)
    args.read<scalar>(index)   vs.  args.argRead<scalar>(index)

- the older method names forms have been retained for code compatibility,
  but are now deprecated
2018-01-08 15:35:18 +01:00
Mark Olesen
f38ad72ad0 ENH: add argList::optionCount method
- convenience for checking is any/all particular options have been
  specified. Eg,

  if (args.optionCount({"opt1", "opt2", "opt3"}) < 3) ...
2017-12-19 08:20:45 +01:00
Mark Olesen
aa112c3f26 ENH: support option aliases with versioning
- can be used for adjusting option names between versions
2017-11-22 14:42:31 +01:00
Mark Olesen
66104f2569 ENH: improve input stringency for argList options
Previously:

  - bad command-line input such as -label 1234xyz would parse as a
    label (with value 1234) and the trailing junk would be silently
    ignored. This may or may not be appropriate. If the trailing junk
    looked like this '100E' or '1000E-' (ie, forgot to type the
    exponent), the incorrectly parsed values can be quite bad:

        label  = 32684
        scalar = 6.93556e-310

Now:

  - use the updated readLabel/readScalar routines that trigger a
    FatalIOError on bad input:

        --> FOAM FATAL IO ERROR:
        Trailing content found parsing '1234xyz'

        --> FOAM FATAL IO ERROR:
        Trailing content found parsing '100E'

   This traps erroneous command-line input immediately.
2017-09-21 16:53:46 +02:00