- simplify compile/uncompile, reading, assignment
- implicit construct wordRe from keyType (was explicit) to simplify
future API changes.
- make Foam::isspace consistent with std::isspace (C-locale)
by including vertical tab and form feed
ENH: improve #ifeq float/label comparisons
- originally had tests for regex meta characters strewn across
regExp classes as well as wordRe, keyType, string.
And had special-purpose quotemeta static function within string
that relied on special naming convention for testing the meta
characters.
The regex meta character testing/handling now relegated entirely
to the regExp class(es).
Relocate quotemeta to stringOps, with a predicate.
- avoid code duplication. Reuse some regExpCxx methods in regExpPosix
For example,
```
entry #eval 10 { vector(rand(), 0, 0) };
```
ENH: be more generous and ignore trailing ';' in expressions
STYLE: adjust parse token name for tensor::I
- simplifies local toggling.
- centralize fileModification static variables into IOobject.
They were previously scattered between IOobject and regIOobject
- support selective enable/disable of the file banner.
ENH: improve code isolation for decomposedBlockData
- use readBlockEntry/writeBlockEntry to encapsulate the IO handling,
which ensures more consistency
- new decomposedBlockData::readHeader for chaining into the
block header information.
- remove unused constructors for decomposedBlockData
ENH: minor cleanup of collated fileOperations
- improves interface and data consistency.
Older signatures are still active (via the Foam_IOstream_extras
define).
- refine internals for IOstreamOption streamFormat, versionNumber
ENH: improve data alignment for IOstream and IOobject
- fit sizeof label/scalar into unsigned char
STYLE: remove dead code
- read/write lists of character data in binary only.
This is the only means of preserving data.
If character data are written as an ASCII list, there is no means of
determining if spaces or newlines are content or separators.
- handle binary/contiguous first as being the most obvious, followed
by increasing complexity of ascii.
Structure reading and writing routines similarly by introducing a
readList method to compliment the writeList method.
- for use when the is_contiguous check has already been done outside
the loop. Naming as per std::span.
STYLE: use data/cdata instead of begin
ENH: replace random_shuffle with shuffle, fix OSX int64 ambiguity
- direct check of punctuation.
For example,
while (!tok.isPunctuation(token::BEGIN_LIST)) ..
instead of
while (!(tok.isPunctuation() && tok.pToken() == token::BEGIN_LIST)) ..
Using direct comparison (tok != token::BEGIN_LIST) can be fragile
when comparing int values:
int c = readChar(is);
while (tok != c) .. // Danger, uses LABEL comparison!
- direct check of word.
For example,
if (tok.isWord("uniform")) ..
instead of
if (tok.isWord() && tok.wordToken() == "uniform") ..
- make token lineNumber() a setter method
ENH: adjust internal compound method empty() -> moved()
- support named compound tokens
STYLE: setter method for stream indentation
- centralises existing functions (erfInv, incGamma*, invIncGamma*).
Provides a location for additional functions in the future.
- adjusted existing models to use these functions
(e.g. distributionModels::normal)
- robuster matching behaviour when encountering paths that themselves
contain the word "processor" in them. For example,
"/path/processor0generation2/case1/processor10/system"
will now correctly match on processor10 instead of failing.
- use procRangeType for encapsulating the processor ranges
- provision for information of distributed vs non-distributed roots.
The information is currently available from the initial setup, but
can useful to access directly within fileOperation.
STYLE: modernize list iteration
- the NullObject singleton can also be cast to a bitSet
(sufficient size and bit-pattern). Useful for places that
need to hold a reference on construction
- change to a templated implementation instead of relying on
the container's writeList() method.
This inlines the generation while also adding the flexibility to
define different delimiters (at compile time) without the
performance penalty of passing run-time parameters.
- deprecate get(key, deflt) in favour of lookup(key, deflt).
Method name compatibility with HashTable.
- deprecate operator().
The meaning is too opaque and equally served by other means:
- use get(key) instead of operator()(key).
Const access whereas HashTable::operator()(key)
creates missing entry.
- lookup(key, deflt) - instead of operator()(key, deflt).
Const access whereas HashTable::operator()(key, deflt)
creates a missing entry.
- make Enum iterable to allow participation in range-for etc.
- For slow oscillations it can be more intuitive to specify the
period.
ENH: separate mark/space for Square
- makes it easier to tailor the desired intervals.
BUG: incorrect square wave fraction with negative phase shifts
ENH: additional cosine Function1
STYLE: avoid code duplication by inheriting Cosine/Square from Sine.
- deprecated Feb-2018, but not marked as such.
The set() method originally enforce an additional run-time check
(Fatal if pointer was already set), but this was rarely used.
In fact, the set() method was invariably used in constructors
where the pointer by definition was unset.
Can now mark as deprecated to catch the last of these.
We prefer reset() for similarity with std::unique_ptr
Eg,
FOAM_EXTRA_CXXFLAGS="-DFoam_autoPtr_deprecate_setMethod" wmake
ENH: support construction of zero-sized IndirectList
- useful when addressing is to be generated in-place after construction.
Eg,
indirectPrimitivePatch myPatches
(
IndirectList<face>(mesh.faces(), Zero),
mesh.points()
);
labelList& patchFaces = myPatches.addressing();
patchFaces.resize(...);
// populate patchFaces
STYLE: add noexcept for zero/one fields and remove old dependency files
COMP: correct typedefs for geometricOneField, geometricZeroField
- uses ocountstream for the output, which swallows all output.
Improves portability
ENH: improved efficiency in countstreambuf
- xsputn() instead of overflow
- more consistent seek* methods
- prefix FOAM_MPI and library directories with 'sys-' for system
versions for uniform identication.
WM_MPLIB | libdir (FOAM_MPI) | old naming |
SYSTEMMPI | sys-mpi | mpi |
SYSTEMOPENMPI | sys-openmpi | openmpi-system |
- prefix preferences with 'prefs.' to make them more easily
identifiable, and update bin/tools/create-mpi-config accordingly
Old name: config.{csh,sh}/openmpi
New name: config.{csh,sh}/prefs.openmpi
- additional mpi preferences now available:
* prefs.intelmpi
* prefs.mpich
...
CONFIG: added hook for EASYBUILDMPI (eb-mpi), somewhat like USERMPI
- EasyBuild uses mpicc when compiling, so no explicit wmake rules are
used
ENH: support different major versions for system openmpi
- for example, with
WM_MPLIB=SYSTEMOPENMPI2
defines FOAM_MPI=sys-openmpi2 and thus creates lib/sys-openmpi2
ENH: centralize handling of mpi as 'mpi-rules'
Before:
sinclude $(GENERAL_RULES)/mplib$(WM_MPLIB)
sinclude $(DEFAULT_RULES)/mplib$(WM_MPLIB)
ifeq (,$(FOAM_MPI_LIBBIN))
FOAM_MPI_LIBBIN := $(FOAM_LIBBIN)/$(FOAM_MPI)
endif
After:
include $(GENERAL_RULES)/mpi-rules
- also allows variants such as SYSTEMOPENMPI2 to be handled separately
- ensures that subsequent Allwmake scripts know about it.
ENH: add bin/tools/query-detect wrapper for wmake have_* scripts
CONFIG: use project/ThirdParty without additional sanity checks
- no need to test for Allwmake or platforms/ if ThirdParty is located
within the project directory itself.
COMP: add simple mpi test to 00-dummy
- for testing library linkage, etc.
- a sphere/spheroid can be specified as a single radius or three radii.
If all three values happen to be identical, they are collapsed to a
single value. Examples,
radius 2;
radius (2 2 2);
radius (2 3 4);
radius (2 2 4);
The search for nearest point on an ellipse or ellipsoid follows the
description given by Geometric Tools (David Eberly), which also
include some pseudo code. The content is CC-BY 4.0
In the search algorithm, symmetry is exploited and the searching is
confined to the first (+x,+y,+z) octant, and the radii are ordered
from largest to smallest.
Searching is optimized for sphere, prolate and oblate spheroids.
- code reduction, documentation, code stubs for spheroid (#1901)
- make searchableSurfaceCollection available as 'collection'
for consistency with other objects
ENH: add some scalar constants for .org compatibility (#1881)
Although it can very much be a moving target, it can prove partly
useful to have some compatibility constants/methods.
- The wholesale change of 'GREAT' -> 'great' etc (JAN-2018), makes
user coding for multiple versions problematic. When
COMPAT_OPENFOAM_ORG is defined, now define constants (aliases) named
as per the openfoam.org version. Values, however, remain identical.
- For type-safe dictionary value retrieval, we have the templated
get<> methods added around NOV-2018 and deprecated the lookupType
method.
The .org version followed suit in NOV-2019, but opted for renaming
the templated lookupType method as a templated 'lookup' method.
Using this is discouraged, but allowed when COMPAT_OPENFOAM_ORG is
defined.
- flips state while preserving the textual representation.
Eg, OFF <-> ON, YES <-> NO etc.
- fix test case to avoid triggering abort(), which we cannot try/catch
- provides a more direct means of generating a compound token without
an Istream
- add transferCompoundToken() without Istream reference
- mark more token methods as noexcept
- provides consistency with identity(label, label) and looks more
familiar than using labelRange::labels()
- relocates labelRange IO operators to IntRange
ENH: make sliceRange interators random access
STYLE: scalarRanges::match() instead of predicate operator
- returns a range of `int` values that can be iterated across.
For example,
for (const int proci : Pstream::subProcs()) { ... }
instead of
for
(
int proci = Pstream::firstSlave();
proci <= Pstream::lastSlave();
++proci
)
{
...
}
- returns a range of `int` values that can be iterated across.
For example,
for (const int proci : Pstream::allProcs()) { ... }
instead of
for (label proci = 0; proci < Pstream::nProcs(); ++proci) { ... }
- add reverse iterators and replace std::iterator
(deprecated in C++17) with full definitions
- simplify construction of iterators
- construct labelRange from a single single parameter.
This creates a (0,len) range.
- make basic constructors forms constexpr.
Remove unused size checks.
- Derive labelRange from new IntRange template class.
Allows reuse of base functionality with different integral sizes.
Deprecations:
- deprecate labelRange::valid() in favour of using
labelRange::empty() or the bool operator.
For example,
if (range) ... vs older if (range.valid()) ...
DEFEATURE: drop labelRange::null, scalarRange::null static variables
- turned out to be not particularly useful.
Can simply use constexpr contructor forms
DEFEATURE: drop labelRange::identity static method
- simply use the single-parameter constructor
- introduce WM_COMPILE_CONTROL variable to convey control information
into the build rules.
The convention (as per spack):
- '+' to select a feature
- '~' to deselect a feature
Eg, to select the gold linker, and disable openmp
(spaces are not required):
WM_COMPILE_CONTROL="+gold ~openmp"
CONFIG: accept FOAM_EXTRA_LDFLAGS for AMD, gold, Mingw linkers
CONFIG: generalize PROJECT_LIBS (-ldl used almost universally)
- makes it easier to use in combination with various 'New' selectors,
which mostly return an autoPtr.
ENH: add very simple FFT test
- basic sanity test that the library links properly
- previously hidden as Detail::[IO]FstreamAllocator, now exposed
directly as [io]fstreamPointer, which allows reuse for
std::ifstream, std::ofstream wrapping, without the additional
ISstream, OSstream layers.
These stream pointers have some characteristics similar to a
unique_ptr.
- restrict direct gzstream usage to two files (fstreamPointers.C,
gzstream.C) which improves localization and makes it simpler to
enable/disable with the `HAVE_LIBZ` define.
The HAVE_LIBZ define is currently simply hard-coded in the
Make/options.
If compiled WITHOUT libz support:
- reading gz files : FatalError
- writing gz files : emit warning and downgrade to uncompressed
- warn if compression is specified in the case controlDict
and downgrade to uncompressed
ENH: minor updates to gzstream interface for C++11
- support construct/open with std::string for the file names.
CONFIG: provisioning for have_libz detection as wmake/script
- naming similarity with autoPtr, unique_ptr and other containers.
For UPtrList derivatives, this is equivalent to the existing
operator(). The read-only variant is also equivalent to the
single-parameter 'set(label)' method.
With PtrList<T> list(...) :
const T* ptr = list.get(10);
if (ptr)
{
ptr->method();
}
vs.
if (list.set(10))
{
list[10].method();
}
For HashPtrTable there is only a read-only variant which is equivalent
to testing for existence and for value.
With HashPtrTable<T> hash(...) :
const T* ptr = list.get("key");
if (ptr)
{
ptr->method();
}
vs.
if (list.found("key"))
{
// Fails on null pointer!!
list["key"].method();
}
Use of get() is largely a matter of taste or local coding requirements
- forwarding like the emplace() method, but overwriting existing
entries as required
- propagate similar changes to HashPtrTable
For example, with HashPtrTable<labelList> table(...) :
With 'insert' semantics
table.emplace("list1", 1000);
vs
if (!table.found("list1"))
{
table.set("list1", new labelList(1000));
}
or
table.insert("list1", autoPtr<labelList>::New(1000));
Note that the last example invokes an unnecessary allocation/deletion
if the insertion is unsuccessful.
With 'set' semantics:
table.emplace_set("list1", 15);
vs
table.set("list1", new labelList(15));
The fakeError function object emits FatalError at different stages (or
does nothing), which is useful for testing purposes (issue #1779).
Can request errors from constructor, execute and write methods.
- with '&&' conditions, often better to check for non-null autoPtr
first (it is cheap)
- check as bool instead of valid() method for cleaner code, especially
when the wrapped item itself has a valid/empty or good.
Also when handling multiple checks.
Now
if (ptr && ptr->valid())
if (ptr1 || ptr2)
instead
if (ptr.valid() && ptr->valid())
if (ptr1.valid() || ptr2.valid())
- libs() singleton method for global library handling
- explicit handling of empty filename for dlLibraryTable open/close.
Largely worked before, but now be more explicit about its behaviour.
- add (key, dict) constructor and open() methods.
More similarity to dimensionedType, Enum etc, and there is no
ambiguity with the templated open().
- construct or open from initializer_list of names
- optional verbosity when opening with auxiliary table,
avoid duplicate messages or spurious messages for these.
- basename and fullname methods (migrated from dynamicCode).
- centralise low-level load/unload hooks
- adjust close to also dlclose() aliased library names.
- use simpler decomposeParDict in tutorials, several had old
'boilerplate' decomposeParDict
- use simpler libs () format
- update surface sampling to use dictionary format
1) Implementation of the compressibleIsoInterFOam solver
2) Implementation of a new PLIC interpolation scheme.
3) New tutorials associated with the solvers
This implementation was carried out by Henning Scheufler (DLR) and Johan
Roenby (DHI), following :
\verbatim
Henning Scheufler, Johan Roenby,
Accurate and efficient surface reconstruction from volume fraction data
on general meshes, Journal of Computational Physics, 2019, doi
10.1016/j.jcp.2019.01.009
\endverbatim
The integration of the code was carried out by Andy Heather and Sergio
Ferraris from OpenCFD Ltd.
ENH: add Test-EigenMatrix application
The new iterative eigen decomposition functionality is
derived from:
Passalacqua et al.'s OpenQBMM (openqbmm.org/),
which is mostly derived from JAMA (math.nist.gov/javanumerics/jama/).
- bundled of boolean values as a vector of 3 components with
element access using x(), y() and z() member functions.
It also has some methods similar to bitSet.
- Not derived from Vector or VectorSpace since it does not share very
many vector-like characteristics.
- support construct from initializer_list, which can help simplify
code with constant coefficients.
- add default constructor for polynomialFunction and Istream reading
to support resizable lists of polynomialFunction.
A default constructed polynomialFunction is simply equivalent to
a constant zero.
- no special IO handling for Polynomial required,
it is the same as VectorSpace anyhow.
- previously introduced `getOrDefault` as a dictionary _get_ method,
now complete the transition and use it everywhere instead of
`lookupOrDefault`. This avoids mixed usage of the two methods that
are identical in behaviour, makes for shorter names, and promotes
the distinction between "lookup" access (ie, return a token stream,
locate and return an entry) and "get" access (ie, the above with
conversion to concrete types such as scalar, label etc).
- Favour use of argList methods that are more similar to dictionary
method names with the aim of reducing the cognitive load.
* Silently deprecate two-parameter get() method in favour of the
more familiar getOrDefault.
* Silently deprecate opt() method in favour of get()
These may be verbosely deprecated in future versions.
- similar to the behaviour of std::ignore and consistent with the
no input / no output nature of nullObject. Similarly accept a
const reference for its Istream operator.
- make most nullObject methods constexpr
- mostly wraps std::chrono so can inline much of it, which is potentially
helpful when used for inner timings.
- add elapsedTime() method for direct cast to double and for
naming similarity with wall-clock method.
Potential breaking change (minor):
- clockValue construct with a bool parameter is now simply tagged
dispatch (value is ignored) and always queries the current clock
value. This avoids needless branching.
Since this constructor form has primarily been used internally (eg,
clockTime), breakages in user code are not expected.
- have printBuildInfo output to std::ostream
- removed extraneous include "stdFoam.H"
ENH: revert to pre-processor defines for hard-coded paths (#1712)
- redundant information, but more robust at run-time without relying
on initialization order
- less frequently used, but the information was previously inaccessible
under etcFiles.C.
Now exposed within the foamVersion namespace and defined under
<global.Cver> to improve configuration possibilities.
- simplified templating, which cleans up code and does not appear to
break any normal user coding.
ENH: unique_ptr instead of homegrown demand-driven handling.
- takes a search string and a replacement character.
The replacement character can also be a nul char ('\0'), which
simply removes the characters.
Possible uses:
* Replace reserved characters
str.replaceAny("<>:", '_');
* Remove shell meta-characters or reserved filesystem characters
str.replaceAny("*?<>{}[]:", '\0');
- adjustments to internal handling to improve run-time addition of
other formats (eg, with additional user library)
For example, to write a binary STL with a '.stl' extension:
$ surfaceMeshConvert input.obj -write-format stlb output.stl
Or in a sampler,
to specify the input type without ambiguity:
surf
{
type meshedSurface;
surface sampling.inp;
fileType starcd;
scale 0.001;
...
}
STYLE: regularize naming for input/output scaling
* -read-scale (compat: -scaleIn)
* -write-scale (compat: -scaleOut)
CONFIG: change edge/surface selection name for STARCD format
- now select as "starcd" instead of "inp" to avoid naming ambiguity
with abaqus
- face_type, point_type (similar to STL value_type, etc).
The naming avoids potential confusion with template parameters.
- rename private typedef from ParentType to MeshReference for more
consistency with polySurface etc.
- previously used a Pstream::exit() invoked from the argList
destructor to handle all MPI shutdown, but this has the unfortunate
side-effect of using a fixed return value for the program exit.
Instead use the Pstream::shutdown() method in the destructor and allow
the normal program exit codes as usual. This means that the
following code now works as expected.
```
argList args(...);
if (...)
{
InfoErr<< "some error\n";
return 1;
}
```
Style changes:
- use std algorithm for some stringOps internals
- pass SubStrings iterators by const reference
ENH: special nullptr handling for ISstream getLine
- pass through to istream::ignore to support read and discard
* Support default values for format/compress enum lookups.
- Avoids situations where the preferred default format is not ASCII.
For example, with dictionary input:
format binar;
The typing mistake would previously have caused formatEnum to
default to ASCII. We can now properly control its behaviour.
IOstream::formatEnum
(
dict.get<word>("format"), IOstream::BINARY
);
Allowing us to switch ascii/binary, using BINARY by default even in
the case of spelling mistakes. The mistakes are flagged, but the
return value can be non-ASCII.
* The format/compression lookup behave as pass-through if the lookup
string is empty.
- Allows the following to work without complaint
IOstream::formatEnum
(
dict.getOrDefault("format", word::null), IOstream::BINARY
);
- Or use constructor-like failsafe method
IOstream::formatEnum("format", dict, IOstream::BINARY);
- Apply the same behaviour with setting stream format/compression
from a word.
is.format("binar");
will emit a warning, but leave the stream format UNCHANGED
* Rationalize versionNumber construction
- constexpr constructors where possible.
Default construct is the "currentVersion"
- Construct from token to shift the burden to versionNumber.
Support token as argument to version().
Now:
is.version(headerDict.get<token>("version"));
or failsafe constructor method
is.version
(
IOstreamOption::versionNumber("version", headerDict)
);
Before (controlled input):
is.version
(
IOstreamOption::versionNumber
(
headerDict.get<float>("version")
)
);
Old, uncontrolled input - has been removed:
is.version(headerDict.lookup("version"));
* improve consistency, default behaviour for IOstreamOption construct
- constexpr constructors where possible
- add copy construct with change of format.
- construct IOstreamOption from streamFormat is now non-explicit.
This is a commonly expected result with no ill-effects
- renamed 'core/' -> 'base/' to avoid gitignore masking when re-adding
files
- rename 'nas/' to 'nastran/' for more clarity
- relocated OBJstream from surfMesh to fileFormats
STYLE: remove unused parseNASCoord. Was deprecated 2017-09
- `tensor` and `tensor2D` returns complex eigenvalues/vectors
- `symmTensor` and `symmTensor2D` returns real eigenvalues/vectors
- adds new test routines for eigendecompositions
- improves numerical stability by:
- using new robust algorithms,
- reordering the conditional branches in root-type selection
- ensures each Tensor-container operates for the following base types:
- floatScalar
- doubleScalar
- complex
- adds/improves test applications for each container and base type:
- constructors
- member functions
- global functions
- global operators
- misc:
- silently removes `invariantIII()` for `tensor2D` and `symmTensor2D`
since the 3rd invariant does not exist for 2x2 matrices
- fixes `invariantII()` algorithm for `tensor2D` and `symmTensor2D`
- adds `Cmpt` multiplication to `Vector2D` and `Vector`
- adds missing access funcs for symmetric containers
- improves func/header documentations
- provides an indirect access to a sub-section of a list that is
somewhat less efficient than a Foam::SubList, but supports the
following:
* adjustment of its addressing range after construction
* recovery of the original, underlying list at any time
This can be more convenient for some coding cases.
For example,
template<class Addr>
void renumberFaces(IndirectListBase<face, Addr>& faces, ...);
which can be called for
* Specific faces:
UIndirectList<face>(mesh.faces(), facesToChange)
* A sub-range of faces:
IndirectSubList<face>(mesh.faces(), pp.range())
* All faces:
IndirectSubList<face>(mesh.faces())
CONFIG: added IndirectListsFwd.H with some common forwarding
- now use debug 2 for scanner and debug 4 for parser.
Provided better feedback about what is being parsed (debug mode)
- relocate debug application to applications/tools/foamExprParserInfo
- follows the principle of least surprise if the expansion behaviour
for #eval and expressions (eg, exprFixedValue) are the same. This
is possible now that we harness the regular stringOps::expand()
within exprString::expand()
- reuse more of stringOps expansions to reduce code and improve the
syntax flexiblity.
We can now embed "pre-calculated" values into an expression.
For example,
angle 35;
valueExpr "vector(${{cos(degToRad($angle))}}, 2, 3)";
and the ${{..}} will be evaluated with the regular string evaluation
and used to build the entire expression for boundary condition
evaluation.
Could also use for fairly wild indirect referencing:
axis1 (1 0 0);
axis2 (0 1 0);
axis3 (0 0 1);
index 100;
expr "$[(vector) axis${{ ($index % 3) +1 }}] / ${{max(1,$index)}}";
QRMatrix (i.e. QR decomposition, QR factorisation or orthogonal-triangular
decomposition) decomposes a scalar/complex matrix \c A into the following
matrix product:
\verbatim
A = Q*R,
\endverbatim
where
\c Q is a unitary similarity matrix,
\c R is an upper triangular matrix.
Usage
Input types:
- \c A can be a \c SquareMatrix<Type> or \c RectangularMatrix<Type>
Output types:
- \c Q is always of the type of the matrix \c A
- \c R is always of the type of the matrix \c A
Options for the output forms of \c QRMatrix (for an (m-by-n) input matrix
\c A with k = min(m, n)):
- outputTypes::FULL_R: computes only \c R (m-by-n)
- outputTypes::FULL_QR: computes both \c R and \c Q (m-by-m)
- outputTypes::REDUCED_R: computes only reduced \c R (k-by-n)
Options where to store \c R:
- storeMethods::IN_PLACE: replaces input matrix content with \c R
- storeMethods::OUT_OF_PLACE: creates new object of \c R
Options for the computation of column pivoting:
- colPivoting::FALSE: switches off column pivoting
- colPivoting::TRUE: switches on column pivoting
Direct solution of linear systems A x = b is possible by solve() alongside
the following limitations:
- \c A = a scalar square matrix
- output type = outputTypes::FULL_QR
- store method = storeMethods::IN_PLACE
Notes
- QR decomposition is not unique if \c R is not positive diagonal \c R.
- The option combination:
- outputTypes::REDUCED_R
- storeMethods::IN_PLACE
will not modify the rows of input matrix \c A after its nth row.
- Both FULL_R and REDUCED_R QR decompositions execute the same number of
operations. Yet REDUCED_R QR decomposition returns only the first n rows
of \c R if m > n for an input m-by-n matrix \c A.
- For m <= n, FULL_R and REDUCED_R will produce the same matrices
COMP: delay evaluation of fieldToken enumeration types
- lazy evaluation at runTime instead of compile-time to make the code
independent of initialization order.
Otherwise triggers problems on gcc-4.8.5 on some systems where
glibc is the same age, or older.
- replace stringOps::toScalar with a more generic stringOps::evaluate
method that handles scalars, vectors etc.
- improve #eval to handle various mathematical operations.
Previously only handled scalars. Now produce vectors, tensors etc
for the entries. These tokens are streamed directly into the entry.
- ITstream append() would previously have used the append from the
underlying tokenList, which leaves the tokenIndex untouched and
renders the freshly appended tokens effectively invisible if
interspersed with primitiveEntry::read() that itself uses tokenIndex
when building the list.
The new append() method makes this hidden ITstream bi-directionality
easier to manage. For efficiency, we only append lists
(not individual tokens) and support a 'lazy' resizing that allows
the final resizing to occur later when all tokens have been appended.
- The new ITstream seek() method provides a conveniently means to move
to the end of the list or reposition to the middle.
Using rewind() and using seek(0) are identical.
ENH: added OTstream to output directly to a list of tokens
---
BUG: List::newElem resized incorrectly
- had a simple doubling of the List size without checking that this
would indeed be sufficient for the requested index.
Bug was not triggered since primitiveEntry was the only class using
this call, and it added the tokens sequentially.
- allows use of Enum in more situations where a tiny Map/HashTable
replacement is desirable. The new methods can be combined with
null constructed for to have a simple low-weight caching system
for words/integers instead of fitting in a HashTable.
- 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)