Go to file
Mark Olesen f73b5b629f ENH: added HashTable 'lookup' and 'retain' methods
- 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.
    Eg,

      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 = ...;

      largeCache.retain(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.
2017-05-11 12:25:35 +02:00
applications ENH: added HashTable 'lookup' and 'retain' methods 2017-05-11 12:25:35 +02:00
bin BUG: foamCleanPath not removing duplicate non-existent directories 2017-04-20 13:04:46 +02:00
doc STYLE: avoid explicit use of 'word' as HashTable template parameter 2017-05-10 13:44:27 +02:00
etc CONFIG: address differences between shells 2017-04-20 11:02:54 +02:00
src ENH: added HashTable 'lookup' and 'retain' methods 2017-05-11 12:25:35 +02:00
tutorials Merge branch 'master' into develop 2017-04-25 12:31:22 +01:00
wmake COMP: skip compilation of plugins if include files are missing (fixes #464) 2017-05-05 10:02:34 +02:00
.gitignore ENH: improve MPI configuration possibilities 2017-03-29 13:48:54 +02:00
Allwmake ENH: reduce reliance on FOAM_EXT_LIBBIN during builds 2017-04-04 15:28:42 +02:00
BuildIssues.txt COMP: silence some compiler warnings 2017-02-21 12:56:27 +01:00
COPYING Copyright transfered to the OpenFOAM Foundation 2011-08-14 12:17:30 +01:00
README.md STYLE: Corrected typo 2017-03-22 09:11:47 +00:00

About OpenFOAM

OpenFOAM is a free, open source CFD software released and developed primarily by OpenCFD Ltd since 2004. It has a large user base across most areas of engineering and science, from both commercial and academic organisations. OpenFOAM has an extensive range of features to solve anything from complex fluid flows involving chemical reactions, turbulence and heat transfer, to acoustics, solid mechanics and electromagnetics. More...

OpenFOAM+ is professionally released every six months to include customer sponsored developments and contributions from the community, including the OpenFOAM Foundation. Releases designated OpenFOAM+ contain several man years of client-sponsored developments of which much has been transferred to, but not released in the OpenFOAM Foundation branch.

Copyright

OpenFOAM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. See the file COPYING in this directory or http://www.gnu.org/licenses/, for a description of the GNU General Public License terms under which you can copy the files.

OpenFOAM Trademark

OpenCFD Ltd grants use of the OpenFOAM trademark by Third Parties on a licence basis. ESI Group and the OpenFOAM Foundation Ltd are currently permitted to use the Name and agreed Domain Name. For information on trademark use, please refer to the trademark policy guidelines.

Please contact OpenCFD if you have any questions on the use of the OpenFOAM trademark.

Violations of the Trademark are continuously monitored, and will be duly prosecuted.

Useful Links

Copyright 2016-2017 OpenCFD Ltd