diff --git a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldFunctions.C b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldFunctions.C index 621b49200f..362c5a355e 100644 --- a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldFunctions.C +++ b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldFunctions.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2019-2023 OpenCFD Ltd. + Copyright (C) 2019-2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -275,24 +275,26 @@ cmptAv(const tmp>& tf1) template \ dimensioned Func \ ( \ - const DimensionedField& f1 \ + const DimensionedField& f1, \ + const label comm \ ) \ { \ return dimensioned \ ( \ #Func "(" + f1.name() + ')', \ f1.dimensions(), \ - gFunc(f1.field()) \ + gFunc(f1.field(), comm) \ ); \ } \ \ template \ dimensioned Func \ ( \ - const tmp>& tf1 \ + const tmp>& tf1, \ + const label comm \ ) \ { \ - dimensioned res = Func(tf1()); \ + dimensioned res = Func(tf1(), comm); \ tf1.clear(); \ return res; \ } diff --git a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldFunctions.H b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldFunctions.H index e444690399..32ce17fcf0 100644 --- a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldFunctions.H +++ b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldFunctions.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2019-2023 OpenCFD Ltd. + Copyright (C) 2019-2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -107,12 +107,14 @@ cmptAv(const tmp>& tf1); template \ dimensioned Func \ ( \ - const DimensionedField& f1 \ + const DimensionedField& f1, \ + const label comm = UPstream::worldComm \ ); \ template \ dimensioned Func \ ( \ - const tmp>& tf1 \ + const tmp>& tf1, \ + const label comm = UPstream::worldComm \ ); UNARY_REDUCTION_FUNCTION(Type, max, gMax) diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C index 2ec59ff2d7..f3037d7e1b 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2015-2024 OpenCFD Ltd. + Copyright (C) 2015-2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -1132,10 +1132,11 @@ Foam::word Foam::GeometricField::select template class PatchField, class GeoMesh> void Foam::GeometricField::writeMinMax ( - Ostream& os + Ostream& os, + label comm ) const { - MinMax range = Foam::minMax(*this).value(); + MinMax range = Foam::minMax(*this, comm).value(); os << "min/max(" << this->name() << ") = " << range.min() << ", " << range.max() << endl; diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H index 077c34149d..5ff69df5ca 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2015-2024 OpenCFD Ltd. + Copyright (C) 2015-2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -906,8 +906,9 @@ public: //- otherwise the standard parameters by returning the field name word select(bool final) const; - //- Helper function to write the min and max to an Ostream - void writeMinMax(Ostream& os) const; + //- Helper function to write the min and max to an Ostream. + // Uses the specified communicator for reductions + void writeMinMax(Ostream& os, label comm = UPstream::worldComm) const; // Member Function *this Operators diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldFunctions.C b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldFunctions.C index 8048be9d6d..506942bb91 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldFunctions.C +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldFunctions.C @@ -429,7 +429,8 @@ cmptAv(const tmp>& tf1) template class PatchField, class GeoMesh> \ dimensioned Func \ ( \ - const GeometricField& f1 \ + const GeometricField& f1, \ + const label comm \ ) \ { \ return dimensioned \ @@ -443,7 +444,9 @@ dimensioned Func \ Foam::Func(f1.primitiveField()), \ Foam::Func(f1.boundaryField()) \ ), \ - BinaryOp() \ + BinaryOp(), \ + UPstream::msgType(), \ + comm \ ) \ ); \ } \ @@ -451,14 +454,16 @@ dimensioned Func \ template class PatchField, class GeoMesh> \ dimensioned Func \ ( \ - const tmp>& tf1 \ + const tmp>& tf1, \ + const label comm \ ) \ { \ - dimensioned res = Func(tf1()); \ + dimensioned res = Func(tf1(), comm); \ tf1.clear(); \ return res; \ } + UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY(Type, max, maxOp) UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY(Type, min, minOp) UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY(MinMax, minMax, plusOp) @@ -473,19 +478,21 @@ UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY(scalarMinMax, minMaxMag, plusOp) template class PatchField, class GeoMesh> \ dimensioned Func \ ( \ - const GeometricField& f1 \ + const GeometricField& f1, \ + const label comm \ ) \ { \ - return Func(f1.internalField()); \ + return Func(f1.internalField(), comm); \ } \ \ template class PatchField, class GeoMesh> \ dimensioned Func \ ( \ - const tmp>& tf1 \ + const tmp>& tf1, \ + const label comm \ ) \ { \ - auto result = Func(tf1()); \ + auto result = Func(tf1(), comm); \ tf1.clear(); \ return result; \ } diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldFunctions.H b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldFunctions.H index 93339f2688..5aab42aae0 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldFunctions.H +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldFunctions.H @@ -225,13 +225,15 @@ cmptAv(const tmp>& tf1); template class PatchField, class GeoMesh> \ dimensioned Func \ ( \ - const GeometricField& f1 \ + const GeometricField& f1, \ + const label comm = UPstream::worldComm \ ); \ \ template class PatchField, class GeoMesh> \ dimensioned Func \ ( \ - const tmp>& tf1 \ + const tmp>& tf1, \ + const label comm = UPstream::worldComm \ ); UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY(Type, max, maxOp) @@ -248,13 +250,15 @@ UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY(scalarMinMax, minMaxMag, plusOp) template class PatchField, class GeoMesh> \ dimensioned Func \ ( \ - const GeometricField& f1 \ + const GeometricField& f1, \ + const label comm = UPstream::worldComm \ ); \ \ template class PatchField, class GeoMesh> \ dimensioned Func \ ( \ - const tmp>& tf1 \ + const tmp>& tf1, \ + const label comm = UPstream::worldComm \ ); UNARY_REDUCTION_FUNCTION(Type, sum)