Compare commits

...

101 Commits

Author SHA1 Message Date
fc20aa1c4d (Merge): INT: Integration of gmresSolver from foam-extend 2024-06-05 11:39:51 +01:00
44f8550185 (Merge) TUT: longPipe: style changes 2024-06-05 11:39:46 +01:00
ab1788ae33 ENH: simpleFoam: added gmres-using case. 2024-06-03 12:29:04 +01:00
578cb2b67c INT: Integration of gmresSolver from foam-extend
(http://www.foam-extend.org)
2024-05-30 17:19:54 +01:00
30d2e2d3cf Merge branch 'feature-Function1-objectRegistry' into 'develop'
Function1: added 'lookup' Function1

See merge request Development/openfoam!676
2024-05-30 10:25:24 +00:00
c07997d816 Function1: added 'lookup' Function1 2024-05-30 10:25:24 +00:00
495fa6c577 Merge branch 'feature-ensight-single-file' into 'develop'
Add support for reading ensight transient single-file format

See merge request Development/openfoam!682
2024-05-29 14:05:27 +00:00
dfc9a8923a ENH: read support for EnSight single-file transient (#3154)
- the ensightReadFile init() now automatically sets up binary/ascii
  (for geometry files) and checks for the transient "BEGIN TIME STEP"
  marker. If found, will also populate the file offsets for each of
  the timesteps.  If no corresponding footer is found (which would be
  very inefficient), it simply pretends that there is only a single
  time step instead of performing a costly file scan.

- parsing of the ensight case file now also supports the use of

      filename numbers:

  as an alternative to

      filename start number:
      filename increment:

- improved parsing robustness of "time values:" entry.
  Can now also have contents on the same line as the introducer.

ENH: base-level adjustments for writing transient single-file

- beginGeometry() is now separated out from file creation.

- in append mode, ensightFile and ensightGeoFile will attempt to
  parse existing time-step information.
2024-05-29 14:04:52 +00:00
ee895577ae ENH: improve OFstream append behaviour (#3160)
- previous support for file appending (largely unused) always
  specified opening with the std::ios_base::app flag.

  Now differentiate between append behaviours:

  APPEND_APP
  ~~~~~~~~~~
  Corresponds to std::ios_base::app behaviour:

  - Existing files will be preserved and a seek-to-end is performed at
    every write. With this mode seeks/repositioning within the file
    will effectively be ignored on output.

  APPEND_ATE
  ~~~~~~~~~~
  Largely approximates std::ios_base::ate behaviour:

  - Existing files will be preserved and a seek-to-end is performed
    immediately after opening, but not subsequently. Can use seekp()
    to overwrite parts of a file.
2024-05-29 14:04:52 +00:00
9f032057b4 Merge branch 'feature-blockLevel-rays' into 'develop'
ENH: shm: blockLevel through ray-shooting

See merge request Development/openfoam!642
2024-05-29 10:11:19 +00:00
10b0c3cfca ENH: shm: blockLevel through ray-shooting 2024-05-29 10:11:18 +00:00
773548c283 Merge branch 'update-GeometricBoundaryField-evaluate' into 'develop'
Improve flexiblity of GeometricBoundaryField evaluate

See merge request Development/openfoam!683
2024-05-29 08:18:53 +00:00
9335b641f1 ENH: GeometricBoundaryField evaluate with specified communication type
- evaluate()
  the communication type is exposed as a parameter to allow for more
  tuning, but default parameter remains defaultCommsType so there is
  no change in behaviour for existing code

- evaluate_if()
  supports a general selection predicate

- evaluateSelected()
  now does initEvaluate() for all patches, waits and then calls
  evaluate(). This avoids potential deadlocks when multiple patches
  are inter-communicating.

ENH: align DimensionedField reading with GeometricField treatment

- use localIOdictionary to obtain the dictionary contents

ENH: update GeometricField code

- change GeometricField writeData() as primary output method
  (not operator<<) for better clarity of purpose

- use unique_ptr for GeometricField demand-driven data
2024-05-28 17:52:09 +01:00
ffc9894033 STYLE: more consistency in writeEntry() signatures
- boundary entries with writeEntry(const word&, ...) instead of
  writeEntry(const keyType&, ...) to match with most other
  writeEntry() signatures. Also, this content will not be used
  to supply regex matched sub-dictionaries.

STYLE: more consistent patch initEvaluate()/evaluate() coding
2024-05-28 17:50:03 +01:00
1406f9ec26 ENH: robuster handling of unknown stream/float formats 2024-05-23 21:13:14 +02:00
b81fe70830 ENH: extend readContents IO factory methods
- support wantedType for localIOdictionary::readContents()

- add readContents() for GlobalIOList, GlobalIOField
2024-05-23 13:51:53 +02:00
bbde236be5 ENH: simpler internal handling of stderr in message streams
- delay construction of message buffer

- OStringStream count() method to test if anything has been streamed

STYLE: explicit use of std::ios_base in IOstreams

- document the return information of set flag methods
2024-05-23 13:51:53 +02:00
3b9176665f ENH: add dictionary::findStream() - symmetric with findDict()
- can be used with this type of code:

  ITstream* streamPtr = dict.findStream(name);
  if (streamPtr)
  {
      auto& is = *streamPtr;
      ...
  }

  versus:

  const entry* eptr = dict.findEntry(name);
  if (eptr && eptr->isStream())
  {
      auto& is = eptr->stream();
      ...
  }

ENH: add findStream(), streamPtr(), isStream() to dictionary search

- symmetric with findDict(), dictPtr(), isDict() methods

STYLE: use findDict() instead of found() + subDict() pairing

COMP: define is_globalIOobject trait at top of IOobject header

- more visibility, permits reuse for specializations etc.
2024-05-23 13:51:53 +02:00
6a80d4de40 ENH: reduce boundary face queries in streamFunction
BUG: streamFunction used uninitialized values for symmetry patches

- related to 8a8b5db977 changes (#3144)

ENH: improve robustness of surface field flattening

- vtk::surfaceFieldWriter
2024-05-23 13:51:53 +02:00
3f1d181b42 COMP: provide GeometricFieldFwd.H for internal/boundary/full field
- simplifies forward declarations
2024-05-23 07:41:01 +02:00
8d649d1737 FIX: additional shell quoting for foamInstallationTest (fixes #3163)
- the PATH on WSL will usually contain spaces, so it needs quoting
2024-05-22 21:00:00 +02:00
21a84bdf91 Merge remote-tracking branch 'origin/master' into develop 2024-05-22 20:59:28 +02:00
1ad1957c41 ENH: GAMG: bit more testing of procAgglom+cyclicAMI 2024-05-22 18:02:28 +01:00
4510067e63 CONFIG: bump patch level 2024-05-22 16:26:39 +02:00
8cf757daf0 BUG: GAMG: processorAgglomeration not merging proc coeffs. Fixes #3172 2024-05-22 16:26:39 +02:00
6581c5792a BUG: STL: cannot handle files > 2Gb. Fixes #3171 2024-05-22 16:25:37 +02:00
03fb8f043e ENH: cyclicAMI: restart search with large bounding box. Fixes #3175 2024-05-22 12:37:32 +01:00
45ec64e6c8 BUG: STL: cannot handle files > 2Gb. Fixes #3171 2024-05-20 12:17:04 +01:00
eb17ff1ea3 DOC: cyclicPeriodicAMI: bit of comment 2024-05-18 12:55:55 +01:00
a7538fab57 BUG: interfaceHeight: fix header writing to output files (fixes #3115) 2024-05-08 11:20:34 +01:00
4fb85d1f76 Merge branch 'update-Pstream-large-sends' into 'develop'
ENH: improve handling of multi-pass send/recv

See merge request Development/openfoam!680
2024-05-07 14:29:14 +00:00
d9c73ae489 ENH: improve handling of multi-pass send/recv (#3152)
- the maxCommsSize variable is used to 'chunk' large data transfers
  (eg, with PstreamBuffers) into a multi-pass send/recv sequence.

  The send/recv windows for chunk-wise transfers:

      iter    data window
      ----    -----------
      0       [0, 1*chunk]
      1       [1*chunk, 2*chunk]
      2       [2*chunk, 3*chunk]
      ...

  Since we mostly send/recv in bytes, the current internal limit
  for MPI counts (INT_MAX) can be hit rather quickly.

  The chunking limit should thus also be INT_MAX, but since it is
  rather tedious to specify such large numbers, can instead use

      maxCommsSize = -1

  to specify (INT_MAX-1) as the limit.
  The default value of maxCommsSize = 0 (ie, no chunking).

Note
~~~~
  In previous versions, the number of chunks was determined by the
  sender sizes. This required an additional MPI_Allreduce to establish
  an overall consistent number of chunks to walk. This additional
  overhead each time meant that maxCommsSize was rarely actually
  enabled.

  We can, however, instead rely on the send/recv buffers having been
  consistently sized and simply walk through the local send/recvs until
  no further chunks need to be exchanged. As an additional enhancement,
  the message tags are connected to chunking iteration, which allows
  the setup of all send/recvs without an intermediate Allwait.

ENH: extend UPstream::probeMessage to use int64 instead of int for sizes
2024-05-07 15:33:02 +02:00
e15d696a24 STYLE: use Perr instead of Pout for UPstream::debug and warnComm
- avoids polluting standard output for utilities such as
  foamDictionary etc
2024-05-07 14:45:10 +02:00
dbfd1f90b1 ENH: add single-time handling to timeSelector
- the timeSelector is often used to select single or multiple times
  (eg, for post-processing). However, there are a few applications
  where only a *single* time should be selected and set.

  These are now covered by this type of use:

      timeSelector::addOptions_singleTime();  // Single-time options
      ...
      // Allow override of time from specified time options, or no-op
      timeSelector::setTimeIfPresent(runTime, args);

   In some cases, if can be desirable to force starting from the
   initial Time=0 when no time options have been specified:

      // Set time from specified time options, or force start from Time=0
      timeSelector::setTimeIfPresent(runTime, args, true);

   These changes make a number of includes redundant:

     * addTimeOptions.H
     * checkConstantOption.H
     * checkTimeOption.H
     * checkTimeOptions.H
     * checkTimeOptionsNoConstant.H

ENH: add time handling to setFields, setAlphaField (#3143)

    Co-authored-by: Johan Roenby <>

STYLE: replace instant("constant") with instant(0, "constant")

- avoids relying on atof parse behaviour returning zero
2024-05-06 22:22:42 +02:00
883196981d ENH: add offset support to stringOps::split functions
- for example,

     string buffer = ...;
     SubStrings<string> split;
     {
         auto colon = buffer.find(':');

         if (colon != std::string::npos)
         {
             split = stringOps::splitSpace(buffer, colon+1);
         }
     }

    Not really possible with a substr() since that would create a new
    temporary which then disappears.  Similarly awkward to split and
    then scan for the ':' to decide how many to discard.

ENH: add pop_front() and pop_back() methods to SubStrings

- the content is trivial enough (a pair of iterators) and the total
  number of elements is usually reasonable short so that removal of
  elements is inexpensive

  For example,

     string buffer = ...;
     auto split = stringOps::splitSpace(buffer);

     if (!split.empty() && split[0].str() == "face")
     {
         split.pop_front();
     }
2024-05-02 17:53:53 +02:00
3fed41547f COMP: remove template-id for constructor/destructor
- not allowed in C++20

COMP: avoid hidden overloaded-virtual (edgeMesh, surfMesh)
2024-05-02 16:47:46 +02:00
e22edc5dee STYLE: limitTemperature: consolidate standard output stream 2024-05-02 14:17:48 +01:00
0ef7589979 BUG: sampledMeshSurface sampling on "empty" patch fails
- requires a field size check when copying into the flat boundary
2024-05-02 10:24:28 +02:00
7dc9ccdcaa Merge branch 'update-Pstream-message-count' into 'develop'
Use MPI Get_elements_x() for message sizes

See merge request Development/openfoam!681
2024-04-29 10:25:30 +00:00
b2bbc15463 ENH: use MPI Get_elements_x() for message sizes (#3152)
- ensures more accurate values for message sizes than using
  MPI Get_count(), which trucates at INT_MAX

- add more/better error messages when trying to receive messages
  that exceed INT_MAX or the char buffer lengths
2024-04-29 10:22:24 +02:00
7b38b148fa STYLE: use PstreamBuffers default construct
- PstreamBuffers are nonBlocking by default, so no need to re-specify
2024-04-29 10:21:25 +02:00
7f355ba343 STYLE: communication name "buffered" instead of "blocking"
- "buffered" corresponds to MPI_Bsend (buffered send),
  whereas the old name "blocking" is misleading since the
  regular MPI_Send also blocks until completion
  (ie, buffer can be reused).

ENH: IPstream::read() returns std::streamsize instead of label (#3152)

- previously returned a 'label' but std::streamsize is consistent with
  the input parameter and will help with later adjustments.

- use <label> instead of <int> for internal accounting of the message
  size, for consistency with the underyling List<char> buffers used.

- improve handling for corner case of IPstream receive with
  non-blocking, although this combination is not used anywhere
2024-04-29 10:19:40 +02:00
e1d45ec26e ENH: snappyHexMesh: more parallel consistency. See #2331 2024-04-25 15:52:41 +01:00
690d02f9e8 ENH: snappyHexMesh: more parallel consistency. See #2331 2024-04-24 17:10:27 +01:00
31b74cd627 Merge branch 'update-fvsPatchFields-mappers' into 'develop'
Fix fvsPatchFields reading/writing the "value" entry

See merge request Development/openfoam!679
2024-04-24 12:35:11 +00:00
f04ccef588 ENH: improve code consistency for {cell,face,point}Mapper (#3147)
- robuster and more reliable determination of inserted objects
  (previous code could produce false positives).

  Now also determine the number of inserted objects within the
  constructor (instead of simply storing a bool). This allows reuse
  in the address calculations to reduce overheads there.

BUG: dodgy short-circuit logic for insertedObjectLabels()

- as a quick short-circuit it previously created as demand-driven
  pointer with a zero elements. However, this meant that if this code
  was called first (before any other addressing), subsequent calls to
  the addressing would fail.

BUG: bad logic and lookup for faAreaMapper (#3147)

- was using labelHashSet but returning a bool and set using the
  addressing using the unfiltered objects!
  This is a latent bug since interpolated/inserted faces not
  currently supported anyhow.

ENH: use std::unique_ptr for demand-driven data
2024-04-24 14:03:11 +02:00
8a8b5db977 BUG: fvsPatchFields reading/writing the "value" entry (fixes #3144)
- manual revert for 44d0fbd594.

  Unless required for post-processing the "value" entry should not
  written if it is not mandatory for reading.

  This is especially crucial with an 'empty' patch field where the
  field (size 0) has a different size from the patch.

- the changes made align fvsPatchField behaviour with fvPatchField
2024-04-24 14:03:02 +02:00
5fb1181bb2 SUBMODULE: update avalanche tutorials (for new finite-area locations) 2024-04-23 16:57:17 +02:00
411ac5fcfa ENH: adjust return type for token compound factory method
- return autoPtr<token::compound> instead of the derived type,
  otherwise cannot easily construct a token from it

ENH: additional typed version of refCompoundToken()

- symmetric with typed version of transferCompoundToken()
  and isCompound()

- add ITstream::findCompound<Type>() method.
  Useful for searching within token streams
2024-04-23 16:51:38 +02:00
880215e8e6 STYLE: use intermediate variable in openFoamTableReader 2024-04-23 12:16:52 +02:00
3874c1312e Merge branch 'update-argList-mpi-startup' into 'develop'
reduce communication argList at startup

See merge request Development/openfoam!678
2024-04-23 09:20:19 +00:00
09377471a3 ENH: stricter handling when freeing communicator components
- previously automatically skipped the first communicator (which was
  assumed to be MPI_COMM_WORLD), but now simply rely on the
  internal pendingMPIFree_ to track which communicators have actually
  been allocated.
2024-04-23 10:58:41 +02:00
2889dc7248 ENH: add wrapped accessor for MPI_Comm
- UPstream::Communicator is similar to UPstream::Request to
  wrap/unwrap MPI_Comm. Provides a 'lookup' method to transcribe
  the internal OpenFOAM communicator tracking to the opaque wrapped
  version.

- provide an 'openfoam_mpi.H' interfacing file, which includes
  the <mpi.h> as well as casting routines.

  Example (caution: ugly!)

     MPI_Comm myComm =
         PstreamUtils::Cast::to_mpi
         (
             UPstream::Communicator::lookup(UPstream::worldComm)
         );
2024-04-23 10:58:38 +02:00
d75c60d8ae ENH: reduce communication argList at startup (#3142)
- replace point-to-point transmission of the argList args/options with
  a broadcast. This is sufficient for most cases (without distributed
  roots).

  For "normal" cases (non-distributed roots) this will replace the
  nProcs-1 messages with a single broadcast.

- for cases with distributed roots, distinguish between a single,
  identical root and different roots.  An identical root can also be
  subsequently handled with a broadcast. Different roots will still
  require individual point-to-point communication.

  For cases with distributed roots, it will add the overhead of an
  additional broadcast.
2024-04-23 10:55:44 +02:00
582b613d5f ENH: add send/recv static methods for broadcast streams
- adds consistency with regular point-to-point parallel streams.

ENH: add ITstream::tokens() methods

- useful, for example, to disambiguate constructing tokenList from
  a ITstream.

  ITstream& is = otherDict.lookup("original");

  tokenList deepCopy(is);  // Error: from Istream or tokenList??
  tokenList deepCopy(is.tokens());  // OK: from tokenList
2024-04-22 11:46:27 +02:00
6cce1cdc8b STYLE: add push_back() method to dlLibraryTable, cellTable, boundaryRegion
- same as append() did, but with more consistent names

STYLE: replace special purpose append() with container method

STYLE: update code style
2024-04-22 11:46:24 +02:00
b6203a7de5 BUG: overlapping zones: incorrect sizing 2024-04-19 20:19:45 +01:00
701c916764 Merge branch 'update-finiteArea' into 'develop'
update to internal accounting for finite-area

See merge request Development/openfoam!675
2024-04-19 15:52:41 +00:00
d1c4a225a2 CONFIG: increment API level to 2402 (finite-area API changes) 2024-04-19 17:20:09 +02:00
4cfa2ea304 TUT: update for new finite-area location (with foamUpgradeFiniteArea) 2024-04-19 17:20:09 +02:00
b5435cc83e ENH: separate registry and revised file locations for finite-area
- The internal storage location of finite-area changes from being
  piggybacked on the polyMesh registry to a having its own dedicated
  registry:

  * allows a clearer separation of field types without name clashes.
  * prerequisite for supporting multiple finite-area regions (future)

Old Locations:
```
   0/Us
   constant/faMesh
   system/faMeshDefinition
   system/faSchemes
   system/faSolution
```

New Locations:
```
   0/finite-area/Us
   constant/finite-area/faMesh
   system/finite-area/faMeshDefinition  (or system/faMeshDefinition)
   system/finite-area/faSchemes
   system/finite-area/faSolution
```

NOTES:
    The new locations represent a hard change (breaking change) that
    is normally to be avoided, but seamless compatibility handling
    within the code was found to be unworkable.

    The `foamUpgradeFiniteArea` script provides assistance with migration.

    As a convenience, the system/faMeshDefinition location continues
    to be supported (may be deprecated in the future).
2024-04-19 17:20:09 +02:00
1d5b95b5fe BUG: redistributePar: Distributing refinement data. Fixes #3137.
- was using blocking (=buffered) comms
- was running out of MPI_COMM_SIZE buffer space
- now using PstreamBuffers to have non-blocing comms
2024-04-18 11:52:34 +01:00
31aadc5c4d ENH: prefer objectRegistry sorted to lookupClass
- lower memory overhead, consistent access pattern
2024-04-16 10:18:08 +02:00
a803516b16 ENH: use typedef for MeshObject within derived classes
- use an internal 'typedef MeshObject<...> MeshObject_type' within
  derived classes. Reduces clutter and eases any updates.
2024-04-16 10:18:08 +02:00
1b212789e5 ENH: add MeshObject Release() static method
- Delete() will perform a 'checkOut()' which does the following:
  * remove the object from the registry
  * delete the pointer (if owned by the registry)

- Release() does the following:
  * transfer ownership of the pointer (if owned by the registry)

- Store() does the following:
  * transfer ownership of the pointer to the registry

ENH: use UPtrList of sorted objects for MeshObject updates

- few allocations and lower overhead than using a HashTable,
  ensures the same walk order over the objects (in parallel)

STYLE: adjust meshObject debug statements
2024-04-16 10:18:08 +02:00
688fd5f3f1 ENH: add separate handling for clearing mesh phi
STYLE: update code style for phi modification (engine motion)

ENH: pass isMeshUpdate param in fvMesh/polyMesh clearOut() methods

- top-level use of isMeshUpdate parameter to clearOut and
  clearAddressing was being inadvertently filtered out
2024-04-16 10:18:08 +02:00
75e19c3116 REGRESSION: distributedTriSurfaceMesh:::findLocalInstance failure (#3135)
- after the modification of d578d48a4f, the parent was now actually
  searched. However, should be returning "constant" and not trigger a
  FatalError if the file/directory is not found.
2024-04-16 10:18:08 +02:00
16dd92b38e ENH: reduce reliance on stringListOps functions
- findStrings, findMatchingStrings now mostly covered by matching
  intrinsics in wordRe and wordRes.

  Add static wordRes match() and matching() variants

COMP: remove stringListOps include from objectRegistry.H

- was already noted for removal (NOV-2018)
2024-04-16 10:18:08 +02:00
92c329a8a9 ENH: add const_cast variants for isA<> and refCast<>
- an example of the new, more succinct refConstCast version:

      auto& abc = refConstCast<adjointVectorBoundaryCondition>(Uab);

  older:
      adjointVectorBoundaryCondition& abc =
          refCast<adjointVectorBoundaryCondition>
          (
              const_cast<fvPatchVectorField&>(Uab)
          );
  or:
      adjointVectorBoundaryCondition& abc =
          const_cast<adjointVectorBoundaryCondition&>
          (
              refCast<const adjointVectorBoundaryCondition>(Uab)
          );

- an example of the new, more succinct isA_constCast version:

      auto* acapPtr = isA_constCast<fieldType>(abf[patchi]);

      if (acapPtr)
      {
          auto& acap = *acapPtr;
          ...
      }

  older:
      if (isA<fieldType>(abf[patchi]))
      {
          fieldType& acap =
              const_cast<fieldType&>
              (
                  refCast<const fieldType>(abf[patchi])
              );
          ...
      }

STYLE: remove spurious 'const' qualifier from isA<> use
2024-04-16 10:18:08 +02:00
6546dd3f5b BUG: redistributePar: bypassing reading remote file. See #3137.
- NewIFstream would read complete remote file to decide if
  was collated.
- This limits files to 31bit size
- Instead now have master-only opening of file.
- Still has problem with refinement history/cellLevel etc.
2024-04-15 16:49:45 +01:00
752ab418c9 COMP: avoid ambiguous type conversion in Clang (fixes #3138) 2024-04-11 09:33:51 +01:00
d578d48a4f ENH: improve findInstance handling for optional files
- previously would always return "constant" as the instance for
  an optional dir/file that wasn't found.
  However, this meant retesting to screen out false positives.
  Now support an additional parameter
      'bool constant_fallback = ...'
  to return "constant" or an empty word.

  The method signature changes slightly with a new optional bool
  parameter:

      //! Return \c "constant" instead of \c "" if the search failed
      const bool constant_fallback = true

ENH: code consolidation for findInstancePath

- relocate from Time to TimePaths and provide an additional static
  version that is reused in fileOperations

BUG: distributedTriSurfaceMesh:::findLocalInstance broken (#3135)

- was not checking the parent at all.

COMP: remove unused findInstancePath(const fileName&, ..) method
2024-04-10 15:55:29 +02:00
85771c8985 ENH: simpler topoSet handling of zone/set
- support construct faceZoneSet from faceSet (#3126)

ENH: support unregistered loading of cell/face/point sets
2024-04-10 15:55:29 +02:00
68c5d90ad0 STYLE: rename readContents -> readIOcontents for private/protected method
- leave 'readContents' method name for exposed (public) methods.
  Generally not a problem, but can confuse the compiler when various
  public/private versions are available with the same number of
  parameters.

STYLE: adjust meshObject debug statements
2024-04-10 15:55:29 +02:00
0dcc53ab03 ENH: additional std::unique_ptr support for regIOobject and IOobjectList
- regIOobject::store(std::unique_ptr<...>&& ptr)
- IOobjectList::add(std::unique_ptr<...>&& ptr)

STYLE: io.globalCaseName() instead of io.time().globalCaseName() [#3007]
2024-04-10 15:55:29 +02:00
6ac572a179 BUG: masterUncollatedFileOperation::read() masked return value (#3135)
ENH: combine broadcasts for uncollated master-only handling
2024-04-10 15:55:29 +02:00
7fd962926d ENH: simplify Pstream broadcast stream construction
- the rootProcNo is usually == UPstream::masterNo()
2024-04-10 15:55:29 +02:00
bca093d89c SUBMODULE: update OpenQBMM (compilation change only) 2024-04-08 19:21:12 +01:00
0ef981adbc BUG: cached ensight type not a word (fixes #3133)
- the type/name for field caching were saved as word, but ensight has
  things like "tensor symm" etc, which do not parse very well as
  'word'. Now save as 'string' type.

  Backwards compatibility is OK since a word token will also be
  readable as string etc.
2024-04-05 14:06:36 +02:00
2d61127606 ENH: accept reading unquoted string (ie, word)
- makes string reading consistent with fileName reading.

  Related to #3133 to also allow compatibility when reading existing
  dictionaries written with unquoted string contents.
2024-04-05 14:05:36 +02:00
e099e98b8b STYLE: remove defunct restore0Dir expand of #include [collated]
- used defunct "processors/" directory naming, and includes are now
  addressed by the file-handler anyhow.

ENH: support 'tutorials/Alltest -init'

- for copying/creating test directory without running
2024-04-03 19:00:39 +02:00
2ff67f8ce4 BUG: overlapping zones: incorrect indexing 2024-03-30 16:29:23 +00:00
13f66313d1 BUG: redistributePar: restore. Fix AMIInterpolation. fixes #3125
Problem was that the zero fvMeshSubset constructed did not reset
the distributed flag.
2024-03-28 14:52:28 +00:00
483075b4aa BUG: KinematicCloud: remove hard-coded debug condition 2024-03-27 19:47:32 +00:00
1668519996 BUG: redistributePar: disable parallel when redistributing. Fixes #3125 2024-03-27 11:52:38 +00:00
5091c79e96 BUG: topoSet: allow use of 'set' as input for zones. Fixes #3126 2024-03-27 10:32:16 +00:00
6bd1486a38 ENH: solution: allow Function1 with database 2024-03-27 09:17:18 +00:00
93f6cae46a DOC: topoSet: add zones instead of sets 2024-03-27 09:17:18 +00:00
68e36946fd BUG: externalWallHeatFluxTemperature: prevent FPE in mixedEnergy condition (fixes #3123) 2024-03-21 16:36:22 +00:00
c6ecf3113a COMP: syncTools: move attribute 2024-03-20 09:32:43 +00:00
46e1b00c34 ENH: handle sub-mesh connectivity by subsetting of adjacency matrix
- in renumberMesh replace calculation of a subMesh connectivity
  with calculation of the full mesh connectivity followed by subsetting
  of the full adjacency matrix. This should reduce the overall number of
  operations. (MR !669)
2024-03-19 14:09:22 +01:00
a431e0fe9a ENH: additional parRun selection/protection on syncTools
- allow more control over using parallel communication or not.
2024-03-18 20:59:21 +01:00
6d69506294 STYLE: adjust comments and iterator de-reference
STYLE: replace PackedListCore.H with in-file definition
2024-03-18 20:59:21 +01:00
77ec7ab679 Merge branch 'feature-topoSet-with-zone' into 'develop'
topoSet: allow use of 'zone' instead 'set', 'zones' instead of 'sets' in all set sources

See merge request Development/openfoam!674
2024-03-18 19:58:07 +00:00
6692ecfbbc topoSet: allow use of 'zone' instead 'set', 'zones' instead of 'sets' in all set sources 2024-03-18 19:58:06 +00:00
3ef892b980 Merge branch 'feature-topoSet' into 'develop'
Feature topo set

See merge request Development/openfoam!668
2024-03-18 16:13:52 +00:00
e651d63566 ENH: cyclicAMI - clear finished send/recv requests 2024-03-18 17:00:34 +01:00
a7d6f2720f ENH: add for geometric transformation properties for topoSet
- added solidBodyMotionFunctions to topoSet which allows things like
  moving cellSet selection for fvOptions etc.

COMP: relocate solidBodyMotionFunctions to meshTools

Co-authored-by: Kutalmis Bercin <>
2024-03-18 16:50:16 +01:00
4a0a63999e BUG: cyclicAMI: start without 'value'. Fixes #3119 2024-03-18 12:14:36 +00:00
b1eb3e8746 BUG: fileHandler: disable parallel side effects. Fixes #3105 2024-03-18 11:54:40 +00:00
bc03a538cf ENH: mapDistribute: improved error message 2024-03-18 10:44:54 +00:00
980 changed files with 19677 additions and 9423 deletions

View File

@ -1,2 +1,2 @@
api=2401
patch=240220
api=2402
patch=240522

View File

@ -188,8 +188,6 @@ int main(int argc, char *argv[])
argList::addBoolOption("label", "Use label for tests (default)");
argList::addBoolOption("ref", "Test writing by ref");
#include "addTimeOptions.H"
#include "setRootCase.H"
#include "createTime.H"
#include "createPolyMesh.H"
@ -280,7 +278,6 @@ int main(int argc, char *argv[])
{
IOFieldRef<vector>(ioOutput, mesh.points()).write();
}
}

View File

@ -1,3 +1,3 @@
Test-OCountStream.C
Test-OCountStream.cxx
EXE = $(FOAM_USER_APPBIN)/Test-OCountStream

View File

@ -65,11 +65,11 @@ int main(int argc, char *argv[])
OCountStream cnt;
OCharStream cstr;
OStringStream str;
OStringStream sstr;
ocountstream plain;
generateOutput(cstr);
generateOutput(str);
generateOutput(sstr);
generateOutput(cnt);
generateOutput(plain);
@ -77,7 +77,7 @@ int main(int argc, char *argv[])
Info<< "counter state: " << (cnt.stdStream().rdstate()) << nl
<< "via char-stream: " << label(cstr.view().size()) << " chars" << nl
<< "via string-stream: " << str.str().size() << " chars" << nl
<< "via string-stream: " << label(sstr.count()) << " chars" << nl
<< "via ocountstream: " << plain.count() << " chars" << endl;
fileName outputName;

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2022 OpenCFD Ltd.
Copyright (C) 2022-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -32,10 +32,14 @@ Description
#include "IOstreams.H"
#include "OSspecific.H"
#include "argList.H"
#include "clock.H"
#include "Switch.H"
#include "ListOps.H"
using namespace Foam;
std::string time_stamp;
void listFiles(const fileName& dir)
{
wordList files = ListOps::create<word>
@ -55,25 +59,150 @@ void listFiles(const fileName& dir)
}
OSstream& printInfo(OFstream& os)
{
InfoErr
<< "open: " << os.name() << nl
<< "appending: " << Switch::name(os.is_appending())
<< " tellp: "<< os.stdStream().tellp()
<< " gz: " << Switch::name(os.compression()) << nl;
return InfoErr.stream();
}
void withHeader(OFstream& os)
{
const auto tellp = os.stdStream().tellp();
if (tellp <= 0)
{
InfoErr
<< "Add header" << nl;
os << "HEADER: " << time_stamp.c_str() << nl;
}
}
template<class OSstreamType>
void generateLines(OSstreamType& os, label count = 1)
{
for (label line = 1; line <= count; ++line)
{
os << "[" << line
<< "] =============================================" << nl;
}
}
template<class OSstreamType>
void generateContent
(
OSstreamType& os,
const bool with_seekend,
const bool test_overwrite = false,
const int64_t seek_out = -1
)
{
if (with_seekend)
{
os.stdStream().seekp(0, std::ios_base::end);
// OR? os.seek_end();
}
printInfo(os);
withHeader(os);
if (test_overwrite && seek_out >= 0)
{
InfoErr<< "... seekp(" << seek_out << ")" << nl;
auto& oss = os.stdStream();
// Actually std::streampos, but cannot increment that
int64_t pos(seek_out);
const int64_t tellp_end = oss.tellp();
if (pos >= 0 && pos < tellp_end)
{
InfoErr
<< "... fill from " << label(pos)
<< " to " << label(tellp_end) << nl;
oss.seekp(pos);
while (pos < tellp_end)
{
// Fill with char 'X', rely on streambuf buffering
oss << 'X';
++pos;
}
oss.seekp(seek_out);
os << "More content [at " << seek_out << ']' << endl;
}
}
generateLines(os, 4);
printInfo(os)
<< "... sleep" << endl;
listFiles(os.name().path());
sleep(2);
os << "[new content] +++++++++++++++++++++++++++++++++++" << endl;
}
template<class OSstreamType>
void generateOverwriteContent
(
OSstreamType& os,
const bool with_seekend,
const int64_t seek_out = -1
)
{
generateContent(os, with_seekend, true, seek_out);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[])
{
argList::addBoolOption("gz", "Use compression");
argList::addBoolOption("append", "Use append mode");
argList::addBoolOption("append-app", "Use append app mode");
argList::addBoolOption("append-ate", "Use append ate mode");
argList::addBoolOption("seekend", "Seek to end after non-append open");
argList::addOption("seek", "value", "Seek from start (default: 100)");
argList::addBoolOption("atomic", "Use atomic");
argList::addBoolOption("keep", "Do not remove test directory");
argList::addOption("write", "file", "test writing to file");
#include "setRootCase.H"
// Same time-stamp for all generated files
time_stamp = clock::dateTime();
const fileName baseDir("Test-OFstream-directory");
Foam::mkDir(baseDir);
InfoErr<< "mkdir: " << baseDir << endl;
Info<< "start:" << nl;
listFiles(baseDir);
const bool with_seekend = args.found("seekend");
const int seek_out = args.getOrDefault<int>("seek", 100);
IOstreamOption streamOpt;
if (args.found("gz"))
@ -83,10 +212,11 @@ int main(int argc, char *argv[])
IOstreamOption::appendType append =
(
args.found("append")
? IOstreamOption::APPEND
: IOstreamOption::NON_APPEND
args.found("append-app") ? IOstreamOption::APPEND_APP
: args.found("append-ate") ? IOstreamOption::APPEND_ATE
: IOstreamOption::NO_APPEND
);
IOstreamOption::atomicType atomic =
(
args.found("atomic")
@ -97,7 +227,6 @@ int main(int argc, char *argv[])
{
OFstream(baseDir/"dummy")() << "Some file content" << endl;
Foam::ln("dummy", baseDir/"Test2.txt");
Foam::ln("dummy", baseDir/"Test3.txt");
Foam::ln("dummy", baseDir/"Test4.txt");
Foam::ln("dummy", baseDir/"Test4.txt.gz");
@ -114,16 +243,31 @@ int main(int argc, char *argv[])
append
);
os << "=========================" << endl;
generateOverwriteContent(os, with_seekend, seek_out);
}
InfoErr<< "open: " << os.name() << endl;
InfoErr<< "... sleep" << endl;
{
OFstream os
(
atomic,
baseDir/"Test1-app.txt",
streamOpt,
IOstreamOption::APPEND_APP
);
listFiles(baseDir);
generateOverwriteContent(os, with_seekend, seek_out);
}
sleep(2);
{
OFstream os
(
atomic,
baseDir/"Test1-ate.txt",
streamOpt,
IOstreamOption::APPEND_ATE
);
os << "+++++++++++++++++++++++++++++++++++" << endl;
generateOverwriteContent(os, with_seekend, seek_out);
}
{
@ -132,39 +276,21 @@ int main(int argc, char *argv[])
atomic,
baseDir/"Test2.txt",
streamOpt
// NON_APPEND
);
os << "=========================" << endl;
InfoErr<< "open: " << os.name() << endl;
InfoErr<< "... sleep" << endl;
listFiles(baseDir);
sleep(2);
os << "+++++++++++++++++++++++++++++++++++" << endl;
generateContent(os, with_seekend);
}
{
OFstream os
(
atomic,
baseDir/"Test3.txt",
streamOpt,
IOstreamOption::APPEND
IOstreamOption::APPEND_APP
);
os << "=========================" << endl;
InfoErr<< "open: " << os.name() << endl;
InfoErr<< "... sleep" << endl;
listFiles(baseDir);
sleep(2);
os << "+++++++++++++++++++++++++++++++++++" << endl;
generateContent(os, with_seekend, with_seekend);
}
{
OFstream os
@ -174,35 +300,17 @@ int main(int argc, char *argv[])
IOstreamOption::COMPRESSED
);
os << "=========================" << endl;
InfoErr<< "open: " << os.name() << endl;
InfoErr<< "... sleep" << endl;
listFiles(baseDir);
sleep(2);
os << "+++++++++++++++++++++++++++++++++++" << endl;
// No seekend with COMPRESSED
generateContent(os, false);
}
{
OFstream os
(
IOstreamOption::ATOMIC,
baseDir/"Test5.txt"
// ASCII UNCOMPRESSED NON_APPEND
);
os << "=========================" << endl;
InfoErr<< "open: " << os.name() << endl;
InfoErr<< "... sleep" << endl;
listFiles(baseDir);
sleep(2);
os << "+++++++++++++++++++++++++++++++++++" << endl;
generateContent(os, with_seekend);
}
Info<< nl << "done:" << endl;

View File

@ -201,7 +201,6 @@ using namespace Foam;
int main(int argc, char *argv[])
{
#include "addTimeOptions.H"
argList::addArgument("patch");
#include "setRootCase.H"
#include "createTime.H"

View File

@ -53,46 +53,37 @@ int main(int argc, char *argv[])
#include "setRootCase.H"
#include "createTime.H"
fileName coherentInst;
word coherentInst;
coherentInst =
(
runTime.findInstance
(
polyMesh::meshSubDir,
"coherent",
IOobject::READ_IF_PRESENT
IOobject::READ_IF_PRESENT,
word::null, // No stop instance
false // No "constant" fallback (word::null instead)
)
);
// Unfortunately with READ_IF_PRESENT, cannot tell if the file
// was actually found or not
Info<< "check: " << (coherentInst/polyMesh::meshSubDir/"coherent") << nl;
if (!Foam::isFile(coherentInst/polyMesh::meshSubDir/"coherent"))
{
coherentInst.clear();
}
Info<< "found coherent: " << coherentInst << nl;
Info<< "Found coherent \"" << coherentInst << '"' << nl;
PtrList<entry> entries;
if (!coherentInst.empty())
{
IOdictionary coherent
(
IOobject
dictionary coherent =
IOdictionary::readContents
(
"coherent",
coherentInst,
polyMesh::meshSubDir,
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
)
);
IOobject
(
"coherent",
coherentInst,
polyMesh::meshSubDir,
runTime,
IOobject::MUST_READ
)
);
ITstream& is = coherent.lookup("boundary");
is >> entries;
@ -105,7 +96,7 @@ int main(int argc, char *argv[])
Info<< "size: " << polyBoundaryMeshEntries::patchSizes(entries) << nl;
Info<< nl;
fileName boundaryInst;
word boundaryInst;
boundaryInst =
(
runTime.findInstance
@ -116,7 +107,7 @@ int main(int argc, char *argv[])
)
);
Info<< "found boundary: " << boundaryInst << nl;
Info<< "Found boundary: \"" << boundaryInst << '"' << nl;
polyBoundaryMeshEntries pbm
(

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2023 OpenCFD Ltd.
Copyright (C) 2017-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -24,7 +24,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
checkDecomposePar
Test-checkDecomposePar
Group
grpParallelUtilities
@ -35,8 +35,9 @@ Description
\*---------------------------------------------------------------------------*/
#include "OSspecific.H"
#include "fvCFD.H"
#include "argList.H"
#include "timeSelector.H"
#include "polyMesh.H"
#include "cpuTime.H"
#include "IFstream.H"
#include "regionProperties.H"
@ -44,10 +45,14 @@ Description
#include "decompositionInformation.H"
#include "decompositionModel.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
timeSelector::addOptions_singleTime(); // Single-time options
argList::addNote
(
"Check decomposition from kaffpa (KaHIP) output"
@ -65,9 +70,6 @@ int main(int argc, char *argv[])
argList::addArgument("kaffpa-output-file");
// Include explicit constant options, have zero from time range
timeSelector::addOptions(true, false);
#include "setRootCase.H"
const auto decompFile = args.get<fileName>(1);
@ -75,8 +77,8 @@ int main(int argc, char *argv[])
// Set time from database
#include "createTime.H"
// Allow override of time
instantList times = timeSelector::selectIfPresent(runTime, args);
// Allow override of time from specified time options, or no-op
timeSelector::setTimeIfPresent(runTime, args);
// Allow override of decomposeParDict location
const fileName decompDictFile =
@ -95,7 +97,7 @@ int main(int argc, char *argv[])
Info<< "\n\nDecomposing mesh " << regionName << nl << endl;
Info<< "Create mesh..." << flush;
fvMesh mesh
polyMesh mesh
(
IOobject
(
@ -111,7 +113,7 @@ int main(int argc, char *argv[])
Info<< " nCells = " << mesh.nCells() << endl;
// Expected format is a simple ASCII list
cellToProc.setSize(mesh.nCells());
cellToProc.resize(mesh.nCells());
{
IFstream is(decompFile);

View File

@ -123,7 +123,7 @@ int main(int argc, char *argv[])
);
Info<< testInput << nl;
SubStrings<string> args = stringOps::splitSpace(testInput);
auto args = stringOps::splitSpace(testInput);
Info<< "split into " << args.size() << " args" << nl;
CStringList inC(args);

View File

@ -1,3 +0,0 @@
Test-dimField.C
EXE = $(FOAM_USER_APPBIN)/Test-dimField

View File

@ -0,0 +1,3 @@
Test-dimField1.cxx
EXE = $(FOAM_USER_APPBIN)/Test-dimField1

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2020-2022 OpenCFD Ltd.
Copyright (C) 2020-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -24,7 +24,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
Test-dimField
Test-dimField1
Description
Simple tests for DimensionedField
@ -52,7 +52,12 @@ namespace Foam
int main(int argc, char *argv[])
{
argList::addBoolOption("write", "write some test fields");
#include "setRootCase.H"
const bool doWrite = args.found("write");
#include "createTime.H"
#include "createMesh.H"
@ -60,19 +65,23 @@ int main(int argc, char *argv[])
Info<< "Tensor field\n" << endl;
DimensionedField<tensor, volMesh> tensorfld
(
IOobject
mesh.newIOobject
(
"tensor",
runTime.timeName(),
mesh,
{ IOobject::READ_IF_PRESENT, IOobject::NO_REGISTER }
{ IOobject::READ_IF_PRESENT, IOobject::NO_WRITE }
),
mesh,
dimensioned<tensor>(dimless, tensor(1,2,3,4,5,6,7,8,9))
);
Info().beginBlock("transformed")
<< tensorfld.T() << nl;
if (doWrite)
{
tensorfld.write();
}
Info<< nl;
Info().beginBlock("transformed") << tensorfld.T();
Info().endBlock();
{
@ -84,8 +93,8 @@ int main(int argc, char *argv[])
dimensioned<scalar>(14)
);
Info().beginBlock(tfld().type())
<< tfld << nl;
Info<< nl;
Info().beginBlock(tfld().type()) << tfld;
Info().endBlock();
}
@ -98,8 +107,8 @@ int main(int argc, char *argv[])
dimensioned<scalar>(5)
);
Info().beginBlock(tfld().type())
<< tfld() << nl;
Info<< nl;
Info().beginBlock(tfld().type()) << tfld();
Info().endBlock();
// From dissimilar types
@ -111,8 +120,8 @@ int main(int argc, char *argv[])
dimensioned<vector>(Zero)
);
Info().beginBlock(tfld2().type())
<< tfld2() << nl;
Info<< nl;
Info().beginBlock(tfld2().type()) << tfld2();
Info().endBlock();
}
}
@ -122,20 +131,13 @@ int main(int argc, char *argv[])
Info<< "uint8 field\n" << endl;
DimensionedField<uint8_t, volMesh> statefld
(
IOobject
(
"state",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh.newIOobject("state")
mesh,
dimensioned<uint8_t>(dimless, uint8_t{100})
);
Info().beginBlock("stateField")
<< statefld << nl;
Info<< nl;
Info().beginBlock("stateField") << statefld;
Info().endBlock();
}
#endif

View File

@ -1,3 +0,0 @@
Test-ensightFile.C
EXE = $(FOAM_USER_APPBIN)/Test-ensightFile

View File

@ -1,8 +0,0 @@
EXE_INC = \
-I$(LIB_SRC)/fileFormats/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/conversion/lnInclude
EXE_LIBS = \
-lmeshTools \
-lconversion

View File

@ -0,0 +1,3 @@
Test-ensightFile1.cxx
EXE = $(FOAM_USER_APPBIN)/Test-ensightFile1

View File

@ -0,0 +1,5 @@
EXE_INC = \
-I$(LIB_SRC)/fileFormats/lnInclude
EXE_LIBS = \
-lfileFormats

View File

@ -0,0 +1,137 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
Test-ensightFile
Description
check cleanup of ensight file and variable names
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "ensightFile.H"
#include "ensightGeoFile.H"
#include "Switch.H"
#include "IOstreams.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[])
{
argList::noBanner();
argList::noParallel();
argList::addBoolOption("ascii", "open as ascii instead of binary");
argList::addBoolOption("binary", "(default)");
argList::addBoolOption("clear", "force clear of time-steps");
argList::addBoolOption("no-end", "skip use of endTimeStep");
argList::addBoolOption("append", "open in append mode");
argList::addOption("geom", "geometry file");
argList::addOption("field", "field file");
#include "setRootCase.H"
const bool with_ascii = args.found("ascii") && !args.found("binary");
// const bool with_binary = args.found("binary");
const bool with_append = args.found("append");
const bool with_clear = args.found("clear");
const bool without_end = args.found("no-end");
const IOstreamOption::streamFormat fmt =
(
with_ascii
? IOstreamOption::ASCII
: IOstreamOption::BINARY
);
const IOstreamOption::appendType append =
(
with_append
? IOstreamOption::APPEND_ATE
: IOstreamOption::NO_APPEND
);
fileName file;
if (args.readIfPresent("geom", file))
{
Info<< "Open " << file << " as geometry "
<< " format:" << (with_ascii ? "ASCII" : "BINARY")
<< " append:" << Switch::name(with_append) << nl;
ensightGeoFile ensFile(append, file, fmt);
if (append)
{
ensFile.beginTimeStep();
// At the moment need to pair begin/end time-step calls
if (!without_end)
{
ensFile.endTimeStep();
}
}
if (with_clear)
{
ensFile.clearTimeSteps();
}
}
if (args.readIfPresent("field", file))
{
Info<< "Open " << file << " as field"
<< " format:" << (with_ascii ? "ASCII" : "BINARY")
<< " append:" << Switch::name(with_append) << nl;
ensightFile ensFile(append, file, fmt);
if (append)
{
ensFile.beginTimeStep();
// At the moment need to pair begin/end time-step calls
if (!without_end)
{
ensFile.endTimeStep();
}
}
if (with_clear)
{
ensFile.clearTimeSteps();
}
}
Info<< "\nEnd\n" << endl;
return 0;
}
// ************************************************************************* //

View File

@ -0,0 +1,3 @@
Test-ensightFileName.cxx
EXE = $(FOAM_USER_APPBIN)/Test-ensightFileName

View File

@ -0,0 +1,5 @@
EXE_INC = \
-I$(LIB_SRC)/fileFormats/lnInclude
EXE_LIBS = \
-lfileFormats

View File

@ -24,10 +24,10 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
Test-ensightFile
Test-ensightFileName
Description
check cleanup of ensight file and variable names
Check cleanup of ensight file and variable names
\*---------------------------------------------------------------------------*/

View File

@ -32,6 +32,7 @@ Description
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "timeSelector.H"
#include "fvMesh.H"
#include "volFields.H"
#include "Time.H"
@ -126,14 +127,14 @@ void writeStencilStats(const labelListList& stencil)
int main(int argc, char *argv[])
{
#include "addTimeOptions.H"
timeSelector::addOptions_singleTime(); // Single-time options
#include "setRootCase.H"
#include "createTime.H"
// Get times list
instantList Times = runTime.times();
#include "checkTimeOptions.H"
runTime.setTime(Times[startTime], startTime);
// Set time from specified time options, or force start from Time=0
timeSelector::setTimeIfPresent(runTime, args, true);
#include "createMesh.H"
// Force calculation of extended edge addressing

View File

@ -32,6 +32,7 @@ Description
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "timeSelector.H"
#include "fvMesh.H"
#include "volFields.H"
#include "surfaceFields.H"
@ -107,14 +108,16 @@ void writeStencilStats(const labelListList& stencil)
int main(int argc, char *argv[])
{
#include "addTimeOptions.H"
argList::noFunctionObjects(); // Never use function objects
timeSelector::addOptions_singleTime(); // Single-time options
#include "setRootCase.H"
#include "createTime.H"
// Get times list
instantList Times = runTime.times();
#include "checkTimeOptions.H"
runTime.setTime(Times[startTime], startTime);
// Set time from specified time options, or force start from Time=0
timeSelector::setTimeIfPresent(runTime, args, true);
#include "createMesh.H"

View File

@ -0,0 +1,3 @@
Test-faMesh-try.cxx
EXE = $(FOAM_USER_APPBIN)/Test-faMesh-try

View File

@ -0,0 +1,7 @@
EXE_INC = \
-I$(LIB_SRC)/finiteArea/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lfiniteArea \
-lmeshTools

View File

@ -0,0 +1,63 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
Test-faMesh-try
Description
Test for loading of faMesh
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "faMesh.H"
#include "polyMesh.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
#include "addRegionOption.H"
#include "addFaRegionOption.H"
#include "setRootCase.H"
#include "createTime.H"
#include "createNamedPolyMesh.H"
#include "getFaRegionOption.H"
autoPtr<faMesh> aMeshPtr = faMesh::TryNew(areaRegionName, mesh);
Info<< "area-mesh: " << Switch::name(aMeshPtr) << nl;
Info<< "\nEnd\n" << nl;
return 0;
}
// ************************************************************************* //

View File

@ -0,0 +1,3 @@
Test-faMeshesRegistry.cxx
EXE = $(FOAM_USER_APPBIN)/Test-faMeshesRegistry

View File

@ -0,0 +1,7 @@
EXE_INC = \
-I$(LIB_SRC)/finiteArea/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lfiniteArea \
-lmeshTools

View File

@ -0,0 +1,68 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
Test-faMeshesRegistry
Description
Basic tests for faMeshesRegistry
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "faMesh.H"
#include "faMeshesRegistry.H"
#include "polyMesh.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
#include "setRootCase.H"
#include "createTime.H"
#include "createPolyMesh.H"
Info<< "mesh 0: " << mesh.sortedNames() << nl;
faMeshesRegistry& reg =
const_cast<faMeshesRegistry&>(faMeshesRegistry::New(mesh));
// faMeshesRegistry faReg = faMeshesRegistry(mesh);
faMesh mesh1(mesh, Foam::zero{});
faMesh mesh2("mesh2", mesh, Foam::zero{});
reg.write();
Info<< "\nEnd\n" << nl;
return 0;
}
// ************************************************************************* //

View File

@ -5,4 +5,5 @@ EXE_INC = \
EXE_LIBS = \
-lfiniteVolume \
-lmeshTools \
-ldynamicMesh

View File

@ -32,6 +32,7 @@ Description
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "timeSelector.H"
#include "fvMesh.H"
#include "volFields.H"
#include "Time.H"
@ -51,22 +52,33 @@ using namespace Foam;
int main(int argc, char *argv[])
{
#include "addTimeOptions.H"
argList::addArgument("inflate (true|false)");
timeSelector::addOptions_singleTime(); // Single-time options
argList::addBoolOption
(
"inflate",
"Use inflation/deflation for deleting cells"
);
#include "setRootCase.H"
#include "createTime.H"
// Allow override of time from specified time options, or no-op
timeSelector::setTimeIfPresent(runTime, args);
#include "createMesh.H"
const Switch inflate(args[1]);
const bool inflate = args.found("inflate");
if (inflate)
{
Info<< "Deleting cells using inflation/deflation" << nl << endl;
Info<< "Deleting cells using inflation/deflation"
<< nl << endl;
}
else
{
Info<< "Deleting cells, introducing points at new position" << nl
<< endl;
Info<< "Deleting cells, introducing points at new position"
<< nl << endl;
}

View File

@ -47,7 +47,7 @@ using namespace Foam;
template<class PrimitiveType>
static List<PrimitiveType> splitStringToList(const std::string& str)
{
const SubStrings<std::string> items = stringOps::splitAny(str, " ,;");
const auto items = stringOps::splitAny(str, " ,;");
DynamicList<PrimitiveType> values(items.size());

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2023 OpenCFD Ltd.
Copyright (C) 2023-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -50,6 +50,9 @@ void printInfo(const meshObjects::gravity& g)
int main(int argc, char *argv[])
{
argList::addBoolOption("checkout", "Test checkout with release");
argList::addBoolOption("release", "Test release instead of delete");
#include "setRootCase.H"
#include "createTime.H"
@ -70,14 +73,81 @@ int main(int argc, char *argv[])
printInfo(g);
}
Pout<< "registered:" << flatOutput(runTime.sortedToc()) << nl << endl;
Pout<< "registered:"
<< flatOutput(runTime.sortedToc()) << nl << endl;
}
meshObjects::gravity::Delete("g", runTime);
meshObjects::gravity::Delete("something-not-in-registry", runTime);
std::unique_ptr<meshObjects::gravity> release1;
std::unique_ptr<meshObjects::gravity> release2;
Info<< "after Delete" << nl;
Pout<< "registered:" << flatOutput(runTime.sortedToc()) << endl;
if (args.found("release"))
{
// Ugly!
typedef
MeshObject<Time, TopologicalMeshObject, meshObjects::gravity>
parent_type;
release1 = meshObjects::gravity::Release("g", runTime);
release2 = meshObjects::gravity::Release("#none#", runTime);
Info<< "release: " << Switch::name(bool(release1))
<< ", " << Switch::name(bool(release2)) << nl;
Info<< "after Release: "
<< flatOutput(runTime.sortedToc()) << endl;
// Do checkout by hand (ugly)
if (args.found("checkout"))
{
if (release1)
{
release1->parent_type::checkOut();
}
if (release2)
{
release2->parent_type::checkOut();
}
Info<< "after checkout: "
<< flatOutput(runTime.sortedToc()) << endl;
}
}
else if (args.found("checkout"))
{
// Do checkout as part of release
release1 = meshObjects::gravity::Release("g", runTime, true);
release2 = meshObjects::gravity::Release("#none#", runTime, true);
Info<< "release: " << Switch::name(bool(release1))
<< ", " << Switch::name(bool(release2)) << nl;
Info<< "after Release/Checkout(true) : "
<< flatOutput(runTime.sortedToc()) << endl;
}
else
{
meshObjects::gravity::Delete("g", runTime);
meshObjects::gravity::Delete("#none#", runTime);
Info<< "after Delete: "
<< flatOutput(runTime.sortedToc()) << endl;
}
if (meshObjects::gravity::Store(std::move(release1)))
{
Info<< "Store pointer" << endl;
}
if (release2)
{
release2.reset();
Info<< "Clear pointer" << endl;
}
Info<< "Before exit: "
<< flatOutput(runTime.sortedToc()) << endl;
Info<< "\nEnd\n" << endl;

View File

@ -5,4 +5,5 @@ EXE_INC = \
EXE_LIBS = \
-lfiniteVolume \
-lmeshTools \
-ldynamicMesh

View File

@ -33,6 +33,7 @@ Description
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "timeSelector.H"
#include "Time.H"
#include "volFields.H"
#include "surfaceFields.H"
@ -52,21 +53,28 @@ using namespace Foam;
// Main program:
int main(int argc, char *argv[])
{
#include "addTimeOptions.H"
argList::addArgument("inflate (true|false)");
timeSelector::addOptions_singleTime(); // Single-time options
argList::addBoolOption
(
"inflate",
"Use inflation/deflation for splitting/deleting cells"
);
#include "setRootCase.H"
#include "createTime.H"
// Allow override of time from specified time options, or no-op
timeSelector::setTimeIfPresent(runTime, args);
#include "createMesh.H"
const pointConstraints& pc = pointConstraints::New(pointMesh::New(mesh));
const Switch inflate(args[1]);
const bool inflate = args.found("inflate");
if (inflate)
{
Info<< "Splitting/deleting cells using inflation/deflation" << nl
<< endl;
Info<< "Splitting/deleting cells using inflation/deflation"
<< nl << endl;
}
else
{
@ -75,6 +83,8 @@ int main(int argc, char *argv[])
}
const pointConstraints& pc = pointConstraints::New(pointMesh::New(mesh));
Random rndGen(0);

View File

@ -51,7 +51,6 @@ using namespace Foam;
int main(int argc, char *argv[])
{
#include "addTimeOptions.H"
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"

View File

@ -66,13 +66,13 @@ int main(int argc, char *argv[])
for (const entry& dEntry : dict)
{
if (!dEntry.isStream())
if (dEntry.isStream())
{
continue;
List<namedDictionary> list(dEntry.stream());
Info<< "input: " << dEntry << nl
<< "list: " << list << nl;
}
Info<< "input: " << dEntry << nl;
List<namedDictionary> list(dEntry.stream());
Info<< "list: " << list << nl;
}
}
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2022 OpenCFD Ltd.
Copyright (C) 2022-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -44,175 +44,62 @@ Description
using namespace Foam;
// Looks like Pstream::exchangeBuf
template<class T>
void do_exchangeBuf
//- Number of elements corresponding to max byte transfer.
// Normal upper limit is INT_MAX since MPI sizes are limited to <int>.
template<class Type>
inline std::size_t maxTransferCount
(
const label sendSize,
const char* sendData,
const label recvSize,
char* recvData,
const int tag,
const label comm,
const bool wait
)
const std::size_t max_bytes = std::size_t(0)
) noexcept
{
const label startOfRequests = UPstream::nRequests();
// Set up receives
// ~~~~~~~~~~~~~~~
// forAll(recvSizes, proci)
{
// if (proci != Pstream::myProcNo(comm) && recvSizes[proci] > 0)
if (!Pstream::master(comm) && recvSize > 0)
{
UIPstream::read
(
UPstream::commsTypes::nonBlocking,
UPstream::myProcNo(comm), // proci,
recvData,
recvSize*sizeof(T),
tag,
comm
);
}
}
// Set up sends
// ~~~~~~~~~~~~
// forAll(sendBufs, proci)
for (const int proci : Pstream::subProcs(comm))
{
if (sendSize > 0)
// if (proci != Pstream::myProcNo(comm) && sendSizes[proci] > 0)
{
if
(
!UOPstream::write
(
UPstream::commsTypes::nonBlocking,
proci,
sendData,
sendSize*sizeof(T),
tag,
comm
)
)
{
FatalErrorInFunction
<< "Cannot send outgoing message. "
<< "to:" << proci << " nBytes:"
<< label(sendSize*sizeof(T))
<< Foam::abort(FatalError);
}
}
}
// Wait for all to finish
// ~~~~~~~~~~~~~~~~~~~~~~
if (wait)
{
UPstream::waitRequests(startOfRequests);
}
return
(
(max_bytes == 0) // ie, unlimited
? (std::size_t(0)) //
: (max_bytes > std::size_t(INT_MAX)) // MPI limit is <int>
? (std::size_t(INT_MAX) / sizeof(Type)) //
: (max_bytes > sizeof(Type)) // require an integral number
? (max_bytes / sizeof(Type)) //
: (std::size_t(1)) // min of one element
);
}
// Looks like Pstream::exchangeContainer
template<class Container, class T>
void do_exchangeContainer
//- Upper limit on number of transfer bytes.
// Max bytes is normally INT_MAX since MPI sizes are limited to <int>.
// Negative values indicate a subtraction from INT_MAX.
inline std::size_t PstreamDetail_maxTransferBytes
(
const Container& sendData,
const label recvSize,
Container& recvData,
const int tag,
const label comm,
const bool wait
)
const int64_t max_bytes
) noexcept
{
const label startOfRequests = UPstream::nRequests();
// Set up receives
// ~~~~~~~~~~~~~~~
// for (const int proci : Pstream::allProcs(comm))
{
if (!Pstream::master(comm) && recvSize > 0)
// if (proci != Pstream::myProcNo(comm) && recvSize > 0)
{
UIPstream::read
(
UPstream::commsTypes::nonBlocking,
UPstream::myProcNo(comm), // proci,
recvData.data_bytes(),
recvSize*sizeof(T),
tag,
comm
);
}
}
// Set up sends
// ~~~~~~~~~~~~
if (Pstream::master(comm) && sendData.size() > 0)
{
for (const int proci : Pstream::subProcs(comm))
{
if
(
!UOPstream::write
(
UPstream::commsTypes::nonBlocking,
proci,
sendData.cdata_bytes(),
sendData.size_bytes(),
tag,
comm
)
)
{
FatalErrorInFunction
<< "Cannot send outgoing message. "
<< "to:" << proci << " nBytes:"
<< label(sendData.size_bytes())
<< Foam::abort(FatalError);
}
}
}
// Wait for all to finish
// ~~~~~~~~~~~~~~~~~~~~~~
if (wait)
{
UPstream::waitRequests(startOfRequests);
}
return
(
(max_bytes < 0) // (numBytes fewer than INT_MAX)
? std::size_t(INT_MAX + max_bytes)
: std::size_t(max_bytes)
);
}
template<class Container, class T>
template<class Container, class Type>
void broadcast_chunks
(
Container& sendData,
const int tag = UPstream::msgType(),
const label comm = UPstream::worldComm,
const bool wait = true
const label comm = UPstream::worldComm
const int64_t maxComms_bytes = UPstream::maxCommsSize
)
{
// OR static_assert(is_contiguous<T>::value, "Contiguous data only!")
if (!is_contiguous<T>::value)
if (!is_contiguous<Type>::value)
{
FatalErrorInFunction
<< "Contiguous data only." << sizeof(T) << Foam::abort(FatalError);
<< "Contiguous data only." << sizeof(Type)
<< Foam::abort(FatalError);
}
if (UPstream::maxCommsSize <= 0)
if (maxComms_bytes == 0)
{
// Do in one go
Info<< "send " << sendData.size() << " elements in one go" << endl;
@ -227,93 +114,90 @@ void broadcast_chunks
sendData.resize_nocopy(recvSize); // A no-op on master
// Determine the number of chunks to send. Note that we
// only have to look at the sending data since we are
// guaranteed that some processor's sending size is some other
// processor's receive size. Also we can ignore any local comms.
// We need to send chunks so the number of iterations:
// maxChunkSize iterations
// ------------ ----------
// 0 0
// 1..maxChunkSize 1
// maxChunkSize+1..2*maxChunkSize 2
// ...
const label maxChunkSize
// The chunk size (number of elements) corresponding to max byte transfer
// Is zero for non-chunked exchanges.
const std::size_t chunkSize
(
max
PstreamDetail_maxTransferCount<Type>
(
static_cast<label>(1),
static_cast<label>(UPstream::maxCommsSize/sizeof(T))
PstreamDetail_maxTransferBytes(maxComms_bytes)
)
);
label nChunks(0);
{
// Get max send count (elements)
// forAll(sendBufs, proci)
// {
// if (proci != Pstream::myProcNo(comm))
// {
// nChunks = max(nChunks, sendBufs[proci].size());
// }
// }
nChunks = sendSize;
if (chunkSize)
{
// Convert from send count (elements) to number of chunks.
// Can normally calculate with (count-1), but add some safety
if (nChunks)
{
nChunks = 1 + (nChunks/maxChunkSize);
}
reduce(nChunks, maxOp<label>(), tag, comm);
label nChunks = 1 + (sendSize/label(chunkSize));
Info
<< "send " << sendSize << " elements ("
<< (sendSize*sizeof(T)) << " bytes) in " << nChunks
<< " chunks of " << maxChunkSize << " elements ("
<< (maxChunkSize*sizeof(T)) << " bytes) for maxCommsSize:"
<< Pstream::maxCommsSize
<< (sendSize*sizeof(Type)) << " bytes) in " << nChunks
<< " chunks of " << label(chunkSize) << " elements ("
<< label(chunkSize*sizeof(Type)) << " bytes) for maxCommsSize:"
<< label(maxComms_bytes)
<< endl;
}
// stress-test with shortened sendSize
// will produce useless loops, but no calls
// sendSize /= 2;
label nSend(0);
label startSend(0);
char* charPtrSend;
typedef stdFoam::span<Type> sendType;
for (label iter = 0; iter < nChunks; ++iter)
do
{
nSend = min
(
maxChunkSize,
sendSize-startSend
);
sendType payload(sendData.data(), sendData.size());
charPtrSend =
(
nSend > 0
? reinterpret_cast<char*>(&(sendData[startSend]))
: nullptr
);
Info<< "iter " << iter
<< ": beg=" << startSend << " len=" << nSend
<< " (" << (nSend*sizeof(T)) << " bytes)" << endl;
UPstream::broadcast(charPtrSend, nSend*sizeof(T), comm);
// forAll(nSend, proci)
if (!chunkSize)
{
startSend += nSend;
UPstream::broadcast
(
payload.data_bytes(),
payload.size_bytes(),
comm
);
break;
}
// Dispatch chunk-wise until there is nothing left
for (int iter = 0; /*true*/; ++iter)
{
// The begin/end for the data window
const std::size_t beg = (std::size_t(iter)*chunkSize);
const std::size_t end = (std::size_t(iter+1)*chunkSize);
if (payload.size() <= beg)
{
// No more data windows
break;
}
sendType window
(
(end < payload.size())
? payload.subspan(beg, end - beg)
: payload.subspan(beg)
);
Info<< "iter " << iter
<< ": beg=" << label(beg) << " len=" << label(window.size())
<< " (" << label(window.size_bytes()) << " bytes)" << endl;
UPstream::broadcast
(
window.data_bytes(),
window.size_bytes(),
comm
);
}
}
while (false);
Info<< "final: " << startSend << endl;
Info<< "final" << endl;
}
@ -333,7 +217,7 @@ int main(int argc, char *argv[])
}
labelList input1;
if (Pstream::master())
if (UPstream::master())
{
input1 = identity(500);
}
@ -348,7 +232,7 @@ int main(int argc, char *argv[])
// Mostly the same with PstreamBuffers
if (false)
{
PstreamBuffers pBufs(UPstream::commsTypes::nonBlocking);
PstreamBuffers pBufs;
labelList sendData;
if (Pstream::master())

View File

@ -62,7 +62,7 @@ scalar sumReduce
scalar procValue;
UIPstream::read
(
UPstream::commsTypes::blocking,
UPstream::commsTypes::buffered,
proci,
reinterpret_cast<char*>(&procValue),
sizeof(scalar),
@ -79,7 +79,7 @@ scalar sumReduce
{
UOPstream::write
(
UPstream::commsTypes::blocking,
UPstream::commsTypes::buffered,
proci,
reinterpret_cast<const char*>(&sum),
sizeof(scalar),
@ -93,7 +93,7 @@ scalar sumReduce
{
UOPstream::write
(
UPstream::commsTypes::blocking,
UPstream::commsTypes::buffered,
UPstream::masterNo(),
reinterpret_cast<const char*>(&localValue),
sizeof(scalar),
@ -105,7 +105,7 @@ scalar sumReduce
{
UIPstream::read
(
UPstream::commsTypes::blocking,
UPstream::commsTypes::buffered,
UPstream::masterNo(),
reinterpret_cast<char*>(&sum),
sizeof(scalar),

View File

@ -41,14 +41,7 @@ Description
#include "PstreamReduceOps.H"
#include "SHA1.H"
// Include MPI without any C++ bindings
#ifndef MPICH_SKIP_MPICXX
#define MPICH_SKIP_MPICXX
#endif
#ifndef OMPI_SKIP_MPICXX
#define OMPI_SKIP_MPICXX
#endif
#include <mpi.h>
#include "openfoam_mpi.H"
using namespace Foam;

View File

@ -41,14 +41,7 @@ Description
#include "StringStream.H"
#include "Random.H"
// Include MPI without any C++ bindings
#ifndef MPICH_SKIP_MPICXX
#define MPICH_SKIP_MPICXX
#endif
#ifndef OMPI_SKIP_MPICXX
#define OMPI_SKIP_MPICXX
#endif
#include <mpi.h>
#include "openfoam_mpi.H"
using namespace Foam;

View File

@ -130,7 +130,7 @@ int main(int argc, char *argv[])
for (bool barrier_active = false, done = false; !done; /*nil*/)
{
std::pair<int, int> probed =
std::pair<int, int64_t> probed =
UPstream::probeMessage
(
UPstream::commsTypes::nonBlocking,
@ -143,8 +143,8 @@ int main(int argc, char *argv[])
{
// Message found and had size: receive it
const label proci = probed.first;
const label count = probed.second;
const label proci(probed.first);
const label count(probed.second);
recvBufs(proci).resize_nocopy(count);
recvFromProc(recvRequests.size()) = proci;

View File

@ -40,14 +40,7 @@ Description
#include "Pstream.H"
#include <iostream>
// Include MPI without any C++ bindings
#ifndef MPICH_SKIP_MPICXX
#define MPICH_SKIP_MPICXX
#endif
#ifndef OMPI_SKIP_MPICXX
#define OMPI_SKIP_MPICXX
#endif
#include <mpi.h>
#include "openfoam_mpi.H"
using namespace Foam;

View File

@ -119,7 +119,7 @@ int main(int argc, char *argv[])
for (bool barrier_active = false, done = false; !done; /*nil*/)
{
std::pair<int, int> probed =
std::pair<int, int64_t> probed =
UPstream::probeMessage
(
UPstream::commsTypes::nonBlocking,
@ -132,8 +132,8 @@ int main(int argc, char *argv[])
{
// Message found and had size: receive it
const label proci = probed.first;
const label count = probed.second;
const label proci(probed.first);
const label count(probed.second);
if (optNonBlocking)
{

View File

@ -66,7 +66,7 @@ int main(int argc, char *argv[])
Pstream::myProcNo()
);
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
PstreamBuffers pBufs;
if (!Pstream::master())
{
@ -150,7 +150,7 @@ int main(int argc, char *argv[])
// Do a non-blocking send inbetween
{
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
PstreamBuffers pBufs;
for (const int proci : Pstream::allProcs())
{

View File

@ -131,7 +131,7 @@ void testTransfer(const T& input)
for (const int proci : UPstream::subProcs())
{
Perr<< "master sending to proc:" << proci << endl;
OPstream os(UPstream::commsTypes::blocking, proci);
OPstream os(UPstream::commsTypes::buffered, proci);
os << data;
}
}
@ -139,7 +139,7 @@ void testTransfer(const T& input)
{
{
Perr<< "proc sending to master" << endl;
OPstream os(UPstream::commsTypes::blocking, UPstream::masterNo());
OPstream os(UPstream::commsTypes::buffered, UPstream::masterNo());
os << data;
}
@ -169,7 +169,7 @@ void testTokenized(const T& data)
for (const int proci : UPstream::subProcs())
{
Perr<< "master sending to proc:" << proci << endl;
OPstream os(UPstream::commsTypes::blocking, proci);
OPstream os(UPstream::commsTypes::buffered, proci);
os << tok;
}
}
@ -177,7 +177,7 @@ void testTokenized(const T& data)
{
{
Perr<< "proc sending to master" << endl;
OPstream os(UPstream::commsTypes::blocking, UPstream::masterNo());
OPstream os(UPstream::commsTypes::buffered, UPstream::masterNo());
os << tok;
}

View File

@ -7,5 +7,6 @@ EXE_INC = \
EXE_LIBS = \
-lfiniteVolume \
-ldynamicFvMesh \
-lsampling \
-loverset

View File

@ -56,6 +56,7 @@ Description
#include "fvCFD.H"
#include "simpleControl.H"
#include "predicates.H"
#include "dynamicFvMesh.H"
#include "dynamicOversetFvMesh.H"
@ -97,6 +98,7 @@ int main(int argc, char *argv[])
component(T.ref(), mesh.C(), 1);
// Interpolate + halo swap
T.correctBoundaryConditions();
// T.boundaryFieldRef().evaluate_if(predicates::always{});
// Check halo swap
dynamicOversetFvMesh::checkCoupledBC(T);
}

View File

@ -34,14 +34,7 @@ Description
#include "globalMeshData.H"
#include "OFstream.H"
// Include MPI without any C++ bindings
#ifndef MPICH_SKIP_MPICXX
#define MPICH_SKIP_MPICXX
#endif
#ifndef OMPI_SKIP_MPICXX
#define OMPI_SKIP_MPICXX
#endif
#include <mpi.h>
#include "openfoam_mpi.H"
using namespace Foam;

View File

@ -148,7 +148,7 @@ int main(int argc, char *argv[])
Info<< "input: " << input << nl
<< "expand: " << output << nl
<< "split: " << stringOps::split(output, "/") << nl << nl;
<< "split: " << stringOps::split(output, '/') << nl << nl;
}
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2021 OpenCFD Ltd.
Copyright (C) 2017-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -34,6 +34,7 @@ Description
#include "argList.H"
#include "fileName.H"
#include "stringOps.H"
#include "Switch.H"
using namespace Foam;
@ -65,6 +66,9 @@ int main(int argc, char *argv[])
{
argList::noBanner();
argList::noParallel();
argList::noMandatoryArgs();
argList::addArgument("string .. stringN");
argList::addOption
(
"any",
@ -89,6 +93,12 @@ int main(int argc, char *argv[])
"int",
"test split on fixed width"
);
argList::addOption
(
"begin",
"int",
"begin offset for splits"
);
argList::addBoolOption
(
"slash",
@ -104,18 +114,25 @@ int main(int argc, char *argv[])
"empty",
"preserve empty strings in split"
);
argList args(argc, argv, false, true);
argList args(argc, argv);
if (args.size() <= 1 && args.options().empty())
{
args.printUsage();
}
const label beginOffset = args.getOrDefault<label>("begin", 0);
const bool keepEmpty = args.found("empty");
Info<< "begin offset: " << beginOffset << nl;
Info<< "keep empty : " << Switch::name(keepEmpty) << nl;
const label nopts =
args.count({"any", "slash", "space", "sub", "fixed", "char"});
if (args.found("any"))
{
const std::string& str = args["any"];
@ -125,7 +142,7 @@ int main(int argc, char *argv[])
for (label argi=1; argi < args.size(); ++argi)
{
const auto split = stringOps::splitAny(args[argi], str);
auto split = stringOps::splitAny(args[argi], str, beginOffset);
printSubStrings(args[argi], split);
}
@ -144,7 +161,7 @@ int main(int argc, char *argv[])
for (label argi=1; argi < args.size(); ++argi)
{
const auto split = stringOps::split(args[argi], str);
auto split = stringOps::split(args[argi], str, beginOffset);
printSubStrings(args[argi], split);
}
@ -161,7 +178,11 @@ int main(int argc, char *argv[])
for (label argi=1; argi < args.size(); ++argi)
{
const auto split = stringOps::splitSpace(args[argi]);
auto split = stringOps::splitSpace(args[argi], beginOffset);
printSubStrings(args[argi], split);
Info<< "pop_front(2)" << nl;
split.pop_front(2);
printSubStrings(args[argi], split);
}
@ -180,7 +201,8 @@ int main(int argc, char *argv[])
for (label argi=1; argi < args.size(); ++argi)
{
const auto split = stringOps::split(args[argi], delim, keepEmpty);
auto split =
stringOps::split(args[argi], delim, beginOffset, keepEmpty);
printSubStrings(args[argi], split);
}
@ -199,7 +221,7 @@ int main(int argc, char *argv[])
for (label argi=1; argi < args.size(); ++argi)
{
const auto split = stringOps::splitFixed(args[argi], width);
auto split = stringOps::splitFixed(args[argi], width, beginOffset);
printSubStrings(args[argi], split);
}
@ -219,7 +241,8 @@ int main(int argc, char *argv[])
for (label argi=1; argi < args.size(); ++argi)
{
const auto split = stringOps::split(args[argi], delim, keepEmpty);
auto split =
stringOps::split(args[argi], delim, beginOffset, keepEmpty);
printSubStrings(args[argi], split);
}
}

View File

@ -44,7 +44,7 @@ Description
Format options:
\table
Property | Description | Required | Default
commsType | blocking/nonBlocking/scheduled | no | scheduled
commsType | scheduled/nonBlocking/buffered | no | scheduled
merge | Enable geometry/field merging | no | true
write | Write file(s) | no | false
narrow | Communicate with narrowed values | no | false

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2023 OpenCFD Ltd.
Copyright (C) 2017-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -35,6 +35,9 @@ Description
#include "labelList.H"
#include "scalarList.H"
#include "DynamicList.H"
#include "labelField.H"
#include "scalarField.H"
#include "SubField.H"
#include "SpanStream.H"
#include "formattingEntry.H"
@ -90,7 +93,7 @@ int main(int argc, char *argv[])
{
// This also works, but not actually using the autoPtr directly
autoPtr<token::Compound<labelList>> ptr
autoPtr<token::compound> ptr
(
new token::Compound<labelList>(identity(10, -9))
);
@ -131,44 +134,50 @@ int main(int argc, char *argv[])
Info<< "resized: "
<< ctok1.info() << nl << ctok1 << endl;
const scalarList* listptr = ctok1.compoundToken().isA<scalarList>();
if (listptr)
{
for (scalar& val : const_cast<scalarList&>(*listptr))
// Using isA<> on compoundToken()
const auto* listptr = ctok1.compoundToken().isA<scalarList>();
if (listptr)
{
val *= 5;
}
// sneaky, SubField bypasses const!
scalarField::subField fld(*listptr);
fld *= 5;
Info<< "multiplied List<scalar>: "
<< ctok1.info() << nl << ctok1 << endl;
Info<< "multiplied List<scalar>: "
<< ctok1.info() << nl << ctok1 << endl;
}
}
listptr = ctok1.isCompound<scalarList>();
if (listptr)
{
for (scalar& val : const_cast<scalarList&>(*listptr))
{
val /= 2;
}
// Using isCompound<...> - combined check
Info<< "divided List<scalar>: "
<< ctok1.info() << nl << ctok1 << endl;
const auto* listptr = ctok1.isCompound<scalarList>();
if (listptr)
{
scalarField::subField fld(*listptr);
fld /= 2;
Info<< "divided List<scalar>: "
<< ctok1.info() << nl << ctok1 << endl;
}
}
const labelList* listptr2 = ctok1.isCompound<labelList>();
if (listptr2)
{
for (label& val : const_cast<labelList&>(*listptr2))
{
val /= 2;
}
// Using isCompound<...> - combined check
Info<< "divided List<label>: "
<< ctok1.info() << nl << ctok1 << endl;
}
else
{
Info<< "compound is not List<label>" << nl;
const auto* listptr = ctok1.isCompound<labelList>();
if (listptr)
{
labelField::subField fld(*listptr);
fld /= 2;
Info<< "divided List<label>: "
<< ctok1.info() << nl << ctok1 << endl;
}
else
{
Info<< "compound is not List<label>" << nl;
}
}
Info<< "Before fill_zero: " << ctok1 << endl;
@ -183,57 +192,33 @@ int main(int argc, char *argv[])
auto& ct = ctok1.refCompoundToken();
ct.resize(20);
bool handled = true;
bool handled = false;
switch (ct.typeCode())
{
case token::tokenType::BOOL :
{
UList<bool> cmpts
(
reinterpret_cast<bool*>(ct.data_bytes()),
label(ct.size_bytes() / sizeof(bool))
);
cmpts = false;
#undef doLocalCode
#define doLocalCode(TokenType, cmptType, cmptValue) \
\
case TokenType : \
{ \
UList<cmptType> cmpts \
( \
reinterpret_cast<cmptType*>(ct.data_bytes()), \
label(ct.size_bytes() / sizeof(cmptType)) \
); \
cmpts = cmptValue; \
handled = true; \
break; \
}
break;
case token::tokenType::LABEL :
{
UList<label> cmpts
(
reinterpret_cast<label*>(ct.data_bytes()),
label(ct.size_bytes() / sizeof(label))
);
cmpts = 123;
}
break;
doLocalCode(token::tokenType::BOOL, bool, false);
doLocalCode(token::tokenType::LABEL, label, 123);
doLocalCode(token::tokenType::FLOAT, float, 2.7);
doLocalCode(token::tokenType::DOUBLE, double, 3.1415);
case token::tokenType::FLOAT :
{
UList<float> cmpts
(
reinterpret_cast<float*>(ct.data_bytes()),
label(ct.size_bytes() / sizeof(float))
);
cmpts = 2.7;
}
break;
#undef doLocalCode
case token::tokenType::DOUBLE :
{
UList<double> cmpts
(
reinterpret_cast<double*>(ct.data_bytes()),
label(ct.size_bytes() / sizeof(double))
);
cmpts = 3.1415;
}
break;
default:
handled = false;
break;
default : break;
}
@ -241,6 +226,10 @@ int main(int argc, char *argv[])
{
Info<< "assigned: " << ctok1 << nl;
}
else
{
Info<< "Warning: not handled!" << nl;
}
}
}
@ -327,6 +316,65 @@ int main(int argc, char *argv[])
Info<< "content" << nl << entry3 << nl;
}
{
primitiveEntry entry0("entry");
Info<< "empty: " << entry0 << nl;
// populate
{
tokenList& toks = entry0.stream();
toks.resize(2);
toks[0] = word("nonuniform");
toks[1] = token::Compound<scalarList>::New(10, scalar(1));
}
Info<< entry0 << nl;
// Modify contents
for (auto& tok : entry0.stream())
{
if (tok.isCompound<scalarList>())
{
tok.refCompoundToken<scalarList>() = 2;
}
}
Info<< entry0 << nl;
// Find and 'capture' contents
{
typedef List<scalar> ListType;
auto* inputDataPtr =
const_cast<ListType*>(entry0.stream().findCompound<ListType>());
if (inputDataPtr)
{
Info<< "found input data" << nl;
Info<< entry0 << nl;
ListType inputData(std::move(*inputDataPtr));
Info<< "input data, after move" << nl;
Info<< entry0 << nl;
ListType replaceData(5, scalar(3.145));
// some manipulation
replaceData.back() = scalar(1.414);
inputDataPtr->swap(replaceData);
Info<< "with replaced values" << nl;
}
}
Info<< entry0 << nl;
}
return 0;
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2021-2022 OpenCFD Ltd.
Copyright (C) 2021-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -77,6 +77,7 @@ int main(int argc, char *argv[])
);
#include "addRegionOption.H"
#include "addFaRegionOption.H"
#include "setRootCase.H"
#include "createTime.H"
#include "createNamedPolyMesh.H"
@ -90,8 +91,7 @@ int main(int argc, char *argv[])
faMesh::geometryOrder(geometryOrder);
}
// Create
faMesh aMesh(mesh);
#include "createNamedFaMesh.H"
Info<< "Time = " << runTime.timeName() << nl << endl;

View File

@ -55,7 +55,7 @@ do
bitSet haveMeshOnProc;
std::unique_ptr<faMeshSubset> subsetter;
IOobjectList objects(0);
IOobjectList objects;
refPtr<fileOperation> newHandler(fileOperation::NewUncollated());
@ -70,7 +70,13 @@ do
const bool oldParRun = UPstream::parRun(false);
objects = IOobjectList(serialMesh.time(), runTime.timeName());
objects = IOobjectList
(
serialMesh.time(),
runTime.timeName(),
serialMesh.dbDir(),
IOobjectOption::NO_REGISTER
);
UPstream::parRun(oldParRun);
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2021-2022 OpenCFD Ltd.
Copyright (C) 2021-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -18,7 +18,8 @@ Required Classes
- Foam::IOdictionary
Required Variables
- regionName [word]
- regionName [word] (the polyMesh region)
- areaRegionName [word] (the areaMesh region)
- args [argList]
- runTime [Time]
@ -35,6 +36,7 @@ autoPtr<IOdictionary> meshDictPtr;
{
fileName dictPath;
const word& regionDir = Foam::polyMesh::regionName(regionName);
const word& areaRegionDir = Foam::polyMesh::regionName(areaRegionName);
if (args.readIfPresent("dict", dictPath))
{
@ -47,38 +49,30 @@ autoPtr<IOdictionary> meshDictPtr;
}
else if
(
// Check global location
exists
// Dictionary under system/faMeshDefinition ?
// (v2312 and earlier)
areaRegionDir.empty()
&& exists
(
runTime.path()/runTime.caseConstant()
runTime.path()/runTime.caseSystem()
/ regionDir/faMesh::meshSubDir/dictName
)
)
{
// Dictionary present in constant faMesh directory (old-style)
// Dictionary present directly in system/ (v2312 and earlier)
dictPath =
(
runTime.constant()
/ regionDir/faMesh::meshSubDir/dictName
);
// Warn that constant/faMesh/faMeshDefinition was used
// instead of system/faMeshDefinition
#if 0
WarningIn(args.executable())
<< "Using the old faMeshDefinition location: "
<< dictPath << nl
<< " instead of default location: "
<< runTime.system()/regionDir/dictName << nl
<< endl;
#endif
dictPath = runTime.system()/regionDir/dictName;
}
else
{
// Assume dictionary is in the system directory
// Use system/finite-area/ directory, with region qualifications
dictPath = runTime.system()/regionDir/dictName;
dictPath =
(
runTime.system()/regionDir
/ faMesh::prefix()/areaRegionDir/dictName
);
}
IOobject meshDictIO

View File

@ -104,10 +104,13 @@ int main(int argc, char *argv[])
);
#include "addRegionOption.H"
#include "addFaRegionOption.H"
#include "setRootCase.H"
#include "createTime.H"
#include "createNamedPolyMesh.H"
#include "getFaRegionOption.H"
const bool doDecompose = !args.found("no-decompose");
const bool doDecompFields = !args.found("no-fields");
@ -133,8 +136,15 @@ int main(int argc, char *argv[])
// Preliminary checks
#include "checkPatchTopology.H"
Info << "Create areaMesh";
if (!Foam::polyMesh::regionName(areaRegionName).empty())
{
Foam::Info << ' ' << areaRegionName;
}
Info << " for polyMesh at time = " << runTime.timeName() << nl;
// Create
faMesh aMesh(mesh, meshDefDict);
faMesh aMesh(areaRegionName, mesh, meshDefDict);
// Mesh information (less verbose)
faMeshTools::printMeshChecks(aMesh, 0);

View File

@ -157,7 +157,7 @@ int main(int argc, char *argv[])
// // skip over time=0, unless some other time option has been specified
// if
// (
// !args.found("zeroTime")
// !args.found("noZero")
// && !args.found("time")
// && !args.found("latestTime")
// && Times.size() > 2

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2022-2023 OpenCFD Ltd.
Copyright (C) 2022-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -93,29 +93,34 @@ void Foam::fileFormats::ensightMeshReader::readIDs
(
ensightReadFile& is,
const bool doRead,
const label nShapes,
const label elemCount,
labelList& foamToElem,
Map<label>& elemToFoam
) const
{
const label sz = foamToElem.size();
foamToElem.resize(sz+nShapes);
const label begElem = foamToElem.size();
const label endElem = begElem + elemCount;
foamToElem.resize(foamToElem.size()+elemCount);
if (doRead)
{
elemToFoam.reserve(elemToFoam.size()+nShapes);
for (label shapei = 0; shapei < nShapes; shapei++)
elemToFoam.reserve(elemToFoam.size()+elemCount);
for (label elemi = begElem; elemi < endElem; ++elemi)
{
label elemi;
is.read(elemi);
foamToElem[sz+shapei] = elemi;
elemToFoam.insert(elemi, sz+shapei);
label id;
is.read(id);
foamToElem[elemi] = id;
elemToFoam.insert(id, elemi);
}
}
else
{
for (label shapei = 0; shapei < nShapes; shapei++)
// identity
for (label elemi = begElem; elemi < endElem; ++elemi)
{
foamToElem[sz+shapei] = sz+shapei;
foamToElem[elemi] = elemi;
}
}
}
@ -209,37 +214,54 @@ bool Foam::fileFormats::ensightMeshReader::readGoldPart
// Work
DynamicList<label> verts;
string line;
string buffer;
while (is.good())
{
do
{
is.readKeyword(line);
// Get entire line/string
is.read(buffer);
}
while (line.empty() && is.good());
while (buffer.empty() && is.good());
const auto split = stringOps::splitSpace(line);
if (!is.good())
{
break;
}
else if (buffer.contains("BEGIN TIME STEP"))
{
// Graciously handle a miscued start
continue;
}
else if (buffer.contains("END TIME STEP"))
{
// END TIME STEP is a valid means to terminate input
break;
}
const auto split = stringOps::splitSpace(buffer);
if (split.size() == 0)
if (split.empty())
{
continue;
}
if (split[0] == "part")
const auto keyword(split[0].str());
if (keyword == "part")
{
return false;
}
else if (split[0] == "node_ids")
else if (keyword == "node_ids")
{
const label nPoints = points.size();
// Ignore for now
for (label i = 0; i < nPoints; i++)
// Ignore point ids
for (label pointi = 0; pointi < nPoints; ++pointi)
{
label index;
is.read(index);
label id;
is.read(id);
}
}
else if (split[0] == "coordinates")
else if (keyword == "coordinates")
{
label nPoints;
is.read(nPoints);
@ -257,207 +279,205 @@ bool Foam::fileFormats::ensightMeshReader::readGoldPart
nodeIdToPoints
);
points.setSize(nPoints);
for (label pointi = 0; pointi < nPoints; pointi++)
{
is.read(points[pointi].x());
}
for (label pointi = 0; pointi < nPoints; pointi++)
{
is.read(points[pointi].y());
}
for (label pointi = 0; pointi < nPoints; pointi++)
{
is.read(points[pointi].z());
}
is.readPoints(nPoints, points);
}
else if (split[0] == "tetra4")
else if (keyword == "tetra4")
{
label nShapes;
is.read(nShapes);
label elemCount;
is.read(elemCount);
Pout<< indent<< "tetra4 " << nShapes
Pout<< indent<< "tetra4 " << elemCount
<< " starting at line " << is.lineNumber()
<< " position " << is.stdStream().tellg() << endl;
const label celli = cells.size();
cells.resize(celli+nShapes);
readIDs
(
is,
read_elem_ids,
nShapes,
elemCount,
cellToElemIds,
elemIdToCells
);
// Extend and fill the new trailing portion
const label startElemi = cells.size();
cells.resize(startElemi+elemCount);
faceListList::subList myElements = cells.slice(startElemi);
const auto& model = cellModel::ref(cellModel::TET);
for (label shapei = 0; shapei < nShapes; shapei++)
for (auto& cellFaces : myElements)
{
readVerts(is, 4, nodeIdToPoints, verts);
if (setHandedness_)
{
setHandedness(model, verts, points);
}
const cellShape cellVerts(model, verts);
cells[celli+shapei] = cellVerts.faces();
cellFaces = cellShape(model, verts).faces();
}
}
else if (split[0] == "pyramid5")
else if (keyword == "pyramid5")
{
label nShapes;
is.read(nShapes);
label elemCount;
is.read(elemCount);
Pout<< indent<< "pyramid5 " << nShapes
Pout<< indent<< "pyramid5 " << elemCount
<< " starting at line " << is.lineNumber()
<< " position " << is.stdStream().tellg() << endl;
const label celli = cells.size();
cells.resize(celli+nShapes);
readIDs
(
is,
read_elem_ids,
nShapes,
elemCount,
cellToElemIds,
elemIdToCells
);
// Extend and fill the new trailing portion
const label startElemi = cells.size();
cells.resize(startElemi+elemCount);
faceListList::subList myElements = cells.slice(startElemi);
const auto& model = cellModel::ref(cellModel::PYR);
for (label shapei = 0; shapei < nShapes; shapei++)
for (auto& cellFaces : myElements)
{
readVerts(is, 5, nodeIdToPoints, verts);
if (setHandedness_)
{
setHandedness(model, verts, points);
}
const cellShape cellVerts(model, verts);
cells[celli+shapei] = cellVerts.faces();
cellFaces = cellShape(model, verts).faces();
}
}
else if (split[0] == "penta6")
else if (keyword == "penta6")
{
label nShapes;
is.read(nShapes);
label elemCount;
is.read(elemCount);
Pout<< indent<< "penta6 " << nShapes
Pout<< indent<< "penta6 " << elemCount
<< " starting at line " << is.lineNumber()
<< " position " << is.stdStream().tellg() << endl;
const label celli = cells.size();
cells.resize(celli+nShapes);
readIDs
(
is,
read_elem_ids,
nShapes,
elemCount,
cellToElemIds,
elemIdToCells
);
// Extend and fill the new trailing portion
const label startElemi = cells.size();
cells.resize(startElemi+elemCount);
faceListList::subList myElements = cells.slice(startElemi);
const auto& model = cellModel::ref(cellModel::PRISM);
for (label shapei = 0; shapei < nShapes; shapei++)
for (auto& cellFaces : myElements)
{
readVerts(is, 6, nodeIdToPoints, verts);
if (setHandedness_)
{
setHandedness(model, verts, points);
}
const cellShape cellVerts(model, verts);
cells[celli+shapei] = cellVerts.faces();
cellFaces = cellShape(model, verts).faces();
}
}
else if (split[0] == "hexa8")
else if (keyword == "hexa8")
{
label nShapes;
is.read(nShapes);
label elemCount;
is.read(elemCount);
Pout<< indent<< "hexa8 " << nShapes
Pout<< indent<< "hexa8 " << elemCount
<< " starting at line " << is.lineNumber()
<< " position " << is.stdStream().tellg() << endl;
const label celli = cells.size();
cells.resize(celli+nShapes);
readIDs
(
is,
read_elem_ids,
nShapes,
elemCount,
cellToElemIds,
elemIdToCells
);
// Extend and fill the new trailing portion
const label startElemi = cells.size();
cells.resize(startElemi+elemCount);
faceListList::subList myElements = cells.slice(startElemi);
const auto& model = cellModel::ref(cellModel::HEX);
for (label shapei = 0; shapei < nShapes; shapei++)
for (auto& cellFaces : myElements)
{
readVerts(is, 8, nodeIdToPoints, verts);
if (setHandedness_)
{
setHandedness(model, verts, points);
}
const cellShape cellVerts(model, verts);
cells[celli+shapei] = cellVerts.faces();
cellFaces = cellShape(model, verts).faces();
}
}
else if (split[0] == "nfaced")
else if (keyword == "nfaced")
{
label nShapes;
is.read(nShapes);
label elemCount;
is.read(elemCount);
Pout<< indent<< "nfaced " << nShapes
Pout<< indent<< "nfaced " << elemCount
<< " starting at line " << is.lineNumber()
<< " position " << is.stdStream().tellg() << endl;
const label celli = cells.size();
cells.resize(celli+nShapes);
readIDs
(
is,
read_elem_ids,
nShapes,
elemCount,
cellToElemIds,
elemIdToCells
);
for (label shapei = 0; shapei < nShapes; shapei++)
// Extend and fill the new trailing portion
const label startElemi = cells.size();
cells.resize(startElemi+elemCount);
faceListList::subList myElements = cells.slice(startElemi);
for (auto& cellFaces : myElements)
{
label nFaces;
is.read(nFaces);
faceList& cellFaces = cells[celli+shapei];
cellFaces.setSize(nFaces);
cellFaces.resize(nFaces);
}
for (label shapei = 0; shapei < nShapes; shapei++)
for (auto& cellFaces : myElements)
{
faceList& cellFaces = cells[celli+shapei];
forAll(cellFaces, cellFacei)
for (face& f : cellFaces)
{
label nVerts;
is.read(nVerts);
cellFaces[cellFacei].setSize(nVerts);
f.resize(nVerts);
}
}
for (label shapei = 0; shapei < nShapes; shapei++)
for (faceList& cellFaces : myElements)
{
faceList& cellFaces = cells[celli+shapei];
forAll(cellFaces, cellFacei)
for (face& f : cellFaces)
{
face& f = cellFaces[cellFacei];
readVerts(is, f.size(), nodeIdToPoints, verts);
f.labelList::operator=(verts);
}
}
forAll(f, fp)
// Full check
forAll(myElements, elemi)
{
for (const face& f : myElements[elemi])
{
for (label pointi : f)
{
if (f[fp] < 0 || f[fp] >= points.size())
if (pointi < 0 || pointi >= points.size())
{
FatalErrorInFunction<< "Face:" << shapei
FatalErrorInFunction
<< "Face:" << elemi
<< " verts:" << f
<< " indexes outside points:" << points.size()
<< exit(FatalError);
@ -466,107 +486,104 @@ bool Foam::fileFormats::ensightMeshReader::readGoldPart
}
}
}
else if (split[0] == "tria3")
else if (keyword == "tria3")
{
label nShapes;
is.read(nShapes);
label elemCount;
is.read(elemCount);
Pout<< indent << "tria3 " << nShapes
Pout<< indent << "tria3 " << elemCount
<< " starting at line " << is.lineNumber()
<< " position " << is.stdStream().tellg() << endl;
const label facei = faces.size();
readIDs
(
is,
read_elem_ids,
nShapes,
elemCount,
faceToElemIDs,
elemIdToFaces
);
faces.setSize(facei+nShapes);
// Extend and fill the new trailing portion
const label startElemi = cells.size();
faces.resize(startElemi+elemCount, face(3)); // <- tria3
faceList::subList myElements = faces.slice(startElemi);
for (label shapei = 0; shapei < nShapes; shapei++)
for (face& f : myElements)
{
auto& f = faces[facei+shapei];
f.setSize(3);
readVerts(is, f.size(), nodeIdToPoints, verts);
f.labelList::operator=(verts);
}
}
else if (split[0] == "quad4")
else if (keyword == "quad4")
{
label nShapes;
is.read(nShapes);
label elemCount;
is.read(elemCount);
Pout<< indent << "quad4 " << nShapes
Pout<< indent << "quad4 " << elemCount
<< " starting at line " << is.lineNumber()
<< " position " << is.stdStream().tellg() << endl;
const label facei = faces.size();
readIDs
(
is,
read_elem_ids,
nShapes,
elemCount,
faceToElemIDs,
elemIdToFaces
);
faces.setSize(facei+nShapes);
// Extend and fill the new trailing portion
const label startElemi = cells.size();
faces.resize(startElemi+elemCount, face(4)); // <- quad4
faceList::subList myElements = faces.slice(startElemi);
for (label shapei = 0; shapei < nShapes; shapei++)
for (face& f : myElements)
{
auto& f = faces[facei+shapei];
f.setSize(4);
readVerts(is, f.size(), nodeIdToPoints, verts);
f.labelList::operator=(verts);
}
}
else if (split[0] == "nsided")
else if (keyword == "nsided")
{
label nShapes;
is.read(nShapes);
label elemCount;
is.read(elemCount);
Pout<< indent << "nsided " << nShapes
Pout<< indent << "nsided " << elemCount
<< " starting at line " << is.lineNumber()
<< " position " << is.stdStream().tellg() << endl;
const label facei = faces.size();
readIDs
(
is,
read_elem_ids,
nShapes,
elemCount,
faceToElemIDs,
elemIdToFaces
);
faces.setSize(facei+nShapes);
// Extend and fill the new trailing portion
const label startElemi = cells.size();
faces.resize(startElemi+elemCount);
faceList::subList myElements = faces.slice(startElemi);
for (label shapei = 0; shapei < nShapes; shapei++)
for (face& f : myElements)
{
auto& f = faces[facei+shapei];
label nVerts;
is.read(nVerts);
f.setSize(nVerts);
f.resize(nVerts);
}
for (label shapei = 0; shapei < nShapes; shapei++)
for (face& f : myElements)
{
auto& f = faces[facei+shapei];
readVerts(is, f.size(), nodeIdToPoints, verts);
f.labelList::operator=(verts);
}
}
else
{
WarningInFunction << "Unhandled key " << string(split[0])
<< " from line " << line
WarningInFunction << "Unhandled key " << keyword
<< " from line " << buffer
<< " starting at line " << is.lineNumber()
<< " position " << is.stdStream().tellg() << endl;
}
@ -584,16 +601,21 @@ bool Foam::fileFormats::ensightMeshReader::readGeometry
const scalar scaleFactor
)
{
// Auto-detect ascii/binary format,
// skips any initial "BEGIN TIME STEP"
ensightReadFile is(geometryFile_);
// Skip 'binary' tag
is.readBinaryHeader();
string header;
is.read(header);
Info<< "Ensight : " << header << endl;
is.read(header);
Info<< "Ensight : " << header << endl;
string buffer;
// Ensight Geometry File
is.read(buffer);
Info<< "Ensight : " << buffer << nl;
// Description - 1
is.read(buffer);
Info<< "Ensight : " << buffer << nl;
bool read_node_ids = false;
@ -623,61 +645,72 @@ bool Foam::fileFormats::ensightMeshReader::readGeometry
// Parse all
string line;
SubStrings<string> split;
while (is.good())
{
do
{
is.readKeyword(line);
// Get entire line/string
is.read(buffer);
}
while (line.empty() && is.good());
const auto split = stringOps::splitSpace(line);
while (buffer.empty() && is.good());
if (buffer.contains("END TIME STEP"))
{
// END TIME STEP is a valid means to terminate input
break;
}
split = stringOps::splitSpace(buffer);
if (split[0] == "extents")
if (split.empty())
{
point min;
point max;
is.read(min.x());
is.read(max.x());
is.read(min.y());
is.read(max.y());
is.read(min.z());
is.read(max.z());
Pout<< indent
<< "Read extents " << boundBox(min, max)
<< endl;
continue;
}
else if (split[0] == "node")
const auto keyword(split[0].str());
if (keyword == "extents")
{
word id(split[1]);
word op(split[2]);
// Optional extents (xmin, xmax, ymin, ymax, zmin, zmax)
boundBox bb;
point& min = bb.min();
point& max = bb.max();
is.read(min.x()); is.read(max.x());
is.read(min.y()); is.read(max.y());
is.read(min.z()); is.read(max.z());
Pout<< indent << "Read extents " << bb << endl;
}
else if (keyword == "node")
{
// "node id (off|assign|given|ignore)"
std::string op(split[2]);
if (op == "given" || op == "ignore")
{
Pout<< indent << "Reading node ids" << endl;
read_node_ids = true;
}
}
else if (split[0] == "element")
else if (keyword == "element")
{
word id(split[1]);
word op(split[2]);
// "element id (off|assign|given|ignore)"
std::string op(split[2]);
if (op == "given" || op == "ignore")
{
Pout<< indent << "Reading element ids" << endl;
read_elem_ids = true;
}
}
else if (split[0] == "part")
else if (keyword == "part")
{
bool finished = false;
do
{
// Make space
partIDs.emplace_back();
is.read(partIDs.back());
partNames.emplace_back();
is.read(partNames.back());
// Read part id and name
is.read(partIDs.emplace_back());
is.read(partNames.emplace_back());
Pout<< indent
<< "Reading part " << partIDs.back()
@ -954,7 +987,7 @@ bool Foam::fileFormats::ensightMeshReader::readGeometry
const face& f = rotateFace(cFaces[cFacei], rotatedFace);
const auto fFnd = vertsToCell.find(f);
if (fFnd)
if (fFnd.good())
{
// Already inserted. Internal face.
vertsToCell.erase(fFnd);
@ -1026,7 +1059,12 @@ bool Foam::fileFormats::ensightMeshReader::readGeometry
)
);
if (!cAndF)
if (cAndF.good())
{
partCellAndFace[patchFacei++] = cAndF.val();
vertsToCell.erase(cAndF);
}
else
{
//WarningInFunction
// << "Did not find face " << facei
@ -1036,11 +1074,6 @@ bool Foam::fileFormats::ensightMeshReader::readGeometry
// << " in part " << parti
// << endl;
}
else
{
partCellAndFace[patchFacei++] = cAndF();
vertsToCell.erase(cAndF);
}
}
partCellAndFace.setSize(patchFacei);
}

View File

@ -1569,7 +1569,7 @@ int main(int argc, char *argv[])
//Get polyMesh to write to constant
runTime.setTime(instant(runTime.constant()), 0);
runTime.setTime(instant(0, runTime.constant()), 0);
repatcher.repatch();

View File

@ -618,7 +618,7 @@ void Foam::conformalVoronoiMesh::reorderProcessorPatches
labelList rotation(faces.size(), Zero);
labelList faceMap(faces.size(), label(-1));
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
PstreamBuffers pBufs;
// Send ordering
forAll(sortMesh.boundaryMesh(), patchi)

View File

@ -568,10 +568,9 @@ void syncPoints
}
}
// buffered send
OPstream toNbr
(
UPstream::commsTypes::blocking,
UPstream::commsTypes::buffered,
procPatch.neighbProcNo()
);
toNbr << patchInfo;

View File

@ -145,6 +145,7 @@ Usage
#include "hexRef8Data.H"
#include "regionProperties.H"
#include "polyMeshTools.H"
#include "subsetAdjacency.H"
using namespace Foam;
@ -194,21 +195,56 @@ tmp<volScalarField> createScalarField
}
// Calculate band of matrix
label getBand(const labelList& owner, const labelList& neighbour)
// Calculate band of mesh
// label getBand(const labelUList& owner, const labelUList& neighbour)
// {
// label bandwidth = 0;
//
// forAll(neighbour, facei)
// {
// const label width = neighbour[facei] - owner[facei];
//
// if (bandwidth < width)
// {
// bandwidth = width;
// }
// }
// return bandwidth;
// }
// Calculate band and profile of matrix. Profile is scalar to avoid overflow
Tuple2<label, scalar> getBand
(
const CompactListList<label>& mat
)
{
label band = 0;
Tuple2<label, scalar> metrics(0, 0);
forAll(neighbour, facei)
auto& bandwidth = metrics.first();
auto& profile = metrics.second();
forAll(mat, celli)
{
label diff = neighbour[facei] - owner[facei];
const auto& neighbours = mat[celli];
if (diff > band)
const label nNbr = neighbours.size();
if (nNbr)
{
band = diff;
// Max distance
const label width = (neighbours[nNbr-1] - celli);
if (bandwidth < width)
{
bandwidth = width;
}
profile += scalar(width);
}
}
return band;
return metrics;
}
@ -217,27 +253,35 @@ void getBand
(
const bool calculateIntersect,
const label nCells,
const labelList& owner,
const labelList& neighbour,
const labelUList& owner,
const labelUList& neighbour,
label& bandwidth,
scalar& profile, // scalar to avoid overflow
scalar& sumSqrIntersect // scalar to avoid overflow
)
{
labelList cellBandwidth(nCells, Foam::zero{});
scalarField nIntersect(nCells, Foam::zero{});
bandwidth = 0;
forAll(neighbour, facei)
{
label own = owner[facei];
label nei = neighbour[facei];
const label own = owner[facei];
const label nei = neighbour[facei];
// Note: mag not necessary for correct (upper-triangular) ordering.
label diff = nei-own;
cellBandwidth[nei] = max(cellBandwidth[nei], diff);
}
const label width = nei - own;
bandwidth = max(cellBandwidth);
if (cellBandwidth[nei] < width)
{
cellBandwidth[nei] = width;
if (bandwidth < width)
{
bandwidth = width;
}
}
}
// Do not use field algebra because of conversion label to scalar
profile = 0;
@ -246,14 +290,16 @@ void getBand
profile += scalar(width);
}
sumSqrIntersect = 0.0;
sumSqrIntersect = 0;
if (calculateIntersect)
{
scalarField nIntersect(nCells, Foam::zero{});
forAll(nIntersect, celli)
{
for (label colI = celli-cellBandwidth[celli]; colI <= celli; colI++)
{
nIntersect[colI] += 1.0;
nIntersect[colI] += scalar(1);
}
}
@ -675,9 +721,8 @@ CompactListList<label> regionRenumber
forAll(regionCellOrder, regioni)
{
// Info<< " region " << regioni
// << " starts at " << regionCellOrder.localStart(regioni)
// << nl;
// Info<< " region " << regioni << " starts at "
// << regionCellOrder.localStart(regioni) << nl;
// No parallel communication
const bool oldParRun = UPstream::parRun(false);
@ -703,27 +748,42 @@ CompactListList<label> regionRenumber
{
timer.resetTimeIncrement();
// Create adjacency matrix of the full mesh and subset subsequently.
// This is more efficient than creating adjacency matrices of
// sub-meshes.
// No parallel communication
const bool oldParRun = UPstream::parRun(false);
// The local connectivity of the full (non-subsetted) mesh
CompactListList<label> meshCellCells;
globalMeshData::calcCellCells(mesh, meshCellCells);
UPstream::parRun(oldParRun); // Restore parallel state
timings[TimingType::CELL_CELLS] += timer.timeIncrement();
// For the respective subMesh selections
bitSet subsetCells(mesh.nCells());
forAll(regionCellOrder, regioni)
{
// Info<< " region " << regioni
// << " starts at " << regionCellOrder.localStart(regioni)
// << nl;
// Info<< " region " << regioni << " starts at "
// << regionCellOrder.localStart(regioni) << nl;
subsetCells = false;
subsetCells.set(regionCellOrder[regioni]);
// Connectivity of local sub-mesh
labelList cellMap;
CompactListList<label> subCellCells =
subsetAdjacency(subsetCells, meshCellCells, cellMap);
timings[TimingType::CELL_CELLS] += timer.timeIncrement();
// No parallel communication
const bool oldParRun = UPstream::parRun(false);
// Connectivity of local sub-mesh
CompactListList<label> cellCells;
labelList cellMap = globalMeshData::calcCellCells
(
mesh,
regionCellOrder[regioni],
cellCells
);
timings[TimingType::CELL_CELLS] += timer.timeIncrement();
labelList subCellOrder = method.renumber(cellCells);
labelList subCellOrder = method.renumber(subCellCells);
UPstream::parRun(oldParRun); // Restore parallel state
@ -743,6 +803,10 @@ CompactListList<label> regionRenumber
int main(int argc, char *argv[])
{
argList::noFunctionObjects(); // Never use function objects
timeSelector::addOptions_singleTime(); // Single-time options
argList::addNote
(
"Renumber mesh cells to reduce the bandwidth. Use the -lib option or"
@ -803,11 +867,8 @@ int main(int argc, char *argv[])
"eg, 'reverse true;'"
);
argList::noFunctionObjects(); // Never use function objects
#include "addAllRegionOptions.H"
#include "addOverwriteOption.H"
#include "addTimeOptions.H"
// -------------------------
@ -835,10 +896,10 @@ int main(int argc, char *argv[])
const bool dryrun = args.dryRun();
const bool readDict = args.found("dict");
const bool doFrontWidth = args.found("frontWidth");
const bool doDecompose = args.found("decompose");
const bool overwrite = args.found("overwrite");
const bool doFields = !args.found("no-fields");
const bool doDecompose = args.found("decompose");
const bool doFrontWidth = args.found("frontWidth") && !doDecompose;
word renumberMethodName;
args.readIfPresent("renumber-method", renumberMethodName);
@ -846,8 +907,7 @@ int main(int argc, char *argv[])
if (doDecompose && UPstream::parRun())
{
FatalErrorIn(args.executable())
<< "Cannot use -decompose option in parallel"
<< " ... giving up" << nl
<< "Cannot use -decompose option in parallel ... giving up" << nl
<< exit(FatalError);
}
@ -867,14 +927,15 @@ int main(int argc, char *argv[])
// Get region names
#include "getAllRegionOptions.H"
// Get times list
instantList Times = runTime.times();
// Set startTime depending on -time and -latestTime options
#include "checkTimeOptions.H"
runTime.setTime(Times[startTime], startTime);
// Set time from specified time options, or force start from Time=0
timeSelector::setTimeIfPresent(runTime, args, true);
// Capture current time information for non-overwrite
const Tuple2<instant, label> startTime
(
instant(runTime.value(), runTime.timeName()),
runTime.timeIndex()
);
// Start/reset all timings
timer.resetTime();
@ -888,7 +949,10 @@ int main(int argc, char *argv[])
for (fvMesh& mesh : meshes)
{
// Reset time in case of multiple meshes and not overwrite
runTime.setTime(Times[startTime], startTime);
if (!overwrite)
{
runTime.setTime(startTime.first(), startTime.second());
}
const word oldInstance = mesh.pointsInstance();
@ -908,21 +972,21 @@ int main(int argc, char *argv[])
reduce(band, maxOp<label>());
reduce(profile, sumOp<scalar>());
reduce(sumSqrIntersect, sumOp<scalar>());
scalar rmsFrontwidth = Foam::sqrt
(
sumSqrIntersect/mesh.globalData().nTotalCells()
);
Info<< "Mesh " << mesh.name()
<< " size: " << mesh.globalData().nTotalCells() << nl
<< "Before renumbering :" << nl
<< "Before renumbering" << nl
<< " band : " << band << nl
<< " profile : " << profile << nl;
if (doFrontWidth)
{
reduce(sumSqrIntersect, sumOp<scalar>());
scalar rmsFrontwidth = Foam::sqrt
(
sumSqrIntersect/mesh.globalData().nTotalCells()
);
Info<< " rms frontwidth : " << rmsFrontwidth << nl;
}
@ -1091,10 +1155,7 @@ int main(int argc, char *argv[])
);
// List of objects read from time directory
// List of stored objects to clear from mesh
IOobjectList objects;
// List of stored objects to clear from mesh (after reading)
DynamicList<regIOobject*> storedObjects;
if (!dryrun && doFields)
@ -1103,55 +1164,60 @@ int main(int argc, char *argv[])
timer.resetTimeIncrement();
objects = IOobjectList(mesh, runTime.timeName());
IOobjectList objects(mesh, runTime.timeName());
storedObjects.reserve(objects.size());
const predicates::always nameMatcher;
// Read GeometricFields
#undef ReadFields
#define ReadFields(FieldType) \
#undef doLocalCode
#define doLocalCode(FieldType) \
readFields<FieldType>(mesh, objects, nameMatcher, storedObjects);
// Read volume fields
ReadFields(volScalarField);
ReadFields(volVectorField);
ReadFields(volSphericalTensorField);
ReadFields(volSymmTensorField);
ReadFields(volTensorField);
doLocalCode(volScalarField);
doLocalCode(volVectorField);
doLocalCode(volSphericalTensorField);
doLocalCode(volSymmTensorField);
doLocalCode(volTensorField);
// Read internal fields
ReadFields(volScalarField::Internal);
ReadFields(volVectorField::Internal);
ReadFields(volSphericalTensorField::Internal);
ReadFields(volSymmTensorField::Internal);
ReadFields(volTensorField::Internal);
doLocalCode(volScalarField::Internal);
doLocalCode(volVectorField::Internal);
doLocalCode(volSphericalTensorField::Internal);
doLocalCode(volSymmTensorField::Internal);
doLocalCode(volTensorField::Internal);
// Read surface fields
ReadFields(surfaceScalarField);
ReadFields(surfaceVectorField);
ReadFields(surfaceSphericalTensorField);
ReadFields(surfaceSymmTensorField);
ReadFields(surfaceTensorField);
doLocalCode(surfaceScalarField);
doLocalCode(surfaceVectorField);
doLocalCode(surfaceSphericalTensorField);
doLocalCode(surfaceSymmTensorField);
doLocalCode(surfaceTensorField);
// Read point fields
const pointMesh& pMesh = pointMesh::New(mesh);
#undef ReadPointFields
#define ReadPointFields(FieldType) \
#undef doLocalCode
#define doLocalCode(FieldType) \
readFields<FieldType>(pMesh, objects, nameMatcher, storedObjects);
ReadPointFields(pointScalarField);
ReadPointFields(pointVectorField);
ReadPointFields(pointSphericalTensorField);
ReadPointFields(pointSymmTensorField);
ReadPointFields(pointTensorField);
doLocalCode(pointScalarField);
doLocalCode(pointVectorField);
doLocalCode(pointSphericalTensorField);
doLocalCode(pointSymmTensorField);
doLocalCode(pointTensorField);
#undef ReadFields
#undef ReadPointFields
#undef doLocalCode
timings[TimingType::READ_FIELDS] += timer.timeIncrement();
// Write loaded fields when mesh.write() is called
for (auto* fldptr : storedObjects)
{
fldptr->writeOpt(IOobject::AUTO_WRITE);
}
}
@ -1224,7 +1290,13 @@ int main(int argc, char *argv[])
CompactListList<label> regionCellOrder =
regionRenumber(renumberPtr(), mesh, cellToRegion);
regionRenumber
(
renumberPtr(),
mesh,
cellToRegion,
decomposePtr().nDomains()
);
cellOrder = regionCellOrder.values();
@ -1586,19 +1658,25 @@ int main(int argc, char *argv[])
);
reduce(band, maxOp<label>());
reduce(profile, sumOp<scalar>());
reduce(sumSqrIntersect, sumOp<scalar>());
scalar rmsFrontwidth = Foam::sqrt
(
sumSqrIntersect/mesh.globalData().nTotalCells()
);
Info<< "After renumbering";
if (doDecompose)
{
Info<< " [values are misleading with -decompose option]";
}
Info<< "After renumbering :" << nl
Info<< nl
<< " band : " << band << nl
<< " profile : " << profile << nl;
if (doFrontWidth)
{
reduce(sumSqrIntersect, sumOp<scalar>());
scalar rmsFrontwidth = Foam::sqrt
(
sumSqrIntersect/mesh.globalData().nTotalCells()
);
Info<< " rms frontwidth : " << rmsFrontwidth << nl;
}

View File

@ -0,0 +1,168 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
Description
Subsetting of an adjacency matrix (as CompactListList).
Can be relocated elsewhere.
\*---------------------------------------------------------------------------*/
#include "CompactListList.H"
#include "bitSet.H"
#include "ListOps.H"
#include "Map.H"
namespace Foam
{
// Perform a subset of the adjacency matrix
CompactListList<label> subsetAdjacency
(
const bitSet& select, // could also be labelHashSet
const CompactListList<label>& input,
labelList& subMap
)
{
// Corresponds to cellMap etc (the original selection)
subMap = select.sortedToc();
// Ensure that the subMap corresponds to a valid subset
{
label validSize = 0;
const label nTotal = input.size();
forAllReverse(subMap, i)
{
if (subMap[i] < nTotal)
{
validSize = i + 1;
break;
}
}
subMap.resize(validSize);
}
// Assumed to be sparse - use Map for reverse lookup
const Map<label> reverseMap(invertToMap(subMap));
// Pass 1: determine the selected sub-sizes
labelList sizes(subMap.size(), Foam::zero{});
forAll(subMap, idx)
{
for (const label nbr : input[subMap[idx]])
{
if
(
select.test(nbr)
&& reverseMap.contains(nbr) // extra consistency (paranoid)
)
{
++sizes[idx];
}
}
}
CompactListList<label> output(sizes);
// Reuse sizes as output offset into output.values()
sizes = labelList::subList(output.offsets(), output.size());
labelList& values = output.values();
// Pass 2: extract sub-adjacent matrix
label newNbr = -1;
forAll(subMap, idx)
{
for (const label nbr : input[subMap[idx]])
{
if
(
select.test(nbr)
&& (newNbr = reverseMap.lookup(nbr, -1)) >= 0
)
{
values[sizes[idx]++] = newNbr;
}
}
}
return output;
}
// Perform a subset of the adjacency matrix
CompactListList<label> subsetAdjacency
(
const labelRange& slice,
const CompactListList<label>& input,
labelList& subMap
)
{
// Ensure that the selection corresponds to a valid subset
const labelRange select = slice.subset0(input.size());
// Corresponds to cellMap etc (the original selection)
subMap = Foam::identity(select);
// Pass 1: determine the selected sub-sizes
labelList sizes(subMap.size(), Foam::zero{});
forAll(subMap, idx)
{
for (const label nbr : input[subMap[idx]])
{
if (select.contains(nbr))
{
++sizes[idx];
}
}
}
CompactListList<label> output(sizes);
// Reuse sizes as output offset into output.values()
sizes = labelList::subList(output.offsets(), output.size());
labelList& values = output.values();
// Pass 2: extract sub-adjacent matrix
const label localOffset = select.start();
forAll(subMap, idx)
{
for (const label nbr : input[subMap[idx]])
{
if (select.contains(nbr))
{
values[sizes[idx]++] = nbr - localOffset;
}
}
}
return output;
}
} // End namespace Foam
// ************************************************************************* //

View File

@ -62,12 +62,13 @@ using namespace Foam;
int main(int argc, char *argv[])
{
timeSelector::addOptions_singleTime(); // Single-time options
argList::addNote
(
"Add point/face/cell Zones from similarly named point/face/cell Sets"
);
timeSelector::addOptions(true, false); // constant(true), zero(false)
argList::addBoolOption
(
"noFlipMap",
@ -75,14 +76,13 @@ int main(int argc, char *argv[])
);
#include "addRegionOption.H"
#include "addTimeOptions.H"
#include "setRootCase.H"
#include "createTime.H"
const bool noFlipMap = args.found("noFlipMap");
// Get times list
(void)timeSelector::selectIfPresent(runTime, args);
// Allow override of time from specified time options, or no-op
timeSelector::setTimeIfPresent(runTime, args);
#include "createNamedPolyMesh.H"

View File

@ -240,9 +240,9 @@ int main(int argc, char *argv[])
// Read set construct info from dictionary
List<namedDictionary> actionEntries(topoSetDict.lookup("actions"));
forAll(timeDirs, timeI)
forAll(timeDirs, timei)
{
runTime.setTime(timeDirs[timeI], timeI);
runTime.setTime(timeDirs[timei], timei);
Info<< "Time = " << runTime.timeName() << endl;
// Optionally re-read mesh

View File

@ -549,16 +549,17 @@ int main(int argc, char *argv[])
{
Info<< finder.dict();
}
else if (finder.ref().isStream())
else if (finder.isStream())
{
bool addSep = false;
bool separator = false;
const tokenList& tokens = finder.ref().stream();
for (const token& tok : tokens)
for (const token& tok : finder.stream())
{
if (addSep) Info<< token::SPACE;
addSep = true;
if (separator)
{
Info<< token::SPACE;
}
separator = true;
Info<< tok;
}
Info<< endl;

View File

@ -173,7 +173,7 @@ namespace Foam
// Uses polyMesh/fvMesh meshSubDir by default
autoPtr<labelIOList> procAddressing
(
const fvMesh& procMesh,
const objectRegistry& procRegistry,
const word& name,
const word& instance,
const word& local = fvMesh::meshSubDir
@ -186,7 +186,7 @@ autoPtr<labelIOList> procAddressing
name,
instance,
local,
procMesh,
procRegistry,
IOobject::MUST_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
@ -199,13 +199,13 @@ autoPtr<labelIOList> procAddressing
// Uses the finiteArea meshSubDir
autoPtr<labelIOList> faProcAddressing
(
const fvMesh& procMesh,
const objectRegistry& procRegistry,
const word& name,
const word& instance,
const word& local = faMesh::meshSubDir
)
{
return procAddressing(procMesh, name, instance, local);
return procAddressing(procRegistry, name, instance, local);
}
@ -797,11 +797,22 @@ int main(int argc, char *argv[])
// Field objects at this time
IOobjectList objects;
IOobjectList faObjects;
if (doDecompFields)
{
// List of volume mesh objects for this instance
objects = IOobjectList(mesh, runTime.timeName());
// List of area mesh objects (assuming single region)
faObjects = IOobjectList
(
mesh.time(),
runTime.timeName(),
faMesh::dbDir(mesh, word::null),
IOobjectOption::NO_REGISTER
);
// Ignore generated fields: (cellDist)
objects.remove("cellDist");
}
@ -810,12 +821,15 @@ int main(int argc, char *argv[])
autoPtr<faMeshDecomposition> faMeshDecompPtr;
if (doFiniteArea)
{
const word boundaryInst =
mesh.time().findInstance(mesh.meshDir(), "boundary");
IOobject io
(
"faBoundary",
mesh.time().findInstance(mesh.meshDir(), "boundary"),
faMesh::meshSubDir,
mesh,
boundaryInst,
faMesh::meshDir(mesh, word::null),
mesh.time(),
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
@ -1225,7 +1239,7 @@ int main(int argc, char *argv[])
if (doDecompFields)
{
areaFieldCache.readAllFields(aMesh, objects);
areaFieldCache.readAllFields(aMesh, faObjects);
}
const label nAreaFields = areaFieldCache.size();
@ -1293,7 +1307,7 @@ int main(int argc, char *argv[])
autoPtr<labelIOList> tfaceProcAddr =
faProcAddressing
(
procFvMesh,
procMesh,
"faceProcAddressing",
runTime.constant()
);
@ -1302,7 +1316,7 @@ int main(int argc, char *argv[])
autoPtr<labelIOList> tboundaryProcAddr =
faProcAddressing
(
procFvMesh,
procMesh,
"boundaryProcAddressing",
runTime.constant()
);
@ -1311,7 +1325,7 @@ int main(int argc, char *argv[])
autoPtr<labelIOList> tedgeProcAddr =
faProcAddressing
(
procFvMesh,
procMesh,
"edgeProcAddressing",
runTime.constant()
);

View File

@ -132,9 +132,6 @@ class domainDecomposition
labelList& elementToZone
);
//- Append single element to list
static void append(labelList&, const label);
//- Add face to inter-processor patch
void addInterProcFace
(

View File

@ -39,14 +39,6 @@ Description
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::domainDecomposition::append(labelList& lst, const label elem)
{
label sz = lst.size();
lst.setSize(sz+1);
lst[sz] = elem;
}
void Foam::domainDecomposition::addInterProcFace
(
const label facei,
@ -354,9 +346,8 @@ void Foam::domainDecomposition::decomposeMesh()
procFaceAddressing_[proci].size();
// Add size as last element to substarts and transfer
append
subPatchStarts[proci][interPatch].append
(
subPatchStarts[proci][interPatch],
curInterPatchFaces[interPatch].size()
);
procProcessorPatchSubPatchIDs_[proci][i].transfer

View File

@ -103,8 +103,8 @@ void Foam::domainDecomposition::processInterCyclics
if (interPatchFaces[proci][interI].size() > oldSz)
{
// Added faces to this interface. Add an entry
append(subPatchIDs[proci][interI], patchi);
append(subPatchStarts[proci][interI], oldSz);
subPatchIDs[proci][interI].append(patchi);
subPatchStarts[proci][interI].append(oldSz);
}
}
}

View File

@ -382,9 +382,25 @@ int main(int argc, char *argv[])
IOobjectList objects
(
procMeshes.meshes()[0],
databases[0].timeName()
databases[0].timeName(),
IOobjectOption::NO_REGISTER
);
IOobjectList faObjects;
if (doFiniteArea && doFields)
{
// List of area mesh objects (assuming single region)
// - scan on processor0
faObjects = IOobjectList
(
procMeshes.meshes()[0],
databases[0].timeName(),
faMesh::dbDir(word::null), // local relative to mesh
IOobjectOption::NO_REGISTER
);
}
if (doFields)
{
// If there are any FV fields, reconstruct them
@ -545,12 +561,12 @@ int main(int argc, char *argv[])
}
else if
(
objects.count<areaScalarField>()
|| objects.count<areaVectorField>()
|| objects.count<areaSphericalTensorField>()
|| objects.count<areaSymmTensorField>()
|| objects.count<areaTensorField>()
|| objects.count<edgeScalarField>()
faObjects.count<areaScalarField>()
|| faObjects.count<areaVectorField>()
|| faObjects.count<areaSphericalTensorField>()
|| faObjects.count<areaSymmTensorField>()
|| faObjects.count<areaTensorField>()
|| faObjects.count<edgeScalarField>()
)
{
Info << "Reconstructing FA fields" << nl << endl;
@ -568,7 +584,7 @@ int main(int argc, char *argv[])
procFaMeshes.boundaryProcAddressing()
);
reconstructor.reconstructAllFields(objects);
reconstructor.reconstructAllFields(faObjects);
}
else
{

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2023 OpenCFD Ltd.
Copyright (C) 2016-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -314,11 +314,7 @@ boundBox procBounds
{
fileName pointsInstance
(
procDb.findInstance
(
polyMesh::meshDir(regionName),
"points"
)
procDb.findInstance(polyMesh::meshDir(regionName), "points")
);
if (pointsInstance != procDb.timeName())
@ -343,11 +339,7 @@ boundBox procBounds
IOobject
(
"points",
procDb.findInstance
(
polyMesh::meshDir(regionName),
"points"
),
pointsInstance,
polyMesh::meshDir(regionName),
procDb,
IOobject::MUST_READ,

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2017 OpenFOAM Foundation
Copyright (C) 2015-2023 OpenCFD Ltd.
Copyright (C) 2015-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -31,6 +31,7 @@ License
#include "Pstream.H"
#include "OSspecific.H"
#include "decomposedBlockData.H"
#include "IFstream.H"
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
@ -161,19 +162,54 @@ Foam::boolList Foam::haveMeshFile
(
handler.filePath(runTime.path()/meshPath/meshFile)
);
bool found = handler.isFile(fName);
if (returnReduceAnd(found)) // worldComm
{
autoPtr<ISstream> isPtr(fileHandler().NewIFstream(fName));
if (isPtr && isPtr->good())
// Bit tricky: avoid having all slaves open file since this involves
// reading it on master and broadcasting it. This fails if file > 2G.
// So instead only read on master
bool isCollated = false;
// Note: can test only world-master. Since even host-collated will have
// same file format type for all processors
if (UPstream::master(UPstream::worldComm))
{
auto& is = *isPtr;
const bool oldParRun = UPstream::parRun(false);
IOobject io(meshFile, meshPath, runTime);
io.readHeader(is);
IFstream is(fName);
if (is.good())
{
IOobject io(meshFile, meshPath, runTime);
io.readHeader(is);
if (decomposedBlockData::isCollatedType(io))
isCollated = decomposedBlockData::isCollatedType(io);
}
UPstream::parRun(oldParRun);
}
Pstream::broadcast(isCollated); //UPstream::worldComm
// Collect block-number in individual filenames (might differ
// on different processors)
if (isCollated)
{
const label nProcs = UPstream::nProcs(fileHandler().comm());
const label myProcNo = UPstream::myProcNo(fileHandler().comm());
// Collect file names on master of local communicator
const fileNameList fNames
(
Pstream::listGatherValues
(
fName,
fileHandler().comm(),
UPstream::msgType()
)
);
// Collect local block number
label myBlockNumber = -1;
{
fileName path, pDir, local;
procRangeType group;
@ -188,7 +224,6 @@ Foam::boolList Foam::haveMeshFile
numProcs
);
label myBlockNumber = 0;
if (proci == -1 && group.empty())
{
// 'processorsXXX' format so contains all ranks
@ -199,12 +234,53 @@ Foam::boolList Foam::haveMeshFile
{
// 'processorsXXX_n-m' format so check for the
// relative rank
myBlockNumber = UPstream::myProcNo(fileHandler().comm());
myBlockNumber = myProcNo;
}
// Check if block for the local rank is inside file
found = decomposedBlockData::hasBlock(is, myBlockNumber);
}
const labelList myBlockNumbers
(
Pstream::listGatherValues
(
myBlockNumber,
fileHandler().comm(),
UPstream::msgType()
)
);
// Determine for all whether the filename exists in the collated
// file.
boolList allFound(nProcs, false);
if (UPstream::master(fileHandler().comm()))
{
// Store nBlocks and index of file that was used for nBlocks
label nBlocks = -1;
label blockRanki = -1;
forAll(fNames, ranki)
{
if
(
blockRanki == -1
|| (fNames[ranki] != fNames[blockRanki])
)
{
blockRanki = ranki;
IFstream is(fNames[ranki]);
nBlocks = decomposedBlockData::getNumBlocks(is);
}
allFound[ranki] = (myBlockNumbers[ranki] < nBlocks);
}
}
found = Pstream::listScatterValues
(
allFound,
fileHandler().comm(),
UPstream::msgType()
);
}
}
#endif

View File

@ -184,7 +184,7 @@ Foam::parLagrangianDistributor::distributeLagrangianPositions
labelListList sendMap;
// Transfer buffers
PstreamBuffers pBufs(UPstream::commsTypes::nonBlocking);
PstreamBuffers pBufs;
{
// List of lists of particles to be transferred for all of the

View File

@ -102,6 +102,7 @@ Usage
#include "faMeshSubset.H"
#include "faMeshTools.H"
#include "faMeshDistributor.H"
#include "faMeshesRegistry.H"
#include "parFaFieldDistributorCache.H"
#include "redistributeLagrangian.H"
@ -906,12 +907,26 @@ autoPtr<mapDistributePolyMesh> redistributeAndWrite
}
// If faMeshesRegistry exists, it is also owned by the polyMesh and will
// be destroyed by clearGeom() in fvMeshDistribute::distribute()
//
// Rescue faMeshesRegistry from destruction by temporarily moving
// it to be locally owned.
std::unique_ptr<faMeshesRegistry> faMeshesRegistry_saved
(
faMeshesRegistry::Release(mesh)
);
// Mesh distribution engine
fvMeshDistribute distributor(mesh);
// Do all the distribution of mesh and fields
autoPtr<mapDistributePolyMesh> distMap = distributor.distribute(decomp);
// Restore ownership onto the polyMesh
faMeshesRegistry::Store(std::move(faMeshesRegistry_saved));
// Print some statistics
InfoOrPout<< "After distribution:" << endl;
printMeshData(mesh);
@ -1598,7 +1613,8 @@ int main(int argc, char *argv[])
);
const fileName areaMeshSubDir
(
polyMesh::regionName(regionName) / faMesh::meshSubDir
// Assume single-region area mesh
faMesh::meshDir(regionName, word::null)
);
InfoOrPout
@ -2501,7 +2517,8 @@ int main(int argc, char *argv[])
);
const fileName areaMeshSubDir
(
polyMesh::regionName(regionName) / faMesh::meshSubDir
// Assume single-region area mesh
faMesh::meshDir(regionName, word::null)
);
InfoOrPout

View File

@ -21,29 +21,38 @@ Requires
// Initially all possible objects that are available at the final time
List<wordHashSet> availableRegionObjectNames(meshes.size());
List<wordHashSet> availableFaRegionObjectNames(meshes.size());
forAll(meshes, regioni)
{
const auto& mesh = meshes[regioni];
IOobjectList objects(0);
IOobjectList objects;
IOobjectList faObjects;
if (doConvertFields && !timeDirs.empty())
{
// List of volume mesh objects for this instance
objects = IOobjectList(mesh, timeDirs.back().name());
if (fieldSelector && !fieldSelector().empty())
{
objects.filterObjects(fieldSelector());
}
// List of area mesh objects (assuming single region)
faObjects = IOobjectList
(
mesh.time(),
timeDirs.back().name(),
faMesh::dbDir(mesh, word::null),
IOobjectOption::NO_REGISTER
);
if (fieldSelector && !fieldSelector().empty())
{
objects.filterObjects(fieldSelector());
faObjects.filterObjects(fieldSelector());
}
// Remove "*_0" restart fields
objects.prune_0();
faObjects.prune_0();
if (!doPointValues)
{
@ -59,12 +68,38 @@ forAll(meshes, regioni)
}
}
wordList objectNames(objects.sortedNames());
// Volume fields
if (!objects.empty())
{
wordList objectNames(objects.sortedNames());
// Check availability for all times...
checkData(mesh, timeDirs, objectNames);
// Check availability for all times...
checkData
(
mesh.thisDb(),
timeDirs,
objectNames
);
availableRegionObjectNames[regioni] = objectNames;
availableRegionObjectNames[regioni] = objectNames;
}
// Area fields
if (!faObjects.empty())
{
wordList objectNames(faObjects.sortedNames());
// Check availability for all times... (assuming single region)
checkData
(
mesh.time(),
timeDirs,
objectNames,
faMesh::dbDir(mesh, word::null)
);
availableFaRegionObjectNames[regioni] = objectNames;
}
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2021 OpenCFD Ltd.
Copyright (C) 2021-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -14,6 +14,8 @@ Description
Code chunk for converting area fields
included by foamToEnsight.
Possible objects to convert are given in faObjects
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -23,7 +25,7 @@ if (doFiniteArea && ensFaCasePtr && ensFaMeshPtr)
{
Info<< " area field (";
writeAllAreaFields(*ensFaCasePtr, *ensFaMeshPtr, objects);
writeAllAreaFields(*ensFaCasePtr, *ensFaMeshPtr, faObjects);
Info<< " )" << nl;
}

View File

@ -554,7 +554,8 @@ int main(int argc, char *argv[])
{
autoPtr<ensightGeoFile> os =
ensCase.newGeometry(hasMovingMesh);
ensMesh.write(os);
ensMesh.write(os.ref());
}
// finite-area
@ -562,7 +563,8 @@ int main(int argc, char *argv[])
{
autoPtr<ensightGeoFile> os =
ensFaCasePtr->newGeometry(hasMovingMesh);
ensFaMeshPtr->write(os);
ensFaMeshPtr->write(os.ref());
}
}
@ -577,6 +579,20 @@ int main(int argc, char *argv[])
// Volume, internal, point fields
#include "convertVolumeFields.H"
// The finite-area objects at this time
IOobjectList faObjects;
if (ensFaMeshPtr)
{
faObjects =
IOobjectList(ensFaMeshPtr->mesh(), runTime.timeName());
faObjects.filterObjects
(
availableFaRegionObjectNames[regioni]
);
}
// The finiteArea fields
#include "convertAreaFields.H"

View File

@ -55,7 +55,7 @@ label timeIndex = 0;
else
{
goodTimeIndex = false;
Info<< "skip ... missing entry " << io.objectPath() << endl;
Info<< "skip ... missing file: " << io.objectRelPath() << endl;
}
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2022 OpenCFD Ltd.
Copyright (C) 2018-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -32,9 +32,10 @@ License
Foam::label Foam::checkData
(
const fvMesh& mesh,
const objectRegistry& obr,
const instantList& timeDirs,
wordList& objectNames
wordList& objectNames,
const fileName& local
)
{
// Assume prune_0() was used prior to calling this
@ -43,6 +44,9 @@ Foam::label Foam::checkData
for (const word& fieldName : objectNames)
{
// // If prune_0() not previously used...
// if (objectNames.ends_with("_0")) continue;
bool good = false;
for (const instant& inst : timeDirs)
@ -52,7 +56,8 @@ Foam::label Foam::checkData
(
fieldName,
inst.name(),
mesh,
local,
obr,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER

View File

@ -164,9 +164,10 @@ tmp<VolumeField<Type>> makeZeroGradientField
// ignore fields that are not available for all time-steps
label checkData
(
const fvMesh& mesh,
const objectRegistry& obr,
const instantList& timeDirs,
wordList& objectNames
wordList& objectNames,
const fileName& local = fileName::null
);

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
Copyright (C) 2023-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -36,6 +36,7 @@ Description
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "timeSelector.H"
#include "fvMesh.H"
#include "volFields.H"
#include "pointFields.H"
@ -145,20 +146,22 @@ void ReadAndMapFields
int main(int argc, char *argv[])
{
argList::noFunctionObjects(); // Never use function objects
timeSelector::addOptions_singleTime(); // Single-time options
argList::addNote
(
"Convert polyMesh results to tetDualMesh"
);
#include "addOverwriteOption.H"
#include "addTimeOptions.H"
#include "setRootCase.H"
#include "createTime.H"
// Get times list
instantList Times = runTime.times();
#include "checkTimeOptions.H"
runTime.setTime(Times[startTime], startTime);
// Set time from specified time options, or force start from Time=0
timeSelector::setTimeIfPresent(runTime, args, true);
// Read the mesh
#include "createNamedMesh.H"

View File

@ -29,7 +29,7 @@ if (doFiniteArea)
autoPtr<faMesh> faMeshPtr;
const label nAreaFields =
objects.count(stringListOps::foundOp<word>(fieldTypes::area));
faObjects.count(stringListOps::foundOp<word>(fieldTypes::area));
if (nAreaFields || withMeshIds)
{
@ -40,7 +40,7 @@ if (doFiniteArea)
{
const faMesh& areaMesh = faMeshPtr();
reportFields::area(Info, objects);
reportFields::area(Info, faObjects);
const auto& pp = faMeshPtr->patch();
@ -97,7 +97,7 @@ if (doFiniteArea)
(
writer,
areaMesh,
objects,
faObjects,
true // syncPar
);

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2022 OpenCFD Ltd.
Copyright (C) 2016-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -141,7 +141,7 @@ Note
#include "pointSet.H"
#include "HashOps.H"
#include "regionProperties.H"
#include "stringListOps.H"
#include "stringListOps.H" // For stringListOps::findMatching()
#include "Cloud.H"
#include "readFields.H"
@ -780,21 +780,34 @@ int main(int argc, char *argv[])
}
}
IOobjectList objects(0);
IOobjectList objects;
IOobjectList faObjects;
if (doConvertFields)
{
// List of objects for this time
// List of volume mesh objects for this instance
objects =
IOobjectList(meshProxy.baseMesh(), runTime.timeName());
// List of area mesh objects (assuming single region)
faObjects =
IOobjectList
(
runTime,
runTime.timeName(),
faMesh::dbDir(meshProxy.baseMesh(), word::null),
IOobjectOption::NO_REGISTER
);
if (fieldSelector && !fieldSelector().empty())
{
objects.filterObjects(fieldSelector());
faObjects.filterObjects(fieldSelector());
}
// Remove "*_0" restart fields
objects.prune_0();
faObjects.prune_0();
if (!doPointValues)
{

View File

@ -353,7 +353,7 @@ int main(int argc, char *argv[])
#include "createTime.H"
runTime.setTime(instant(runTime.constant()), 0);
runTime.setTime(instant(0, runTime.constant()), 0);
#include "createNamedMesh.H"

View File

@ -106,7 +106,7 @@ int main(int argc, char *argv[])
}
runTime.setTime(instant(runTime.constant()), 0);
runTime.setTime(instant(0, runTime.constant()), 0);
#include "createNamedMesh.H"

View File

@ -80,7 +80,6 @@ Usage
#include "IOobjectList.H"
#include "IOPtrList.H"
#include "volFields.H"
#include "stringListOps.H"
#include "timeSelector.H"
using namespace Foam;
@ -189,7 +188,7 @@ labelList findMatches
const HashTable<wordList>& shortcuts,
const wordList& shortcutNames,
const wordList& thisKeys,
const keyType& key
const wordRe& key
)
{
labelList matches;
@ -197,20 +196,20 @@ labelList findMatches
if (key.isPattern())
{
// Wildcard match
matches = findStrings(key, thisKeys);
matches = wordRes::matching(key, thisKeys);
}
else if (shortcuts.size())
{
// See if patchGroups expand to valid thisKeys
labelList indices = findStrings(key, shortcutNames);
labelList indices = wordRes::matching(key, shortcutNames);
for (const label idx : indices)
{
const word& name = shortcutNames[idx];
const wordList& keys = shortcuts[name];
forAll(keys, j)
for (const word& k : keys)
{
const label index = thisKeys.find(keys[j]);
const label index = thisKeys.find(k);
if (index != -1)
{
matches.append(index);

View File

@ -26,8 +26,8 @@ License
\*---------------------------------------------------------------------------*/
#ifndef MapConsistentVolFields_H
#define MapConsistentVolFields_H
#ifndef Foam_MapConsistentVolFields_H
#define Foam_MapConsistentVolFields_H
#include "GeometricField.H"
#include "meshToMesh.H"
@ -41,48 +41,42 @@ namespace Foam
template<class Type>
void evaluateConstraintTypes(GeometricField<Type, fvPatchField, volMesh>& fld)
{
auto& fldBf = fld.boundaryFieldRef();
auto& bfld = fld.boundaryFieldRef();
const UPstream::commsTypes commsType = UPstream::defaultCommsType;
const label startOfRequests = UPstream::nRequests();
if
(
commsType == UPstream::commsTypes::blocking
commsType == UPstream::commsTypes::buffered
|| commsType == UPstream::commsTypes::nonBlocking
)
{
forAll(fldBf, patchi)
{
fvPatchField<Type>& tgtField = fldBf[patchi];
const label startOfRequests = UPstream::nRequests();
for (auto& pfld : bfld)
{
if
(
tgtField.type() == tgtField.patch().patch().type()
&& polyPatch::constraintType(tgtField.patch().patch().type())
pfld.type() == pfld.patch().patch().type()
&& polyPatch::constraintType(pfld.patch().patch().type())
)
{
tgtField.initEvaluate(commsType);
pfld.initEvaluate(commsType);
}
}
// Wait for outstanding requests
if (commsType == UPstream::commsTypes::nonBlocking)
{
UPstream::waitRequests(startOfRequests);
}
// Wait for outstanding requests (non-blocking)
UPstream::waitRequests(startOfRequests);
forAll(fldBf, patchi)
for (auto& pfld : bfld)
{
fvPatchField<Type>& tgtField = fldBf[patchi];
if
(
tgtField.type() == tgtField.patch().patch().type()
&& polyPatch::constraintType(tgtField.patch().patch().type())
pfld.type() == pfld.patch().patch().type()
&& polyPatch::constraintType(pfld.patch().patch().type())
)
{
tgtField.evaluate(commsType);
pfld.evaluate(commsType);
}
}
}
@ -94,22 +88,21 @@ void evaluateConstraintTypes(GeometricField<Type, fvPatchField, volMesh>& fld)
for (const auto& schedEval : patchSchedule)
{
const label patchi = schedEval.patch;
fvPatchField<Type>& tgtField = fldBf[patchi];
auto& pfld = bfld[patchi];
if
(
tgtField.type() == tgtField.patch().patch().type()
&& polyPatch::constraintType(tgtField.patch().patch().type())
pfld.type() == pfld.patch().patch().type()
&& polyPatch::constraintType(pfld.patch().patch().type())
)
{
if (schedEval.init)
{
tgtField.initEvaluate(commsType);
pfld.initEvaluate(commsType);
}
else
{
tgtField.evaluate(commsType);
pfld.evaluate(commsType);
}
}
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 DHI
Copyright (C) 2017-2020 OpenCFD Ltd.
Copyright (C) 2017-2024 OpenCFD Ltd.
Copyright (C) 2017-2020 German Aerospace Center (DLR)
Copyright (C) 2020 Johan Roenby
-------------------------------------------------------------------------------
@ -39,6 +39,7 @@ Description
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "timeSelector.H"
#include "triSurface.H"
#include "triSurfaceTools.H"
@ -139,6 +140,10 @@ void setAlpha
int main(int argc, char *argv[])
{
argList::noFunctionObjects(); // Never use function objects
timeSelector::addOptions_singleTime(); // Single-time options
argList::addNote
(
"Uses cutCellIso to create a volume fraction field from an "
@ -151,9 +156,14 @@ int main(int argc, char *argv[])
"file",
"Alternative setAlphaFieldDict dictionary"
);
#include "addRegionOption.H"
#include "setRootCase.H"
#include "createTime.H"
// Set time from specified time options, or no-op
timeSelector::setTimeIfPresent(runTime, args);
#include "createNamedMesh.H"
const word dictName("setAlphaFieldDict");

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2022-2023 OpenCFD Ltd.
Copyright (C) 2022-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -36,6 +36,7 @@ Description
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "timeSelector.H"
#include "Time.H"
#include "fvMesh.H"
#include "faMesh.H"
@ -656,6 +657,10 @@ struct setAreaField
int main(int argc, char *argv[])
{
argList::noFunctionObjects(); // Never use function objects
timeSelector::addOptions_singleTime(); // Single-time options
argList::addNote
(
"Set values on a selected set of cells/patch-faces via a dictionary"
@ -670,8 +675,15 @@ int main(int argc, char *argv[])
);
#include "addRegionOption.H"
// -------------------------
#include "setRootCase.H"
#include "createTime.H"
// Set time from specified time options, or no-op
timeSelector::setTimeIfPresent(runTime, args);
#include "createNamedMesh.H"
autoPtr<faMesh> faMeshPtr;

View File

@ -51,6 +51,7 @@ Description
#include "emptyPolyPatch.H"
#include "processorPolyPatch.H"
#include "ListListOps.H"
#include "stringListOps.H" // For stringListOps::findMatching()
#include "indirectPrimitivePatch.H"
#include "globalMeshData.H"
#include "globalIndex.H"

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2014 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
Copyright (C) 2020-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -294,7 +294,7 @@ bool Foam::searchableSurfaceModifiers::cut::modify
// Find the surfaces to cut with
for (const wordRe& cutterName : cutterNames_)
{
labelList geomIDs = findStrings(cutterName, geometry_.names());
labelList geomIDs = wordRes::matching(cutterName, geometry_.names());
for (const label geomI : geomIDs)
{

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2013 OpenFOAM Foundation
Copyright (C) 2015-2022 OpenCFD Ltd.
Copyright (C) 2015-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -130,9 +130,14 @@ int main(int argc, char *argv[])
for (const entry& e : regionsDict)
{
const keyType& regionName = e.keyword();
const wordRe regionName(e.keyword());
const dictionary& regionDict = e.dict();
labelList regionIDs
(
wordRes::matching(regionName, surf.regions())
);
autoPtr<searchableSurfaceModifier> modifier
(
searchableSurfaceModifier::New
@ -143,9 +148,6 @@ int main(int argc, char *argv[])
)
);
labelList regionIDs =
findStrings(regionName, surf.regions());
if (modifier().modify(regionIDs, surf))
{
changed = true;

View File

@ -56,7 +56,7 @@ Usage
#include "argList.H"
#include "MeshedSurfaces.H"
#include "stringListOps.H"
#include "stringListOps.H" // For stringListOps::findMatching()
#include "geometricSurfacePatch.H"
using namespace Foam;

View File

@ -210,7 +210,7 @@ reportExecutable()
{
APP_NAME="$1"
APP_SPEC="$2"
APP_PATH="$(findExec $PATH $1)"
APP_PATH="$(findExec "$PATH" "$1")"
VERSION="unknown"
if [ -z "$APP_PATH" ]

322
bin/foamUpgradeFiniteArea Executable file
View File

@ -0,0 +1,322 @@
#!/bin/bash
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2023-2024 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# Script
# foamUpgradeFiniteArea
#
# Description
# Relocate finite-area files to new sub-directory locations
#
#------------------------------------------------------------------------------
printHelp() {
cat <<USAGE
Usage: ${0##*/} [OPTION]
options:
-case=DIR Specify starting directory, default is cwd
-dry-run | -n Test without performing actions
-verbose | -v Additional verbosity
-force (currently ignored)
-link-back Link back from new finite-area/ to old locations
-no-mesh Do not move system/faMeshDefinition
-git Use 'git mv' when making changes
-help Print help and exit
Relocate finite-area files to new sub-directory locations
Equivalent options:
| -case=DIR | -case DIR |
USAGE
exit 0 # A clean exit
}
# Report error and exit
die()
{
exec 1>&2
echo
echo "Error encountered:"
while [ "$#" -ge 1 ]; do echo " $1"; shift; done
echo
echo "See '${0##*/} -help' for usage"
echo
exit 1
}
#------------------------------------------------------------------------------
# Parse options
unset caseDir optDryRun optGit optVerbose optLink optMeshDef hadError
while [ "$#" -gt 0 ]
do
case "$1" in
(- | --)
shift
break # Stop option parsing
;;
(-h | -help*) printHelp ;;
(-n | -dry-run) optDryRun="(dry-run) " ;;
(-v | -verbose) optVerbose=true ;;
(-f | -force) echo "Ignored option: ${1%%=*}" 1>&2 ;;
(-link-back) optLink=back ;;
# (-link-only) optLink=forward ;;
(-no-mesh) optMeshDef=false ;;
(-git) optGit=true ;;
(-case=*)
caseDir="${1#*=}"
;;
(-case)
caseDir="$2"
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
shift
;;
(-*) die "unknown option: $1" ;;
(*) die "unknown argument: $1" ;;
esac
shift
done
if [ -n "$caseDir" ]
then
cd "$caseDir" 2>/dev/null || {
echo "${0##*/}: No such directory $caseDir" 1>&2
exit 2
}
fi
#------------------------------------------------------------------------------
# Proper umask
umask 022
# The commands
copy_cmd="cp -a${optVerbose:+ -v}"
move_cmd="mv${optVerbose:+ -v}"
link_cmd="ln -sf${optVerbose:+ -v}"
mkdir_cmd="mkdir -p"
if [ -n "$optDryRun" ]
then
if [ -n "$optVerbose" ]
then
copy_cmd="echo cp -a"
move_cmd="echo mv"
link_cmd="echo ln -sf"
mkdir_cmd="echo mkdir -p"
else
copy_cmd=true
move_cmd=true
link_cmd=true
mkdir_cmd=true
fi
elif [ -n "$optGit" ]
then
move_cmd="git mv"
link_cmd="echo no symlink for git:"
fi
regionDir="finite-area"
#------------------------------------------------------------------------------
# Various script parts
#
# awk : scan file for FoamFile { ... class NAME; }
read -d '' getClass_awk << 'AWK_CONTENT'
BEGIN { state = 0 } # 0=begin, 1=header, 2=done
/FoamFile/ { if (!state) { state = 1; next; } exit; }
# FoamFile begin contents
/\{/ { if (state == 1) state = 2; next; }
# FoamFile end contents
/\}/ { if (state == 2) exit; next; }
/^[ ]*class[ ]/ {
if (state == 2)
{
sub("^[ ]*class[ ]+", "")
sub("[ ;]*$", "")
print
exit
}
next
}
AWK_CONTENT
# Check for FoamFile and return extracted 'class'
getFoamFile_class()
{
local file="$1"
local class
if grep -q FoamFile "$file" 2>/dev/null
then
# class="$(foamDictionary -disableFunctionEntries -entry FoamFile/class -value "$file" 2> stderr)"
class="$(awk -- "$getClass_awk" "$file")"
fi
echo "$class"
}
# Check if class corresponds to an finite-area field
# eg, areaScalarField, ... edgeVectorField
isAreaFieldClass()
{
case "$1" in
(area*Field | edge*Field) return 0 ;;
esac
return 1
}
#------------------------------------------------------------------------------
#Debug# getFoamFile_class "system/faSchemes"
#------------------------------------------------------------------------------
# Link back from the local finite-area/ directory to the current directory
# variables
# - regionDir = "finite-area"
#
performLinkBack()
{
local file
if [ -d "$regionDir" ]
then
find "$regionDir" -maxdepth 1 -type f 2>/dev/null | while read file
do
file="${file#*/}"
if [ -f "$regionDir/$file" ] && [ ! -f "$file" ]
then
echo "${optDryRun} ln -s $regionDir/$file $file" 1>&2
$link_cmd "$regionDir/$file" "$file"
fi
done
fi
}
# Move from current directory to local finite-area/ directory
# variables
# - regionDir = "finite-area"
#
performMove()
{
local file="$1"
if [ -f "$regionDir/$file" ]
then
echo "${optDryRun} already: $regionDir/$file" 1>&2
elif [ -f "$file" ]
then
$mkdir_cmd "$regionDir"
echo "${optDryRun} mv $file -> $regionDir/" 1>&2
$move_cmd "$file" "$regionDir/$file"
elif [ -n "$file" ]
then
echo "${optDryRun} no $file" 1>&2
fi
}
#------------------------------------------------------------------------------
# system
# ----
if [ -d system ]
then
(
cd system || exit
currDir="system"
echo "${optDryRun}Examining files in $currDir/" 1>&2
performMove faSchemes
performMove faSolution
if [ "$optMeshDef" = false ]
then
echo "${optDryRun} ignore: faMeshDefinition" 1>&2
else
performMove faMeshDefinition
fi
if [ -d "$regionDir" ] && [ "$optLink" = back ]
then
performLinkBack
fi
)
else
echo "${optDryRun}No system/ directory..." 1>&2
fi
#------------------------------------------------------------------------------
# time dirs (initial conditions)
# ----
for timeDir in 0 0.orig
do
if [ -d "$timeDir" ]
then
(
cd "$timeDir" || exit
currDir="$timeDir"
echo "${optDryRun}Examining $currDir/" 1>&2
find . -maxdepth 1 -type f | while read file
do
file="${file#*/}"
case "$file" in
(*.gz)
echo "${optDryRun} ignoring compressed file: $file" 1>&2
continue
;;
esac
className="$(getFoamFile_class "$file")"
if isAreaFieldClass "$className"
then
performMove "$file"
fi
done
if [ -d "$regionDir" ] && [ "$optLink" = back ]
then
performLinkBack
fi
)
else
echo "${optDryRun}No $timeDir/ directory..." 1>&2
fi
done
#------------------------------------------------------------------------------

View File

@ -6,7 +6,7 @@
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2015-2023 OpenCFD Ltd.
# Copyright (C) 2015-2024 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -501,9 +501,9 @@ cloneParallelCase()
}
# Overwrite 0/ with the contents of 0.orig/ if it exists.
# The -processor option to do the processor directories instead
#
# If 0.orig/ exists, copy (overwrite) into 0/ [ie, serial case]
# * -processor : copy into processor directories instead
# * -all : copy into serial and processor directories
restore0Dir()
{
if [ ! -d 0.orig ]
@ -513,35 +513,27 @@ restore0Dir()
fi
case "$1" in
-proc | -processor | -processors)
echo "Restore 0/ from 0.orig/ [processor directories]"
(-all | -proc | -processor*)
if [ "$1" = "-all" ]
then
echo "Restore 0/ from 0.orig/ [serial/processor dirs]" 1>&2
\rm -rf 0
\cp -r 0.orig 0 2>/dev/null
else
echo "Restore 0/ from 0.orig/ [processor dirs]" 1>&2
fi
\ls -d processor* | xargs -I {} \rm -rf ./{}/0
\ls -d processor* | xargs -I {} \cp -r 0.orig ./{}/0 > /dev/null 2>&1
# Remove '#include' directives from field dictionaries
# for collated format
if [ "$1" = "-processors" ]
then
(
echo "Filter #include directives in processors/0:"
\cd processors/0 2>/dev/null || exit 0
for file in $(grep -l "#include" * 2>/dev/null)
do
foamDictionary "$file" > "$file.$$." && mv "$file.$$." "$file"
echo " $file"
done | tr -d '\n'
echo
)
fi
;;
*)
echo "Restore 0/ from 0.orig/"
(*)
echo "Restore 0/ from 0.orig/" 1>&2
\rm -rf 0
\cp -r 0.orig 0 2>/dev/null
;;
esac
return 0
}

View File

@ -43,6 +43,10 @@ cellSet_doc
sets (c1 c2);
// or
set c1;
// or
zones (c1Zone c2Zone);
// or
zone c1Zone;
}
@ -62,6 +66,10 @@ cellSet_doc
sets (f0 f1);
// or
set f0; // Name of faceSet
// or
zones (f0Zone f1Zone);
// or
zone f0Zone;
//- selection option (mandatory)
option any; // cell with any face in faceSet
@ -127,6 +135,10 @@ cellSet_doc
sets (p0 p1);
// or
sets p0;
// or
zones (p0Zone p1Zone);
// or
zone p0Zone;
option any; // cell with any point in pointSet
//option edge; // cell with an edge with both points in pointSet
@ -254,6 +266,10 @@ faceSet_doc
sets (c0 c1);
// or
set c0; // Name of cellSet
// or
zones (c0Zone c1Zone);
// or
zone c0Zone;
option all; // All faces of cells
//option both; // Only faces with owner+neighbour in cellSet
@ -310,6 +326,10 @@ faceSet_doc
sets (p0 p1);
// or
set p0; // Name of pointSet
// or
zones (p0Zone p1Zone);
// or
zone p0Zone;
option any; // Faces using any point in pointSet
//option all // Faces with all points in pointSet
@ -399,6 +419,10 @@ pointSet_doc
sets (c1 c2);
// or
set c1;
// or
zones (c1Zone c2Zone);
// or
zone c1Zone;
option all; // all points of cell
}
@ -421,6 +445,10 @@ pointSet_doc
sets (f1 f2);
// or
set f1;
// or
zones (f1Zone f2Zone);
// or
zone f1Zone;
option all; // all points of face
}
@ -446,6 +474,10 @@ pointSet_doc
sets (p1 p2);
// or
set p1;
// or
zones (p1Zone p2Zone);
// or
zone p1Zone;
}

View File

@ -1,7 +1,7 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2312 |
| \\ / O peration | Version: v2406 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
@ -132,7 +132,7 @@ OptimisationSwitches
// MPI/Parallel settings
// =====================
// Default communication type (nonBlocking | scheduled | blocking);
// Default communication type (nonBlocking | scheduled | buffered)
commsType nonBlocking;
// Transfer double as float for processor boundaries. Mostly defunct.
@ -146,13 +146,18 @@ OptimisationSwitches
// The default and minimum is (20000000).
mpiBufferSize 0;
// Optional max size (bytes) for unstructured data exchanges. In some
// phases of OpenFOAM it can send over very large data chunks
// Optional max size (bytes) for unstructured data exchanges.
// In some phases of OpenFOAM it can send over very large data chunks
// (e.g. in parallel load balancing) and some MPI implementations have
// problems with this. Setting this variable > 0 indicates that the
// data exchange needs to be done in multiple passes, each of maxCommsSize.
// This is not switched on by default since it requires an additional
// global reduction, even if multi-pass is not needed)
// problems with this.
//
// This tuning parameter specifies the max number of bytes before
// switching to a multi-pass send/recv
// (currently only affects PstreamBuffers exchanges).
//
// 0 : disabled
// >0 : limit exchanges to specified number of bytes
// <0 : limit exchanges to INT_MAX minus specified number of bytes
maxCommsSize 0;
// Optional (experimental) feature in lduMatrixUpdate

Some files were not shown because too many files have changed in this diff Show More