- objectRegistry gets a rename() that also adjusts the dbDir
- cloud reworked to use static variables subInstance and defaultName.
This avoids writing "lagrangian" everywhere
string fixes
- avoid masking of std::string::replace in string.H
- avoid old strstream in PV3FoamReader
- regIOobject: don't re-register an unregister object on rename/assignment
- Hasher: split-off HasherInt with uint32_t specializations
- IOobject: writeBanner/writeDivider return Stream for easier chaining.
... also dropped some namespace bracketing while I was at it.
- If the underlying type is contiguous, FixedList hashes its storage directly.
- Drop labelPairHash (non-commutative) from fvMeshDistribute since
FixedList::Hash does the right thing anyhow.
- Hash<edge> specialization is commutative, without multiplication.
- Hash<triFace> specialization kept multiplication (but now uLabel).
There's not much point optimizing it, since it's not used much anyhow.
Misc. changes
- added StaticAssert to NamedEnum.H
- label.H / uLabel.H : define FOAM_LABEL_MAX, FOAM_ULABEL_MAX with the
values finally used for the storage. These can be useful for pre-processor
checks elsewhere (although I stopped needing them in the meantime).
- not much speed difference between SuperFastHash and Jenkin's lookup3 but
both are 5-10% faster than what is currently implemented in Foam::string,
albeit inlining probably helps there.
- TODO: integration with existing infrastructure
- 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];
- it was possible to create a PackedList::iterator from a
PackedList::const_iterator and violate const-ness
- added HashTable::printInfo for emitting some information
- changed default table sizes from 100 -> 128 in preparation for future
2^n table sizes
- much better performance on empty tables (4-6x speedup), neutral
performance change on filled tables. Since tableSize_ is non-zero when
nElmts_ is, there is no modulus zero problem.
- change system/controlDict to use functions {..} instead of functions (..);
* This is internally more efficient
- fixed formatting of system/controlDict functions entry
- pedantic change: use 'return 0' instead of 'return(0)' in the applications,
since return is a C/C++ keyword, not a function.
- this (now deprecated) idiom:
for (runTime++; !runTime.end(); runTime++) { ... }
has a few problems:
* stop-on-next-write will be off-by-one (ie, doesn't work)
* function objects are not executed on exit with runTime.end()
Fixing these problems is not really possible.
- this idiom
while (runTime.run())
{
runTime++;
...
}
works without the above problems.
- added class OSHA1stream for a stream-based calculation method
- dictionary gets digest() method
- dictionaryEntry tweak: avoid trailing space after dictionary keyword
- 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.
- 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.
- 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
- 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
- exists() = forward to OSspecific exists(...)
- isDir() = forward to OSspecific dir(...)
- isFile() = forward to OSspecific file(...)
- IOobjectComponents() - split into instance, local, name following rules
set out for IOobject.
- added IOobject(path, registry, ...) constructor that uses
fileName::IOobjectComponents(). This hides the complexity we otherwise need.
- 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.
- 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.
regExp:
- added optional ignoreCase for constructor.
- the compile() methods is now exposed as set(...) method with an optional
ignoreCase argument. Not currently much use for the other regex compile
flags though. The set() method can be used directly instead of the
operator=() assignment.
keyType + wordRe:
- it's not clear that any particular characters are valid/invalid (compared
to string or word), so just drop the valid(char) method for now
wordRe:
- a bool doesn't suffice, added enum compOption (compile-option)
- most constructors now have a compOption. In *all* cases it defaults to
LITERAL - ie, the same behaviour for std::string and Foam::string
- added set(...) methods that do much the same as operator=(...), but the
compOption can be specified. In all cases, it defaults to DETECT.
In Summary
By default the constructors will generally preserve the argument as
string literal and the assignment operators will use the wordRe::DETECT
compOption to scan the string for regular expression meta characters
and/or invalid word characters and react accordingly.
The exceptions are when constructing/assigning from another
Foam::wordRe (preserve the same type) or from a Foam::word (always
literal).
- The capitalization is consistent with most other template classes, but
more importantly frees up xfer() for use as method name without needing
special treatment to avoid ambiguities.
It seems reasonable to have different names for transfer(...) and xfer()
methods, since the transfer is occuring in different directions.
The xfer() method can thus replace the recently introduced zero-parameter
transfer() methods.
Other name candidates (eg, yield, release, etc.) were deemed too abstract.
- a possible future replacement for keyType, but the immediate use is the
wordReList for grepping through other lists.
- note that the argList treatment of '(' ... ')' yields quoted strings,
which we can use for building a wordReList
minor cleanup of regExp class
- constructor from std::string, match std::string and
operator=(std::string&)
rely on automatic conversion to Foam::string
- ditch partialMatch with sub-groups, it doesn't make much sense
- Istream and Ostream now retain backslashes when reading/writing strings.
The previous implementation simply discarded them, except when used to
escape a double-quote or a newline. It is now vitally important to retain
them, eg for quoting regular expression meta-characters.
The backslash continues to be used as an escape character for double-quote
and newline, but otherwise get passed through "as-is" without any other
special meaning (ie, they are *NOT* C-style strings). This helps avoid
'backslash hell'!
For example,
string: "match real dots \.+, question mark \? or any char .*"
C-style: "match real dots \\.+, question mark \\? or any char .*"
- combined subfiles in db/IOstreams, some had more copyright info than code
- OPstreamI.H contained only private methods, moved into OPstream.C
Are these really correct?
IOstreams/Istream.H:# include "HashTable.C"
token/token.H:#define NoHashTableC
- this should provide a slightly more naturally means to using transfer
constructors, for example
labelList list2(list1.transfer());
vs. labelList list2(xferMove(list1));
- returns a plain list where appropriate (eg, DynamicList, SortableList)
for example
labelList list2(dynList1.transfer());
vs. labelList list2(xferMoveTo<labelList>(dynList1));
StaticHashTable:
- erase(iterator&) now actually alters the iterator and iterator++() handles
it properly
- clear() also sets count to zero
- operator=(const StaticHashTable&) doesn't crash after a previous transfer
- operator(), operator==() and operator!=() added
HashTable:
- operator=(const HashTable&) gets tableSize if required, eg, after a
previous transfer)
HashSet / Map
- add xfer<...> constructor for underlying HashTable
- This was originally plan 'B', but it is actually probably more efficient
than using PtrDictionary anyhow.
- straightened out the return value logic, but it wasn't being used anywhere
anyhow.
- new 'updated_' data member avoids inadvertent execution in the read()
method when execution is turned off.
- if mandatory is true, findEtcFile() will abort with a message (via cerr).
This allows a non-existent file to be caught at the lowest level and avoid
error handling in IFstream, which might not be initialized at that stage.
- the improved side-effect of enabling -zeroTimea alters default selection
behaviour and -latestTime selection behaviour for utilities in which
accidentally using the 0/ directory can cause damage (eg, reconstructPar)
- can combine -time ranges and -latestTime
- dropped setSize() in favour of List::setSize().
The size of the indices is set in sort() anyhow and undefined before that.
- added reverseSort() method
- added ListOps uniqueOrder() and duplicateOrder()
- setSize() adjusts the addressable length only.
Changed setSize(label) usage to setCapacity(label) or reserve(label)
throughout. The final name (capacity vs. storageSize() vs. whatever) can
easily be decided at a later date.
- added setSize(label, const T&), which may still not be really useful, but
is at least now meaningful
- made shrink() a bit more legible.
- added append(UList<T>&)
- copying from a UList avoids reallocations where possible
The following bits of code continue to use the DynamicList::setSize(), but
appear to be legitimate (or the corresponding code itself needs rethinking).
src/OpenFOAM/meshes/primitiveMesh/primitiveMeshPointCells.C:167: error: within this context
src/OpenFOAM/lnInclude/faceTemplates.C:44: error: within this context
src/surfMesh/surfaceFormats/tri/TRIsurfaceFormatCore.C:178: error: within this context
src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C:737: error: within this context
src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C:741: error: within this context
src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C:745: error: within this context
src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C:749: error: within this context
src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C:754: error: within this context
src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C:935: error: within this context
src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C:940: error: within this context
src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C:1041: error: within this context
src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C:1046: error: within this context
src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C:2161: error: within this context
src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C:2162: error: within this context
src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C:2201: error: within this context
src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C:2205: error: within this context
src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C:2261: error: within this context
src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C:2262: error: within this context
src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C:2263: error: within this context
src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C:2264: error: within this context
src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C:2265: error: within this context
src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C:3011: error: within this context
src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C:3076: error: within this context
src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C:3244: error: within this context
src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C:3371: error: within this context
src/dynamicMesh/meshCut/cellLooper/topoCellLooper.C:73: error: within this context
src/dynamicMesh/meshCut/cellLooper/topoCellLooper.C:91: error: within this context
src/dynamicMesh/meshCut/cellLooper/topoCellLooper.C:73: error: within this context
src/dynamicMesh/meshCut/cellLooper/topoCellLooper.C:91: error: within this context
* DynamicList::allocSize(label)
- Adjust the allocated size. The addressed list can be truncated but not
extended, use setSize() for that.
* DynamicList::reserve(label)
- Reserve allocation for *at least* this number of elements.
Never shrinks the allocated size, nor touches the addressed list size.
* DynamicList::setSize(label)
- proposed behaviour:
Adjust the addressed list size, allocating extra space if required.
- The current behaviour is ambiguous about what addressable size will
actually get set and using it to extend the addressable size (as
per List) automatically shrinks the allocated space to this size!
- operator+= : add in the listed keys
- operator-= : remove the listed keys
- operator&= : intersection of keys
- added xfer constructor (just in case)
- moved labelHashSet typedef to HashSet.H, for consistency with the
wordHashSet typedef being there and since it is used so often
- removed operator* in favour of operator() for consistency with tmp
class. The previous use of operator() for const casting didn't work
anyhow due to template confusion.
- added xferCopy(), xferMove() and xferTmp() template functions instead
- preliminary changes to IOobjects and Fields for xfer
* added '#remove' function
* changed insert() method name to more general execute()
* using #inputMode or #remove within a primitiveEntry now provokes an error
* adjusted the dictionaryTest accordingly