Commit Graph

26585 Commits

Author SHA1 Message Date
Mark Olesen
a341d09afc ENH: update and enhancement of memory-streams
- soft renames (ie, old names still available via typedefs) for more
  reasonable names and more coverage with std stream variants.

  The old names could be a bit cryptic.
  For example, uiliststream (== an unallocated/external list storage),
  which is written as std::ispanstream for C++23.

  Could similarly argue that IListStream is better named as
  ICharStream, since it is an input stream of characters and the
  internal storage mechanism (List or something else) is mostly
  irrelevant.

  Extending the coverage to include all std stream variants, and
  simply rewrap them for OpenFOAM IOstream types. This simplifies the
  inheritance patterns and allows reuse of icharstream/ocharstream as
  a drop-in replace for istringstream/ostringstream in other wrappers.

  Classes:
    * icharstream / ICharStream   [old: none / IListStream]
    * ocharstream / OCharStream   [old: none / OListStream]
    * ispanstream / ISpanStream   [old: uiliststream / UIListStream]
    * ospanstream / OSpanStream   [old: none / UOListStream]

  Possible new uses : read file contents into a buffer, broadcast
  buffer contents to other ranks and then transfer into an icharstream
  to be read from. This avoid the multiple intermediate copies that
  would be associated when using an istringstream.

- Use size doubling instead of block-wise incremental for ocharstream
  (OCharStream). This corresponds to the sizing behaviour as per
  std::stringstream (according to gcc-11 includes)

STYLE: drop Foam_IOstream_extras constructors for memory streams

- transitional/legacy constructors but not used in any code
2023-09-01 14:44:49 +00:00
mattijs
6d7e67408e BUG: snappyHexMesh: correct oppositeness checking. Fixes #2971 2023-08-31 14:06:02 +01:00
Mattijs Janssens
d8f5714d1b Merge branch 'feature-nonblocking-cyclicAMI' into 'develop'
Support non-blocking construction of cyclic AMI

