Commit Graph

27444 Commits

Author SHA1 Message Date
Kutalmış Berçin
fd41930377 Merge branch 'namespace-qualify_code-style' into 'develop'
Improve namespace qualification of min/max, other minor code improvements

See merge request Development/openfoam!736
2025-04-10 10:49:36 +00:00
Mark Olesen
59f3c55871 STYLE: avoid implicit cast of UList to List 2025-04-09 15:58:30 +02:00
Mark Olesen
0be19b7fae COMP: namespace qualify min/max functions (#3348)
FIX: missing patch face index writeFields (#3347)
2025-04-09 15:58:30 +02:00
Mark Olesen
01727c84f1 ENH: use gMinMax() instead of separate gMin(), gMax()
- for reciprocal values, gMinMax() first and then calculate the
  reciprocal, which avoids creating temporaries

STYLE: prefer MinMax to separate min/max accounting

COMP: namespace qualify min/max for deltaT, CourantNo, etc (#3348)
2025-04-09 15:58:30 +02:00
Mark Olesen
80d7fe97f0 TUT: clarify use of Antal parameters (#3353)
TUT: simplify example of coded motion solver
2025-04-09 15:58:29 +02:00
Mark Olesen
a7e8a43f4a ENH: add writeContents() static methods for IOList etc.
- encapsulates IOListRef etc into a simpler syntax

ENH: use UList instead of refPtr for IOListRef (avoids List cast etc)
2025-04-09 15:58:29 +02:00
Mark Olesen
6c20df2808 ENH: additional in-place clamp_min(), clamp_max() field methods
- these already existed for a single value, but now handle the full
  field. This is more memory-friendly.

      fld.clamp_min(lower);  OLD: fld = max(fld, lower);
      fld.clamp_max(upper);  OLD: fld = min(fld, upper);
2025-04-09 15:58:29 +02:00
Mark Olesen
b8a0706e72 ENH: add ListPolicy::reserve_size() helper (related to #3348)
- central way to calculate reverse sizes for dynamic containers.

  For example;
      reserve_size<16, 2>(len, cap);     // min-size=16, ratio=2
      reserve_size<16, 3, 2>(len, cap);  // min-size=16, ratio=1.5

  replaces this type of code that was used in several places:
      max(SizeMin, max(len, label(2*capacity_)));

  The caller will have already checked (len < cap) before deciding
  to make this call.

ENH: updates for DynamicList/DynamicField handling

- add reserve_exact() method, which is like reserve() but without any
  extra sizing heuristics

- add DynamicField 'reuse' constructors, consistent with Field constructors

- sync allocated size before list destruction.
  This may help when using aligned allocation strategies.
2025-04-09 08:10:48 +02:00
Mark Olesen
7f062a8f5e ENH: return plain List instead of shrinking the DynamicList
Using 'return List<T>(std::move(dynList))' for transfer of content
  (with implicit shrinking) into a plain List, and leave copy elision
  to do the rest. The implicit transfer (move construct List from
  DynamicList) will normally invoke resize (new/delete and moving
  elements).

  With 'return dynList.shrink()', it will first invoke an internal
  resize (new/delete and moving elements), followed by a copy
  construct as a plain list.

STYLE: avoid implicit cast to 'const List&' in constructors
2025-04-08 11:26:11 +02:00
Mark Olesen
f13a05375c STYLE: promote ListPolicy to Foam namespace
- previously under Foam::Detail::ListPolicy, now as Foam::ListPolicy
2025-04-07 18:28:46 +02:00
Mark Olesen
eb56c75c4b ENH: provide edge::sorted() static constructor
- avoids min(a,b), max(a,b) free functions (#3348)
2025-04-07 18:28:46 +02:00
Mark Olesen
cb6d11d39b CONFIG: add LIBO_LIBS support into wmake rules
- provides an additional hook when linking OSspecific

CONFIG: apply quiet flag to wmkdepend

- suppresses "could not open FileName" warnings in quiet mode

FIX: reinstate selection of strict/non-strict deprecation

- accidentally removed in cf2b305b4f.
- extend with a _STRICTER version as well.
2025-04-07 18:28:42 +02:00
Kutalmış Berçin
ad037ac744 Merge branch 'issue-3313-SVD-pinv_tensors' into 'develop'
avoid heap allocations for pseudo-inverse of tensor/symmTensor (#3313)

See merge request Development/openfoam!734
2025-04-01 16:19:01 +00:00
Mark Olesen
e3c93a9c85 ENH: refactor SVD to support tensors directly (#3313) 2025-04-01 17:52:13 +02:00
Mark Olesen
a2df607998 CONFIG: set API level to 2501
- Pstream changes (one-sided), local AMI communicators,
  other adjustments
2025-03-31 18:53:43 +02:00
Mark Olesen
e121db6e86 ENH: extend sigFpe::fillNan() interfaces
- provide separate float/double UList interfaces, which improves
  flexibility (eg, with SPDP)

- sigFpe::fillNan_if() interface, for filling in when using alternative
  memory allocators
2025-03-31 18:50:29 +02:00
Mark Olesen
e720f823d3 ENH: simplify SubStrings class/handling (remove template parameters)
- previous code used derived string iterators, but these would
  be largely ignored anyhow since the underlying std::sub_match
  str() method would just yields a std::string anyhow.

  The SubStrings::str(size_t) method wasn't used in any code, so now
  just use std::string iterators only.

  This change simplfies overall handling, since it removes an unneeded
  template dependency.
2025-03-31 16:00:07 +02:00
Mark Olesen
bdac68ebc7 CONFIG: add Gcc rules for MacOS (darwin)
- /usr/bin/{gcc,g++} normally just symlinks to clang/clang++
  and may have unknown default flags.
  For a gcc toolchain, it would be better to use a homebrew
  installation.

  For these cases, the compiler will need to be specified with
  version=.. in WM_COMPILE_CONTROL.

  For example, with "version=14", to select gcc-14, g++-14 from the
  homebrew installation.

- needs a slight hack for locating the FlexLexer.h header.
  Added into src/OSspecific/POSIX similar to how it is handled
  in src/OSspecific/MSwindows

CONFIG: add simple config/detection support for libumpire (Linux)
2025-03-31 16:00:07 +02:00
Mark Olesen
edf9621ebe ENH: add foamConfigurePaths support for homebrew
- new options to set components specified by homebrew.
  Sets version as system, path from brew --prefix

    -adios-brew, -adios2-brew, -boost-brew, -cgal-brew,
    -fftw-brew, -kahip-brew, -metis-brew, -scotch-brew,
    -gmp-brew, -mpfr-brew

    -with-homebrew
     Shortcut for selecting all the above (except gmp, mpfr)

* additional special treatment for GMP and MPFR.

  If using non-system locations and not part of the ThirdParty
  compiler, they can additionally be set in the CGAL config file:

    -gmp-brew, -gmp-path
    -mpfr-brew, -mpfr-path
2025-03-31 16:00:07 +02:00
Mark Olesen
a9863d9a3f ENH: add size_type to Matrix and VectorSpace
- easier to create type-specific looping in templated code

STYLE: pass 'direction' and 'label' by value instead of reference

COMP: qualify Foam::min() in dense matrix classes
2025-03-31 15:58:55 +02:00
Mark Olesen
bdb890d4e2 COMP: disambiguate pTraits for long/unsigned long on Darwin 2025-03-25 16:02:42 +01:00
Mark Olesen
707db0b65b COMP: avoid deprecated headers for CGAL-6.0 2025-03-24 16:27:02 +01:00
Mark Olesen
8716795d86 COMP: more int/label consistency for communicator parameter 2025-03-24 16:27:02 +01:00
Mattijs Janssens
8bbfe6eb44 Merge branch 'remove-posix-regex' into 'develop'
DEFEATURE: remove POSIX regex interface (#3343)

See merge request Development/openfoam!733
2025-03-24 10:33:15 +00:00
Mark Olesen
aaa9af9ee8 DEFEATURE: remove POSIX regex interface (#3343)
- compiler versions are now sufficient that only the C++ regex
  interface is now being used. Can remove the old POSIX code
  accordingly.

  This change also removes any dependency on the SubStrings class to
  manage the matching results.

ENH: remove OpenFOAM dependencies from MacOS addr2line utility
2025-03-21 14:41:43 +01:00
Mattijs Janssens
4de0b84c2f Merge branch 'pstream-topo-aware' into 'develop'
additional topology-aware handling for Pstream

See merge request Development/openfoam!731
2025-03-20 12:02:45 +00:00
Mark Olesen
db871856c0 CONFIG: add named topoControls 2025-03-20 10:51:43 +00:00
Mark Olesen
a01f3ed8b7 ENH: add node-based gatherList() 2025-03-20 10:51:43 +00:00
Mark Olesen
c4b261c615 ENH: add node-based gather(), listGather(), mapGather() 2025-03-20 10:51:43 +00:00
Mark Olesen
7b0ab0dbb3 ENH: add node-based broadcasting and reduction 2025-03-20 10:51:43 +00:00
Mark Olesen
b9b0d1b3aa STYLE: use weighted average/sum in a few places
- minor adjustments to some BCs construction:
  * ensure origin/axis are zero-initialized
  * use dictionary get<> instead of lookup
2025-03-20 11:14:39 +01:00
Mark Olesen
034a0524af ENH: add weighted average and weighted sum functions (local and global)
- convenience, avoids creating intermediate fields and for
  gWeightedAverage() requires one fewer reduction

ENH: combine loops for FieldField averaging

STYLE: remove clip() function, superseded by clamp_range() - JAN-2023
2025-03-19 12:10:27 +01:00
Mark Olesen
eaa65913f4 CONFIG: combine flex/flex++ rules (minor cleanup)
- generate .cc (instead of .C) intermediate files, consistent with how
  we manage other generated code and makes them less case sensitive
2025-03-19 12:10:12 +01:00
mattijs
6dd8804acb BUG: fixup. See #3334 2025-03-17 15:07:25 +00:00
mattijs
a77aaa7582 BUG: AMIInterpolation: reset cached data. Fixes #3334 2025-03-17 14:11:38 +00:00
Andrew Heather
5cc36dc5b7 Merge branch 'issue-3211-fan-jumpCyclic' into 'develop'
BUG: fan: bc value not updated. See #3211

See merge request Development/openfoam!701
2025-03-17 14:11:12 +00:00
Mattijs Janssens
d4a959a93f BUG: fan: bc value not updated. See #3211 2025-03-17 14:11:12 +00:00
Mark Olesen
09e04003c4 CONFIG: support Allwmake with -bear-output-dir (#3322) 2025-03-17 11:58:25 +01:00
Mark Olesen
dcbd546d51 FIX: incorrect parameters for IN_PLACE MPI_Gather, MPI_Scatter
STYLE: mark Pstream::scatterList() as deprecated

- this entry point is not directly used anywhere, only the
  scatterList_algorithm backend is actually used.

  The scatterList() routine is misnomer since it actually works like a
  broadcast that skips overwriting the local rank, but only if used in
  combination with the gatherList() manual implementation that uses
  the same walk pattern.
2025-03-14 17:55:12 +01:00
Mark Olesen
d64c6371f1 ENH: foamDictionary now respects header format [ascii/binary] (#3329) 2025-03-14 09:08:04 +01:00
Mark Olesen
2d246cd5d1 ENH: add token::read(Istream&) method
- can be used to simplify some logic. For example,

      if
      (
          (tok.read(is) && tok.isWord("FoamFile"))
       && (tok.read(is) && tok.isPunctuation(token::BEGIN_BLOCK))
      )
      ...
  vs
      if
      (
          (is.good() && (is >> tok) && tok.isWord("FoamFile")) ...
       && (is.good() && (is >> tok) && tok.isPunctuation(token::BEGIN_BLOCK))
      ) ...
2025-03-12 20:09:00 +01:00
Mark Olesen
51bb06764a ENH: add polyBoundaryMesh::nNonProcessorFaces()
- the number boundary faces before the first processor patch.
  This approximately equals the 'real' number of boundary faces
2025-03-12 19:14:48 +01:00
Mark Olesen
795bce4519 COMP: suppress old-style cast warning (boost/cgal) 2025-03-12 12:14:58 +01:00
Mark Olesen
db0709f957 ENH: use DynamicList to SLList for ansysToFoam, kivaToFoam
- also fixes a compilation issue introduced by f13be4f62c
  (where the direct assignment from SLList to List was removed)
2025-03-12 11:50:58 +01:00
Mark Olesen
38e08fc092 COMP: avoid constructor ambiguity for ISpanStream
- compiler cannot decide between std::string and std::string_view
  when creating from 'const char*' without also supplying the size,
  so also supply a 'const char*' constructor.

ENH: additional string_view handling for ITstream and SubStrings
2025-03-12 10:04:43 +01:00
Mark Olesen
36ae93d017 ENH: components to support one-sided communication 2025-03-10 16:32:35 +01:00
Mark Olesen
ab7cfdcf49 ENH: add UList move construct and move assignment (shallow copy)
- the 'move' treatment performs a shallow copy but does not alter
  the passed parameter. Identical semantics as per std::span.

ENH: constexpr for basic HashTable constructors

STYLE: 'Foam::zero' instead of 'const Foam::zero' for containers

- this is simply a compiler dispatch flag, so the additional 'const'
  qualifier is unnecessary
2025-03-10 16:32:23 +01:00
Mark Olesen
f13be4f62c DEFEATURE: remove old/unused SLList -> List construct/assignment
- should ideally avoid SLList in most cases, since it is allocation
  intensive and most places can easily use DynamicList or
  CircularBuffer instead.

STYLE: use push_uniq instead of deprecated appendUniq method

- mark with a 'normal' deprecation instead of 'strict' deprecation
2025-03-10 16:32:22 +01:00
Mark Olesen
ae638c2b9c CONFIG: improvements to mpirunDebug
- the '-no-core' to limit coredumps to zero size
- the '-quick' option, which changes valgrind --leak-check from "full"
  to "summary", and implies -no-core as well.
- enforce tcp libfabrics provider under valgrind since valgrind
  does not otherwie work nicely with RMA
2025-03-10 16:29:47 +01:00
Mark Olesen
9cd0aa8816 COMP: avoid in-place reduce for OPEN-MPI as well (#3331)
- fails with MPI_ARG_ERR.
  Do not assume that any vendors actually support in-place handling
  for MPI_Reduce(), regardless of what their documentation may claim.
2025-03-07 09:29:28 +01:00