Commit Graph

1291 Commits

Author SHA1 Message Date
Mark Olesen
33f9ae5080 ENH: improvements to IOstreamOption
* 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
2020-02-18 21:51:35 +01:00
Mark Olesen
4e1bc2d2f1 COMP: incorrect placement of compiler attributes 2020-02-18 13:51:20 +01:00
Mark Olesen
4307e1719f STYLE: adjust names, locations for fileFormats
- 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
2020-02-18 13:51:20 +01:00
Kutalmis Bercin
55e7da670c ENH: improve analytical eigendecompositions
- `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
2020-02-18 12:21:01 +00:00
Kutalmis Bercin
66b02ca5ca ENH: improve funcs and opers in Tensor types
- 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
2020-02-18 12:21:01 +00:00
Kutalmis Bercin
8ca724fffa ENH: improve stability in polynomialEqns
- replaces floating-point equal comparisons in
    `linearEqn`, `quadraticEqn`, and `cubicEqn`,
  - ensures `quadraticEqn` and `cubicEqn` can return `complex` roots,
  - reorders if-branches in `quadraticEqn` and `cubicEqn` to avoid
    zero-equal comparison,
  - adds Kahan's cancellation-avoiding algorithm into `quadraticEqn` and
    `cubicEqn` for the numerically-sensitive discriminant computation,

  - adds/improves `polynomialEqns` tests:
    * adds Test-linearEqn.C
    * adds Test-quadraticEqn.C
    * improves Test-cubicEqn.C
2020-02-18 12:21:01 +00:00
Mark Olesen
53dec91cc2 COMP: add -help-man for Test-dummyLib (minimal packaging tests) 2020-02-06 10:06:20 +01:00
Mark Olesen
822d052e32 ENH: added IndirectSubList
- 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
2020-01-31 17:01:22 +01:00
OpenFOAM bot
596e4aef3f STYLE: remove trailing space, tabs 2020-01-22 10:00:03 +01:00
Andrew Heather
ae2ab06312 REL: Release preparations 2019-12-23 09:49:23 +00:00
Mark Olesen
74b12c6afd ENH: improved separation of scanner/parser debug selection
- 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
2019-12-19 13:16:26 +01:00
Mark Olesen
1cf795a40f ENH: use exprString expansions for #eval
- 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()
2019-12-17 09:47:51 +01:00
Mark Olesen
1a16207e0d COMP: compilation of Test-QRMatrix (clang, int64)
- remove unused local functions from volumeExprDriver
2019-12-16 11:22:15 +01:00
Mark Olesen
33e0c4ba88 ENH: improve expression string expansions
- 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)}}";
2019-12-14 00:11:28 +01:00
Mark Olesen
7aa2bf832f STYLE: header format 2019-12-13 12:33:23 +01:00
Mark Olesen
17d9969ae5 ENH: stringOps::findTrim helper
- finds beg/end indices of string trimmed of leading/trailing whitespace
2019-12-13 12:10:53 +01:00
Mark Olesen
677e314279 string trim 2019-12-13 10:05:28 +01:00
Kutalmis Bercin
af0e454ccf BUG: fix QRMatrix (#1261, #1240)
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
2019-12-12 11:22:14 +00:00
Kutalmis Bercin
64614cfce8 ENH: add new funcs into SquareMatrix
- query func `symmetric()`
    - query func `tridiagonal()`
    - `resize()`
    - `labelpair` identity constructor

    STYLE: add `#if(0 | RUNALL)` to improve test control in Test-Matrix
2019-12-12 11:22:13 +00:00
Mark Olesen
eb4fec371a ENH: unified some common parser static methods
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.
2019-12-11 13:32:36 +01:00
Mark Olesen
c2123452b1 ENH: generalize string expression evaluation
- 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.
2019-12-09 19:44:23 +01:00
Mark Olesen
9fd696e1ae ENH: add ITstream append and seek methods.
- 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.
2019-12-06 17:23:59 +01:00
Mark Olesen
6b5da70602 ENH: add scalarOps with divide-by-zero protection
- add functor versions of floor/ceil/round for scalar
2019-12-07 16:55:18 +01:00
Mark Olesen
1310e85225 ENH: support 'get()' for retrieving argList options
- previously only had 'opt<..>()' for options, but 'get<..>()'
  provides more similarity with dictionary methods.
  The 'opt<..>()' method is retained.
2019-11-26 21:07:11 +01:00
Mark Olesen
6dd3cd0e51 ENH: add clear/append method to Enum and std::ostream output
- 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.
2019-11-25 18:15:31 +01:00
Mark Olesen
42a9a6ae5a ENH: add generator class for uniform/gaussian random numbers
- can be used in combination with std::generate, or as a substitute
  unary operator to supply random numbers for std::transform.
2019-11-21 09:40:00 +01:00
Mark Olesen
9e6683f7bc ENH: add conditionals to #eval (string to scalar)
Example,

     ($radius > 10) ? sin(degToRad(45)) : cos(degToRad(30))

- protect division and modulo against zero-divide.

- add scanner/parser debugging switches in the namespace,
  selectable as "stringToScalar". For example,

    debug parser:  foamDictionary -debug-switch stringToScalar=2
    debug scanner: foamDictionary -debug-switch stringToScalar=4
    debug both:    foamDictionary -debug-switch stringToScalar=6
2019-11-19 14:22:03 +01:00
Mattijs Janssens
2d080ff331 Feature single precision solve type 2019-11-19 11:10:07 +00:00
Mark Olesen
4d18fea8e1 ENH: add value_type to dimensioned type. Add Switch::name(bool) 2019-11-18 09:13:58 +01:00
Mark Olesen
2a8669b3f8 ENH: add zip/unzip for GeometricField 2019-11-15 17:29:50 +01:00
Mark Olesen
cf2b84ef32 ENH: add zip/unzip for FieldField 2019-11-15 13:32:27 +01:00
Mark Olesen
6882ed35a4 ENH: add zip/unzip for vector and tensor fields
- the full tensor also supports zip/unzip rows/cols
  and unzipRow, unzipCol, unzipDiag
