Commit Graph

8 Commits

Author SHA1 Message Date
Mark Olesen
8cfb483054 STYLE: some general spelling fixes 2020-05-04 09:15:21 +02: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
4965ea4988 ENH: simplify/extend objectRegistry code with templated predicates
- replace explicit use of wordRe, wordRes, wordHashSet as filters
  with a MatchPredicate.

- support filtering by class based on <Type> or predicates
2018-11-10 17:20:32 +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
f2ba618c19 STYLE: consistency in using argList::addArgument, argList::addOption 2017-11-22 12:54:28 +01:00
Mark Olesen
92fa5a1921 ENH: improve objectRegistry functionality (issue #322)
- Recursive searching for objects within a registry is now optional
  (previous it was always done).

  A recursive search effectively blocks the construction of sub-sub-registries
  if their names are 'masked' by some parent level sub-registry with
  the same name! (BUG)

- Recursive search is now turned OFF by default, which makes it consistent
  with dictionary and probably causes the least number of surprises.

----
Various new convenience methods added:

lookupObjectRef()
- returns a non-const reference.
  For example,

      volScalarField& U = mesh().lookupObjectRef<volScalarField>("U");

  Instead of

      volScalarField& U = const_cast<volScalarField&>
      (
          mesh().lookupObject<volScalarField>("U")
      );

--
lookupObjectPtr()
- returns a const pointer, and nullptr on failure.
  For example,

      const volScalarField* Uptr = mesh().lookupObjectPtr<volScalarField>("U");
      if (Uptr)
      {
          const volScalarField& U = *Uptr;
          ...
      }

  Instead of

      if (mesh().foundObject<volScalarField>("U"))
      {
          const volScalarField& U = mesh().lookupObject<volScalarField>("U");
          ...
      }

--
lookupObjectRefPtr()
- returns a non-const pointer, and nullptr on failure.
  For example,

      volScalarField* Uptr = mesh().lookupObjectRefPtr<volScalarField>("U");
      if (Uptr)
      {
          volScalarField& U = *Uptr;  // use as reference
          (*Uptr) = ...;              // or use directly
      }

  Instead of

      if (mesh().foundObject<volScalarField>("U"))
      {
          volScalarField& U = const_cast<volScalarField&>
          (
              mesh().lookupObject<volScalarField>("U")
          );
      }

--
sortedNames()
- now works with template parameters and with regular expression
  matching as well.
  For example,

      wordList names  = mesh().sortedNames();
      wordList fields = mesh().sortedName<volScalarField>();

  Instead of

      wordList names  = mesh().sortedNames();
      wordList fields = mesh().names<volScalarField>();
      Foam::sort(fields);

--
2016-12-01 13:04:07 +01:00
Mark Olesen
8628ddac43 ENH: add Test-objectRegistry (issue #322)
- test clearly shows failure to insert a sub-registry when it has
  the same name as one of the parent sub-registry.
2016-12-01 12:30:38 +01:00