Commit Graph

14 Commits

Author SHA1 Message Date
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
ae02a86562 ENH: multi-region support for reconstructParMesh (#2072) 2021-06-11 17:18:35 +02:00
Mark Olesen
c410edf928 ENH: centralized handling of -allRegions, -regions, -region (#2072)
Step 1.
    include "addAllRegionOptions.H"

    Adds the -allRegions, -regions and -region options to argList.

Step 2.
    include "getAllRegionOptions.H"

    Processes the options with -allRegions selecting everything
    from the regionProperties.

    OR use -regions to specify multiple regions (from
       regionProperties), and can also contain regular expressions

    OR use the -region option

    Specifying a single -regions NAME (not a regular expresssion)
    is the same as -region NAME and doesn't use regionProperties

    Creates a `wordList regionNames`

Step 3.
    Do something with the region names.
    Either directly, or quite commonly with the following

    include "createNamedMeshes.H"

    Creates a `PtrList<fvMesh> meshes`

STYLE: add description to some central include files
2021-05-07 09:46:33 +02:00
Mark Olesen
b060378dca ENH: improve consistency of fileName handling windows/non-windows (#2057)
- wrap command-line retrieval of fileName with an implicit validate.

  Instead of this:
      fileName input(args[1]);
      fileName other(args["someopt"]);

  Now use this:
      auto input = args.get<fileName>(1);
      auto other = args.get<fileName>("someopt");

  which adds a fileName::validate on the inputs

  Because of how it is implemented, it will automatically also apply
  to argList getOrDefault<fileName>, readIfPresent<fileName> etc.

- adjust fileName::validate and clean to handle backslash conversion.
  This makes it easier to ensure that path names arising from MS-Windows
  are consistently handled internally.

- dictionarySearch: now check for initial '/' directly instead of
  relying on fileName isAbsolute(), which now does more things

BREAKING: remove fileName::clean() const method

- relying on const/non-const to control the behaviour (inplace change
  or return a copy) is too fragile and the const version was
  almost never used.

  Replace:
      fileName sanitized = constPath.clean();

  With:
      fileName sanitized(constPath);
      sanitized.clean());

STYLE: test empty() instead of comparing with fileName::null
2021-04-19 16:33:42 +00:00
Mark Olesen
cdbc3e2de6 ENH: List/DynamicList appendUniq() method
- affords some code reduction.

STYLE: use HashSet insert() without found() check in more places
2021-04-19 16:33:42 +00: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
29a5793b5b STYLE: argList::opt method instead of the longer argList::lookupOrDefault
- also replaced a few instances of readIfPresent with opt<> for
  constant values.
2018-12-12 12:10:39 +01:00
Mark Olesen
7cb5b638ad STYLE: more consistency in handling of -region vs -allRegions 2018-07-19 09:15:33 +02: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
f2ba618c19 STYLE: consistency in using argList::addArgument, argList::addOption 2017-11-22 12:54:28 +01:00
Mark Olesen
7d7b0bfe84 STYLE: use list methods find/found instead of findIndex function 2017-10-24 19:07:34 +02:00
Mark Olesen
e9254eee58 ENH: support KaHIP decomposition
- refactor some common metis-like elements into the metisLikeDecomp
  abstract class.
2017-10-09 21:00:34 +02:00