2019-11-15 12:56:23 +01:00
Mark Olesen
39a1191bd5 ENH: add zip/unzip functions for complexField and vector2DField 2019-11-15 11:26:45 +01:00
Mark Olesen
6798c61047 ENH: add boolIOField to allow registering 2019-11-13 18:54:10 +01:00
Mark Olesen
98467036b3 STYLE: regularize quoting and exit on failed 'cd' 2019-11-13 13:19:16 +01:00
Mark Olesen
7c1190f0b1 ENH: rationalize some string methods.
- 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()
2019-11-11 18:50:00 +01:00
Mark Olesen
71de630722 ENH: tune efficiency of stringOps::trim
- move left/right positions prior to substr
2019-11-10 10:50:49 +01:00
Mark Olesen
ec7e3c88e4 ENH: test for WM_PROJECT_DIR being set/unset in scripts 2019-11-06 09:18:51 +01:00
Mark Olesen
e8fa46230a ENH: add min/max compare/reduction operators for Tuple2 first()
- min/max ops that only compare the first element
2019-11-05 13:08:21 +01:00
Andrew Heather
fdf8d10ab4 Merge commit 'e9219558d7' into develop-v1906 2019-12-05 11:47:19 +00:00
OpenFOAM bot
e9219558d7 GIT: Header file updates 2019-10-31 14:48:44 +00:00
Mark Olesen
177f4b79fe ENH: use direct scanning mode when lexing #eval expressions 2019-11-01 19:13:50 +01:00
Mark Olesen
28a9cde028 ENH: add boolField specializations: negate(), component()
ENH: added scalarField hypot() function
2019-10-10 13:13:20 +02:00
Mark Olesen
6b5492e3bd ENH: code simplification, improvements for reading dictionary variables
- 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.
2019-10-08 18:43:38 +02:00
Mark Olesen
46225279c0 ENH: improvements to stringOps::expand operations
- 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.
2019-10-07 08:27:19 +02:00
Mark Olesen
d9d29e5a8f STYLE: split off Test-string2 2019-10-04 17:52:08 +02:00
Mark Olesen
bd35981feb ENH: stringOps::toScalar improvements
- 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
2019-10-04 17:50:55 +02:00
Mark Olesen
61e95b8471 ENH: improvements to SubList and SubField
- 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.
2019-10-04 14:21:18 +02:00
Mark Olesen
836d3a849f ENH: add stringOps::toScalar and dictionary #eval directive
- 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)
2019-09-30 16:40:32 +02:00
Mark Olesen
4a5569776e ENH: add cmptMagSqr for scalars, VectorSpace, Fields (#1449) 2019-09-29 16:53:42 +02:00
Mark Olesen
b6bf9129f6 DEFEATURE: pointer dereferencing for HashTable iterator
- 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).
2019-09-27 19:45:54 +02:00
Mark Olesen
13967565a6 ENH: stringOps removeComments and inplaceRemoveComments
- useful for manual handling of string with comments
2019-09-24 08:25:32 +02:00
sergio
e3b05494f7 COMP: relocate regionProperties to meshTools 2019-09-20 14:06:30 -07:00
Mark Olesen
79dff5d8fe ENH: add col/row access methods for Tensor2D (#1430) 2019-09-23 14:40:47 +02:00
Mark Olesen
07fb19e9d8 ENH: add construct dimensionedType from primitiveEntry
- allows direct reading of a single entry with token checking
2019-08-28 21:16:19 +02:00
Mark Olesen
c9cb4ce34f ENH: minor improvements, cleanup of token class
- 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.
2019-08-20 17:48:31 +02:00
Mark Olesen
b5342c166c ENH: handle keyType type (literal/regex) as enum instead of bool
- makes its use somewhat clearer and allows more future options
2019-08-20 13:48:05 +02:00
Mark Olesen
ba69505225 ENH: add ITstream::toString() method
- creates a std::string with space-delimited tokens, which can be sent
  to another application or even re-parsed into tokens
2019-08-14 19:29:02 +02:00
Mark Olesen
1d79c0452c ENH: additional contiguous traits (#1378)
- 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.
2019-07-29 11:36:30 +02:00
Mark Olesen
3c07a1bb6f ENH: Foam::name() of memory address
- returns the memory address formatted in hexadecimal, which can be
  useful for detailed information
2019-08-12 10:46:29 +02:00
Mark Olesen
1dde76c8dd ENH: add bitSet::begin(pos) to provide alternative start for indexing 2019-08-07 13:49:48 +02:00
Mark Olesen
0cfd019b92 STYLE: add data/cdata to VectorSpace for consistency with FixedList etc 2019-08-06 12:00:56 +02:00
Mark Olesen
c28d785a73 STYLE: adjust name, default count for readRawLabel/readRawScalar (#1378) 2019-08-06 11:54:14 +02:00
Mark Olesen
ef9bb4ae16 ENH: add low-level readRawLabels, readRawScalars (#1378)
- these use the additional byte-size checks in IOstream to handle
  native vs non-native sizes
2019-07-29 16:01:34 +02:00
Mark Olesen
8b3d77badc ENH: make OSstream indentation adjustable
- 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
2019-07-31 12:51:54 +02:00
Mark Olesen
6f8da834a9 ENH: add OListStream::swap(DynamicList<char>&)
- 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 >> ...
      }
2019-07-31 11:31:40 +02:00
Mark Olesen
78ce269a52 ENH: add field operations for complex (#1365) 2019-07-28 21:19:43 +02:00
Mark Olesen
1d86fc4f6b ENH: add single-parameter sortedOrder() function 2019-07-17 11:08:40 +02:00
Mark Olesen
e03c0977f5 ENH: support Foam::mv overwrite of existing files on windows (#1238)
- 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.
2019-07-09 18:52:06 +02:00
Mark Olesen
bbc2d4a8b0 ENH: HashTable and HashSet improvements
- 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
2019-07-12 18:00:00 +02:00
Mark Olesen
488f8938b2 ENH: add invert (inverse mappings) for bitSet 2019-07-12 12:00:00 +02:00
Mark Olesen
4b8fabaa4b STYLE: relocate Allwmake-scan to src/
- reduced clutter. Mostly only need to scan source tree.

- 00-dummy: use wmake/src/Allmake to get native (not cross-compiled)
  wmake toolchain binaries
2019-06-28 09:55:25 +02:00
Mark Olesen
10a03ceba2 STYLE: relocate Allwmake-scan to src/
- reduced clutter. Mostly only need to scan source tree.

- 00-dummy: use wmake/src/Allmake to get native (not cross-compiled)
  wmake toolchain binaries
2019-06-28 09:55:25 +02:00
Andrew Heather
be44dcaf1f RELEASE: Version clean-up for release 2019-06-25 11:51:19 +01:00
Mark Olesen
fa8ab2d5b4 STYLE: add Test-copyFile 2019-06-24 14:46:38 +02:00
Mark Olesen
f863925112 STYLE: use uintptr_t instead of long 2019-06-13 19:37:27 +02:00
Mark Olesen
03de501310 STYLE: fix file permissions, inconsistent Test files 2019-06-04 17:50:18 +02:00
kuti
e42cc287de BUG: incorrect scalar/complex division (#1331)
ENH: define addition/subtraction operations for scalar and complex

- required since construct complex from scalar is explicit
- additional tests in Test-complex
2019-06-04 09:08:42 +01:00
Mark Olesen
fc11c40841 ENH: add wmake -debug option
- 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.
2019-06-03 10:16:31 +02:00
kuti
745624c024 ENH: partial overhaul of Matrix type (#1220)
- additional operators:
  + compound assignment
  + inner product: operator&
  + outer product: operator^

- additional functions:
   - MatrixBlock methods: subColumn, subRow, subMatrix
   - L2 norms for matrix or column
   - trace, diag, round, transpose

- MatrixBlock methods: col(), block() are deprecated since their
  access patterns with (size, offset) are unnatural/unwieldy.

- verifications by test/Matrix/Test-Matrix
2019-05-23 11:32:45 +01:00
Mark Olesen
db0678bf0e TUT: incorrect regex escaping in fvSchemes
- error trapped by C++11 regex
2019-05-30 14:26:15 +02:00
Mark Olesen
96d0a8f2af ENH: harmonize matrix constructors (#1220)
- 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
2019-05-29 09:50:46 +02:00
mattijs
7945ca739c ENH: correct sumProd return type (#1086)
- previously returned scalar, but now return pTraits cmptType
  which is the same as scalarProduct / outerProduct type.
2019-02-10 14:31:35 +00:00
Mark Olesen
aab644a3fc STYLE: eliminate complex constants that are duplications of pTraits
- eg pTraits<complex>::zero, pTraits<complex>::one instead.
  This is consistent with other primitives such as scalar, label etc.
2019-05-27 18:09:43 +02:00
Mark Olesen
b8dc024444 BUG: incorrect IOobject instance for absolute windows path (#1238)
STYLE: remove unused local variables in edgeMeshFormat
2019-05-23 10:27:06 +01:00
Mark Olesen
061eb53fb5 ENH: improvements, modernization of matrix containers (#1220)
- add iterators, begin/end, empty() methods for STL behaviour.
  Use standard algorithms where possible
     * std::fill, std::copy
     * std::min_element, std::max_element

- access methods consistent with other OpenFOAM containers:
     * data(), cdata(), uniform()

- Use ListPolicy to impose output line breaks

- Can recover matrix storage for re-use elsewhere.
  For example, to populate values with 2D i-j addressing and later
  release it as flat linear storage.

- construct/assign moveable

- added minMax() function for Matrix

- additional inplace +=, -=, *=, /= operations

- add named methods at() and rowData() to Matrix.
  Allows a better distinction between linear and row-based addressing

- low-level matrix solve on List/UList instead of Field
2019-05-22 12:18:31 +01:00
kuti
f8a70115fd ENH: add sign(), csign() methods for complex
- use std::hypot for complex mag() instead of long-hand version

- Detail::conj() function for complex or non-complex
2019-05-21 11:18:12 +01:00
Mark Olesen
32916fa845 ENH: dictionary checking methods with predicates on the input values
- can be used to check the validity of input values.

Example:

    dict.getCheck<label>("nIters", greaterOp1<label>(0));
    dict.getCheck<scalar>("relax", scalarMinMax::zero_one());

- use 'get' prefix for more regular dictionary methods.
  Eg, getOrDefault() as alternative to lookupOrDefault()

- additional ops for convenient construction of predicates

ENH: make dictionary writeOptionalEntries integer

- allow triggering of Fatal if default values are used

ENH: additional scalarRange static methods: ge0, gt0, zero_one

- use GREAT instead of VGREAT for internal placeholders

- additional MinMax static methods: gt, le
2019-05-21 19:10:14 +01:00
Mark Olesen
3a00dd9b9a CONFIG: use C++11 regex instead of POSIX for newer compilers
BUG: The ok_ flag was not being updated in the regExpCxx::set() method
2019-05-21 12:29:52 +01:00
Mark Olesen
6c8f6a2f50 ENH: support all 12 Euler rotation orders (#1292)
- adjust naming of quaternion 'rotationSequence' to be 'eulerOrder'
  to reflect its purpose.

- provide rotation matrices directly for these rotation orders in
  coordinateRotations::euler for case in which the rotation tensor
  is required but not a quaternion.
2019-05-10 11:20:21 +02:00
Mark Olesen
0f1fcb97b5 ENH: additional MinMax span() and zero_one() methods 2019-05-08 12:12:00 +02:00
Mark Olesen
ac317699d8 ENH: additional HashTable emplace/insert/set methods (#1286)
- support move insert/set and emplace insertion.

  These adjustments can be used for improved memory efficiency, and
  allow hash tables of non-copyable objects (eg, std::unique_ptr).

- extend special HashTable output treatment to include pointer-like
  objects such as autoPtr and unique_ptr.

ENH: HashTable::at() method with checking. Fatal if entry does not exist.
2019-05-06 08:34:39 +02:00
Mark Olesen
23e5d43e4e ENH: add colour for x3d surface writer (#1057)
- can be used for outputing sampled surfaces in x3d format for direct
  import in other rendering tools.
2019-05-06 17:13:22 +02:00
Mark Olesen
3089a11647 STYLE: comments and parameter names for coordinateRotations::euler 2019-05-03 13:31:00 +02:00
Mark Olesen
675aa8053a ENH: support pointer cast from autoPtr 2019-05-03 09:59:53 +02:00
mattijs
912009c458 ENH: overset: insert remote interpolation into lduMatrix
All remote contributions to interpolation stencils now
get added as 'processor' type lduInterfaces. This guarantees
a consistent matrix, e.g. initial residual is normalised to 1.

Second change is the normalisation of the interpolation discretisation
which uses the diagonal from the unmodified equation. This helps
GAMG.
2019-05-02 16:49:48 +01:00
Mark Olesen
26a391b1e9 ENH: no string quotes when using OSHA1stream (#1301)
- previously would have different SHA1 depending on whether the
  string was a C-string, a C++-string or if the SHA1 was calculated
  directly or via the OSHA1stream.

    - SHA1("string")
    - OSHA1stream << "string";
    - OSHA1stream << string("string");

  By avoiding string quoting on output, they now all deliver the same
  result. This also means that the following will no longer change the SHA1
  content, since it does not add anything:

    osha<< string() << string() << string() << string();

  This would have previously add a pair of double quotes each time!
2019-04-30 12:43:59 +02:00
Mark Olesen
4a51239820 STYLE: restrict posix and ieee754 random tests (non-portable) to linux 2019-04-30 10:05:53 +02:00
mattijs
25e0182fca COMP: label64: fixes #1297. 2019-04-29 14:23:05 +01:00
Mark Olesen
beefee48d4 COMP: adjust compilation order with updated interdependencies
- Eg, with surface writers now in surfMesh, there are fewer libraries
  depending on conversion and sampling.

COMP: regularize linkage ordering and avoid some implicit linkage (#1238)
2019-04-28 14:44:33 +02:00
Mark Olesen
59da4cf56d STYLE: use uintptr_t cast instead of long when reporting addresses 2019-04-29 08:15:48 +02:00
Andrew Heather
6146667284 Merge branch 'feature-indirect-lists' into 'develop'
Feature indirect lists

See merge request Development/OpenFOAM-plus!253
2019-04-29 10:48:17 +01:00
Mark Olesen
180a284814 ENH: add '==' and '!=' operators for PackedList/bitSet
- also available as equal() member function
2019-04-26 13:01:39 +02:00
Mark Olesen
e1609d16d1 STYLE: use degToRad() instead of pi/180 2019-04-26 11:48:27 +02:00
Mark Olesen
661d1f53df ENH: additional rotation tests (#1292) 2019-04-25 20:22:06 +02:00
Mark Olesen
bf30779b64 ENH: add partial sorting to SortableList 2019-04-24 19:03:00 +02:00
Mark Olesen
b3fa961991 ENH: add Ostream output for std::vector
- convenient when using data structures from other codes
2019-04-16 18:00:20 +02:00
Mark Olesen
d14f181529 ENH: add tracking of label/scalar size when reading IOobject header
- extracts values from the arch "LSB;label=32;scalar=64" header entry
  to provision for managing dissimilar primitive sizes.

  Compensate for the additional IOobject members by narrowing the types
  for the (objectState, readOption, writeOption) enumerations
2019-04-16 12:23:01 +02:00
Mark Olesen
765493b69f ENH: generalize indirect lists and support new types
- use an IndirectListBase class for various indirect list types.

- new SortList type

  In some places the SortList can be used as a lightweight alternative
  to SortableList to have the convenience of bundling data and sort
  indices together, but while operating on existing data lists.
  In other situations, it can be useful as an alternative to
  sortedOrder.  For example,

        pointField points = ...;

        labelList order;
        sortedOrder(points, order);

        forAll(order, i)
        {
            points[order[i]] = ...;
        }

   Can be replaced with the following (with the same memory overhead)

        pointField points = ...;

        SortList<point> sortedPoints(points);

        for (point& pt : sortedPoints)
        {
            pt = ...;
        }

- new SliceList type (#1220), which can be used for stride-based
  addressing into existing lists
2019-04-11 15:24:33 +02:00
Mark Olesen
b56fbc4377 ENH: replace OSspecific clockValue with std::chrono version (#1278)
- aids with portability and maintenance (#1238)
2019-04-11 10:07:54 +02:00
Mark Olesen
d5c01f1aa4 ENH: support external MPI initialize / finalize (#1266) 2019-04-01 18:44:23 +02:00
Mark Olesen
39c91d8440 ENH: support HashTable iterator pointer dereference 2019-04-06 16:00:21 +02:00
Mark Olesen
d4eb17a9ff ENH: new sliceRange class
- this is somewhat like labelRange, but with a stride.
  Can be used to define slices (of lists, fields, ..) or as a range specifier
  for a for-loop. For example,

      for (label i : sliceRange(0, 10, 3))
      {
          ...
      }
2019-04-06 15:07:53 +02:00
Mark Olesen
06e709c26f ENH: added labelRange += and -= operators
- removed unused decrement() and increment() methods, which provided
  identical functionality as the ++, +=, --, -= operators.
2019-04-06 15:07:53 +02:00
Mark Olesen
ae94509f42 ENH: wrap internal POSIX directory reading as an iterator class 2019-04-03 17:34:56 +02:00
Mark Olesen
567fced30b ENH: add pTraits<complex> (#1247) 2019-04-04 19:00:29 +02:00
Mark Olesen
1c4e32fb6a ENH: add iterators to VectorSpace (#1265)
- this adds support for various STL operations including

    * sorting, filling, find min/max element etc.
    * for-range iteration

STYLE: use constexpr for VectorSpace rank
2019-04-04 17:14:27 +02:00
Mark Olesen
f3670521cd STYLE: use std:: qualifier on ::abort, ::exit
- consistent with use of <cstdlib> and makes for a stronger distinct
  from Foam::abort etc.
2019-04-03 20:24:30 +02:00
Mark Olesen
939144233c STYLE: adjusted wording and messages for wmake
- add an additional test for wmake pre-processing
2019-04-03 08:57:01 +02:00
Mark Olesen
89245fa796 ENH: allow space char in fileName is now configurable (#1008)
- having whitespace in fileName can be somewhat fragile since it means
  that the fileName components do not necessarily correspond to a
  'Foam::word'. But in many cases it will work provided that spaces
  are not present in the final portion of the simulation directory
  itself.

    InfoSwitches
    {
        // Allow space character in fileName (use with caution)
        allowSpaceInFileName    0;
    }

- now use doClean=true as default for fileName::validate(). Was false.

  Unlike fileName::clean() this requires no internal string rewrite
  since the characters are being copied.  Also handle any path
  separator transformations (ie, backslash => forward slash) at the
  same time. This makes it resemble the std::filesystem a bit more.
2019-04-01 16:40:22 +02:00
Mark Olesen
37819905c2 ENH: add some function support for complexField (#1247)
- operators are still incomplete, as are dimensioned fields,
  field-fields etc.

- split complexFields into separate complexField, complexVectorField files
2019-03-29 11:57:02 +01:00
Mark Olesen
fcba64913a ENH: conversion and function improvements for complex (#1247)
- add construction from and conversion to std::complex, which allows
  easier wrapping of functions

- add Foam:: functions for complex versions of sin, cos, ...
2019-03-29 11:03:48 +01:00
Mark Olesen
1788bce0a2 ENH: changed definition of complex::one (#1247)
- was historically defined as (1 1), but it is more consistent with
  the concept of one to have a real component only.

  Now defined as (1 0):  1+0i

STYLE: remove obscure '!' operator for complex conjugate

- either use the member function or the '~' operator
2019-03-27 08:24:03 +01:00
Mark Olesen
a1999bc92c ENH: additional construct/assignment methods for complex (#1247)
- construct/assign from Zero
2019-03-25 15:17:58 +01:00
mattijs
a33f1787b7 ENH: globalIndex: helper function to get remote values 2019-03-21 17:55:05 +00:00
Mark Olesen
4995fc5997 ENH: add findCell for PDRblockMesh 2019-03-14 16:24:20 +01:00
Mark Olesen
cdb36e08e9 COMP: provision for non-existence of bessel functions
- These are not defined in the C++ standard for cmath, so allow for
  compilation without them. Will need to provide replacements in the
  future or rework.
2019-03-15 11:19:15 +01:00
Mark Olesen
487877377d ENH: reorganize regular expressions and add C++11 regex support
- new regExpCxx wrapper for C++11 regex support with drop-in
  compatibility with existing code.

- regExpPosix (was regExp), for future phase out in favour of regExpCxx.

- The regExp header will continue to be used for defining an
  appropriate typedef corresponding to the preferred implementation.
2019-03-14 13:24:23 +01:00
Mark Olesen
9149b3579a ENH: PtrList and PtrListOps improvements
- PtrDynList support for move append list:
  can be used to concatenate pointer lists into a single one

- include resize in PtrDynList squeezeNull as being a natural
  combination

- support sorting operations for pointer lists (PtrListOps)
2019-03-13 10:53:28 +01:00
Mark Olesen
773ec00d4b ENH: improved consistency of surface writers (#1232)
- remove writeGeometry() in favour of write() and make it pure virtual
  so that all writers must explicitly deal with it.

- establish proxy extension at construction time and treated as an
  invariant thereafter. This avoids potentially surprising changes in
  behaviour when writing.
2019-03-11 15:09:03 +01:00
Mark Olesen
97be0673dc ENH: additional constructors for IjkField 2019-02-27 08:01:19 +01:00
Mark Olesen
4d499d3c20 ENH: basic i-j-k Field container (#1216)
- this is a simple container for fields with i-j-k addressing.

  It does not support field operations directly, but is primarily
  intended to be used when assembling field information with i-j-k
  logic. After assembly, the field can be transferred to a regular
  field for normal operations.  Eg,

      IjkField<scalar> assemble({15, 16, 200});

      // .. fill in i-j-k fields

      Field<scalar> final(std::move(assemble));
      assemble.clear();   // be pedantic
      ...
2019-02-24 18:16:17 +01:00
Mark Olesen
e9323ecbbb STYLE: use finiteVolume in Make/options placeholder 2019-02-24 17:32:13 +01:00
Mark Olesen
84270ed667 ENH: new PDRblockMesh mesh generation utility (issue #1216)
- While a rectilinear mesh can be created with blockMesh, not every mesh
  created with blockMesh will satisfy the requirements for being a
  rectilinear mesh.

  This alternative to blockMesh uses a single block that is aligned
  with the xy-z directions and specifications of the control points,
  mesh divisions and expansion ratios. For example,

    x
    {
        points  ( -13.28 -0.10 6.0 19.19 );
        nCells  (  10  12 10 );
        ratios  ( 0.2   1  5 );
    }

    y { ... }
    z { ... }

  With only one block, the boundary patch definition is simple and the
  canonical face number is used directly. For example,

    inlet
    {
        type    patch;
        faces   ( 0 );
    }
    outlet
    {
        type    patch;
        faces   ( 1 );
    }

    sides
    {
        type    patch;
        faces   ( 2 3 );
    }

    ...

- After a mesh is defined, it is trivial to retrieve mesh-related
  information such as cell-volume, cell-centres for any i-j-k location
  without an actual polyMesh.

STYLE: remove -noFunctionObjects from blockMesh

- no time loop, so function objects cannot be triggered anyhow.
2019-02-23 15:45:32 +01:00
Mark Olesen
7795adfcb4 ENH: additional PtrList constructor and memory management method
- PtrList::release() method.

  Similar to autoPtr and unique_ptr and clearer in purpose than
  using set(i,nullptr)

- Construct from List of pointers, taking ownership.

  Useful when upgrading code. Eg,

     List<polyPatch*> oldList = ...;
     PtrList<polyPatch> newList(oldList);
     ...

BUG: incorrect resizing method names (PtrDynList) in previously unused code
2019-02-22 15:55:17 +01:00
Mark Olesen
95a33c2f68 ENH: wordRes::uniq() removes all duplicates
- previously just removed duplicate literals, but now remove any
  duplicates.

- Replace previous wordHashSet implementation with a linear search
  instead. The lists are normally fairly small and mostly just have
  unique entries anyhow. This reduces the overall overhead.
2019-02-14 11:03:04 +01:00
Mark Olesen
e3e0d7c8b9 ENH: add possibility to change const reference in tmp.
- previously it was only possible to reset a pointer, but not to
  change a const-reference directly (needed a swap() to do this).
2019-02-11 18:23:06 +01:00
Mark Olesen
eaa3da72c5 ENH: extend size of NullObject for safer reinterpret cast
- previously had a single pointer/value zeros (8 bytes), this meant
  that the reinterpret cast to a List would yield a reference that
  could be unsafe under certain conditions.

  Eg,
     const labelList& myList = labelList::null();

     Info<< myList.size() << nl; // OK since size is the first parameter

     SubList<label>(myList, 0);  // Unsafe

  The SubList usage is unsafe since it passes in pointer and size into
  the underlying UList. However, the pointer from the labelList::null()
  will be whatever happens to be around in memory immediately after the
  NullObject singleton. This is mostly not a problem if the List size
  is always checked, but does mean that the data pointer is rather
  dubious.

- Increase the size of the nullObject singleton to 32 bytes of zeros
  to ensure that most reinterpret casting will not result in objects
  that reference arbitrary memory.

  The 32-byte data size is rather arbitrary, but covers most basic
  containers.
2019-02-07 11:13:13 +01:00
OpenFOAM bot
154029ddd0 BOT: Cleaned up header files 2019-02-06 12:28:23 +00:00
Mark Olesen
9a7029004c ENH: minMax, minMaxMag as functions and field functions
- Global functions are unary or combining binary functions, which are
  defined in MinMax.H (MinMaxOps.H).

  There are also global reduction functions (gMinMax, gMinMaxMag)
  as well as supporting 'Op' classes:

  - minMaxOp, minMaxEqOp, minMaxMagOp, minMaxMagEqOp

  Since the result of the functions represents a content reduction
  into a single MinMax<T> value (a min/max pair), field operations
  returning a field simply do not make sense.

- Implemented for lists, fields, field-fields, DimensionedField,
  GeometricField (parallel reducing, with boundaries).

- Since the minMax evaluates during its operation, this makes it more
  efficient for cases where both min/max values are required since it
  avoids looping twice through the data.

  * Changed GeometricField writeMinMax accordingly.

ENH: clip as field function

- clipping provides a more efficient, single-pass operation to apply
  lower/upper limits on single or multiple values.

  Examples,

    scalarMinMax limiter(0, 1);

    limiter.clip(value)

       -> returns a const-ref to the value if within the range, or else
          returns the appropriate lower/upper limit

    limiter.inplaceClip(value)

       -> Modifies the value if necessary to be within lower/upper limit

  Function calls

    clip(value, limiter)

       -> returns a copy after applying lower/upper limit

    clip(values, limiter)

       -> returns a tmp<Field> of clipped values
2019-01-10 09:43:23 +01:00
Mark Olesen
3316055267 ENH: minor adjustments to Switch
- assignment operators return a value, for consistency with bool.

- partial revert of DEFAULT_TRUE, DEFAULT_FALSE, to reduce complexity.
2019-01-29 09:38:09 +01:00
Mark Olesen
a3f960e36f ENH: add 'default' as possible Switch state, but not as input/output
- in some circumstances we need to pass a bool value upwards to the
  caller and know if the true/false value was set based on real input
  or is a default value.

  Eg, in the object::read() we might normally have

     enabled_(dict.readIfPresent(key, true));

  but would lose information about why the value is true/false.

  We can change that by using

     enabled_(dict.readIfPresent<Switch>(key, Switch::DEFAULT_ON));

  After which we can use this information is testing.

      if
      (
          child.enabled().nonDefault()
        ? child.enabled()
        : parent.enabled()
      )
      { ... }

   And thus enable output if the parent requested it explicitly or by
   default and it has not been explicitly disabled in the child.

  No difference when testing as a bool and the text representation
  of DEFAULT_ON / DEFAULT_OFF will simply be "true" / "false".

ENH: add construction of Switch from dictionary (similar to Enum)
2019-01-28 23:18:21 +01:00
Mark Olesen
87523acad3 ENH: add ListOps find/found accepting a unary predicate (#1182)
- can also be used for other purposes.
  Eg,

      if (ListOps::found(list, matcher))
      {
         ...
      }

  vs.

      if (!findStrings(matcher, list).empty())
      {
         ...
      }
2019-01-25 11:45:03 +01:00
Mark Olesen
5ec44cd51f ENH: add range check on findIndices (#1182)
- add compile-time detection of deprecated findIndex() function

- replace occurrences of findIndex() with the equivalent container
  method
2019-01-25 10:47:34 +01:00
Mark Olesen
856f45a910 Merge remote-tracking branch 'origin/master' into develop 2019-01-23 21:27:03 +01:00
Mark Olesen
a5cc0ffcad STYLE: use const reference for caught exceptions 2019-01-23 09:03:06 +01:00
Mark Olesen
8f8a4dc682 ENH: add foamDictionary -precision option (issue #1177)
- since foamDictionary doesn't use system/controlDict it will use the
  standard default precision. The '-precision' option allows adjusting
  that value.
2019-01-22 15:11:28 +01:00
Mark Olesen
73e89f9332 ENH: add UPtrList method to squeeze out (remove) null pointers
- moves any nullptr to the end of the list where they can be
  eliminated in a second step with resize()
2019-01-21 09:51:02 +01:00
Mark Olesen
ed94a2714d STYLE: use HashTable iterator 'val()' method instead of 'object()' 2019-01-18 16:26:50 +01:00
Mark Olesen
8a391b79b5 ENH: MinMax class for handling value ranges 2019-01-14 10:00:32 +01:00
Mark Olesen
00cbf5564b STYLE: add deprecated message to NamedEnum constructor
- this class really should not be used at all anymore.
  Add a message so people recognize can find any occurrences.
2019-01-10 14:49:18 +01:00
Mark Olesen
8071020518 ENH: make List output compile-time configurable (#1160)
- introduced a ListPolicy details to make the transition between
  a short list (space separated) and a long list (newline separated)
  more configurable.

  We suppress line breaks for commonly used types that often have
  short content: (word, wordRes, keyType).
2019-01-10 14:24:11 +01:00
Andrew Heather
29315f4644 DEP: Deprecated the ensightFoamReader 2019-01-17 09:35:04 +00:00
Mark Olesen
000f704e08 ENH: FixedList empty(), size(), max_size() now constexpr static (#1160)
- this allows their use as templates parameters
2019-01-10 09:35:41 +01:00
Mark Olesen
7720b59066 ENH: add dimensionSet provisioning for a dimensioned clip() method
- use file-local function to reduce some code clutter
2019-01-09 23:44:17 +01:00
Mark Olesen
cf8d500f8c ENH: export FOAM_API in dictionary (issue #1158)
- uses the value of foamVersion::api, which should be reliable.
2019-01-07 19:04:50 +01:00
Mark Olesen
2067014079 ENH: minor consistency improvements for bounding box
- a valid() method (same as !empty() call) for consistency with other
  containers and data types

- a centre() method (same as midpoint() method) for consistency with
  other OpenFOAM geometric entities
2019-01-09 09:32:23 +01:00
Mark Olesen
a0a7da2edd ENH: Pair, Tuple2 improvements (#1160)
- move constructors, construct from std::pair
- input/output of std::pair

Makes it easier when using data structures for other codes.
2019-01-08 22:16:41 +01:00
Mark Olesen
907dd6d49f STYLE: consistent indentation and template parameters for FixedList 2019-01-08 21:50:12 +01:00
Mark Olesen
14a404170b ENH: for-range, forAllIters() ... in applications/utilities
- reduced clutter when iterating over containers
2019-01-07 09:20:51 +01:00
Mark Olesen
22b659d7c0 ENH: export FOAM_API in dictionary (issue #1158)
- uses the value of foamVersion::api, which should be reliable.
2019-01-07 19:04:50 +01:00
Mark Olesen
0dbd05daa4 STYLE: minor adjustment of test case 2019-01-03 19:16:13 +01:00
Mark Olesen
6a448016aa ENH: additional read guards for dimensionedType. input consistency (#762, #1148)
- provide a lookupOrDefault constructor form, since this is a fairly
  commonly used requirement and simplifies the calling sequence.

  Before

      dimensionedScalar rhoMax
      (
          dimensionedScalar::lookupOrDefault
          (
              "rhoMax",
              pimple.dict(),
              dimDensity,
              GREAT
          )
     );

  After

      dimensionedScalar rhoMax("rhoMax", dimDensity, GREAT, pimple.dict());

- read, readIfPresent methods with alternative lookup names.

- Mark the Istream related constructors with compile-time deprecated
  warnings.

BUG: read, readIfPresent methods not handling optional dimensions (#1148)
2019-01-03 13:34:11 +01:00
Mark Olesen
af310075a0 ENH: handle dimensions in dimensioned<Type>::lookupOrAddToDict (#1116) 2019-01-03 01:30:27 +01:00
Mark Olesen
3560884abe ENH: allow direct testing of HashTable iterator as a bool
- can be used as a more natural test on the iterator.
  For example, with

     HashTable<..> table;
     auto iter = table.find(...);

  Following are now all equivalent:

    1.  if (iter != table.end()) ...
    2.  if (iter.found()) ...
    3.  if (iter) ...
2018-12-20 18:03:16 +01:00
Mark Olesen
08335beb6f ENH: add get() accessor to tmp classes
- similar to autoPtr and unique_ptr. Returns the pointer value without
  any checks. This provides a simple way for use to use either
  an autoPtr or a tmp for local memory management without accidentally
  stealing the pointer.

  Eg,

     volVectorField* ptr;
     tmp<volVectorField> tempField;

     if (someField.valid())
     {
         ptr = someField.get();
     }
     else
     {
         tempField.reset(new volVectorField(....));
         ptr = tmpField.get();
     }

     const volVectorField& withField = *ptr;

STYLE: make more tmp methods noexcept
2018-12-20 17:29:51 +01:00
Andrew Heather
9231534efa STYLE: Updating version to v1812 2018-12-19 18:07:52 +00:00
Mark Olesen
455c8ef540 ENH: simplify use of case-relative paths
- provide relativePath() for argList and for Time.
  These are relative to the case globalPath().
  Eg,

     Info<< "output: " << runTime.relativePath(outputFile) << nl;
2018-12-15 13:26:55 +01:00
Mark Olesen
2617c326d8 ENH: extend fileName::relative() method
- optionally replace stripped parent directory with the \<case\> shortcut

    "/this/path/and/subdirs/name"

    relative("/this/path")        -> "and/subdirs/name"
    relative("/this/path", true)  -> "\<case\>/and/subdirs/name"
2018-12-14 17:44:07 +01:00
Mark Olesen
1d85fecf4d ENH: use Zero when zero-initializing types
- makes the intent clearer and avoids the need for additional
  constructor casting. Eg,

      labelList(10, Zero)    vs.  labelList(10, 0)
      scalarField(10, Zero)  vs.  scalarField(10, scalar(0))
      vectorField(10, Zero)  vs.  vectorField(10, vector::zero)
2018-12-11 23:50:15 +01:00
Mark Olesen
5d9e278e92 ENH: consolidate handling of mandatory/optional command arguments
- for some special cases we wish to mark command-line arguments as
  being optional, in order to do our own treatment. For example,
  when an arbitrary number of arguments should be allowed.

  Now tag this situation with argList::noMandatoryArgs().
  The argList::argsMandatory() query can then be used in any further
  logic, including the standard default argument checking.

- with the new default check, can consolidate the special-purpose

      "setRootCaseNonMandatoryArgs.H"

  into the regular

      "setRootCase.H"

- revert to a simple "setRootCase.H" and move all the listing related
  bits to a "setRootCaseLists.H" file. This leaves the information
  available for solvers, or whoever else wishes, without being
  introduced everywhere.

- add include guards and scoping to the listing files and rename to
  something less generic.

     listOptions.H -> setRootCaseListOptions.H
     listOutput.H  -> setRootCaseListOutput.H
2018-12-13 01:45:09 +01:00
Mark Olesen
172c36c29a ENH: support search modes for etcFiles()
- similar to the foamEtcFile script -mode=... option, the specific
  search location (user/group/other) can now also specified for
  string expansions and as a numerical value for etcFile()

  For example, if searching for group or other (project) controlDict,
  but not wishing to see the user controlDict:

    1.  foamEtcFile -mode=go controlDict

    2.  fileName dictFile("<etc:go>/controlDict");
        dictFile.expand();

    3.  etcFile(controlDict, false, 0077);

  The default behaviour for searching all contexts is unchanged.

    1.  foamEtcFile controlDict

    2.  fileName dictFile("<etc>/controlDict");
        dictFile.expand();

    3.  etcFile(controlDict);
2018-12-12 13:45:32 +01:00
Mark Olesen
29a5793b5b STYLE: argList::opt method instead of the longer argList::lookupOrDefault
- also replaced a few instances of readIfPresent with opt<> for
  constant values.
2018-12-12 12:10:39 +01:00
Mark Olesen
5e4d7386ec ENH: use foamVersion::api internally in etcFiles searching (#1010)
- prefer this to using the OPENFOAM define since this improves the
  internal consistency with the build information.

  The API information could change between builds without the
  etcFiles.C being recompiled whereas the value of
  Foam::foamVersion::api is force updated during the build (triggers
  recompilation of globals.Cver)
2018-12-08 17:42:31 +01:00
Mark Olesen
bff16a0ddc STYLE: additional comments in Test-decomposePar 2018-12-05 08:42:55 +01:00
Mark Olesen
b8c257d6ad CONFIG: adjustments to environment
- provide default WM_DIR if not already set, to improve robustness if a
  reduced environment is used

- add etc/ to WM_PROJECT_SITE search. This makes the site directory
  structure consistent with the OpenFOAM structure.
  Eg,

      WM_PROJECT_SITE/etc/..
      WM_PROJECT_SITE/bin/..
      WM_PROJECT_SITE/platforms/..

- Don't set/export WM_OSTYPE.  The default is POSIX and is properly
  defaulted throughout, including in CMakeLists-OpenFOAM.txt (also for
  Catalyst)
2018-12-03 09:50:48 +01:00
Mark Olesen
4b7e11fc8b COMP: adjust headers for more detailed build info in the future (issue #1010)
- this splits a larger changeset for a gradual implementation
2018-11-29 21:01:01 +01:00
Mark Olesen
b81420e524 ENH: additional variants of IOobjectList findObject()
- cfindObject() for const pointer access.

- getObject() for mutable non-const pointer access, similar to the
     objectRegistry::getObjectPtr()

- cfindObject(), findObject(), getObject() with template type access
  to also check the headerClassName.

  For example,

      cfindObject("U")  ->  good
      cfindObject<volVectorField>("U") -> good
      cfindObject<volScalarField>("U") -> nullptr

  This allows inversion of looping logic.

    1) Obtain the names for a particular Type

       for (const word& objName : objs.sortedNames<Type>())
       {
           const IOobject* io = objs[objName];
           ...
       }

    2) Use previously obtained names and apply to a particular Type

       for (const word& objName : someListOfNames)
       {
           const IOobject* io = objs.cfindObject<Type>(objName);
           if (io)
           {
               ...
           }
       }
2018-11-28 11:28:38 +01:00
Mark Olesen
f78aa8e342 ENH: added Ostream fill() methods and corresponding IOmanip setfill()
- useful when generating formatted output such as tables.
2018-11-25 14:17:55 +01:00
Mark Olesen
0e47b0717d ENH: vtk::seriesWriter to encapsulate writing file series (issue #926) 2018-10-02 14:06:34 +02:00
Mark Olesen
42009c168e ENH: vtk::vtmWriter for generating vtkMultiBlockDataSet (.vtm) (issue #926)
- Provides a means of accumulating file entries for generating vtm
  by accumulate blocks, datasets and writing them later.

  Only a single block depth is currently supported and the methods
  are kept fairly simple.
2018-10-02 12:53:01 +02:00
Mark Olesen
1456a8ca1d STYLE: emit warning about using deprecated "~OpenFOAM" expansion
- Within strings it is preferable to use the "<etc>" instead.
  Most use cases for the old "~OpenFOAM" expansion have been obsoleted
  by the #includeEtc directive.
2018-11-23 13:12:33 +01:00
Mark Olesen
ac03307258 ENH: improve consistency in version handling (issue #1010)
- use std::string instead of c-string for the string constants

- centralize some definitions of resources into foamVersion.H

  Now expose some of the hard-coded values used in foamEtcFiles()
  so that they can be known or even overridden as required.

  Relocate to src/OpenFOAM/include as a constant location.
2018-11-23 11:08:36 +01:00
Mark Olesen
45d5d7bbc1 COMP: add minimal test application
- uses wmake, without OpenFOAM libraries.

  The application and libray serve as a minimal test case for wmake,
  but can also be used to generate a minimal library/executable pair
  target for testing of packaging etc.
2018-11-23 00:21:10 +01:00
Mark Olesen
083e9e9665 ENH: isolate version information in foamVersion names instead of globals
- For compatibility, access to the old global names is provided via
  macros
        #define FOAMversion     foamVersion::version
        #define FOAMbuild       foamVersion::build
        #define FOAMbuildArch   foamVersion::buildArch

- this isolation makes it easier to provide additional scoped methods
  for dealing with version related information.  Eg, printBuildInfo()
2018-11-22 11:50:24 +01:00
Mark Olesen
5a9a2935ad ENH: modernize code in dimensionSet, dimensionSets
- 'unfriend' operators on dimensionSet, since they operate without
  requiring access to non-public members.

- add missing invTransform() function for dimensionSet.

- make inv(const dimensionSet&) available as
  operator~(const dimensionSet&), which can be used instead
  of (dimless/ds).
2018-11-20 18:16:17 +01:00
Mark Olesen
72c4b3186b ENH: added dimensionedType::writeEntry method
- writing of dictionary entry with the name of the dimensionedType
  suppressed if it is identical to the keyword.
  This corresponds to the input requirements.
2018-11-20 16:26:44 +01:00
Mark Olesen
dd87c98393 ENH: add read guard for dimensionedType constructors (#762)
- deprecate dimensionedType constructors using an Istream in favour of
  versions accepting a keyword and a dictionary.

  Dictionary entries are almost the exclusive means of read
  constructing a dimensionedType. By construct from the dictionary
  entry instead of doing a lookup() first, we can detect possible
  input errors such as too many tokens as a result of a input syntax
  error.

  Constructing a dimensionedType from a dictionary entry now has
  two forms.

  1.  dimensionedType(key, dims, dict);

      This is the constructor that will normally be used.

      It accepts entries with optional leading names and/or
      dimensions. If the entry contains dimensions, they are
      verified against the expected dimensions and an IOError is
      raised if they do not correspond. On conclusion, checks the
      token stream for any trailing rubbish.

  2.  dimensionedType(key, dict);

      This constructor is used less frequently.

      Similar to the previous description, except that it is initially
      dimensionless. If entry contains dimensions, they are used
      without further verification. The constructor also includes a
      token stream check.

      This constructor is useful when the dimensions are entirely
      defined from the dictionary input, but also when handling
      transition code where the input dimensions are not obvious from
      the source.

      This constructor can also be handy when obtaining values from
      a dictionary without needing to worry about the input dimensions.
      For example,

         Info<< "rho: " << dimensionedScalar("rho", dict).value() << nl;

      This will accept a large range of inputs without hassle.

ENH: consistent handling of dimensionedType for inputs (#1083)

BUG: incorrect Omega dimensions (fixes #2084)
2018-11-20 15:14:10 +01:00
Mark Olesen
4bf4b89af4 ENH: support scalar predicates and lists of scalar predicates (#1056) 2018-11-13 14:12:53 +01:00
Mark Olesen
1883a872a1 STYLE: adds comments in empty Make/options files
- easier when making modifications

STYLE: spelling in topoSetSource comments
2018-11-13 15:21:13 +01:00
Mark Olesen
8752120ad5 COMP: use hard-coded values for fieldTypes (issue #1068)
- this seems to be the only reliable means of obtaining the values.

  Using typeName_() yields the wrong value.

  Using the typeName causes initialization issues
  (segfault when executing on some systems).
2018-11-12 16:39:55 +01:00
Mark Olesen
90dd4b30cd TUT: syntax typo (#1059) 2018-11-12 13:59:38 +01:00
Mark Olesen
9bc61e5f41 ENH: improve IOobjectList name filtering
- support name filtering by class based on <Type> or predicates.
  Eg,

      objects.sortedNames<volScalarField>(namePattern);
  vs  objects.sortedNames(volScalarField::typeName, namePattern);

  These can also be used directly for untyped name matching.
  Eg,
      objects.sortedNames<void>(namePattern);

  Can also use a predicate:

      objects.sortedNames(wordRe("vol.*Field"), namePattern);
      objects.sortedNames
      (
          [](const word& clsName){ return clsName.startsWith("vol"); },
          namePattern
      );
2018-11-12 08:55:45 +01:00
Mark Olesen
f94d724a93 ENH: add objectRegistry::count() methods
- can be useful for obtaining information about number of fields.
  Eg,

       nScalar = mesh.count<volScalarField>(wordre);
2018-11-11 19:00:54 +01:00
Mark Olesen
4965ea4988 ENH: simplify/extend objectRegistry code with templated predicates
- replace explicit use of wordRe, wordRes, wordHashSet as filters
  with a MatchPredicate.

- support filtering by class based on <Type> or predicates
2018-11-10 17:20:32 +01:00
Mark Olesen
faaa93fdb5 ENH: add IOobjectList::findObject() method
- naming similar to objectRegistry, with unambiguous resolution.
  The lookup() methods have different return types depending on the
  calling parameter.

STYLE: use IOobjectListTemplates.C for implementations

- previously included as local definition within IOobjectList.C,
  but will be adding more templated methods soon.

- adjust parameters (eg, matchName instead of matcher) to show their
  function

ENH: handle objectRegistry::names<void>(...)

- this is equivalent to no Type restriction, and can be used when
  filtering names. Eg,

     obr.names<void>(wordRe..);
2018-11-09 21:57:55 +01:00
Mark Olesen
91cfe4c271 ENH: add wordRes::matching() method
- returns indices of matching entries.
2018-11-09 21:21:15 +01:00
Mark Olesen
6f3471d5fb STYLE: protect and comment test of illegal access (#1066) 2018-11-08 14:46:35 +01:00
Mattijs Janssens
c20b12b62f Feature patch function1 2018-10-29 09:44:31 +00:00
Mark Olesen
07dafe7b0b STYLE: use range-for when looping dictionary entries.
- as part of the cleanup of dictionary access methods (c6520033c9)
  made the dictionary class single inheritance from IDLList<entry>.

  This eliminates any ambiguities for iterators and allows
  for simple use of range-for looping.

  Eg,
      for (const entry& e : topDict))
      {
          Info<< "entry:" << e.keyword() << " is dict:" << e.isDict() << nl;
      }

   vs

      forAllConstIter(dictionary, topDict, iter))
      {
          Info<< "entry:" << iter().keyword()
              << " is dict:" << iter().isDict() << nl;
      }
2018-10-19 13:08:24 +02:00
Mark Olesen
3b74512231 ENH: cleanup of Enum class
- more dictionary-like methods, enforce keyType::LITERAL for all
  lookups to avoid any spurious keyword matching.

- new readEntry, readIfPresent methods

- The get() method replaces the now deprecate lookup() method.

- Deprecate lookupOrFailsafe()
  Failsafe behaviour is now an optional parameter for lookupOrDefault,
  which makes it easier to tailor behaviour at runtime.

- output of the names is now always flatted without line-breaks.
  Thus,

     os << flatOutput(someEnumNames.names()) << nl;
     os << someEnumNames << nl;

  both generate the same output.

- Constructor now uses C-string (const char*) directly instead of
  Foam::word in its initializer_list.

- Remove special enum + initializer_list constructor form since
  it can create unbounded lookup indices.

- Removd old hasEnum, hasName forms that were provided during initial
  transition from NamedEnum.

- Added static_assert on Enum contents to restrict to enum or
  integral values.  Should not likely be using this class to enumerate
  other things since it internally uses an 'int' for its values.

  Changed volumeType accordingly to enumerate on its type (enum),
  not the class itself.
2018-10-18 12:57:32 +02:00
Mark Olesen
e0255cfff2 ENH: add compareOp for three-way comparison
- similar to the \c <=> operator in C++20.
  Primarily for use when defining cascaded sort function objects.
2018-10-17 09:29:28 +02:00
Mark Olesen
8b569b16d1 STYLE: logical ops return bool (issue #1043)
- these currently only with bool parameters, but the return value should
  nonetheless always be a bool value:

      andOp(), orOp(), lessOp(), lessEqOp(), greaterOp(), greaterEqOp()

- renamed the unused eqEqOp() to equalOp() for naming consistency with
  the equal() global function.

ENH: equalOp() specialization for scalars

- function object version of the equal() function.
  The default constructor uses the same tolerance (VSMALL),
  but can also supply an alternative tolerance on construction.
2018-10-17 07:59:26 +02:00
Mark Olesen
0a0fee88a0 STYLE: update fileName docs and minor code cleanup 2018-10-16 23:03:38 +02:00
Mark Olesen
77017e58f4 ENH: support token stream checking to entry (issue #762)
- Eg,
    scalar val(-GREAT);

    const entry* eptr = dict.findEntry(k);

    if (eptr)
    {
        val = eptr.get<scalar>();

        // Or
        eptr.readEntry(val);
    }
2018-10-16 11:13:35 +02:00
Mark Olesen
7864672c78 ENH: make cwd() behaviour user-adjustable (issue #1007)
- with the 'cwd' optimization switch it is possible to select the
  preferred behaviour for the cwd() function.

  A value of 0 causes cwd() to return the physical directory,
  which is what getcwd() and `pwd -P` return.
  Until now, this was always the standard behaviour.

  With a value of 1, cwd() instead returns the logical directory,
  which what $PWD contains and `pwd -L` returns.
  If any of the sanity checks fail (eg, PWD points to something other
  than ".", etc), a warning is emitted and the physical cwd() is
  returned instead.

  Apart from the optical difference in the output, this additional
  control helps workaround file systems with whitespace or other
  characters in the directory that normally cause OpenFOAM to balk.
  Using a cleaner symlink elsewhere should skirt this issue.

  Eg,
      cd $HOME
      ln -s "/mounted volume/user/workdir"  workdir
      cd workdir
      # start working with OpenFOAM
2018-10-16 01:30:44 +02:00
Mark Olesen
c6520033c9 ENH: rationalize dictionary access methods
- use keyType::option enum to consolidate searching options.
  These enumeration names should be more intuitive to use
  and improve code readability.

    Eg,   lookupEntry(key, keyType::REGEX);
    vs    lookupEntry(key, false, true);

  or

    Eg,   lookupEntry(key, keyType::LITERAL_RECURSIVE);
    vs    lookupEntry(key, true, false);

- new findEntry(), findDict(), findScoped() methods with consolidated
  search options for shorter naming and access names more closely
  aligned with other components. Behave simliarly to the
  methods lookupEntryPtr(), subDictPtr(), lookupScopedEntryPtr(),
  respectively. Default search parameters consistent with lookupEntry().

    Eg, const entry* e = dict.findEntry(key);
    vs  const entry* e = dict.lookupEntryPtr(key, false, true);

- added '*' and '->' dereference operators to dictionary searchers.
2018-10-15 16:16:12 +02:00
Mark Olesen
8eddcc072a ENH: avoid readScalar, readLabel etc from dictionary (#762, #1033)
- use the dictionary 'get' methods instead of readScalar for
  additional checking

     Unchecked:  readScalar(dict.lookup("key"));
     Checked:    dict.get<scalar>("key");

- In templated classes that also inherit from a dictionary, an additional
  'template' keyword will be required. Eg,

     this->coeffsDict().template get<scalar>("key");

  For this common use case, the predefined getXXX shortcuts may be
  useful. Eg,

     this->coeffsDict().getScalar("key");
2018-10-12 08:14:47 +02:00
Mattijs Janssens
fdf19d67a4 Merge branch 'feature-coordinateSystem' into 'develop'
coordinate system improvements

See merge request Development/OpenFOAM-plus!211
2018-10-11 16:32:03 +01:00
Mark Olesen
a77ab5d4eb STYLE: relocate distributed flag into ParRunControl
- adjust member order in TimePaths to better packing
2018-10-11 09:12:01 +02:00
Mark Olesen
f7c85b034b STYLE: clearer handling of argList -case internals (issue #1037) 2018-10-11 08:32:43 +02:00
Mark Olesen
2cd2732fed ENH: avoid change when setting UPtrList twice (issue #1035)
UPtrList::set(const label i, T* ptr);

No-op if the new pointer value is identical to the current content.
This avoid memory management issues.
2018-10-09 08:27:50 +02:00
Mark Olesen
3b77493abc ENH: wordRes matcher method that distinguishes literal vs. regex
- useful for customizing the behaviour of white/black lists depending
  on the type of the match.
2018-10-07 18:30:33 +02:00
Mark Olesen
501326b27a ENH: additional constructor and methods for regionProperties
- can now construct with READ_IF_PRESENT and use count() to determine
  if it was loaded. names() and sortedNames() for a collected overview.
2018-10-01 16:01:02 +02:00
Mark Olesen
8548009eee ENH: generalize instant to be templated, movable, etc
- allows reuse for other purposes
2018-10-03 14:05:45 +02:00
Mark Olesen
6c91048e8b ENH: fileName hasPath(), removePath() methods
- improved move constructors/assignments for fileName, string, etc
2018-10-03 14:05:45 +02:00
Mark Olesen
6697bb4735 ENH: improve, simplify, rationalize coordinate system handling (issue #863)
Previously the coordinate system functionality was split between
coordinateSystem and coordinateRotation. The coordinateRotation stored
the rotation tensor and handled all tensor transformations.

The functionality has now been revised and consolidated into the
coordinateSystem classes. The sole purpose of coordinateRotation
is now just to provide a selectable mechanism of how to define the
rotation tensor (eg, axis-angle, euler angles, local axes) for user
input, but after providing the appropriate rotation tensor it has
no further influence on the transformations.

--

The coordinateSystem class now contains an origin and a base rotation
tensor directly and various transformation methods.

  - The origin represents the "shift" for a local coordinate system.

  - The base rotation tensor represents the "tilt" or orientation
    of the local coordinate system in general (eg, for mapping
    positions), but may require position-dependent tensors when
    transforming vectors and tensors.

For some coordinate systems (currently the cylindrical coordinate system),
the rotation tensor required for rotating a vector or tensor is
position-dependent.

The new coordinateSystem and its derivates (cartesian, cylindrical,
indirect) now provide a uniform() method to define if the rotation
tensor is position dependent/independent.

The coordinateSystem transform and invTransform methods are now
available in two-parameter forms for obtaining position-dependent
rotation tensors. Eg,

      ... = cs.transform(globalPt, someVector);

In some cases it can be useful to use query uniform() to avoid
storage of redundant values.

      if (cs.uniform())
      {
          vector xx = cs.transform(someVector);
      }
      else
      {
          List<vector> xx = cs.transform(manyPoints, someVector);
      }

Support transform/invTransform for common data types:
   (scalar, vector, sphericalTensor, symmTensor, tensor).

====================
  Breaking Changes
====================

- These changes to coordinate systems and rotations may represent
  a breaking change for existing user coding.

- Relocating the rotation tensor into coordinateSystem itself means
  that the coordinate system 'R()' method now returns the rotation
  directly instead of the coordinateRotation. The method name 'R()'
  was chosen for consistency with other low-level entities (eg,
  quaternion).

  The following changes will be needed in coding:

      Old:  tensor rot = cs.R().R();
      New:  tensor rot = cs.R();

      Old:  cs.R().transform(...);
      New:  cs.transform(...);

  Accessing the runTime selectable coordinateRotation
  has moved to the rotation() method:

      Old:  Info<< "Rotation input: " << cs.R() << nl;
      New:  Info<< "Rotation input: " << cs.rotation() << nl;

- Naming consistency changes may also cause code to break.

      Old:  transformVector()
      New:  transformPrincipal()

  The old method name transformTensor() now simply becomes transform().

====================
  New methods
====================

For operations requiring caching of the coordinate rotations, the
'R()' method can be used with multiple input points:

       tensorField rots(cs.R(somePoints));

   and later

       Foam::transformList(rots, someVectors);

The rotation() method can also be used to change the rotation tensor
via a new coordinateRotation definition (issue #879).

The new methods transformPoint/invTransformPoint provide
transformations with an origin offset using Cartesian for both local
and global points. These can be used to determine the local position
based on the origin/rotation without interpreting it as a r-theta-z
value, for example.

================
  Input format
================

- Streamline dictionary input requirements

  * The default type is cartesian.
  * The default rotation type is the commonly used axes rotation
    specification (with e1/e2/3), which is assumed if the 'rotation'
    sub-dictionary does not exist.

    Example,

    Compact specification:

        coordinateSystem
        {
            origin  (0 0 0);
            e2      (0 1 0);
            e3      (0.5 0 0.866025);
        }

    Full specification (also accepts the longer 'coordinateRotation'
    sub-dictionary name):

        coordinateSystem
        {
            type    cartesian;
            origin  (0 0 0);

            rotation
            {
                type    axes;
                e2      (0 1 0);
                e3      (0.5 0 0.866025);
            }
        }

   This simplifies the input for many cases.

- Additional rotation specification 'none' (an identity rotation):

      coordinateSystem
      {
          origin  (0 0 0);
          rotation { type none; }
      }

- Additional rotation specification 'axisAngle', which is similar
  to the -rotate-angle option for transforming points (issue #660).
  For some cases this can be more intuitive.

  For example,

      rotation
      {
          type    axisAngle;
          axis    (0 1 0);
          angle   30;
      }
  vs.
      rotation
      {
          type    axes;
          e2      (0 1 0);
          e3      (0.5 0 0.866025);
      }

- shorter names (or older longer names) for the coordinate rotation
  specification.

     euler         EulerRotation
     starcd        STARCDRotation
     axes          axesRotation

================
  Coding Style
================
- use Foam::coordSystem namespace for categories of coordinate systems
  (cartesian, cylindrical, indirect). This reduces potential name
  clashes and makes a clearer declaration. Eg,

      coordSystem::cartesian csys_;

  The older names (eg, cartesianCS, etc) remain available via typedefs.

- added coordinateRotations namespace for better organization and
  reduce potential name clashes.
2018-10-01 13:54:10 +02:00
Mark Olesen
7d88075842 ENH: dictionary lookup with detection of zero tokens (#1033)
- the opposite problem from issue #762. Now we also test if the input
  token stream had any tokens at all.

- called by the dictionary get<> and readEntry() methods.
2018-10-05 09:56:17 +02:00
Mark Olesen
4a61042f3f ENH: add column access and other methods for Tensor
- Can now retrieve or set a column/row of a tensor.
  Either compile-time or run-time checks.

  Get
     t.col<1>();   t.col(1);
     t.row<1>();   t.row(1);

  Set
     t.col<1>(vec);   t.col(1,vec);
     t.row<1>(vec);   t.row(1,vec);

  The templated versions are compile-time checked

     t.col<3>();
     t.col<3>(vec);

  The parameter versions are run-time checked

     t.col(3);
     t.col(3,vec);

ENH: provide named access to tensor/tensor inner product as inner()
2018-09-28 11:20:31 +02:00
Mark Olesen
64c3e484bb STYLE: add nBoundaryFaces() method to primitiveMesh
- nBoundaryFaces() is often used and is identical to
  (nFaces() - nInternalFaces()).

- forward the mesh nInternalFaces() and nBoundaryFaces() to
  polyBoundaryMesh as nFaces() and start() respectively,
  for use when operating on a polyBoundaryMesh.

STYLE:

- use identity() function with starting offset when creating boundary maps.

     labelList map
     (
         identity(mesh.nBoundaryFaces(), mesh.nInternalFaces())
     );

  vs.

     labelList map(mesh.nBoundaryFaces());
     forAll(map, i)
     {
         map[i] = mesh.nInternalFaces() + i;
     }
2018-09-27 10:17:30 +02:00
Mark Olesen
12c903bba8 ENH: define nameOp<>, typeOp<>, sizeOp<> functors (issue #1013) 2018-09-19 15:32:04 +02:00
Andrew Heather
d3812b9b69 Merge remote-tracking branch 'origin/master' into develop 2018-08-29 13:51:40 +01:00
Will Bainbridge
5e7a766159 BUG: cubicEqn, quadraticEqn: Correction to repeated roots
Also extended the cubic equation test routine and modified the error
methods so that they more accurately generate the round of error of
evaluation.

This resolves bug report https://bugs.openfoam.org/view.php?id=3015
2018-07-24 15:54:32 +01:00
Andrew Heather
6e35bcda70 ENH: Updated config for release v1806 2018-06-28 12:56:00 +01:00
Mark Olesen
be07fc9bbe STYLE: some test apps compiling into wrong location (issue #876) 2018-06-27 10:31:35 +02:00
Mark Olesen
30b4eda7a4 TUT: update some old keywords found in tutorials
- functionObjectLibs -> libs
- redirectType -> name
- change deprecated writeCompression flags types to Switch.

- cleanup some trailing ';;' from some dictionaries
2018-06-26 14:18:52 +02:00
Mark Olesen
62b83a76a4 ENH: face, triFace sign() method analogous to plane
- a quick test for which side of the face a point is located
2018-08-14 10:08:22 +02:00
Mark Olesen
b41d5ed523 STYLE: remove deprecated constraints format from tutorials 2018-07-11 17:02:40 +02:00
Mark Olesen
ae36f5f504 ENH: change argList get<> and getList<> from read<>, readList<>
- more consistent with dictionary method naming. The get<> or
  getList<> returns a value, doesn't read into a existing location.
2018-08-09 11:27:36 +02:00
Mark Olesen
dd9ecd4988 ENH: add missing Hash function for List/UList (issue #966)
- there were previously no hashing mechanisms for lists so they
  would fall back to the definition for primitives and hash the
  memory location of the allocated List object.

- provide a UList::Hash<> sub-class for inheritance, and also a global
  specialization for UList<T>, List<T> such that the hash value for
  List<List<T>> cascades properly.

- provide similar function in triFace to ensure that it remains
  similar in behaviour to face.

- added SymmHash to Pair, for use when order is unimportant.

STYLE: use string::hash() more consistently

- no particular reason to use Hash<word>() which forwards to
  string::hash() anyhow
2018-08-08 23:54:27 +02:00
Mark Olesen
e0f83938ee ENH: ignore -noFunctionObjects option when disabled
- With argList::noFunctionObjects() we use the logic added in
  4b93333292 (issue #352)

  By removing the '-noFunctionObjects' option, we automatically
  suppress the creation of function-objects via Time (with argList
  as a parameter).
  There is generally no need in these cases for an additional

      runTime.functionObjects().off()  statement

  Use the argList::noFunctionObjects() for more direct configuration
  and reduce unnecessary clutter in the -help information.

  In previous versions, the -noFunctionObjects would have been redundant
  anyhow, so we can also just ignore it now instead.
2018-08-08 09:44:28 +02:00
Mark Olesen
822acaf6ef ENH: make indices for boundBox::add() a templated parameter
- allows use with any container with begin(), end() and where the
  "*iterator" dereference returns a label, which is used for indexing
  into the list of points.
  This container could be labelUList, bitSet, labelHashSet, etc
2018-08-07 22:23:16 +02:00
Mark Olesen
0e996431b7 STYLE: relocate STRING_QUOTE macro to macros.H 2018-08-02 16:26:25 +02:00
Mark Olesen
9be9f02a12 ENH: bitSet, PackedList copy construct a subset
Eg,
    processorPolyPatch pp = ...;

    UOPstream toNbr(pp.neighbProcNo(), pBufs);
    toNbr << PackedList<Width>(faceValues, pp.range());
2018-08-01 17:54:53 +02:00
Mark Olesen
80f4ff87dd ENH: allow use of FixedList<label,N> for bitSet construct/set/unset
- allows direct 'hashing' of fixed lists. Eg, triFace
2018-08-01 13:01:43 +02:00
Mark Olesen
35facb8208 ENH: add PackedList::unpack() method
- allows for simpler unpacking of a full list, or list range into any
  sufficiently large integral type.

  For example,
    processorPolyPatch pp = ...;

    UOPstream toNbr(pp.neighbProcNo(), pBufs);
    toNbr << faceValues.unpack<char>(pp.range());
2018-08-01 12:48:35 +02:00
Mark Olesen
215570915e ENH: explicit convert to bool operator for autoPtr
- behaves the same as the valid() method, but can be queried directly
  like a normal raw pointer and as per std::unique_ptr.
  Eg,

      autoPtr<T> ptr = ...

      if (ptr) ...
2018-07-30 14:33:22 +02:00
Bernhard Gschaider
b5f093076b STYLE: add sigFpe test 2018-07-30 12:13:42 +02:00
Mark Olesen
a5e5ba3179 ENH: add bitSet-type of methods for boolList
- test(), get(), set(), unset() with behaviour as per bitSet,
  to allow easier swapping out of boolList <-> bitSet.
2018-07-27 15:51:19 +02:00
Mark Olesen
db9cd2bc85 ENH: add IOobjectList append() method for building larger lists
- supports copy append and move append
2018-07-27 15:38:32 +02:00
Mark Olesen
fe808e24e7 ENH: add rpmToRads() convenience functions
- simplifies conversion of RPM to radians/sec for const variables
2018-07-23 22:20:26 +02:00
mattijs
423ed38986 COMP: rigidBodyDynamics: add Time& argument to make them compile 2018-07-19 18:03:10 +01:00
Mark Olesen
ca2a83d532 Merge remote-tracking branch 'origin/develop' into develop-pre-release 2018-06-20 01:56:41 +02:00
Mark Olesen
8295d398aa BUG: accessing invalid coordinateRotation after move assignment (fixes #884)
- incorrect coordinateSystem clear() after the move

- add Test-coordinateSystem
2018-06-19 21:24:38 +02:00
Mark Olesen
f9fe71815a STYLE: consistent use of '= delete' for removed constructors/assignments
- make the purpose more explicit, and reduces some work for the
  compiler as well.
2018-05-30 12:03:17 +02:00
Mark Olesen
6b6b36afd3 STYLE: revert bitSet/HashSet setMany() to set() method (issue #837)
- improves backward compatibility and more naming consistency.
  Retain setMany(iter1, iter2) to avoid ambiguity with the
  PackedList::set(index, value) method.
2018-05-29 17:38:02 +02:00
Mark Olesen
d318a630b6 ENH: add directive '#sinclude' (or '#includeIfPresent' as long name)
- consistency with make and more succinct.

- reduce code duplication in findEtcFiles.
2018-05-28 13:38:03 +02:00
Mark Olesen
48d654cf19 ENH: avoid memory leaks for HashPtrTable, PtrMap insertion (issue #749)
- disallow insert() of raw pointers, since a failed insertion
  (ie, entry already existed) results in an unmanaged pointer.

  Either insert using an autoPtr, or set() with raw pointers or autoPtr.

- IOobjectList::add() now takes an autoPtr instead of an object reference

- IOobjectList::remove() now returns an autoPtr instead of a raw pointer
2018-05-17 09:56:36 +01:00
Mark Olesen
0ea44eda59 ENH: bitSet::find_first_not() method (issue #751)
- find the position of the first bit off - symmetrical with find_first()
2018-05-02 08:33:49 +02:00
Mark Olesen
dd8341f659 ENH: make format of ExecutionTime = ... output configurable (issue #788)
- controlled by the the 'printExecutionFormat' InfoSwitch in
  etc/controlDict

      // Style for "ExecutionTime = " output
      // - 0 = seconds (with trailing 's')
      // - 1 = day-hh:mm:ss

   ExecutionTime = 112135.2 s  ClockTime = 113017 s

   ExecutionTime = 1-07:08:55.20  ClockTime = 1-07:23:37

- Callable via the new Time::printExecutionTime() method,
  which also helps to reduce clutter in the applications.
  Eg,

     runTime.printExecutionTime(Info);

  vs

     Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
         << "  ClockTime = " << runTime.elapsedClockTime() << " s"
         << nl << endl;

--

ENH: return elapsedClockTime() and clockTimeIncrement as double

- previously returned as time_t, which is less portable.
2018-04-27 15:00:34 +02:00