Compare commits

...

96 Commits

Author SHA1 Message Date
a9c757f1ff ENH: InterfaceCompositionModels: add new thermo types for kineticGasEvaporation 2022-11-10 11:58:11 +00:00
8c0679d25f BUG: Lagrangian: sync IO call. Fixes #2627 2022-11-09 15:31:20 +00:00
6c6c8c5008 BUG: distributedTriSurfaceMesh: locally empty surface. Fixes #2612 2022-11-09 08:55:06 +00:00
7fa4f1ef76 Merge branch 'feature-mpi-updates' into 'develop'
More consistent use of combineReduce, simpler and/or reductions

See merge request Development/openfoam!566
2022-11-08 16:48:21 +00:00
5b29ff0e42 ENH: consolidate 'formatOptions' handling for coordSetWriter/surfaceWriter
- replaced ad hoc handling of formatOptions with coordSetWriter and
  surfaceWriter helpers.

  Accompanying this change, it is now possible to specify "default"
  settings to be inherited, format-specific settings and have a
  similar layering with surface-specific overrides.

- snappyHexMesh now conforms to setFormats

  Eg,

      formatOptions
      {
          default
          {
              verbose     true;
              format      binary;
          }
          vtk
          {
              precision   10;
          }
     }

     surfaces
     {
         surf1
         {
             ...

             formatOptions
             {
                 ensight
                 {
                     scale   1000;
                 }
             }
         }
     }
2022-11-08 16:48:08 +00:00
b7592c1ee8 ENH: preserve globalIndex merge information within mergedSurf
- for later reuse with fields (for example)

