Commit Graph

13 Commits

Author SHA1 Message Date
Mark Olesen
1d43e45fdd ENH: add test application for fileHander writing
COMP: update applications/test
2023-10-11 18:11:37 +00:00
Mark Olesen
eeb9d144e3 STYLE: qualify Swap with Foam:: prefix (visibility)
- drop unnecessary Foam::Swap specializations when MoveConstructible
  and MoveAssignable already apply. The explicit redirect to swap
  member functions was needed before proper move semantics where
  added.

  Removed specializations: autoPtr, refPtr, tmp, UList.
  Retained specialization: DynamicList, FixedList.

     Special handling for DynamicList is only to accommodate dissimilar
     sizing template parameters (which probably doesn't occur in
     practice).
     Special handling for FixedList to apply element-wise swapping.

- use std::swap for primitives. No need to mask with Foam::Swap wrapper
2023-08-16 12:28:09 +02:00
Mark Olesen
129b738136 ENH: define IOobjectList::csorted(), deprecate some sorted() const methods
- prefer csorted() method for const access since it ensures that the
  return values are also const pointers (for example) even if
  the object itself can be accessed as a non-const.

- the csorted() method already existed for HashTable and
  objectRegistry, but now added to IOobjectList for method name
  consistency (even although the IOobjectList only has a const-access
  version)

ENH: objectRegistry with templated strict lookup

- for lookupClass and csorted/sorted. Allows isType restriction as a
  compile-time specification.
2023-07-31 20:11:32 +02:00
Mark Olesen
7afebef509 ENH: HashTable sorted() method
- the sorted() method fills a UPtrList with sorted entries. In some
  places this can provide a more convenient means of traversing a
  HashTable in consistent order, without the extra step of creating
  a sortedToc(). The sorted() method with a UPtrList will also have
  a lower overhead than creating any sortedToc() or toc() since it is
  list of pointers and not full copies of the keys.

  Instead of this:

      HashTable<someType> table = ...;

      for (const word& key : table.sortedToc())
      {
          Info<< key << " => " << table[key] << nl;
      }

  can write this:

      for (const auto& iter : table.sorted())
      {
          Info<< iter.key() << " => " << iter.val() << nl;
      }

STYLE:

- declare hash entry key 'const' since it is immutable
2022-05-10 10:47:01 +02:00
Mark Olesen
327c43f3e8 ENH: identityOp as equivalent to std::identity (C++20)
- similar to how noOp was defined, but with perfect forwarding

STYLE: combine Swap into stdFoam

STYLE: capitalize FileOp, NegateOp template parameters
2022-03-13 22:35:18 +01:00
Mark Olesen
8884d58a52 STYLE: fix/correct some tests. Remove useless tests 2021-07-05 14:55:37 +02:00
OpenFOAM bot
e9219558d7 GIT: Header file updates 2019-10-31 14:48:44 +00:00
OpenFOAM bot
154029ddd0 BOT: Cleaned up header files 2019-02-06 12:28:23 +00:00
Mark Olesen
ed94a2714d STYLE: use HashTable iterator 'val()' method instead of 'object()' 2019-01-18 16:26:50 +01:00
Mark Olesen
915e8c9f35 ENH: remove Foam::Swap specializations for HashSet, HashTable
- without these will use the normal move construct + move assign.
  This is similarly efficient, but avoids the inadvertently having the
  incorrect Swap being used for derived classes.

STYLE: remove unused xfer methods for HashTable, HashSet

- unneeded since move construct and move assignment are possible
2018-01-25 12:13:16 +01:00
Mark Olesen
03b287ed24 COMP: adjust tests to compile with current code base 2018-02-20 17:24:08 +01:00
Mark Olesen
39ee5d5079 ENH: add HashTable += operation (combines HashTables)
- adjust return values of HashSet operators.
2018-01-23 16:35:43 +01:00
Mark Olesen
053a648ee6 ENH: improvements to HashTable internals
- make single-parameter construct (label) explicit
- consolidate iterators
- slightly reduced overhead for some HashSet types
- improved resizing behaviour
- compact output for empty Ptr hashes
2017-10-31 08:46:47 +01:00