1. 17 May, 2017 6 commits
    • Mark OLESEN's avatar
    • Mark OLESEN's avatar
    • Mark OLESEN's avatar
      ENH: simplify foamToEnsight using new IOobjectList methods · b2edd738
      Mark OLESEN authored
      BUG: foamToEnsight fails with missing field at time 0 (fixes #473)
    • Mark OLESEN's avatar
      ENH: added classes() method to objectRegistry/IOobjectList · 9761e9d8
      Mark OLESEN authored
      - provides a summary hash of classes used and their associated object names.
        The HashTable representation allows us to leverage various HashTable
        methods. This hashed summary view can be useful when querying
        particular aspects, but is most useful when reducing the objects in
        consideration to a particular subset. For example,
            const wordHashSet interestingTypes
            IOobjectList objects(runTime, runTime.timeName());
            HashTable<wordHashSet> classes = objects.classes();
            // Or do just the opposite:
        Can also use the underlying HashTable filter methods
      STYLE: use templated internals to avoid findString() when matching subsets
    • Mark OLESEN's avatar
      ENH: added HashTable count, filter and generalized toc methods · cf889306
      Mark OLESEN authored
      - Generalized means over filtering table entries based on their keys,
        values, or both.  Either filter (retain), or optionally prune elements
        that satisfy the specified predicate.
        filterKeys and filterValues:
        - Take a unary predicate with the signature
              bool operator()(const Key& k);
        - filterEntries:
          Takes a binary predicate with the signature
              bool operator()(const Key& k, const T& v);
        The predicates can be normal class methods, or provide on-the-fly
        using a C++ lambda. For example,
            wordRes goodFields = ...;
                [&goodFields](const word& k){ return goodFields.match(k); }
        Note that all classes that can match a string (eg, regExp, keyType,
        wordRe, wordRes) or that are derived from a Foam::string (eg, fileName,
        word) are provided with a corresponding
            bool operator()(const std::string&)
        that either performs a regular expression or a literal match.
        This allows such objects to be used directly as a unary predicate
        when filtering any string hash keys.
        Note that HashSet and hashedWordList both have the proper
        operator() methods that also allow them to be used as a unary
      - Similar predicate selection with the following:
          * tocKeys, tocValues, tocEntries
          * countKeys, countValues, countEntries
        except that instead of pruning, there is a simple logic inversion.
    • Mark OLESEN's avatar
      ENH: added constant predicates · 8d018e79
      Mark OLESEN authored
      - predicates::always and predicates::never returning true and false,
        respectively. These simple classes make it easier when writing
        templated code.
        As well as unary and binary predicate forms, they also contain a
        match(std::string) method for compatibility with regex-based classes.
      STYLE: write bool and direction as primitive 'int' not as 'label'.
  2. 16 May, 2017 2 commits
    • Mark OLESEN's avatar
      ENH: cleanup wordRe interfaces etc. · a8d2ebf2
      Mark OLESEN authored
      - ensure that the string-related classes have consistently similar
        matching methods. Use operator()(const std::string) as an entry
        point for the match() method, which makes it easier to use for
        filters and predicates. In some cases this will also permit using
        a HashSet as a match predicate.
      - the set method now returns a bool to signal that the requested
        pattern was compiled.
      - have separate constructors with the compilation option (was previously
        a default parameter). This leaves the single parameter constructor
        explicit, but the two parameter version is now non-explicit, which
        makes it easier to use when building lists.
      - renamed compile-option from REGEX (to REGEXP) for consistency with
        with the <regex.h>, <regex> header names etc.
      - renamed from wordReListMatcher -> wordRes. For reduced typing and
        since it behaves as an entity only slightly related to its underlying
        list nature.
      - Provide old name as typedef and include for code transition.
      - pass through some list methods into wordRes
      - hashedWordList[const word& name] now returns a -1 if the name is is
        not found in the list of indices. That has been a pending change
        ever since hashedWordList was generalized out of speciesTable
      - add operator()(const word& name) for easy use as a predicate
      STYLE: adjust parameter names in stringListOps
      - reflect if the parameter is being used as a primary matcher, or the
        matcher will be derived from the parameter.
        For example,
            (const char* re), which first creates a regExp
            versus (const regExp& matcher) which is used directly.
    • Mark OLESEN's avatar
      ENH: pass through doc/Allwmake arguments, add -config, -dir options · c1c6243c
      Mark OLESEN authored
      - can run doxygen with an alternative Doxyfile, which is useful
        when verifying generated content for particular classes.
            PATH/doc/Allwmake -dir $PWD
  3. 17 May, 2017 2 commits
  4. 15 May, 2017 5 commits
  5. 14 May, 2017 3 commits
    • Mark OLESEN's avatar
      BUG: hashtable key_iterator ++ operator returning incorrect type · 4b0d1632
      Mark OLESEN authored
      ENH: ensure std::distance works with hashtable iterators
    • Mark OLESEN's avatar
      ENH: avoid std::distance for std::initializer_list · 0c53a815
      Mark OLESEN authored
      - std::initializer_list has its own size() method, so no need to use
      STYLE/BUG: use separate iterator de-reference and increment in List
      - avoids unnecessary copying of iterators, and avoids any potentially
        odd behaviour with the combination with incrementing.
      ENH: support construct from iterator pair for DynamicList, SortableList
    • Mark OLESEN's avatar
      ENH: improvements to labelRange const_iterator · 83669e28
      Mark OLESEN authored
      - inherit from std::iterator to obtain the full STL typedefs, meaning
        that std::distance works and the following is now possible:
            labelRange range(100, 1500);
            scalarList list(range.begin(), range.end());
        Note that this does not work (mismatched data-types):
            scalarList list = identity(12345);
        But this does, since the *iter promotes label to scalar:
            labelList ident = identity(12345);
            scalarList list(ident.begin(), ident.end());
        It is however more than slightly wasteful to create a labelList
        just for initializing a scalarList. An alternative could be a
        a labelRange for the same purpose.
            labelRange ident = labelRange::identity(12345);
            scalarList list(ident.begin(), ident.end());
        Or this
            scalarList list
  6. 12 May, 2017 1 commit
  7. 11 May, 2017 1 commit
    • Mark OLESEN's avatar
      ENH: added HashTable 'lookup' and 'retain' methods · f73b5b62
      Mark OLESEN authored
      - lookup(): with a default value (const access)
        For example,
            Map<label> something;
            value = something.lookup(key, -1);
          being equivalent to the following:
            Map<label> something;
            value = -1;  // bad value
            if (something.found(key))
                value = something[key];
          except that lookup also makes it convenient to handle const references.
            const labelList& ids = someHash.lookup(key, labelList());
      - For consistency, provide a two parameter HashTable '()' operator.
        The lookup() method is, however, normally preferable when
        const-only access is to be ensured.
      - retain(): the counterpart to erase(), it only retains entries
        corresponding to the listed keys.
        For example,
            HashTable<someType> largeCache;
            wordHashSet preserve = ...;
          being roughly equivalent to the following two-stage process,
          but with reduced overhead and typing, and fewer potential mistakes.
            HashTable<someType> largeCache;
            wordHashSet preserve = ...;
                wordHashSet cull(largeCache.toc()); // all keys
                cull.erase(preserve);               // except those to preserve
                largeCache.erase(cull);             //
        The HashSet &= operator and retain() are functionally equivalent,
        but retain() also works with dissimilar value types.
  8. 10 May, 2017 2 commits
  9. 08 May, 2017 6 commits
  10. 07 May, 2017 2 commits
  11. 05 May, 2017 3 commits
  12. 04 May, 2017 7 commits