Commit Graph

26642 Commits

Author SHA1 Message Date
d296713af1 CONFIG: increment API level to 2308
- support for SpanStreams etc
2023-10-24 10:57:49 +02:00
0343ab00f3 DOC: add application/test/README.md
- extraction of Description from the respective tests.
  Relatively incomplete

  Uses the `application/tests/get-descriptions` extractor
2023-10-24 10:57:49 +02:00
870c6a6924 TEST: add standalone test application: Test-surface-sampling 2023-10-24 10:57:22 +02:00
1476de89ee ENH: add unary functor for Foam::zero
- acts somewhat like an identity op that 'swallows' its parameter
  and maps back to zero.
2023-10-23 15:28:34 +02:00
93f48d88ea STYLE: add scoping limit to Field macros 2023-10-23 15:28:08 +02:00
cfa6da5953 COMP: circumvent aggressive compiler branch optimization (clang-17)
- it seems that both sides of the ternary are evaluated despite
  the divide-by-zero protection. Use volatile to force the compiler
  to use in-order evaluation.
2023-10-23 15:27:58 +02:00
a7bb8edbad COMP: avoid issues with new compilers and/or new C++ standards
- prevent automatic comparison rewriting (c++20)
- no bitwise operations between different enumerations
- template instantiation

ENH: add DimensionedField Internal typedef (simplifies handling)
2023-10-23 09:45:41 +02:00
e4745d09ec STYLE: remove virtual from override-qualified methods (surfaceFeatureExtract) 2023-10-23 09:44:54 +02:00
32a8a30b8c CONFIG: bump paraview from 5.11.1 to 5.11.2 2023-10-20 10:29:41 +02:00
2b34412591 Merge branch 'ensight-timeFormat' into 'develop'
support user specification of ensight time format/precision (#2999)

See merge request Development/openfoam!634
2023-10-19 10:39:07 +00:00
ba2e774aac ENH: increase precision for ensight field cache (#2999)
- attempt to minimize rounding in the cached time values
  since these are also used to re-populate the case files

STYLE: remove ancient handling of "meshes" entry

- was superseded by "geometry" entry in OpenFOAM-1912 and later.
  Now remove the transitional shim, which was in place for
  restart migration from 1906.
2023-10-19 10:28:09 +00:00
3618d07134 ENH: support user-defined sampleFreq for noise models (#2999)
CONFIG: downgrade non-uniform time from error to warning

- can be a spurious error when the deltaT is very small

CONFIG: support keywords 'minFreq', 'maxFreq'

- these are the updated naming for 'fl' and 'fu' (still supported)
2023-10-19 10:28:09 +00:00
dafae668d1 ENH: support user specification of ensight time format/precision (#2999)
- new format option keywords: timeFormat, timePrecision

CONFIG: default ensight output is now consistently BINARY

- this removes some uncertainty with the ensightWrite functionObject
  which was previously dependent on the simulation writeFormat
  and makes its behaviour consistent with foamToEnsight

  Note: binary Ensight output is consistent with the
  defaults for VTP output (inline binary)

ENH: minor adjustment of ensight writing methods
2023-10-19 10:28:09 +00:00
8ec35d0b26 Merge branch 'update-zone-handling' into 'develop'
ENH: zone improvements

See merge request Development/openfoam!633
2023-10-19 10:23:14 +00:00
05c66ae62d ENH: reduce overhead for readUpdate of mesh zones 2023-10-17 12:33:03 +02:00
6aa8b82744 ENH: zone improvements
- retain group information when copying zones
- support construct empty (add details later)
- improve consistency for zone and boundaryMesh construction

- support front/back/both selection for faceZoneToCell

STYLE: prefer faceZone patch() method instead of operator()

STYLE: use std::unique_ptr instead of manual pointer management

- for zones and core patch types.
  Easier data management, allows default destructors (for example)
2023-10-17 12:33:03 +02:00
59c366525e ENH: add release() method to UPstream::communicator
- allows caller to take ownership of the communicator
2023-10-16 16:42:23 +02:00
c1e2fd6726 ENH: improve consistency of adding tokens to ITstream
- use add_tokens() instead of the old multi-parameter
  append(.., bool) method which was misleading since it added tokens
  at the current tokenIndex, not at the end.

- stringify ITstream contents with CharStream instead of StringStream.
  Allows string_view for copying out the content.

ENH: set namedDictionary dictionary name from Istream

- provides context for error messages etc (#2990)
2023-10-16 14:21:14 +02:00
fb26fcedfc STYLE: use getOrDefault instead of lookupOrDefault
- now mark methods with strict deprecation, to make it easier to find
  their use but without adding extra compilation noise for others

ENH: minor update for Enum methods and iterator

- add warnOnly (failsafe) option for readEntry and getOrDefault

- add good() method to Enum iterator (simliar to HashTable)

- replace unused/fragile Enum find() methods with iterator return
  that can be used more generally
2023-10-16 14:19:19 +02:00
3562565995 ENH: minor updates for globalIndex
- explicit use of UPstream::worldComm in globalIndex methods
  for more clarity

- adjust method declaration ordering:
  de-emphasize the processor-local convenience methods

- consistent use of leading tag dispatch,
  remove unused enum-based dispatch tag

- add begin()/cbegin() with offset (as per List containers)

BUG: missing use of communicator in globalIndex gatherNonLocal

- does not affect any existing code (which all use worldComm anyhow)
2023-10-13 14:44:18 +02:00
c65fac192e REGRESSION: incorrect fill range for ensight writeString
- introduced by b76595df42, only affects recent develop
2023-10-13 14:42:37 +02:00
fc9fb5c150 Merge branch 'update-stringIO-and-containers' into 'develop'
updates for resizing containers, reduced overhead for std::string output etc

See merge request Development/openfoam!632
2023-10-11 18:12:09 +00:00
0fb2c8eb1c STYLE: update applications/tests to use SpanStream/CharStream 2023-10-11 18:11:37 +00:00
3693d61e6c ENH: refine SpanStream and CharStream methods
- support std::string_view (c++17) or span view (older c++) of stream
  buffer contents. This simplifies formatting + reparsing.

  Example,

      OCharStream os;
      os << ...;

      ISpanStream is(os.view());
      is >> ...;

- additional release() method for ICharStream, OCharStream
  that returns the contents as a DynamicList<char> and resets the stream.

- provide a str() method for API compatibility with older
  std::ostringstream etc.
2023-10-11 18:11:37 +00:00
1ddcad820f ENH: multi-parameter IOobject::scopedName 2023-10-11 18:11:37 +00:00
722c528316 ENH: add string::length static methods
- simplifies writing of code that should accept either
  C strings (forwards to strlen) or
  C++ strings (forwards to std::string::length)
2023-10-11 18:11:37 +00:00
b76595df42 ENH: improve stream output of std::string etc.
- change write(const string&) to write(const std::string&).
  This allows output of std::string without an intermediate copy.

- additional writeQuoted method to handle range of char data:

     writeQuoted(const char* str, std::streamsize len, bool)

  This helps with supporting string_view and span<char>

- add operator<< for stdFoam::span<char> and std::string_view (c++17)

- avoid duplicate code in OBJstream

STYLE: add override keyword for IO stream methods
2023-10-11 18:11:37 +00:00
d9727fad1c ENH: use updated HashTable methods 2023-10-11 18:11:37 +00:00
5dcced7b86 ENH: use capacity=0 for HashTable/HashSet/Map default constructors
- default construct is now identical to HashTable(Foam::zero).
  It performs no allocation and is also noexcept.

  The previously used default capacity (128) was a holdover from
  much older versions where set/insert did not properly handle
  insertion into a table with zero capacity (number of buckets).
2023-10-11 18:11:37 +00:00
89d3687278 ENH: HashTable sizing improvements
- earlier deletion of unpopulated HashTable on resizing:

  If the table is already clear (ie, has no entries),
  can immediately remove the old internal table before reallocating
  the newly sized table, which may avoid a needless memory spike.

- reserve() method:

  Naming and general behaviour as per std::unordered_map.
  It behaves similarly to the resize() method but is supplied the
  number of elements instead of the capacity, which can be a more
  natural way of specifying the storage requirements.
  Additionally, reserve() will only increase the table capacity for
  behaviour similar to DynamicList and std::vector, std::string etc.

  Old:
     labelHashSet set;
     set.resize(2*nElems);

  Now:
     labelHashSet set;
     set.reserve(nElems);

- remove unused HashTable(Istream&, label) constructor

STYLE: static_cast of (nullptr) and std::fill_n for filling table
2023-10-11 18:11:37 +00:00
58bd255a73 ENH: handle List<char> I/O in base class
- previously used a template specialization, but now recombined into
  regular readList/writeList methods to consolidate the code logic
2023-10-11 18:11:37 +00:00
96c9bf8615 ENH: add List::resize_unsafe(label)
- changes the addressed list size without affecting list allocation.
  Can be useful for the following type of coding pattern:

  - pre-allocate a List with some max content length
  - populate with some content (likely not the entire pre-allocated size)
  - truncate the list to the length of valid content
  - process the List
  - discard the List

  Since the List is being discarded, using resize_unsafe() instead of
  resize() avoids an additional allocation with the new size and
  copying/moving of the elements.

  This programming pattern can also be used when the List is being
  returned from a subroutine, and carrying about a bit of unused memory
  is less important than avoiding reallocation + copy/move.

  If used improperly, it can obviously result in addressing into
  unmanaged memory regions (ie, 'unsafe').
2023-10-11 18:11:37 +00:00
0f53871fd3 ENH: make various List/Field move constructors noexcept 2023-10-11 18:11:37 +00:00
ce1260cf70 ENH: improve DynamicList shrink and swapping
- shrink_to_fit()
  corresponds to std::vector naming.
  For DynamicList it is a *binding* request.

- shrink_unsafe()
  simply adjusts the capacity() to match the
  current size() without forcing a re-allocation.

  Useful when collapsing to a non-dynamic list to avoid reallocation
  and copying contents. The memory cleanup will still occur properly
  at a later stage.

- DynamicList::swap(List&)
  simple recovery of content into a non-dynamic List that also
  ensures that the capacity is correctly updated.

STYLE: promote List::capacity() to public visibility (like std::vector)

STYLE: remove unused expandStorage() method

- simply a wrapper for resize(capacity())
2023-10-11 18:11:37 +00:00
1d43e45fdd ENH: add test application for fileHander writing
COMP: update applications/test
2023-10-11 18:11:37 +00:00
1af40e7dfe STYLE: remove unused (transitional) methods from CircularBuffer
- old methods (and class) were not widely used
2023-10-11 18:11:37 +00:00
524c953af3 STYLE: use List clear() instead of setSize(0), resize(0)
- adds some consistency
2023-10-11 18:11:37 +00:00
9ac0f03963 ENH: pisoFoam: allow runTimeModifiable. Fixes #2997. 2023-10-11 15:54:30 +01:00
dfb08af3de BUG: ThermoSurfaceFilm: reintroduce energy to film sources (fixes #2996) 2023-10-11 11:23:08 +01:00
3458cea49e FIX: avoid bad copy (foamCloneCase) when time dir is missing (fixes #2975) 2023-10-08 17:58:53 +02:00
a811e25556 DOC: StandardWallInteraction: correct restitution coeff (fixes #2676) 2023-10-04 17:06:43 +01:00
f7dfb02d12 DEFEATURE: remove unused (and partly-broken) SubDimensionedField 2023-09-27 19:37:18 +02:00
a252677618 BUG: Lambda2: reverse the sign of the governing equation (fixes #2731) 2023-09-27 17:09:13 +01:00
99f5d9a7db BUG: overset: correct sizing. Fixes #2985. 2023-09-18 18:12:37 +01:00
133149a1dd ENH: snappyHexMesh: mutliple inside points. Fixes #2981 2023-09-14 16:12:53 +01:00
6396256522 BUG: cyclicAMI: operate on copy. Fixes #2980
also
- steal nbr value
- do not copy nbr value if different internalfield
2023-09-14 15:10:15 +01:00
5d98eec6af ENH: re-toggle warnings in functionObjectList execution (#2973)
- when running with "errors warn;" it will reset the warnings counter
  (if any) when it returns to a good state.
  This re-enables un-suppressed warnings for the next cycle.
  Also reset the warnings counter on end().

ENH: add short-circuit in HashTable::erase(key)

- skip and return false if the table is empty or the key is not found.
  This makes for faster no-op behaviour.
2023-09-06 10:19:38 +02:00
2d76514b5b Merge branch 'issue-2966-errorhandling' into 'develop'
ENH: add error handling for empty surfaces in surfaceFieldValue (#2966)

See merge request Development/openfoam!627
2023-09-05 15:37:33 +00:00
2e3f0811a0 ENH: error handling for empty surfaces in surfaceFieldValue (#2966)
- for workflows with appearing/disappearing patches (for example)
  can specify that empty surfaces should be ignored or warned about
  instead of raising a FatalError.

  Note that this handling is additional to the regular top-level
  "errors" specification. So specifying 'strict' will only actually
  result in a FatalError if the "errors" does not trap errors.

- "ignore" : any empty surfaces are simply ignored and no
  file output (besides the header).

- "warn" : empty surfaces are warned about a few times (10)
  and the file output contains a NaN entry

- "strict" : corresponds to the default behaviour.
  Throws a FatalError if the surface is empty.
  This error may still be caught by the top-level "errors" handling.
2023-09-05 15:36:53 +00:00
ff2abdf1f0 ENH: relocate functionObjectList errorHandling types to error (#2966)
- was previously private within functionObjectList, now exposed from
  error as 'handlerTypes' and 'handlerNames' enumeration.
2023-09-05 15:36:53 +00:00