Commit Graph

27070 Commits

Author SHA1 Message Date
546b204793 COMP: split endian.H into foamEndianFwd.H and foamEndian.H
- usually only need big/little defines (which are now in the Fwd)
  and rarely need byte-swapping.

  Provide endian.H compatibility include, but foamEndianFwd.H or
  foamEndian.H to avoid potential name clashes.
2023-11-07 10:33:47 +01:00
98ccb7df6b ENH: extend VectorSpace traits to include pTraits_cmptType
- The pTraits_cmptType returns the data type of 'cmptType' (for
  arithmetic and VectorSpace types) or is simply a pass-through.

  This can be combined with the pTraits_nComponents for casting.
  For example,

  function
  (
      reinterpret_cast<pTraits_cmptType<Type>::type*>(buf.data()),
      (buf.size()/pTraits_nComponents<Type>::value)
  );

ENH: extend Foam::identityOp so support array indexing (pass-through)
2023-11-07 10:33:47 +01:00
df8efcaf62 REGRESSION: registry filtering not using regIOobject name (fixes #3023)
- was using the derived object name (could be something like "region0")
  instead of the actual registered name (ie, the regIOobject name)
2023-11-07 10:33:47 +01:00
ad2389a37d BUG: foamMeshToFluent: improve compatibility with tmerge (fixes #2820) 2023-11-03 16:26:57 +00:00
8f54827d19 Merge branch 'feature-map-constraint' into 'develop'
ENH: Moving electric sources mapped from external meshes

See merge request Development/openfoam!630
2023-11-03 14:33:10 +00:00
4fa1f723eb ENH: MapFieldConstraint: new fvOption constraint 2023-11-03 14:32:49 +00:00
ef6fa8007a ENH: cellSetOption: enable dictionary-based updates of selections 2023-11-03 14:32:49 +00:00
f54400d5cc ENH: cellSetOption: add new selectionMode for moving points 2023-11-03 14:32:49 +00:00
f3d939fa10 ENH: electricPotential: add finite-volume constraint hook 2023-11-03 14:32:49 +00:00
a50ee8e2d2 BUG: electricPotential: correct return value of read function 2023-11-03 14:32:49 +00:00
6373dfd6ac COMP: linear: duplicate filename in same library 2023-11-02 14:23:31 +00:00
dc7d0ffeaa ENH: add face/triFace find(edge) method (#3004)
- returns the edge index within the face, -1 if not found
2023-10-27 13:48:18 +02:00
29e2718162 ENH: add face/triFace contains(edge) method (#3004)
STYLE: use contains() and reduce reliance on edgeDirection -1/+1 values
2023-10-26 14:11:28 +02:00
b34793c392 ENH: additional globalIndex methods and helpers
- single() method : simply tests if the globalIndex has nProcs == 1,
  which is typically from a gatherNone invocation.
  For example,

     globalIndex gi;
     if (...) gi.reset(localSize);
     else     gi.reset(globalIndex::gatherNone{}, localSize);

     // later...
     const label begin = (gi.single() ? 0 : gi.localStart());
     const label count = (gi.single() ? gi.totalSize() : gi.localSize());

- add front() and back() methods to return the begin/end ranges,
  and begin_value(), end_value() - as per labelRange.

- make more methods noexcept

- calcOffset(), calcRange() helper functions to determine
  the processor-local of a numbering range without the overhead of
  creating a list of offsets.

  For example,

     label myOffset = globalIndex::calcOffset(mesh.nCells());
     labelRange mySlice = globalIndex::calcRange(mesh.nCells());

- add globalIndex localEnd() as per CompactListList method

STYLE: align looping constructs in CompactListList with List

- make more methods noexcept
2023-10-26 14:03:39 +02:00
d9f0587416 ENH: promote ListOps::identity to Foam::identity
- becoming more frequently used and there is no ambiguity in calling
  parameters either - identity(label) vs identity(labelUList&).

  Provide both int32 and int64 versions.
2023-10-26 11:24:57 +02:00
ef92d31493 ENH: construct labelRange from begin/end value pair 2023-10-26 11:11:48 +02:00
1faa143a7c ENH: expose fieldNames() selection for sampledSets/sampledSurfaces
- consistent with probes. Allows reporting/querying
2023-10-26 09:19:18 +02:00
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
c423ebecc1 BUG: ConeInjection - corrected parallel restart. Fixes #2998 2023-10-12 11:37:02 +01: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