See merge request Development/openfoam!623
2023-08-30 15:52:01 +00:00
mattijs
69169c5abe ENH: add non-blocking handling for cyclicAMI (#2963)
Co-authored-by: Mark Olesen <>
2023-08-30 13:39:16 +00:00
Mark Olesen
539d538d5a ENH: mapDistribute consistency improvements
- nonBlocking: receive before send

- nonBlocking: wait for receive requests, process and then wait for
  other requests. Can be extended to use polling...

- the 'fake' send (to self) now send copies into recv buffers instead
  of send buffers.
  This provides a clear separation of send and receive fields

- avoid unnecessary reallocations with PtrList of send/recv buffers

- remove outer looping for accessAndFlip and pass target field
  as parameter for inner looping instead

ENH: refine mapDistribute send/recv requests handling

- separate send/recv requests for finer control
- receive does not need access to PtrList of sendBuffers, since the
  send-to-self now uses the recvBuffers
2023-08-30 13:39:16 +00:00
Mark Olesen
c09acbb781 ENH: avoid list resizing when reindexing AMIInterpolation::append (#2933)
- create reindexing values as interleaved identity maps directly into
  the remapping lookup.
2023-08-30 13:39:16 +00:00
Mark Olesen
b931772369 ENH: mapDistribute subMapTotalSize(), constructMapTotalSize()
- the sum of the respective list sizes

COMP: add noexcept to trivial mapDistribute constructors
2023-08-30 13:39:16 +00:00
Mark Olesen
750d9084d4 ENH: improve addressing into labelRanges (#2933)
- totalSize() returns retrieve the linear (total) size
  (naming as per globalIndex)
- operator[] retrieves the referenced value (linear indexing)
- labels() returns a flattened labelList (as per labelRange itself)
2023-08-30 13:39:16 +00:00
mattijs
6defeddbff BUG: mapFields: incorrect patches. Fixes #2944. 2023-08-30 11:46:25 +01:00
Mark Olesen
9d291ab4cc ENH: add Pstream::broadcastList()
- broadcasts list contiguous content as a two-step process:
    1. broadcast the size, and resize for receiver list
    2. broadcast contiguous contents (if non-empty)

  This avoids serialization/de-serialization memory overhead but at
  the expense of an additional broadcast call.
  The trade-off of the extra broadcast of the size will be less
  important than avoiding a memory peak for large contiguous mesh data.

REVERT: unstable MPI_Mprobe/MPI_Mrecv on intelmpi + PMI-2 (#2796)

- partial revert of commit c6f528588b, for NBX implementation.
  Not yet flagged as causing errors here, but eliminated for
  consistency.
2023-08-29 11:24:16 +02:00
Mark Olesen
0e11f47f74 STYLE: prefer emplace_back() to append() + last() 2023-08-29 11:24:16 +02:00
Mark Olesen
698e05eeb3 STYLE: prefer push_uniq() to appendUniq
- more consistency with push_back etc.
2023-08-29 11:24:16 +02:00
Mark Olesen
2395e493d1 ENH: simplify add/remove patch/zone groups
STYLE: reuse polyBoundaryMesh patchSizes(), patchStarts()
2023-08-29 11:24:16 +02:00
Mark Olesen
12916cd7a3 ENH: additional fstream pointer constructors with IOstreamOption
- allow future tweaking based on the target stream format.

- add ifstreamPointer::open().
  Allows default construct followed by open()
2023-08-29 11:24:13 +02:00
Mark Olesen
b66369fb37 ENH: add sigFpe::fillNan(char* buf, size_t count)
- simplifies use with other allocators (eg, memory pools).
  Can also be used with other containers.

  vectorField fld = ...;
  sigFpe::fillNan(fld.data_bytes(), fld.size_bytes());

COMP: inline sigFpe::ignore helper class

- now unused (may be removed in the future), but can avoid compiling
  code for it

COMP: missing sigStopAtWriteNow() definition for MSwindows
2023-08-29 10:01:41 +02:00
Mark Olesen
b236e1493c SUBMODULE: compilation fix for visualization 2023-08-28 18:11:44 +02:00
Gregor Weiss
a6744d0814 ENH: add is_range test to pTraits
- helps support algorithms with list-based forwarding
2023-08-28 15:50:32 +02:00
mattijs
1e2858e8cb ENH: attachDetach: use parallel sizes. See #2969 2023-08-24 13:17:25 +01:00
Mattijs Janssens
09d86dc02b Merge branch 'update-scoped-dictionary' into 'develop'
ENH: change internal dictionary separator to '/' (#1073)

See merge request Development/openfoam!622
2023-08-21 12:35:15 +00:00
Mark Olesen
36f8542e01 TUT: use '/' dictionary scoping for variables and foamDictionary (#1073)
- leave windAroundBuildings blockMeshDict with older '.' syntax
  (to test compatibility)
2023-08-21 12:12:41 +02:00
Mark Olesen
886ba89ddb ENH: change internal dictionary separator to '/' (#1073)
- simplifies internal handling (like a fileName) and allows the
  dictionary name to be used with unambiguous addressing.
  The previous dot (.) separator is ambiguous (ie, as dictionary
  separator or as part of a keyword).

ENH: foamDictionary report -add/-set to stderr
2023-08-21 08:40:39 +02:00
Mark Olesen
778796853d CONFIG: enable use of stricter deprecation warnings
- selected with '+strict' in WM_COMPILE_CONTROL or 'wmake -strict', it
  enables the FOAM_DEPRECATED_STRICT() macro, which can be used to
  mark methods that are implicitly deprecated, but are not yet marked
  as full deprecated (eg, API modification is too recent, generates
  too many warnings).  Can be considered a developer option.
2023-08-21 08:39:36 +02:00
Mark Olesen
224c3199aa CONFIG: enable xcrun with cc/c++ based on WM_COMPILE_CONTROL (#2965)
- adding in +xcrun into WM_COMPILE_CONTROL changes the compiler
  settings as follows (for MacOS)

      cc         := xcrun cc
      CC         := xcrun c++ -std=c++14
2023-08-18 15:46:25 +02:00
Alexey Matveichev
e4f2efec18 COMP: add rpath information to MacOS compilation rules (#2948)
- since the Apple SIP (System Integrity Protection) clears environment
  variables such as DYLD_LIBRARY_PATH, a number of workarounds have
  been used to provide shadow values. However, for a more robust
  installation using -rpath at compilation time appears to be the
  better solution.

  In addition to the usual -rpath specification with absolute file
  paths, MacOS supports (@loader_path, @executable_path) as well.
  Now default to link with rpath information for MacOS, which can be
  disabled by adding `~rpath` in WM_COMPILE_CONTROL

  Explicit library paths handled:
    - FOAM_FOAM_EXT_LIBBIN, FOAM_EXT_LIBBIN/FOAM_MPI

  The executable rpaths are handled assuming a structure of
     install-path/bin
     install-path/lib/$(FOAM_MPI)
     install-path/lib

  Absolute compile-time paths for FOAM_USER_LIBBIN, FOAM_SITE_LIBBIN
  and FOAM_LIBBIN are not handled since these are either too fragile
  (FOAM_USER_LIBBIN and FOAM_SITE_LIBBIN values) or covered via
  @loader_path anyhow (FOAM_LIBBIN).

  Since the value of FOAM_MPI is a compile-time value, this rpath
  treatment makes the installation less suitable for runtime changes
  to the MPI vendor/version.

  Note: no rpath added for c-only compilations since there are
  currently no c-only libraries or executables with dynamic loading
2023-08-18 15:46:12 +02:00
Guanyang Xue
3630333526 ENH: improve FPE handling for Apple and ARM64 (#2956) 2023-08-18 15:44:12 +02:00
Mark Olesen
97668eab26 STYLE: update noexcept and default construct for signals
- eliminate ClassName in favour of simple debug

- include Apple-specific FPE handling after local definition
  to allow for more redefinitions

COMP: remove stray <csignal> includes
2023-08-18 15:42:18 +02:00
Mark Olesen
b620152191 ENH: add UPstream::msgType() setter method and UPstream::incrMsgType()
- like UPstream::parRun() etc, returns old value
2023-08-18 15:08:42 +02:00
Mark Olesen
03ca52b036 ENH: PtrList, PtrDynList, HashPtrTable try_emplace() method
- naming like std::map::try_emplace(), it behaves like emplace_set()
  if there is no element at the given location otherwise a no-op

ENH: reuse existing HashPtrTable 'slot' when setting pointers

- avoids extra HashTable operations
2023-08-18 13:55:32 +02:00
Mattijs Janssens
11a1f78338 Merge branch 'feature-delayed-compound-reading' into 'develop'
Extend ITstream handling and provision for delayed reading of compound tokens

See merge request Development/openfoam!621
2023-08-17 08:16:56 +00:00
Mark Olesen
268de43afc ENH: provision for delayed reading of compound tokens (#2953)
- the construction of compound tokens is now split into two stages:
    - default construct
    - read contents
  This permits a larger variety of handling.

- the new token::readCompoundToken(..) method allows for simpler
  more failsafe invocations.

- forward resize(), read() methods for compound tokens to support
  separate read and population.
  Top-level refCompoundToken() method for modify access.

ENH: split off a private readCompoundToken() method within ISstream

- this allows overloading and alternative tokenisation handling for
  derived classes
2023-08-16 16:22:17 +02:00
Mark Olesen
43f8b477b7 ENH: additional ITstream access/manipulate methods
- simplifies iteration of ITstream using nRemainingTokens() and skip()
  methods or directly as a list of tokens.

  The currentToken() method returns const or non-const access to
  the token at the current tokenIndex.

  The peekToken(label) method provides failsafe read access to tokens
  at given locations.

ENH: add primitiveEntry construct with moving a single token
2023-08-16 16:22:17 +02:00
Andrew Heather
bbbab8a9c2 Merge branch 'feature-container-algorithms' into 'develop'
Increase usage of std algoritms within the OpenFOAM List classes. Remove reliance on linked-list during reading

See merge request Development/openfoam!620
2023-08-16 12:58:09 +00:00
Mark Olesen
2422e6f061 ENH: use std algorithms for copy/move/compare within List containers
ENH: add List resize_fill variant. Fuses resize_nocopy + uniform fill

COMP: avoid cast ambiguity when assigning Foam::zero to UList<char>
2023-08-16 12:28:12 +02:00
Mark Olesen
eeb9d144e3 STYLE: qualify Swap with Foam:: prefix (visibility)
- drop unnecessary Foam::Swap specializations when MoveConstructible
  and MoveAssignable already apply. The explicit redirect to swap
  member functions was needed before proper move semantics where
  added.

  Removed specializations: autoPtr, refPtr, tmp, UList.
  Retained specialization: DynamicList, FixedList.

     Special handling for DynamicList is only to accommodate dissimilar
     sizing template parameters (which probably doesn't occur in
     practice).
     Special handling for FixedList to apply element-wise swapping.

- use std::swap for primitives. No need to mask with Foam::Swap wrapper
2023-08-16 12:28:09 +02:00
Mark Olesen
fabd3f4e0c ENH: eliminate reliance on SLList during reading
- fully implement DynamicList::readList() instead of simply
  redirecting to List::readList(). This also benefits DynamicField.
  Leverage DynamicList reading to simplify and improve CircularBuffer
  reading.

- bracket lists are now read chunk-wise instead of using a
  singly-linked list. For integral and vector-space types
  (eg, scalar, vector, etc) this avoids intermediate allocations
  for each element.

ENH: add CircularBuffer emplace_front/emplace_back

STYLE: isolate to-be-deprecated construct/assign forms

- still have construct/assign FixedList from a C-array.
  This is not really needed, can use std::initializer_list

- still have construct/assign List from SLList.
  Prefer to avoid these in the future.

DEFEATURE: remove construct/assign FixedList from SLList

- never used

DEFEATURE: remove move construct/assign List from SLList

- now unused. Retain copy construct/assign from SLList for transition
  purposes.
2023-08-16 12:27:04 +02:00
mattijs
7828067ef6 BUG: snappyHexMesh: support dryRun. Fixes #2959 2023-08-14 13:01:42 +01:00
Andrew Heather
53b3fff7d5 Merge branch 'feature-pTraits-vectorspace' into 'develop'
Extend traits to include VectorSpace tests and wrapped access to pTraits static members

See merge request Development/openfoam!619
2023-08-11 12:40:00 +00:00
Mark Olesen
066a5a997a CONFIG: update compiler minimums (gcc-7.5.0) and standard (c++14) 2023-08-11 10:50:13 +02:00
Mark Olesen
4daaf6dd2a ENH: support move sematics for get/set putback token 2023-08-10 16:39:31 +02:00
Mark Olesen
944840f8d6 ENH: polyMesh/faMesh hasGlobalData() query
- test for existing globalData() or perhaps use DIY globalIndex instead

STYLE: check for non-ASCII instead of BINARY with compression

- allows for other non-ASCII formats
2023-08-10 16:39:25 +02:00
Mark Olesen
1340bc50bd STYLE: qualify zero/one dispatch tags with Foam:: prefix
- use Foam::zero{} instead of Zero with tagged re-dispatch
2023-08-10 11:51:04 +02:00
Mark Olesen
97a42df7ba ENH: add VectorSpace trait tests and evaluations
- is_vectorspace :
  test existence and non-zero value of the Type 'rank' static variable

- pTraits_rank :
  value of 'rank' static variable (if it exists), 0 otherwise

- pTraits_nComponents :
  value of 'nComponents' static variable (if it exists), 1 otherwise

- pTraits_has_zero :
  test for pTraits<T>::zero member, which probably means that it also
  has one, min, max members as well

Note that these traits are usable with any classes. For example,

  - is_vectorspace<std::string>::value  ==> false
  - pTraits_nComponents<std::string>::value  ==> 1
  - pTraits<std::string>::nComponents  ==> fails to compile

  Thus also allows testing pTraits_rank<...>::value with items
  for which pTraits<...>::rank fails to compile.

  Eg, cyclicAMIPolyPatch::interpolate called by FaceCellWave with a
  wallPoint.

     pTraits<wallPoint>::rank ==> fails to compile
     is_vectorspace<wallPoint>::value ==> false

GIT: relocate ListLoopM.H to src/OpenFOAM/fields/Fields (future isolation)
2023-08-10 10:38:39 +02:00
Andrew Heather
5eacd8257b Merge branch 'feature-subsetMesh-exclude-patches' into 'develop'
Support select/ignore patches for subsetMesh, extend select/ignore to general selection (#2947)

See merge request Development/openfoam!618
2023-08-02 15:06:45 +00:00
Mark Olesen
aad4c2222e ENH: subsetMesh -exclude-patches (#2947)
STYLE: use -exclude-patches instead of -excludePatch for other utilities

- avoids inconsistencies with utilities like foamToVTK etc.
2023-08-02 12:35:10 +02:00
Mark Olesen
14f7d44ca0 ENH: patch/zone indices with select/ignore combination
STYLE: prefer indices() to patchSet() with warn=false
2023-08-02 12:34:41 +02:00
Andrew Heather
db39f196cc Merge branch 'update-selection-ordering' into 'develop'
Updates to function objects handling of patches / selection names for parallel consistent order

See merge request Development/openfoam!617
2023-08-01 15:26:42 +00:00
Mark Olesen
2fc2d1f95f TUT: missing ';' for solverInfo 2023-07-31 20:11:32 +02:00
Mark Olesen
db16d80840 ENH: use objectRegistry/IOobjectList sorted instead of lookupClass
- in most cases a parallel-consistent order is required.
  Even when the order is not important, it will generally require
  fewer allocations to create a UPtrList of entries instead of a
  HashTable or even a wordList.
2023-07-31 20:11:32 +02:00
Mark Olesen
d65e2d89b5 ENH: use MinMax for bounds management in binModels (code simplication) 2023-07-31 20:11:32 +02:00
Mark Olesen
dc95242cd2 ENH: use sorted order for fieldSelection::selectionNames() (#2819)
- return a sorted wordList instead of a wordHashSet to ensure that
  fields will be processed in consistent order in parallel
2023-07-31 20:11:32 +02:00