ENH: use 'scheduled' for surfaceWriter field merging (#2402)

- in tests with merging fields (surfaceWriter), 'scheduled' was
  generally faster than 'nonBlocking' for scalars, minorly faster for
  vectors.
  Thus make 'scheduled' the default for the surfaceWriter but with a
  user-option to adjust as required. Previously simply relied on
  whichever default globalIndex had (currently nonBlocking).

  Reuse globalIndex information from mergedSurf instead of
  globalIndex::gatherOp to avoid an extra MPI call to gather sizes
  each time.

  These changes will not be noticable unless surface sampling is done
  very frequently (eg, every iteration) and with large core counts.
2022-11-08 16:48:08 +00:00
799d247142 ENH: PatchTools::gatherAndMerge with recovery of the globalIndex
- support globalIndex for points/faces as an output parameter,
  which allows reuse in subsequent field merge operations.

- make pointMergeMap an optional parameter. This information is not
  always required. Eg, if only using gatherAndMerge to combine faces
  but without any point fields.

ENH: make globalIndex() noexcept, add globalIndex::clear() method
2022-11-08 16:48:08 +00:00
70208a7399 ENH: use returnReduceAnd(), returnReduceOr() functions
DOC: document which MPI send/recv are associated with commType
2022-11-08 16:48:08 +00:00
473e14418a ENH: more consistent use of broadcast, combineReduce etc.
- broadcast           : (replaces scatter)
  - combineReduce       == combineGather + broadcast
  - listCombineReduce   == listCombineGather + broadcast
  - mapCombineReduce    == mapCombineGather + broadcast
  - allGatherList       == gatherList + scatterList

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

    - combineReduce       (2206: combineAllGather)
    - listCombineReduce   (2206: listCombineAllGather)
    - mapCombineReduce    (2206: mapCombineAllGather)
2022-11-08 16:48:08 +00:00
b9c15b8585 COMP: missing linkage for ensightToFoam (ldd linker) 2022-11-08 17:13:46 +01:00
18216a4639 BUG: zoneMotion: supply optional coeffs dict. Fixes #2630 2022-11-08 12:38:44 +00:00
99780bd7cd Merge branch 'feature-ensightToFoam' into 'develop'
ENH: ensightToFoam: Ensight Gold mesh converter

See merge request Development/openfoam!567
2022-11-07 21:26:37 +00:00
5163e52974 ENH: ensightToFoam: Ensight Gold mesh converter 2022-11-07 21:22:18 +00:00
35aa6140cc Merge branch 'feature-grey-area-turbulence' into 'develop'
Integration of grey area turbulence models from Upstream CFD

See merge request Development/openfoam!560
2022-11-07 11:33:31 +00:00
e510321a26 TUT: wallMountedHump: new DES tutorial 2022-11-07 10:59:18 +00:00
3a4537abc9 STYLE: various simplifications and changes
BUG: DEShybrid: reintroduce e28bed59
2022-11-07 10:59:18 +00:00
493bfdbdc4 ENH: DEShybrid - code refactoring/simplification 2022-11-07 10:59:18 +00:00
32507b3251 TUT: vortexShed case - added turbulenceFields example 2022-11-07 10:59:18 +00:00
81f783286c ENH: turbulenceFields FO - added LESRegion and DES shielding function, fd 2022-11-07 10:59:18 +00:00
7db69fc22e ENH: DES models - added access function for shielding function, fd 2022-11-07 10:59:18 +00:00
9557cde880 STYLE: Minor code formatting 2022-11-07 10:59:18 +00:00
c039a09e71 ENH: DEShybrid - restored inputs for backwards compatibility 2022-11-07 10:59:17 +00:00
e0f3993045 ENH: scalar - added readOrDefault(is, defaultValue) function 2022-11-07 10:59:17 +00:00
12ba22bebf ENH: DESModel - stabilisation of Ssigma function
- Code supplied by Marian Fuchs, Upstream CFD GmbH
2022-11-07 10:59:17 +00:00
07a9ee86f3 ENH: Code refactoring 2022-11-07 10:59:17 +00:00
9563607e01 ENH: Turbulence IDDES models - added option to switch fe term in dTilda calc
Default is fe = true, yielding the original form given be Shur (2008)
2022-11-07 10:59:17 +00:00
5b1c060e9e ENH: kOmegaSSTDES - added convenience functions for RAS|LES length scales 2022-11-07 10:59:17 +00:00
53397e6f3f ENH: Added deprecation warnings for SpalartAllmaras and kOmegaSST DES variants 2022-11-07 10:59:17 +00:00
67ba5acf18 ENH: Spalart-Allmaras model - added user switch for ft2 term (default = off) 2022-11-07 10:59:17 +00:00
e5cf96b0f9 INT: Integration of Upstream CFD's SLADelta - use hmaxPtr
- Initial code supplied by Marian Fuchs, Upstream CFD GmbH
- Code cleaned/refactored/integrated by OpenCFD
2022-11-07 10:59:17 +00:00
62f37b2a43 INT: Integration of Upstream CFD's sigma LES model
- Initial code supplied by Marian Fuchs, Upstream CFD GmbH
- Code cleaned/refactored/integrated by OpenCFD
2022-11-07 10:59:17 +00:00
619ddc2355 INT: Integration of Upstream CFD's DeltaOmegaTilde delta function
- Initial code supplied by Marian Fuchs, Upstream CFD GmbH
- Code cleaned/refactored/integrated by OpenCFD
2022-11-07 10:59:17 +00:00
4fc34c8a63 INT: Integration of Upstream CFD's DESHybrid updates
- Initial code supplied by Marian Fuchs, Upstream CFD GmbH
- Code cleaned/refactored/integrated by OpenCFD
2022-11-07 10:59:17 +00:00
2cc96ad7f4 INT: Integration of Upstream CFD's grey-area sigma into kOmegaSST models
- Initial code supplied by Marian Fuchs, Upstream CFD GmbH
- Code cleaned/refactored/integrated by OpenCFD
2022-11-07 10:59:17 +00:00
541b6eb28a INT: integration of Upstream CFD's grey-area sigma into S-A models
- Initial code supplied by Marian Fuchs, Upstream CFD GmbH
- Code cleaned/refactored/integrated by OpenCFD
2022-11-07 10:59:17 +00:00
10b724b10d INT: integration of Upstream CFD's grey-area sigma into base DESModel
- Initial code supplied by Marian Fuchs, Upstream CFD GmbH
- Code cleaned/refactored/integrated by OpenCFD
2022-11-07 10:59:17 +00:00
d2f2ab6d25 ENH: kOmegaSST - code refactoring and clean-up 2022-11-07 10:59:16 +00:00
b92fbd8f73 ENH: Refactored Spalart-Allmaras turbulence models
- Added a new S-A base class: SpalartAllmarasBase
- RAS and DES models derived from new base class
- Removed code duplication
2022-11-07 10:59:16 +00:00
3c214e99df ENH: propellerInfo - protection against Uref = 0 2022-11-03 09:43:39 +00:00
913c45afff ENH: faMatrix - added dot operator functions 2022-11-03 09:43:39 +00:00
fc19ca39f3 BUG: integratedNonUniformTable: correct offsets (fixes #2614) 2022-11-01 14:47:08 +00:00
2202995f5c ENH: expose IntRange {begin,end}_value() methods
- end_value() corresponds to the infrequently used after() method, but
  with naming that corresponds better to iterator naming conventions.

  Eg,

     List<Type> list = ...;
     labelRange range = ...;

     std::transform
     (
         (list.data() + range.begin_value()),
         (list.data() + range.end_value()),

         outIter,
         op
     );

- promote min()/max() methods from labelRange to IntRange base class

STYLE: change timeSelector from "is-a" to "has-a" scalarRanges.
2022-10-31 18:36:15 +01:00
21f037e3a0 ENH: single/double value reset method for MinMax
- resets min/max to be identical to the specified value,
  which can be more convenient (and slightly more efficient) than doing
  a full reset followed by add()

- additional MinMax intersects() query, which works like overlaps()
  but with exclusive checks at the ends

- provide MinMax::operator&=() to replace (unused) intersect() method

ENH: single/double value reset method for boundBox

- boundBox::operator&=() to replace (rarely used) intersect() method.
  Deprecate boundBox::intersect() to avoid confusion with various
  intersects() method

COMP: provide triangleFwd.H
2022-10-31 18:36:14 +01:00
c973066646 ENH: supplementary vector comparison methods
- background: for some application it can be useful to have fully
  sorted points. i.e., sorted by x, followed by y, followed by z.

  The default VectorSpace 'operator<' compares *all*
  components. This is seen by the following comparisons

  1.  a = (-2.2 -3.3 -4.4)
      b = (-1.1 -2.2 3.3)

      (a < b) : True
      Each 'a' component is less than each 'b' component

  2.  a = (-2.2 -3.3 -4.4)
      b = (-2.2 3.3 4.4)

      (a < b) : False
      The a.x() is not less than b.x()

  The static definitions 'less_xyz', 'less_yzx', 'less_zxy'
  instead use comparison of the next components as tie breakers
  (like a lexicographic sort).
  - same type of definition that Pair and Tuple2 use.

      a = (-2.2 -3.3 -4.4)
      b = (-2.2 3.3 4.4)

      vector::less_xyz(a, b) : True
      The a.x() == b.x(), but a.y() < b.y()

   They can be used directly as comparators:

      pointField points = ...;

      std::sort(points.begin(), points.end(), vector::less_zxy);

ENH: make VectorSpace named access methods noexcept.

   Since the addressing range is restricted to enumerated offsets
   (eg, X/Y/Z) into storage, always remains in-range.
   Possible to make constexpr with future C++ versions.

STYLE: VectorSpace 'operator>' defined using 'operator<'

- standard rewriting rule
2022-10-31 18:36:14 +01:00
371795840c ENH: bounding sphere calculation for PrimitivePatch face
- useful when a characteristic per-face search dimension is required.
  With PrimitivePatch we are certain to have consistent evaluations
  of the face centre.

STYLE: tag PrimitivePatch compatibility headers as such
2022-10-31 18:36:14 +01:00
7a43cac55a ENH: component/element access for zero/one return themselves
STYLE: more consistent access for uniform list/fields
2022-10-31 18:36:14 +01:00
9433898941 ENH: support construction of pointIndexHit from pointHit
STYLE: combine templated/non-templated headers (reduced clutter)

STYLE: use hitPoint(const point&) combined setter

- same as setHit() + setPoint(const point&)

ENH: expose and use labelOctBits::pack method for addressing
2022-10-31 18:36:14 +01:00
454f7960b0 STYLE: expand use of ListLoop macros (#2624)
- the old List_FOR_ALL macro only remained in use in relatively few
  places. Replace with the expanded equivalent and move the looping
  parameter out of the macro and give an explicit name (eg, loopLen)
  which simplifies the addition of any loop pragmas in the various
  TFOR_ALL... macros (for example).
2022-10-31 18:36:14 +01:00
9db3547bd3 ENH: support optional average value when reading rawIOField
ENH: simplify bookkeeping within MappedFile
2022-10-31 18:36:14 +01:00
278378031e ENH: add syncState() method to serial streams (#2623)
- in places where direct reading from the std::stream is used,
  this method can be used to ensure that the OpenFOAM Sstream state
  is properly updated from the std::stream.

ENH: restrict stream renaming to ISstream

- non-const access was previously declared at the top-level (IOstream)
  but that not only added in potentially odd setting of the static
  fileName, but also meant that the OFstream name() could potentially
  be altered after opening a file and thus be inconsistent with the
  underlying file that had been opened.

  Now restrict name modification to ISstream (and ITstream
  counterpart). Does not affect any existing valid code.

STYLE: non-default OFstream destructor (for future file staging)
2022-10-31 09:34:37 +01:00
bd000d89e9 COMP: include fileFormats, surfMesh for faOptions, fvOptions 2022-10-27 16:13:41 +02:00
ac25608fbd BUG: viewFactor: smoothing when zero visible faces. Fixes #2622 2022-10-27 11:58:36 +01:00
37e90dbad7 ENH: limitTemperature: obey 'active' flag. Fixes #2621 2022-10-27 10:00:00 +01:00
2c7a7b27a3 ENH: distributedTriSurfaceMesh: support distributed running 2022-10-26 17:15:51 +01:00
7a67c1e72b DOC: redistributePar: better warning 2022-10-26 17:15:51 +01:00
b145e59049 STYLE: viewFactorsGen with std::vector (reserve) instead of std::list 2022-10-26 18:04:56 +02:00
24ffc5236d COMP: simplify openmp handling (#2617)
- remove old, unneeded -DUSE_OMP define.
- wmake -no-openmp option to add '~openmp' to WM_COMPILE_CONTROL

ENH: add bash completion handling for wmake
2022-10-26 18:04:56 +02:00
fd55151a12 SUBMODULE: cfmesh update handling of -DUSE_OMP (openmp)
- defined locally, independent of wmake rules
2022-10-26 18:02:26 +02:00
3caeeb1f51 BUG: functionObjectProperties: prevent restart failures (fixes #2618)
- regression in develop, not other branches
2022-10-26 14:49:21 +01:00
0c3a938810 Merge branch 'feature-masterCoarsest-multi-masters' into 'develop'
Feature master coarsest multi masters

See merge request Development/openfoam!565
2022-10-20 09:14:23 +00:00
62244c6caf Feature master coarsest multi masters 2022-10-20 09:14:22 +00:00
3a6a76044d BUG: objective: avoid double name registration in localIOdictionary (fixes #2596) 2022-10-18 13:08:56 +01:00
5a9dbcdadf BUG: incorrect tag/communicator order in debugSurfaceWriter 2022-10-13 18:15:21 +02:00
65dc440f3c COMP: silence clang -Wbitwise-instead-of-logical (triggered by boost/cgal) 2022-10-12 19:44:01 +02:00
4585a2d229 COMP: fix bad constructor resolution
STYLE: simpler initialization
2022-10-12 19:32:56 +02:00
18eeba116a ENH: use boundBox building blocks in misc places 2022-10-12 13:19:48 +02:00
61deacd24d ENH: boundBox improvements (#2609)
- construct boundBox from Pair<point> of min/max limits,
  make sortable

- additional bounding box intersections (linePointRef), add noexcept

- templated access for boundBox hex-corners
  (used to avoid temporary point field).
  Eg, unrolled plane/bound-box intersection with early exit

- bounding box grow() to expand box by absolute amounts
  Eg,

      bb.grow(ROOTVSMALL);   // Or: bb.grow(point::uniform(ROOTVSMALL));
  vs
      bb.min() -= point::uniform(ROOTVSMALL);
      bb.max() += point::uniform(ROOTVSMALL);

- treeBoundBox bounding box extend with two or three parameters.
  The three parameter version includes grow(...) for reduced writing.
  Eg,

      bb = bb.extend(rndGen, 1e-4, ROOTVSMALL);

  vs
      bb = bb.extend(rndGen, 1e-4);
      bb.min() -= point::uniform(ROOTVSMALL);
      bb.max() += point::uniform(ROOTVSMALL);

  This also permits use as const variables or parameter passing.
  Eg,

      const treeBoundBox bb
      (
          treeBoundBox(some_points).extend(rndGen, 1e-4, ROOTVSMALL)
      );
2022-10-12 13:19:44 +02:00
81b1c5021f ENH: provide low-level bound box() methods for meshShapes
- box method on meshShapes (cell,edge,face,triangle,...)
  returns a Pair<point>.

  Can be used directly without dependency on boundBox,
  but the limits can also passed through to boundBox.

- Direct box calculation for cell, which walks the cell-faces and
  mesh-faces.  Direct calculation for face (#2609)
2022-10-12 12:54:39 +02:00
96ff2f32e5 ENH: support direct calculation of finiteArea edgeNormals (#2592)
- with geometryOrder=1, calculate the edge normals from the adjacent
  faces (area-weighted, inverse distance squared) and also
  use that for the Le() calculation.

  Includes the contributions from processor edge neighbours, so it
  should be consistent on both sides.

  This new method (consider as 'beta') contrasts with the current
  standard method that first calculates area-weighted point normals
  and uses the average of them for the edge normal.

  Enable for testing either with a controlDict OptimisationSwitch entry
  "fa:geometryOrder", or on the command-line:

      solverName -opt-switch=fa:geometryOrder=1
2022-10-11 18:02:23 +02:00
9434972261 ENH: use fallback value if calculated Le() is degenerate (#2592)
- the Le vector is calculated from (edgeVec ^ edgeNorm)
  and should be oriented in direction (faceCentre -> edgeCentre).

  If, however, the edgeNorm value is bad for any reason, the
  cross-product falls apart and Le vector is calculated as a zero
  vector!

  For these cases, revert to using (faceCentre -> edgeCentre)
  as a better approximation than a zero vector.

  In the future, will very likely switch calculating the edge normals
  directly from the attached faces, instead of from the attached
  points as is currently done, which should improve robustness.

ENH: expose fa:geometryOrder as a registered OptimisationSwitch

ENN: reuse polyMesh data (eg, faceCentres) if possible in faMesh

STYLE: add code lambdas and static functions to isolate logic
2022-10-11 18:02:23 +02:00
d5cdc60a54 BUG: processorMeshes removeFiles does not remove collated (fixes #2607)
ENH: extend rmDir to handle removal of empty directories only

- recursively remove directories that only contain other directories
  but no other contents. Treats dead links as non-content.
2022-10-11 17:58:22 +02:00
779a2ca084 ENH: adjust fileName methods for similarity to std::filesystem::path
- stem(), replace_name(), replace_ext(), remove_ext() etc

- string::contains() method - similar to C++23 method

  Eg,
      if (keyword.contains('/')) ...
  vs
      if (keyword.find('/') != std::string::npos) ...
2022-10-11 17:58:22 +02:00
98a510c317 GIT: relocate treeDataEdge, treeDataPoint into OpenFOAM
- similar to treeDataCell, doesn't need any meshTools components
- AABBTree under algorithms (like indexedOctree)
2022-10-11 17:56:57 +02:00
0c89f38312 ENH: additional DimensionedField, GeometricField factory methods
- construct based on db and mesh information from an existing field

- check movable() instead of isTmp() when reusing fields

STYLE: isolate check for reuse GeometricField into Detail namespace
2022-10-06 12:54:06 +02:00
bcd461926c BUG: invalid pointer reference for optional coordinate system lookup
- code remnant from separate lookup + construct of coordinateSystem
  (7b2bcfda0b).
  Apply consistent use of coordinateSystem::NewIfPresent to avoid
  these types of coding mishaps
2022-10-06 12:50:06 +02:00
793433da72 DOC: snappyHexMeshDict: updated comment for blockLevel 2022-10-05 12:15:19 +01:00
34d69cad23 ENH: snappyHexMesh. Avoid excessive intermediate. Fixes #2600 2022-10-05 11:45:44 +01:00
a246a97b12 ENH: add debug surfaceWriter
- enables special purpose debugging.
  Its definition and behaviour are subject to change at any time.
2022-10-04 15:51:27 +02:00
7b2bcfda0b ENH: improved handling of coordinateSystems
- in continuation of #2565 (rotationCentre for surface output formats)
  it is helpful to also support READ_IF_PRESENT behaviour for the
  'origin' keyword.

  This can be safely used wherever the coordinate system definition
  is embedded within a sub-dictionary scope.

  Eg,
      dict1
      {
          coordinateSystem
          {
              origin (0 0 0);  // now optional here
              rotation ...;
          }
      }

   but remains mandatory if constructed without a sub-dict:

      dict2
      {
          origin (0 0 0);   // still mandatory
          e1  (1 0 0);
          e3  (0 0 1);
      }

   With this change, the "transform" sub-dictionary can written
   more naturally:

       formatOptions
       {
           vtk
           {
               scale 1000;  // m -> mm
               transform
               {
                   rotationCentre  (1 0 0);
                   rotation axisAngle;
                   axis    (0 0 1);
                   angle   -45;
               }
           }
       }

ENH: simplify handling of "coordinateSystem" dictionary lookups

- coordinateSystems::NewIfPresent method for optional entries:

    coordSysPtr_ = coordinateSystem::NewIfPresent(mesh, dict);

  Instead of

    if (dict.found(coordinateSystem::typeName, keyType::LITERAL))
    {
        coordSysPtr_ =
            coordinateSystem::New
            (
                mesh_,
                dict,
                coordinateSystem::typeName
            );
    }
    else
    {
        coordSysPtr_.reset();
    }

ENH: more consistent handling of priorities for binModels, forces (#2598)

- if the dictionaries are overspecified, give a 'coordinateSystem'
  entry a higher prioriy than the 'CofR' shortcuts.

  Was previously slightly inconsistent between the different models.
2022-10-04 15:51:27 +02:00
7eda6de6f4 ENH: use readOption to fine-tune dictionary reading
- previously had 'mandatory' (bool) for advanced control of reading
  dictionary entries but its meaning was unclear in the calling code
  without extra code comments.

  Now use IOobjectOption::readOption instead, which allows further
  options (ie, NO_READ) and is more transparent as to its purpose in
  the code than a true/false bool flag was.

  This is a minor breaking change (infrequent, advanced usage only)

- minor code cleanup in dictionary lookup methods
2022-10-04 15:51:26 +02:00
d938e01d7a ENH: refactor IOobject options
- IOobjectOption class encapsulates read/write, storage flags for
  lightweight handling, independent of objectRegistry etc.

ENH: add IOobject isReadRequired() and isReadOptional() queries

- encapsulates test of MUST_READ, MUST_READ_IF_MODIFIED,
  READ_IF_PRESENT for convenience / less clutter.

Example,

    if (isReadRequired() || (isReadOptional() && headerOk()))
    {
        ...
    }

Instead of

    if
    (
        (
            readOpt() == IOobject::MUST_READ
         || readOpt() == IOobject::MUST_READ_IF_MODIFIED
        )
     || (readOpt() == IOobject::READ_IF_PRESENT && headerOk())
    )
    {
        ...
    }
2022-10-04 15:51:26 +02:00
623c0624fb ENH: simplify stream construction
- with IOstreamOption there are no cases where we need to construct
  top-level streams (eg, IFstream, OFstream) with additional information
  about the internal IOstream 'version' (eg, version: 2.0).

  Makes it more convenient to open files with a specified
  format/compression combination - no clutter of specifying the
  version
2022-10-04 15:51:26 +02:00
36d7954004 ENH: refPtr/tmp is_reference() to complement is_pointer() method
STYLE: return nullptr instead of tmp<...>() for failure
2022-10-04 15:51:26 +02:00
159a7a5a38 ENH: simplify parallel/serial checks in ensight output
BUG: inadvertant type conversion in ensightFileTemplates::writeLabels
2022-10-04 15:51:26 +02:00
55f5f8774b ENH: use dictionary findDict() instead of isDict() + subDict()
- avoids redundant dictionary searching

STYLE: remove dictionary lookupOrDefaultCompat wrapper

- deprecated and replaced by getOrDefaultCompat (2019-05).
  The function is usually specific to internal keyword upgrading
  (version compatibility) and unlikely to exist in any user code.
2022-10-04 15:51:26 +02:00
9d5a3a5c54 STYLE: remove duplicate dimensionSet dictionary read constructor
STYLE: make dimensionedTypes access inline noexcept
2022-10-04 15:51:26 +02:00
ee9119f436 ENH: rationalize expression string reading
- read construct from dictionary.
  Calling syntax similar to dimensionedType, dimensionedSet,...

  Replaces the older getEntry(), getOptional() static methods

- support readIfPresent
2022-10-04 15:51:26 +02:00
3a6e427409 ENH: simplify dictionary search for value/refValue in BCs
- in expressions BCs in particular, there is various logic handling
  for if value/refValue/refGradient etc are found or not.

  Handle the lookups as findEntry and branch to use Field assign
  or other handling, depending on its existence.

STYLE: use wordList instead of wordRes for copy/filter dictionary
2022-10-04 15:51:26 +02:00
ea51c2c0e4 STYLE: return orientedType, Switch directly instead of const reference
- noexcept on some Time methods

ENH: pass through is_oriented() method for clearer coding

- use logical and/or/xor instead of bitwise versions (clearer intent)
2022-10-04 15:51:26 +02:00
867b5e9060 Merge branch 'feature-noise-writeFile' into 'develop'
ENH: noiseModels - replaced graph usage by writeFile

See merge request Development/openfoam!562
2022-10-04 13:50:32 +00:00
7c2311aae6 ENH: noiseModels - replaced graph usage by writeFile
Header information now includes, e.g.

    f [Hz] vs P(f) [Pa]
    Lower frequency: 2.500000e+01
    Upper frequency: 5.000000e+03
    Window model: Hanning
    Window number: 2
    Window samples: 512
    Window overlap %: 5.000000e+01
    dBRef       : 2.000000e-05
    Area average: false
    Area sum    : 6.475194e-04
    Number of faces: 473

Note: output files now have .dat extension
2022-10-04 13:10:39 +00:00
f87f0040b8 ENH: writeFile - add newFile function
ENH: writeFile - renamed createFile functions
     to newFileAtTime and newFileAtStartTime
2022-10-04 13:10:39 +00:00
c59b6db3c4 ENH: viewFactorsGen: re-enable 2D. See #2560
This reverts the v2206 behaviour so does not include
the edge-integration (2LI) optimisation - it uses
the exact same code as v2206.
2022-10-03 16:54:58 +01:00
5677e10d90 ENH: checkMesh: report overlapping zones. See #2521 2022-10-03 11:41:42 +01:00
38d68824b3 ENH: uniformInterpolatedDisplacement: Delay evaluation. Fixes #2605
If a `value` field is present use it and don't look for time
directories since this messes up the construct-from-dictionary
2022-10-03 10:31:40 +01:00
8283599c31 ENH: meshQualityDict: disable minEdgeLength by default (fixes #2599) 2022-09-29 14:16:44 +01:00
971 changed files with 24501 additions and 10855 deletions

View File

@ -35,7 +35,7 @@
(
solidRegions[i],
thermos[i],
coordinateSystem::typeName_()
coordinateSystem::typeName
)
);

View File

@ -15,7 +15,7 @@ if (!thermo.isotropic())
(
mesh,
thermo,
coordinateSystem::typeName_()
coordinateSystem::typeName
);
tmp<volVectorField> tkappaByCp = thermo.Kappa()/thermo.Cp();

View File

@ -157,12 +157,7 @@ void Foam::radiation::laserDTRM::initialiseReflection()
);
}
if (reflections_.size())
{
reflectionSwitch_ = true;
}
reflectionSwitch_ = returnReduce(reflectionSwitch_, orOp<bool>());
reflectionSwitch_ = returnReduceOr(reflections_.size());
}
}
@ -299,14 +294,12 @@ void Foam::radiation::laserDTRM::initialise()
DTRMCloud_.addParticle(pPtr);
}
if (returnReduce(cellI, maxOp<label>()) == -1)
if (nMissed < 10 && returnReduceAnd(cellI < 0))
{
if (++nMissed <= 10)
{
WarningInFunction
<< "Cannot find owner cell for focalPoint at "
<< p0 << endl;
}
++nMissed;
WarningInFunction
<< "Cannot find owner cell for focalPoint at "
<< p0 << endl;
}
}
}

View File

@ -28,11 +28,6 @@ License
#include "DirLister.H"
#include <dirent.h>
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
static const Foam::word extgz("gz");
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
bool Foam::DirLister::const_iterator::open(const fileName& dir)
@ -110,9 +105,9 @@ Foam::word Foam::DirLister::next(DIR* dirPtr) const
if (ok)
{
if (fType == fileName::FILE && stripgz_ && name.hasExt(extgz))
if (fType == fileName::FILE && stripgz_ && name.has_ext("gz"))
{
name = name.lessExt();
name.remove_ext();
}
if (!name.empty() && accept(name))

View File

@ -113,7 +113,6 @@ int main(int argc, char *argv[])
label coarseSize = max(addr)+1;
Info<< "Level : " << level << endl
<< returnReduce(addr.size(), sumOp<label>()) << endl
<< " current size : "
<< returnReduce(addr.size(), sumOp<label>()) << endl
<< " agglomerated size : "

View File

@ -90,7 +90,7 @@ void writeAndRead
const IOobject& io,
const label sz,
const word& writeType,
const IOobject::readOption rOpt,
IOobjectOption::readOption rOpt,
const word& readType
)
{
@ -208,7 +208,8 @@ int main(int argc, char *argv[])
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
IOobject::NO_WRITE,
IOobject::NO_REGISTER
);
{
@ -243,9 +244,7 @@ int main(int argc, char *argv[])
args.executable(),
"constant",
runTime,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
IOobject::NO_REGISTER // implicit convert to IOobjectOption
);
labelList ints(identity(200));

View File

@ -182,7 +182,7 @@ int main(int argc, char *argv[])
// MPI barrier
bool barrier = true;
Pstream::scatter(barrier);
Pstream::broadcast(barrier);
}

View File

@ -83,9 +83,9 @@ int main(int argc, char *argv[])
{
IOstreamOption streamOpt;
if (outputName.hasExt("gz"))
if (outputName.has_ext("gz"))
{
outputName.removeExt();
outputName.remove_ext();
streamOpt.compression(IOstreamOption::COMPRESSED);
}

View File

@ -138,8 +138,8 @@ int main()
maxFirstEqOp<label>()(maxIndexed, item);
}
Pstream::combineAllGather(minIndexed, minFirstEqOp<label>());
Pstream::combineAllGather(maxIndexed, maxFirstEqOp<label>());
Pstream::combineReduce(minIndexed, minFirstEqOp<label>());
Pstream::combineReduce(maxIndexed, maxFirstEqOp<label>());
Info<< "Min indexed: " << minIndexed << nl
<< "Max indexed: " << maxIndexed << nl;
@ -156,8 +156,8 @@ int main()
maxIndexed = maxFirstOp<label>()(maxIndexed, item);
}
Pstream::combineAllGather(minIndexed, minFirstEqOp<label>());
Pstream::combineAllGather(maxIndexed, maxFirstEqOp<label>());
Pstream::combineReduce(minIndexed, minFirstEqOp<label>());
Pstream::combineReduce(maxIndexed, maxFirstEqOp<label>());
Info<< "Min indexed: " << minIndexed << nl
<< "Max indexed: " << maxIndexed << nl;

View File

@ -1,7 +1,2 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lmeshTools
/* EXE_INC = */
/* EXE_LIBS = */

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2018 OpenCFD Ltd.
Copyright (C) 2016-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -31,7 +31,8 @@ Description
#include "argList.H"
#include "Time.H"
#include "polyMesh.H"
#include "boundBox.H"
#include "line.H"
#include "Random.H"
#include "treeBoundBox.H"
#include "cellModel.H"
#include "bitSet.H"
@ -84,7 +85,20 @@ int main(int argc, char *argv[])
else
{
bb = cube(0, 1);
Info<<"starting box: " << bb << endl;
Info<< "starting box: " << bb << endl;
Info<< "corner: " << bb.hexCorner<0>() << nl
<< "corner: " << bb.hexCorner<7>() << nl
<< "corner: " << bb.hexCorner<6>() << endl;
linePoints ln1(bb.max(), bb.centre());
Info<< "line: " << ln1 << " box: " << ln1.box() << endl;
Info<< "box: " << boundBox(ln1.box()) << endl;
Info<< "corner: " << bb.hexCorner<0>() << nl
<< "corner: " << bb.hexCorner<7>() << nl
<< "corner: " << bb.hexCorner<6>() << endl;
point pt(Zero);
bb.add(pt);
@ -147,6 +161,25 @@ int main(int argc, char *argv[])
Info<< "box is now => " << box1 << endl;
}
List<boundBox> boxes(12);
{
Random rndGen(12345);
for (auto& bb : boxes)
{
bb = cube
(
rndGen.position<scalar>(-10, 10),
rndGen.position<scalar>(0, 5)
);
}
Info<< "boxes: " << boxes << endl;
Foam::sort(boxes);
Info<< "sorted: " << boxes << endl;
}
return 0;
}

View File

@ -59,11 +59,11 @@ void basicTests(const coordinateSystem& cs)
{
cs.writeEntry(cs.name(), Info);
if (const auto* cartptr = isA<coordSystem::cartesian>(cs))
if ((const auto* cartptr = isA<coordSystem::cartesian>(cs)) != nullptr)
{
if (!cartptr->active())
if (!cartptr->valid())
{
Info<< "inactive cartesian = " << (*cartptr)
Info<< "invalid cartesian = " << (*cartptr)
<< " with: " << (*cartptr).R() << nl;
}
}
@ -106,7 +106,7 @@ void doTest(const dictionary& dict)
try
{
auto cs1ptr = coordinateSystem::New(dict, "");
auto cs1ptr = coordinateSystem::New(dict, word::null);
coordinateSystem& cs1 = *cs1ptr;
cs1.rename(dict.dictName());

View File

@ -51,11 +51,8 @@ cs4
{
type cylindrical;
origin (0 3 5);
rotation
{
type euler;
angles (90 0 0);
}
rotation euler;
angles (90 0 0);
}
cyl
@ -75,10 +72,7 @@ cyl
ident
{
origin (0 0 0);
rotation
{
type none;
}
rotation none;
}
)

View File

@ -26,7 +26,7 @@ rot_x90
rot_x90_axesRotation
{
origin (0 0 0);
coordinateRotation
rotation
{
type axesRotation;
e1 (1 0 0);
@ -37,7 +37,7 @@ rot_x90_axesRotation
rot_x90_axisAngle
{
origin (0 0 0);
coordinateRotation
rotation
{
type axisAngle;
axis (1 0 0); // non-unit also OK
@ -48,7 +48,7 @@ rot_x90_axisAngle
rot_x90_euler
{
origin (0 0 0);
coordinateRotation
rotation
{
type euler;
angles (0 90 0); // z-x'-z''
@ -61,7 +61,7 @@ rot_x90_euler
rot_z45_axesRotation
{
origin (0 0 0);
coordinateRotation
rotation
{
type axesRotation;
e1 (1 1 0);
@ -72,7 +72,7 @@ rot_z45_axesRotation
rot_z45_axisAngle
{
origin (0 0 0);
coordinateRotation
rotation
{
type axisAngle;
axis (0 0 10); // non-unit also OK
@ -83,7 +83,7 @@ rot_z45_axisAngle
rot_z45_euler
{
origin (0 0 0);
coordinateRotation
rotation
{
type euler;
angles (45 0 0); // z-x'-z''
@ -93,7 +93,7 @@ rot_z45_euler
rot_z45_starcd
{
origin (0 0 0);
coordinateRotation
rotation
{
type starcd;
angles (45 0 0); // z-x'-y''
@ -106,7 +106,7 @@ rot_z45_starcd
rot_zm45_axesRotation
{
origin (0 0 0);
coordinateRotation
rotation
{
type axesRotation;
e1 (1 -1 0);
@ -117,7 +117,7 @@ rot_zm45_axesRotation
rot_zm45_axisAngle
{
origin (0 0 0);
coordinateRotation
rotation
{
type axisAngle;
axis (0 0 10); // non-unit also OK
@ -128,7 +128,7 @@ rot_zm45_axisAngle
rot_zm45_euler
{
origin (0 0 0);
coordinateRotation
rotation
{
type euler;
angles (-45 0 0); // z-x'-z''
@ -141,7 +141,7 @@ rot_zm45_euler
null_axesRotation
{
origin (0 0 0);
coordinateRotation
rotation
{
type axesRotation;
e1 (1 0 0);
@ -152,7 +152,7 @@ null_axesRotation
null_axisAngle0
{
origin (0 0 0);
coordinateRotation
rotation
{
type axisAngle;
axis (0 0 0); // non-unit also OK
@ -163,7 +163,7 @@ null_axisAngle0
null_axisAngle1
{
origin (0 0 0);
coordinateRotation
rotation
{
type axisAngle;
axis (1 1 1); // non-unit also OK
@ -174,7 +174,7 @@ null_axisAngle1
null_euler
{
origin (0 0 0);
coordinateRotation
rotation
{
type euler;
angles (0 0 0); // z-x'-z''

View File

@ -60,7 +60,7 @@ int main(int argc, char *argv[])
Info<< "Reading " << file << nl << endl;
decomposedBlockData data
(
Pstream::worldComm,
UPstream::worldComm,
IOobject
(
file,
@ -79,7 +79,6 @@ int main(int argc, char *argv[])
(
objPath,
IOstreamOption::BINARY,
IOstreamOption::currentVersion,
runTime.writeCompression()
);
if (!os.good())

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2020 OpenCFD Ltd.
Copyright (C) 2020-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -65,8 +65,7 @@ int main(int argc, char *argv[])
"tensor",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
{ IOobject::READ_IF_PRESENT, IOobject::NO_REGISTER }
),
mesh,
dimensioned<tensor>(dimless, tensor(1,2,3,4,5,6,7,8,9))
@ -75,6 +74,47 @@ int main(int argc, char *argv[])
Info().beginBlock("transformed")
<< tensorfld.T() << nl;
Info().endBlock();
{
auto tfld =
DimensionedField<scalar, volMesh>::New
(
tensorfld,
"scalar",
dimensioned<scalar>(14)
);
Info().beginBlock(tfld().type())
<< tfld << nl;
Info().endBlock();
}
{
auto tfld =
volScalarField::New
(
"scalar",
tensorfld.mesh(),
dimensioned<scalar>(5)
);
Info().beginBlock(tfld().type())
<< tfld() << nl;
Info().endBlock();
// From dissimilar types
auto tfld2 =
volVectorField::New
(
tfld(),
"vector",
dimensioned<vector>(Zero)
);
Info().beginBlock(tfld2().type())
<< tfld2() << nl;
Info().endBlock();
}
}
#ifdef TEST_UINT8_FIELD

View File

@ -120,7 +120,8 @@ int main(int argc, char *argv[])
try
{
// Should not trigger any errors
expressions::exprString expr(str, dict, false);
auto expr = expressions::exprString::toExpr(str, dict);
Info<< "expr: " << expr << nl;
}
catch (const Foam::error& err)

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2021 OpenCFD Ltd.
Copyright (C) 2016-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -48,6 +48,14 @@ Description
using namespace Foam;
// Create named file with some dummy content
void touchFileContent(const fileName& file)
{
std::ofstream os(file);
os << "file=<" << file << ">" << nl;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
unsigned testClean(std::initializer_list<Pair<std::string>> tests)
@ -260,7 +268,7 @@ int main(int argc, char *argv[])
"hello1",
"hello2",
"hello3",
"hello4.hmm"
"hello4.ext"
};
Info<< file1 << nl;
@ -270,7 +278,7 @@ int main(int argc, char *argv[])
{
file1,
"some",
"more/things.hmm"
"more/things.ext"
};
Info<< file2 << nl;
@ -281,7 +289,7 @@ int main(int argc, char *argv[])
{
std::string("ffO"),
"some",
"more/things.hmm"
"more/things.ext"
};
Info<< file3 << nl;
@ -295,7 +303,7 @@ int main(int argc, char *argv[])
{
"some",
file3,
"more/things.hmm",
"more/things.ext",
file1
};
Info<< "All ==> " << file4 << nl;
@ -328,26 +336,26 @@ int main(int argc, char *argv[])
fileName input1("path.to/media/image.png");
Info<<"File : " << input0 << " ext: "
<< Switch(input0.hasExt())
<< Switch(input0.has_ext())
<< " = " << input0.ext() << nl;
Info<<"File : " << input1 << " ext: "
<< Switch(input1.hasExt())
<< Switch(input1.has_ext())
<< " = " << input1.ext() << nl;
Info<<"File : " << endWithDot << " ext: "
<< Switch(endWithDot.hasExt())
<< Switch(endWithDot.has_ext())
<< " = " << endWithDot.ext() << " <-- perhaps return false?" << nl;
Info<<"File : " << endWithSlash << " ext: "
<< Switch(endWithSlash.hasExt())
<< Switch(endWithSlash.has_ext())
<< " = " << endWithSlash.ext() << nl;
Info<<"Remove extension " << (input0.removeExt());
Info<<"Remove extension " << (input0.remove_ext());
Info<< " now: " << input0 << nl;
Info<<"Remove extension " << (input1.removeExt());
Info<< " now: " << input1 << nl;
Info<<"Remove extension " << (endWithSlash.removeExt());
Info<<"Remove extension " << (endWithSlash.remove_ext());
Info<< " now: " << endWithSlash << nl;
wordList exts{ "jpg", "png", "txt", word::null };
@ -359,14 +367,14 @@ int main(int argc, char *argv[])
Info<< nl;
Info<<"Test hasExt(word)" << nl
Info<<"Test has_ext(word)" << nl
<<"~~~~~~~~~~~~~~~~~" << nl;
Info<<"Has extension(s):" << nl
<< "input: " << input1 << nl;
for (const word& e : exts)
{
Info<<" '" << e << "' -> "
<< Switch(input1.hasExt(e)) << nl;
<< Switch(input1.has_ext(e)) << nl;
}
Info<< nl;
@ -375,12 +383,12 @@ int main(int argc, char *argv[])
for (const word& e : exts)
{
Info<<" '" << e << "' -> "
<< Switch(endWithDot.hasExt(e)) << nl;
<< Switch(endWithDot.has_ext(e)) << nl;
}
Info<< nl;
Info<<"Test hasExt(wordRe)" << nl
Info<<"Test has_ext(wordRe)" << nl
<<"~~~~~~~~~~~~~~~~~~~" << nl;
// A regex with a zero length matcher doesn't work at all:
@ -393,25 +401,25 @@ int main(int argc, char *argv[])
Info<<"Has extension(s):" << nl
<< "input: " << endWithDot << nl;
Info<<" " << matcher0 << " -> "
<< Switch(endWithDot.hasExt(matcher0)) << nl;
<< Switch(endWithDot.has_ext(matcher0)) << nl;
Info<<" " << matcher1 << " -> "
<< Switch(endWithDot.hasExt(matcher1)) << nl;
<< Switch(endWithDot.has_ext(matcher1)) << nl;
Info<<" " << matcher2 << " -> "
<< Switch(endWithDot.hasExt(matcher2)) << nl;
<< Switch(endWithDot.has_ext(matcher2)) << nl;
Info<< "input: " << input1 << nl;
Info<<" " << matcher0 << " -> "
<< Switch(input1.hasExt(matcher0)) << nl;
<< Switch(input1.has_ext(matcher0)) << nl;
Info<<" " << matcher1 << " -> "
<< Switch(input1.hasExt(matcher1)) << nl;
<< Switch(input1.has_ext(matcher1)) << nl;
Info<<" " << matcher2 << " -> "
<< Switch(input1.hasExt(matcher2)) << nl;
<< Switch(input1.has_ext(matcher2)) << nl;
Info<< nl;
Info<<"Remove extension(s):" << nl << "input: " << input1 << nl;
while (!input1.empty())
{
if (input1.removeExt())
if (input1.remove_ext())
{
Info<< " -> " << input1 << nl;
}
@ -587,14 +595,54 @@ int main(int argc, char *argv[])
if (args.found("system"))
{
const fileName dirA("dirA");
const fileName dirB("dirB");
const fileName dirC("dirC");
const fileName dirD("dirD");
const fileName lnA("lnA");
const fileName lnB("lnB");
const fileName dirB("dirB");
Foam::rmDir(dirA);
// Purge anything existing
Foam::rmDir(dirA, true);
Foam::rmDir(dirB, true);
Foam::rmDir(dirC, true);
Foam::rmDir(dirD, true);
Foam::rm(lnA);
Foam::rm(lnB);
Foam::rmDir(dirB);
{
fileName name(dirA/dirB/dirC/"abc");
Foam::mkDir(name.path());
touchFileContent(name); // Create real file
Foam::mkDir(dirB/dirB/dirB/dirB);
Foam::ln("test", dirB/"linkB"); // Create dead link
Foam::mkDir(dirC);
Foam::ln("../dirD", dirC/"linkC"); // Create real link
Foam::mkDir(dirD);
for (const fileName& d : { dirA, dirB, dirC, dirD })
{
Info<< "Directory: " << d << " = "
<< readDir(d, fileName::UNDEFINED, false, false) << nl;
if (Foam::rmDir(d, false, true))
{
Info<< " Removed empty dir" << nl;
}
else
{
Info<< " Could not remove empty dir" << nl;
}
}
// Force removal before continuing
Foam::rmDir(dirA, true);
Foam::rmDir(dirB, true);
Foam::rmDir(dirC, true);
Foam::rmDir(dirD, true);
}
Info<< nl << "=========================" << nl
<< "Test some copying and deletion" << endl;
@ -618,9 +666,7 @@ int main(int argc, char *argv[])
);
Info<<" create: " << file << endl;
std::ofstream os(file);
os << "file=<" << file << ">" << nl;
touchFileContent(file);
}
const int oldDebug = POSIX::debug;
@ -708,7 +754,7 @@ int main(int argc, char *argv[])
"hello1",
"hello2",
"hello3",
"hello4.hmm"
"hello4.ext"
};
fileName pathName(wrdList);
@ -718,14 +764,28 @@ int main(int argc, char *argv[])
<< "pathName.name() = >" << pathName.name() << "<\n"
<< "pathName.path() = " << pathName.path() << nl
<< "pathName.ext() = >" << pathName.ext() << "<\n"
<< "pathName.nameLessExt= >" << pathName.nameLessExt() << "<\n";
<< "pathName.stem = >" << pathName.stem() << "<\n";
Info<< "pathName.components() = " << pathName.components() << nl
<< "pathName.component(2) = " << pathName.component(2) << nl
<< endl;
Info<< "hasPath = " << Switch(pathName.hasPath()) << nl;
pathName.removePath();
pathName.replace_name("newName.ext");
Info<< "new name = " << pathName << nl;
Info<< "has ext = " << Switch::name(pathName.has_ext()) << nl;
Info<< "has ext('') = " << Switch::name(pathName.has_ext("")) << nl;
Info<< "has ext(foo) = " << Switch::name(pathName.has_ext("foo")) << nl;
Info<< "has ext(ext) = " << Switch::name(pathName.has_ext("ext")) << nl;
pathName.replace_ext("png");
Info<< "new ext = " << pathName << nl;
pathName.replace_ext(""); // Same as remove_ext
Info<< "new ext = " << pathName << nl;
Info<< "has path = " << Switch::name(pathName.has_path()) << nl;
pathName.remove_path();
pathName.removePath(); // second type should be a no-op
Info<< "removed path = " << pathName << nl;
Info<< nl << nl;

View File

@ -64,13 +64,8 @@ int main(int argc, char *argv[])
// Slightly extended bb. Slightly off-centred just so on symmetric
// geometry there are less face/edge aligned items.
treeBoundBox bb
(
efem.points()
);
bb.min() -= point::uniform(ROOTVSMALL);
bb.max() += point::uniform(ROOTVSMALL);
treeBoundBox bb(efem.points());
bb.grow(ROOTVSMALL);
labelList allEdges(identity(efem.edges().size()));

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2020-2021 OpenCFD Ltd.
Copyright (C) 2020-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -61,10 +61,10 @@ int main(int argc, char *argv[])
InfoErr<< "output: " << outputName;
IOstreamOption::compressionType comp(IOstreamOption::UNCOMPRESSED);
if (outputName.hasExt("gz"))
if (outputName.has_ext("gz"))
{
comp = IOstreamOption::COMPRESSED;
outputName.removeExt();
outputName.remove_ext();
InfoErr<< " [compress]";
}

View File

@ -204,7 +204,7 @@ int main(int argc, char *argv[])
labelPair inOut;
pointField allCcs(globalNumbering.gather(mesh.cellCentres()));
inOut[0] = allCcs.size();
Pstream::scatter(allCcs);
Pstream::broadcast(allCcs);
inOut[1] = allCcs.size();
Pout<< " " << inOut << endl;

View File

@ -41,8 +41,8 @@ void printInfo(const labelRange& range)
<< "last " << range.last() << nl
<< "min " << range.min() << nl
<< "max " << range.max() << nl
<< "after " << range.after() << nl
<< "begin end " << *range.cbegin() << ' ' << *range.cend() << nl;
<< "end " << range.end_value() << nl
<< "begin/end " << *range.cbegin() << ' ' << *range.cend() << nl;
// Info<< "rbegin rend " << *range.rbegin() << ' ' << *range.rend() << nl;
}
@ -56,7 +56,7 @@ int main(int argc, char *argv[])
argList::noParallel();
argList::noFunctionObjects();
argList::addArgument("start size .. startN sizeN");
argList::addVerbose("enable labelRange::debug");
argList::addVerboseOption("enable labelRange::debug");
argList::addNote
(
"The default is to add ranges, use 'add' and 'del' to toggle\n\n"

View File

@ -44,7 +44,7 @@ using namespace Foam;
template<class T>
Ostream& printInfo(const MinMax<T>& range)
{
Info<< range << " valid=" << range.valid() << " span=" << range.span();
Info<< range << " good=" << range.good() << " span=" << range.span();
return Info;
}
@ -234,11 +234,7 @@ int main(int argc, char *argv[])
Pout<< "hashed: " << hashed << nl;
Pstream::mapCombineGather
(
hashed,
plusEqOp<scalarMinMax>()
);
Pstream::mapCombineReduce(hashed, plusEqOp<scalarMinMax>());
Info<< "reduced: " << hashed << nl;

View File

@ -44,7 +44,7 @@ using namespace Foam;
template<class T>
Ostream& printInfo(const MinMax<T>& range)
{
Info<< range << " valid=" << range.valid();
Info<< range << " good=" << range.good();
return Info;
}

View File

@ -1,4 +1,4 @@
EXE_INC = $(COMP_OPENMP) /* -UUSE_OMP */
EXE_INC = $(COMP_OPENMP)
/* Mostly do not need to explicitly link openmp libraries */
/* EXE_LIBS = $(LINK_OPENMP) */

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenCFD Ltd.
Copyright (C) 2017-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -41,12 +41,6 @@ Description
int main(int argc, char *argv[])
{
#if USE_OMP
std::cout << "USE_OMP defined (" << USE_OMP << ")\n";
#else
std::cout << "USE_OMP undefined\n";
#endif
#if _OPENMP
std::cout << "_OPENMP = " << _OPENMP << "\n\n";

View File

@ -167,7 +167,7 @@ int main(int argc, char *argv[])
(
localValue,
sumOp<scalar>(),
Pstream::msgType(),
UPstream::msgType(),
comm
);
Pout<< "sum :" << sum << endl;

View File

@ -125,13 +125,13 @@ int main(int argc, char *argv[])
scalar data1 = 1.0;
label request1 = -1;
{
Foam::reduce(data1, sumOp<scalar>(), Pstream::msgType(), request1);
Foam::reduce(data1, sumOp<scalar>(), UPstream::msgType(), request1);
}
scalar data2 = 0.1;
label request2 = -1;
{
Foam::reduce(data2, sumOp<scalar>(), Pstream::msgType(), request2);
Foam::reduce(data2, sumOp<scalar>(), UPstream::msgType(), request2);
}

View File

@ -232,6 +232,7 @@ int main(int argc, char *argv[])
const labelListList& edgeFaces = pp.edgeFaces();
const labelListList& faceEdges = pp.faceEdges();
Pout<< "box: " << pp.box() << endl;
checkFaceEdges(localFaces, edges, faceEdges);

View File

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

View File

@ -0,0 +1,9 @@
EXE_INC = \
-I$(LIB_SRC)/fileFormats/lnInclude \
-I$(LIB_SRC)/surfMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lfileFormats \
-lsurfMesh \
-lmeshTools

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) 2022 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-rawIOField
Description
Reading rawIOField from disk
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "Time.H"
#include "Switch.H"
#include "primitiveFields.H"
#include "pointField.H"
#include "rawIOField.H"
#include "exprTraits.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
using namespace Foam;
#undef USE_ROOT_CASE
//#define USE_ROOT_CASE
template<class Type>
tmp<Field<Type>> readRawField
(
const IOobject& io,
IOobjectOption::readOption withAverage
)
{
rawIOField<Type> raw(io, withAverage);
Info<< "File: " << io.objectPath() << nl
<< "Read: " << raw.size()
<< ' ' << pTraits<Type>::typeName << " entries" << nl
<< "Average: " << Switch::name(raw.hasAverage())
<< " = " << raw.average() << endl;
return tmp<Field<Type>>::New(std::move(static_cast<Field<Type>&>(raw)));
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
argList::addNote
(
"Test behaviour of rawIOField reading (writing?)"
);
argList::noCheckProcessorDirectories();
argList::addBoolOption("scalar", "Read scalar field");
argList::addBoolOption("vector", "Read vector field");
argList::addBoolOption("point", "Read point field");
argList::addBoolOption("average", "Require averaged value entry");
argList::addBoolOption("try-average", "Optional averaged value entry");
argList::addArgument("fileName");
#ifdef USE_ROOT_CASE
#include "setRootCase.H"
#include "createTime.H"
#else
// Without root case, or time
argList args(argc, argv);
#endif
fileName inputName = args.get<fileName>(1);
IOobjectOption::readOption withAverage = IOobjectOption::NO_READ;
if (args.found("average"))
{
withAverage = IOobjectOption::MUST_READ;
}
else if (args.found("try-average"))
{
withAverage = IOobjectOption::READ_IF_PRESENT;
}
Info<< "Using case: " << argList::envGlobalPath() << nl
<< "Read file: " << inputName << nl
<< "with average: " << int(withAverage) << nl
<< endl;
refPtr<Time> timePtr;
#ifdef USE_ROOT_CASE
timePtr.cref(runTime);
#endif
// Fallback (eg, no runTime)
if (!timePtr.good())
{
timePtr.reset(Time::New(argList::envGlobalPath()));
}
const auto& tm = timePtr();
fileName resolvedName(inputName);
resolvedName.toAbsolute();
IOobject io
(
resolvedName, // absolute path
tm,
IOobject::MUST_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER,
true // is global object (currently not used)
);
if (args.found("scalar"))
{
auto tfield = readRawField<scalar>(io, withAverage);
}
else if (args.found("point"))
{
auto tfield = readRawField<point>(io, withAverage);
}
else if (args.found("vector"))
{
auto tfield = readRawField<vector>(io, withAverage);
}
else
{
Info<< "no data type specified!\n";
}
Info<< nl << "End\n" << endl;
return 0;
}
// ************************************************************************* //

View File

@ -135,6 +135,7 @@ int main(int argc, char *argv[])
cout<<"string:" << sizeof(Foam::string) << nl;
}
cout<<"IOobjectOption:" << sizeof(Foam::IOobjectOption) << nl;
cout<<"IOobject:" << sizeof(Foam::IOobject) << nl;
cout<<"IOstream:" << sizeof(Foam::IOstream) << nl;
cout<<"PstreamBuffers:" << sizeof(Foam::PstreamBuffers) << nl;

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2021 OpenCFD Ltd.
Copyright (C) 2018-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -91,15 +91,15 @@ int main(int argc, char *argv[])
const auto importName = args.get<fileName>(1);
word ext;
if (!args.readIfPresent("ext", ext))
{
ext = importName.ext();
if (ext == "gz")
{
ext = importName.lessExt().ext();
}
}
word ext =
(
importName.has_ext("gz")
? importName.stem().ext()
: importName.ext()
);
// Allow override of extension
args.readIfPresent("ext", ext);
args.readIfPresent("stl-parser", fileFormats::STLReader::parserType);

View File

@ -33,6 +33,7 @@ Description
#include "vectorField.H"
#include "IOstreams.H"
#include "Random.H"
#include <algorithm>
#include <random>
@ -74,8 +75,12 @@ void doTest(vector& vec1, vector& vec2)
printInfo(vec1);
printInfo(vec2);
Info<< "min of " << vec1 << " and " << vec2 << " = "
<< min(vec1, vec2) << nl << nl;
Info<< "vector: " << vec1 << nl
<< "vector: " << vec2 << nl
<< " min: " << min(vec1, vec2) << nl
<< " dist: " << vec1.dist(vec2) << ' ' << mag(vec1 - vec2) << nl
<< "dist^2: " << vec1.distSqr(vec2) << ' ' << magSqr(vec1 - vec2) << nl
<< nl;
}
@ -146,6 +151,46 @@ int main(int argc, char *argv[])
std::shuffle(vec2.begin(), vec2.end(), std::default_random_engine());
Info<< "shuffled: " << vec2 << nl;
// Vectors with some identical components
List<vector> vectors
({
{1.1, 2.2, 3.3 },
{2.2, 3.3, 4.4 },
{-1.1, 2.2, 3.3 },
{-2.2, 3.3, 4.4 },
{-1.1, -2.2, 3.3 },
{-2.2, -3.3, 4.4 },
{-1.1, -2.2, -3.3 },
{-2.2, -3.3, -4.4 },
{-3.3, 2.1, 12 },
{3.145, 1.6, 2 },
{0, 0, 0}
});
shuffle(vectors);
Info<< "initial vectors: ";
vectors.writeList(Info, 1) << nl;
Foam::sort(vectors);
Info<< "regular sort:";
vectors.writeList(Info, 1) << nl;
std::sort(vectors.begin(), vectors.end(), vector::less_xyz);
Info<< "sorted xyz:";
vectors.writeList(Info, 1) << nl;
std::sort(vectors.begin(), vectors.end(), vector::less_yzx);
Info<< "sorted yzx:";
vectors.writeList(Info, 1) << nl;
std::sort(vectors.begin(), vectors.end(), vector::less_zxy);
Info<< "sorted zxy:";
vectors.writeList(Info, 1) << nl;
}
// Basic tests for fields

View File

@ -585,7 +585,7 @@ void createBaffles
// Wrapper around find patch. Also makes sure same patch in parallel.
label findPatch(const polyBoundaryMesh& patches, const word& patchName)
{
label patchi = patches.findPatchID(patchName);
const label patchi = patches.findPatchID(patchName);
if (patchi == -1)
{
@ -597,16 +597,15 @@ label findPatch(const polyBoundaryMesh& patches, const word& patchName)
// Check same patch for all procs
{
label newPatch = patchi;
reduce(newPatch, minOp<label>());
const label newPatchi = returnReduce(patchi, minOp<label>());
if (newPatch != patchi)
if (newPatchi != patchi)
{
FatalErrorInFunction
<< "Patch " << patchName
<< " should have the same patch index on all processors." << nl
<< "On my processor it has index " << patchi
<< " ; on some other processor it has index " << newPatch
<< " ; on some other processor it has index " << newPatchi
<< exit(FatalError);
}
}

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -396,12 +397,11 @@ int main(int argc, char *argv[])
meshSearch queryMesh(mesh);
// Check all 'outside' points
forAll(outsidePts, outsideI)
for (const point& outsidePoint : outsidePts)
{
const point& outsidePoint = outsidePts[outsideI];
const label celli = queryMesh.findCell(outsidePoint, -1, false);
label celli = queryMesh.findCell(outsidePoint, -1, false);
if (returnReduce(celli, maxOp<label>()) == -1)
if (returnReduceAnd(celli < 0))
{
FatalErrorInFunction
<< "outsidePoint " << outsidePoint

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2021 OpenCFD Ltd.
Copyright (C) 2016-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -175,7 +175,7 @@ int main(int argc, char *argv[])
// strip erroneous extension (.ccm, .ccmg, .ccmp)
if (ext == "ccm" || ext == "ccmg" || ext == "ccmp")
{
exportName = exportName.lessExt();
exportName.remove_ext();
}
}
else if (args.found("export"))

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016 OpenCFD Ltd.
Copyright (C) 2016-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -137,7 +137,7 @@ int main(int argc, char *argv[])
// strip erroneous extension (.ccm, .ccmg, .ccmp)
if (ext == "ccm" || ext == "ccmg" || ext == "ccmp")
{
exportName = exportName.lessExt();
exportName.remove_ext();
}
}
else if (args.found("case"))

View File

@ -0,0 +1,4 @@
ensightMeshReader.C
ensightToFoam.C
EXE = $(FOAM_APPBIN)/ensightToFoam

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,194 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2022 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/>.
Class
Foam::fileFormats::ensightMeshReader
Description
Notes
SourceFiles
ensightMeshReader.C
\*---------------------------------------------------------------------------*/
#ifndef Foam_ensightMeshReader_H
#define Foam_ensightMeshReader_H
#include "meshReader.H"
//#include "ensightReadFile.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward Declarations
class ensightReadFile;
namespace fileFormats
{
/*---------------------------------------------------------------------------*\
Class fileFormats::ensightMeshReader Declaration
\*---------------------------------------------------------------------------*/
class ensightMeshReader
:
public meshReader
{
// Private Data
//- Merge distance
const scalar mergeTol_;
//- Check and correct handedness
const bool setHandedness_;
protected:
// Protected Data
//- mesh point to original node_id
labelList nodeIds_;
//- mesh cell to original element_id
labelList elementIds_;
// Protected Member Functions
//- Rotate face so lowest vertex is first
const face& rotateFace
(
const face& f,
face& rotatedFace
) const;
//- Read set of vertices. Optional mapping
void readVerts
(
ensightReadFile& is,
const label nVerts,
const Map<label>& nodeIdToPoints,
DynamicList<label>& verts
) const;
//- Read set of element/node IDs
void readIDs
(
ensightReadFile& is,
const bool doRead,
const label nShapes,
labelList& foamToElem,
Map<label>& elemToFoam
) const;
//- Swap handedness of hex if needed
void setHandedness
(
const cellModel& model,
DynamicList<label>& verts,
const pointField& points
) const;
//- Read a single part until eof (return true) or until start of next
// part (return false)
bool readGoldPart
(
ensightReadFile& is,
const bool read_node_ids,
const bool read_elem_ids,
pointField& points,
labelList& pointToNodeIds,
Map<label>& nodeIdToPoints,
// 3D-elems : cells (cell-to-faces)
faceListList& cellFaces,
labelList& cellToElemIds,
Map<label>& elemIdToCells,
// 2D-elems : faces
faceList& faces,
labelList& faceToElemIDs,
Map<label>& elemIdToFaces
) const;
//- Read the mesh from the file(s)
virtual bool readGeometry(const scalar scaleFactor = 1.0);
public:
//- Runtime type information
TypeName("ensightMeshReader");
// Constructors
//- Construct from case name
ensightMeshReader
(
const fileName& geomFile,
const objectRegistry& registry,
const scalar mergeTol = SMALL,
const scalar scaleFactor = 1.0,
const bool setHandedness = true
);
//- Destructor
virtual ~ensightMeshReader() = default;
// Access
//- Original node id (if supplied) or -1
const labelList& nodeIds() const noexcept
{
return nodeIds_;
}
//- Original element id (if supplied) or -1
const labelList& elementIds() const noexcept
{
return elementIds_;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fileFormats
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,118 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2022 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
ensightToFoam
Group
grpMeshConversionUtilities
Description
Convert an Ensight Gold mesh into OpenFOAM format.
Usage
\b ensightToFoam [OPTION] \<ensightGeometryFile\>
Options:
- \par -mergeTol \<factor\>
Specify an alternative merging tolerance as a fraction of
the bounding box of the points.
- \par -scale \<factor\>
Specify an optional geometry scaling factor.
- \par -keepHandedness
Do not automatically flip negative volume cells
See also
Foam::meshReader and Foam::fileFormats::STARCDMeshReader
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "Time.H"
#include "ensightMeshReader.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
argList::addNote
(
"Convert Ensight mesh to OpenFOAM"
);
argList::noParallel();
argList::addArgument(".geo file", "The file containing the geometry");
argList::addOption
(
"mergeTol",
"factor",
"Merge tolerance as a fraction of bounding box - 0 to disable merging"
);
argList::addOption
(
"scale",
"factor",
"Geometry scaling factor - default is 1"
);
argList::addBoolOption
(
"keepHandedness",
"Do not automatically flip inverted cells"
" (default is to do a geometric test)"
);
argList args(argc, argv);
Time runTime(args.rootPath(), args.caseName());
// Increase the precision of the points data
IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision()));
const fileName geomFile(args.get<fileName>(1));
{
fileFormats::ensightMeshReader reader
(
geomFile,
runTime,
args.getOrDefault<scalar>("mergeTol", 1e-10),
args.getOrDefault<scalar>("scale", 1.0),
args.found("keepHandedness")
);
autoPtr<polyMesh> mesh = reader.mesh(runTime);
mesh().setInstance(runTime.constant());
mesh().write();
}
Info<< "\nEnd\n" << endl;
return 0;
}
// ************************************************************************* //

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020-2021 OpenCFD Ltd.
Copyright (C) 2020-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -87,8 +87,8 @@ int main(int argc, char *argv[])
const scalar scaleFactor = args.getOrDefault<scalar>("scale", 0);
const bool doTriangulate = args.found("tri");
fileName exportBase = exportName.lessExt();
word exportExt = exportName.ext();
const fileName exportBase = exportName.lessExt();
const word exportExt = exportName.ext();
if (!meshedSurface::canWriteType(exportExt, true))
{

View File

@ -538,8 +538,11 @@ int main(int argc, char *argv[])
// Add any patches.
label nAdded = nPatches - mesh.boundaryMesh().size();
reduce(nAdded, sumOp<label>());
const label nAdded = returnReduce
(
nPatches - mesh.boundaryMesh().size(),
sumOp<label>()
);
Info<< "Adding overall " << nAdded << " processor patches." << endl;
@ -946,9 +949,8 @@ int main(int argc, char *argv[])
// Put all modifications into meshMod
bool anyChange = collapser.setRefinement(allPointInfo, meshMod);
reduce(anyChange, orOp<bool>());
if (anyChange)
if (returnReduceOr(anyChange))
{
// Construct new mesh from polyTopoChange.
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false);
@ -1118,8 +1120,7 @@ int main(int argc, char *argv[])
processorMeshes::removeFiles(mesh);
// Need writing cellSet
label nAdded = returnReduce(addedCellsSet.size(), sumOp<label>());
if (nAdded > 0)
if (returnReduceOr(addedCellsSet.size()))
{
cellSet addedCells(mesh, "addedCells", addedCellsSet);
Info<< "Writing added cells to cellSet " << addedCells.name()

View File

@ -345,7 +345,7 @@ void deleteEmptyPatches(fvMesh& mesh)
else
{
// Common patch.
if (returnReduce(patches[patchi].empty(), andOp<bool>()))
if (returnReduceAnd(patches[patchi].empty()))
{
Pout<< "Deleting patch " << patchi
<< " name:" << patches[patchi].name()
@ -661,8 +661,8 @@ void countExtrudePatches
}
// Synchronise decision. Actual numbers are not important, just make
// sure that they're > 0 on all processors.
Pstream::listCombineAllGather(zoneSidePatch, plusEqOp<label>());
Pstream::listCombineAllGather(zoneZonePatch, plusEqOp<label>());
Pstream::listCombineReduce(zoneSidePatch, plusEqOp<label>());
Pstream::listCombineReduce(zoneZonePatch, plusEqOp<label>());
}
@ -1848,7 +1848,7 @@ int main(int argc, char *argv[])
const primitiveFacePatch extrudePatch(std::move(zoneFaces), mesh.points());
Pstream::listCombineAllGather(isInternal, orEqOp<bool>());
Pstream::listCombineReduce(isInternal, orEqOp<bool>());
// Check zone either all internal or all external faces
checkZoneInside(mesh, zoneNames, zoneID, extrudeMeshFaces, isInternal);
@ -2309,7 +2309,7 @@ int main(int argc, char *argv[])
}
// Reduce
Pstream::mapCombineAllGather(globalSum, plusEqOp<point>());
Pstream::mapCombineReduce(globalSum, plusEqOp<point>());
forAll(localToGlobalRegion, localRegionI)
{

View File

@ -588,9 +588,8 @@ Foam::label Foam::DistributedDelaunayMesh<Triangulation>::referVertices
reduce(preInsertionSize, sumOp<label>());
reduce(postInsertionSize, sumOp<label>());
label nTotalToInsert = referredVertices.size();
reduce(nTotalToInsert, sumOp<label>());
label nTotalToInsert =
returnReduce(referredVertices.size(), sumOp<label>());
if (preInsertionSize + nTotalToInsert != postInsertionSize)
{

View File

@ -167,14 +167,7 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
{
if (volumeStatus[celli] == volumeType::UNKNOWN)
{
treeBoundBox cellBb
(
mesh_.cells()[celli].points
(
mesh_.faces(),
mesh_.points()
)
);
treeBoundBox cellBb(mesh_.cells()[celli].box(mesh_));
if (geometry.overlaps(cellBb))
{
@ -224,7 +217,7 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
);
}
if (returnReduce(newCellsToRefine.size(), sumOp<label>()) == 0)
if (returnReduceAnd(newCellsToRefine.empty()))
{
break;
}
@ -286,14 +279,7 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
{
if (volumeStatus[celli] == volumeType::UNKNOWN)
{
treeBoundBox cellBb
(
mesh_.cells()[celli].points
(
mesh_.faces(),
mesh_.points()
)
);
treeBoundBox cellBb(mesh_.cells()[celli].box(mesh_));
if (geometry.overlaps(cellBb))
{
@ -512,14 +498,7 @@ bool Foam::backgroundMeshDecomposition::refineCell
// const conformationSurfaces& geometry = geometryToConformTo_;
treeBoundBox cellBb
(
mesh_.cells()[celli].points
(
mesh_.faces(),
mesh_.points()
)
);
treeBoundBox cellBb(mesh_.cells()[celli].box(mesh_));
weightEstimate = 1.0;
@ -899,7 +878,7 @@ Foam::backgroundMeshDecomposition::distribute
}
}
if (returnReduce(cellsToRefine.size(), sumOp<label>()) == 0)
if (returnReduceAnd(cellsToRefine.empty()))
{
break;
}

View File

@ -153,7 +153,7 @@ public:
return name_;
}
const Switch& forceInitialPointInsertion() const
Switch forceInitialPointInsertion() const noexcept
{
return forceInitialPointInsertion_;
}

View File

@ -92,9 +92,7 @@ bool Foam::controlMeshRefinement::detectEdge
magSqr(a - b) < tolSqr
)
{
pointFound.setPoint(midPoint);
pointFound.setHit();
pointFound.hitPoint(midPoint);
return true;
}
@ -264,7 +262,7 @@ void Foam::controlMeshRefinement::initialMeshPopulation
const cellSizeAndAlignmentControl& controlFunction =
controlFunctions[fI];
const Switch& forceInsertion =
const Switch forceInsertion =
controlFunction.forceInitialPointInsertion();
Info<< "Inserting points from " << controlFunction.name()
@ -450,7 +448,7 @@ void Foam::controlMeshRefinement::initialMeshPopulation
const cellSizeAndAlignmentControl& controlFunction =
controlFunctions[fI];
const Switch& forceInsertion =
const Switch forceInsertion =
controlFunction.forceInitialPointInsertion();
Info<< "Inserting points from " << controlFunction.name()

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2017 OpenFOAM Foundation
Copyright (C) 2016-2020 OpenCFD Ltd.
Copyright (C) 2016-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -298,7 +298,7 @@ Foam::tmp<Foam::triSurfacePointScalarField> Foam::automatic::load()
(
surface_.searchableSurface::time().constant()
/ "triSurface"
/ surfaceName_.nameLessExt() + "_cellSize"
/ surfaceName_.stem() + "_cellSize"
)
);

View File

@ -38,6 +38,7 @@ Description
#if defined(CGAL_VERSION_NR) && (CGAL_VERSION_NR < 1050211000)
#define BOOST_BIND_GLOBAL_PLACEHOLDERS
#endif
#pragma clang diagnostic ignored "-Wbitwise-instead-of-logical"
// ------------------------------------------------------------------------- //

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2020-2021 OpenCFD Ltd.
Copyright (C) 2020-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -87,23 +87,17 @@ void Foam::conformalVoronoiMesh::cellSizeMeshOverlapsBackground() const
boundBox cellSizeMeshBb = cellSizeMesh.bounds();
bool fullyContained = true;
bool fullyContained = cellSizeMeshBb.contains(bb);
if (!cellSizeMeshBb.contains(bb))
if (!fullyContained)
{
Pout<< "Triangulation not fully contained in cell size mesh."
<< endl;
Pout<< "Cell Size Mesh Bounds = " << cellSizeMesh.bounds() << endl;
Pout<< "foamyHexMesh Bounds = " << bb << endl;
fullyContained = false;
Pout<< "Triangulation not fully contained in cell size mesh." << endl
<< "Cell Size Mesh Bounds = " << cellSizeMeshBb << endl
<< "foamyHexMesh Bounds = " << bb << endl;
}
reduce(fullyContained, andOp<unsigned int>());
Info<< "Triangulation is "
<< (fullyContained ? "fully" : "not fully")
<< (returnReduceAnd(fullyContained) ? "fully" : "not fully")
<< " contained in the cell size mesh"
<< endl;
}
@ -115,12 +109,7 @@ void Foam::conformalVoronoiMesh::insertInternalPoints
bool distribute
)
{
label nPoints = points.size();
if (Pstream::parRun())
{
reduce(nPoints, sumOp<label>());
}
const label nPoints = returnReduce(points.size(), sumOp<label>());
Info<< " " << nPoints << " points to insert..." << endl;
@ -145,16 +134,15 @@ void Foam::conformalVoronoiMesh::insertInternalPoints
map().distribute(points);
}
label nVert = number_of_vertices();
label preReinsertionSize(number_of_vertices());
insert(points.begin(), points.end());
label nInserted(number_of_vertices() - nVert);
if (Pstream::parRun())
{
reduce(nInserted, sumOp<label>());
}
const label nInserted = returnReduce
(
label(number_of_vertices()) - preReinsertionSize,
sumOp<label>()
);
Info<< " " << nInserted << " points inserted"
<< ", failed to insert " << nPoints - nInserted

View File

@ -753,7 +753,7 @@ Foam::conformalVoronoiMesh::createPolyMeshFromPoints
forAll(patches, p)
{
label totalPatchSize = patchDicts[p].get<label>("nFaces");
label nPatchFaces = patchDicts[p].get<label>("nFaces");
if
(
@ -762,7 +762,7 @@ Foam::conformalVoronoiMesh::createPolyMeshFromPoints
)
{
// Do not create empty processor patches
if (totalPatchSize > 0)
if (nPatchFaces)
{
patchDicts[p].set("transform", "coincidentFullMatch");
@ -781,9 +781,8 @@ Foam::conformalVoronoiMesh::createPolyMeshFromPoints
else
{
// Check that the patch is not empty on every processor
reduce(totalPatchSize, sumOp<label>());
if (totalPatchSize > 0)
if (returnReduceOr(nPatchFaces))
{
patches[nValidPatches] = polyPatch::New
(

View File

@ -729,7 +729,7 @@ Foam::label Foam::conformalVoronoiMesh::synchroniseSurfaceTrees
}
}
Pstream::listCombineAllGather(hits, plusEqOp<labelHashSet>());
Pstream::listCombineReduce(hits, plusEqOp<labelHashSet>());
forAll(surfaceHits, eI)
{
@ -816,7 +816,7 @@ Foam::label Foam::conformalVoronoiMesh::synchroniseEdgeTrees
}
}
Pstream::listCombineAllGather(hits, plusEqOp<labelHashSet>());
Pstream::listCombineReduce(hits, plusEqOp<labelHashSet>());
forAll(featureEdgeHits, eI)
{

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2017 OpenFOAM Foundation
Copyright (C) 2015-2018 OpenCFD Ltd.
Copyright (C) 2015-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -707,9 +707,7 @@ void Foam::conformalVoronoiMesh::reorderProcessorPatches
Info<< incrIndent << indent << "Faces matched." << endl;
reduce(anyChanged, orOp<bool>());
if (anyChanged)
if (returnReduceOr(anyChanged))
{
label nReorderedFaces = 0;

View File

@ -44,6 +44,7 @@ SourceFiles
#if defined(CGAL_VERSION_NR) && (CGAL_VERSION_NR < 1050211000)
#define BOOST_BIND_GLOBAL_PLACEHOLDERS
#endif
#pragma clang diagnostic ignored "-Wbitwise-instead-of-logical"
// ------------------------------------------------------------------------- //

View File

@ -45,6 +45,7 @@ SourceFiles
#if defined(CGAL_VERSION_NR) && (CGAL_VERSION_NR < 1050211000)
#define BOOST_BIND_GLOBAL_PLACEHOLDERS
#endif
#pragma clang diagnostic ignored "-Wbitwise-instead-of-logical"
// ------------------------------------------------------------------------- //

View File

@ -605,7 +605,7 @@ Foam::conformationSurfaces::conformationSurfaces
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
bool Foam::conformationSurfaces::overlaps(const treeBoundBox& bb) const
bool Foam::conformationSurfaces::overlaps(const boundBox& bb) const
{
forAll(surfaces_, s)
{

View File

@ -188,7 +188,7 @@ public:
//- Check if the supplied bound box overlaps any part of any of
// the surfaces
bool overlaps(const treeBoundBox& bb) const;
bool overlaps(const boundBox& bb) const;
//- Check if points are inside surfaces to conform to
Field<bool> inside(const pointField& samplePts) const;

View File

@ -84,16 +84,12 @@ Foam::searchableBoxFeatures::features() const
autoPtr<extendedFeatureEdgeMesh> features;
List<vector> faceNormalsList(treeBoundBox::faceNormals);
vectorField faceNormals(faceNormalsList);
vectorField faceNormals(std::move(faceNormalsList));
vectorField edgeDirections(12);
labelListList normalDirections(12);
labelListList normalDirections(12, labelList(2, Zero));
labelListList edgeNormals(12, labelList(2, Zero));
labelListList edgeNormals(12);
forAll(edgeNormals, eI)
{
edgeNormals[eI].setSize(2, 0);
}
edgeNormals[0][0] = 2; edgeNormals[0][1] = 4;
edgeNormals[1][0] = 1; edgeNormals[1][1] = 4;
edgeNormals[2][0] = 3; edgeNormals[2][1] = 4;
@ -116,7 +112,6 @@ Foam::searchableBoxFeatures::features() const
surfacePoints[treeBoundBox::edges[eI].end()]
- surfacePoints[treeBoundBox::edges[eI].start()];
normalDirections[eI] = labelList(2, Zero);
for (label j = 0; j < 2; ++j)
{
const vector cross =
@ -138,12 +133,12 @@ Foam::searchableBoxFeatures::features() const
}
}
labelListList featurePointNormals(8);
labelListList featurePointEdges(8);
labelListList featurePointNormals(8, labelList(3, Zero));
labelListList featurePointEdges(8, labelList(3, Zero));
forAll(featurePointNormals, pI)
{
labelList& ftPtEdges = featurePointEdges[pI];
ftPtEdges.setSize(3, 0);
label edgeI = 0;
forAll(treeBoundBox::edges, eI)
@ -161,7 +156,6 @@ Foam::searchableBoxFeatures::features() const
}
labelList& ftPtNormals = featurePointNormals[pI];
ftPtNormals.setSize(3, 0);
ftPtNormals[0] = edgeNormals[ftPtEdges[0]][0];
ftPtNormals[1] = edgeNormals[ftPtEdges[0]][1];

View File

@ -727,14 +727,12 @@ int main(int argc, char *argv[])
pointField mergedPoints;
faceList mergedFaces;
labelList pointMergeMap;
PatchTools::gatherAndMerge
(
tolDim,
primitivePatch(SubList<face>(isoFaces), isoPoints),
mergedPoints,
mergedFaces,
pointMergeMap
mergedFaces
);
if (Pstream::master())

View File

@ -38,6 +38,7 @@ Description
#if defined(CGAL_VERSION_NR) && (CGAL_VERSION_NR < 1050211000)
#define BOOST_BIND_GLOBAL_PLACEHOLDERS
#endif
#pragma clang diagnostic ignored "-Wbitwise-instead-of-logical"
// ------------------------------------------------------------------------- //

View File

@ -40,6 +40,7 @@ Description
#if defined(CGAL_VERSION_NR) && (CGAL_VERSION_NR < 1050211000)
#define BOOST_BIND_GLOBAL_PLACEHOLDERS
#endif
#pragma clang diagnostic ignored "-Wbitwise-instead-of-logical"
// ------------------------------------------------------------------------- //

View File

@ -416,10 +416,12 @@ void extractSurface
// Allocate zone/patch for all patches
HashTable<label> compactZoneID(1024);
forAllConstIters(patchSize, iter)
if (Pstream::master())
{
label sz = compactZoneID.size();
compactZoneID.insert(iter.key(), sz);
forAllConstIters(patchSize, iter)
{
compactZoneID.insert(iter.key(), compactZoneID.size());
}
}
Pstream::broadcast(compactZoneID);
@ -431,7 +433,7 @@ void extractSurface
label patchi = bMesh.findPatchID(iter.key());
if (patchi != -1)
{
patchToCompactZone[patchi] = iter();
patchToCompactZone[patchi] = iter.val();
}
}
@ -663,7 +665,7 @@ void removeZeroSizedPatches(fvMesh& mesh)
if
(
isA<coupledPolyPatch>(pp)
|| returnReduce(pp.size(), sumOp<label>())
|| returnReduceOr(pp.size())
)
{
// Coupled (and unknown size) or uncoupled and used
@ -1889,11 +1891,8 @@ int main(int argc, char *argv[])
);
// Use the maxLocalCells from the refinement parameters
bool preBalance = returnReduce
(
(mesh.nCells() >= refineParams.maxLocalCells()),
orOp<bool>()
);
const bool preBalance =
returnReduceOr(mesh.nCells() >= refineParams.maxLocalCells());
if (!overwrite && !debugLevel)

View File

@ -104,9 +104,6 @@ void Foam::checkPatch
// << endl;
}
//DebugVar(globalEdgeFaces);
// Synchronise across coupled edges.
syncTools::syncEdgeList
(
@ -116,7 +113,6 @@ void Foam::checkPatch
labelList() // null value
);
//DebugVar(globalEdgeFaces);
label labelTyp = TopoType::MANIFOLD;
forAll(meshEdges, edgei)
@ -191,7 +187,7 @@ void Foam::checkPatch
{
const labelList& mp = pp.meshPoints();
if (returnReduce(mp.size(), sumOp<label>()) > 0)
if (returnReduceOr(mp.size()))
{
boundBox bb(pp.points(), mp, true); // reduce
Info<< ' ' << bb;
@ -200,6 +196,35 @@ void Foam::checkPatch
}
template<class Zone>
Foam::label Foam::checkZones
(
const polyMesh& mesh,
const ZoneMesh<Zone, polyMesh>& zones,
topoSet& set
)
{
labelList zoneID(set.maxSize(mesh), -1);
for (const auto& zone : zones)
{
for (const label elem : zone)
{
if
(
zoneID[elem] != -1
&& zoneID[elem] != zone.index()
)
{
set.insert(elem);
}
zoneID[elem] = zone.index();
}
}
return returnReduce(set.size(), sumOp<label>());
}
Foam::label Foam::checkTopology
(
const polyMesh& mesh,
@ -227,10 +252,10 @@ Foam::label Foam::checkTopology
}
}
reduce(nEmpty, sumOp<label>());
label nTotCells = returnReduce(mesh.cells().size(), sumOp<label>());
const label nCells = returnReduce(mesh.cells().size(), sumOp<label>());
// These are actually warnings, not errors.
if (nTotCells && (nEmpty % nTotCells))
if (nCells && (nEmpty % nCells))
{
Info<< " ***Total number of faces on empty patches"
<< " is not divisible by the number of cells in the mesh."
@ -310,7 +335,7 @@ Foam::label Foam::checkTopology
{
noFailedChecks++;
label nPoints = returnReduce(points.size(), sumOp<label>());
const label nPoints = returnReduce(points.size(), sumOp<label>());
Info<< " <<Writing " << nPoints
<< " unused points to set " << points.name() << endl;
@ -447,7 +472,7 @@ Foam::label Foam::checkTopology
}
}
label nOneCells = returnReduce(oneCells.size(), sumOp<label>());
const label nOneCells = returnReduce(oneCells.size(), sumOp<label>());
if (nOneCells > 0)
{
@ -463,7 +488,7 @@ Foam::label Foam::checkTopology
}
}
label nTwoCells = returnReduce(twoCells.size(), sumOp<label>());
const label nTwoCells = returnReduce(twoCells.size(), sumOp<label>());
if (nTwoCells > 0)
{
@ -563,11 +588,7 @@ Foam::label Foam::checkTopology
}
}
Pstream::listCombineAllGather
(
regionDisconnected,
andEqOp<bool>()
);
Pstream::listCombineReduce(regionDisconnected, andEqOp<bool>());
}
@ -614,7 +635,7 @@ Foam::label Foam::checkTopology
cellRegions[i].write();
}
label nPoints = returnReduce(points.size(), sumOp<label>());
const label nPoints = returnReduce(points.size(), sumOp<label>());
if (nPoints)
{
Info<< " <<Writing " << nPoints
@ -714,6 +735,25 @@ Foam::label Foam::checkTopology
);
Info<< endl;
}
// Check for duplicates
if (allTopology)
{
faceSet mzFaces(mesh, "multiZoneFaces", mesh.nFaces()/100);
const label nMulti = checkZones(mesh, faceZones, mzFaces);
if (nMulti)
{
Info<< " <<Writing " << nMulti
<< " faces that are in multiple zones"
<< " to set " << mzFaces.name() << endl;
mzFaces.instance() = mesh.pointsInstance();
mzFaces.write();
if (surfWriter && surfWriter->enabled())
{
mergeAndWrite(*surfWriter, mzFaces);
}
}
}
}
else
{
@ -791,6 +831,26 @@ Foam::label Foam::checkTopology
<< returnReduce(v, sumOp<scalar>())
<< ' ' << bb << endl;
}
// Check for duplicates
if (allTopology)
{
cellSet mzCells(mesh, "multiZoneCells", mesh.nCells()/100);
const label nMulti = checkZones(mesh, cellZones, mzCells);
if (nMulti)
{
Info<< " <<Writing " << nMulti
<< " cells that are in multiple zones"
<< " to set " << mzCells.name() << endl;
mzCells.instance() = mesh.pointsInstance();
mzCells.write();
if (surfWriter && surfWriter->enabled())
{
mergeAndWrite(*surfWriter, mzCells);
}
}
}
}
else
{
@ -798,6 +858,65 @@ Foam::label Foam::checkTopology
}
}
{
Info<< "\nChecking basic pointZone addressing..." << endl;
Pout.setf(ios_base::left);
const pointZoneMesh& pointZones = mesh.pointZones();
if (pointZones.size())
{
Info<< " "
<< setw(20) << "PointZone"
<< setw(8) << "Points"
<< "BoundingBox" << endl;
for (const auto& zone : pointZones)
{
boundBox bb;
for (const label pointi : zone)
{
bb.add(mesh.points()[pointi]);
}
bb.reduce(); // Global min/max
Info<< " "
<< setw(20) << zone.name()
<< setw(8)
<< returnReduce(zone.size(), sumOp<label>())
<< bb << endl;
}
// Check for duplicates
if (allTopology)
{
pointSet mzPoints(mesh, "multiZonePoints", mesh.nPoints()/100);
const label nMulti = checkZones(mesh, pointZones, mzPoints);
if (nMulti)
{
Info<< " <<Writing " << nMulti
<< " points that are in multiple zones"
<< " to set " << mzPoints.name() << endl;
mzPoints.instance() = mesh.pointsInstance();
mzPoints.write();
if (setWriter && setWriter->enabled())
{
mergeAndWrite(*setWriter, mzPoints);
}
}
}
}
else
{
Info<< " No pointZones found."<<endl;
}
}
// Force creation of all addressing if requested.
// Errors will be reported as required
if (allTopology)

View File

@ -1,5 +1,7 @@
#include "labelList.H"
#include "autoPtr.H"
#include "ZoneMesh.H"
#include "topoSet.H"
namespace Foam
{
@ -21,6 +23,14 @@ namespace Foam
pointSet& points
);
template<class Zone>
label checkZones
(
const polyMesh& mesh,
const ZoneMesh<Zone, polyMesh>& zones,
topoSet& set
);
label checkTopology
(
const polyMesh& mesh,

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2021 OpenCFD Ltd.
Copyright (C) 2016-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -138,7 +138,7 @@ void filterPatches(fvMesh& mesh, const wordHashSet& addedPatchNames)
if
(
isA<coupledPolyPatch>(pp)
|| returnReduce(pp.size(), sumOp<label>())
|| returnReduceOr(pp.size())
|| addedPatchNames.found(pp.name())
)
{

View File

@ -686,7 +686,7 @@ void syncPoints
//- Note: hasTransformation is only used for warning messages so
// reduction not strictly necessary.
//reduce(hasTransformation, orOp<bool>());
//Pstream::reduceOr(hasTransformation);
// Synchronize multiple shared points.
const globalMeshData& pd = mesh.globalData();
@ -714,7 +714,7 @@ void syncPoints
}
// Combine - globally consistent
Pstream::listCombineAllGather(sharedPts, cop);
Pstream::listCombineReduce(sharedPts, cop);
// Now we will all have the same information. Merge it back with
// my local information.

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2013-2016 OpenFOAM Foundation
Copyright (C) 2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -272,7 +273,7 @@ int main(int argc, char *argv[])
}
if (returnReduce(changedEdges.size(), sumOp<label>()) == 0)
if (returnReduceAnd(changedEdges.empty()))
{
break;
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2021 OpenCFD Ltd.
Copyright (C) 2016-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -1103,9 +1103,7 @@ int main(int argc, char *argv[])
// Update proc maps
if (cellProcAddressing.headerOk())
{
bool localOk = (cellProcAddressing.size() == mesh.nCells());
if (returnReduce(localOk, andOp<bool>()))
if (returnReduceAnd(cellProcAddressing.size() == mesh.nCells()))
{
Info<< "Renumbering processor cell decomposition map "
<< cellProcAddressing.name() << endl;
@ -1129,9 +1127,7 @@ int main(int argc, char *argv[])
if (faceProcAddressing.headerOk())
{
bool localOk = (faceProcAddressing.size() == mesh.nFaces());
if (returnReduce(localOk, andOp<bool>()))
if (returnReduceAnd(faceProcAddressing.size() == mesh.nFaces()))
{
Info<< "Renumbering processor face decomposition map "
<< faceProcAddressing.name() << endl;
@ -1171,9 +1167,7 @@ int main(int argc, char *argv[])
if (pointProcAddressing.headerOk())
{
bool localOk = (pointProcAddressing.size() == mesh.nPoints());
if (returnReduce(localOk, andOp<bool>()))
if (returnReduceAnd(pointProcAddressing.size() == mesh.nPoints()))
{
Info<< "Renumbering processor point decomposition map "
<< pointProcAddressing.name() << endl;
@ -1197,12 +1191,13 @@ int main(int argc, char *argv[])
if (boundaryProcAddressing.headerOk())
{
bool localOk =
if
(
boundaryProcAddressing.size()
== mesh.boundaryMesh().size()
);
if (returnReduce(localOk, andOp<bool>()))
returnReduceAnd
(
boundaryProcAddressing.size() == mesh.boundaryMesh().size()
)
)
{
// No renumbering needed
}

View File

@ -847,7 +847,7 @@ void createAndWriteRegion
if (!isA<processorPolyPatch>(pp))
{
if (returnReduce(pp.size(), sumOp<label>()) > 0)
if (returnReduceOr(pp.size()))
{
oldToNew[patchi] = newI;
if (!addedPatches.found(patchi))
@ -1114,7 +1114,7 @@ label findCorrespondingRegion
}
}
Pstream::listCombineAllGather(cellsInZone, plusEqOp<label>());
Pstream::listCombineReduce(cellsInZone, plusEqOp<label>());
// Pick region with largest overlap of zoneI
label regionI = findMax(cellsInZone);

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 OpenFOAM Foundation
Copyright (C) 2017-2021 OpenCFD Ltd.
Copyright (C) 2017-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -144,11 +144,7 @@ using namespace Foam;
// but leave anything with '/' delimiters untouched
bool upgradeScope(word& entryName)
{
if
(
entryName.find('/') == string::npos
&& entryName.find(':') != string::npos
)
if (!entryName.contains('/') && entryName.contains(':'))
{
const wordList names(fileName(entryName).components(':'));

View File

@ -223,7 +223,7 @@ bool writeOptionalMeshObject
// Make sure all know if there is a valid class name
wordList classNames(1, io.headerClassName());
Pstream::combineAllGather(classNames, uniqueEqOp<word>());
Pstream::combineReduce(classNames, uniqueEqOp<word>());
// Check for correct type
if (classNames[0] == T::typeName)
@ -429,7 +429,7 @@ int main(int argc, char *argv[])
)
);
Pstream::combineAllGather(lagrangianDirs, uniqueEqOp<fileName>());
Pstream::combineReduce(lagrangianDirs, uniqueEqOp<fileName>());
if (!lagrangianDirs.empty())
{
@ -466,7 +466,7 @@ int main(int argc, char *argv[])
)
);
Pstream::combineAllGather(cloudDirs, uniqueEqOp<fileName>());
Pstream::combineReduce(cloudDirs, uniqueEqOp<fileName>());
forAll(cloudDirs, i)
{
@ -492,7 +492,7 @@ int main(int argc, char *argv[])
);
// Combine with all other cloud objects
Pstream::combineAllGather(cloudFields, uniqueEqOp<word>());
Pstream::combineReduce(cloudFields, uniqueEqOp<word>());
for (const word& name : cloudFields)
{

View File

@ -252,7 +252,7 @@ autoPtr<mapPolyMesh> mergeSharedPoints
Info<< "mergeSharedPoints : detected " << pointToMaster.size()
<< " points that are to be merged." << endl;
if (returnReduce(pointToMaster.size(), sumOp<label>()) == 0)
if (returnReduceAnd(pointToMaster.empty()))
{
return nullptr;
}

View File

@ -69,7 +69,7 @@ Foam::boolList Foam::haveMeshFile
void Foam::removeProcAddressing(const faMesh& mesh)
{
IOobject ioAddr
IOobject io
(
"procAddressing",
mesh.facesInstance(),
@ -79,9 +79,9 @@ void Foam::removeProcAddressing(const faMesh& mesh)
for (const auto prefix : {"boundary", "edge", "face", "point"})
{
ioAddr.rename(prefix + word("ProcAddressing"));
io.rename(prefix + word("ProcAddressing"));
const fileName procFile(ioAddr.objectPath());
const fileName procFile(io.objectPath());
Foam::rm(procFile);
}
}
@ -89,7 +89,7 @@ void Foam::removeProcAddressing(const faMesh& mesh)
void Foam::removeProcAddressing(const polyMesh& mesh)
{
IOobject ioAddr
IOobject io
(
"procAddressing",
mesh.facesInstance(),
@ -99,89 +99,18 @@ void Foam::removeProcAddressing(const polyMesh& mesh)
for (const auto prefix : {"boundary", "cell", "face", "point"})
{
ioAddr.rename(prefix + word("ProcAddressing"));
io.rename(prefix + word("ProcAddressing"));
const fileName procFile(ioAddr.objectPath());
const fileName procFile(io.objectPath());
Foam::rm(procFile);
}
}
bool Foam::removeEmptyDir(const fileName& path)
void Foam::removeEmptyDir(const fileName& path)
{
// Return true if empty directory. Note bypass of fileHandler to be
// consistent with polyMesh.removeFiles for now.
{
fileNameList files
(
Foam::readDir
(
path,
fileName::FILE,
false, // filterGz
false // followLink
)
);
if (files.size())
{
return false;
}
}
{
fileNameList dirs
(
Foam::readDir
(
path,
fileName::DIRECTORY,
false, // filterGz
false // followLink
)
);
if (dirs.size())
{
return false;
}
}
{
fileNameList links
(
Foam::readDir
(
path,
fileName::SYMLINK,
false, // filterGz
false // followLink
)
);
if (links.size())
{
return false;
}
}
{
fileNameList other
(
Foam::readDir
(
path,
fileName::UNDEFINED,
false, // filterGz
false // followLink
)
);
if (other.size())
{
return false;
}
}
// Avoid checking success of deletion since initial path might not
// exist (e.g. contain 'region0'). Will stop when trying to delete
// parent directory anyway since now not empty.
Foam::rm(path);
return true;
// Remove directory: silent, emptyOnly
Foam::rmDir(path, true, true);
}

View File

@ -64,8 +64,8 @@ void removeProcAddressing(const faMesh& mesh);
//- Remove procAddressing
void removeProcAddressing(const polyMesh& mesh);
//- Remove empty directory. Return true if removed.
bool removeEmptyDir(const fileName& path);
//- Remove empty directory
void removeEmptyDir(const fileName& path);
//- Remove empty directories from bottom up
void removeEmptyDirs(const fileName& path);

View File

@ -224,7 +224,7 @@ Foam::parFvFieldDistributor::distributeField
}
// Map all faces
primitiveField = Field<Type>(flatFld, mapper, fld.oriented()());
primitiveField = Field<Type>(flatFld, mapper, fld.is_oriented());
// Trim to internal faces (note: could also have special mapper)
primitiveField.resize

View File

@ -89,10 +89,11 @@ void Foam::parLagrangianDistributor::findClouds
}
// Synchronise cloud names
Pstream::combineGather(cloudNames, ListOps::uniqueEqOp<word>());
Pstream::broadcast(cloudNames);
Pstream::combineReduce(cloudNames, ListOps::uniqueEqOp<word>());
Foam::sort(cloudNames); // Consistent order
objectNames.setSize(cloudNames.size());
objectNames.clear();
objectNames.resize(cloudNames.size());
for (const fileName& localCloudName : localCloudDirs)
{
@ -124,11 +125,11 @@ void Foam::parLagrangianDistributor::findClouds
}
}
// Synchronise objectNames
forAll(objectNames, i)
// Synchronise objectNames (per cloud)
for (wordList& objNames : objectNames)
{
Pstream::combineGather(objectNames[i], ListOps::uniqueEqOp<word>());
Pstream::broadcast(objectNames[i]);
Pstream::combineReduce(objNames, ListOps::uniqueEqOp<word>());
Foam::sort(objNames); // Consistent order
}
}
@ -291,7 +292,7 @@ Foam::parLagrangianDistributor::distributeLagrangianPositions
nsTransPs[sendProcI] = subMap[sendProcI].size();
}
// Send sizes across. Note: blocks.
Pstream::combineAllGather(sizes, Pstream::listEq());
Pstream::combineReduce(sizes, Pstream::listEq());
labelListList constructMap(Pstream::nProcs());
label constructSize = 0;

View File

@ -51,14 +51,9 @@ Foam::wordList Foam::parLagrangianDistributor::filterObjects
: objects.names<Container>(selectedFields)
);
// Parallel synchronise
// - Combine names from all processors
Pstream::combineGather(fieldNames, ListOps::uniqueEqOp<word>());
Pstream::broadcast(fieldNames);
// Sort for consistent order on all processors
Foam::sort(fieldNames);
// Parallel synchronise - combine names from all processors
Pstream::combineReduce(fieldNames, ListOps::uniqueEqOp<word>());
Foam::sort(fieldNames); // Consistent order
return fieldNames;
}
@ -93,11 +88,8 @@ Foam::label Foam::parLagrangianDistributor::distributeFields
if (!nFields)
{
// Performing an all-to-one (reconstruct)?
reconstruct = returnReduce
(
(!map.constructSize() || Pstream::master()),
andOp<bool>()
);
reconstruct =
returnReduceAnd(!map.constructSize() || Pstream::master());
}
if (verbose_)
@ -200,11 +192,8 @@ Foam::label Foam::parLagrangianDistributor::distributeFieldFields
if (!nFields)
{
// Performing an all-to-one (reconstruct)?
reconstruct = returnReduce
(
(!map.constructSize() || Pstream::master()),
andOp<bool>()
);
reconstruct =
returnReduceAnd(!map.constructSize() || Pstream::master());
}
if (verbose_)
@ -349,11 +338,8 @@ Foam::label Foam::parLagrangianDistributor::distributeStoredFields
if (!nFields)
{
// Performing an all-to-one (reconstruct)?
reconstruct = returnReduce
(
(!map.constructSize() || Pstream::master()),
andOp<bool>()
);
reconstruct =
returnReduceAnd(!map.constructSize() || Pstream::master());
}
if (verbose_)

View File

@ -132,7 +132,7 @@ void createTimeDirs(const fileName& path)
//Pstream::parRun(oldParRun); // Restore parallel state
masterTimeDirs = localTimeDirs;
}
Pstream::scatter(masterTimeDirs);
Pstream::broadcast(masterTimeDirs);
//DebugVar(masterTimeDirs);
//DebugVar(localTimeDirs);
@ -1168,7 +1168,7 @@ int main(int argc, char *argv[])
bool nfs = true;
{
List<fileName> roots(1, args.rootPath());
Pstream::combineAllGather(roots, ListOps::uniqueEqOp<fileName>());
Pstream::combineReduce(roots, ListOps::uniqueEqOp<fileName>());
nfs = (roots.size() == 1);
}
@ -1187,7 +1187,8 @@ int main(int argc, char *argv[])
{
if (decompose)
{
Info<< "Removing existing processor directory" << procDir << endl;
Info<< "Removing existing processor directory:"
<< args.relativePath(procDir) << endl;
fileHandler().rmDir(procDir);
}
}
@ -1202,7 +1203,7 @@ int main(int argc, char *argv[])
}
}
// If master changed to decompose mode make sure all nodes know about it
Pstream::scatter(decompose);
Pstream::broadcast(decompose);
// If running distributed we have problem of new processors not finding
@ -1287,7 +1288,7 @@ int main(int argc, char *argv[])
// use the times list from the master processor
// and select a subset based on the command-line options
instantList timeDirs = timeSelector::select(runTime.times(), args);
Pstream::scatter(timeDirs);
Pstream::broadcast(timeDirs);
if (timeDirs.empty())
{
@ -1546,7 +1547,7 @@ int main(int argc, char *argv[])
if
(
!volMeshHaveUndecomposed
|| !returnReduce(haveVolAddressing, andOp<bool>())
|| !returnReduceAnd(haveVolAddressing)
)
{
Info<< "No undecomposed mesh. Creating from: "
@ -1614,7 +1615,7 @@ int main(int argc, char *argv[])
&&
(
!areaMeshHaveUndecomposed
|| !returnReduce(haveAreaAddressing, andOp<bool>())
|| !returnReduceAnd(haveAreaAddressing)
)
)
{
@ -2066,7 +2067,7 @@ int main(int argc, char *argv[])
args
)[0].value();
}
Pstream::scatter(masterTime);
Pstream::broadcast(masterTime);
Info<< "Setting time to that of master or undecomposed case : "
<< masterTime << endl;
runTime.setTime(masterTime, 0);
@ -2348,6 +2349,8 @@ int main(int argc, char *argv[])
// Remove any left-over empty processor directories created
// by loadOrCreateMesh to get around the collated start-up
// problems
Info<< "Removing left-over empty processor directories" << nl;
if (Pstream::master()) //fileHandler().comm()))
{
const auto myProci = UPstream::myProcNo(); //comm()
@ -2364,9 +2367,7 @@ int main(int argc, char *argv[])
&& volMeshDir[proci] != volMeshDir[myProci]
)
{
Info<< "Deleting mesh dir:"
<< volMeshDir[proci] << endl;
Foam::rmDir(volMeshDir[proci]);
Foam::rmDir(volMeshDir[proci], true); // silent
}
if
@ -2375,9 +2376,18 @@ int main(int argc, char *argv[])
&& areaMeshDir[proci] != areaMeshDir[myProci]
)
{
Info<< "Deleting mesh dir:"
<< areaMeshDir[proci] << endl;
Foam::rmDir(areaMeshDir[proci]);
Foam::rmDir(areaMeshDir[proci], true); // silent
}
// Remove empty processor directories
// Eg, <path-name>/processorN/constant/polyMesh
// to <path-name>/processorN
if (proci != myProci)
{
removeEmptyDir
(
volMeshDir[proci].path().path()
);
}
}
@ -2441,7 +2451,8 @@ int main(int argc, char *argv[])
// Remove dummy mesh created by loadOrCreateMesh
const bool oldParRun = Pstream::parRun(false);
mesh.removeFiles();
Foam::rmDir(mesh.objectRegistry::objectPath());
// Silent rmdir
Foam::rmDir(mesh.objectRegistry::objectPath(), true);
Pstream::parRun(oldParRun); // Restore parallel state
}
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2021 OpenCFD Ltd.
Copyright (C) 2021-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -78,6 +78,6 @@ if (timeDirs.size() > 1)
}
// Ensure consistency
reduce(hasMovingMesh, orOp<bool>());
Pstream::reduceOr(hasMovingMesh);
// ************************************************************************* //

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2021 OpenCFD Ltd.
Copyright (C) 2018-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -38,7 +38,7 @@ if (doLagrangian)
Info<< "Cloud " << cloudName << " (";
const bool cloudExists =
returnReduce(currentCloudDirs.found(cloudName), orOp<bool>());
returnReduceOr(currentCloudDirs.found(cloudName));
{
autoPtr<ensightFile> os = ensCase.newCloud(cloudName);
@ -82,7 +82,7 @@ if (doLagrangian)
const bool oldParRun = Pstream::parRun(false);
fieldExists = fieldObject.typeHeaderOk<IOField<scalar>>(false);
Pstream::parRun(oldParRun); // Restore parallel state
reduce(fieldExists, orOp<bool>());
Pstream::reduceOr(fieldExists);
}
bool wrote = false;

View File

@ -101,7 +101,7 @@ if (timeDirs.size() && doLagrangian)
{
for (auto& cloudFields : regionCloudFields)
{
Pstream::mapCombineAllGather
Pstream::mapCombineReduce
(
cloudFields,
HashTableOps::plusEqOp<word>()

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018 OpenCFD Ltd.
Copyright (C) 2018-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -64,9 +64,7 @@ Foam::label Foam::checkData
}
}
reduce(good, andOp<bool>());
if (good)
if (returnReduceAnd(good))
{
goodFields.insert(fieldName);
}

View File

@ -46,11 +46,9 @@ if (doLagrangian)
if (Pstream::parRun())
{
// Synchronise cloud names
Pstream::combineGather(cloudNames, ListOps::uniqueEqOp<word>());
Pstream::broadcast(cloudNames);
Pstream::combineReduce(cloudNames, ListOps::uniqueEqOp<word>());
}
// Consistent order
Foam::sort(cloudNames);
Foam::sort(cloudNames); // Consistent order
for (const word& cloudName : cloudNames)
{
@ -66,7 +64,7 @@ if (doLagrangian)
isCloud = true;
}
if (!returnReduce(isCloud, orOp<bool>()))
if (!returnReduceOr(isCloud))
{
continue;
}
@ -78,7 +76,7 @@ if (doLagrangian)
);
// Are there cloud fields (globally)?
if (returnReduce(cloudObjs.empty(), andOp<bool>()))
if (returnReduceAnd(cloudObjs.empty()))
{
continue;
}

View File

@ -186,7 +186,7 @@ int main(int argc, char *argv[])
const label maxNProcs = returnReduce(maxIds.size(), maxOp<label>());
maxIds.resize(maxNProcs, -1);
Pstream::listCombineAllGather(maxIds, maxEqOp<label>());
Pstream::listCombineReduce(maxIds, maxEqOp<label>());
// From ids to count
const labelList numIds = maxIds + 1;

View File

@ -77,8 +77,7 @@ Foam::label Foam::particleTracksSampler::setTrackFields
if (Pstream::parRun())
{
Pstream::combineGather(fieldNames, ListOps::uniqueEqOp<word>());
Pstream::broadcast(fieldNames);
Pstream::combineReduce(fieldNames, ListOps::uniqueEqOp<word>());
}
for (const word& fieldName : fieldNames)

View File

@ -15,10 +15,5 @@ wordRes acceptFields(propsDict.get<wordRes>("fields"));
wordRes excludeFields;
propsDict.readIfPresent("exclude", excludeFields);
const dictionary formatOptions
(
propsDict.subOrEmptyDict("formatOptions", keyType::LITERAL)
);
// ************************************************************************* //

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -68,7 +69,7 @@ void Foam::channelIndex::walkOppositeFaces
blockedFace[facei] = true;
}
while (returnReduce(frontFaces.size(), sumOp<label>()) > 0)
while (returnReduceOr(frontFaces.size()))
{
// Transfer across.
boolList isFrontBndFace(nBnd, false);

View File

@ -40,7 +40,7 @@ Foam::Field<T> Foam::channelIndex::regionSum(const Field<T>& cellField) const
}
// Global sum
Pstream::listCombineAllGather(regionField, plusEqOp<T>());
Pstream::listCombineReduce(regionField, plusEqOp<T>());
return regionField;
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2016-2021 OpenCFD Ltd.
Copyright (C) 2016-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -127,7 +127,7 @@ int main(int argc, char *argv[])
IOdictionary dict(dictIO);
autoPtr<noiseModel> model(noiseModel::New(dict));
autoPtr<noiseModel> model(noiseModel::New(dict, runTime));
model->calculate();
Info<< nl << "End\n" << endl;

View File

@ -193,14 +193,14 @@ int main(int argc, char* argv[])
const labelRange origBlocks(0, obstacles.size());
// Intersection blockage
labelRange interBlocks(origBlocks.after(), 0);
labelRange interBlocks(origBlocks.end_value(), 0);
scalar volSubtract = 0;
// Do binary intersections between blocks and cylinders (or diag-beam)
// by creating -ve blocks at the overlap
labelRange int1Blocks(origBlocks.after(), 0);
labelRange int1Blocks(origBlocks.end_value(), 0);
if (pars.overlaps % 2 > 0)
{
@ -219,7 +219,7 @@ int main(int argc, char* argv[])
// Do binary intersections between blocks
// by creating -ve blocks at the overlap
labelRange int2Blocks(int1Blocks.after(), 0);
labelRange int2Blocks(int1Blocks.end_value(), 0);
if (pars.overlaps % 4 > 1)
{
Info<< " block/block intersections" << endl;
@ -237,7 +237,7 @@ int main(int argc, char* argv[])
// Correct for triple intersections
// by looking for overlaps between the -ve blocks just created
labelRange int3Blocks(int2Blocks.after(), 0);
labelRange int3Blocks(int2Blocks.end_value(), 0);
if (pars.overlaps % 8 > 3)
{
Info<< " triple intersections" << endl;

View File

@ -223,7 +223,7 @@ void Foam::solverTemplate::setRegionProperties
fieldDimensions_[regionI].set
(
i,
new dimensionSet(dict, "dimensions")
new dimensionSet("dimensions", dict)
);
}
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019-2021 OpenCFD Ltd.
Copyright (C) 2019-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -238,7 +238,7 @@ void rewriteBoundary
patches.reorder(oldToNew);
if (returnReduce(nOldCyclics, sumOp<label>()) > 0)
if (returnReduceOr(nOldCyclics))
{
if (dryrun)
{
@ -299,7 +299,7 @@ void rewriteField
dictionary& boundaryField = fieldDict.subDict("boundaryField");
label nChanged = 0;
bool hasChange = false;
forAllConstIters(thisNames, iter)
{
@ -337,13 +337,13 @@ void rewriteField
);
Info<< " Adding entry " << nbrNames[patchName] << endl;
nChanged++;
hasChange = true;
}
}
//Info<< "New boundaryField:" << boundaryField << endl;
if (returnReduce(nChanged, sumOp<label>()) > 0)
if (returnReduceOr(hasChange))
{
if (dryrun)
{

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2018-2019 OpenCFD Ltd.
Copyright (C) 2018-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -113,10 +113,9 @@ void mapLagrangian(const meshToMesh& interp)
if
(
returnReduce
returnReduceOr
(
(objects.found("coordinates") || objects.found("positions")),
orOp<bool>()
objects.found("coordinates") || objects.found("positions")
)
)
{

View File

@ -60,18 +60,16 @@ int main(int argc, char *argv[])
)
).subDict("volumetricBSplinesMotionSolverCoeffs")
);
// Read box names and allocate size
wordList controlBoxes(NURBSdict.toc());
for (const word& boxName : controlBoxes)
for (const entry& dEntry : NURBSdict)
{
if (NURBSdict.isDict(boxName))
if (dEntry.isDict())
{
// Creating an object writes the control points in the
// constructor
NURBS3DVolume::New
(void) NURBS3DVolume::New
(
NURBSdict.subDict(boxName),
dEntry.dict(),
mesh,
false // do not compute parametric coordinates
);

View File

@ -232,15 +232,7 @@ int main(int argc, char *argv[])
dictionary& patchDict = boundaryFieldDict.subDict(patchName);
auto valueExpr_
(
expressions::exprString::getEntry
(
"expression",
currDict,
true // strip comments
)
);
expressions::exprString valueExpr_("expression", currDict);
Info<< "Set boundaryField/" << patchName << '/'
<< targetName << nl

View File

@ -560,7 +560,6 @@ int main(int argc, char *argv[])
" (command-line operation)",
true // Advanced option
);
argList::addOptionCompat("dimensions", {"dimension", 2012});
argList::addBoolOption
(
@ -771,11 +770,7 @@ int main(int argc, char *argv[])
ctrl.streamOpt.format(IOstreamOption::ASCII);
}
expressions::exprString valueExpr_
(
args["expression"],
dictionary::null
);
expressions::exprString valueExpr_(args["expression"]);
expressions::exprString maskExpr_;
args.readIfPresent("field-mask", maskExpr_);
@ -860,14 +855,7 @@ int main(int argc, char *argv[])
const word fieldName(dict.get<word>("field"));
auto valueExpr_
(
expressions::exprString::getEntry
(
"expression",
dict
)
);
expressions::exprString valueExpr_("expression", dict);
expressions::exprString maskExpr_;
{
@ -884,18 +872,11 @@ int main(int argc, char *argv[])
}
}
// Optional: "dimensions"
dimensionSet dims;
if (dims.readEntry("dimensions", dict, false))
{
const entry* dimPtr = dict.findCompat
(
"dimensions", {{"dimension", 2012}},
keyType::LITERAL
);
if (dimPtr)
{
dimPtr->stream() >> dims;
}
ctrl.hasDimensions = bool(dimPtr);
ctrl.hasDimensions = true;
}
if (args.verbose() && !timei)

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