Commit Graph

522 Commits

Author SHA1 Message Date
Mark Olesen
5e0a23edd5 STYLE: compacter help information for -debug-switch etc. 2022-11-18 21:24:17 +01:00
Mark Olesen
70208a7399 ENH: use returnReduceAnd(), returnReduceOr() functions
DOC: document which MPI send/recv are associated with commType
2022-11-08 16:48:08 +00:00
Mark Olesen
473e14418a ENH: more consistent use of broadcast, combineReduce etc.
- broadcast           : (replaces scatter)
  - combineReduce       == combineGather + broadcast
  - listCombineReduce   == listCombineGather + broadcast
  - mapCombineReduce    == mapCombineGather + broadcast
  - allGatherList       == gatherList + scatterList

  Before settling on a more consistent naming convention,
  some intermediate namings were used in OpenFOAM-v2206:

    - combineReduce       (2206: combineAllGather)
    - listCombineReduce   (2206: listCombineAllGather)
    - mapCombineReduce    (2206: mapCombineAllGather)
2022-11-08 16:48:08 +00:00
Mark Olesen
d5cdc60a54 BUG: processorMeshes removeFiles does not remove collated (fixes #2607)
ENH: extend rmDir to handle removal of empty directories only

- recursively remove directories that only contain other directories
  but no other contents. Treats dead links as non-content.
2022-10-11 17:58:22 +02:00
Mark Olesen
ea51c2c0e4 STYLE: return orientedType, Switch directly instead of const reference
- noexcept on some Time methods

ENH: pass through is_oriented() method for clearer coding

- use logical and/or/xor instead of bitwise versions (clearer intent)
2022-10-04 15:51:26 +02:00
Mark Olesen
88061f3b28 ENH: improved argList handling of libs, functionObjects
- include -no-libs option by default, similar to '-lib',
  which makes it available to all solvers/utilities.
  Add argList allowLibs() method to query it.

- relocate with/no functionObjects logic from Time to argList
  itself as argList allowFunctionObjects()

- add libs/functionObjects override handling to decomposePar etc

ENH: report the stream relativeName for IOerrors (see c9333a5ac8)
2022-09-22 16:08:52 +02:00
Mark Olesen
c031f7d00a ENH: improve autoPtr/refPtr/tmp consistency (#2571)
- disallow inadvertant casting and hidden copy constructions etc
2022-09-22 11:50:51 +02:00
Mark Olesen
3d892ace29 STYLE: set readOpt(..), writeOpt(..) by parameter, not by assignment
STYLE: qualify format/version/compression with IOstreamOption not IOstream

STYLE: reduce number of lookups when scanning {fa,fv}Solution

STYLE: call IOobject::writeEndDivider as static
2022-07-19 11:17:47 +02:00
Mark Olesen
71246b94b7 ENH: minor update of particle methods 2022-07-08 11:13:00 +02:00
Mark Olesen
3c64283364 BUG: redistributePar -reconstruct lagrangian trashes fields (fixes #2494)
- the file removal cleanup, which makes reasonable sense for
  redistribute mode, always forced the removal of the reconstructed
  lagrangian fields (since all of the non-master fields are empty by
  definition)!

  Detect reconstruct mode (by using constructSize from the map) to
  circumvent this logic.
2022-06-24 14:49:14 +02:00
Mark Olesen
39d8964851 BUG: distributed roots cause redistributePar failure (fixes #2523)
- zero-sized faMeshSubset and fvMeshSubset had READ_IF_PRESENT instead
  of simply copying the schemes/solution setting from the baseMesh
2022-06-24 13:18:41 +02:00
Mark Olesen
7b94573add BUG: distributed roots cause redistributePar failure (fixes #2523)
- fvMeshSubset zero constructor triggers readIfPresent for
  fvSchemes/fvSolution: causing mismatched parallel communication
2022-06-23 18:26:28 +02:00
Mark Olesen
b51e0d4c1c STYLE: verbose point field decompose/reconstruct (#120)
TUT: use redistributePar for multiphase/interFoam/RAS/DTCHull
2022-06-22 19:45:08 +02:00
Mark Olesen
ba10afea77 ENH: add 'filtered' polyMesh regionName() method
- in various situations with mesh regions it is also useful to
  filter out or remove the defaultRegion name (ie, "region0").

  Can now do that conveniently from the polyMesh itself or as a static
  function. Simply use this

      const word& regionDir = polyMesh::regionName(regionName);

  OR  mesh.regionName()

  instead of

      const word& regionDir =
      (
           regionName != polyMesh::defaultRegion
         ? regionName
         : word::null
      );

  Additionally, since the string '/' join operator filters out empty
  strings, the following will work correctly:

      (polyMesh::regionName(regionName)/polyMesh::meshSubDir)

      (mesh.regionName()/polyMesh::meshSubDir)
2022-05-27 14:10:31 +02:00
Mark Olesen
f00f236cb3 STYLE: use zero-gradient for cellDist field (reconstructParMesh)
- consistent with what decomposePar and redistributePar create
2022-05-27 14:10:31 +02:00
Mark Olesen
cc1e6c12bb ENH: redistributePar support for finiteArea (#2436) 2022-05-25 13:12:38 +00:00
Mark Olesen
6644cf8ddb ENH: cleanup/reorganize parts of redistributePar
- separate out lagrangian routines etc

- align names with regular decompose/reconstruct methods
2022-05-25 13:12:38 +00:00
mattijs
f976a02bd0 ENH: redistributePar - add support for pointFields (#2436) 2022-05-25 13:12:38 +00:00
Mark Olesen
3b6761afed ENH: code modernization for decompose/reconstruct
- simplify procAddressing read/write

- avoid accessing points in faMeshReconstructor.
  Can rely on the patch meshPoints (labelList), which does not need
  access to a pointField

- report number of points on decomposed mesh.
  Can be useful additional information.
  Additional statistics for finite area decomposition

- provide bundled reconstructAllFields for various reconstructors

- remove reconstructPar checks for very old face addressing
  (from foam2.0 - ie, older than OpenFOAM itself)

- bundle all reading into fieldsDistributor tools,
  where it can be reused by various utilities as required.

- combine decomposition fields as respective fieldsCache
  which eliminates most of the clutter from decomposePar
  and similfies reuse in the future.

STYLE: remove old wordHashSet selection (deprecated in 2018)

BUG: incorrect face flip handling for faMeshReconstructor

- a latent bug which is not yet triggered since the faMesh faces are
  currently only definable on boundary faces (which never flip)
2022-05-25 13:12:38 +00:00
Mark Olesen
68b692fdfc ENH: combine loadOrCreateMesh from redistributePar into fvMeshTools.
- similar functionality as newMesh etc.
  Relocated to finiteVolume since there are no dynamicMesh dependencies.

- use simpler procAddressing (with updated mapDistributeBase).
  separated from redistributePar
2022-05-17 17:35:51 +02:00
mattijs
809fc70166 BUG: redistributePar: reconstruct mesh 2022-05-11 16:06:52 +01:00
Mark Olesen
efe057897f ENH: foamToVTK attempt finite-area write if -with-ids is specified
- previously filtered on the existence of area fields, but with
  faMesh::TryNew this is not required anymore.

STYLE: enable -verbose for various parallel utilities (consistency)
2022-05-11 11:34:04 +02:00
Mark Olesen
cf7dbf4d42 ENH: relocate/refactor fvMeshSubset
- direct construct and reset method for creating a zero-sized (dummy)
  subMesh. Has no exposed faces and no parallel synchronization
  required.

- core mapping (interpolate) functionality with direct handling
  of subsetting in fvMeshSubset (src/finiteVolume).
  Does not use dynamicMesh topology changes

- two-step subsetting as fvMeshSubsetter (src/dynamicMesh).
  Does use dynamicMesh topology changes.
  This is apparently only needed by the subsetMesh application itself.

DEFEATURE: remove deprecated setLargeCellSubset() method

- was deprecated JUL-2018, now removed (see issue #951)
2022-04-29 11:44:29 +02:00
Mark Olesen
6e21d6f78c ENH: refactor/centralize handling of direct and distributed mappers (#2436)
- added templating level to avoid code duplication and provide future
  extensibility
2022-04-29 11:44:29 +02:00
Mark Olesen
b68193088c ENH: add GeometricBoundaryField evaluateCoupled method (#2436)
- allows restricted evaluation to specific coupled patch types.
  Code relocated/refactored from redistributePar.

STYLE: ensure use of waitRequests() also corresponds to nonBlocking

ENH: additional copy/move construct GeometricField from DimensionedField

STYLE: processorPointPatch owner()/neighbour() as per processorPolyPatch

STYLE: orientedType with bool cast operator and noexcept
2022-04-29 11:44:29 +02:00
Mark Olesen
18e0d7e4d6 ENH: bundle broadcasts (#2371)
- additional Pstream::broadcasts() method to serialize/deserialize
  multiple items.

- revoke the broadcast specialisations for std::string and List(s) and
  use a generic broadcasting template. In most cases, the previous
  specialisations would have required two broadcasts:
    (1) for the size
    (2) for the contiguous content.

  Now favour reduced communication over potential local (intermediate)
  storage that would have only benefited a few select cases.

ENH: refine PstreamBuffers access methods

- replace 'bool hasRecvData(label)' with 'label recvDataCount(label)'
  to recover the number of unconsumed receive bytes from specified
  processor.  Can use 'labelList recvDataCounts()' to recover the
  number of unconsumed receive bytes from all processor.

- additional peekRecvData() method (for transcribing contiguous data)

ENH: globalIndex whichProcID - check for isLocal first

- reasonable to assume that local items are searched for more
  frequently, so do preliminary check for isLocal before performing
  a more costly binary search of globalIndex offsets

ENH: masterUncollatedFileOperation - bundled scatter of status
2022-04-29 11:44:28 +02:00
Mark Olesen
d38de84d21 ENH: bundle Pstream:: AllGather methods
- bundles frequently used 'gather/scatter' patterns more consistently.

  - combineAllGather     -> combineGather + broadcast
  - listCombineAllGather -> listCombineGather + broadcast
  - mapCombineAllGather  -> mapCombineGather + broadcast
  - allGatherList        -> gatherList + scatterList
  - reduce               -> gather + broadcast (ie, allreduce)

- The allGatherList currently wraps gatherList/scatterList, but may be
  replaced with a different algorithm in the future.

STYLE: PstreamCombineReduceOps.H is mostly unneeded now
2022-03-31 15:56:04 +02:00
Mark Olesen
e98acdc4fc ENH: extend type aliases to include geometric boundary fields (#2348)
STYLE: LduInterfaceFieldPtrsList as alias instead of a class

STYLE: define patch lists typedefs when defining the base patch

- eg, polyPatchList typedef within polyPatch.H

INT: relocate GeometricField::Boundary -> GeometricBoundaryField

- was internal to GeometricField but moving it outside simplifies
  forward declarations etc. Code adapted from openfoam.org
2022-03-30 16:36:03 +02:00
Mark Olesen
62fc3bbc33 STYLE: broadcast instead of combineScatter/listCombineScatter/mapCombineScatter
- these are the same thing now and 'broadcast' expresses the intention
  more directly/consistently
2022-03-12 21:16:30 +01:00
Mark Olesen
0cf02eb384 ENH: globalIndex with direct gather/broadcast
- less communication than gatherList/scatterList

ENH: refine send granularity in Pstream::exchange

STYLE: ensure PstreamBuffers and defaultCommsType agree

- simpler loops for lduSchedule
2022-03-12 21:16:29 +01:00
Mark Olesen
14631984df ENH: additional control and access methods for PstreamBuffers
- PstreamBuffers nProcs() and allProcs() methods to recover the rank
  information consistent with the communicator used for construction

- allowClearRecv() methods for more control over buffer reuse
  For example,

      pBufs.allowClearRecv(false);

      forAll(particles, particlei)
      {
          pBufs.clear();

          fill...

          read via IPstream(..., pBufs);
       }

  This preserves the receive buffers memory allocation between calls.

- finishedNeighbourSends() method as compact wrapper for
  finishedSends() when send/recv ranks are identically
  (eg, neighbours)

- hasSendData()/hasRecvData() methods for PstreamBuffers.

  Can be useful for some situations to skip reading entirely.
  For example,

      pBufs.finishedNeighbourSends(neighProcs);

      if (!returnReduce(pBufs.hasRecvData(), orOp<bool>()))
      {
          // Nothing to do
          continue;
      }
      ...

  On an individual basis:

      for (const int proci : pBufs.allProcs())
      {
          if (pBufs.hasRecvData(proci))
          {
             ...
          }
      }

  Also conceivable to do the following instead (nonBlocking only):

      if (!returnReduce(pBufs.hasSendData(), orOp<bool>()))
      {
          // Nothing to do
          pBufs.clear();
          continue;
      }

      pBufs.finishedNeighbourSends(neighProcs);
      ...
2022-03-04 17:49:23 +00:00
Mark Olesen
af8161925b ENH: use mpi gather for list values in a few places
- avoid gatherList/scatterList when value are only need on master
2022-03-04 17:49:23 +00:00
Mark Olesen
f3674eee36 ENH: simpler use of broadcast (via Pstream::scatter)
- avoids worrying about forgetting a (Pstream::parRun()) guard
  and reduces code. The Pstream::scatter does the same thing under the
  hood.
2022-03-04 17:49:23 +00:00
Mark Olesen
1348cd7e7b ENH: use broadcasting Pstreams for one-to-all sends 2022-03-04 17:49:23 +00:00
Mark Olesen
62ec2f2ddf COMP: deprecate domainName and full hostName (#2280)
- unused in regular OpenFOAM code
- POSIX version uses deprecated gethostbyname()
- Windows version never worked

COMP: localize, noexcept on internal OSspecific methods

STYLE: support fileName::Type SYMLINK and LINK as synonyms
2022-02-10 16:46:12 +01:00
mattijs
debbcfb7df BUG: redistributePar: handle cyclicA(C)MI cleaner. See #1558.
Should test on patch, not patch field
2022-02-10 13:46:21 +00:00
mattijs
7fa44e3c19 BUG: redistributePar: handle cyclicA(C)MI cleaner. See #1558. 2022-02-09 14:17:17 +00:00
Mark Olesen
d2961eec09 STYLE: avoid deprecation warnings for autoPtr set() method
- set() was silently deprecated in favour of reset() FEB-2018
  since the original additional check for overwriting an existing
  pointer was never used. The reset(...) name is more consistent
  with unique_ptr, tmp etc.

  Now emit deprecations for set().

- use direct test for autoPtr, tmp instead of valid() method.
  More consistent with unique_ptr etc.

STYLE: eliminate redundant ptr() use on cloned quantities
2022-01-24 12:26:38 +01:00
mattijs
fa5d79d0e5 ENH: redistributePar: add comment 2022-01-12 09:16:04 +00:00
mattijs
7da2a5e096 ENH: redistributePar: reconstruct mode in collated. Fixes #2194 2021-12-10 15:24:04 +00:00
Mark Olesen
a78e79908b ENH: additional decompose options
- decomposePar: -no-fields to suppress decomposition of fields

- makeFaMesh: -no-decompose to suppress creation of *ProcAddressing
  and fields, -no-fields to suppress decomposition of fields only
2021-11-09 15:44:54 +01:00
Mark Olesen
5a121119e6 ENH: add -verbose support into argList
- similar to -dry-run handling, can be interrogated from argList,
  which makes it simpler to add into utilities.

- support multiple uses of -dry-run and -verbose to increase the
  level. For example, could have

    someApplication -verbose -verbose

 and inside of the application:

    if (args.verbose() > 2) ...

BUG: error with empty distributed roots specification (fixes #2196)

- previously used the size of distributed roots to transmit if the
  case was running in distributed mode, but this behaves rather poorly
  with bad input. Specifically, the following questionable setup:

      distributed true;
      roots ( /*none*/ );

  Now transmit the ParRunControl distributed() value instead,
  and also emit a gentle warning for the user:

      WARNING: running distributed but did not specify roots!
2021-11-09 15:44:54 +01:00
Mark Olesen
b364a9e72c ENH: argList improvements
- argList::envExecutable() static method.
  This is identical to getEnv("FOAM_EXECUTABLE"), where the name of
  the executable has typically been set from the argList construction.

  Provides a singleton access to this value from locations that
  do not have knowledge of the originating command args (argList).
  This is a similar rationale as for the argList::envGlobalPath() static.

- additional argList::envRelativePath() static method.

- make -dry-run handling more central and easier to use by adding into
  argList itself.

STYLE: drop handling of -srcDoc (v1706 option)

- replaced with -doc-source for 1712 and never used much anyhow
2021-11-03 11:38:21 +01:00
mattijs
b157614e00 ENH: redistributePar: write collated format. #806
- supports redistributePar -decompose -fileHandler collated
- supports redistributePar -reconstruct
- does not support redistributePar with collated in redistribution mode
2021-10-19 12:18:07 +01:00
Mark Olesen
fe8c630936 BUG: Foam::cp inadvertently creates recursive directories (fixes #2235)
- noticed by Robin Knowles with `decomposePar -fields -copyZero`

  The internals for the Foam:cp method combine the behaviour of
  a regular `cp` and `cp -R` combined.

  When source and target are both directories, the old implementation
  created a subdirectory for the contents.
  This normally fine,

      ok:  cp "path1/0/" to "path2/1" -> "path2/1/2"
      BUT: cp "path1/0/" to "path2/0" -> "path2/0/0" !!

  Now add check for the basenames first.
  If they are identical, we probably meant to copy directory contents
  only, without the additional subdir layer.

BUG: decomposePar -fields -copyZero copies the wrong directory

- was using the current time name (usually latest) instead of copying
  the 0 directory

ENH: accept 0.orig directories as a fallback to copy if the 0 directory
is missing
2021-10-18 14:58:17 +02:00
Mark Olesen
8a3dc0527c ENH: -no-finite-area, -no-lagrangian options for some parallel utils 2021-10-01 15:26:50 +02:00
Mark Olesen
96adf3ae80 ENH: add IOobject::objectRelPath() for compact output (#2195) 2021-09-07 16:35:34 +02:00
Mark Olesen
ae02a86562 ENH: multi-region support for reconstructParMesh (#2072) 2021-06-11 17:18:35 +02:00
Mark Olesen
0ae17908a2 ENH: collect and cleanup decompose and reconstruct methods (#2084)
- new faDecompose and faReconstruct libraries

- provide common readFields in the faDecompose library
2021-05-27 21:04:55 +02:00
Mark Olesen
0cf4aede6e ENH: initial revamp of faMesh to improve modularity (#2084)
- improved separation of patch creation that is also parallel-aware,
  which now allows creation in parallel

- memory-safe use of PtrList for adding patches, with a more generalized
  faPatchData helper

- use uindirectPrimitivePatch instead of indirectPrimitivePatch
  for internal patch handling.

- align boundary methods with polyMesh equivalents

- system/faMeshDefinition instead of constant/faMesh/faMeshDefinition
  as per blockMesh convention. Easier to manage definitions, easier
  for cleanup.

- drop inheritence from GeoMesh.
2021-05-27 21:04:55 +02:00
Mattijs Janssens
4028738327 ENH: redistributePar - detect if reconstruct is required (#2092) 2021-05-19 18:16:06 +02:00
Mark Olesen
0df219d1b3 ENH: expose decomposePar -dry-run options -domains, -method
- can now drop older Test-decomposePar for exploration purposes
  and simply use -dry-run with the -domains and -method options.

- write VTK file instead of volScalarField in combination
  with -dry-run and -cellDist.

  Avoids adding any OpenFOAM fields and is usually faster to load.
  Also easier to rename than a volScalarField would be when exploring
  multiple decompositions.
2021-05-19 18:16:05 +02:00
Mark Olesen
0ea709e5ee STYLE: minor code reduction in reconstructParMesh 2021-05-19 18:16:05 +02:00
Mark Olesen
5022591c36 ENH: return old file handler on change
- intended for the following type of use:

      auto oldHandler = fileHandler(fileOperation::NewUncollated());

      ... do something that only works with uncollated

      // Restore previous (if any)
      if (oldHandler)
      {
          fileHandler(std::move(oldHandler));
      }

ENH: make fileOperation distributed(bool) mutable

- use is "static-like" and akin to Pstream::parRun(bool),
  thus allow toggling of the switch without a const_cast
2021-05-13 11:39:30 +02:00
Mark Olesen
2a438385a3 STYLE: make polyMesh constructor explicit
- use polyMesh::defaultRegion instead of fvMesh::defaultRegion and
  others via static inheritance. (92 vs ~25 occurrences)
2021-05-12 11:24:57 +02:00
Mark Olesen
c410edf928 ENH: centralized handling of -allRegions, -regions, -region (#2072)
Step 1.
    include "addAllRegionOptions.H"

    Adds the -allRegions, -regions and -region options to argList.

Step 2.
    include "getAllRegionOptions.H"

    Processes the options with -allRegions selecting everything
    from the regionProperties.

    OR use -regions to specify multiple regions (from
       regionProperties), and can also contain regular expressions

    OR use the -region option

    Specifying a single -regions NAME (not a regular expresssion)
    is the same as -region NAME and doesn't use regionProperties

    Creates a `wordList regionNames`

Step 3.
    Do something with the region names.
    Either directly, or quite commonly with the following

    include "createNamedMeshes.H"

    Creates a `PtrList<fvMesh> meshes`

STYLE: add description to some central include files
2021-05-07 09:46:33 +02:00
Mark Olesen
86f627b9e6 ENH: consolidate decomposition model, constructors for decomposition methods
- make regionName an optional constructor parameter, which eliminates
  a separate set of constructors and construction tables. Adjust
  internals to treat a missing/empty regionName as a no-op.

- pass in fallback dictionary content via new IOdictionary constructor
  with a pointer

ENH: further relax check for matching number of processor dirs

- if the "numberOfSubdomains" entry is missing (or even zero)
  ignore checks of processor dirs as meaningless.
2021-04-27 09:14:48 +02:00
Mark Olesen
9a2a22a03a ENH: provide setter methods for IOobject read/write options etc.
- simplifies local toggling.

- centralize fileModification static variables into IOobject.
  They were previously scattered between IOobject and regIOobject
2021-03-17 15:10:00 +01:00
mattijs
3299f9ac0d ENH: redistributePar: single-step. See #1211
Support for DimensionedFields
2021-03-17 12:21:46 +00:00
mattijs
db343351f7 BUG: redistributePar: single-step. See #1211
- override casename, procesorCase flags to guarantee reconstructed
case to be written to the undecomposed directory
- alternative is to construct a Zero mesh on the undecomposed
runTime and add all other bits to that but that has not been
pursued
2021-03-15 08:31:10 +00:00
mattijs
ba9e573812 ENH: redistributePar: single-step. See #1211
- single-step for reconstructParMesh
- no point merging for redistributePar -reconstruct
2021-03-08 11:01:57 +00:00
Mark Olesen
6cdf89dced ENH: use concise forms for walking processor and cyclic boundaries 2021-02-09 17:57:49 +01:00
mattijs
f5e689c6a8 BUG: redistributePar: symmetric logic. Fixes #1973. 2021-01-04 14:44:28 +00:00
mattijs
dbaed65d75 BUG: redistributePar: failing reconstruct. See #1953.
In reconstruct mode redistributePar will have
- master read undecomposed mesh
- slaves construct dummy mesh (0 faces/points etc.)
  but correct patches and zones
so all processors have two valid meshes. This was
all handled inside fvMeshTools::newMesh and this
was behaving differently.
2020-12-16 17:27:08 +00:00
mattijs
723edc1c61 ENH: redistributePar: avoid temporary unassigned faces. See #1956. 2020-12-16 17:27:08 +00:00
Mattijs Janssens
46dbfabd9d ENH: primitiveMesh: make geometry calculation runtime selectable
This adds a 'geometry' scheme section to the system/fvSchemes:

geometry
{
    type            highAspectRatio;
}

These 'fvGeometryMethod's are used to calculate
- deltaCoeffs
- nonOrthoCoeffs
etc and can even modify the basic face/cellCentres calculation.
2020-12-11 10:31:34 +00:00
mattijs
8268d8aaba BUG: redistributePar: avoid par comms. Fixes #1953 2020-12-10 15:43:28 +00:00
mattijs
89f2cda3ab ENH: mpi: use per-application communicator. 2020-12-09 15:17:44 +00:00
Mark Olesen
df74e8448c ENH: robuster fileOperations splitProcessorPath
- robuster matching behaviour when encountering paths that themselves
  contain the word "processor" in them. For example,

    "/path/processor0generation2/case1/processor10/system"
    will now correctly match on processor10 instead of failing.

- use procRangeType for encapsulating the processor ranges

- provision for information of distributed vs non-distributed roots.
  The information is currently available from the initial setup, but
  can useful to access directly within fileOperation.

STYLE: modernize list iteration
2020-12-08 11:58:28 +01:00
Mark Olesen
9c7aa9727a ENH: add UPstream::parRun(const bool)
- slightly neater code when disabling/restoring parallel state

  New
      const bool oldParRun = Pstream::parRun(false);
      ...
      Pstream::parRun(oldParRun);

  Old
      const bool oldParRun = Pstream::parRun();
      Pstream::parRun() = false;
      ...
      Pstream::parRun() = oldParRun;
2020-10-12 12:51:22 +02:00
Mark Olesen
5dc5ea928a ENH: add UPstream::subProcs() static method
- returns a range of `int` values that can be iterated across.
  For example,

      for (const int proci : Pstream::subProcs()) { ... }

  instead of

      for
      (
          int proci = Pstream::firstSlave();
          proci <= Pstream::lastSlave();
          ++proci
      )
      {
          ...
      }
2020-09-28 14:26:07 +02:00
Mark Olesen
e18ff114a6 ENH: add UPstream::allProcs() method
- returns a range of `int` values that can be iterated across.
  For example,

      for (const int proci : Pstream::allProcs()) { ... }

  instead of

      for (label proci = 0; proci < Pstream::nProcs(); ++proci) { ... }
2020-09-28 14:25:59 +02:00
Mark Olesen
12c91b9472 STYLE: check autoPtr as plain bool instead of valid()
- cleaner code, more similarity with unique_ptr

  Now
      if (ptr)
      if (!ptr)

  instead
      if (ptr.valid())
      if (!ptr.valid())
2020-07-16 11:39:24 +02:00
Mark Olesen
9af3f85cf9 STYLE: simplify short-circuit involving autoPtr (#1775)
- with '&&' conditions, often better to check for non-null autoPtr
  first (it is cheap)

- check as bool instead of valid() method for cleaner code, especially
  when the wrapped item itself has a valid/empty or good.
  Also when handling multiple checks.

  Now
      if (ptr && ptr->valid())
      if (ptr1 || ptr2)

  instead
      if (ptr.valid() && ptr->valid())
      if (ptr1.valid() || ptr2.valid())
2020-07-16 10:17:25 +02:00
OpenFOAM bot
df7044845e GIT: remove whitespace, backslash escape angle brackets in comments
- fix older '> >' template parameters as '>>'
2020-06-26 12:28:49 +02:00
Kutalmis Bercin
2803f765f5 BUG: decomposePar -decomposeParDict option (fixes #1649)
DOC: reorder the options of decomposePar in the header file
2020-06-11 13:30:30 +01:00
mattijs
aa956f4b05 ENH: Pstream: Feed through outstanding requests more. See #1626.
This e.g. was giving a problem with using volPointInterpolation (in
functionObjects) with non-blocking global reductions.
2020-06-10 12:10:02 +01:00
Mark Olesen
31b172217c ENH: support predicate checks for argList (similar to dictionary methods)
- Favour use of argList methods that are more similar to dictionary
  method names with the aim of reducing the cognitive load.

  * Silently deprecate two-parameter get() method in favour of the
    more familiar getOrDefault.
  * Silently deprecate opt() method in favour of get()

  These may be verbosely deprecated in future versions.
2020-06-02 13:51:18 +02:00
mattijs
8eeb5e8699 ENH: redistributePar: handle cyclicACMI. See #1558.
Explicitly avoid updating cyclicACMI.
2020-05-20 18:03:54 +01:00
Mark Olesen
42299dca22 ENH: use IOstreamOption for writeObject() calls.
- reduces the number of parameters that are being passed around
  and allows future additions into the IOstreamOption with mininal
  effort.
2020-02-19 09:25:33 +00:00
Mark Olesen
87b3006566 STYLE: backslash doxygen commands, email address, typos in error messages 2020-01-31 17:06:30 +01:00
Mark Olesen
1310e85225 ENH: support 'get()' for retrieving argList options
- previously only had 'opt<..>()' for options, but 'get<..>()'
  provides more similarity with dictionary methods.
  The 'opt<..>()' method is retained.
2019-11-26 21:07:11 +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
mattijs
f64125c6d9 ENH: redistributePar: handle -overwrite. Fixes #1450. 2019-10-17 13:27:55 +01:00
sergio
e3b05494f7 COMP: relocate regionProperties to meshTools 2019-09-20 14:06:30 -07:00
Mark Olesen
1d8ea9182b ENH: add basic zero-initialized constructors for particle classes
- for the most basic level construction with mesh and position only.
2019-08-02 17:23:00 +02:00
Mark Olesen
037be8dbb0 STYLE: use default constructors/destructors for base cloud classes
- use cloud::defaultName instead of "defaultCloud" string literal
2019-08-02 17:22:00 +02:00
Mark Olesen
66a100997f COMP: force dlOpen for windows application binaries (#1238)
- when windows portable executables (.exe or .dll) files are loaded,
  their dependent libraries not fully loaded. For OpenFOAM this means
  that the static constructors which are responsible for populating
  run-time selection tables are not triggered, and most of the run-time
  selectable models will simply not be available.

Possible Solution
=================

  Avoid this problem by defining an additional library symbol such as
  the following:

      extern "C" void libName_Load() {}

  in the respective library, and tag this symbol as 'unresolved' for
  the linker so that it will attempt to resolve it at run-time by
  loading the known libraries until it finds it. The link line would
  resemble the following:

      -L/some/path -llibName -ulibName_Load

  Pros:
    - Allows precise control of forced library loading

  Cons:
    - Moderately verbose adjustment of some source files (even with macro
      wrapping for the declaration).
    - Adjustment of numerous Make/options files and somewhat ad hoc
      in nature.
    - Requires additional care when implementing future libraries and/or
      applications.

  - This is the solution taken by the symscape patches (Richard Smith)

Possible Solution
=================

  Avoid this problem by simply force loading all linked libraries.
  This is done by "scraping" the information out of the respective
  Make/options file (after pre-processing) and using that to define
  the library list that will be passed to Foam::dlOpen() at run-time.

  Pros:
    - One-time (very) minimal adjustment of the sources and wmake toolchain
    - Automatically applies to future applications

  Cons:
    - Possibly larger memory footprint of application (since all dependent
      libraries are loaded).
    - Possible impact on startup time (while loading libraries)
    - More sensitive to build failures. Since the options files are
      read and modified based on the existence of the dependent
      libraries as a preprocessor step, if the libraries are initially
      unavailable for the first attempt at building the application,
      the dependencies will be inaccurate for later (successful) builds.

  - This is solution taken by the bluecape patches (Bruno Santos)

Adopted Solution
================

  The approach taken by Bruno was adopted in a modified form since
  this appears to be the most easily maintained.

Additional Notes
================

  It is always possible to solve this problem by defining a corresponding
  'libs (...)' entry in the case system/controlDict, which forces a dlOpen
  of the listed libraries. This is obviously less than ideal for large-scale
  changes, but can work to resolve an individual problem.

  The peldd utility (https://github.com/gsauthof/pe-util), which is
  also packaged as part of MXE could provide yet another alternative.
  Like ldd it can be used to determine the library dependencies of
  binaries or libraries. This information could be used to define an
  additional load layer for Windows.
2019-05-25 19:10:14 +02:00
Mark Olesen
beefee48d4 COMP: adjust compilation order with updated interdependencies
- Eg, with surface writers now in surfMesh, there are fewer libraries
  depending on conversion and sampling.

COMP: regularize linkage ordering and avoid some implicit linkage (#1238)
2019-04-28 14:44:33 +02:00
Mark Olesen
078e34746e ENH: code adjustments for updated NullObject
- can now safely use labelList::null() instead of emptyLabelList for
  return values. No special treatment required for lists.

  Possible replacements:

      if (notNull(list) && list.size())  ->  if (list.size())
      if (isNull(list) || list.empty())  ->  if (list.empty())

  The receiver may still wish to handle differently to distinguish
  between a null list and an empty list, but no additional special
  protection is required when obtaining sizes, traversing, outputting
  etc.
2019-02-07 13:04:24 +01:00
OpenFOAM bot
154029ddd0 BOT: Cleaned up header files 2019-02-06 12:28:23 +00:00
mattijs
73705d8290 BUG: decomposePar: incorrect indexing. Fixes #1189. 2019-01-30 11:48:35 +00:00
Mark Olesen
3b91160027 STYLE: centralize example dictionaries under etc/ (issue #1074)
- as well as being more convenient to find, this is necessary when the
  OpenFOAM installation is without sources or tutorials
2019-01-26 17:46:08 +01:00
Mark Olesen
cb5617e070 STYLE: fix some doxygen markup
- missing verbatim/endverbatim markers, missing "Foam::" prefix, typos
2019-01-11 08:22:02 +01:00
Mark Olesen
14a404170b ENH: for-range, forAllIters() ... in applications/utilities
- reduced clutter when iterating over containers
2019-01-07 09:20:51 +01:00
mattijs
a6a46d23b8 BUG: polyMesh: set AUTO_WRITE flag. See #1147. 2019-01-07 17:51:47 +00:00
Mark Olesen
1d85fecf4d ENH: use Zero when zero-initializing types
- makes the intent clearer and avoids the need for additional
  constructor casting. Eg,

      labelList(10, Zero)    vs.  labelList(10, 0)
      scalarField(10, Zero)  vs.  scalarField(10, scalar(0))
      vectorField(10, Zero)  vs.  vectorField(10, vector::zero)
2018-12-11 23:50:15 +01:00
Andrew Heather
9231534efa STYLE: Updating version to v1812 2018-12-19 18:07:52 +00:00
Mark Olesen
29a5793b5b STYLE: argList::opt method instead of the longer argList::lookupOrDefault
- also replaced a few instances of readIfPresent with opt<> for
  constant values.
2018-12-12 12:10:39 +01:00