Skip to content
Snippets Groups Projects
  1. May 01, 2017
    • Mark OLESEN's avatar
      BUG: comparison with incorrect construction tables · dc57c016
      Mark OLESEN authored
      - previously hidden when hashtable used a static method and a
        different class for end()
      dc57c016
    • Mark OLESEN's avatar
      ENH: support UList[labelRange] and SubList construction with labelRange · 805b76d4
      Mark OLESEN authored
      This uses a concept similar to what std::valarray and std::slice do.
      A labelRange provides a convenient container for holding start/size
      and lends itself to addressing 'sliced' views of lists.
      For safety, the operations and constructors restricts the given input range
      to a valid addressible region of the underlying list, while the labelRange
      itself precludes negative sizes.
      
      The SubList version is useful for patches or other things that have a
      SubList as its parameter. Otherwise the UList [] operator will be the
      more natural solution. The slices can be done with a labelRange, or
      a {start,size} pair.
      
      Examples,
           labelList list1 = identity(20);
      
           list1[labelRange(18,10)]  = -1;
           list1[{-20,25}] = -2;
           list1[{1000,5}] = -3;
      
           const labelList list2 = identity(20);
           list2[{5,10}] = -3;  // ERROR: cannot assign to const!
      805b76d4
  2. Apr 30, 2017
  3. Apr 29, 2017
    • Mark OLESEN's avatar
      ENH: add some standard templates and macros into stdFoam.H · c65e2e58
      Mark OLESEN authored
      - some functionality similar to what the standary library <iterator>
        provides.
      
        * stdFoam::begin() and stdFoam::end() do type deduction,
          which means that many cases it is possible to manage these types
          of changes.
      
          For example, when managing a number of indices:
             Map<labelHashSet> lookup;
      
          1) Longhand:
      
              for
              (
                  Map<labelHashSet>::const_iterator iter = lookup.begin();
                  iter != lookup.end();
                  ++iter
              )
              { .... }
      
          1b) The same, but wrapped via a macro:
      
              forAllConstIter(Map<labelHashSet>, lookup, iter)
              { .... }
      
          2) Using stdFoam begin/end templates directly
      
              for
              (
                  auto iter = stdFoam::begin(lookup);
                  iter != stdFoam::end(lookup);
                  ++iter
              )
              { .... }
      
          2b) The same, but wrapped via a macro:
      
              forAllConstIters(lookup, iter)
              { .... }
      
      Note that in many cases it is possible to simply use a range-based for.
      Eg,
           labelList myList;
      
           for (auto val : myList)
           { ... }
      
           for (const auto& val : myList)
           { ... }
      
      These however will not work with any of the OpenFOAM hash-tables,
      since the standard C++ concept of an iterator would return a key,value
      pair when deferencing the *iter.
      
      The deduction methods also exhibits some slightly odd behaviour with
      some PtrLists (needs some more investigation).
      c65e2e58
    • Mark OLESEN's avatar
      ENH: improve HashSet construction and assignment · 6a5ea9a2
      Mark OLESEN authored
      - make construct from UList explicit and provide corresponding
        assignment operator.
      
      - add construct,insert,set,assignment from FixedList.
        This is convenient when dealing with things like edges or triFaces.
      6a5ea9a2
    • Mark OLESEN's avatar
      ENH: support HashTable erasure via a FixedList · a2ddf7dd
      Mark OLESEN authored
      - propagate common erasure methods as HashSet::unset() method,
        for symmetry with HashSet::set()
      a2ddf7dd
    • Mark OLESEN's avatar
      STYLE: HashTable documentation · ded105c5
      Mark OLESEN authored
      - explicitly mention the value-initialized status for the operator().
        This means that the following code will properly use an initialized
        zero.
      
            HashTable<label> regionCount;
      
            if (...)
               regionCount("region1")++;
      
            ... and also this;
      
            if (regionCount("something") > 0)
            {
                ...
            }
      
        Note that the OpenFOAM HashTable uses operator[] to provide read and
        write access to *existing* entries and will provoke a FatalError if
        the entry does not exist.
      
        The operator() provides write access to *existing* entries or will
        create the new entry as required.
        The STL hashes use operator[] for this purpose.
      ded105c5
    • Mark OLESEN's avatar
      ENH: further refinement to edge methods · 1d9b311b
      Mark OLESEN authored
      - more hash-like methods.
        Eg, insert/erase via lists, clear(), empty(),...
      
      - minVertex(), maxVertex() to return the smallest/largest label used
      
      - improved documentation, more clarification about where/how negative
        point labels are treated.
      1d9b311b
  4. May 04, 2017
  5. May 02, 2017
  6. Apr 28, 2017
  7. Apr 27, 2017
  8. Apr 26, 2017
  9. Apr 25, 2017
  10. Apr 24, 2017
  11. Apr 23, 2017
    • Mark OLESEN's avatar
      ENH: UList<point> instead of pointField for meshShapes methods · 430d8e1c
      Mark OLESEN authored
      - improves flexibility.
      
      STYLE: make longestEdge a face method and deprecate the global function
      430d8e1c
    • Mark OLESEN's avatar
      ENH: various enhancements for edge. · f2304f7c
      Mark OLESEN authored
      - support edge-ordering on construction, and additional methods:
        - sort(), sorted(), unitVec(), collapse()
      
      - null constructor initializes with -1, for consistency with face,
        triFace and since it is generally much more useful that way.
      
      - add some methods that allow edges to used somewhat more like hashes.
        - count(), found(), insert(), erase()
      
        Here is possible way to use that:
      
            edge someEdge;  // initializes with '-1' for both entries
      
            if (someEdge.insert(pt1))
            {
               // added a new point label
            }
      
            ... later
      
            // unmark point on edge
            someEdge.erase(pt2);
      
      --
      
      STYLE:
      
      - use UList<point> instead of pointField for edge methods for flexibility.
      
        The pointField include is retained, however, since many other routines
        may be relying on it being included via edge.H
      f2304f7c
  12. Apr 21, 2017
  13. Apr 20, 2017