Commit Graph

23 Commits

Author SHA1 Message Date
Henry
c2dd153a14 Copyright transfered to the OpenFOAM Foundation 2011-08-14 12:17:30 +01:00
andy
eaef8d482b STYLE: Updated 1991 start copyright year to 2004 2011-01-14 16:08:00 +00:00
andy
099cc39e2e Revert "STYLE: 2011 copyright date."
This reverts commit b18f6cc1ce.
2011-01-05 18:24:29 +00:00
graham
b18f6cc1ce STYLE: 2011 copyright date. 2011-01-05 11:14:26 +00:00
Mark Olesen
499d48cfdb STYLE: uniform 'Test-' prefix for all applications/test
- easier to clean, avoid confusion with 'real' applications, etc.
2010-11-23 16:26:04 +01:00
Mark Olesen
b7c85357d5 ENH: added binary IO for PackedList and compact ASCII format
The compact ASCII format is a block of index/value tuples for the
non-zero entries:

    { (index1 value1) (index2 value2) (index3 value3) }

For PackedList<1>, and thus PackedBoolList, the compact ASCII format is
a block of indices for the non-zero entries:

    { index1 index2 index3 }

Thus either of the following could be used - for PackedList<2>:

  - a list of all values:
        16(0 3 0 2 0 0 3 1 0 0 0 0 0 0 0 1)

  - a block of index/value tuples:
        {(1 3) (3 2) (7 3) (8 1) (15 1)}

For PackedList<1> and PackedBoolList, either of the following could be
used:

  - a list of all values, using any valid bool representation:
        16(0 1 0 true 0 0 t 1 0 n n 0 0 0 0 yes)

  - a block of the indices for non-zero entries:
        {1 3 7 8 15}
2010-09-15 10:20:39 +02:00
graham
28345247a7 STYLE: Fixing code style requirements for more files - those not
picked up by a copyright change.
2010-07-29 11:28:44 +01:00
Mark Olesen
d29c438657 STYLE: use url for FSF license instead of postal address, switch to GPL v3 2010-03-29 14:07:56 +02:00
Mark Olesen
d857d671ac STYLE: use new argList argRead() method and operator[] for cleaner code.
- deprecate argList::additionalArgs() method and remove uses of it
2010-02-16 17:57:49 +01:00
Mark Olesen
063d8edea1 PackedBoolList specializaton for operator=
- now that I re-examined the code, the note in commit 51fd6327a6
  can be mostly ignored

  PackedList isMaster(nPoints, 1u);
  is not really inefficient at all, since the '1u' is packed into
  32/64-bits before the subsequent assignment and doesn't involve
  shifts/masking for each index

  The same misinformation applies to the PackedList(size, 0u) form.
  It isn't much slower at all.

  Nonetheless, add bool specialization so that it is a simple assign.
2009-12-03 16:33:58 +01:00
Mark Olesen
58b7e64185 Use argList::addOption, argList::addBoolOption (almost) everywhere
- ensure that the standard options (eg, from timeSelector) also have
  some usage information
2009-12-03 13:32:12 +01:00
Mark Olesen
ceaaabab56 bugfix PackedList for non-optimized compilation
- use shift-right instead of shift-left formulation to avoid wrong behaviour
  with non-optimized compilation when the packed items fit exactly in the
  available number of bits.
2009-07-23 22:46:52 +02:00
Mark Olesen
6c9f2520e1 added another PackedListTest 2009-07-23 15:36:46 +02:00
Mark Olesen
106d417de0 StaticAssert added
- catch people using silly template sizes for FixedList, PackedList
2009-02-27 16:41:51 +01:00
Mark Olesen
dbc9b7427a PackedList iterator bugfix
- compare iteratorBase == iteratorBase by value, not position
  thus this works
      list[a] == list[b] ...

- compare iterator == iteratorBase and const_iterator == iteratorBase
  by position, not value. The inheritance rules means that this works:
      iter == list.end() ...
  this will compare positions:
      iter == list[5];
  Of course, this will still compare values:
      *iter == list[5];
2009-02-27 13:43:43 +01:00
Mark Olesen
69918f23c5 consistency update
- OSspecific: chmod() -> chMod(), even although it's not used anywhere

- ListOps get subset() and inplaceSubset() templated on BoolListType

- added UList<bool>::operator[](..) const specialization.
  Returns false (actually pTraits<bool>::zero) for out-of-range elements.
  This lets us use List<bool> with lazy evaluation and no noticeable
  change in performance.

- use rcIndex() and fcIndex() wherever possible.
  Could check if branching or modulus is faster for fcIndex().

- UList and FixedList get 'const T* cdata() const' and 'T* data()' members.
  Similar to the STL front() and std::string::data() methods, they return a
  pointer to the first element without needing to write '&myList[0]', recast
  begin() or violate const-ness.
2009-02-06 20:43:09 +01:00
Mark Olesen
1f6733d91d PackedList - activated lazy evaluation
- moving back to original flat addressing in iterators means there is no
  performance issue with using lazy evaluation
- set() method now has ~0 for a default value.
  We can thus simply write 'set(i) to trun on all of the bits.
  This means we can use it just like labelHashSet::set(i)
- added flip() method for inverting bits. I don't know where we might need
  it, but the STL has it so we might as well too.
2009-01-30 00:07:53 +01:00
Mark Olesen
4e56643efe PackedList improvements
- dropped auto-vivification for now (performance issue), but reworked to
  allow easy reinstatement
- derived both iterator and const_iterator from iteratorBase and use
  iteratorBase as our proxy for non-const access to the list elements.
  This allows properly chaining assignments:
     list[1] = list[2];
     list[1] = list[2] = 10;
- assigning iterators from iteratorBase or other iterators works:
     iterator iter = list[20];
- made template parameter nBits=1 the default
2009-01-29 14:03:53 +01:00
Mark Olesen
7c739978b1 PackedList gets count() and trim() methods
- the bit counting is relatively fast:
  under 0.2 seconds for 1M bits counted 1000 times

- trim()'ing the final zero elements tested for a few cases,
  but might need more attention
2009-01-28 16:32:47 +01:00
Mark Olesen
84ec272d23 PackedList changes
- added Mattijs' speed tests
- optimized resize() and assignment operators to avoid set() method
- add const_iterator and re-did the proxy handling.

Reading/writing by looping across iterators is still somewhat slow, but
might be acceptable.
2009-01-26 00:33:28 +01:00
Mark Olesen
cc4cd0a171 PackedList: encapsulate calculations in an iterator
- eliminated previous PackedBitRef class, the iterator does all of that and
  can also be used to (forward) traverse the list
- no const_iterator yet

- Note that PackedList is also a bit like DynamicList in terms of storage
  management and the append() method. Since the underlying storage in
  integer, any auto-vivified elements will also flood-fill the gaps with
  zero.
2009-01-23 01:40:55 +01:00
Mark Olesen
173607fd2d PackedList gets functionality akin to DynamicList 2009-01-22 16:24:05 +01:00
Mark Olesen
6d57bb4e7b added PackedBoolList typedef (used everywhere) and improved PackedList
- new members:  capacity(), two-argument resize()/setSize(), const storage()
- new static members: max_value(), packing(), etc.
2009-01-21 11:30:10 +01:00