Commit Graph

1057 Commits

Author SHA1 Message Date
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