- silently deprecate 'startsWith', 'endsWith' methods
(added in 2016: 2b14360662), in favour of
'starts_with', 'ends_with' methods, corresponding to C++20 and
allowing us to cull then in a few years.
- handle single character versions of starts_with, ends_with.
- add single character version of removeEnd and silently deprecate
removeTrailing which did the same thing.
- drop the const versions of removeRepeated, removeTrailing.
Unused and with potential confusion.
STYLE: use shrink_to_fit(), erase()
- Now accept '/' when reading variables without requiring
a surrounding '{}'
- fix some degenerate parsing cases when the first character is
already bad.
Eg, $"abc" would have previously parsed as a <$"> variable, even
although a double quote is not a valid variable character.
Now emits a warning and parses as a '$' token and a string token.
- add toScalar evaluation, embedded as "${{EXPR}}".
For example,
"repeat ${{5 * 7}} times or ${{ pow(3, 10) }}"
- use direct string concatenation if primitive entry is only a string
type. This prevents spurious quotes from appearing in the expansion.
radius "(2+4)";
angle "3*15";
#eval "$radius*sin(degToRad($angle))";
We want to have
'(2+4)*sin(degToRad(3*15))'
and not
'"(2+4)"*sin(degToRad("3*15"))'
ENH: code refactoring
- refactored expansion code with low-level service routines now
belonging to file-scope. All expansion routines use a common
multi-parameter backend to handle with/without dictionary etc.
This removes a large amount of code duplication.
- add floor/ceil/round methods
- support evaluation of sub-strings
STYLE: add blockMeshDict1.calc, blockMeshDict1.eval test dictionaries
- useful for testing and simple demonstration of equivalence
- SubField and SubList assign from zero
- SubField +=, -=, *=, /= operators
- SubList construct from UList (as per SubField)
Note: constructing an anonymous SubField or SubList with a single
parameter should use '{} instead of '()' to avoid compiler
ambiguities.
- the #eval directive is similar to the #calc directive, but for evaluating
string expressions into scalar values. It uses an internal parser for
the evaluation instead of dynamic code compilation. This can make it
more suitable for 'quick' evaluations.
The evaluation supports the following:
- operations: - + * /
- functions: exp, log, log10, pow, sqrt, cbrt, sqr, mag, magSqr
- trigonometric: sin, cos, tan, asin, acos, atan, atan2, hypot
- hyperbolic: sinh, cosh, tanh
- conversions: degToRad, radToDeg
- constants: pi()
- misc: rand(), rand(seed)
- this largely reverts 3f0f218d88 and 4ee65d12c4.
Consistent addressing with support for wrapped pointer types (eg,
autoPtr, std::unique_ptr) has proven to be less robust than desired.
Thus rescind HashTable iterator '->' dereferencing (from APR-2019).
- relax casting rules
* down-cast of labelToken to boolToken
* up-cast of wordToken to stringToken.
Can use isStringType() test for word or string types
- simplify constructors, move construct etc.
- expose reset() method as public, which resets to UNDEFINED and
clears allocated storage etc.
DEFEATURE: remove assign from word or string pointer.
- This was deprecated 2017-11 and now removed.
For this type of content transfer, move assignment should be used
instead of stealing pointers.
- change contiguous from a series of global functions to separate
templated traits classes:
- is_contiguous
- is_contiguous_label
- is_contiguous_scalar
The static constexpr 'value' and a constexpr conversion operator
allow use in template expressions. The change also makes it much
easier to define general traits and to inherit from them.
The is_contiguous_label and is_contiguous_scalar are special traits
for handling data of homogeneous components of the respective types.
- this is principally for cases where reduced indentation is desired,
such as when streaming to a memory location. If the indentation size
is zero or one, only a single space will be used to separate the
key/value.
This change does not affect the stream allocation size, since the
extra data falls within the padding.
ENH: relocate label/scalar sizes from Istream to IOstream.
- could allow future use for output streams as well?
Due to padding, reorganization has no effect on allocated size
of output streams.
STYLE: add read/write name qualifier to beginRaw, endRaw
- removes ambiguity for bi-directional streams
STYLE: fix inconsistent 'const' qualifier on std::streamsize
- base Ostream was without const, some derived streams with const
- allows full recovery of allocated space, not just addressable range.
This can be particularly useful for code patterns that repeatedly
reuse the same buffer space. For example,
DynamicList<char> buf(1024);
// some loop
{
OListStream os(std::move(buf));
os << ...
os.swap(buf);
}
Can read back from this buffer as a second operation:
{
UIListStream is(buf);
is >> ...
}
- the behaviour of std::rename with overwriting an existing file is
implementation dependent:
- POSIX: it overwrites.
- Windows: it does not overwrite.
- for Windows need to use the ::MoveFileEx() routine for overwriting.
More investigation is needed for proper handling of very long names.
- unfriend HashSet, HashTable IO operators
- global min(), max(), minMax() functions taking a labelHashSet and an
optional limit. For example,
labelHashSet set = ...;
Info<< "min is " << min(set) << nl;
Info<< "max (non-negative) " << max(set, 0) << nl;
- make HashTable iterator '->' dereferencing more consistent by also
supporting non-pointer types as well.
- read HashTable values in-situ to avoid copying
ENH: define addition/subtraction operations for scalar and complex
- required since construct complex from scalar is explicit
- additional tests in Test-complex
- forces c++DBUG='-DFULLDEBUG -g -O0' for the compilation, to allow
localized debugging during development without file editing and
while retaining the WM_COMPILE_OPTION (eg, Opt)
Note that switching between 'wmake' and 'wmake -debug' will not
cause existing targets to be rebuilt. As before, these are driven by
the dependencies. An intermediate wclean may thus be required.
- generalize identity matrix constructors for non-scalar types
- add constructors using labelPair for the row/column sizing information.
For a SquareMatrix, this provides an unambiguous parameter resolution.
- reuse assignment operators
STYLE: adjust matrix comments