Skip to content
Snippets Groups Projects
  1. Jul 12, 2019
    • Mark OLESEN's avatar
      ENH: properly trap incorrect enumerations (#1372) · ca5e7a52
      Mark OLESEN authored
      - the Enum::readEntry() method was previously as bit sloppy with
        respect to the enumeration that it accepted. If the input was
        non-mandatory, typos would go unnoticed. Now tighten things so that
        if an enumeration is found, it must also be valid.
      
      STYLE: remove unused/deprecated Enum::lookupOrFailsafe() method
      
      - this was only used in a few places internally in 1712 and 1806 but
        has since then been superseded by getOrDefault() with an optional
        'failsafe' flag.
      ca5e7a52
  2. May 21, 2019
    • Mark OLESEN's avatar
      ENH: dictionary checking methods with predicates on the input values · 32916fa8
      Mark OLESEN authored
      - can be used to check the validity of input values.
      
      Example:
      
          dict.getCheck<label>("nIters", greaterOp1<label>(0));
          dict.getCheck<scalar>("relax", scalarMinMax::zero_one());
      
      - use 'get' prefix for more regular dictionary methods.
        Eg, getOrDefault() as alternative to lookupOrDefault()
      
      - additional ops for convenient construction of predicates
      
      ENH: make dictionary writeOptionalEntries integer
      
      - allow triggering of Fatal if default values are used
      
      ENH: additional scalarRange static methods: ge0, gt0, zero_one
      
      - use GREAT instead of VGREAT for internal placeholders
      
      - additional MinMax static methods: gt, le
      32916fa8
  3. Feb 08, 2019
  4. Nov 11, 2018
  5. Oct 18, 2018
    • Mark OLESEN's avatar
      ENH: cleanup of Enum class · 3b745122
      Mark OLESEN authored
      - more dictionary-like methods, enforce keyType::LITERAL for all
        lookups to avoid any spurious keyword matching.
      
      - new readEntry, readIfPresent methods
      
      - The get() method replaces the now deprecate lookup() method.
      
      - Deprecate lookupOrFailsafe()
        Failsafe behaviour is now an optional parameter for lookupOrDefault,
        which makes it easier to tailor behaviour at runtime.
      
      - output of the names is now always flatted without line-breaks.
        Thus,
      
           os << flatOutput(someEnumNames.names()) << nl;
           os << someEnumNames << nl;
      
        both generate the same output.
      
      - Constructor now uses C-string (const char*) directly instead of
        Foam::word in its initializer_list.
      
      - Remove special enum + initializer_list constructor form since
        it can create unbounded lookup indices.
      
      - Removd old hasEnum, hasName forms that were provided during initial
        transition from NamedEnum.
      
      - Added static_assert on Enum contents to restrict to enum or
        integral values.  Should not likely be using this class to enumerate
        other things since it internally uses an 'int' for its values.
      
        Changed volumeType accordingly to enumerate on its type (enum),
        not the class itself.
      3b745122
  6. Sep 19, 2018
  7. May 30, 2018
  8. Nov 04, 2017
  9. Nov 28, 2017
    • Mark OLESEN's avatar
      ENH: minor improvements for Enum · c0e86940
      Mark OLESEN authored
      - found() method for consistency with other classes
      
      - operator()(name, deflt) for similarity to lookupOrDefault,
        but without a dictionary
      c0e86940
  10. Jul 07, 2017
  11. May 29, 2017
    • Mark OLESEN's avatar
      ENH: Enum class as drop-in alternative for NamedEnum · 8afc6cbd
      Mark OLESEN authored
      - the NamedEnum wrapper is somewhate too rigid.
        * All enumerated values are contiguous, starting as zero.
        * The implicit one-to-one mapping precludes using it for aliases.
        * For example, perhaps we want to support alternative lookup names for an
          enumeration, or manage an enumeration lookup for a sub-range.
      8afc6cbd
    • Mark OLESEN's avatar
      ENH: cleanup of NamedEnum · fb497164
      Mark OLESEN authored
      - Remove the unused enums() method since it delivers wholly unreliable
        results. It is not guaranteed to cover the full enumeration range,
        but only the listed names.
      
      - Remove the unused strings() method.
        Duplicated functionality of the words(), but was never used.
      
      - Change access of words() method from static to object.
        Better code isolation. Permits the constructor to take over
        as the single point of failure for bad input.
      
      - Add values() method
      
      - do not expose internal (HashTable) lookup since it makes it more
        difficult to enforce constness and the implementation detail should
        not be exposed. However leave toc() and sortedToc() for the interface.
      
      STYLE: relocated NamedEnum under primitives (was containers)
      
      - internal typedef as 'value_type' for some consistency with STL conventions
      fb497164
  12. May 26, 2017
    • Mark OLESEN's avatar
    • Mark OLESEN's avatar
      ENH: HashTable cfind() method returning a const_iterator · b8300759
      Mark OLESEN authored
      - This follows the same idea as cbegin/cend and is helpful when using
        C++11 auto to ensure we have unambiguous const-safe access.
      
        Previously:
        ====
          typename someLongClass::const_iterator iter = someTable.find(key);
      
          ... later on:
          *iter = value; // Oops, but caught by compiler.
      
        We can save some typing with auto, but it is uncertain what we get:
        ====
          auto iter = someTable.find(key);
              // iterator or const_iterator?
              // depends on someTable having const or non-const access.
      
          ... later on:
          *iter = value;  // Oops, but not caught by compiler.
      
        Using cfind instead, auto will deduce const_iterator as the type:
        ====
          auto iter = someTable.cfind(key);  // definitely const_iterator
      
          ... later on:
          *iter = value; // Oops, but caught by compiler.
      b8300759
  13. Feb 02, 2017
  14. Sep 27, 2016
  15. Apr 26, 2016
  16. Feb 28, 2016
  17. Aug 14, 2011
  18. Jan 19, 2011
  19. Jan 14, 2011
  20. Jan 07, 2011
  21. Jan 05, 2011
  22. Nov 17, 2010
  23. Jul 28, 2010
  24. Mar 29, 2010
  25. Mar 04, 2009
    • Mark Olesen's avatar
      Switched from old hashing functions to use Bob Jenkins' hash routine · 17548296
      Mark Olesen authored
      - If the underlying type is contiguous, FixedList hashes its storage directly.
      - Drop labelPairHash (non-commutative) from fvMeshDistribute since
        FixedList::Hash does the right thing anyhow.
      - Hash<edge> specialization is commutative, without multiplication.
      - Hash<triFace> specialization kept multiplication (but now uLabel).
        There's not much point optimizing it, since it's not used much anyhow.
      
      Misc. changes
      
      - added StaticAssert to NamedEnum.H
      - label.H / uLabel.H : define FOAM_LABEL_MAX, FOAM_ULABEL_MAX with the
        values finally used for the storage.  These can be useful for pre-processor
        checks elsewhere (although I stopped needing them in the meantime).
      17548296
  26. Jan 05, 2009
    • Mark Olesen's avatar
      rename xfer<T> class to Xfer<T> · 19503c93
      Mark Olesen authored
      - The capitalization is consistent with most other template classes, but
        more importantly frees up xfer() for use as method name without needing
        special treatment to avoid ambiguities.
      
        It seems reasonable to have different names for transfer(...) and xfer()
        methods, since the transfer is occuring in different directions.
        The xfer() method can thus replace the recently introduced zero-parameter
        transfer() methods.
        Other name candidates (eg, yield, release, etc.) were deemed too abstract.
      19503c93
  27. Dec 31, 2008
  28. Jun 25, 2008
  29. Apr 15, 2008