diff --git a/applications/solvers/combustion/PDRFoam/setDeltaT.H b/applications/solvers/combustion/PDRFoam/setDeltaT.H index 365126ce90ca961df6fa2135e4012a3b2bac30cc..177fc1fa7feec9d32d83397d12b941e7d1bbabca 100644 --- a/applications/solvers/combustion/PDRFoam/setDeltaT.H +++ b/applications/solvers/combustion/PDRFoam/setDeltaT.H @@ -36,11 +36,13 @@ Description if (adjustTimeStep) { scalar maxDeltaTFact = maxCo/(CoNum + StCoNum + SMALL); - scalar deltaTFact = min(min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2); + + const scalar deltaTFact = + Foam::min(Foam::min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2); runTime.setDeltaT ( - min + Foam::min ( deltaTFact*runTime.deltaTValue(), maxDeltaT diff --git a/applications/solvers/combustion/chemFoam/setDeltaT.H b/applications/solvers/combustion/chemFoam/setDeltaT.H index ef50a9702690309190df5c9b4efa9a64c5b6b2e9..93f68ceb6c92ca49e571567331150d45d11cb2cc 100644 --- a/applications/solvers/combustion/chemFoam/setDeltaT.H +++ b/applications/solvers/combustion/chemFoam/setDeltaT.H @@ -1,5 +1,6 @@ if (adjustTimeStep) { - runTime.setDeltaT(min(dtChem, maxDeltaT)); + runTime.setDeltaT(Foam::min(dtChem, maxDeltaT)); + Info<< "deltaT = " << runTime.deltaTValue() << endl; } diff --git a/applications/solvers/combustion/fireFoam/setMultiRegionDeltaT.H b/applications/solvers/combustion/fireFoam/setMultiRegionDeltaT.H index 31c9e675fcde15a9a1c4a0b878122acdc7654e21..a5ac0fcc9a686419ed02e99506dc0f042a9c6bf8 100644 --- a/applications/solvers/combustion/fireFoam/setMultiRegionDeltaT.H +++ b/applications/solvers/combustion/fireFoam/setMultiRegionDeltaT.H @@ -54,9 +54,18 @@ if (adjustTimeStep) runTime.setDeltaT ( - min + Foam::min ( - dt0*min(min(TFactorFluid, min(TFactorFilm, TFactorSolid)), 1.2), + dt0 + * Foam::min + ( + Foam::min + ( + TFactorFluid, + Foam::min(TFactorFilm, TFactorSolid) + ), + 1.2 + ), maxDeltaT ) ); diff --git a/applications/solvers/combustion/reactingFoam/setRDeltaT.H b/applications/solvers/combustion/reactingFoam/setRDeltaT.H index 6bf4cf8375f4db1054d32aa70556e2656ec9bd8d..67a2b00f9148996f03dd839d13e20e3d88fd9768 100644 --- a/applications/solvers/combustion/reactingFoam/setRDeltaT.H +++ b/applications/solvers/combustion/reactingFoam/setRDeltaT.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2013-2016 OpenFOAM Foundation - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020,2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -57,10 +57,22 @@ License // (relative to reference value) scalar alphaY(pimpleDict.getOrDefault<scalar>("alphaY", 1.0)); - Info<< "Time scales min/max:" << endl; - // Cache old reciprocal time scale field - volScalarField rDeltaT0("rDeltaT0", rDeltaT); + // The old reciprocal time scale field, with any damping factor + tmp<volScalarField> rDeltaT0_damped; + + // Calculate damped value before applying any other changes + if + ( + rDeltaTDampingCoeff < 1 + && runTime.timeIndex() > runTime.startTimeIndex() + 1 + ) + { + rDeltaT0_damped = (scalar(1) - rDeltaTDampingCoeff)*(rDeltaT); + } + + + Info<< "Time scales min/max:" << endl; // Flow time scale { @@ -70,12 +82,14 @@ License /((2*maxCo)*mesh.V()*rho()) ); - // Limit the largest time scale - rDeltaT.max(1/maxDeltaT); + // Limit the largest time scale (=> smallest reciprocal time) + rDeltaT.clamp_min(1/maxDeltaT); + + auto limits = gMinMax(rDeltaT.primitiveField()); + limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL)); Info<< " Flow = " - << 1/gMax(rDeltaT.primitiveField()) << ", " - << 1/gMin(rDeltaT.primitiveField()) << endl; + << limits.min() << ", " << limits.max() << endl; } // Heat release rate time scale @@ -86,11 +100,13 @@ License mag(Qdot)/(alphaTemp*rho*thermo.Cp()*T) ); - Info<< " Temperature = " - << 1/(gMax(rDeltaTT.field()) + VSMALL) << ", " - << 1/(gMin(rDeltaTT.field()) + VSMALL) << endl; + rDeltaT.primitiveFieldRef().clamp_min(rDeltaTT); - rDeltaT.ref() = max(rDeltaT(), rDeltaTT); + auto limits = gMinMax(rDeltaTT.field()); + limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL)); + + Info<< " Temperature = " + << limits.min() << ", " << limits.max() << endl; } // Reaction rate time scale @@ -138,11 +154,13 @@ License if (foundY) { - Info<< " Composition = " - << 1/(gMax(rDeltaTY.field()) + VSMALL) << ", " - << 1/(gMin(rDeltaTY.field()) + VSMALL) << endl; + rDeltaT.primitiveFieldRef().clamp_min(rDeltaTY); + + auto limits = gMinMax(rDeltaTY.field()); + limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL)); - rDeltaT.ref() = max(rDeltaT(), rDeltaTY); + Info<< " Composition = " + << limits.min() << ", " << limits.max() << endl; } else { @@ -161,28 +179,22 @@ License fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff); } - // Limit rate of change of time scale + // Limit rate of change of time scale (=> smallest reciprocal time) // - reduce as much as required // - only increase at a fraction of old time scale - if - ( - rDeltaTDampingCoeff < 1 - && runTime.timeIndex() > runTime.startTimeIndex() + 1 - ) + if (rDeltaT0_damped) { - rDeltaT = max - ( - rDeltaT, - (scalar(1) - rDeltaTDampingCoeff)*rDeltaT0 - ); + rDeltaT.clamp_min(rDeltaT0_damped()); } // Update tho boundary values of the reciprocal time-step rDeltaT.correctBoundaryConditions(); + auto limits = gMinMax(rDeltaT.field()); + limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL)); + Info<< " Overall = " - << 1/gMax(rDeltaT.primitiveField()) - << ", " << 1/gMin(rDeltaT.primitiveField()) << endl; + << limits.min() << ", " << limits.max() << endl; } diff --git a/applications/solvers/compressible/rhoCentralFoam/setRDeltaT.H b/applications/solvers/compressible/rhoCentralFoam/setRDeltaT.H index 5e2a2b302caaa9f5f305c0666f10c976440f2e1f..8f9560b74291ec097018195ba79db18be66d06f1 100644 --- a/applications/solvers/compressible/rhoCentralFoam/setRDeltaT.H +++ b/applications/solvers/compressible/rhoCentralFoam/setRDeltaT.H @@ -23,7 +23,11 @@ fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff); - Info<< "Flow time scale min/max = " - << gMin(1/rDeltaT.primitiveField()) - << ", " << gMax(1/rDeltaT.primitiveField()) << endl; + { + auto limits = gMinMax(rDeltaT.primitiveField()); + limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL)); + + Info<< "Flow time scale min/max = " + << limits.min() << ", " << limits.max() << endl; + } } diff --git a/applications/solvers/compressible/rhoPimpleFoam/setRDeltaT.H b/applications/solvers/compressible/rhoPimpleFoam/setRDeltaT.H index e818402eff6577330155820b75e43d0e3e713b57..51ecac9f07aa8fbfe3e0e23c7f5548a170358119 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/setRDeltaT.H +++ b/applications/solvers/compressible/rhoPimpleFoam/setRDeltaT.H @@ -52,18 +52,26 @@ // Update the boundary values of the reciprocal time-step rDeltaT.correctBoundaryConditions(); - Info<< "Flow time scale min/max = " - << gMin(1/rDeltaT.primitiveField()) - << ", " << gMax(1/rDeltaT.primitiveField()) << endl; + { + auto limits = gMinMax(rDeltaT.primitiveField()); + limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL)); + + Info<< "Flow time scale min/max = " + << limits.min() << ", " << limits.max() << endl; + } if (rDeltaTSmoothingCoeff < 1.0) { fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff); } - Info<< "Smoothed flow time scale min/max = " - << gMin(1/rDeltaT.primitiveField()) - << ", " << gMax(1/rDeltaT.primitiveField()) << endl; + { + auto limits = gMinMax(rDeltaT.primitiveField()); + limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL)); + + Info<< "Smoothed flow time scale min/max = " + << limits.min() << ", " << limits.max() << endl; + } // Limit rate of change of time scale // - reduce as much as required @@ -78,8 +86,10 @@ rDeltaT0 *max(rDeltaT/rDeltaT0, scalar(1) - rDeltaTDampingCoeff); + auto limits = gMinMax(rDeltaT.primitiveField()); + limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL)); + Info<< "Damped flow time scale min/max = " - << gMin(1/rDeltaT.primitiveField()) - << ", " << gMax(1/rDeltaT.primitiveField()) << endl; + << limits.min() << ", " << limits.max() << endl; } } diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/compressibleMultiRegionCourantNo.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/compressibleMultiRegionCourantNo.H index 3ca2f685819312306802794b946f5048e91e6e51..5ccc00d3ad4e1fbacc2b6237dd8fcfe04fe7b0d9 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/compressibleMultiRegionCourantNo.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/compressibleMultiRegionCourantNo.H @@ -1,7 +1,7 @@ scalar CoNum = -GREAT; forAll(fluidRegions, regionI) { - CoNum = max + CoNum = Foam::max ( compressibleCourantNo ( diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/pEqn.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/pEqn.H index fe3d7428164790fd1f20427da40daab7730920f3..d4dd47300ec87197c5056d06c8bb322b55571b45 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/pEqn.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/pEqn.H @@ -78,8 +78,8 @@ } rho = thermo.rho(); - rho = max(rho, rhoMin[i]); - rho = min(rho, rhoMax[i]); + + rho.clamp_range(rhoMin[i], rhoMax[i]); rho.relax(); Info<< "Min/max rho:" << min(rho).value() << ' ' diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionTwoPhaseEulerFoam/derivedFvPatchFields/turbulentTemperatureTwoPhaseRadCoupledMixed/turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField.C b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionTwoPhaseEulerFoam/derivedFvPatchFields/turbulentTemperatureTwoPhaseRadCoupledMixed/turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField.C index 33d1c05548a6e8c707d585a1cda1e2db404928f1..a0232c0b1cd1590b8d47b78891acbd3c681fc526 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionTwoPhaseEulerFoam/derivedFvPatchFields/turbulentTemperatureTwoPhaseRadCoupledMixed/turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField.C +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionTwoPhaseEulerFoam/derivedFvPatchFields/turbulentTemperatureTwoPhaseRadCoupledMixed/turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField.C @@ -387,15 +387,18 @@ updateCoeffs() { scalar Q = gSum(kappa(Tp)*patch().magSf()*snGrad()); - Info<< "T solid : " << nl << endl; - - Info - << " heat transfer rate from solid:" << Q - << " walltemperature " - << " min:" << gMin(Tp) - << " max:" << gMax(Tp) - << " avg:" << gAverage(Tp) << nl - << endl; + auto limits = gMinMax(Tp); + auto avg = gAverage(Tp); + + Info<< "T solid : " << nl << endl; + + Info + << " heat transfer rate from solid:" << Q + << " walltemperature " + << " min:" << limits.min() + << " max:" << limits.max() + << " avg:" << avg << nl + << endl; } } else if (regionType_ == fluid) @@ -445,10 +448,16 @@ updateCoeffs() scalarField qLiq((Tp - Tc)*KdeltaLiq); scalarField qVap((Tp - Tv.patchInternalField())*KdeltaVap); + auto infoT = gMinMax(Tp); + auto avgT = gAverage(Tp); + + auto infoLiq = gMinMax(qLiq); + auto infoVap = gMinMax(qVap); + Info<< "T flow : " << nl << endl; - Info<< " qLiq: " << gMin(qLiq) << " - " << gMax(qLiq) << endl; - Info<< " qVap: " << gMin(qVap) << " - " << gMax(qVap) << endl; + Info<< " qLiq: " << infoLiq.min() << " - " << infoLiq.max() << nl + << " qVap: " << infoVap.min() << " - " << infoVap.max() << nl; scalar QLiq = gSum(qLiq*patch().magSf()); scalar QVap = gSum(qVap*patch().magSf()); @@ -457,9 +466,9 @@ updateCoeffs() Info<< " Heat transfer to Vap: " << QVap << endl; Info<< " walltemperature " - << " min:" << gMin(Tp) - << " max:" << gMax(Tp) - << " avg:" << gAverage(Tp) + << " min:" << infoT.min() + << " max:" << infoT.max() + << " avg:" << avgT << endl; } } diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionTwoPhaseEulerFoam/fluid/compressibleMultiRegionCourantNo.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionTwoPhaseEulerFoam/fluid/compressibleMultiRegionCourantNo.H index 290bb596cf41103a7d20fe71d0a3aa9bfb2bfaf0..392d74f6a3cd708b8986a707d66abf1d3b468137 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionTwoPhaseEulerFoam/fluid/compressibleMultiRegionCourantNo.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionTwoPhaseEulerFoam/fluid/compressibleMultiRegionCourantNo.H @@ -31,7 +31,7 @@ ); - CoNum = + scalar regionCoNum = 0.5*gMax ( sumPhi/fluidRegions[regioni].V().field() @@ -41,9 +41,9 @@ ( fvc::surfaceSum(mag(phi1 - phi2))().primitiveField() / fluidRegions[regioni].V().field() - )*runTime.deltaTValue(), + )*runTime.deltaTValue(); - CoNum = max(UrCoNum, CoNum); + CoNum = Foam::max(CoNum, Foam::max(regionCoNum, UrCoNum)); } } diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/compressibleMultiRegionCourantNo.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/compressibleMultiRegionCourantNo.H index dd129047dc35b706128fd3578381be78bb847806..d5b5c7ceaa4a2d9a8d1fd0eb4ffe2e64bec9c0a7 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/compressibleMultiRegionCourantNo.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/compressibleMultiRegionCourantNo.H @@ -2,7 +2,7 @@ forAll(fluidRegions, regioni) { - CoNum = max + CoNum = Foam::max ( compressibleCourantNo ( @@ -17,7 +17,7 @@ /* forAll(porousFluidRegions, porousi) { - CoNum = max + CoNum = Foam::max ( compressibleCourantNo ( diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/include/setInitialMultiRegionDeltaT.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/include/setInitialMultiRegionDeltaT.H index 09f4a717a9673ff0dc82d43df7e7ce5aae6d91e8..8be63457654746030b657a8c1ee6a573c19204e9 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/include/setInitialMultiRegionDeltaT.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/include/setInitialMultiRegionDeltaT.H @@ -47,10 +47,10 @@ if (adjustTimeStep) runTime.setDeltaT ( - min + Foam::min ( - min(maxCo/CoNum, maxDi/DiNum)*runTime.deltaTValue(), - min(runTime.deltaTValue(), maxDeltaT) + Foam::min(maxCo/CoNum, maxDi/DiNum)*runTime.deltaTValue(), + Foam::min(runTime.deltaTValue(), maxDeltaT) ) ); Info<< "deltaT = " << runTime.deltaTValue() << endl; diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/include/setMultiRegionDeltaT.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/include/setMultiRegionDeltaT.H index 8eed82dd5c82249ace6b9323149836508843cba5..d81d374f41c6e6974d481c8fa76628bbe57754bf 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/include/setMultiRegionDeltaT.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/include/setMultiRegionDeltaT.H @@ -48,18 +48,14 @@ if (adjustTimeStep) scalar maxDeltaTFluid = maxCo/(CoNum + SMALL); scalar maxDeltaTSolid = maxDi/(DiNum + SMALL); - scalar deltaTFluid = - min - ( - min(maxDeltaTFluid, 1.0 + 0.1*maxDeltaTFluid), - 1.2 - ); + const scalar deltaTFluid = + Foam::min(Foam::min(maxDeltaTFluid, 1.0 + 0.1*maxDeltaTFluid), 1.2); runTime.setDeltaT ( - min + Foam::min ( - min(deltaTFluid, maxDeltaTSolid)*runTime.deltaTValue(), + Foam::min(deltaTFluid, maxDeltaTSolid)*runTime.deltaTValue(), maxDeltaT ) ); diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solidRegionDiffusionNo.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solidRegionDiffusionNo.H index 6e87fb92034ea9ec69234ae97651637117795afd..8c6111d27678aa4f9f4fd359ac14d39d40262cfb 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solidRegionDiffusionNo.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solidRegionDiffusionNo.H @@ -22,7 +22,7 @@ forAll(solidRegions, i) tmp<volScalarField> trho = thermo.rho(); const volScalarField& rho = trho(); - DiNum = max + DiNum = Foam::max ( solidRegionDiffNo ( diff --git a/applications/solvers/heatTransfer/solidFoam/solidDiffusionNo.H b/applications/solvers/heatTransfer/solidFoam/solidDiffusionNo.H index 90317f67c612fe56779a24b3a858362b377d78a3..3484c35b9fef2be86231aec06624c4e7d6b13e55 100644 --- a/applications/solvers/heatTransfer/solidFoam/solidDiffusionNo.H +++ b/applications/solvers/heatTransfer/solidFoam/solidDiffusionNo.H @@ -17,7 +17,7 @@ scalar DiNum = -GREAT; tmp<volScalarField> trho = thermo.rho(); const volScalarField& rho = trho(); - DiNum = max + DiNum = Foam::max ( solidRegionDiffNo ( diff --git a/applications/solvers/incompressible/adjointShapeOptimizationFoam/adjointShapeOptimizationFoam.C b/applications/solvers/incompressible/adjointShapeOptimizationFoam/adjointShapeOptimizationFoam.C index be66f4cc539bf1c4a71dd7b8fd17eb068d35e4b1..79a06161d1bbbdc4e2e7f1989b6686905200cd2c 100644 --- a/applications/solvers/incompressible/adjointShapeOptimizationFoam/adjointShapeOptimizationFoam.C +++ b/applications/solvers/incompressible/adjointShapeOptimizationFoam/adjointShapeOptimizationFoam.C @@ -60,13 +60,10 @@ template<class Type> void zeroCells ( GeometricField<Type, fvPatchField, volMesh>& vf, - const labelList& cells + const labelUList& cells ) { - forAll(cells, i) - { - vf[cells[i]] = Zero; - } + UIndirectList<Type>(vf.primitiveField(), cells) = Zero; } diff --git a/applications/solvers/incompressible/adjointShapeOptimizationFoam/createFields.H b/applications/solvers/incompressible/adjointShapeOptimizationFoam/createFields.H index 4d7b9d881106ae3be279b210dd101c060500ecd4..3d19017f9de07c7c0cff596aca4e7d089609a770 100644 --- a/applications/solvers/incompressible/adjointShapeOptimizationFoam/createFields.H +++ b/applications/solvers/incompressible/adjointShapeOptimizationFoam/createFields.H @@ -103,8 +103,8 @@ dimensionedScalar alphaMax laminarTransport ); -const labelList& inletCells = mesh.boundary()["inlet"].faceCells(); -//const labelList& outletCells = mesh.boundary()["outlet"].faceCells(); +const labelUList& inletCells = mesh.boundary()["inlet"].faceCells(); +//const labelUList& outletCells = mesh.boundary()["outlet"].faceCells(); volScalarField alpha ( diff --git a/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/correctPhi.H b/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/correctPhi.H index 8c692c1378b180507989b4d78bc3631dc2aaa40e..f5304eea588240807e2117538adf0ef8e43363f0 100644 --- a/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/correctPhi.H +++ b/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/correctPhi.H @@ -55,7 +55,7 @@ if (mesh.changing()) dimensionedScalar rAUf("rAUf", dimTime, 1.0); const cellCellStencilObject& overlap = Stencil::New(mesh); - const labelList& cellTypes = overlap.cellTypes(); + const labelUList& cellTypes = overlap.cellTypes(); const labelIOList& zoneIDs = overlap.zoneID(); while (pimple.correctNonOrthogonal()) diff --git a/applications/solvers/incompressible/pimpleFoam/setRDeltaT.H b/applications/solvers/incompressible/pimpleFoam/setRDeltaT.H index 962bfa8766cafeb044d4726ed05d5dcd19bae9e7..3acc01c5fa3ad0c81852eb6439d2aa3c7641a03d 100644 --- a/applications/solvers/incompressible/pimpleFoam/setRDeltaT.H +++ b/applications/solvers/incompressible/pimpleFoam/setRDeltaT.H @@ -36,18 +36,26 @@ // Update the boundary values of the reciprocal time-step rDeltaT.correctBoundaryConditions(); - Info<< "Flow time scale min/max = " - << gMin(1/rDeltaT.primitiveField()) - << ", " << gMax(1/rDeltaT.primitiveField()) << endl; + { + auto limits = gMinMax(rDeltaT.primitiveField()); + limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL)); + + Info<< "Flow time scale min/max = " + << limits.min() << ", " << limits.max() << endl; + } if (rDeltaTSmoothingCoeff < 1.0) { fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff); } - Info<< "Smoothed flow time scale min/max = " - << gMin(1/rDeltaT.primitiveField()) - << ", " << gMax(1/rDeltaT.primitiveField()) << endl; + { + auto limits = gMinMax(rDeltaT.primitiveField()); + limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL)); + + Info<< "Smoothed flow time scale min/max = " + << limits.min() << ", " << limits.max() << endl; + } // Limit rate of change of time scale // - reduce as much as required @@ -62,8 +70,10 @@ rDeltaT0 *max(rDeltaT/rDeltaT0, scalar(1) - rDeltaTDampingCoeff); + auto limits = gMinMax(rDeltaT.primitiveField()); + limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL)); + Info<< "Damped flow time scale min/max = " - << gMin(1/rDeltaT.primitiveField()) - << ", " << gMax(1/rDeltaT.primitiveField()) << endl; + << limits.min() << ", " << limits.max() << endl; } } diff --git a/applications/solvers/lagrangian/coalChemistryFoam/setRDeltaT.H b/applications/solvers/lagrangian/coalChemistryFoam/setRDeltaT.H index bda1cc2d8837ef033a07444d808a33cdf816167e..745249cfdf6be9ee9e6d92495edc2395080181b3 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/setRDeltaT.H +++ b/applications/solvers/lagrangian/coalChemistryFoam/setRDeltaT.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020,2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -54,10 +54,21 @@ License scalar alphaTemp(pimpleDict.getOrDefault("alphaTemp", 0.05)); - Info<< "Time scales min/max:" << endl; + // The old reciprocal time scale field, with any damping factor + tmp<volScalarField> rDeltaT0_damped; + + // Calculate damped value before applying any other changes + if + ( + rDeltaTDampingCoeff < 1 + && runTime.timeIndex() > runTime.startTimeIndex() + 1 + ) + { + rDeltaT0_damped = (scalar(1) - rDeltaTDampingCoeff)*(rDeltaT); + } + - // Cache old reciprocal time scale field - volScalarField rDeltaT0("rDeltaT0", rDeltaT); + Info<< "Time scales min/max:" << endl; // Flow time scale { @@ -67,12 +78,14 @@ License /((2*maxCo)*mesh.V()*rho()) ); - // Limit the largest time scale - rDeltaT.max(1/maxDeltaT); + // Limit the largest time scale (=> smallest reciprocal time) + rDeltaT.clamp_min(1/maxDeltaT); + + auto limits = gMinMax(rDeltaT.primitiveField()); + limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL)); Info<< " Flow = " - << gMin(1/rDeltaT.primitiveField()) << ", " - << gMax(1/rDeltaT.primitiveField()) << endl; + << limits.min() << ", " << limits.max() << endl; } // Reaction source time scale @@ -93,15 +106,13 @@ License ) ); - Info<< " Temperature = " - << gMin(1/(rDeltaTT.field() + VSMALL)) << ", " - << gMax(1/(rDeltaTT.field() + VSMALL)) << endl; + rDeltaT.primitiveFieldRef().clamp_min(rDeltaTT); - rDeltaT.ref() = max - ( - rDeltaT(), - rDeltaTT - ); + auto limits = gMinMax(rDeltaTT.field()); + limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL)); + + Info<< " Temperature = " + << limits.min() << ", " << limits.max() << endl; } // Update tho boundary values of the reciprocal time-step @@ -113,25 +124,19 @@ License fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff); } - // Limit rate of change of time scale + // Limit rate of change of time scale (=> smallest reciprocal time) // - reduce as much as required // - only increase at a fraction of old time scale - if - ( - rDeltaTDampingCoeff < 1.0 - && runTime.timeIndex() > runTime.startTimeIndex() + 1 - ) + if (rDeltaT0_damped) { - rDeltaT = max - ( - rDeltaT, - (scalar(1) - rDeltaTDampingCoeff)*rDeltaT0 - ); + rDeltaT.clamp_min(rDeltaT0_damped()); } + auto limits = gMinMax(rDeltaT.primitiveField()); + limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL)); + Info<< " Overall = " - << gMin(1/rDeltaT.primitiveField()) - << ", " << gMax(1/rDeltaT.primitiveField()) << endl; + << limits.min() << ", " << limits.max() << endl; } diff --git a/applications/solvers/lagrangian/reactingParcelFoam/setMultiRegionDeltaT.H b/applications/solvers/lagrangian/reactingParcelFoam/setMultiRegionDeltaT.H index 70d55cb8c87b171d67c1990cff341cd98a2e1c31..1257447f3ec969eb69a241e4124c1ecc340e6ecb 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/setMultiRegionDeltaT.H +++ b/applications/solvers/lagrangian/reactingParcelFoam/setMultiRegionDeltaT.H @@ -36,13 +36,18 @@ Description if (adjustTimeStep) { const scalar maxDeltaTFact = - min(maxCo/(CoNum + SMALL), maxCo/(surfaceFilm.CourantNumber() + SMALL)); + Foam::min + ( + maxCo/(CoNum + SMALL), + maxCo/(surfaceFilm.CourantNumber() + SMALL) + ); + const scalar deltaTFact = - min(min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2); + Foam::min(Foam::min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2); runTime.setDeltaT ( - min + Foam::min ( deltaTFact*runTime.deltaTValue(), maxDeltaT diff --git a/applications/solvers/lagrangian/reactingParcelFoam/setRDeltaT.H b/applications/solvers/lagrangian/reactingParcelFoam/setRDeltaT.H index 5977b18fe67dde0922adfaf598f3fa510ef72233..42e187ed3c36f6541a6fedfaf394eb84de862c28 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/setRDeltaT.H +++ b/applications/solvers/lagrangian/reactingParcelFoam/setRDeltaT.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020,2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -54,10 +54,21 @@ License scalar alphaTemp(pimpleDict.getOrDefault("alphaTemp", 0.05)); - Info<< "Time scales min/max:" << endl; + // The old reciprocal time scale field, with any damping factor + tmp<volScalarField> rDeltaT0_damped; - // Cache old reciprocal time scale field - volScalarField rDeltaT0("rDeltaT0", rDeltaT); + // Calculate damped value before applying any other changes + if + ( + rDeltaTDampingCoeff < 1 + && runTime.timeIndex() > runTime.startTimeIndex() + 1 + ) + { + rDeltaT0_damped = (scalar(1) - rDeltaTDampingCoeff)*(rDeltaT); + } + + + Info<< "Time scales min/max:" << endl; // Flow time scale { @@ -67,12 +78,14 @@ License /((2*maxCo)*mesh.V()*rho()) ); - // Limit the largest time scale - rDeltaT.max(1/maxDeltaT); + // Limit the largest time scale (=> smallest reciprocal time) + rDeltaT.clamp_min(1/maxDeltaT); + + auto limits = gMinMax(rDeltaT.primitiveField()); + limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL)); Info<< " Flow = " - << gMin(1/rDeltaT.primitiveField()) << ", " - << gMax(1/rDeltaT.primitiveField()) << endl; + << limits.min() << ", " << limits.max() << endl; } // Reaction source time scale @@ -92,15 +105,13 @@ License ) ); - Info<< " Temperature = " - << gMin(1/(rDeltaTT.field() + VSMALL)) << ", " - << gMax(1/(rDeltaTT.field() + VSMALL)) << endl; + rDeltaT.primitiveFieldRef().clamp_min(rDeltaTT); - rDeltaT.ref() = max - ( - rDeltaT(), - rDeltaTT - ); + auto limits = gMinMax(rDeltaTT.field()); + limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL)); + + Info<< " Temperature = " + << limits.min() << ", " << limits.max() << endl; } // Update the boundary values of the reciprocal time-step @@ -112,25 +123,22 @@ License fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff); } - // Limit rate of change of time scale + // Limit rate of change of time scale (=> smallest reciprocal time) // - reduce as much as required // - only increase at a fraction of old time scale - if - ( - rDeltaTDampingCoeff < 1.0 - && runTime.timeIndex() > runTime.startTimeIndex() + 1 - ) + if (rDeltaT0_damped) { - rDeltaT = max - ( - rDeltaT, - (scalar(1) - rDeltaTDampingCoeff)*rDeltaT0 - ); + rDeltaT.clamp_min(rDeltaT0_damped()); } + // Update the boundary values of the reciprocal time-step + rDeltaT.correctBoundaryConditions(); + + auto limits = gMinMax(rDeltaT.primitiveField()); + limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL)); + Info<< " Overall = " - << gMin(1/rDeltaT.primitiveField()) - << ", " << gMax(1/rDeltaT.primitiveField()) << endl; + << limits.min() << ", " << limits.max() << endl; } diff --git a/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/pEqn.H b/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/pEqn.H index 1ce5db0ec8f1fbd4758d126be362ebb0dd2d3354..2b3d264c62610cadd097c79d19d39408e876818a 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/pEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/pEqn.H @@ -48,8 +48,7 @@ U.correctBoundaryConditions(); fvOptions.correct(U); rho = thermo.rho(); -rho = max(rho, rhoMin); -rho = min(rho, rhoMax); +rho.clamp_range(rhoMin, rhoMax); rho.relax(); Info<< "p min/max = " << min(p).value() << ", " << max(p).value() << endl; diff --git a/applications/solvers/lagrangian/simpleCoalParcelFoam/pEqn.H b/applications/solvers/lagrangian/simpleCoalParcelFoam/pEqn.H index 055eff6f0b34ec7e30fb3da5d8ac9f6f96386d25..1c85828e24a632853aa7272e79ed5cf744e4e0f3 100644 --- a/applications/solvers/lagrangian/simpleCoalParcelFoam/pEqn.H +++ b/applications/solvers/lagrangian/simpleCoalParcelFoam/pEqn.H @@ -49,8 +49,7 @@ fvOptions.correct(U); rho = thermo.rho(); - rho = max(rho, rhoMin); - rho = min(rho, rhoMax); + rho.clamp_range(rhoMin, rhoMax); rho.relax(); Info<< "p min/max = " << min(p).value() << ", " << max(p).value() << endl; diff --git a/applications/solvers/lagrangian/sprayFoam/pEqn.H b/applications/solvers/lagrangian/sprayFoam/pEqn.H index 198bf00d52caab6aae55d8e2075ddacae20bfa94..fbdcc577908d41ea50663918e6b777722503de7b 100644 --- a/applications/solvers/lagrangian/sprayFoam/pEqn.H +++ b/applications/solvers/lagrangian/sprayFoam/pEqn.H @@ -1,6 +1,5 @@ rho = thermo.rho(); -rho = max(rho, rhoMin); -rho = min(rho, rhoMax); +rho.clamp_range(rhoMin, rhoMax); rho.relax(); volScalarField rAU(1.0/UEqn.A()); @@ -94,8 +93,7 @@ p.relax(); // Recalculate density from the relaxed pressure rho = thermo.rho(); -rho = max(rho, rhoMin); -rho = min(rho, rhoMax); +rho.clamp_range(rhoMin, rhoMax); rho.relax(); Info<< "rho min/max : " << min(rho).value() << " " << max(rho).value() << endl; diff --git a/applications/solvers/lagrangian/sprayFoam/sprayDyMFoam/pEqn.H b/applications/solvers/lagrangian/sprayFoam/sprayDyMFoam/pEqn.H index a7850a5e903257f9a921d475fc91edb2148ca694..92bd8c2564b6cf0a77515eb7de0d7afcca7a6318 100644 --- a/applications/solvers/lagrangian/sprayFoam/sprayDyMFoam/pEqn.H +++ b/applications/solvers/lagrangian/sprayFoam/sprayDyMFoam/pEqn.H @@ -1,6 +1,5 @@ rho = thermo.rho(); -rho = max(rho, rhoMin); -rho = min(rho, rhoMax); +rho.clamp_range(rhoMin, rhoMax); rho.relax(); volScalarField rAU(1.0/UEqn.A()); @@ -94,8 +93,7 @@ p.relax(); // Recalculate density from the relaxed pressure rho = thermo.rho(); -rho = max(rho, rhoMin); -rho = min(rho, rhoMax); +rho.clamp_range(rhoMin, rhoMax); rho.relax(); Info<< "rho min/max : " << min(rho).value() << " " << max(rho).value() << endl; diff --git a/applications/solvers/multiphase/VoF/setDeltaT.H b/applications/solvers/multiphase/VoF/setDeltaT.H index ac59647e7e84d66600d81e06cefa8e5a9bd237e9..79fbe90c4fd9866cf5bdc877679a66199b8bc5ad 100644 --- a/applications/solvers/multiphase/VoF/setDeltaT.H +++ b/applications/solvers/multiphase/VoF/setDeltaT.H @@ -36,13 +36,14 @@ Description if (adjustTimeStep) { scalar maxDeltaTFact = - min(maxCo/(CoNum + SMALL), maxAlphaCo/(alphaCoNum + SMALL)); + Foam::min(maxCo/(CoNum + SMALL), maxAlphaCo/(alphaCoNum + SMALL)); - scalar deltaTFact = min(min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2); + const scalar deltaTFact = + Foam::min(Foam::min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2); runTime.setDeltaT ( - min + Foam::min ( deltaTFact*runTime.deltaTValue(), maxDeltaT diff --git a/applications/solvers/multiphase/VoF/setRDeltaT.H b/applications/solvers/multiphase/VoF/setRDeltaT.H index 313fca2e33b1d9162125a7f32d770fd15df93ff2..bcc6e3b56d46d2979232fc0c187162012f8953f9 100644 --- a/applications/solvers/multiphase/VoF/setRDeltaT.H +++ b/applications/solvers/multiphase/VoF/setRDeltaT.H @@ -53,6 +53,21 @@ pimpleDict.getOrDefault<scalar>("maxDeltaT", GREAT) ); + + // The old reciprocal time scale field, with any damping factor + tmp<volScalarField> rDeltaT0_damped; + + // Calculate damped value before applying any other changes + if + ( + rDeltaTDampingCoeff < 1 + && runTime.timeIndex() > runTime.startTimeIndex() + 1 + ) + { + rDeltaT0_damped = (scalar(1) - rDeltaTDampingCoeff)*(rDeltaT); + } + + volScalarField rDeltaT0("rDeltaT0", rDeltaT); // Set the reciprocal time-step from the local Courant number @@ -83,10 +98,13 @@ // Update tho boundary values of the reciprocal time-step rDeltaT.correctBoundaryConditions(); - Info<< "Flow time scale min/max = " - << gMin(1/rDeltaT.primitiveField()) - << ", " << gMax(1/rDeltaT.primitiveField()) << endl; + { + auto limits = gMinMax(rDeltaT.primitiveField()); + limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL)); + Info<< "Flow time scale min/max = " + << limits.min() << ", " << limits.max() << endl; + } if (rDeltaTSmoothingCoeff < 1.0) { fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff); @@ -110,27 +128,25 @@ fvc::sweep(rDeltaT, alpha1, nAlphaSweepIter, alphaSpreadDiff); } - Info<< "Smoothed flow time scale min/max = " - << gMin(1/rDeltaT.primitiveField()) - << ", " << gMax(1/rDeltaT.primitiveField()) << endl; + { + auto limits = gMinMax(rDeltaT.primitiveField()); + limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL)); + + Info<< "Smoothed flow time scale min/max = " + << limits.min() << ", " << limits.max() << endl; + } - // Limit rate of change of time scale + // Limit rate of change of time scale (=> smallest reciprocal time) // - reduce as much as required // - only increase at a fraction of old time scale - if - ( - rDeltaTDampingCoeff < 1.0 - && runTime.timeIndex() > runTime.startTimeIndex() + 1 - ) + if (rDeltaT0_damped) { - rDeltaT = max - ( - rDeltaT, - (scalar(1) - rDeltaTDampingCoeff)*rDeltaT0 - ); + rDeltaT.clamp_min(rDeltaT0_damped()); + + auto limits = gMinMax(rDeltaT.primitiveField()); + limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL)); Info<< "Damped flow time scale min/max = " - << gMin(1/rDeltaT.primitiveField()) - << ", " << gMax(1/rDeltaT.primitiveField()) << endl; + << limits.min() << ", " << limits.max() << endl; } } diff --git a/applications/solvers/multiphase/cavitatingFoam/setDeltaT.H b/applications/solvers/multiphase/cavitatingFoam/setDeltaT.H index e1e7427fe0d427b92a7e259696340081ffe7dc42..1d2dd28f6bf4a78cc73c1bbc8d5452999544c45c 100644 --- a/applications/solvers/multiphase/cavitatingFoam/setDeltaT.H +++ b/applications/solvers/multiphase/cavitatingFoam/setDeltaT.H @@ -36,13 +36,14 @@ Description if (adjustTimeStep) { scalar maxDeltaTFact = - min(maxCo/(CoNum + SMALL), maxAcousticCo/(acousticCoNum + SMALL)); + Foam::min(maxCo/(CoNum + SMALL), maxAcousticCo/(acousticCoNum + SMALL)); - scalar deltaTFact = min(min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2); + const scalar deltaTFact = + Foam::min(Foam::min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2); runTime.setDeltaT ( - min + Foam::min ( deltaTFact*runTime.deltaTValue(), maxDeltaT diff --git a/applications/solvers/multiphase/cavitatingFoam/setInitialDeltaT.H b/applications/solvers/multiphase/cavitatingFoam/setInitialDeltaT.H index 69fbe573338217e7311feac157e0a6ccb42be8dc..435b2e4b0b591d2acf812246d08c2ad46e8670e6 100644 --- a/applications/solvers/multiphase/cavitatingFoam/setInitialDeltaT.H +++ b/applications/solvers/multiphase/cavitatingFoam/setInitialDeltaT.H @@ -37,11 +37,15 @@ if (adjustTimeStep) if (CoNum > SMALL) { scalar maxDeltaTFact = - min(maxCo/(CoNum + SMALL), maxAcousticCo/(acousticCoNum + SMALL)); + Foam::min + ( + maxCo/(CoNum + SMALL), + maxAcousticCo/(acousticCoNum + SMALL) + ); runTime.setDeltaT ( - min + Foam::min ( maxDeltaTFact*runTime.deltaTValue(), maxDeltaT diff --git a/applications/solvers/multiphase/compressibleInterFoam/alphaSuSp.H b/applications/solvers/multiphase/compressibleInterFoam/alphaSuSp.H index ce2e5520015656a43b6923eafcf0879fe5a9b37e..cc698aefed8fc36d593ebbb709d7fd0be6faa919 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/alphaSuSp.H +++ b/applications/solvers/multiphase/compressibleInterFoam/alphaSuSp.H @@ -26,12 +26,12 @@ forAll(dgdt, celli) { if (dgdt[celli] > 0.0) { - Sp[celli] -= dgdt[celli]/max(1.0 - alpha1[celli], 1e-4); - Su[celli] += dgdt[celli]/max(1.0 - alpha1[celli], 1e-4); + Sp[celli] -= dgdt[celli]/Foam::max(1.0 - alpha1[celli], 1e-4); + Su[celli] += dgdt[celli]/Foam::max(1.0 - alpha1[celli], 1e-4); } else if (dgdt[celli] < 0.0) { - Sp[celli] += dgdt[celli]/max(alpha1[celli], 1e-4); + Sp[celli] += dgdt[celli]/Foam::max(alpha1[celli], 1e-4); } } diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/VoFPatchTransfer/VoFPatchTransfer.C b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/VoFPatchTransfer/VoFPatchTransfer.C index b0c52f0f621dc784b0aeb46d316e800da5c7fd61..e3e2d7ee5f69882a49ea72e69582d35f14970501 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/VoFPatchTransfer/VoFPatchTransfer.C +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/VoFPatchTransfer/VoFPatchTransfer.C @@ -210,7 +210,7 @@ void VoFPatchTransfer::correct film().toRegion(patchi, Vp); const polyPatch& pp = pbm[patchi]; - const labelList& faceCells = pp.faceCells(); + const labelUList& faceCells = pp.faceCells(); // Accumulate the total mass removed from patch scalar dMassPatch = 0; diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterIsoFoam/alphaSuSp.H b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterIsoFoam/alphaSuSp.H index 65c5750ff94f1acf7549bd16e29b171ff6f308d4..457f40891aff00c92be9f414802b536f1199f245 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterIsoFoam/alphaSuSp.H +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterIsoFoam/alphaSuSp.H @@ -26,12 +26,12 @@ forAll(dgdt, celli) { if (dgdt[celli] > 0.0) { - Sp[celli] -= dgdt[celli]/max(1.0 - alpha1[celli], 1e-4); - Su[celli] += dgdt[celli]/max(1.0 - alpha1[celli], 1e-4); + Sp[celli] -= dgdt[celli]/Foam::max(1.0 - alpha1[celli], 1e-4); + Su[celli] += dgdt[celli]/Foam::max(1.0 - alpha1[celli], 1e-4); } else if (dgdt[celli] < 0.0) { - Sp[celli] += dgdt[celli]/max(alpha1[celli], 1e-4); + Sp[celli] += dgdt[celli]/Foam::max(alpha1[celli], 1e-4); } } diff --git a/applications/solvers/multiphase/compressibleInterFoam/overCompressibleInterDyMFoam/alphaSuSp.H b/applications/solvers/multiphase/compressibleInterFoam/overCompressibleInterDyMFoam/alphaSuSp.H index 65c5750ff94f1acf7549bd16e29b171ff6f308d4..457f40891aff00c92be9f414802b536f1199f245 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/overCompressibleInterDyMFoam/alphaSuSp.H +++ b/applications/solvers/multiphase/compressibleInterFoam/overCompressibleInterDyMFoam/alphaSuSp.H @@ -26,12 +26,12 @@ forAll(dgdt, celli) { if (dgdt[celli] > 0.0) { - Sp[celli] -= dgdt[celli]/max(1.0 - alpha1[celli], 1e-4); - Su[celli] += dgdt[celli]/max(1.0 - alpha1[celli], 1e-4); + Sp[celli] -= dgdt[celli]/Foam::max(1.0 - alpha1[celli], 1e-4); + Su[celli] += dgdt[celli]/Foam::max(1.0 - alpha1[celli], 1e-4); } else if (dgdt[celli] < 0.0) { - Sp[celli] += dgdt[celli]/max(alpha1[celli], 1e-4); + Sp[celli] += dgdt[celli]/Foam::max(alpha1[celli], 1e-4); } } diff --git a/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/setDeltaT.H b/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/setDeltaT.H index 026fb506bbc6fbb2517365e52b02d2e68ff518ca..9a67a63d136e959d0ce1d2110654a3baf95a3bd0 100644 --- a/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/setDeltaT.H +++ b/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/setDeltaT.H @@ -36,13 +36,13 @@ Description if (adjustTimeStep) { scalar maxDeltaTFact = - min + Foam::min ( maxCo/(CoNum + SMALL), - min + Foam::min ( maxAlphaCo/(alphaCoNum + SMALL), - min + Foam::min ( maxAlphaDdt/(ddtAlphaNum + SMALL), maxDi/(DiNum + SMALL) @@ -50,16 +50,18 @@ if (adjustTimeStep) ) ); - scalar deltaTFact = min(min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2); + const scalar deltaTFact = + Foam::min(Foam::min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2); runTime.setDeltaT ( - min + Foam::min ( deltaTFact*runTime.deltaTValue(), maxDeltaT ) ); + Info<< "deltaT = " << runTime.deltaTValue() << endl; } diff --git a/applications/solvers/multiphase/interFoam/overInterDyMFoam/correctPhi.H b/applications/solvers/multiphase/interFoam/overInterDyMFoam/correctPhi.H index 7df3631b0402c5b0dbce0e90f8309201ad0a2736..9af4e28691c4324adb7d55ab9094f72ec01339c6 100644 --- a/applications/solvers/multiphase/interFoam/overInterDyMFoam/correctPhi.H +++ b/applications/solvers/multiphase/interFoam/overInterDyMFoam/correctPhi.H @@ -65,7 +65,7 @@ dimensionedScalar rAUf("rAUf", dimTime/rho.dimensions(), 1.0); const cellCellStencilObject& overlap = Stencil::New(mesh); - const labelList& cellTypes = overlap.cellTypes(); + const labelUList& cellTypes = overlap.cellTypes(); const labelIOList& zoneIDs = overlap.zoneID(); while (pimple.correctNonOrthogonal()) diff --git a/applications/solvers/multiphase/reactingMultiphaseEulerFoam/setRDeltaT.H b/applications/solvers/multiphase/reactingMultiphaseEulerFoam/setRDeltaT.H index 1d0c65b1539028e1c4d3fe69cf981ba40b365e54..c15dfe4a9f8bbf3aafde41eb6ae8c291c822e71b 100644 --- a/applications/solvers/multiphase/reactingMultiphaseEulerFoam/setRDeltaT.H +++ b/applications/solvers/multiphase/reactingMultiphaseEulerFoam/setRDeltaT.H @@ -38,7 +38,9 @@ fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff); + auto limits = gMinMax(rDeltaT.primitiveField()); + limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL)); + Info<< "Flow time scale min/max = " - << gMin(1/rDeltaT.primitiveField()) - << ", " << gMax(1/rDeltaT.primitiveField()) << endl; + << limits.min() << ", " << limits.max() << endl; } diff --git a/applications/solvers/multiphase/reactingTwoPhaseEulerFoam/CourantNos.H b/applications/solvers/multiphase/reactingTwoPhaseEulerFoam/CourantNos.H index 13c45ad51c10a476a20cf83a96906d59bed4520d..1bd1d9d036bc4c3709262b11980dcea76b070c3a 100644 --- a/applications/solvers/multiphase/reactingTwoPhaseEulerFoam/CourantNos.H +++ b/applications/solvers/multiphase/reactingTwoPhaseEulerFoam/CourantNos.H @@ -8,5 +8,5 @@ Info<< "Max Ur Courant Number = " << UrCoNum << endl; - CoNum = max(CoNum, UrCoNum); + CoNum = Foam::max(CoNum, UrCoNum); } diff --git a/applications/solvers/multiphase/reactingTwoPhaseEulerFoam/setRDeltaT.H b/applications/solvers/multiphase/reactingTwoPhaseEulerFoam/setRDeltaT.H index 10a7c9e0f09337da2cc5aa3479e33bd53994fb86..45d9e6c74a2bd6995b0637d034460961ccc2ba81 100644 --- a/applications/solvers/multiphase/reactingTwoPhaseEulerFoam/setRDeltaT.H +++ b/applications/solvers/multiphase/reactingTwoPhaseEulerFoam/setRDeltaT.H @@ -31,7 +31,9 @@ fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff); + auto limits = gMinMax(rDeltaT.primitiveField()); + limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL)); + Info<< "Flow time scale min/max = " - << gMin(1/rDeltaT.primitiveField()) - << ", " << gMax(1/rDeltaT.primitiveField()) << endl; + << limits.min() << ", " << limits.max() << endl; } diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/CourantNos.H b/applications/solvers/multiphase/twoPhaseEulerFoam/CourantNos.H index d828f32769d327e41488135b48f78c1c1cfc4607..96e1ece1ac21bc09d449f2c878afee3900acf45a 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/CourantNos.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/CourantNos.H @@ -8,5 +8,5 @@ Info<< "Max Ur Courant Number = " << UrCoNum << endl; - CoNum = max(CoNum, UrCoNum); + CoNum = Foam::max(CoNum, UrCoNum); } diff --git a/applications/test/IOField/Test-IOField.cxx b/applications/test/IOField/Test-IOField.cxx index 96f91d5e7e55e6f72dfbe62e9afaa944ba155401..e9f6123e405e67aa14ca426a1c77c2a85868a53e 100644 --- a/applications/test/IOField/Test-IOField.cxx +++ b/applications/test/IOField/Test-IOField.cxx @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2017 OpenFOAM Foundation - Copyright (C) 2019-2022 OpenCFD Ltd. + Copyright (C) 2019-2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -269,7 +269,7 @@ int main(int argc, char *argv[]) ioOutput.rename(args.executable() + "-labels"); Info<< "write " << ioOutput.objectRelPath() << endl; { - IOListRef<label>(ioOutput, ints).write(); + IOList<label>::writeContents(ioOutput, ints); } ioOutput.rename(args.executable() + "-points"); diff --git a/applications/test/fieldMapping/Test-fieldMapping.C b/applications/test/fieldMapping/Test-fieldMapping.C index bb4ad0576bd62e65f3eabb101690980a8a227ee0..f2bd3a87c9c5e8631903f468c15d55a46fb0fde3 100644 --- a/applications/test/fieldMapping/Test-fieldMapping.C +++ b/applications/test/fieldMapping/Test-fieldMapping.C @@ -262,13 +262,12 @@ int main(int argc, char *argv[]) // Check constant profile { - const scalar max = gMax(one); - const scalar min = gMin(one); + auto limits = gMinMax(one); - Info<< "Uniform one field min = " << min - << " max = " << max << endl; + Info<< "Uniform one field min = " + << limits.min() << " max = " << limits.max() << endl; - if (isNotEqual(max, 1) || isNotEqual(min, 1)) + if (isNotEqual(limits.min(), 1) || isNotEqual(limits.max(), 1)) { FatalErrorInFunction << "Uniform volVectorField not preserved." @@ -286,13 +285,12 @@ int main(int argc, char *argv[]) { const scalarField diff = ccX-mesh.C().component(0); - const scalar max = gMax(diff); - const scalar min = gMin(diff); + auto limits = gMinMax(diff); - Info<< "Linear profile field min = " << min - << " max = " << max << endl; + Info<< "Linear profile field min = " + << limits.min() << " max = " << limits.max() << endl; - if (isNotEqual(max, 0) || isNotEqual(min, 0)) + if (isNotEqual(limits.min(), 0) || isNotEqual(limits.max(), 0)) { FatalErrorInFunction << "Linear profile not preserved." @@ -309,13 +307,12 @@ int main(int argc, char *argv[]) // Check face field mapping if (surfaceOne.size()) { - const scalar max = gMax(surfaceOne.primitiveField()); - const scalar min = gMin(surfaceOne.primitiveField()); + auto limits = gMinMax(surfaceOne.primitiveField()); - Info<< "Uniform surface field min = " << min - << " max = " << max << endl; + Info<< "Uniform surface field min = " + << limits.min() << " max = " << limits.max() << endl; - if (isNotEqual(max, 1) || isNotEqual(min, 1)) + if (isNotEqual(limits.min(), 1) || isNotEqual(limits.max(), 1)) { FatalErrorInFunction << "Uniform surfaceScalarField not preserved." diff --git a/applications/test/hexRef8/Test-hexRef8.C b/applications/test/hexRef8/Test-hexRef8.C index 12c6d5e38e4eae9a4f2f73c04d73bfd3ae243a25..f122a6a92ecc7babe080db1cc5ee49b47c538db5 100644 --- a/applications/test/hexRef8/Test-hexRef8.C +++ b/applications/test/hexRef8/Test-hexRef8.C @@ -344,13 +344,12 @@ int main(int argc, char *argv[]) // Check constant profile { - const scalar max = gMax(one); - const scalar min = gMin(one); + auto limits = gMinMax(one); - Info<< "Uniform one field min = " << min - << " max = " << max << endl; + Info<< "Uniform one field min = " + << limits.min() << " max = " << limits.max() << endl; - if (isNotEqual(min, 1) || isNotEqual(max, 1)) + if (isNotEqual(limits.min(), 1) || isNotEqual(limits.max(), 1)) { FatalErrorInFunction << "Uniform volVectorField not preserved." @@ -368,13 +367,12 @@ int main(int argc, char *argv[]) { const scalarField diff = ccX-mesh.C().component(0); - const scalar max = gMax(diff); - const scalar min = gMin(diff); + auto limits = gMinMax(diff); - Info<< "Linear profile field min = " << min - << " max = " << max << endl; + Info<< "Linear profile field min = " + << limits.min() << " max = " << limits.max() << endl; - if (isNotEqual(min, 0) || isNotEqual(max, 0)) + if (isNotEqual(limits.min(), 0) || isNotEqual(limits.max(), 0)) { Info<< "Linear profile not preserved." << " Min and max should both be 0.0. min:" << min @@ -389,13 +387,12 @@ int main(int argc, char *argv[]) // Check face field mapping if (surfaceOne.size()) { - const scalar max = gMax(surfaceOne.primitiveField()); - const scalar min = gMin(surfaceOne.primitiveField()); + auto limits = gMinMax(surfaceOne.primitiveField()); - Info<< "Uniform surface field min = " << min - << " max = " << max << endl; + Info<< "Uniform surface field min = " + << limits.min() << " max = " << limits.max() << endl; - if (isNotEqual(min, 1) || isNotEqual(max, 1)) + if (isNotEqual(limits.min(), 1) || isNotEqual(limits.max(), 1)) { FatalErrorInFunction << "Uniform surfaceScalarField not preserved." diff --git a/applications/test/minMax2/Test-minMax2.cxx b/applications/test/minMax2/Test-minMax2.cxx index e228f0dce2cc0415876f398bce5e95bbe75bd1f7..b58363c74485f3514049703a8202fb918c57a3ec 100644 --- a/applications/test/minMax2/Test-minMax2.cxx +++ b/applications/test/minMax2/Test-minMax2.cxx @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2019-2023 OpenCFD Ltd. + Copyright (C) 2019-2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -175,6 +175,36 @@ int main(int argc, char *argv[]) << nl; } + { + scalarField field1(10); + scalarField field2(10); + scalarField work; + + Random rnd(4567); + for (scalar& val : field1) + { + val = rnd.position(scalar(-0.2), scalar(1.2)); + } + for (scalar& val : field2) + { + val = rnd.position(scalar(-0.1), scalar(1.1)); + } + + Info<< nl + << "field1: " << flatOutput(field1) << nl + << "field2: " << flatOutput(field2) << nl; + + work = field1; + work.clamp_min(field2); + + Info<< "clamp_min: " << flatOutput(work) << nl; + + work = field1; + work.clamp_max(field2); + + Info<< "clamp_max: " << flatOutput(work) << nl; + } + Info<< nl << "\nDone\n" << endl; return 0; } diff --git a/applications/utilities/finiteArea/makeFaMesh/checkPatchTopology.H b/applications/utilities/finiteArea/makeFaMesh/checkPatchTopology.H index a38666a544f1205502ba4134c281ad72fe3fac27..6202b67cd86980c3a5abe9c36990b9aad950c304 100644 --- a/applications/utilities/finiteArea/makeFaMesh/checkPatchTopology.H +++ b/applications/utilities/finiteArea/makeFaMesh/checkPatchTopology.H @@ -108,13 +108,13 @@ Input if (numNbrs == 1) { //if (pointSetPtr) pointSetPtr->insert(mesh.edges()[meshEdgei]); - labelTyp = max(labelTyp, TopoType::OPEN); + labelTyp = Foam::max(labelTyp, TopoType::OPEN); } else if (numNbrs == 0 || numNbrs > 2) { if (pointSetPtr) pointSetPtr->insert(mesh.edges()[meshEdgei]); if (badEdgesPtr) badEdgesPtr->insert(edgei); - labelTyp = max(labelTyp, TopoType::ILLEGAL); + labelTyp = Foam::max(labelTyp, TopoType::ILLEGAL); } } reduce(labelTyp, maxOp<label>()); diff --git a/applications/utilities/mesh/advanced/PDRMesh/PDRMesh.C b/applications/utilities/mesh/advanced/PDRMesh/PDRMesh.C index 645a5073d18c31b53680afc4492abc30a9910f83..f2e6a8be6d7cc7908c00e395f61e2e42a4527867 100644 --- a/applications/utilities/mesh/advanced/PDRMesh/PDRMesh.C +++ b/applications/utilities/mesh/advanced/PDRMesh/PDRMesh.C @@ -368,7 +368,8 @@ void subsetTopoSets Info<< "Subsetting " << set.type() << ' ' << set.name() << endl; - labelHashSet subset(2*min(set.size(), map.size())); + labelHashSet subset; + subset.reserve(Foam::min(set.size(), map.size())); // Map the data forAll(map, i) diff --git a/applications/utilities/mesh/advanced/refineHexMesh/refineHexMesh.C b/applications/utilities/mesh/advanced/refineHexMesh/refineHexMesh.C index 0da12172dbf214b4849ffda563f9b0f9be9117ae..fa387d01168178c6a27ad48f79406a69c478ce70 100644 --- a/applications/utilities/mesh/advanced/refineHexMesh/refineHexMesh.C +++ b/applications/utilities/mesh/advanced/refineHexMesh/refineHexMesh.C @@ -145,17 +145,22 @@ int main(int argc, char *argv[]) hexRef8 meshCutter(mesh); // Some stats - Info<< "Read mesh:" << nl - << " cells:" << mesh.globalData().nTotalCells() << nl - << " faces:" << mesh.globalData().nTotalFaces() << nl - << " points:" << mesh.globalData().nTotalPoints() << nl - << " cellLevel :" - << " min:" << gMin(meshCutter.cellLevel()) - << " max:" << gMax(meshCutter.cellLevel()) << nl - << " pointLevel :" - << " min:" << gMin(meshCutter.pointLevel()) - << " max:" << gMax(meshCutter.pointLevel()) << nl - << endl; + { + auto cellLimits = gMinMax(meshCutter.cellLevel()); + auto pointLimits = gMinMax(meshCutter.pointLevel()); + + Info<< "Read mesh:" << nl + << " cells:" << mesh.globalData().nTotalCells() << nl + << " faces:" << mesh.globalData().nTotalFaces() << nl + << " points:" << mesh.globalData().nTotalPoints() << nl + << " cellLevel :" + << " min:" << cellLimits.min() + << " max:" << cellLimits.max() << nl + << " pointLevel :" + << " min:" << pointLimits.min() + << " max:" << pointLimits.max() << nl + << endl; + } // Maintain 2:1 ratio diff --git a/applications/utilities/mesh/advanced/selectCells/edgeStats.C b/applications/utilities/mesh/advanced/selectCells/edgeStats.C index 579a989b4dc7bba198d212faae9787afd1a90904..1f54ceb7932b9cbb2fe7d8e44eb9f1d533ec7505 100644 --- a/applications/utilities/mesh/advanced/selectCells/edgeStats.C +++ b/applications/utilities/mesh/advanced/selectCells/edgeStats.C @@ -37,7 +37,6 @@ License const Foam::scalar Foam::edgeStats::edgeTol_ = 1e-3; - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // Foam::direction Foam::edgeStats::getNormalDir @@ -45,26 +44,25 @@ Foam::direction Foam::edgeStats::getNormalDir const twoDPointCorrector* correct2DPtr ) const { - direction dir = 3; - if (correct2DPtr) { const vector& normal = correct2DPtr->planeNormal(); - if (mag(normal & vector(1, 0, 0)) > 1-edgeTol_) + if (mag(normal.x()) > 1-edgeTol_) { - dir = 0; + return vector::X; } - else if (mag(normal & vector(0, 1, 0)) > 1-edgeTol_) + else if (mag(normal.y()) > 1-edgeTol_) { - dir = 1; + return vector::Y; } - else if (mag(normal & vector(0, 0, 1)) > 1-edgeTol_) + else if (mag(normal.z()) > 1-edgeTol_) { - dir = 2; + return vector::Z; } } - return dir; + + return direction(3); } @@ -95,12 +93,9 @@ Foam::edgeStats::edgeStats(const polyMesh& mesh) { Info<< "Correcting for 2D motion" << endl << endl; - autoPtr<twoDPointCorrector> correct2DPtr - ( - new twoDPointCorrector(mesh) - ); + twoDPointCorrector correct2D(mesh); - normalDir_ = getNormalDir(&correct2DPtr()); + normalDir_ = getNormalDir(&correct2D); } } } @@ -122,24 +117,15 @@ Foam::edgeStats::edgeStats Foam::scalar Foam::edgeStats::minLen(Ostream& os) const { - label nX = 0; - label nY = 0; - label nZ = 0; + label nAny(0); + label nX(0); + label nY(0); + label nZ(0); - scalar minX = GREAT; - scalar maxX = -GREAT; - vector x(1, 0, 0); - - scalar minY = GREAT; - scalar maxY = -GREAT; - vector y(0, 1, 0); - - scalar minZ = GREAT; - scalar maxZ = -GREAT; - vector z(0, 0, 1); - - scalar minOther = GREAT; - scalar maxOther = -GREAT; + scalarMinMax limitsAny(GREAT, -GREAT); + scalarMinMax limitsX(limitsAny); + scalarMinMax limitsY(limitsAny); + scalarMinMax limitsZ(limitsAny); const edgeList& edges = mesh_.edges(); @@ -151,58 +137,75 @@ Foam::scalar Foam::edgeStats::minLen(Ostream& os) const eVec /= eMag; - if (mag(eVec & x) > 1-edgeTol_) + if (mag(eVec.x()) > 1-edgeTol_) { - minX = min(minX, eMag); - maxX = max(maxX, eMag); + limitsX.add(eMag); nX++; } - else if (mag(eVec & y) > 1-edgeTol_) + else if (mag(eVec.y()) > 1-edgeTol_) { - minY = min(minY, eMag); - maxY = max(maxY, eMag); + limitsY.add(eMag); nY++; } - else if (mag(eVec & z) > 1-edgeTol_) + else if (mag(eVec.z()) > 1-edgeTol_) { - minZ = min(minZ, eMag); - maxZ = max(maxZ, eMag); + limitsZ.add(eMag); nZ++; } else { - minOther = min(minOther, eMag); - maxOther = max(maxOther, eMag); + limitsAny.add(eMag); + nAny++; } } os << "Mesh bounding box:" << boundBox(mesh_.points()) << nl << nl << "Mesh edge statistics:" << nl - << " x aligned : number:" << nX << "\tminLen:" << minX - << "\tmaxLen:" << maxX << nl - << " y aligned : number:" << nY << "\tminLen:" << minY - << "\tmaxLen:" << maxY << nl - << " z aligned : number:" << nZ << "\tminLen:" << minZ - << "\tmaxLen:" << maxZ << nl - << " other : number:" << mesh_.nEdges() - nX - nY - nZ - << "\tminLen:" << minOther - << "\tmaxLen:" << maxOther << nl << endl; - - if (normalDir_ == 0) + << " x aligned : number:" << nX + << "\tminLen:" << limitsX.min() << "\tmaxLen:" << limitsX.max() << nl + << " y aligned : number:" << nY + << "\tminLen:" << limitsY.min() << "\tmaxLen:" << limitsY.max() << nl + << " z aligned : number:" << nZ + << "\tminLen:" << limitsZ.min() << "\tmaxLen:" << limitsZ.max() << nl + << " other : number:" << nAny + << "\tminLen:" << limitsAny.min() + << "\tmaxLen:" << limitsAny.max() << nl << endl; + + if (normalDir_ == vector::X) { - return min(minY, min(minZ, minOther)); + return Foam::min + ( + limitsAny.min(), + Foam::min(limitsY.min(), limitsZ.min()) + ); } - else if (normalDir_ == 1) + else if (normalDir_ == vector::Y) { - return min(minX, min(minZ, minOther)); + return Foam::min + ( + limitsAny.min(), + Foam::min(limitsX.min(), limitsZ.min()) + ); } - else if (normalDir_ == 2) + else if (normalDir_ == vector::Z) { - return min(minX, min(minY, minOther)); + return Foam::min + ( + limitsAny.min(), + Foam::min(limitsX.min(), limitsY.min()) + ); } else { - return min(minX, min(minY, min(minZ, minOther))); + return Foam::min + ( + limitsAny.min(), + Foam::min + ( + limitsX.min(), + Foam::min(limitsY.min(), limitsZ.min()) + ) + ); } } diff --git a/applications/utilities/mesh/advanced/snappyRefineMesh/snappyRefineMesh.C b/applications/utilities/mesh/advanced/snappyRefineMesh/snappyRefineMesh.C index 6aa76e6653ea319e9209d0355e15fcfca25a96bf..2b537081feed62e21a1df4ba3ca3f658990ee16a 100644 --- a/applications/utilities/mesh/advanced/snappyRefineMesh/snappyRefineMesh.C +++ b/applications/utilities/mesh/advanced/snappyRefineMesh/snappyRefineMesh.C @@ -81,26 +81,25 @@ void writeSet(const cellSet& cells, const string& msg) direction getNormalDir(const twoDPointCorrector* correct2DPtr) { - direction dir = 3; - if (correct2DPtr) { const vector& normal = correct2DPtr->planeNormal(); - if (mag(normal & vector(1, 0, 0)) > 1-edgeTol) + if (mag(normal.x()) > 1-edgeTol) { - dir = 0; + return vector::X; } - else if (mag(normal & vector(0, 1, 0)) > 1-edgeTol) + else if (mag(normal.y()) > 1-edgeTol) { - dir = 1; + return vector::Y; } - else if (mag(normal & vector(0, 0, 1)) > 1-edgeTol) + else if (mag(normal.z()) > 1-edgeTol) { - dir = 2; + return vector::Z; } } - return dir; + + return direction(3); } @@ -109,89 +108,95 @@ direction getNormalDir(const twoDPointCorrector* correct2DPtr) // directions but exclude component (0=x, 1=y, 2=z, other=none) scalar getEdgeStats(const primitiveMesh& mesh, const direction excludeCmpt) { - label nX = 0; - label nY = 0; - label nZ = 0; - - scalar minX = GREAT; - scalar maxX = -GREAT; - vector x(1, 0, 0); - - scalar minY = GREAT; - scalar maxY = -GREAT; - vector y(0, 1, 0); + label nAny(0); + label nX(0); + label nY(0); + label nZ(0); - scalar minZ = GREAT; - scalar maxZ = -GREAT; - vector z(0, 0, 1); - - scalar minOther = GREAT; - scalar maxOther = -GREAT; + scalarMinMax limitsAny(GREAT, -GREAT); + scalarMinMax limitsX(limitsAny); + scalarMinMax limitsY(limitsAny); + scalarMinMax limitsZ(limitsAny); const edgeList& edges = mesh.edges(); - forAll(edges, edgei) + for (const edge& e : edges) { - const edge& e = edges[edgei]; - vector eVec(e.vec(mesh.points())); scalar eMag = mag(eVec); eVec /= eMag; - if (mag(eVec & x) > 1-edgeTol) + if (mag(eVec.x()) > 1-edgeTol) { - minX = min(minX, eMag); - maxX = max(maxX, eMag); + limitsX.add(eMag); nX++; } - else if (mag(eVec & y) > 1-edgeTol) + else if (mag(eVec.y()) > 1-edgeTol) { - minY = min(minY, eMag); - maxY = max(maxY, eMag); + limitsY.add(eMag); nY++; } - else if (mag(eVec & z) > 1-edgeTol) + else if (mag(eVec.z()) > 1-edgeTol) { - minZ = min(minZ, eMag); - maxZ = max(maxZ, eMag); + limitsZ.add(eMag); nZ++; } else { - minOther = min(minOther, eMag); - maxOther = max(maxOther, eMag); + limitsAny.add(eMag); + nAny++; } } Info<< "Mesh bounding box:" << boundBox(mesh.points()) << nl << nl << "Mesh edge statistics:" << nl - << " x aligned : number:" << nX << "\tminLen:" << minX - << "\tmaxLen:" << maxX << nl - << " y aligned : number:" << nY << "\tminLen:" << minY - << "\tmaxLen:" << maxY << nl - << " z aligned : number:" << nZ << "\tminLen:" << minZ - << "\tmaxLen:" << maxZ << nl - << " other : number:" << mesh.nEdges() - nX - nY - nZ - << "\tminLen:" << minOther - << "\tmaxLen:" << maxOther << nl << endl; - - if (excludeCmpt == 0) + << " x aligned : number:" << nX + << "\tminLen:" << limitsX.min() << "\tmaxLen:" << limitsX.max() << nl + << " y aligned : number:" << nY + << "\tminLen:" << limitsY.min() << "\tmaxLen:" << limitsY.max() << nl + << " z aligned : number:" << nZ + << "\tminLen:" << limitsZ.min() << "\tmaxLen:" << limitsZ.max() << nl + << " other : number:" << nAny + << "\tminLen:" << limitsAny.min() + << "\tmaxLen:" << limitsAny.max() << nl << endl; + + if (excludeCmpt == vector::X) { - return min(minY, min(minZ, minOther)); + return Foam::min + ( + limitsAny.min(), + Foam::min(limitsY.min(), limitsZ.min()) + ); } - else if (excludeCmpt == 1) + else if (excludeCmpt == vector::Y) { - return min(minX, min(minZ, minOther)); + return Foam::min + ( + limitsAny.min(), + Foam::min(limitsX.min(), limitsZ.min()) + ); } - else if (excludeCmpt == 2) + else if (excludeCmpt == vector::Z) { - return min(minX, min(minY, minOther)); + return Foam::min + ( + limitsAny.min(), + Foam::min(limitsX.min(), limitsY.min()) + ); } else { - return min(minX, min(minY, min(minZ, minOther))); + return Foam::min + ( + limitsAny.min(), + Foam::min + ( + limitsX.min(), + Foam::min(limitsY.min(), limitsZ.min()) + ) + ); } } diff --git a/applications/utilities/mesh/conversion/cfx4ToFoam/cfx4ToFoam.C b/applications/utilities/mesh/conversion/cfx4ToFoam/cfx4ToFoam.C index c8294f55be99c0a70eee8872afd2683b2d7e39d8..c6388a0e5b92d3157ef112ff200f415e418d8a36 100644 --- a/applications/utilities/mesh/conversion/cfx4ToFoam/cfx4ToFoam.C +++ b/applications/utilities/mesh/conversion/cfx4ToFoam/cfx4ToFoam.C @@ -271,7 +271,7 @@ int main(int argc, char *argv[]) if (blockPFacePointi != blockPFacePointi2) { sqrMergeTol = - min + Foam::min ( sqrMergeTol, magSqr @@ -338,16 +338,16 @@ int main(int argc, char *argv[]) blockNFacePoints[blockNFacePointi] + blockOffsets[blockNlabel]; - label minPN = min(PpointLabel, NpointLabel); + label minPN = Foam::min(PpointLabel, NpointLabel); if (pointMergeList[PpointLabel] != -1) { - minPN = min(minPN, pointMergeList[PpointLabel]); + minPN = Foam::min(minPN, pointMergeList[PpointLabel]); } if (pointMergeList[NpointLabel] != -1) { - minPN = min(minPN, pointMergeList[NpointLabel]); + minPN = Foam::min(minPN, pointMergeList[NpointLabel]); } pointMergeList[PpointLabel] @@ -411,7 +411,7 @@ int main(int argc, char *argv[]) pointMergeList[PpointLabel] = pointMergeList[NpointLabel] - = min + = Foam::min ( pointMergeList[PpointLabel], pointMergeList[NpointLabel] diff --git a/applications/utilities/mesh/conversion/fluentMeshToFoam/fluentMeshToFoam.L b/applications/utilities/mesh/conversion/fluentMeshToFoam/fluentMeshToFoam.L index d74f4ab01ca83d58a9676087141b79d1423183f8..200a45becd33894665ed94728f2c7214295bd9d1 100644 --- a/applications/utilities/mesh/conversion/fluentMeshToFoam/fluentMeshToFoam.L +++ b/applications/utilities/mesh/conversion/fluentMeshToFoam/fluentMeshToFoam.L @@ -1674,10 +1674,9 @@ int main(int argc, char *argv[]) // Add cell zones to patch zone list forAll(bPatches, pI) { - const labelList& faceCells = bPatches[pI].faceCells(); - forAll(faceCells, fcI) + for (const label celli : bPatches[pI].faceCells()) { - if (zoneCell.test(faceCells[fcI])) + if (zoneCell.test(celli)) { boundaryZones[pI].append(name); break; diff --git a/applications/utilities/mesh/conversion/foamMeshToFluent/fluentFvMesh.C b/applications/utilities/mesh/conversion/foamMeshToFluent/fluentFvMesh.C index f212aee72a2be676388b4b7feb18d93839724529..75ee48cccfaa2bf4dc034886da56ac6ff3e4bee4 100644 --- a/applications/utilities/mesh/conversion/foamMeshToFluent/fluentFvMesh.C +++ b/applications/utilities/mesh/conversion/foamMeshToFluent/fluentFvMesh.C @@ -161,8 +161,7 @@ void Foam::fluentFvMesh::writeFluentMesh() const { const faceUList& patchFaces = boundaryMesh()[patchi]; - const labelList& patchFaceCells = - boundaryMesh()[patchi].faceCells(); + const labelUList& patchFaceCells = boundaryMesh()[patchi].faceCells(); // The face group will be offset by 10 from the patch label diff --git a/applications/utilities/mesh/conversion/gambitToFoam/gambitToFoam.L b/applications/utilities/mesh/conversion/gambitToFoam/gambitToFoam.L index c29bff53e584ae9ac6a2462c61461c6320fd7027..23739c02ca250aef98cba8ed068e6c05ec19ceeb 100644 --- a/applications/utilities/mesh/conversion/gambitToFoam/gambitToFoam.L +++ b/applications/utilities/mesh/conversion/gambitToFoam/gambitToFoam.L @@ -350,7 +350,7 @@ mtype {space}"MTYPE:"{space} // Find out how many labels are expected. If less or equal to // seven, read them all and finish with it. If there is more, // set read of the next line - label labelsToRead = min(8, nVertices); + label labelsToRead = Foam::min(8, nVertices); label labelI = 0; for (; labelI < labelsToRead; labelI++) { @@ -387,7 +387,7 @@ mtype {space}"MTYPE:"{space} labelList& curLabels = cellLabels[curNumberOfCells]; - label labelsToRead = min + label labelsToRead = Foam::min ( (nCellContinuationLines + 1)*7, curLabels.size() diff --git a/applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.C b/applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.C index 8e95e454a990f40b57e2f236c084c4dc044cc317..c91d9023bde383133f5d5c2274bcf4951f6757ab 100644 --- a/applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.C +++ b/applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.C @@ -1506,7 +1506,7 @@ int main(int argc, char *argv[]) // Go through all the patchFaces and find corresponding face in pp. forAll(patchFaces, patchi) { - const DynamicList<face>& pFaces = patchFaces[patchi]; + const auto& pFaces = patchFaces[patchi]; Info<< "Finding faces of patch " << patchi << endl; diff --git a/applications/utilities/mesh/conversion/ideasUnvToFoam/ideasUnvToFoam.C b/applications/utilities/mesh/conversion/ideasUnvToFoam/ideasUnvToFoam.C index cfc923bcf30a7c5a60393e66f5266f42af53bc24..36f89a1814e21e8048eacddb4edb4d471d207cf5 100644 --- a/applications/utilities/mesh/conversion/ideasUnvToFoam/ideasUnvToFoam.C +++ b/applications/utilities/mesh/conversion/ideasUnvToFoam/ideasUnvToFoam.C @@ -269,7 +269,7 @@ void readCells label maxUnvPoint = 0; forAll(unvPointID, pointi) { - maxUnvPoint = max(maxUnvPoint, unvPointID[pointi]); + maxUnvPoint = Foam::max(maxUnvPoint, unvPointID[pointi]); } labelList unvToFoam(invert(maxUnvPoint+1, unvPointID)); @@ -784,7 +784,7 @@ int main(int argc, char *argv[]) label maxUnvPoint = 0; forAll(unvPointID, pointi) { - maxUnvPoint = max(maxUnvPoint, unvPointID[pointi]); + maxUnvPoint = Foam::max(maxUnvPoint, unvPointID[pointi]); } labelList unvToFoam(invert(maxUnvPoint+1, unvPointID)); diff --git a/applications/utilities/mesh/conversion/kivaToFoam/checkPatch.H b/applications/utilities/mesh/conversion/kivaToFoam/checkPatch.H index 6e9eaae3819a686fddf88412c006062188ac24a0..708b9664f534b3696d18286379aef297eb1fe1d2 100644 --- a/applications/utilities/mesh/conversion/kivaToFoam/checkPatch.H +++ b/applications/utilities/mesh/conversion/kivaToFoam/checkPatch.H @@ -8,10 +8,10 @@ { if (kivaVersion == kiva3v) { - regionIndex = max + regionIndex = Foam::max ( - max(idface[quadFace[0]], idface[quadFace[1]]), - max(idface[quadFace[2]], idface[quadFace[3]]) + Foam::max(idface[quadFace[0]], idface[quadFace[1]]), + Foam::max(idface[quadFace[2]], idface[quadFace[3]]) ); if (regionIndex > 0) diff --git a/applications/utilities/mesh/conversion/kivaToFoam/readKivaGrid.H b/applications/utilities/mesh/conversion/kivaToFoam/readKivaGrid.H index fa8c5548dd08b47fcce518fd7223c9f84890b0a1..6c7c23137ab9c18b0bc68c7080e83f53acd37938 100644 --- a/applications/utilities/mesh/conversion/kivaToFoam/readKivaGrid.H +++ b/applications/utilities/mesh/conversion/kivaToFoam/readKivaGrid.H @@ -148,9 +148,7 @@ for (label i=0; i<nPoints; i++) end = pointMap[end]; } - label minLabel = min(start, end); - - pointMap[start] = pointMap[end] = minLabel; + pointMap[start] = pointMap[end] = Foam::min(start, end); } } @@ -331,7 +329,7 @@ if { forAll(pf, pfi) { - minz = min(minz, points[pf[pfi]].z()); + minz = Foam::min(minz, points[pf[pfi]].z()); } } diff --git a/applications/utilities/mesh/conversion/netgenNeutralToFoam/netgenNeutralToFoam.C b/applications/utilities/mesh/conversion/netgenNeutralToFoam/netgenNeutralToFoam.C index c9cbabe10b5adc574df3959fedb888ee54019559..7c719aa8536605d5d105532ab7e29b4acb2cf5ec 100644 --- a/applications/utilities/mesh/conversion/netgenNeutralToFoam/netgenNeutralToFoam.C +++ b/applications/utilities/mesh/conversion/netgenNeutralToFoam/netgenNeutralToFoam.C @@ -188,7 +188,7 @@ int main(int argc, char *argv[]) } - maxPatch = max(maxPatch, patchi); + maxPatch = Foam::max(maxPatch, patchi); triFace tri(readLabel(str)-1, readLabel(str)-1, readLabel(str)-1); diff --git a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C index d1fb66a6056c4b48562672c70d9270bd2d116b9e..c536d2c840d8866f86ea16fbb76a98a1a7f95843 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C +++ b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C @@ -556,8 +556,8 @@ void calcEdgeMinMaxZone forAll(eFaces, i) { label zoneI = mappedZoneID[eFaces[i]]; - minZoneID[edgeI] = min(minZoneID[edgeI], zoneI); - maxZoneID[edgeI] = max(maxZoneID[edgeI], zoneI); + minZoneID[edgeI] = Foam::min(minZoneID[edgeI], zoneI); + maxZoneID[edgeI] = Foam::max(maxZoneID[edgeI], zoneI); } } } @@ -813,8 +813,8 @@ void addCoupledPatches forAll(eFaces, i) { label proci = procID[eFaces[i]]; - minProcID[edgeI] = min(minProcID[edgeI], proci); - maxProcID[edgeI] = max(maxProcID[edgeI], proci); + minProcID[edgeI] = Foam::min(minProcID[edgeI], proci); + maxProcID[edgeI] = Foam::max(maxProcID[edgeI], proci); } } } @@ -1291,7 +1291,7 @@ void extrudeGeometricProperties label celli = regionMesh.faceOwner()[facei]; if (regionMesh.isInternalFace(facei)) { - celli = max(celli, regionMesh.faceNeighbour()[facei]); + celli = Foam::max(celli, regionMesh.faceNeighbour()[facei]); } // Calculate layer from cell numbering (see createShellMesh) @@ -2210,8 +2210,8 @@ int main(int argc, char *argv[]) if (addSidePatches && (zone0 != zone1)) // || (cos(angle) > blabla)) { - label minZone = min(zone0,zone1); - label maxZone = max(zone0,zone1); + label minZone = Foam::min(zone0,zone1); + label maxZone = Foam::max(zone0,zone1); label index = minZone*zoneNames.size()+maxZone; ePatches.setSize(eFaces.size()); diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.C index 2c50d6c462b46a2cf659c1562d74fedb4f348c91..d0acdef622d911d2f365c2fbbcd2eb37a9a2c891 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.C @@ -42,7 +42,7 @@ template<class Triangulation> Foam::autoPtr<Foam::mapDistribute> Foam::DistributedDelaunayMesh<Triangulation>::buildMap ( - const List<label>& toProc + const labelUList& toProc ) { // Determine send map @@ -431,7 +431,7 @@ void Foam::DistributedDelaunayMesh<Triangulation>::markVerticesToRefer template<class Triangulation> Foam::label Foam::DistributedDelaunayMesh<Triangulation>::referVertices ( - const DynamicList<label>& targetProcessor, + const labelUList& targetProcessor, DynamicList<Vb>& parallelVertices, PtrList<labelPairHashSet>& referralVertices, labelPairHashSet& receivedVertices diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.H b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.H index 8a8c75cd97dae007ead2dcba170851e49272d18a..1af5cba757223209acb58ffc1eb13a913fe2d42f 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.H +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.H @@ -115,7 +115,7 @@ private: label referVertices ( - const DynamicList<label>& targetProcessor, + const labelUList& targetProcessor, DynamicList<Vb>& parallelVertices, PtrList<labelPairHashSet>& referralVertices, labelPairHashSet& receivedVertices @@ -160,7 +160,7 @@ public: // Member Functions //- Build a mapDistribute for the supplied destination processor data - static autoPtr<mapDistribute> buildMap(const List<label>& toProc); + static autoPtr<mapDistribute> buildMap(const labelUList& toProc); //- bool distribute(const boundBox& bb); diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.C index 48c0a68a63c5d210408143ed7098780b738b6be0..4a93e7117b3040f591cbaa6bd19c20f7ad695ec3 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.C @@ -47,7 +47,7 @@ namespace Foam Foam::autoPtr<Foam::mapDistribute> Foam::backgroundMeshDecomposition::buildMap ( - const List<label>& toProc + const labelUList& toProc ) { // Determine send map diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.H b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.H index a0dd1bd11d53fbfbb5eda5de0c6880530d0713d9..64ad37a169f05d4332b3871aac5490b6790f249b 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.H +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.H @@ -213,7 +213,7 @@ public: // Member Functions //- Build a mapDistribute for the supplied destination processor data - static autoPtr<mapDistribute> buildMap(const List<label>& toProc); + static autoPtr<mapDistribute> buildMap(const labelUList& toProc); //- Redistribute the background mesh based on a supplied weight field, // returning a map to use to redistribute vertices. diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C index a90fa8ac514ed843f2c1d25734254094e1b1c0a2..8107aee818e4e85c300e0950681dd8a7a5ef2794 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C @@ -945,7 +945,7 @@ Foam::labelHashSet Foam::conformalVoronoiMesh::findOffsetPatchFaces const faceList& localFaces = patch.localFaces(); const pointField& localPoints = patch.localPoints(); - const labelList& fCell = patch.faceCells(); + const labelUList& fCell = patch.faceCells(); forAll(localFaces, pLFI) { diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/pointPairs/pointPairs.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/pointPairs/pointPairs.C index b4f3e88b169dddb868da8f7051d440b9253a4795..cfeb5885cfd0176ae31ca1ee079996100e8b73c2 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/pointPairs/pointPairs.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/pointPairs/pointPairs.C @@ -117,7 +117,7 @@ template<class Triangulation> inline bool Foam::pointPairs<Triangulation>::addPointPair ( const labelPair& master, - const DynamicList<labelPair>& slaves + const UList<labelPair>& slaves ) { for (const labelPair& slave : slaves) diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/pointPairs/pointPairs.H b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/pointPairs/pointPairs.H index 11feda75d47d0e3c6457f46cb124012c30e98064..3b16e5a044d7bd072e718f4c55ef90acc186d101 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/pointPairs/pointPairs.H +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/pointPairs/pointPairs.H @@ -130,7 +130,7 @@ public: inline bool addPointPair ( const labelPair& master, - const DynamicList<labelPair>& slaves + const UList<labelPair>& slaves ); inline bool addPointPair diff --git a/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/CV2D.H b/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/CV2D.H index 2efc703e5eba30db67e331fd8215bdbaca26f498..0f3735423f9190992ace4bb47f9e06486b7998ae 100644 --- a/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/CV2D.H +++ b/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/CV2D.H @@ -262,10 +262,10 @@ private: // and write the inserted point locations to the given file. void insertPointPairs ( - const DynamicList<point2D>& nearSurfacePoints, - const DynamicList<point2D>& surfacePoints, - const DynamicList<label>& surfaceTris, - const DynamicList<label>& surfaceHits, + const UList<point2D>& nearSurfacePoints, + const UList<point2D>& surfacePoints, + const labelUList& surfaceTris, + const labelUList& surfaceHits, const fileName fName ); diff --git a/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/insertSurfaceNearestPointPairs.C b/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/insertSurfaceNearestPointPairs.C index d9b88edbdcd64437e8ab0500b611a086cc35bd84..694ff9efea6a4fbeafb14d723e0d94fc0cec7602 100644 --- a/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/insertSurfaceNearestPointPairs.C +++ b/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/insertSurfaceNearestPointPairs.C @@ -75,10 +75,10 @@ bool Foam::CV2D::dualCellSurfaceIntersection void Foam::CV2D::insertPointPairs ( - const DynamicList<point2D>& nearSurfacePoints, - const DynamicList<point2D>& surfacePoints, - const DynamicList<label>& surfaceTris, - const DynamicList<label>& surfaceHits, + const UList<point2D>& nearSurfacePoints, + const UList<point2D>& surfacePoints, + const labelUList& surfaceTris, + const labelUList& surfaceHits, const fileName fName ) { diff --git a/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/shortEdgeFilter2D.C b/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/shortEdgeFilter2D.C index 3141e0a4b33c270cfa55eecd3ebedfbb38590da1..92ec92926b7de630524e17736bd4deb177b634fc 100644 --- a/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/shortEdgeFilter2D.C +++ b/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/shortEdgeFilter2D.C @@ -80,10 +80,10 @@ void Foam::shortEdgeFilter2D::updateEdgeRegionMap label region = -1; - const DynamicList<label>& startPtRegions = + const labelUList& startPtRegions = boundaryPtRegions[surfPtToBoundaryPt[meshPoints[e.first()]]]; - const DynamicList<label>& endPtRegions = + const labelUList& endPtRegions = boundaryPtRegions[surfPtToBoundaryPt[meshPoints[e.second()]]]; if (startPtRegions.size() > 1 && endPtRegions.size() > 1) @@ -363,9 +363,9 @@ void Foam::shortEdgeFilter2D::filter() && !flagDegenerateFace ) { - const DynamicList<label>& startVertexRegions = + const labelUList& startVertexRegions = boundaryPointRegions[meshPoints[startVertex]]; - const DynamicList<label>& endVertexRegions = + const labelUList& endVertexRegions = boundaryPointRegions[meshPoints[endVertex]]; if (startVertexRegions.size() && endVertexRegions.size()) diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkTools.C b/applications/utilities/mesh/manipulation/checkMesh/checkTools.C index 8b6b0d3195db0367d053a012062de1a328355240..36d1b4755d095836e31c13759561899f234af30d 100644 --- a/applications/utilities/mesh/manipulation/checkMesh/checkTools.C +++ b/applications/utilities/mesh/manipulation/checkMesh/checkTools.C @@ -294,7 +294,7 @@ void Foam::mergeAndWrite forAll(pbm, patchi) { const polyPatch& pp = pbm[patchi]; - const labelList& fc = pp.faceCells(); + const labelUList& fc = pp.faceCells(); forAll(fc, i) { bndInSet[pp.start()+i-mesh.nInternalFaces()] = isInSet[fc[i]]; @@ -319,7 +319,7 @@ void Foam::mergeAndWrite forAll(pbm, patchi) { const polyPatch& pp = pbm[patchi]; - const labelList& fc = pp.faceCells(); + const labelUList& fc = pp.faceCells(); if (pp.coupled()) { forAll(fc, i) diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkTopology.C b/applications/utilities/mesh/manipulation/checkMesh/checkTopology.C index 1c2decf3c23f8854e6789ca93fa81ee16cdbbd43..8842ee73c9dfaf4e05cb5c61b728496a6f24c8d7 100644 --- a/applications/utilities/mesh/manipulation/checkMesh/checkTopology.C +++ b/applications/utilities/mesh/manipulation/checkMesh/checkTopology.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2017-2023 OpenCFD Ltd. + Copyright (C) 2017-2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -700,19 +700,11 @@ Foam::label Foam::checkTopology << mesh.time().timeName()/"cellToRegion" << endl; - IOListRef<label> + IOList<label>::writeContents ( - IOobject - ( - "cellToRegion", - mesh.time().timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), + IOobject("cellToRegion", mesh.time().timeName(), mesh), rs - ).write(); + ); // Points in multiple regions diff --git a/applications/utilities/mesh/manipulation/checkMesh/writeFields.C b/applications/utilities/mesh/manipulation/checkMesh/writeFields.C index c16334b9e3f81dcc73854af12db30167c8cb9d4d..8dd9c08459b21102db7a0871867d1c7eb4142e3a 100644 --- a/applications/utilities/mesh/manipulation/checkMesh/writeFields.C +++ b/applications/utilities/mesh/manipulation/checkMesh/writeFields.C @@ -21,19 +21,16 @@ void maxFaceToCell scalarField& cellFld = cellData.ref(); cellFld = -GREAT; - forAll(cells, cellI) + forAll(cells, celli) { - const cell& cFaces = cells[cellI]; - forAll(cFaces, i) + for (const label facei : cells[celli]) { - cellFld[cellI] = max(cellFld[cellI], faceData[cFaces[i]]); + cellFld[celli] = Foam::max(cellFld[celli], faceData[facei]); } } - forAll(cellData.boundaryField(), patchI) + for (fvPatchScalarField& fvp : cellData.boundaryFieldRef()) { - fvPatchScalarField& fvp = cellData.boundaryFieldRef()[patchI]; - fvp = fvp.patch().patchSlice(faceData); } cellData.correctBoundaryConditions(); @@ -51,19 +48,16 @@ void minFaceToCell scalarField& cellFld = cellData.ref(); cellFld = GREAT; - forAll(cells, cellI) + forAll(cells, celli) { - const cell& cFaces = cells[cellI]; - forAll(cFaces, i) + for (const label facei : cells[celli]) { - cellFld[cellI] = min(cellFld[cellI], faceData[cFaces[i]]); + cellFld[celli] = Foam::min(cellFld[celli], faceData[facei]); } } - forAll(cellData.boundaryField(), patchI) + for (fvPatchScalarField& fvp : cellData.boundaryFieldRef()) { - fvPatchScalarField& fvp = cellData.boundaryFieldRef()[patchI]; - fvp = fvp.patch().patchSlice(faceData); } cellData.correctBoundaryConditions(); @@ -77,7 +71,7 @@ void minFaceToCell const bool correctBoundaryConditions ) { - scalarField& cellFld = cellData.ref(); + scalarField& cellFld = cellData.primitiveFieldRef(); cellFld = GREAT; @@ -87,19 +81,19 @@ void minFaceToCell // Internal faces forAll(own, facei) { - cellFld[own[facei]] = min(cellFld[own[facei]], faceData[facei]); - cellFld[nei[facei]] = min(cellFld[nei[facei]], faceData[facei]); + cellFld[own[facei]] = Foam::min(cellFld[own[facei]], faceData[facei]); + cellFld[nei[facei]] = Foam::min(cellFld[nei[facei]], faceData[facei]); } // Patch faces - forAll(faceData.boundaryField(), patchi) + for (const fvsPatchScalarField& fvp : faceData.boundaryField()) { - const fvsPatchScalarField& fvp = faceData.boundaryField()[patchi]; - const labelUList& fc = fvp.patch().faceCells(); + label pfacei = 0; - forAll(fc, i) + for (const label celli : fvp.patch().faceCells()) { - cellFld[fc[i]] = min(cellFld[fc[i]], fvp[i]); + cellFld[celli] = Foam::max(cellFld[celli], fvp[pfacei]); + ++pfacei; } } @@ -163,7 +157,7 @@ void Foam::writeFields if (selectedFields.found("nonOrthoAngle")) { //- Face based orthogonality - const scalarField faceOrthogonality + scalarField faceOrthogonality ( polyMeshTools::faceOrthogonality ( @@ -172,14 +166,12 @@ void Foam::writeFields mesh.cellCentres() ) ); + faceOrthogonality.clamp_range(-1, 1); //- Face based angle const scalarField nonOrthoAngle ( - radToDeg - ( - Foam::acos(min(scalar(1), max(scalar(-1), faceOrthogonality))) - ) + radToDeg(Foam::acos(faceOrthogonality)) ); //- Cell field - max of either face @@ -534,7 +526,7 @@ void Foam::writeFields ownCc, fc ).quality(); - ownVol = min(ownVol, tetQual); + ownVol = Foam::min(ownVol, tetQual); } } if (mesh.isInternalFace(facei)) @@ -550,7 +542,7 @@ void Foam::writeFields fc, neiCc ).quality(); - neiVol = min(neiVol, tetQual); + neiVol = Foam::min(neiVol, tetQual); } } } @@ -602,19 +594,23 @@ void Foam::writeFields // Internal faces forAll(own, facei) { - cellFld[own[facei]] = min(cellFld[own[facei]], ownPyrVol[facei]); - cellFld[nei[facei]] = min(cellFld[nei[facei]], neiPyrVol[facei]); + cellFld[own[facei]] = + Foam::min(cellFld[own[facei]], ownPyrVol[facei]); + cellFld[nei[facei]] = + Foam::min(cellFld[nei[facei]], neiPyrVol[facei]); } // Patch faces for (const auto& fvp : minPyrVolume.boundaryField()) { - const labelUList& fc = fvp.patch().faceCells(); + label meshFacei = fvp.patch().start(); - forAll(fc, i) + for (const label celli : fvp.patch().faceCells()) { - const label meshFacei = fvp.patch().start(); - cellFld[fc[i]] = min(cellFld[fc[i]], ownPyrVol[meshFacei]); + cellFld[celli] = + Foam::min(cellFld[celli], ownPyrVol[meshFacei]); + + ++meshFacei; } } @@ -625,7 +621,7 @@ void Foam::writeFields if (writeFaceFields) { scalarField minFacePyrVol(neiPyrVol); - minFacePyrVol = min + minFacePyrVol = Foam::min ( minFacePyrVol, SubField<scalar>(ownPyrVol, mesh.nInternalFaces()) diff --git a/applications/utilities/mesh/manipulation/polyDualMesh/meshDualiser.C b/applications/utilities/mesh/manipulation/polyDualMesh/meshDualiser.C index c5cdb17370790834e4d4bb19c0b4cbf4d92d94fa..a3d8b6e510cc21a9d570855678f04c5641795406 100644 --- a/applications/utilities/mesh/manipulation/polyDualMesh/meshDualiser.C +++ b/applications/utilities/mesh/manipulation/polyDualMesh/meshDualiser.C @@ -33,6 +33,7 @@ License #include "mapPolyMesh.H" #include "edgeFaceCirculator.H" #include "mergePoints.H" +#include "DynamicList.H" #include "OFstream.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -98,20 +99,14 @@ void Foam::meshDualiser::dumpPolyTopoChange Info<< "Dumping current polyTopoChange. Faces to " << str1.name() << " , points and edges to " << str2.name() << endl; - const DynamicList<point>& points = meshMod.points(); - - forAll(points, pointi) + for (const auto& p : meshMod.points()) { - meshTools::writeOBJ(str1, points[pointi]); - meshTools::writeOBJ(str2, points[pointi]); + meshTools::writeOBJ(str1, p); + meshTools::writeOBJ(str2, p); } - const DynamicList<face>& faces = meshMod.faces(); - - forAll(faces, facei) + for (const face& f : meshMod.faces()) { - const face& f = faces[facei]; - str1<< 'f'; forAll(f, fp) { @@ -210,7 +205,7 @@ Foam::label Foam::meshDualiser::addInternalFace const bool edgeOrder, const label dualCell0, const label dualCell1, - const DynamicList<label>& verts, + const labelUList& verts, polyTopoChange& meshMod ) const { @@ -326,7 +321,7 @@ Foam::label Foam::meshDualiser::addBoundaryFace const label dualCelli, const label patchi, - const DynamicList<label>& verts, + const labelUList& verts, polyTopoChange& meshMod ) const { diff --git a/applications/utilities/mesh/manipulation/polyDualMesh/meshDualiser.H b/applications/utilities/mesh/manipulation/polyDualMesh/meshDualiser.H index d65d796d085b81ba2e921c607b38c48616e1c482..e10b8c9a9820bca2d9aa873e6b3dd31a18c4ac66 100644 --- a/applications/utilities/mesh/manipulation/polyDualMesh/meshDualiser.H +++ b/applications/utilities/mesh/manipulation/polyDualMesh/meshDualiser.H @@ -46,10 +46,9 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef meshDualiser_H -#define meshDualiser_H +#ifndef Foam_meshDualiser_H +#define Foam_meshDualiser_H -#include "DynamicList.H" #include "bitSet.H" #include "boolList.H" #include "typeInfo.H" @@ -124,7 +123,7 @@ class meshDualiser const bool edgeOrder, const label dualCell0, const label dualCell1, - const DynamicList<label>& verts, + const labelUList& verts, polyTopoChange& meshMod ) const; @@ -137,7 +136,7 @@ class meshDualiser const label dualCelli, const label patchi, - const DynamicList<label>& verts, + const labelUList& verts, polyTopoChange& meshMod ) const; diff --git a/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C b/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C index 0076597534782210174645ea1d57086817476d4e..3a51efb29880039ac7e1851ac29e694e24062cf7 100644 --- a/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C +++ b/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C @@ -63,96 +63,72 @@ static const scalar edgeTol = 1e-3; // Print edge statistics on mesh. void printEdgeStats(const polyMesh& mesh) { - label nX = 0; - label nY = 0; - label nZ = 0; + label nAny(0); + label nX(0); + label nY(0); + label nZ(0); - scalar minX = GREAT; - scalar maxX = -GREAT; - static const vector x(1, 0, 0); - - scalar minY = GREAT; - scalar maxY = -GREAT; - static const vector y(0, 1, 0); - - scalar minZ = GREAT; - scalar maxZ = -GREAT; - static const vector z(0, 0, 1); - - scalar minOther = GREAT; - scalar maxOther = -GREAT; + scalarMinMax limitsAny(GREAT, -GREAT); + scalarMinMax limitsX(limitsAny); + scalarMinMax limitsY(limitsAny); + scalarMinMax limitsZ(limitsAny); bitSet isMasterEdge(syncTools::getMasterEdges(mesh)); const edgeList& edges = mesh.edges(); - forAll(edges, edgeI) + for (const label edgei : isMasterEdge) { - if (isMasterEdge.test(edgeI)) - { - const edge& e = edges[edgeI]; + const edge& e = edges[edgei]; - vector eVec(e.vec(mesh.points())); + vector eVec(e.vec(mesh.points())); - scalar eMag = mag(eVec); + scalar eMag = mag(eVec); - eVec /= eMag; + eVec /= eMag; - if (mag(eVec & x) > 1-edgeTol) - { - minX = min(minX, eMag); - maxX = max(maxX, eMag); - nX++; - } - else if (mag(eVec & y) > 1-edgeTol) - { - minY = min(minY, eMag); - maxY = max(maxY, eMag); - nY++; - } - else if (mag(eVec & z) > 1-edgeTol) - { - minZ = min(minZ, eMag); - maxZ = max(maxZ, eMag); - nZ++; - } - else - { - minOther = min(minOther, eMag); - maxOther = max(maxOther, eMag); - } + if (mag(eVec.x()) > 1-edgeTol) + { + limitsX.add(eMag); + nX++; + } + else if (mag(eVec.y()) > 1-edgeTol) + { + limitsY.add(eMag); + nY++; + } + else if (mag(eVec.z()) > 1-edgeTol) + { + limitsZ.add(eMag); + nZ++; + } + else + { + limitsAny.add(eMag); + nAny++; } } - label nEdges = mesh.nEdges(); - reduce(nEdges, sumOp<label>()); reduce(nX, sumOp<label>()); reduce(nY, sumOp<label>()); reduce(nZ, sumOp<label>()); + reduce(nAny, sumOp<label>()); - reduce(minX, minOp<scalar>()); - reduce(maxX, maxOp<scalar>()); - - reduce(minY, minOp<scalar>()); - reduce(maxY, maxOp<scalar>()); - - reduce(minZ, minOp<scalar>()); - reduce(maxZ, maxOp<scalar>()); - - reduce(minOther, minOp<scalar>()); - reduce(maxOther, maxOp<scalar>()); - + reduce(limitsX, sumOp<scalarMinMax>()); + reduce(limitsY, sumOp<scalarMinMax>()); + reduce(limitsZ, sumOp<scalarMinMax>()); + reduce(limitsAny, sumOp<scalarMinMax>()); Info<< "Mesh edge statistics:" << nl - << " x aligned : number:" << nX << "\tminLen:" << minX - << "\tmaxLen:" << maxX << nl - << " y aligned : number:" << nY << "\tminLen:" << minY - << "\tmaxLen:" << maxY << nl - << " z aligned : number:" << nZ << "\tminLen:" << minZ - << "\tmaxLen:" << maxZ << nl - << " other : number:" << nEdges - nX - nY - nZ - << "\tminLen:" << minOther - << "\tmaxLen:" << maxOther << nl << endl; + << " x aligned : number:" << nX + << "\tminLen:" << limitsX.min() << "\tmaxLen:" << limitsX.max() << nl + << " y aligned : number:" << nY + << "\tminLen:" << limitsY.min() << "\tmaxLen:" << limitsY.max() << nl + << " z aligned : number:" << nZ + << "\tminLen:" << limitsZ.min() << "\tmaxLen:" << limitsZ.max() << nl + << " other : number:" << nAny + << "\tminLen:" << limitsAny.min() + << "\tmaxLen:" << limitsAny.max() << nl << endl; } diff --git a/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C b/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C index 9a3eb426477e8bfca4be0825c52771451938f6ca..b0a30a0a787cd9f3aa3adfc9a30dfa48e90b12fa 100644 --- a/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C +++ b/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2016-2024 OpenCFD Ltd. + Copyright (C) 2016-2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -465,7 +465,7 @@ labelList getRegionFaceOrder // Do region interfaces { - const label nRegions = max(cellToRegion)+1; + const label nRegions = Foam::max(cellToRegion)+1; // Sort in increasing region SortableList<label> sortKey(mesh.nInternalFaces(), labelMax); @@ -478,8 +478,10 @@ labelList getRegionFaceOrder if (ownRegion != neiRegion) { sortKey[facei] = - min(ownRegion, neiRegion)*nRegions - +max(ownRegion, neiRegion); + ( + Foam::min(ownRegion, neiRegion)*nRegions + + Foam::max(ownRegion, neiRegion) + ); } } @@ -1913,13 +1915,13 @@ int main(int argc, char *argv[]) ); meshMapIO.resetHeader("cellMap"); - IOListRef<label>(meshMapIO, map().cellMap()).write(); + IOList<label>::writeContents(meshMapIO, map().cellMap()); meshMapIO.resetHeader("faceMap"); - IOListRef<label>(meshMapIO, map().faceMap()).write(); + IOList<label>::writeContents(meshMapIO, map().faceMap()); meshMapIO.resetHeader("pointMap"); - IOListRef<label>(meshMapIO, map().pointMap()).write(); + IOList<label>::writeContents(meshMapIO, map().pointMap()); } } diff --git a/applications/utilities/mesh/manipulation/setSet/setSet.C b/applications/utilities/mesh/manipulation/setSet/setSet.C index af462ed6d948ea594e88638663b53c17d2856f98..3ca4aedf7b70a6b1a7282ec6dd34059aa335b5de 100644 --- a/applications/utilities/mesh/manipulation/setSet/setSet.C +++ b/applications/utilities/mesh/manipulation/setSet/setSet.C @@ -320,10 +320,10 @@ bool doCommand const globalMeshData& parData = mesh.globalData(); label typSize = - max + Foam::max ( parData.nTotalCells(), - max + Foam::max ( parData.nTotalFaces(), parData.nTotalPoints() @@ -375,7 +375,7 @@ bool doCommand topoSet& currentSet = currentSetPtr(); // Presize it according to current mesh data. - currentSet.reserve(max(currentSet.size(), typSize)); + currentSet.reserve(Foam::max(currentSet.size(), typSize)); } } diff --git a/applications/utilities/mesh/manipulation/subsetMesh/subsetMesh.C b/applications/utilities/mesh/manipulation/subsetMesh/subsetMesh.C index 1b195acc0322956076116ac4dd7f71335a82c787..22c781a7ad22bb0f787efe72cced1906462050d1 100644 --- a/applications/utilities/mesh/manipulation/subsetMesh/subsetMesh.C +++ b/applications/utilities/mesh/manipulation/subsetMesh/subsetMesh.C @@ -295,7 +295,8 @@ void subsetTopoSets Info<< "Subsetting " << set.type() << " " << set.name() << endl; - labelHashSet subset(2*min(set.size(), map.size())); + labelHashSet subset; + subset.reserve(Foam::min(set.size(), map.size())); // Map the data forAll(map, i) diff --git a/applications/utilities/miscellaneous/patchSummary/patchSummary.C b/applications/utilities/miscellaneous/patchSummary/patchSummary.C index 14d9e3f9ea680e09fe3b506626a6f91c834cdf2a..a451b1134a990ea2f90927b4efcaacda76d988f0 100644 --- a/applications/utilities/miscellaneous/patchSummary/patchSummary.C +++ b/applications/utilities/miscellaneous/patchSummary/patchSummary.C @@ -191,10 +191,8 @@ int main(int argc, char *argv[]) } - forAll(groupToPatches, groupI) + for (const auto& patchIDs : groupToPatches) { - const DynamicList<label>& patchIDs = groupToPatches[groupI]; - if (patchIDs.size() > 1) { // Check if part of a group diff --git a/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C index b77f2777fb3dfc4bd74aee6441aae864505fb2d4..369670821467a3502f6d23918690d5338041dee7 100644 --- a/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C +++ b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2019-2024 OpenCFD Ltd. + Copyright (C) 2019-2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -846,12 +846,9 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets) "boundaryProcAddressing", procMesh.facesInstance(), polyMesh::meshSubDir/pointMesh::meshSubDir, - procPointMesh.thisDb(), - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER + procPointMesh.thisDb() ); - IOListRef<label>(ioAddr, boundaryProcAddressing).write(); + IOList<label>::writeContents(ioAddr, boundaryProcAddressing); } } @@ -1013,15 +1010,15 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets) // pointProcAddressing ioAddr.rename("pointProcAddressing"); - IOListRef<label>(ioAddr, procPointAddressing_[proci]).write(); + IOList<label>::writeContents(ioAddr, procPointAddressing_[proci]); // faceProcAddressing ioAddr.rename("faceProcAddressing"); - IOListRef<label>(ioAddr, procFaceAddressing_[proci]).write(); + IOList<label>::writeContents(ioAddr, procFaceAddressing_[proci]); // cellProcAddressing ioAddr.rename("cellProcAddressing"); - IOListRef<label>(ioAddr, procCellAddressing_[proci]).write(); + IOList<label>::writeContents(ioAddr, procCellAddressing_[proci]); // Write patch map for backwards compatibility. // (= identity map for original patches, -1 for processor patches) @@ -1031,7 +1028,7 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets) // boundaryProcAddressing ioAddr.rename("boundaryProcAddressing"); - IOListRef<label>(ioAddr, procBoundaryAddr).write(); + IOList<label>::writeContents(ioAddr, procBoundaryAddr); } diff --git a/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C b/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C index 56eaa1d4d9cf1a2255f5c9df66582806613a00a1..35add854354c0e78f2ccb6765ff0519582ef3ac5 100644 --- a/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C +++ b/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2016-2024 OpenCFD Ltd. + Copyright (C) 2016-2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -502,7 +502,7 @@ void writeMaps Info<< " pointProcAddressing" << endl; ioAddr.rename("pointProcAddressing"); - IOListRef<label>(ioAddr, pointProcAddressing).write(); + IOList<label>::writeContents(ioAddr, pointProcAddressing); // From processor face to reconstructed mesh face Info<< " faceProcAddressing" << endl; @@ -551,13 +551,13 @@ void writeMaps // From processor cell to reconstructed mesh cell Info<< " cellProcAddressing" << endl; ioAddr.rename("cellProcAddressing"); - IOListRef<label>(ioAddr, cellProcAddressing).write(); + IOList<label>::writeContents(ioAddr, cellProcAddressing); // From processor patch to reconstructed mesh patch Info<< " boundaryProcAddressing" << endl; ioAddr.rename("boundaryProcAddressing"); - IOListRef<label>(ioAddr, boundProcAddressing).write(); + IOList<label>::writeContents(ioAddr, boundProcAddressing); Info<< endl; } @@ -1131,7 +1131,7 @@ int main(int argc, char *argv[]) for ( label addedI=next; - addedI<min(proci+step, nProcs); + addedI < Foam::min(proci+step, nProcs); addedI++ ) { diff --git a/applications/utilities/parallelProcessing/redistributePar/redistributePar.C b/applications/utilities/parallelProcessing/redistributePar/redistributePar.C index 305ec95aca647db71b8c22fd6dd287d113b8b2d4..f1461bac18d1c2c98d292eafe2f2ba4560c48b0b 100644 --- a/applications/utilities/parallelProcessing/redistributePar/redistributePar.C +++ b/applications/utilities/parallelProcessing/redistributePar/redistributePar.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. @@ -403,11 +403,11 @@ void printMeshData(const polyMesh& mesh) << nBndFaces-nProcFaces << endl; } - maxProcCells = max(maxProcCells, nLocalCells); + maxProcCells = Foam::max(maxProcCells, nLocalCells); totProcFaces += nProcFaces; totProcPatches += nei.size(); - maxProcFaces = max(maxProcFaces, nProcFaces); - maxProcPatches = max(maxProcPatches, nei.size()); + maxProcFaces = Foam::max(maxProcFaces, nProcFaces); + maxProcPatches = Foam::max(maxProcPatches, nei.size()); } // Summary stats @@ -461,19 +461,12 @@ void writeDecomposition { // Write the decomposition as labelList for use with 'manual' // decomposition method. - IOListRef<label> + IOList<label>::writeContents ( - IOobject - ( - "cellDecomposition", - mesh.facesInstance(), // mesh read from facesInstance - mesh, - IOobjectOption::NO_READ, - IOobjectOption::NO_WRITE, - IOobjectOption::NO_REGISTER - ), + // NB: mesh read from facesInstance + IOobject("cellDecomposition", mesh.facesInstance(), mesh), decomp - ).write(); + ); InfoOrPout << "Writing wanted cell distribution to volScalarField " << name @@ -991,7 +984,8 @@ autoPtr<mapDistributePolyMesh> redistributeAndWrite polyMesh::meshSubDir, mesh.thisDb(), IOobjectOption::NO_READ, - IOobjectOption::AUTO_WRITE + IOobjectOption::AUTO_WRITE, + IOobjectOption::REGISTER ), distMap() ); @@ -3029,20 +3023,17 @@ int main(int argc, char *argv[]) { auto oldHandler = fileOperation::fileHandler(writeHandler); - IOmapDistributePolyMeshRef + IOmapDistributePolyMesh::writeContents ( IOobject ( "procAddressing", areaProcMeshPtr->facesInstance(), faMesh::meshSubDir, - areaProcMeshPtr->thisDb(), - IOobjectOption::NO_READ, - IOobjectOption::NO_WRITE, - IOobjectOption::NO_REGISTER + areaProcMeshPtr->thisDb() ), faDistMap - ).write(); + ); areaProcMeshPtr->write(); diff --git a/applications/utilities/postProcessing/dataConversion/foamDataToFluent/writeFluentScalarField.C b/applications/utilities/postProcessing/dataConversion/foamDataToFluent/writeFluentScalarField.C index 56dd1c626dddb64c4cd0e84933df3baca3d3012b..9a00f738bda0ca7d780538b88a51a65404fec900 100644 --- a/applications/utilities/postProcessing/dataConversion/foamDataToFluent/writeFluentScalarField.C +++ b/applications/utilities/postProcessing/dataConversion/foamDataToFluent/writeFluentScalarField.C @@ -76,7 +76,7 @@ void Foam::writeFluentField const scalarField& phiInternal = phi; // Get reference to internal cells - const labelList emptyFaceCells = + const auto& emptyFaceCells = phi.boundaryField()[patchi].patch().patch().faceCells(); // Writing cells for empty patch diff --git a/applications/utilities/postProcessing/lagrangian/particleTracks/particleTracks.C b/applications/utilities/postProcessing/lagrangian/particleTracks/particleTracks.C index 2202574ad88b3d3a4a62fc229fc6ad026d806e50..1e6af8563f92ccc3d877180c687ded4f830ceb22 100644 --- a/applications/utilities/postProcessing/lagrangian/particleTracks/particleTracks.C +++ b/applications/utilities/postProcessing/lagrangian/particleTracks/particleTracks.C @@ -131,7 +131,7 @@ int main(int argc, char *argv[]) args.readIfPresent("format", setFormat); args.readIfPresent("stride", sampleFrequency); - sampleFrequency = max(1, sampleFrequency); // sanity + sampleFrequency = Foam::max(1, sampleFrequency); // sanity // Setup the writer auto writerPtr = @@ -179,7 +179,7 @@ int main(int argc, char *argv[]) maxIds.resize(origProc+1, -1); } - maxIds[origProc] = max(maxIds[origProc], origId); + maxIds[origProc] = Foam::max(maxIds[origProc], origId); } } diff --git a/applications/utilities/preProcessing/PDR/pdrFields/PDRarraysCalc.C b/applications/utilities/preProcessing/PDR/pdrFields/PDRarraysCalc.C index 382086b80b41c1e60cc6eb1773ade2f3ac38b142..f25ede0b3e4d396e2d4353e5798635e9d2be4542 100644 --- a/applications/utilities/preProcessing/PDR/pdrFields/PDRarraysCalc.C +++ b/applications/utilities/preProcessing/PDR/pdrFields/PDRarraysCalc.C @@ -1056,7 +1056,7 @@ void calc_drag_etc const scalar expon = ( br > 0.0 - ? min(max((surr_br / br - 0.25) * 4.0 / 3.0, scalar(0)), scalar(1)) + ? Foam::clamp((surr_br / br - 0.25) * 4.0 / 3.0, Foam::zero_one{}) : 0.0 ); @@ -1114,16 +1114,16 @@ void Foam::PDRarrays::blockageSummary() const totVolBlock += v_block(ijk) * pdrBlock.V(ijk); totArea += surf(ijk); - totCount += max(0, obs_count(ijk)); + totCount += Foam::max(0, obs_count(ijk)); - totDrag.x() += max(0, drag_s(ijk).xx()); - totDrag.y() += max(0, drag_s(ijk).yy()); - totDrag.z() += max(0, drag_s(ijk).zz()); + totDrag.x() += Foam::max(0, drag_s(ijk).xx()); + totDrag.y() += Foam::max(0, drag_s(ijk).yy()); + totDrag.z() += Foam::max(0, drag_s(ijk).zz()); for (direction cmpt=0; cmpt < vector::nComponents; ++cmpt) { - totBlock[cmpt] += max(0, area_block_s(ijk)[cmpt]); - totBlock[cmpt] += max(0, area_block_r(ijk)[cmpt]); + totBlock[cmpt] += Foam::max(0, area_block_s(ijk)[cmpt]); + totBlock[cmpt] += Foam::max(0, area_block_r(ijk)[cmpt]); } } } diff --git a/applications/utilities/preProcessing/PDR/pdrFields/PDRutilsOverlap.C b/applications/utilities/preProcessing/PDR/pdrFields/PDRutilsOverlap.C index 1c27f536cfe2538b17e4f9ec83527679a6962581..b79311b49aed1bcea7d180e5dbc7ddf5ec703f97 100644 --- a/applications/utilities/preProcessing/PDR/pdrFields/PDRutilsOverlap.C +++ b/applications/utilities/preProcessing/PDR/pdrFields/PDRutilsOverlap.C @@ -302,7 +302,7 @@ void Foam::PDRutils::circle_overlap scalar da = ac - 0.5 * (a1 + a2); scalar db = bc - 0.5 * (b1 + b2); scalar dc = std::hypot(da, db); - scalar rat1 = min(max((dc / sqrt(area) - 0.3) * 1.4, 0), 1); + scalar rat1 = Foam::min(Foam::max((dc / sqrt(area) - 0.3) * 1.4, 0), 1); scalar drg0 = c_drag(ia,ib).xx(); scalar drg1 = c_drag(ia,ib).yy(); scalar drg = std::hypot(drg0, drg1); @@ -449,8 +449,8 @@ scalar block_overlap { PDRobstacle over; - over.pt = max(blk1.pt, blk2.pt); - over.span = min(max1, max2) - over.pt; + over.pt = Foam::max(blk1.pt, blk2.pt); + over.span = Foam::min(max1, max2) - over.pt; assert(cmptProduct(over.span) > 0.0); @@ -603,11 +603,11 @@ scalar block_cylinder_overlap over.x() = a_centre - 0.5 * a_lblk; over.y() = b_centre - 0.5 * b_lblk; - over.z() = max(blk1.z(), cyl2.z()); + over.z() = Foam::max(blk1.z(), cyl2.z()); over.span.x() = a_lblk; over.span.y() = b_lblk; - over.span.z() = min(max1.z(), cyl2.z() + cyl2.len()) - over.z(); + over.span.z() = Foam::min(max1.z(), cyl2.z() + cyl2.len()) - over.z(); assert(over.x() > -200.0); assert(over.x() < 2000.0); } @@ -668,11 +668,11 @@ scalar block_cylinder_overlap over.z() = a_centre - a_lblk * 0.5; over.x() = b_centre - b_lblk * 0.5; - over.y() = max(blk1.y(), cyl2.y()); + over.y() = Foam::max(blk1.y(), cyl2.y()); over.span.z() = a_lblk; over.span.x() = b_lblk; - over.span.y() = min(max1.y(), cyl2.y() + cyl2.len()) - over.y(); + over.span.y() = Foam::min(max1.y(), cyl2.y() + cyl2.len()) - over.y(); } break; @@ -734,11 +734,11 @@ scalar block_cylinder_overlap over.y() = a_centre - a_lblk * 0.5; over.z() = b_centre - b_lblk * 0.5; - over.x() = max(blk1.x(), cyl2.x()); + over.x() = Foam::max(blk1.x(), cyl2.x()); over.span.y() = a_lblk; over.span.z() = b_lblk; - over.span.x() = min(max1.x(), cyl2.x() + cyl2.len()) - over.x(); + over.span.x() = Foam::min(max1.x(), cyl2.x() + cyl2.len()) - over.x(); } break; } diff --git a/applications/utilities/preProcessing/createBoxTurb/createBoxTurb.C b/applications/utilities/preProcessing/createBoxTurb/createBoxTurb.C index 5e01b77ada518c386afc72c38fb5564b84b001d6..4c1400fc08da618e6b44bde1401d72df30f08f71 100644 --- a/applications/utilities/preProcessing/createBoxTurb/createBoxTurb.C +++ b/applications/utilities/preProcessing/createBoxTurb/createBoxTurb.C @@ -167,18 +167,24 @@ int main(int argc, char *argv[]) Info<< "Generating kinetic energy field" << endl; volScalarField k("k", 0.5*magSqr(U)); k.write(); + + auto limits = gMinMax(k); + auto avg = gAverage(k); + Info<< "min/max/average k = " - << gMin(k) << ", " << gMax(k) << ", " << gAverage(k) - << endl; + << limits.min() << ", " << limits.max() << ", " << avg << endl; } { Info<< "Generating div(U) field" << endl; volScalarField divU(fvc::div(U)); divU.write(); + + auto limits = gMinMax(divU); + auto avg = gAverage(divU); + Info<< "min/max/average div(U) = " - << gMin(divU) << ", " << gMax(divU) << ", " << gAverage(divU) - << endl; + << limits.min() << ", " << limits.max() << ", " << avg << endl; } Info<< nl; diff --git a/applications/utilities/preProcessing/createViewFactors/viewFactorModels/viewFactorModel/viewFactor2AI/viewFactor2AI.C b/applications/utilities/preProcessing/createViewFactors/viewFactorModels/viewFactorModel/viewFactor2AI/viewFactor2AI.C index 2b7afe34bff644309a57a8532eaa415eb71ca37d..ff333a20e095ab9950c7d906bdd500773928233e 100644 --- a/applications/utilities/preProcessing/createViewFactors/viewFactorModels/viewFactorModel/viewFactor2AI/viewFactor2AI.C +++ b/applications/utilities/preProcessing/createViewFactors/viewFactorModels/viewFactorModel/viewFactor2AI/viewFactor2AI.C @@ -78,10 +78,10 @@ Foam::scalarListList Foam::VF::viewFactor2AI::calculate const labelListList& visibleFaceFaces, const pointField& compactCf, const vectorField& compactSf, - const List<List<vector>>& compactFineSf, - const List<List<point>>& compactFineCf, - const DynamicList<List<point>>& compactPoints, - const DynamicList<label>& compactPatchId + const UList<List<vector>>& compactFineSf, + const UList<List<point>>& compactFineCf, + const UList<List<point>>& compactPoints, + const UList<label>& compactPatchId ) const { // Fill local view factor matrix diff --git a/applications/utilities/preProcessing/createViewFactors/viewFactorModels/viewFactorModel/viewFactor2AI/viewFactor2AI.H b/applications/utilities/preProcessing/createViewFactors/viewFactorModels/viewFactorModel/viewFactor2AI/viewFactor2AI.H index 9ba377435b4d55193731e0d6ef6b1012e01888ca..3610dc9239a0e1bf5b5a0433339ac893f6d585ff 100644 --- a/applications/utilities/preProcessing/createViewFactors/viewFactorModels/viewFactorModel/viewFactor2AI/viewFactor2AI.H +++ b/applications/utilities/preProcessing/createViewFactors/viewFactorModels/viewFactorModel/viewFactor2AI/viewFactor2AI.H @@ -85,10 +85,10 @@ protected: const labelListList& visibleFaceFaces, const pointField& compactCf, const vectorField& compactSf, - const List<List<vector>>& compactFineSf, - const List<List<point>>& compactFineCf, - const DynamicList<List<point>>& compactPoints, - const DynamicList<label>& compactPatchId + const UList<List<vector>>& compactFineSf, + const UList<List<point>>& compactFineCf, + const UList<List<point>>& compactPoints, + const UList<label>& compactPatchId ) const; diff --git a/applications/utilities/preProcessing/createViewFactors/viewFactorModels/viewFactorModel/viewFactor2LI/viewFactor2LI.C b/applications/utilities/preProcessing/createViewFactors/viewFactorModels/viewFactorModel/viewFactor2LI/viewFactor2LI.C index 273b5c2ac5e3f22ccddd99c6de10960989cb8b85..d81598e6850f32c94904a00c6726d07dae4e4d65 100644 --- a/applications/utilities/preProcessing/createViewFactors/viewFactorModels/viewFactorModel/viewFactor2LI/viewFactor2LI.C +++ b/applications/utilities/preProcessing/createViewFactors/viewFactorModels/viewFactorModel/viewFactor2LI/viewFactor2LI.C @@ -84,10 +84,10 @@ Foam::scalarListList Foam::VF::viewFactor2LI::calculate const labelListList& visibleFaceFaces, const pointField& compactCf, const vectorField& compactSf, - const List<List<vector>>& compactFineSf, - const List<List<point>>& compactFineCf, - const DynamicList<List<point>>& compactPoints, - const DynamicList<label>& compactPatchId + const UList<List<vector>>& compactFineSf, + const UList<List<point>>& compactFineCf, + const UList<List<point>>& compactPoints, + const UList<label>& compactPatchId ) const { // Fill local view factor matrix diff --git a/applications/utilities/preProcessing/createViewFactors/viewFactorModels/viewFactorModel/viewFactor2LI/viewFactor2LI.H b/applications/utilities/preProcessing/createViewFactors/viewFactorModels/viewFactorModel/viewFactor2LI/viewFactor2LI.H index 0d2c0d273d3403cc4000dc32a54d1d093aecfb12..94625f654a1b87f81fca425e367201b7db275bf9 100644 --- a/applications/utilities/preProcessing/createViewFactors/viewFactorModels/viewFactorModel/viewFactor2LI/viewFactor2LI.H +++ b/applications/utilities/preProcessing/createViewFactors/viewFactorModels/viewFactorModel/viewFactor2LI/viewFactor2LI.H @@ -98,10 +98,10 @@ protected: const labelListList& visibleFaceFaces, const pointField& compactCf, const vectorField& compactSf, - const List<List<vector>>& compactFineSf, - const List<List<point>>& compactFineCf, - const DynamicList<List<point>>& compactPoints, - const DynamicList<label>& compactPatchId + const UList<List<vector>>& compactFineSf, + const UList<List<point>>& compactFineCf, + const UList<List<point>>& compactPoints, + const UList<label>& compactPatchId ) const; diff --git a/applications/utilities/preProcessing/createViewFactors/viewFactorModels/viewFactorModel/viewFactorHottel/viewFactorHottel.C b/applications/utilities/preProcessing/createViewFactors/viewFactorModels/viewFactorModel/viewFactorHottel/viewFactorHottel.C index 3b352ab69f8c976833f9566fe2977a5c054ebf22..85ae0b75df50ba8a20d66d54369ddb5bf200809b 100644 --- a/applications/utilities/preProcessing/createViewFactors/viewFactorModels/viewFactorModel/viewFactorHottel/viewFactorHottel.C +++ b/applications/utilities/preProcessing/createViewFactors/viewFactorModels/viewFactorModel/viewFactorHottel/viewFactorHottel.C @@ -63,10 +63,10 @@ Foam::scalarListList Foam::VF::viewFactorHottel::calculate const labelListList& visibleFaceFaces, const pointField& compactCf, const vectorField& compactSf, - const List<List<vector>>& compactFineSf, - const List<List<point>>& compactFineCf, - const DynamicList<List<point>>& compactPoints, - const DynamicList<label>& compactPatchId + const UList<List<vector>>& compactFineSf, + const UList<List<point>>& compactFineCf, + const UList<List<point>>& compactPoints, + const UList<label>& compactPatchId ) const { // Fill local view factor matrix diff --git a/applications/utilities/preProcessing/createViewFactors/viewFactorModels/viewFactorModel/viewFactorHottel/viewFactorHottel.H b/applications/utilities/preProcessing/createViewFactors/viewFactorModels/viewFactorModel/viewFactorHottel/viewFactorHottel.H index da7bade587b3356ca40c9e4dfa406c362eee8cc8..0b11f75b3cf80040a2aa3460fbe12139be866733 100644 --- a/applications/utilities/preProcessing/createViewFactors/viewFactorModels/viewFactorModel/viewFactorHottel/viewFactorHottel.H +++ b/applications/utilities/preProcessing/createViewFactors/viewFactorModels/viewFactorModel/viewFactorHottel/viewFactorHottel.H @@ -103,10 +103,10 @@ protected: const labelListList& visibleFaceFaces, const pointField& compactCf, const vectorField& compactSf, - const List<List<vector>>& compactFineSf, - const List<List<point>>& compactFineCf, - const DynamicList<List<point>>& compactPoints, - const DynamicList<label>& compactPatchId + const UList<List<vector>>& compactFineSf, + const UList<List<point>>& compactFineCf, + const UList<List<point>>& compactPoints, + const UList<label>& compactPatchId ) const; diff --git a/applications/utilities/preProcessing/createViewFactors/viewFactorModels/viewFactorModel/viewFactorModel/viewFactorModel.H b/applications/utilities/preProcessing/createViewFactors/viewFactorModels/viewFactorModel/viewFactorModel/viewFactorModel.H index 549c50978da3f15556a93d72b74903f79024eb84..a2ed02d934728061687bc44657b2388493c6174b 100644 --- a/applications/utilities/preProcessing/createViewFactors/viewFactorModels/viewFactorModel/viewFactorModel/viewFactorModel.H +++ b/applications/utilities/preProcessing/createViewFactors/viewFactorModels/viewFactorModel/viewFactorModel/viewFactorModel.H @@ -117,10 +117,10 @@ protected: const labelListList& visibleFaceFaces, const pointField& compactCoarseCf, const vectorField& compactCoarseSf, - const List<List<vector>>& compactFineSf, - const List<List<point>>& compactFineCf, - const DynamicList<List<point>>& compactPoints, - const DynamicList<label>& compactPatchId + const UList<List<vector>>& compactFineSf, + const UList<List<point>>& compactFineCf, + const UList<List<point>>& compactPoints, + const labelUList& compactPatchId ) const = 0; diff --git a/applications/utilities/preProcessing/engineSwirl/engineSwirl.C b/applications/utilities/preProcessing/engineSwirl/engineSwirl.C index cb50df548598185515aa4cc97e636a24f75a7ab4..9c1d70e96a49c9134b1b7159a60dee484761b92b 100644 --- a/applications/utilities/preProcessing/engineSwirl/engineSwirl.C +++ b/applications/utilities/preProcessing/engineSwirl/engineSwirl.C @@ -71,9 +71,9 @@ int main(int argc, char *argv[]) { scalar b = j1(swirlProfile*r/cylinderRadius).value(); scalar vEff = omega*b; - r = max(r, SMALL); + r = Foam::max(r, SMALL); U[celli] = ((vEff/r)*(c & yT))*xT + (-(vEff/r)*(c & xT))*yT; - Umax = max(Umax, mag(U[celli])); + Umax = Foam::max(Umax, mag(U[celli])); } } diff --git a/applications/utilities/preProcessing/setAlphaField/setAlphaField.C b/applications/utilities/preProcessing/setAlphaField/setAlphaField.C index 89e10cd444974a8e808b5829e8f233cba1b43aa8..d6f754d286be779c0a51d90b84adeb9c9270f4a4 100644 --- a/applications/utilities/preProcessing/setAlphaField/setAlphaField.C +++ b/applications/utilities/preProcessing/setAlphaField/setAlphaField.C @@ -55,7 +55,7 @@ Description void isoFacesToFile ( - const DynamicList<List<point>>& faces, + const UList<List<point>>& faces, const word& fileName ) { @@ -65,7 +65,7 @@ void isoFacesToFile if (Pstream::parRun()) { // Collect points from all the processors - List<DynamicList<List<point>>> allProcFaces(Pstream::nProcs()); + List<List<List<point>>> allProcFaces(Pstream::nProcs()); allProcFaces[Pstream::myProcNo()] = faces; Pstream::gatherList(allProcFaces); @@ -73,9 +73,9 @@ void isoFacesToFile { Info<< "Writing file: " << fileName << endl; - for (const DynamicList<List<point>>& procFaces : allProcFaces) + for (const auto& procFaces : allProcFaces) { - for (const List<point>& facePts : procFaces) + for (const auto& facePts : procFaces) { os.writeFace(facePts); } @@ -86,7 +86,7 @@ void isoFacesToFile { Info<< "Writing file: " << fileName << endl; - for (const List<point>& facePts : faces) + for (const auto& facePts : faces) { os.writeFace(facePts); } @@ -223,11 +223,16 @@ int main(int argc, char *argv[]) Info<< "Writing new alpha field " << alpha1.name() << endl; alpha1.write(); - const scalarField& alpha = alpha1.internalField(); + { + const auto& alpha = alpha1.primitiveField(); + + auto limits = gMinMax(alpha); + auto total = gWeightedSum(mesh.V(), alpha); - Info<< "sum(alpha*V):" << gSum(mesh.V()*alpha) - << ", 1-max(alpha1): " << 1 - gMax(alpha) - << " min(alpha1): " << gMin(alpha) << endl; + Info<< "sum(alpha*V):" << total + << ", 1-max(alpha1): " << 1 - limits.max() + << " min(alpha1): " << limits.min() << endl; + } Info<< "\nEnd\n" << endl; diff --git a/applications/utilities/surface/surfaceCheck/surfaceCheck.C b/applications/utilities/surface/surfaceCheck/surfaceCheck.C index 7c6be507e1786efa4e23089dc970c96b5e123675..15ec124430b3c818316b8ed53824fb4f36c27791 100644 --- a/applications/utilities/surface/surfaceCheck/surfaceCheck.C +++ b/applications/utilities/surface/surfaceCheck/surfaceCheck.C @@ -887,7 +887,7 @@ int main(int argc, char *argv[]) writeParts ( surf, - min(outputThreshold, numZones), + Foam::min(outputThreshold, numZones), faceZone, surfFilePath, surfFileStem @@ -953,7 +953,7 @@ int main(int argc, char *argv[]) writeParts ( surf, - min(outputThreshold, numNormalZones), + Foam::min(outputThreshold, numNormalZones), normalZone, surfFilePath, surfFileStem + "_normal" diff --git a/applications/utilities/surface/surfaceHookUp/surfaceHookUp.C b/applications/utilities/surface/surfaceHookUp/surfaceHookUp.C index 603f07b43fd8aba37d03b07b5f07de284768201a..ef0b74fdcf735a1608ae6f45f885adbe828b2822 100644 --- a/applications/utilities/surface/surfaceHookUp/surfaceHookUp.C +++ b/applications/utilities/surface/surfaceHookUp/surfaceHookUp.C @@ -280,7 +280,7 @@ int main(int argc, char *argv[]) const IOdictionary dict(dictIO); const scalar dist(args.get<scalar>(1)); - const scalar matchTolerance(max(1e-6*dist, SMALL)); + const scalar matchTolerance(Foam::max(1e-6*dist, SMALL)); const label maxIters = 100; Info<< "Hooking distance = " << dist << endl; diff --git a/applications/utilities/surface/surfaceInflate/surfaceInflate.C b/applications/utilities/surface/surfaceInflate/surfaceInflate.C index 3292780ef73fdc7a8d4132f602d821dcd639c9ad..4a16e37c8b542cc5194b78e2a3e51bf30f860851 100644 --- a/applications/utilities/surface/surfaceInflate/surfaceInflate.C +++ b/applications/utilities/surface/surfaceInflate/surfaceInflate.C @@ -276,7 +276,7 @@ label detectIntersectionPoints // 1. Extrusion offset vectors intersecting new surface location { - scalar tol = max(tolerance, 10*s.tolerance()); + scalar tol = Foam::max(tolerance, 10*s.tolerance()); // Collect all the edge vectors. Slightly shorten the edges to prevent // finding lots of intersections. The fast triangle intersection routine @@ -296,7 +296,7 @@ label detectIntersectionPoints && !localFaces[hits[pointI].index()].found(pointI) ) { - scale[pointI] = max(0.0, scale[pointI]-0.2); + scale[pointI] = Foam::max(0.0, scale[pointI]-0.2); isPointOnHitEdge.set(pointI); nHits++; @@ -330,7 +330,7 @@ label detectIntersectionPoints << pt << endl; - scale[e[0]] = max(0.0, scale[e[0]]-0.2); + scale[e[0]] = Foam::max(0.0, scale[e[0]]-0.2); nHits++; } if (isPointOnHitEdge.set(e[1])) @@ -342,7 +342,7 @@ label detectIntersectionPoints << pt << endl; - scale[e[1]] = max(0.0, scale[e[1]]-0.2); + scale[e[1]] = Foam::max(0.0, scale[e[1]]-0.2); nHits++; } } @@ -418,7 +418,7 @@ void minSmooth const edge& e = edges[edgeI]; scalar w = mag(points[mp[e[0]]]-points[mp[e[1]]]); - edgeWeights[edgeI] = 1.0/(max(w, SMALL)); + edgeWeights[edgeI] = 1.0/(Foam::max(w, SMALL)); } tmp<scalarField> tavgFld = avg(s, fld, edgeWeights); @@ -429,7 +429,7 @@ void minSmooth { if (isAffectedPoint.test(pointI)) { - newFld[pointI] = min + newFld[pointI] = Foam::min ( fld[pointI], 0.5*fld[pointI] + 0.5*avgFld[pointI] diff --git a/applications/utilities/surface/surfaceMeshExtract/surfaceMeshExtract.C b/applications/utilities/surface/surfaceMeshExtract/surfaceMeshExtract.C index 6f276914579981810a6e6fe31eb2ca43f0a6725d..fcd551ab61e4f76948f7e3d1e67db543a5932518 100644 --- a/applications/utilities/surface/surfaceMeshExtract/surfaceMeshExtract.C +++ b/applications/utilities/surface/surfaceMeshExtract/surfaceMeshExtract.C @@ -109,7 +109,7 @@ void writeOBJ const auto& constraints = ppp.constraints(); forAll(constraints, i) { - maxConstraint = max(maxConstraint, constraints[i].first()); + maxConstraint = Foam::max(maxConstraint, constraints[i].first()); } reduce(maxConstraint, maxOp<label>()); diff --git a/applications/utilities/thermophysical/adiabaticFlameT/adiabaticFlameT.C b/applications/utilities/thermophysical/adiabaticFlameT/adiabaticFlameT.C index 220a0da6ddbac025d5ab37ec8636299996be7a23..7345394f9c21b45df3d4e90f3abc816d5a72a4b6 100644 --- a/applications/utilities/thermophysical/adiabaticFlameT/adiabaticFlameT.C +++ b/applications/utilities/thermophysical/adiabaticFlameT/adiabaticFlameT.C @@ -180,8 +180,8 @@ int main(int argc, char *argv[]) scalar o2 = (1.0/equiv)*stoicO2; scalar n2 = (0.79/0.21)*o2; - scalar fres = max(1.0 - 1.0/equiv, 0.0); - scalar ores = max(1.0/equiv - 1.0, 0.0); + scalar fres = Foam::max(1.0 - 1.0/equiv, 0.0); + scalar ores = Foam::max(1.0/equiv - 1.0, 0.0); scalar fburnt = 1.0 - fres; thermo reactants diff --git a/applications/utilities/thermophysical/equilibriumFlameT/equilibriumFlameT.C b/applications/utilities/thermophysical/equilibriumFlameT/equilibriumFlameT.C index a6f2e4fb63fb8476784bf4338a36600d5fcfe8fb..89798b215212a27eb493bbd97112e9422a6b86ba 100644 --- a/applications/utilities/thermophysical/equilibriumFlameT/equilibriumFlameT.C +++ b/applications/utilities/thermophysical/equilibriumFlameT/equilibriumFlameT.C @@ -196,12 +196,12 @@ int main(int argc, char *argv[]) // Number of moles of species for one mole of fuel scalar o2 = (1.0/equiv)*stoicO2; scalar n2 = (0.79/0.21)*o2; - scalar fres = max(1.0 - 1.0/equiv, 0.0); + scalar fres = Foam::max(1.0 - 1.0/equiv, 0.0); scalar fburnt = 1.0 - fres; // Initial guess for number of moles of product species // ignoring product dissociation - scalar oresInit = max(1.0/equiv - 1.0, 0.0)*stoicO2; + scalar oresInit = Foam::max(1.0/equiv - 1.0, 0.0)*stoicO2; scalar co2Init = fburnt*stoicCO2; scalar h2oInit = fburnt*stoicH2O; @@ -231,18 +231,18 @@ int main(int argc, char *argv[]) if (j > 0) { co = co2* - min + Foam::min ( CO2BreakUp.Kn(P, equilibriumFlameTemperature, N) - /::sqrt(max(ores, 0.001)), + /::sqrt(Foam::max(ores, 0.001)), 1.0 ); h2 = h2o* - min + Foam::min ( H2OBreakUp.Kn(P, equilibriumFlameTemperature, N) - /::sqrt(max(ores, 0.001)), + /::sqrt(Foam::max(ores, 0.001)), 1.0 ); diff --git a/src/OpenFOAM/containers/Lists/List/UList.H b/src/OpenFOAM/containers/Lists/List/UList.H index ede6083323db801a9b5c054416513c751aa5f688..2af60648ff3ab49591265dfbbde211ecf75bd1fc 100644 --- a/src/OpenFOAM/containers/Lists/List/UList.H +++ b/src/OpenFOAM/containers/Lists/List/UList.H @@ -424,8 +424,14 @@ public: // out-of-range element returns false without ill-effects inline const T& operator[](const label i) const; - //- Allow cast to a const List<T>& - inline operator const Foam::List<T>&() const; + //- Allow cast to a const List<T>&. + // \note Marked as "strictly" deprecated. + // Currently (2025-04) code still depends on this cast. + FOAM_DEPRECATED_STRICTER(2025-04, "dereference as UList, not List") + operator const Foam::List<T>&() const + { + return *reinterpret_cast<const List<T>*>(this); + } //- Assignment of all entries to the given value inline void operator=(const T& val); diff --git a/src/OpenFOAM/containers/Lists/List/UListI.H b/src/OpenFOAM/containers/Lists/List/UListI.H index de385d61161acd02d46797e17cd2da1acf954af4..9e544cbfcf01f871a9b8424dd6b460883b98d5d1 100644 --- a/src/OpenFOAM/containers/Lists/List/UListI.H +++ b/src/OpenFOAM/containers/Lists/List/UListI.H @@ -385,13 +385,6 @@ inline const T& Foam::UList<T>::operator[](const label i) const } -template<class T> -inline Foam::UList<T>::operator const Foam::List<T>&() const -{ - return *reinterpret_cast<const List<T>*>(this); -} - - // * * * * * * * * * * * * * * STL Member Functions * * * * * * * * * * * * // template<class T> diff --git a/src/OpenFOAM/db/IOobjects/IOList/IOList.C b/src/OpenFOAM/db/IOobjects/IOList/IOList.C index a6a0bbb2002c737c004d2409228b76341f67d5ee..1e535c861d4589df51272350b94e024387243ec7 100644 --- a/src/OpenFOAM/db/IOobjects/IOList/IOList.C +++ b/src/OpenFOAM/db/IOobjects/IOList/IOList.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2016-2024 OpenCFD Ltd. + Copyright (C) 2016-2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -118,7 +118,7 @@ template<class T> Foam::IOListRef<T>::IOListRef ( const IOobject& io, - const List<T>& content + const UList<T>& content ) : regIOobject(io), @@ -143,6 +143,23 @@ Foam::List<T> Foam::IOList<T>::readContents(const IOobject& io) } +template<class T> +void Foam::IOList<T>::writeContents +( + const IOobject& io, + const UList<T>& content +) +{ + IOListRef<T> writer + ( + IOobject(io, IOobjectOption::NO_REGISTER), + content + ); + + writer.write(); +} + + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class T> @@ -156,7 +173,7 @@ bool Foam::IOList<T>::writeData(Ostream& os) const template<class T> bool Foam::IOListRef<T>::writeData(Ostream& os) const { - os << contentRef_.cref(); + os << contentRef_; return os.good(); } diff --git a/src/OpenFOAM/db/IOobjects/IOList/IOList.H b/src/OpenFOAM/db/IOobjects/IOList/IOList.H index 636fab73dbbb0baaf4a88cca017e9583e67e1d01..40f62c6d032afba6a5099f5853d7710ba628a388 100644 --- a/src/OpenFOAM/db/IOobjects/IOList/IOList.H +++ b/src/OpenFOAM/db/IOobjects/IOList/IOList.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2018-2024 OpenCFD Ltd. + Copyright (C) 2018-2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -96,6 +96,10 @@ public: //- Read and return contents. The IOobject is never registered static List<T> readContents(const IOobject& io); + //- Write contents. The IOobject is never registered. + // Uses IOListRef internally. + static void writeContents(const IOobject& io, const UList<T>& content); + //- Destructor virtual ~IOList() = default; @@ -121,7 +125,7 @@ public: Class IOListRef Declaration \*---------------------------------------------------------------------------*/ -//- A IOList wrapper for writing external data. +//- A IOList wrapper for writing external List data template<class T> class IOListRef : @@ -130,7 +134,7 @@ class IOListRef // Private Data //- Reference to the external content - refPtr<List<T>> contentRef_; + UList<T> contentRef_; public: @@ -161,7 +165,7 @@ public: // Constructors //- Construct from IOobject and const data reference - IOListRef(const IOobject& io, const List<T>& content); + IOListRef(const IOobject& io, const UList<T>& content); //- Destructor @@ -171,10 +175,9 @@ public: // Member Functions //- Allow cast to const content - // Fatal if content is not set - operator const List<T>&() const + operator const UList<T>&() const { - return contentRef_.cref(); + return contentRef_; } //- The writeData method for regIOobject write operation diff --git a/src/OpenFOAM/fields/FieldFields/FieldField/FieldField.C b/src/OpenFOAM/fields/FieldFields/FieldField/FieldField.C index 17d07fb2f069ccb5bd79f6c2bd16ea2a7277a5cb..1cd6a54c6b2d67c444d87b9b2de88605036f1ff0 100644 --- a/src/OpenFOAM/fields/FieldFields/FieldField/FieldField.C +++ b/src/OpenFOAM/fields/FieldFields/FieldField/FieldField.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. @@ -308,6 +308,36 @@ void FieldField<Field, Type>::clamp_max } +template<template<class> class Field, class Type> +void FieldField<Field, Type>::clamp_min +( + const FieldField<Field, Type>& lower +) +{ + const label loopLen = this->size(); + + for (label i = 0; i < loopLen; ++i) + { + (*this)[i].clamp_min(lower[i]); + } +} + + +template<template<class> class Field, class Type> +void FieldField<Field, Type>::clamp_max +( + const FieldField<Field, Type>& upper +) +{ + const label loopLen = this->size(); + + for (label i = 0; i < loopLen; ++i) + { + (*this)[i].clamp_max(upper[i]); + } +} + + template<template<class> class Field, class Type> void FieldField<Field, Type>::clamp_range ( diff --git a/src/OpenFOAM/fields/FieldFields/FieldField/FieldField.H b/src/OpenFOAM/fields/FieldFields/FieldField/FieldField.H index d8dbbcdf0e04f56a4146034a8e96d8389350455a..f1c9fda937f710a6d9561aed34bd4c97183dfb96 100644 --- a/src/OpenFOAM/fields/FieldFields/FieldField/FieldField.H +++ b/src/OpenFOAM/fields/FieldFields/FieldField/FieldField.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2022-2023 OpenCFD Ltd. + Copyright (C) 2022-2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -152,9 +152,15 @@ public: //- Impose lower (floor) clamp on the field values (in-place) void clamp_min(const Type& lower); + //- Impose lower (floor) clamp on the field values (in-place) + void clamp_min(const FieldField<Field, Type>& lower); + //- Impose upper (ceiling) clamp on the field values (in-place) void clamp_max(const Type& upper); + //- Impose upper (ceiling) clamp on the field values (in-place) + void clamp_max(const FieldField<Field, Type>& upper); + //- Clamp field values (in-place) to the specified range. // Does not check if range is valid or not. void clamp_range(const Type& lower, const Type& upper); diff --git a/src/OpenFOAM/fields/Fields/Field/Field.C b/src/OpenFOAM/fields/Fields/Field/Field.C index 0372523102a2411f043ceaead0e67f6ee004341d..1b500ff6c97cbd1211444a285c10fe27ae88b05b 100644 --- a/src/OpenFOAM/fields/Fields/Field/Field.C +++ b/src/OpenFOAM/fields/Fields/Field/Field.C @@ -669,6 +669,7 @@ void Foam::Field<Type>::clamp_min(const Type& lower) } } + template<class Type> void Foam::Field<Type>::clamp_max(const Type& upper) { @@ -681,6 +682,40 @@ void Foam::Field<Type>::clamp_max(const Type& upper) } +template<class Type> +void Foam::Field<Type>::clamp_min(const UList<Type>& lower) +{ + // Use free function max() [sic] to impose component-wise clamp_min + std::transform + ( + // Can use (std::execution::par_unseq | std::execution::unseq) + this->begin(), + // this->end() but with some extra range safety + this->begin(lower.size()), + lower.begin(), + this->begin(), + maxOp<Type>() + ); +} + + +template<class Type> +void Foam::Field<Type>::clamp_max(const UList<Type>& upper) +{ + // Use free function min() [sic] to impose component-wise clamp_max + std::transform + ( + // Can use (std::execution::par_unseq | std::execution::unseq) + this->begin(), + // this->end() but with some extra range safety + this->begin(upper.size()), + upper.begin(), + this->begin(), + minOp<Type>() + ); +} + + template<class Type> void Foam::Field<Type>::clamp_range(const Type& lower, const Type& upper) { diff --git a/src/OpenFOAM/fields/Fields/Field/Field.H b/src/OpenFOAM/fields/Fields/Field/Field.H index fb7851edc6dfc78953a95c81c413dd79d35b44fa..3441a50e0b5949f53be62a8a2ffbf717804afd3b 100644 --- a/src/OpenFOAM/fields/Fields/Field/Field.H +++ b/src/OpenFOAM/fields/Fields/Field/Field.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2015-2023 OpenCFD Ltd. + Copyright (C) 2015-2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -50,6 +50,7 @@ SourceFiles #include "direction.H" #include "labelList.H" #include "keyType.H" +#include "ops.H" #include "scalarList.H" #include "VectorSpace.H" #include "IOobjectOption.H" @@ -441,9 +442,15 @@ public: //- Impose lower (floor) clamp on the field values (in-place) void clamp_min(const Type& lower); + //- Impose lower (floor) clamp on the field values (in-place) + void clamp_min(const UList<Type>& lower); + //- Impose upper (ceiling) clamp on the field values (in-place) void clamp_max(const Type& upper); + //- Impose upper (ceiling) clamp on the field values (in-place) + void clamp_max(const UList<Type>& upper); + //- Clamp field values (in-place) to the specified range. // Does not check if range is valid or not. void clamp_range(const Type& lower, const Type& upper); diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C index 2ef9c028adee99b0137cb4e6692c72f0cee0ba30..7667b784355bb41f04d586792849a6810d9ac5cf 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C @@ -1276,6 +1276,38 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::clamp_max } +template<class Type, template<class> class PatchField, class GeoMesh> +void Foam::GeometricField<Type, PatchField, GeoMesh>::clamp_min +( + const GeometricField<Type, PatchField, GeoMesh>& lower +) +{ + primitiveFieldRef().clamp_min(lower.primitiveField()); + boundaryFieldRef().clamp_min(lower.boundaryField()); + correctLocalBoundaryConditions(); + if (GeometricBoundaryField<Type, PatchField, GeoMesh>::debug) + { + boundaryField().check(); + } +} + + +template<class Type, template<class> class PatchField, class GeoMesh> +void Foam::GeometricField<Type, PatchField, GeoMesh>::clamp_max +( + const GeometricField<Type, PatchField, GeoMesh>& upper +) +{ + primitiveFieldRef().clamp_max(upper.primitiveField()); + boundaryFieldRef().clamp_max(upper.boundaryField()); + correctLocalBoundaryConditions(); + if (GeometricBoundaryField<Type, PatchField, GeoMesh>::debug) + { + boundaryField().check(); + } +} + + template<class Type, template<class> class PatchField, class GeoMesh> void Foam::GeometricField<Type, PatchField, GeoMesh>::clamp_range ( diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H index 5ff69df5cab49a8c63d6823a0d030bf04ecf81a2..2345159762d3334e190c7cb087fd6d824df6adae 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H @@ -936,17 +936,25 @@ public: //- Impose lower (floor) clamp on the field values (in-place) void clamp_min(const Type& lower); - //- Impose upper (ceiling) clamp on the field values (in-place) - void clamp_max(const Type& upper); - //- Impose lower (floor) clamp on the field values (in-place) // No dimension checking void clamp_min(const dimensioned<Type>& lower); + //- Impose lower (floor) clamp on the field values (in-place) + // No dimension checking + void clamp_min(const GeometricField<Type, PatchField, GeoMesh>& lower); + + //- Impose upper (ceiling) clamp on the field values (in-place) + void clamp_max(const Type& upper); + //- Impose upper (ceiling) clamp on the field values (in-place) // No dimension checking void clamp_max(const dimensioned<Type>& upper); + //- Impose upper (ceiling) clamp on the field values (in-place) + // No dimension checking + void clamp_max(const GeometricField<Type, PatchField, GeoMesh>& upper); + //- Clamp field values (in-place) to the specified range. // Does not check if range is valid or not. No dimension checking. void clamp_range(const dimensioned<MinMax<Type>>& range); @@ -1055,11 +1063,13 @@ public: //- Use minimum of the field and specified value. ie, clamp_max(). // This sets the \em ceiling on the field values // \deprecated(2023-01) prefer clamp_max() + FOAM_DEPRECATED_STRICT(2023-01, "clamp_max() method") void min(const dimensioned<Type>& upper) { this->clamp_max(upper); } //- Use maximum of the field and specified value. ie, clamp_min(). // This sets the \em floor on the field values // \deprecated(2023-01) prefer clamp_min() + FOAM_DEPRECATED_STRICT(2023-01, "clamp_min() method") void max(const dimensioned<Type>& lower) { this->clamp_min(lower); } //- Deprecated(2019-01) identical to clamp_range() diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduAddressing.C b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduAddressing.C index 81b80f0efb522c831d7070b416b1e094fee38a01..d90d1b982139143634487873267d83d60f798080 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduAddressing.C +++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduAddressing.C @@ -80,7 +80,7 @@ void Foam::lduAddressing::calcLosort() const forAll(cellNbrFaces, celli) { - const labelList& curNbr = cellNbrFaces[celli]; + const labelUList& curNbr = cellNbrFaces[celli]; forAll(curNbr, curNbrI) { @@ -100,7 +100,7 @@ void Foam::lduAddressing::calcOwnerStart() const << abort(FatalError); } - const labelList& own = lowerAddr(); + const labelUList& own = lowerAddr(); ownerStartPtr_ = std::make_unique<labelList>(size() + 1, own.size()); auto& ownStart = *ownerStartPtr_; @@ -139,9 +139,9 @@ void Foam::lduAddressing::calcLosortStart() const losortStartPtr_ = std::make_unique<labelList>(size() + 1, Foam::zero{}); auto& lsrtStart = *losortStartPtr_; - const labelList& nbr = upperAddr(); + const labelUList& nbr = upperAddr(); - const labelList& lsrt = losortAddr(); + const labelUList& lsrt = losortAddr(); // Set up first lookup by hand lsrtStart[0] = 0; diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/lduCalculatedProcessorField/lduCalculatedProcessorField.C b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/lduCalculatedProcessorField/lduCalculatedProcessorField.C index 075a79f4460d3cdd7d8761792a4821de4f9e4948..2eba61fb8f8cb9fc5471215977fbac0b8af6e723 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/lduCalculatedProcessorField/lduCalculatedProcessorField.C +++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/lduCalculatedProcessorField/lduCalculatedProcessorField.C @@ -99,7 +99,7 @@ void Foam::lduCalculatedProcessorField<Type>::initInterfaceMatrixUpdate } // Bypass patchInternalField since uses fvPatch addressing - const labelList& fc = lduAddr.patchAddr(patchId); + const labelUList& fc = lduAddr.patchAddr(patchId); scalarSendBuf_.resize_nocopy(fc.size()); forAll(fc, i) diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/cyclicGAMGInterfaceField/cyclicGAMGInterfaceField.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/cyclicGAMGInterfaceField/cyclicGAMGInterfaceField.C index 439a3f936f8c11dd38983e878344850aa32b5147..a6c358984caec3a7e22a12edb805df838e931137 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/cyclicGAMGInterfaceField/cyclicGAMGInterfaceField.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/cyclicGAMGInterfaceField/cyclicGAMGInterfaceField.C @@ -162,7 +162,7 @@ void Foam::cyclicGAMGInterfaceField::updateInterfaceMatrix { // Get neighbouring field - const labelList& nbrFaceCells = + const auto& nbrFaceCells = lduAddr.patchAddr ( cyclicInterface_.neighbPatchID() @@ -172,7 +172,7 @@ void Foam::cyclicGAMGInterfaceField::updateInterfaceMatrix transformCoupleField(pnf, cmpt); - const labelList& faceCells = lduAddr.patchAddr(patchId); + const auto& faceCells = lduAddr.patchAddr(patchId); this->addToInternalField(result, !add, faceCells, coeffs, pnf); } diff --git a/src/OpenFOAM/meshes/lduMesh/lduMesh.C b/src/OpenFOAM/meshes/lduMesh/lduMesh.C index a6c62c3811b41625335965823dd7560e32dcafde..e7dbad5f2a53b48e84161f47c27ac385e5eacf75 100644 --- a/src/OpenFOAM/meshes/lduMesh/lduMesh.C +++ b/src/OpenFOAM/meshes/lduMesh/lduMesh.C @@ -105,8 +105,8 @@ Foam::Ostream& Foam::operator<< // Print actual contents if (lduMesh::debug) { - const labelList& l = addr.lowerAddr(); - const labelList& u = addr.upperAddr(); + const labelUList& l = addr.lowerAddr(); + const labelUList& u = addr.upperAddr(); forAll(l, facei) { os << " face:" << facei << " l:" << l[facei] diff --git a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/IOmapDistributePolyMesh.C b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/IOmapDistributePolyMesh.C index 8f35bbedaa269eabeecda102e895ea3311108a03..0557a63f547512dddb8b050adfa315024eacb27b 100644 --- a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/IOmapDistributePolyMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/IOmapDistributePolyMesh.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2015 OpenFOAM Foundation - Copyright (C) 2022-2024 OpenCFD Ltd. + Copyright (C) 2022-2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -124,6 +124,23 @@ Foam::IOmapDistributePolyMeshRef::IOmapDistributePolyMeshRef /// contentRef_.ref(map); // writable reference /// } +// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // + +void Foam::IOmapDistributePolyMesh::writeContents +( + const IOobject& io, + const mapDistributePolyMesh& map +) +{ + IOmapDistributePolyMeshRef writer + ( + IOobject(io, IOobjectOption::NO_REGISTER), + map + ); + + writer.write(); +} + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/IOmapDistributePolyMesh.H b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/IOmapDistributePolyMesh.H index b0d85a2afd79d8ee9aa947958ac3905eb8c6d908..92fb1390c62060301a5b6e3631f1f1229cca230d 100644 --- a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/IOmapDistributePolyMesh.H +++ b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/IOmapDistributePolyMesh.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2015 OpenFOAM Foundation - Copyright (C) 2022-2024 OpenCFD Ltd. + Copyright (C) 2022-2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -88,6 +88,17 @@ public: ); + // Factory Methods + + //- Write contents. The IOobject is never registered. + // Uses IOmapDistributePolyMeshRef internally. + static void writeContents + ( + const IOobject& io, + const mapDistributePolyMesh& map + ); + + //- Destructor virtual ~IOmapDistributePolyMesh() = default; diff --git a/src/OpenFOAM/parallel/commSchedule/commSchedule.C b/src/OpenFOAM/parallel/commSchedule/commSchedule.C index ae5817627cd0cfd2cf70bb76e7be32bb3be5e0d7..5386ea857eb7f7dd31a2ba48bb1a9affa2fcee2f 100644 --- a/src/OpenFOAM/parallel/commSchedule/commSchedule.C +++ b/src/OpenFOAM/parallel/commSchedule/commSchedule.C @@ -49,7 +49,7 @@ namespace Foam static label outstandingComms ( const labelUList& commToSchedule, - const DynamicList<label>& procComms + const labelUList& procComms ) { label nOutstanding = 0; diff --git a/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmNutWallFunction/atmNutWallFunctionFvPatchScalarField.C b/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmNutWallFunction/atmNutWallFunctionFvPatchScalarField.C index da1a3fd09a57807e7358b5d07ac85af3e3ce4f47..c6a727b0f3cc3a44fa35c95103f7ea991821106a 100644 --- a/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmNutWallFunction/atmNutWallFunctionFvPatchScalarField.C +++ b/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmNutWallFunction/atmNutWallFunctionFvPatchScalarField.C @@ -86,7 +86,7 @@ tmp<scalarField> atmNutWallFunctionFvPatchScalarField::calcNut() const } #endif - const labelList& faceCells = patch().faceCells(); + const labelUList& faceCells = patch().faceCells(); forAll(nutw, facei) { diff --git a/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmNutkWallFunction/atmNutkWallFunctionFvPatchScalarField.C b/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmNutkWallFunction/atmNutkWallFunctionFvPatchScalarField.C index deaae7c9dc7c882bbcd1e26ccf692a8e669e7a9a..a1f0b7ec39e12de3fd365f4b1f34f1cab8b880ce 100644 --- a/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmNutkWallFunction/atmNutkWallFunctionFvPatchScalarField.C +++ b/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmNutkWallFunction/atmNutkWallFunctionFvPatchScalarField.C @@ -84,7 +84,7 @@ tmp<scalarField> atmNutkWallFunctionFvPatchScalarField::calcNut() const } #endif - const labelList& faceCells = patch().faceCells(); + const labelUList& faceCells = patch().faceCells(); // (HW:Eq. 5) forAll(nutw, facei) diff --git a/src/combustionModels/EDC/EDC.C b/src/combustionModels/EDC/EDC.C index 90fc7e26051fc64a8209265518218a6f6471ecc5..977270aa9d1a51d7b4734b48b432ed9aa23d5c30 100644 --- a/src/combustionModels/EDC/EDC.C +++ b/src/combustionModels/EDC/EDC.C @@ -180,8 +180,9 @@ void Foam::combustionModels::EDC<ReactionThermo>::correct() kappa_.correctBoundaryConditions(); } - Info<< "Chemistry time solved max/min : " - << gMax(tauStar) << " / " << gMin(tauStar) << endl; + auto limits = gMinMax(tauStar); + Info<< "Chemistry time solved min/max : " + << limits.min() << ", " << limits.max() << endl; this->chemistryPtr_->solve(tauStar); } diff --git a/src/conversion/ccm/reader/ccmReader.H b/src/conversion/ccm/reader/ccmReader.H index 147c320a4d8aeeeef80ebddc0d7085be7afd14ca..ab05dc2c0eec9617f69e37be807c52839cb62a95 100644 --- a/src/conversion/ccm/reader/ccmReader.H +++ b/src/conversion/ccm/reader/ccmReader.H @@ -393,7 +393,7 @@ private: ( const objectRegistry& registry, const word& propertyName, - const labelList& list, + const labelUList& list, IOstreamOption streamOpt ) const; diff --git a/src/conversion/ccm/reader/ccmReaderAux.C b/src/conversion/ccm/reader/ccmReaderAux.C index 3e119be25c0e9c99b13a2444fb7c605a743fec25..eb5167095ab94da4873f7c912cefd6d6d97782c3 100644 --- a/src/conversion/ccm/reader/ccmReaderAux.C +++ b/src/conversion/ccm/reader/ccmReaderAux.C @@ -145,7 +145,7 @@ void Foam::ccm::reader::writeMeshLabelList ( const objectRegistry& registry, const word& propertyName, - const labelList& list, + const labelUList& list, IOstreamOption streamOpt ) const { diff --git a/src/conversion/common/reader/meshReader.H b/src/conversion/common/reader/meshReader.H index 68baf6a775047e7a011b75fa7c968d1b402b7c1d..3bd02e90bc16326021ef6520edf856e6c60dcb48 100644 --- a/src/conversion/common/reader/meshReader.H +++ b/src/conversion/common/reader/meshReader.H @@ -192,7 +192,7 @@ private: ( const objectRegistry& registry, const word& propertyName, - const labelList& list, + const labelUList& list, IOstreamOption streamOpt ) const; diff --git a/src/conversion/common/reader/meshReaderAux.C b/src/conversion/common/reader/meshReaderAux.C index d4b4d5f426e4d28e61c7de3e8eda81beeef08eff..bdf234e94941b9f1d52a0f2fc2dbf57830eae040 100644 --- a/src/conversion/common/reader/meshReaderAux.C +++ b/src/conversion/common/reader/meshReaderAux.C @@ -108,7 +108,7 @@ void Foam::meshReader::writeMeshLabelList ( const objectRegistry& registry, const word& propertyName, - const labelList& list, + const labelUList& list, IOstreamOption streamOpt ) const { diff --git a/src/dynamicFaMesh/interfaceTrackingFvMesh/freeSurfacePointDisplacement.C b/src/dynamicFaMesh/interfaceTrackingFvMesh/freeSurfacePointDisplacement.C index 8661837cf23f48ec1ad612e2f88a305a23fd9edb..6382d9a5f0ed88c401db645e5d46fc090fefceda 100644 --- a/src/dynamicFaMesh/interfaceTrackingFvMesh/freeSurfacePointDisplacement.C +++ b/src/dynamicFaMesh/interfaceTrackingFvMesh/freeSurfacePointDisplacement.C @@ -113,7 +113,7 @@ Foam::interfaceTrackingFvMesh::pointDisplacement() aMesh().boundary()[patchI].ngbPolyPatchFaceNormals() ); - const labelList& eFaces = + const labelUList& eFaces = aMesh().boundary()[patchI].edgeFaces(); // Correct N according to specified contact angle diff --git a/src/dynamicFaMesh/interfaceTrackingFvMesh/interfaceTrackingFvMesh.C b/src/dynamicFaMesh/interfaceTrackingFvMesh/interfaceTrackingFvMesh.C index aa5bf5a4fd5d8aad855f34551d9690dcf1534ca9..e0644c2f243dc1dbfbc671b1dab76993fa597a50 100644 --- a/src/dynamicFaMesh/interfaceTrackingFvMesh/interfaceTrackingFvMesh.C +++ b/src/dynamicFaMesh/interfaceTrackingFvMesh/interfaceTrackingFvMesh.C @@ -733,12 +733,13 @@ void Foam::interfaceTrackingFvMesh::initializeControlPointsPosition() << abort(FatalError); } - const labelList& eFaces = - aMesh().boundary()[fixedPatchID].edgeFaces(); - - forAll(eFaces, edgeI) + for + ( + const label facei + : aMesh().boundary()[fixedPatchID].edgeFaces() + ) { - deltaH[eFaces[edgeI]] *= 2.0; + deltaH[facei] *= 2.0; } } @@ -789,12 +790,13 @@ void Foam::interfaceTrackingFvMesh::smoothFreeSurfaceMesh() << abort(FatalError); } - const labelList& eFaces = - aMesh().boundary()[fixedPatchID].edgeFaces(); - - forAll(eFaces, edgeI) + for + ( + const label facei + : aMesh().boundary()[fixedPatchID].edgeFaces() + ) { - deltaHf[eFaces[edgeI]] *= 2.0; + deltaHf[facei] *= 2.0; } } @@ -1060,7 +1062,7 @@ void Foam::interfaceTrackingFvMesh::correctPointDisplacement const labelList& pLabels = aMesh().boundary()[fixedPatchID].pointLabels(); - const labelList& eFaces = + const labelUList& eFaces = aMesh().boundary()[fixedPatchID].edgeFaces(); labelHashSet pointSet; @@ -1147,7 +1149,7 @@ void Foam::interfaceTrackingFvMesh::correctPointDisplacement const labelList& pLabels = aMesh().boundary()[nonReflectingPatchID].pointLabels(); - const labelList& eFaces = + const labelUList& eFaces = aMesh().boundary()[nonReflectingPatchID].edgeFaces(); labelList corrPoints = pLabels; @@ -2022,8 +2024,11 @@ bool Foam::interfaceTrackingFvMesh::update() const scalarField& K = aMesh().faceCurvatures().internalField(); - Info<< "Free surface curvature: min = " << gMin(K) - << ", max = " << gMax(K) << ", average = " << gAverage(K) << nl; + auto limits = gMinMax(K); + + Info<< "Free surface curvature: min = " << limits.min() + << ", max = " << limits.max() + << ", average = " << gAverage(K) << nl; timeIndex_ = mesh().time().timeIndex(); } @@ -2120,12 +2125,13 @@ bool Foam::interfaceTrackingFvMesh::update() << abort(FatalError); } - const labelList& eFaces = - aMesh().boundary()[fixedPatchID].edgeFaces(); - - forAll(eFaces, edgeI) + for + ( + const label facei + : aMesh().boundary()[fixedPatchID].edgeFaces() + ) { - deltaHf[eFaces[edgeI]] *= 2.0; + deltaHf[facei] *= 2.0; } } diff --git a/src/dynamicMesh/attachDetach/attachInterface.C b/src/dynamicMesh/attachDetach/attachInterface.C index 70e996d297e1f9ff4e7aa0a6959b5efc8a230381..4a420a21d8a9059df3f2480af579ed26ec467d70 100644 --- a/src/dynamicMesh/attachDetach/attachInterface.C +++ b/src/dynamicMesh/attachDetach/attachInterface.C @@ -110,8 +110,8 @@ void Foam::attachDetach::attachInterface } // Modify the faces from the master patch - const labelList& masterFaceCells = masterPatch.faceCells(); - const labelList& slaveFaceCells = slavePatch.faceCells(); + const labelUList& masterFaceCells = masterPatch.faceCells(); + const labelUList& slaveFaceCells = slavePatch.faceCells(); const boolList& mfFlip = mesh.faceZones()[faceZoneID_.index()].flipMap(); diff --git a/src/dynamicMesh/motionSmoother/motionSmootherAlgo.C b/src/dynamicMesh/motionSmoother/motionSmootherAlgo.C index 93d9c97a8a217b82a17f3e84553dc66ed7465dd5..7f209b9ef60c09fc6cb4f9aaed9bf11b4a0c7036 100644 --- a/src/dynamicMesh/motionSmoother/motionSmootherAlgo.C +++ b/src/dynamicMesh/motionSmoother/motionSmootherAlgo.C @@ -879,10 +879,13 @@ bool Foam::motionSmootherAlgo::scaleMesh vector::zero // null value ); - Info<< "Moving mesh using displacement scaling :" - << " min:" << gMin(scale_.primitiveField()) - << " max:" << gMax(scale_.primitiveField()) - << endl; + { + auto limits = gMinMax(scale_.primitiveField()); + Info<< "Moving mesh using displacement scaling :" + << " min:" << limits.min() + << " max:" << limits.max() + << endl; + } // Get points using current displacement and scale. Optionally 2D corrected. pointField newPoints(curPoints()); @@ -1018,9 +1021,11 @@ bool Foam::motionSmootherAlgo::scaleMesh if (debug) { + auto limits = gMinMax(scale_); + Pout<< "scale_ after smoothing :" - << " min:" << Foam::gMin(scale_) - << " max:" << Foam::gMax(scale_) + << " min:" << limits.min() + << " max:" << limits.max() << endl; } diff --git a/src/dynamicMesh/motionSolvers/componentDisplacement/componentDisplacementMotionSolver.C b/src/dynamicMesh/motionSolvers/componentDisplacement/componentDisplacementMotionSolver.C index b0a98da1995d533a4d70119c5f3e2b00cffc2c59..01b0642f873ddc04eb40eb4be80bc1b49b95d33a 100644 --- a/src/dynamicMesh/motionSolvers/componentDisplacement/componentDisplacementMotionSolver.C +++ b/src/dynamicMesh/motionSolvers/componentDisplacement/componentDisplacementMotionSolver.C @@ -166,9 +166,7 @@ void Foam::componentDisplacementMotionSolver::updateMesh(const mapPolyMesh& mpm) ); // Get extents of points0 and points and determine scale - const scalar scale = - (gMax(points0_)-gMin(points0_)) - /(gMax(points)-gMin(points)); + const scalar scale = gMinMax(points0_).span() / gMinMax(points).span(); scalarField newPoints0(mpm.pointMap().size()); diff --git a/src/dynamicMesh/motionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.C b/src/dynamicMesh/motionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.C index 2026e4e09e424b11f20057ed50ce9e8ef0b25546..24b07f17181d3dd6332c55bc31c8eef0e977d174 100644 --- a/src/dynamicMesh/motionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.C +++ b/src/dynamicMesh/motionSolvers/displacement/interpolation/displacementInterpolationMotionSolver.C @@ -138,16 +138,18 @@ void Foam::displacementInterpolationMotionSolver::calcInterpolation() scalar minCoord = VGREAT; scalar maxCoord = -VGREAT; - forAll(fz().meshPoints(), localI) + scalarMinMax limits; + + for (const label pointi : fz().meshPoints()) { - label pointi = fz().meshPoints()[localI]; const scalar coord = points0()[pointi][dir]; - minCoord = min(minCoord, coord); - maxCoord = max(maxCoord, coord); + limits.add(coord); } - zoneCoordinates[2*i] = returnReduce(minCoord, minOp<scalar>()); - zoneCoordinates[2*i+1] = returnReduce(maxCoord, maxOp<scalar>()); + reduce(limits, sumOp<scalarMinMax>()); + + zoneCoordinates[2*i] = limits.min(); + zoneCoordinates[2*i+1] = limits.max(); if (debug) { @@ -167,8 +169,13 @@ void Foam::displacementInterpolationMotionSolver::calcInterpolation() // Check if we have static min and max mesh bounds const scalarField meshCoords(points0().component(dir)); - scalar minCoord = gMin(meshCoords); - scalar maxCoord = gMax(meshCoords); + scalar minCoord, maxCoord; + { + auto limits = gMinMax(meshCoords); + + minCoord = limits.min(); + maxCoord = limits.max(); + } if (debug) { diff --git a/src/dynamicMesh/motionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.C b/src/dynamicMesh/motionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.C index 645be3cea28295c511a2db6c1b1b2838e8d62ce0..14b8ed41c7c8afed50b9e8e470734c9ab5939d37 100644 --- a/src/dynamicMesh/motionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.C +++ b/src/dynamicMesh/motionSolvers/displacement/layeredSolver/displacementLayeredMotionMotionSolver.C @@ -386,15 +386,21 @@ void Foam::displacementLayeredMotionMotionSolver::cellZoneSolve patchi ); - DebugInfo - << "For cellZone:" << cellZoneI - << " for faceZone:" << fz.name() - << " nPoints:" << tseed().size() - << " have patchField:" - << " max:" << gMax(tseed()) - << " min:" << gMin(tseed()) - << " avg:" << gAverage(tseed()) - << endl; + if (debug) + { + auto limits = gMinMax(tseed()); + auto avg = gAverage(tseed()); + + Info + << "For cellZone:" << cellZoneI + << " for faceZone:" << fz.name() + << " nPoints:" << tseed().size() + << " have patchField:" + << " min:" << limits.min() + << " max:" << limits.max() + << " avg:" << avg + << endl; + } // Set distance and transported value diff --git a/src/dynamicMesh/polyMeshAdder/polyMeshAdder.C b/src/dynamicMesh/polyMeshAdder/polyMeshAdder.C index a2ff83268129796bea99d66eb587afd33441ae26..8d586f8bdb52d93b0bd58b5bd9e4f6b8b71c29a7 100644 --- a/src/dynamicMesh/polyMeshAdder/polyMeshAdder.C +++ b/src/dynamicMesh/polyMeshAdder/polyMeshAdder.C @@ -1339,14 +1339,14 @@ void Foam::polyMeshAdder::mergeZones void Foam::polyMeshAdder::addZones ( - const DynamicList<word>& pointZoneNames, + const UList<word>& pointZoneNames, const List<DynamicList<label>>& pzPoints, - const DynamicList<word>& faceZoneNames, + const UList<word>& faceZoneNames, const List<DynamicList<label>>& fzFaces, const List<DynamicList<bool>>& fzFlips, - const DynamicList<word>& cellZoneNames, + const UList<word>& cellZoneNames, const List<DynamicList<label>>& czCells, polyMesh& mesh @@ -2423,9 +2423,9 @@ void Foam::polyMeshAdder::patchFacePairs { const auto& mesh = meshes[meshi]; const polyBoundaryMesh& pbm = mesh.boundaryMesh(); - const DynamicList<label>& procPatches = localPatch[meshi]; - const DynamicList<label>& procNbrs = remoteMesh[meshi]; - const DynamicList<label>& procNbrPatches = remotePatch[meshi]; + const labelUList& procPatches = localPatch[meshi]; + const labelUList& procNbrs = remoteMesh[meshi]; + const labelUList& procNbrPatches = remotePatch[meshi]; // Count number of processor faces diff --git a/src/dynamicMesh/polyMeshAdder/polyMeshAdder.H b/src/dynamicMesh/polyMeshAdder/polyMeshAdder.H index cad076ca049e9fd37f3fb3234a5e8a17a2950b04..6af9c4e1cd8412366ad49894f6b83f7715511c80 100644 --- a/src/dynamicMesh/polyMeshAdder/polyMeshAdder.H +++ b/src/dynamicMesh/polyMeshAdder/polyMeshAdder.H @@ -226,14 +226,14 @@ class polyMeshAdder //- Create new zones and add to new mesh. static void addZones ( - const DynamicList<word>& pointZoneNames, + const UList<word>& pointZoneNames, const List<DynamicList<label>>& pzPoints, - const DynamicList<word>& faceZoneNames, + const UList<word>& faceZoneNames, const List<DynamicList<label>>& fzFaces, const List<DynamicList<bool>>& fzFlips, - const DynamicList<word>& cellZoneNames, + const UList<word>& cellZoneNames, const List<DynamicList<label>>& czCells, polyMesh& mesh diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8Data.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8Data.C index 78bb1bfe48dbaf58ff00db1c0e8d1e27a2bc9c77..e3f66c35037c801983b3724166d8771fd6697087 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8Data.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8Data.C @@ -101,8 +101,8 @@ Foam::hexRef8Data::hexRef8Data ( const IOobject& io, const hexRef8Data& data, - const labelList& cellMap, - const labelList& pointMap + const labelUList& cellMap, + const labelUList& pointMap ) { if (data.cellLevelPtr_) diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8Data.H b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8Data.H index 8363c3839a80b9246563055ee3b7872664405bc2..9e5b4706f6e131b72676f2ad0bffe9d9cec470c4 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8Data.H +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8Data.H @@ -93,8 +93,8 @@ public: ( const IOobject& io, const hexRef8Data&, - const labelList& cellMap, - const labelList& pointMap + const labelUList& cellMap, + const labelUList& pointMap ); //- Construct from multiple hexRef8Data diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/refinementHistory.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/refinementHistory.C index c842c2a696000b406207d8338b1a101d149c9d2e..6f2ee3caf319fcd2c9f81f3adcd87e6185231ba7 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/refinementHistory.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/refinementHistory.C @@ -983,7 +983,7 @@ Foam::autoPtr<Foam::refinementHistory> Foam::refinementHistory::clone Foam::autoPtr<Foam::refinementHistory> Foam::refinementHistory::clone ( const IOobject& io, - const labelList& cellMap + const labelUList& cellMap ) const { if (active_) diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/refinementHistory.H b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/refinementHistory.H index 6f40cf11dd6d6b560c7fc5aa136bc41759a07519..9f50fb348c1c5e6db528a0f82786e88c1613e2c9 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/refinementHistory.H +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/refinementHistory.H @@ -341,7 +341,7 @@ public: autoPtr<refinementHistory> clone ( const IOobject& io, - const labelList& cellMap + const labelUList& cellMap ) const; //- Update numbering for mesh changes diff --git a/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatch.H b/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatch.H index 2689d449f830e7a5067aa2bc18a409ad9cc52732..9dd3f61569534a406282238be752ed7dc70db046 100644 --- a/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatch.H +++ b/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatch.H @@ -86,13 +86,13 @@ class enrichedPatch mutable Map<label> pointMergeMap_; //- Slave point point hits - const labelList& slavePointPointHits_; + const labelUList& slavePointPointHits_; //- Slave point edge hits - const labelList& slavePointEdgeHits_; + const labelUList& slavePointEdgeHits_; //- Slave point face hits - const List<objectHit>& slavePointFaceHits_; + const UList<objectHit>& slavePointFaceHits_; // Demand-driven private data diff --git a/src/finiteArea/faMatrices/faScalarMatrix/faScalarMatrix.C b/src/finiteArea/faMatrices/faScalarMatrix/faScalarMatrix.C index f9d39a7d00d1f713efa73ffb39d7fd75c0db3cbe..d944b639285ff1a39a3379e559d293d56bcc5036 100644 --- a/src/finiteArea/faMatrices/faScalarMatrix/faScalarMatrix.C +++ b/src/finiteArea/faMatrices/faScalarMatrix/faScalarMatrix.C @@ -85,7 +85,7 @@ Foam::solverPerformance Foam::faMatrix<Foam::scalar>::solve internalCoeffs_, psi_.boundaryField().scalarInterfaces(), solverControls - )->solve(psi.ref(), totalSource); + )->solve(psi.primitiveFieldRef(), totalSource); if (logLevel) { @@ -146,7 +146,7 @@ Foam::tmp<Foam::areaScalarField> Foam::faMatrix<Foam::scalar>::H() const Hphi.primitiveFieldRef() = (lduMatrix::H(psi_.primitiveField()) + source_); addBoundarySource(Hphi.primitiveFieldRef()); - Hphi.ref() /= psi_.mesh().S(); + Hphi.primitiveFieldRef() /= psi_.mesh().S(); Hphi.correctBoundaryConditions(); return tHphi; diff --git a/src/finiteArea/faMesh/faMeshMapper/faPatchMapper.C b/src/finiteArea/faMesh/faMeshMapper/faPatchMapper.C index 88f8393b54abff92a0884e4b1986a925b1d9b389..42a2227f99fb3aee9fd67a76a050ed4a0da2b6bf 100644 --- a/src/finiteArea/faMesh/faMeshMapper/faPatchMapper.C +++ b/src/finiteArea/faMesh/faMeshMapper/faPatchMapper.C @@ -63,7 +63,7 @@ void Foam::faPatchMapper::calcAddressing() const } // Go through new edgeFaces and for each edge try to locate old index - const labelList& ef = patch_.edgeFaces(); + const labelUList& ef = patch_.edgeFaces(); forAll(ef, efI) { diff --git a/src/finiteArea/faMesh/faPatches/basic/coupled/coupledFaPatch.H b/src/finiteArea/faMesh/faPatches/basic/coupled/coupledFaPatch.H index d7e0dc74ceb8d52673f3a55f8106a7eb175181b0..504355122dd7d45aa53c1c2b1cc687d322bcdecd 100644 --- a/src/finiteArea/faMesh/faPatches/basic/coupled/coupledFaPatch.H +++ b/src/finiteArea/faMesh/faPatches/basic/coupled/coupledFaPatch.H @@ -119,7 +119,7 @@ public: coupledFaPatch ( const word& name, - const labelList& edgeLabels, + const labelUList& edgeLabels, const label index, const faBoundaryMesh& bm, const label nbrPolyPatchIndex, diff --git a/src/finiteArea/finiteArea/gradSchemes/limitedGradSchemes/edgeLimitedFaGrad/edgeLimitedFaGrads.C b/src/finiteArea/finiteArea/gradSchemes/limitedGradSchemes/edgeLimitedFaGrad/edgeLimitedFaGrads.C index a68d4f63ec717ad2578af29e386c879b88dc9d5c..2e11e21291a8b9d025b59076a297dbb3bf2407fc 100644 --- a/src/finiteArea/finiteArea/gradSchemes/limitedGradSchemes/edgeLimitedFaGrad/edgeLimitedFaGrads.C +++ b/src/finiteArea/finiteArea/gradSchemes/limitedGradSchemes/edgeLimitedFaGrad/edgeLimitedFaGrads.C @@ -175,10 +175,13 @@ tmp<areaVectorField> edgeLimitedGrad<scalar>::calcGrad if (fa::debug) { + auto limits = gMinMax(limiter); + auto avg = gAverage(limiter); + Info<< "gradient limiter for: " << vsf.name() - << " max = " << gMax(limiter) - << " min = " << gMin(limiter) - << " average: " << gAverage(limiter) << endl; + << " min = " << limits.min() + << " max = " << limits.max() + << " average: " << avg << endl; } g.primitiveFieldRef() *= limiter; @@ -312,10 +315,13 @@ tmp<areaTensorField> edgeLimitedGrad<vector>::calcGrad if (fa::debug) { + auto limits = gMinMax(limiter); + auto avg = gAverage(limiter); + Info<< "gradient limiter for: " << vvf.name() - << " max = " << gMax(limiter) - << " min = " << gMin(limiter) - << " average: " << gAverage(limiter) << endl; + << " min = " << limits.min() + << " max = " << limits.max() + << " average: " << avg << endl; } g.primitiveFieldRef() *= limiter; diff --git a/src/finiteArea/finiteArea/gradSchemes/limitedGradSchemes/faceLimitedFaGrad/faceLimitedFaGrads.C b/src/finiteArea/finiteArea/gradSchemes/limitedGradSchemes/faceLimitedFaGrad/faceLimitedFaGrads.C index eb0cc9bcbd05eaf9f37004519f3e0f0d54db7ef6..80a2a60a6a1779469478b4a66cc47ac321c14135 100644 --- a/src/finiteArea/finiteArea/gradSchemes/limitedGradSchemes/faceLimitedFaGrad/faceLimitedFaGrads.C +++ b/src/finiteArea/finiteArea/gradSchemes/limitedGradSchemes/faceLimitedFaGrad/faceLimitedFaGrads.C @@ -221,10 +221,13 @@ tmp<areaVectorField> faceLimitedGrad<scalar>::calcGrad if (fa::debug) { + auto limits = gMinMax(limiter); + auto avg = gAverage(limiter); + Info<< "gradient limiter for: " << vsf.name() - << " max = " << gMax(limiter) - << " min = " << gMin(limiter) - << " average: " << gAverage(limiter) << endl; + << " min = " << limits.min() + << " max = " << limits.max() + << " average: " << avg << endl; } g.primitiveFieldRef() *= limiter; @@ -370,10 +373,13 @@ tmp<areaTensorField> faceLimitedGrad<vector>::calcGrad if (fa::debug) { + auto limits = gMinMax(limiter); + auto avg = gAverage(limiter); + Info<< "gradient limiter for: " << vsf.name() - << " max = " << gMax(limiter) - << " min = " << gMin(limiter) - << " average: " << gAverage(limiter) << endl; + << " min = " << limits.min() + << " max = " << limits.max() + << " average: " << avg << endl; } tensorField& gIf = g.primitiveFieldRef(); diff --git a/src/finiteVolume/cfdTools/general/include/setDeltaT.H b/src/finiteVolume/cfdTools/general/include/setDeltaT.H index 25ee3713ddf908198cfa32cefd29d7a972d8b33b..aa8089320344e9565d4f21400ffa3b9dc0bbe5d8 100644 --- a/src/finiteVolume/cfdTools/general/include/setDeltaT.H +++ b/src/finiteVolume/cfdTools/general/include/setDeltaT.H @@ -36,11 +36,13 @@ Description if (adjustTimeStep) { scalar maxDeltaTFact = maxCo/(CoNum + SMALL); - scalar deltaTFact = min(min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2); + + const scalar deltaTFact = + Foam::min(Foam::min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2); runTime.setDeltaT ( - min + Foam::min ( deltaTFact*runTime.deltaTValue(), maxDeltaT diff --git a/src/finiteVolume/cfdTools/general/include/setInitialDeltaT.H b/src/finiteVolume/cfdTools/general/include/setInitialDeltaT.H index 55f23f13e1476a7e9858904b3e91844afc9bccf2..1f45166220d947bf7931b82675636d4ef5b206e6 100644 --- a/src/finiteVolume/cfdTools/general/include/setInitialDeltaT.H +++ b/src/finiteVolume/cfdTools/general/include/setInitialDeltaT.H @@ -38,10 +38,10 @@ if (adjustTimeStep) { runTime.setDeltaT ( - min + Foam::min ( maxCo*runTime.deltaTValue()/CoNum, - min(runTime.deltaTValue(), maxDeltaT) + Foam::min(runTime.deltaTValue(), maxDeltaT) ) ); } diff --git a/src/finiteVolume/expressions/patch/patchExprDriverFields.C b/src/finiteVolume/expressions/patch/patchExprDriverFields.C index 2b1326b9fc9d6a5f739a14b6345c8057af355e6f..32f1b47a32fcd1c091f1a0caa631962f53f55113 100644 --- a/src/finiteVolume/expressions/patch/patchExprDriverFields.C +++ b/src/finiteVolume/expressions/patch/patchExprDriverFields.C @@ -84,7 +84,7 @@ Foam::expressions::patchExpr::parseDriver::field_cellSelection // Not particularly efficient... labelHashSet inSelection(tselected()); - const labelList& faceCells = patch_.faceCells(); + const labelUList& faceCells = patch_.faceCells(); auto tresult = tmp<boolField>::New(this->size(), false); auto& result = tresult.ref(); diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/calculatedProcessor/calculatedProcessorFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/calculatedProcessor/calculatedProcessorFvPatchField.C index 682a4481fb361c481f5558c33969bbb7b2217516..d89655e902e778931dfe3e9674c2b612ad027185 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/calculatedProcessor/calculatedProcessorFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/calculatedProcessor/calculatedProcessorFvPatchField.C @@ -129,7 +129,7 @@ void Foam::calculatedProcessorFvPatchField<Type>::initEvaluate // Bypass patchInternalField since uses fvPatch addressing { const Field<Type>& iF = this->internalField(); - const labelList& fc = procInterface_.faceCells(); + const labelUList& fc = procInterface_.faceCells(); sendBuf_.resize_nocopy(fc.size()); forAll(fc, i) { @@ -202,7 +202,7 @@ void Foam::calculatedProcessorFvPatchField<Type>::initInterfaceMatrixUpdate } // Bypass patchInternalField since uses fvPatch addressing - const labelList& fc = lduAddr.patchAddr(patchId); + const labelUList& fc = lduAddr.patchAddr(patchId); scalarSendBuf_.resize_nocopy(fc.size()); forAll(fc, i) diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.C index 380b6e4999a21a5d64ad12709ce11782ca7fe9cc..548ae95d9071adc306733b221bb2b1d8c30724d5 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.C @@ -222,7 +222,7 @@ void Foam::cyclicFvPatchField<Type>::updateInterfaceMatrix const Pstream::commsTypes ) const { - const labelList& nbrFaceCells = + const labelUList& nbrFaceCells = lduAddr.patchAddr ( this->cyclicPatch().neighbPatchID() diff --git a/src/finiteVolume/fields/fvPatchFields/derived/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.C index 8722e4b16ec5647bac26880ab98ee4cfd2ec3bf7..f4ba5c41371b120f1e22527cdaeff66e90c2c13a 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.C @@ -227,12 +227,12 @@ void Foam::activeBaffleVelocityFvPatchVectorField::updateCoeffs() ); const fvPatch& cyclicPatch = patch().boundaryMesh()[cyclicPatchLabel_]; - const labelList& cyclicFaceCells = cyclicPatch.patch().faceCells(); + const labelUList& cyclicFaceCells = cyclicPatch.patch().faceCells(); const fvPatch& nbrPatch = refCast<const cyclicFvPatch> ( cyclicPatch ).neighbFvPatch(); - const labelList& nbrFaceCells = nbrPatch.patch().faceCells(); + const labelUList& nbrFaceCells = nbrPatch.patch().faceCells(); scalar forceDiff = 0; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/activePressureForceBaffleVelocity/activePressureForceBaffleVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/activePressureForceBaffleVelocity/activePressureForceBaffleVelocityFvPatchVectorField.C index f2b719f54544a92667ea417f482b1f73378bcffb..845899c3547639d8886c072c30e24557dd568d3c 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/activePressureForceBaffleVelocity/activePressureForceBaffleVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/activePressureForceBaffleVelocity/activePressureForceBaffleVelocityFvPatchVectorField.C @@ -253,11 +253,11 @@ void Foam::activePressureForceBaffleVelocityFvPatchVectorField::updateCoeffs() db().lookupObject<volScalarField>(pName_); const fvPatch& cyclicPatch = patch().boundaryMesh()[cyclicPatchLabel_]; - const labelList& cyclicFaceCells = cyclicPatch.patch().faceCells(); + const labelUList& cyclicFaceCells = cyclicPatch.patch().faceCells(); const fvPatch& nbrPatch = refCast<const cyclicFvPatch>(cyclicPatch).neighbFvPatch(); - const labelList& nbrFaceCells = nbrPatch.patch().faceCells(); + const labelUList& nbrFaceCells = nbrPatch.patch().faceCells(); scalar valueDiff = 0; scalar area = 0; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/electrostaticDeposition/electrostaticDepositionFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/electrostaticDeposition/electrostaticDepositionFvPatchScalarField.C index 2ffd8892c115a97624240ce9e50727eaa33c2feb..61e2959eacf9d384bf3dc61317a77cf93b5c7320 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/electrostaticDeposition/electrostaticDepositionFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/electrostaticDeposition/electrostaticDepositionFvPatchScalarField.C @@ -496,16 +496,15 @@ void Foam::electrostaticDepositionFvPatchScalarField::updateCoeffs() timei_ = db().time().timeIndex(); { - const scalar hMin = gMin(h_); - const scalar hMax = gMax(h_); - const scalar hAvg = gAverage(h_); + auto limits = gMinMax(h_); + auto avg = gAverage(h_); - if (Pstream::master()) + if (UPstream::master()) { Info<< " patch: " << patch().name() - << ", h: min = " << hMin - << ", max = " << hMax - << ", average = " << hAvg << nl + << ", h: min = " << limits.min() + << ", max = " << limits.max() + << ", average = " << avg << nl << endl; } } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedFieldFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedFieldFvPatchField.C index cd3da655042cbdc7f1ec913787e566774afb6301..3ad7284506837be3d252b6eaa484e9fbeca2fd06 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedFieldFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedFieldFvPatchField.C @@ -175,11 +175,14 @@ void Foam::mappedFieldFvPatchField<Type>::updateCoeffs() if (debug) { + auto limits = gMinMax(*this); + auto avg = gAverage(*this); + Info<< "operating on field:" << this->internalField().name() << " patch:" << this->patch().name() - << " avg:" << gAverage(*this) - << " min:" << gMin(*this) - << " max:" << gMax(*this) + << " avg:" << avg + << " min:" << limits.min() + << " max:" << limits.max() << endl; } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedMixedFieldFvPatchField/mappedMixedFieldFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedMixedFieldFvPatchField/mappedMixedFieldFvPatchField.C index d0a225f0e4f1ee5ce9cbca9426b49c51c496cf7b..643b495772562e8a9fc532358d82d5c07c3c4bdf 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedMixedFieldFvPatchField/mappedMixedFieldFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedMixedFieldFvPatchField/mappedMixedFieldFvPatchField.C @@ -173,6 +173,9 @@ void Foam::mappedMixedFieldFvPatchField<Type>::updateCoeffs() if (debug) { + auto limits = gMinMax(*this); + auto avg = gAverage(*this); + Info<< this->patch().boundaryMesh().mesh().name() << ':' << this->patch().name() << ':' << this->internalField().name() << " <- " @@ -180,9 +183,9 @@ void Foam::mappedMixedFieldFvPatchField<Type>::updateCoeffs() << this->mapper_.samplePatch() << ':' << this->fieldName_ << " :" << " value " - << " min:" << gMin(*this) - << " max:" << gMax(*this) - << " avg:" << gAverage(*this) + << " min:" << limits.min() + << " max:" << limits.max() + << " avg:" << avg << endl; } } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedValue/mappedFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedValue/mappedFixedValueFvPatchField.C index ec190df0f1811cc44c8f68e6510de895d487bafc..58970edd6e6f6003d9f4a4a5a8c4cec9ddb3b219 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedValue/mappedFixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedValue/mappedFixedValueFvPatchField.C @@ -122,12 +122,15 @@ void Foam::mappedFixedValueFvPatchField<Type>::updateCoeffs() if (debug) { + auto limits = gMinMax(*this); + auto avg = gAverage(*this); + Info<< "mapped on field:" << this->internalField().name() << " patch:" << this->patch().name() - << " avg:" << gAverage(*this) - << " min:" << gMin(*this) - << " max:" << gMax(*this) + << " avg:" << avg + << " min:" << limits.min() + << " max:" << limits.max() << endl; } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/mappedMixed/mappedMixedFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/mappedMixed/mappedMixedFvPatchField.C index f3d9870e0d4433667e9b7300c3227318036840ff..95d553d508bfce8cdbc7899a7d2142d708a9c7b9 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/mappedMixed/mappedMixedFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/mappedMixed/mappedMixedFvPatchField.C @@ -215,6 +215,9 @@ void Foam::mappedMixedFvPatchField<Type>::updateCoeffs() if (debug) { + auto limits = gMinMax(*this); + auto avg = gAverage(*this); + Info<< this->patch().boundaryMesh().mesh().name() << ':' << this->patch().name() << ':' << this->internalField().name() << " <- " @@ -222,9 +225,9 @@ void Foam::mappedMixedFvPatchField<Type>::updateCoeffs() << this->mapper_.samplePatch() << ':' << this->fieldName_ << " :" << " value " - << " min:" << gMin(*this) - << " max:" << gMax(*this) - << " avg:" << gAverage(*this) + << " min:" << limits.min() + << " max:" << limits.max() + << " avg:" << avg << endl; } } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C index 40dc0780ccdd97589fd8c0822d90f94efb0b7928..f5a3a61818ff27b74f2739bb3dfd0b0151574636 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C @@ -181,9 +181,12 @@ void Foam::timeVaryingMappedFixedValueFvPatchField<Type>::updateCoeffs() if (debug) { - Pout<< "updateCoeffs : set fixedValue to min:" << gMin(*this) - << " max:" << gMax(*this) - << " avg:" << gAverage(*this) << endl; + auto limits = gMinMax(*this); + auto avg = gAverage(*this); + + Pout<< "updateCoeffs : set fixedValue to min:" << limits.min() + << " max:" << limits.max() + << " avg:" << avg << endl; } fixedValueFvPatchField<Type>::updateCoeffs(); diff --git a/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/turbulentDFSEMInletFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/turbulentDFSEMInletFvPatchVectorField.C index 888e5bc6c00ac000d4bac16294c7a9f73d63fa3f..24114e2055fb464020036f178c3e03ddd9ced68d 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/turbulentDFSEMInletFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/turbulentDFSEMInletFvPatchVectorField.C @@ -962,6 +962,8 @@ void Foam::turbulentDFSEMInletFvPatchVectorField::updateCoeffs() if (debug) { + auto limits = gMinMax(*this); + Info<< "Magnitude of bulk velocity: " << UBulk << endl; Info<< "Number of eddies: " @@ -969,7 +971,7 @@ void Foam::turbulentDFSEMInletFvPatchVectorField::updateCoeffs() << endl; Info<< "Patch:" << patch().patch().name() - << " min/max(U):" << gMin(U) << ", " << gMax(U) + << " min/max(U):" << limits.min() << ", " << limits.max() << endl; if (db().time().writeTime()) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.C index 0eb44f87fa69ddbc73fe328411f22f8f375b89f0..e98f7f20b01da375b2836a3c555f89a8e6347c01 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.C @@ -210,8 +210,12 @@ void Foam::waveSurfacePressureFvPatchScalarField::updateCoeffs() } - Info<< "min/max zetap = " << gMin(zetap & nf()) << ", " - << gMax(zetap & nf()) << endl; + { + auto limits = gMinMax(zetap & nf()); + + Info<< "min/max zetap = " + << limits.min() << ", " << limits.max() << endl; + } // Update the surface pressure const uniformDimensionedVectorField& g = diff --git a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C index ada91e0d510c419ca2cd43ef06fa1caf553d16e9..0fb4255c42235c3f25836c194a8aa09c25e0f590 100644 --- a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C @@ -272,7 +272,7 @@ void Foam::fvPatchField<Type>::autoMap && mapper.directAddressing().size() ) { - const labelList& mapAddressing = mapper.directAddressing(); + const labelUList& mapAddressing = mapper.directAddressing(); forAll(mapAddressing, i) { diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/ddtScheme/ddtScheme.C b/src/finiteVolume/finiteVolume/ddtSchemes/ddtScheme/ddtScheme.C index 06209c1334c261a8921232779d336470c525d514..9f339aecc5e191b0d67963bac90c160d6a7148ef 100644 --- a/src/finiteVolume/finiteVolume/ddtSchemes/ddtScheme/ddtScheme.C +++ b/src/finiteVolume/finiteVolume/ddtSchemes/ddtScheme/ddtScheme.C @@ -186,12 +186,12 @@ tmp<surfaceScalarField> ddtScheme<Type>::fvcDdtPhiCoeff if (debug > 1) { + auto limits = gMinMax(ddtCouplingCoeff.primitiveField()); + auto avg = gAverage(ddtCouplingCoeff.primitiveField()); + InfoInFunction << "ddtCouplingCoeff mean max min = " - << gAverage(ddtCouplingCoeff.primitiveField()) - << " " << gMax(ddtCouplingCoeff.primitiveField()) - << " " << gMin(ddtCouplingCoeff.primitiveField()) - << endl; + << avg << ' ' << limits.max() << ' ' << limits.min() << endl; } return tddtCouplingCoeff; @@ -267,12 +267,12 @@ tmp<surfaceScalarField> ddtScheme<Type>::fvcDdtPhiCoeffExperimental if (debug > 1) { + auto limits = gMinMax(ddtCouplingCoeff.primitiveField()); + auto avg = gAverage(ddtCouplingCoeff.primitiveField()); + InfoInFunction << "ddtCouplingCoeff mean max min = " - << gAverage(ddtCouplingCoeff.primitiveField()) - << " " << gMax(ddtCouplingCoeff.primitiveField()) - << " " << gMin(ddtCouplingCoeff.primitiveField()) - << endl; + << avg << ' ' << limits.max() << ' ' << limits.min() << endl; } return tddtCouplingCoeff; diff --git a/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/cellLimitedGrad/cellLimitedGrad.C b/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/cellLimitedGrad/cellLimitedGrad.C index f259794f1f10dec764fa4aeec0927372c4f9ceea..0d6605cbfc7960adbd3567bb59890c0224e67f09 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/cellLimitedGrad/cellLimitedGrad.C +++ b/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/cellLimitedGrad/cellLimitedGrad.C @@ -215,10 +215,13 @@ Foam::fv::cellLimitedGrad<Type, Limiter>::calcGrad if (fv::debug) { + auto limits = gMinMax(limiter); + auto avg = gAverage(limiter); + Info<< "gradient limiter for: " << vsf.name() - << " max = " << gMax(limiter) - << " min = " << gMin(limiter) - << " average: " << gAverage(limiter) << endl; + << " min = " << limits.min() + << " max = " << limits.max() + << " average: " << avg << endl; } limitGradient(limiter, g); diff --git a/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/faceLimitedGrad/faceLimitedGrads.C b/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/faceLimitedGrad/faceLimitedGrads.C index 5ef4594ef7d736e800ba613e3b488c18f96962c0..a6591c366e82841c84e574eb015ee3803ce6bcc0 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/faceLimitedGrad/faceLimitedGrads.C +++ b/src/finiteVolume/finiteVolume/gradSchemes/limitedGradSchemes/faceLimitedGrad/faceLimitedGrads.C @@ -162,10 +162,13 @@ Foam::fv::faceLimitedGrad<Foam::scalar>::calcGrad if (fv::debug) { + auto limits = gMinMax(limiter); + auto avg = gAverage(limiter); + Info<< "gradient limiter for: " << vsf.name() - << " max = " << gMax(limiter) - << " min = " << gMin(limiter) - << " average: " << gAverage(limiter) << endl; + << " min = " << limits.min() + << " max = " << limits.max() + << " average: " << avg << endl; } g.primitiveFieldRef() *= limiter; @@ -323,10 +326,13 @@ Foam::fv::faceLimitedGrad<Foam::vector>::calcGrad if (fv::debug) { + auto limits = gMinMax(limiter); + auto avg = gAverage(limiter); + Info<< "gradient limiter for: " << vvf.name() - << " max = " << gMax(limiter) - << " min = " << gMin(limiter) - << " average: " << gAverage(limiter) << endl; + << " min = " << limits.min() + << " max = " << limits.max() + << " average: " << avg << endl; } g.primitiveFieldRef() *= limiter; diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/faceCorrectedSnGrad/faceCorrectedSnGrad.C b/src/finiteVolume/finiteVolume/snGradSchemes/faceCorrectedSnGrad/faceCorrectedSnGrad.C index 46982ebda83ab17a9000c7342188b8e02249de90..3e970fbfa346b36a5f058ada960977a74af6b07e 100644 --- a/src/finiteVolume/finiteVolume/snGradSchemes/faceCorrectedSnGrad/faceCorrectedSnGrad.C +++ b/src/finiteVolume/finiteVolume/snGradSchemes/faceCorrectedSnGrad/faceCorrectedSnGrad.C @@ -71,8 +71,8 @@ Foam::fv::faceCorrectedSnGrad<Type>::fullGradCorrection const vectorField& Sf = mesh.Sf(); const vectorField& C = mesh.C(); const scalarField& magSf = mesh.magSf(); - const labelList& owner = mesh.owner(); - const labelList& neighbour = mesh.neighbour(); + const auto& owner = mesh.owner(); + const auto& neighbour = mesh.neighbour(); forAll(sfCorr, facei) { diff --git a/src/finiteVolume/fvMatrices/solvers/MULES/CMULESTemplates.C b/src/finiteVolume/fvMatrices/solvers/MULES/CMULESTemplates.C index 070e9b557ba497ca9fde91060b7043ecbde03c76..80e686e64b6261a2ffb970647bd823b66d9c1372 100644 --- a/src/finiteVolume/fvMatrices/solvers/MULES/CMULESTemplates.C +++ b/src/finiteVolume/fvMatrices/solvers/MULES/CMULESTemplates.C @@ -322,7 +322,7 @@ void Foam::MULES::limiterCorr const fvPatchScalarField& psiPf = psiBf[patchi]; const scalarField& phiCorrPf = phiCorrBf[patchi]; - const labelList& pFaceCells = mesh.boundary()[patchi].faceCells(); + const labelUList& pFaceCells = mesh.boundary()[patchi].faceCells(); if (psiPf.coupled()) { @@ -441,7 +441,7 @@ void Foam::MULES::limiterCorr scalarField& lambdaPf = lambdaBf[patchi]; const scalarField& phiCorrfPf = phiCorrBf[patchi]; - const labelList& pFaceCells = mesh.boundary()[patchi].faceCells(); + const labelUList& pFaceCells = mesh.boundary()[patchi].faceCells(); forAll(lambdaPf, pFacei) { @@ -515,7 +515,7 @@ void Foam::MULES::limiterCorr } else if (psiPf.coupled()) { - const labelList& pFaceCells = + const labelUList& pFaceCells = mesh.boundary()[patchi].faceCells(); forAll(lambdaPf, pFacei) @@ -536,7 +536,7 @@ void Foam::MULES::limiterCorr } else { - const labelList& pFaceCells = + const labelUList& pFaceCells = mesh.boundary()[patchi].faceCells(); const scalarField& phiPf = phiBf[patchi]; diff --git a/src/finiteVolume/fvMatrices/solvers/MULES/MULESTemplates.C b/src/finiteVolume/fvMatrices/solvers/MULES/MULESTemplates.C index 30ad56a9d38e2b31094aff4c2f7e24050dd5982c..cd59c831e6ffb75ce3898062825d1cb646eb2a36 100644 --- a/src/finiteVolume/fvMatrices/solvers/MULES/MULESTemplates.C +++ b/src/finiteVolume/fvMatrices/solvers/MULES/MULESTemplates.C @@ -321,7 +321,7 @@ void Foam::MULES::limiter const scalarField& phiBDPf = phiBDBf[patchi]; const scalarField& phiCorrPf = phiCorrBf[patchi]; - const labelList& pFaceCells = mesh.boundary()[patchi].faceCells(); + const labelUList& pFaceCells = mesh.boundary()[patchi].faceCells(); if (psiPf.coupled()) { @@ -469,7 +469,7 @@ void Foam::MULES::limiter scalarField& lambdaPf = lambdaBf[patchi]; const scalarField& phiCorrfPf = phiCorrBf[patchi]; - const labelList& pFaceCells = mesh.boundary()[patchi].faceCells(); + const labelUList& pFaceCells = mesh.boundary()[patchi].faceCells(); forAll(lambdaPf, pFacei) { @@ -542,7 +542,7 @@ void Foam::MULES::limiter } else if (psiPf.coupled()) { - const labelList& pFaceCells = + const labelUList& pFaceCells = mesh.boundary()[patchi].faceCells(); forAll(lambdaPf, pFacei) diff --git a/src/finiteVolume/fvMesh/fvGeometryScheme/averageNeighbour/averageNeighbourFvGeometryScheme.C b/src/finiteVolume/fvMesh/fvGeometryScheme/averageNeighbour/averageNeighbourFvGeometryScheme.C index 6cfef0e9448818082d09814b2e889d6e2311d877..feb35be095faf82e417fc6a6be1bc965198baec7 100644 --- a/src/finiteVolume/fvMesh/fvGeometryScheme/averageNeighbour/averageNeighbourFvGeometryScheme.C +++ b/src/finiteVolume/fvMesh/fvGeometryScheme/averageNeighbour/averageNeighbourFvGeometryScheme.C @@ -814,6 +814,7 @@ void Foam::averageNeighbourFvGeometryScheme::movePoints() Foam::acos(faceOrthogonality) ) ); + Pout<< " iter:" << iter << " nClipped:" << nClipped << " average displacement:" << gAverage(magCorrection) @@ -845,10 +846,13 @@ void Foam::averageNeighbourFvGeometryScheme::movePoints() if (debug) { + auto limits = gMinMax(cellWeight); + auto avg = gAverage(cellWeight); + Pout<< "averageNeighbourFvGeometryScheme::movePoints() :" << " averageNeighbour weight" - << " max:" << gMax(cellWeight) << " min:" << gMin(cellWeight) - << " average:" << gAverage(cellWeight) << endl; + << " min:" << limits.min() << " max:" << limits.max() + << " average:" << avg << endl; // Dump lines from old to new location const fileName tp(mesh_.time().timePath()); diff --git a/src/finiteVolume/fvMesh/fvGeometryScheme/highAspectRatio/cellAspectRatio.C b/src/finiteVolume/fvMesh/fvGeometryScheme/highAspectRatio/cellAspectRatio.C index efa5a01fd9e89b68d8fd6ff6bf206445476cf7aa..ce87146904a2eb371613a11eb3503d497c3ab525 100644 --- a/src/finiteVolume/fvMesh/fvGeometryScheme/highAspectRatio/cellAspectRatio.C +++ b/src/finiteVolume/fvMesh/fvGeometryScheme/highAspectRatio/cellAspectRatio.C @@ -120,8 +120,11 @@ void Foam::cellAspectRatio::calcAspectRatio() if (debug) { - InfoInFunction << "Calculated cell aspect ratio min:" << gMin(aRatio) - << " max:" << gMax(aRatio) << " average:" << gAverage(aRatio) + auto limits = gMinMax(aRatio); + auto avg = gAverage(aRatio); + + InfoInFunction << "Calculated cell aspect ratio min:" << limits.min() + << " max:" << limits.max() << " average:" << avg << endl; } } diff --git a/src/finiteVolume/fvMesh/fvGeometryScheme/highAspectRatio/highAspectRatioFvGeometryScheme.C b/src/finiteVolume/fvMesh/fvGeometryScheme/highAspectRatio/highAspectRatioFvGeometryScheme.C index 0f64298abc1fa40b31207b7e107f625bf160dbfc..6e60a2eac3229fa28296d97f9f97099591a3df2e 100644 --- a/src/finiteVolume/fvMesh/fvGeometryScheme/highAspectRatio/highAspectRatioFvGeometryScheme.C +++ b/src/finiteVolume/fvMesh/fvGeometryScheme/highAspectRatio/highAspectRatioFvGeometryScheme.C @@ -434,10 +434,13 @@ void Foam::highAspectRatioFvGeometryScheme::movePoints() if (debug) { + auto limits = gMinMax(cellWeight); + auto avg = gAverage(cellWeight); + Pout<< "highAspectRatioFvGeometryScheme::movePoints() :" << " highAspectRatio weight" - << " max:" << gMax(cellWeight) << " min:" << gMin(cellWeight) - << " average:" << gAverage(cellWeight) << endl; + << " min:" << limits.max() << " max:" << limits.max() + << " average:" << avg << endl; } vectorField faceAreas(mesh_.faceAreas()); diff --git a/src/finiteVolume/interpolation/interpolation/interpolationPointMVC/pointMVCWeight.C b/src/finiteVolume/interpolation/interpolation/interpolationPointMVC/pointMVCWeight.C index e26f61466b7feb2c1761c8839923126e8f43149f..e6871a0bb37cce5aa8a6104cd55fe7b71dc117ab 100644 --- a/src/finiteVolume/interpolation/interpolation/interpolationPointMVC/pointMVCWeight.C +++ b/src/finiteVolume/interpolation/interpolation/interpolationPointMVC/pointMVCWeight.C @@ -44,7 +44,7 @@ void Foam::pointMVCWeight::calcWeights ( const Map<label>& toLocal, const face& f, - const DynamicList<point>& u, + const UList<point>& u, const scalarField& dist, scalarField& weights ) const diff --git a/src/finiteVolume/interpolation/interpolation/interpolationPointMVC/pointMVCWeight.H b/src/finiteVolume/interpolation/interpolation/interpolationPointMVC/pointMVCWeight.H index f2abe5a210760ae61cec4dd2b0808fa86444cb1d..220e6baa398e7fc43301c67c47fb3580a3742dc0 100644 --- a/src/finiteVolume/interpolation/interpolation/interpolationPointMVC/pointMVCWeight.H +++ b/src/finiteVolume/interpolation/interpolation/interpolationPointMVC/pointMVCWeight.H @@ -86,7 +86,7 @@ protected: ( const Map<label>& toLocal, const face& f, - const DynamicList<point>& u, + const UList<point>& u, const scalarField& dist, scalarField& weights ) const; diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/linearUpwind/linearUpwind.C b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/linearUpwind/linearUpwind.C index 7848088c17306fb0a51cb7ad07a322ee2f2d5a4d..ac5e0b67e1f7b82835a30468c23ff521fa17c2a1 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/linearUpwind/linearUpwind.C +++ b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/linearUpwind/linearUpwind.C @@ -61,8 +61,8 @@ Foam::linearUpwind<Type>::correction const surfaceScalarField& faceFlux = this->faceFlux_; - const labelList& owner = mesh.owner(); - const labelList& neighbour = mesh.neighbour(); + const auto& owner = mesh.owner(); + const auto& neighbour = mesh.neighbour(); const volVectorField& C = mesh.C(); const surfaceVectorField& Cf = mesh.Cf(); @@ -172,8 +172,8 @@ Foam::linearUpwind<Foam::vector>::correction const surfaceScalarField& faceFlux = this->faceFlux_; - const labelList& owner = mesh.owner(); - const labelList& neighbour = mesh.neighbour(); + const auto& owner = mesh.owner(); + const auto& neighbour = mesh.neighbour(); const volVectorField& C = mesh.C(); const surfaceVectorField& Cf = mesh.Cf(); diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/linearUpwind/linearUpwindV.C b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/linearUpwind/linearUpwindV.C index 48439fe7407c41555fee9d9d9d7c95dde3960443..f53be64e1bf26382d4a28e3db98ffaba52b5f886 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/linearUpwind/linearUpwindV.C +++ b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/linearUpwind/linearUpwindV.C @@ -64,8 +64,8 @@ Foam::linearUpwindV<Type>::correction const surfaceScalarField& faceFlux = this->faceFlux_; const surfaceScalarField& w = mesh.weights(); - const labelList& own = mesh.owner(); - const labelList& nei = mesh.neighbour(); + const auto& own = mesh.owner(); + const auto& nei = mesh.neighbour(); const volVectorField& C = mesh.C(); const surfaceVectorField& Cf = mesh.Cf(); diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/outletStabilised/outletStabilised.H b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/outletStabilised/outletStabilised.H index 381ab0cc03e504870e995c53758cccd13a339cc3..65f7a49cb15ae10ef20f2b92d959f89ca6cf26c1 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/outletStabilised/outletStabilised.H +++ b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/outletStabilised/outletStabilised.H @@ -154,17 +154,14 @@ public: (vf.boundaryField()[patchi]) ) { - const labelList& pFaceCells = - mesh_.boundary()[patchi].faceCells(); - - forAll(pFaceCells, pFacei) + for + ( + const label celli + : mesh_.boundary()[patchi].faceCells() + ) { - const cell& pFaceCell = cells[pFaceCells[pFacei]]; - - forAll(pFaceCell, fi) + for (const label facei : cells[celli]) { - label facei = pFaceCell[fi]; - if (mesh_.isInternalFace(facei)) { // Apply upwind differencing @@ -213,17 +210,14 @@ public: (vf.boundaryField()[patchi]) ) { - const labelList& pFaceCells = - mesh_.boundary()[patchi].faceCells(); - - forAll(pFaceCells, pFacei) + for + ( + const label celli + : mesh_.boundary()[patchi].faceCells() + ) { - const cell& pFaceCell = cells[pFaceCells[pFacei]]; - - forAll(pFaceCell, fi) + for (const label facei : cells[celli]) { - label facei = pFaceCell[fi]; - if (mesh_.isInternalFace(facei)) { // Remove correction diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/pointLinear/pointLinear.C b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/pointLinear/pointLinear.C index 6d8cad97f713f2060432527384ce077b9c3a33f7..40b8b70111ff1110d4281038e1be832318e9f5c9 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/pointLinear/pointLinear.C +++ b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/pointLinear/pointLinear.C @@ -56,8 +56,8 @@ correction const pointField& C = mesh.C(); const faceList& faces = mesh.faces(); const scalarField& w = mesh.weights(); - const labelList& owner = mesh.owner(); - const labelList& neighbour = mesh.neighbour(); + const auto& owner = mesh.owner(); + const auto& neighbour = mesh.neighbour(); forAll(sfCorr, facei) { diff --git a/src/functionObjects/field/AMIWeights/AMIWeights.C b/src/functionObjects/field/AMIWeights/AMIWeights.C index 7ec095d55dc73c200ca2fe31597826e1c4e97b6c..a3a49b20aad147f4973cacc053aa7d96476d2c78 100644 --- a/src/functionObjects/field/AMIWeights/AMIWeights.C +++ b/src/functionObjects/field/AMIWeights/AMIWeights.C @@ -88,52 +88,52 @@ void Foam::functionObjects::AMIWeights::reportPatch const Switch distributed = pp.AMI().distributed(); const scalarField& srcWeightsSum = pp.AMI().srcWeightsSum(); - const scalar srcMinWeight = gMin(srcWeightsSum); - const scalar srcMaxWeight = gMax(srcWeightsSum); - const scalar srcAveWeight = gAverage(srcWeightsSum); + const auto srcWeightLimits = gMinMax(srcWeightsSum); + const auto srcWeightAvg = gAverage(srcWeightsSum); const labelListList& srcAddress = pp.AMI().srcAddress(); - label srcMinNbr = labelMax; - label srcMaxNbr = labelMin; - scalar srcAveNbr = 0; + + labelMinMax srcNbrLimits(labelMax, labelMin); + scalar srcNbrAvg(0); for (const labelList& srcFace : srcAddress) { const label n = srcFace.size(); - srcAveNbr += n; - srcMinNbr = min(srcMinNbr, n); - srcMaxNbr = max(srcMaxNbr, n); + + srcNbrAvg += n; + srcNbrLimits.add(n); } - reduce(srcMinNbr, minOp<label>()); - reduce(srcMaxNbr, maxOp<label>()); + { + reduce(srcNbrLimits, sumOp<labelMinMax>()); - srcAveNbr = - returnReduce(srcAveNbr, sumOp<scalar>()) - /(returnReduce(srcAddress.size(), sumOp<scalar>()) + ROOTVSMALL); + label count = srcAddress.size(); + sumReduce(srcNbrAvg, count); + srcNbrAvg /= (count + ROOTVSMALL); + } const scalarField& tgtWeightsSum = pp.AMI().tgtWeightsSum(); - const scalar tgtMinWeight = gMin(tgtWeightsSum); - const scalar tgtMaxWeight = gMax(tgtWeightsSum); - const scalar tgtAveWeight = gAverage(tgtWeightsSum); + const auto tgtWeightLimits = gMinMax(tgtWeightsSum); + const auto tgtWeightAvg = gAverage(tgtWeightsSum); const labelListList& tgtAddress = pp.AMI().tgtAddress(); - label tgtMinNbr = labelMax; - label tgtMaxNbr = labelMin; - scalar tgtAveNbr = 0; + + labelMinMax tgtNbrLimits(labelMax, labelMin); + scalar tgtNbrAvg(0); for (const labelList& tgtFace : tgtAddress) { const label n = tgtFace.size(); - tgtAveNbr += n; - tgtMinNbr = min(tgtMinNbr, n); - tgtMaxNbr = max(tgtMaxNbr, n); + + tgtNbrAvg += n; + tgtNbrLimits.add(n); } - reduce(tgtMinNbr, minOp<label>()); - reduce(tgtMaxNbr, maxOp<label>()); + { + reduce(tgtNbrLimits, sumOp<labelMinMax>()); - tgtAveNbr = - returnReduce(tgtAveNbr, sumOp<scalar>()) - /(returnReduce(tgtAddress.size(), sumOp<scalar>()) + ROOTVSMALL); + label count = tgtAddress.size(); + sumReduce(tgtNbrAvg, count); + tgtNbrAvg /= (count + ROOTVSMALL); + } file() << mesh_.time().timeName() << tab @@ -147,18 +147,18 @@ void Foam::functionObjects::AMIWeights::reportPatch } file() - << srcMinWeight << tab - << srcMaxWeight << tab - << srcAveWeight << tab - << srcMinNbr << tab - << srcMaxNbr << tab - << srcAveNbr << tab - << tgtMinWeight << tab - << tgtMaxWeight << tab - << tgtAveWeight << tab - << tgtMinNbr << tab - << tgtMaxNbr << tab - << tgtAveNbr << tab + << srcWeightLimits.min() << tab + << srcWeightLimits.max() << tab + << srcWeightAvg << tab + << srcNbrLimits.min() << tab + << srcNbrLimits.max() << tab + << srcNbrAvg << tab + << tgtWeightLimits.min() << tab + << tgtWeightLimits.max() << tab + << tgtWeightAvg << tab + << tgtNbrLimits.min() << tab + << tgtNbrLimits.max() << tab + << tgtNbrAvg << endl; Log << " Patches: " << nl @@ -176,34 +176,34 @@ void Foam::functionObjects::AMIWeights::reportPatch Log << " | " << setw(w) << pp.name() << " | " << setw(w) << nbrPatchName << " | " << nl - << " min(weight) | " << setw(w) << srcMinWeight - << " | " << setw(w) << tgtMinWeight << " | " << nl - << " max(weight) | " << setw(w) << srcMaxWeight - << " | " << setw(w) << tgtMaxWeight << " | " << nl - << " ave(weight) | " << setw(w) << srcAveWeight - << " | " << setw(w) << tgtAveWeight << " | " << nl - << " min(address) | " << setw(w) << srcMinNbr - << " | " << setw(w) << tgtMinNbr << " | " << nl - << " max(address) | " << setw(w) << srcMaxNbr - << " | " << setw(w) << tgtMaxNbr << " | " << nl - << " ave(address) | " << setw(w) << srcAveNbr - << " | " << setw(w) << tgtAveNbr << " | " << nl + << " min(weight) | " << setw(w) << srcWeightLimits.min() + << " | " << setw(w) << tgtWeightLimits.min() << " | " << nl + << " max(weight) | " << setw(w) << srcWeightLimits.max() + << " | " << setw(w) << tgtWeightLimits.max() << " | " << nl + << " ave(weight) | " << setw(w) << srcWeightAvg + << " | " << setw(w) << tgtWeightAvg << " | " << nl + << " min(address) | " << setw(w) << srcNbrLimits.min() + << " | " << setw(w) << tgtNbrLimits.min() << " | " << nl + << " max(address) | " << setw(w) << srcNbrLimits.max() + << " | " << setw(w) << tgtNbrLimits.max() << " | " << nl + << " ave(address) | " << setw(w) << srcNbrAvg + << " | " << setw(w) << tgtNbrAvg << " | " << nl << endl; setResult(pp.name() + ":src", pp.name()); setResult(pp.name() + ":tgt", nbrPatchName); - setResult(pp.name() + ":src:min(weight)", srcMinWeight); - setResult(pp.name() + ":src:max(weight)", srcMaxWeight); - setResult(pp.name() + ":src:ave(weight)", srcAveWeight); - setResult(pp.name() + ":src:min(address)", srcMinNbr); - setResult(pp.name() + ":src:max(address)", srcMaxNbr); - setResult(pp.name() + ":src:ave(address)", srcAveNbr); - setResult(pp.name() + ":tgt:min(weight)", tgtMinWeight); - setResult(pp.name() + ":tgt:max(weight)", tgtMaxWeight); - setResult(pp.name() + ":tgt:ave(weight)", tgtAveWeight); - setResult(pp.name() + ":tgt:min(address)", tgtMinNbr); - setResult(pp.name() + ":tgt:max(address)", tgtMaxNbr); - setResult(pp.name() + ":tgt:ave(address)", tgtAveNbr); + setResult(pp.name() + ":src:min(weight)", srcWeightLimits.min()); + setResult(pp.name() + ":src:max(weight)", srcWeightLimits.max()); + setResult(pp.name() + ":src:ave(weight)", srcWeightAvg); + setResult(pp.name() + ":src:min(address)", srcNbrLimits.min()); + setResult(pp.name() + ":src:max(address)", srcNbrLimits.max()); + setResult(pp.name() + ":src:ave(address)", srcNbrAvg); + setResult(pp.name() + ":tgt:min(weight)", tgtWeightLimits.min()); + setResult(pp.name() + ":tgt:max(weight)", tgtWeightLimits.max()); + setResult(pp.name() + ":tgt:ave(weight)", tgtWeightAvg); + setResult(pp.name() + ":tgt:min(address)", tgtNbrLimits.min()); + setResult(pp.name() + ":tgt:max(address)", tgtNbrLimits.max()); + setResult(pp.name() + ":tgt:ave(address)", tgtNbrAvg); } diff --git a/src/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C b/src/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C index 092969850fdb595f9b5d044abe12b96c695ae700..65ff24101fcb2d85da6bef7e66e8aa8bfd7b1c9d 100644 --- a/src/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C +++ b/src/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C @@ -162,7 +162,7 @@ void Foam::functionObjects::fieldMinMax::calcMinMaxFieldType { const vectorField& Cfp = CfBoundary[patchi]; - const labelList& faceCells = + const labelUList& faceCells = fieldBoundary[patchi].patch().faceCells(); minMaxIds = findMinMax(fp); diff --git a/src/functionObjects/field/yPlus/yPlus.C b/src/functionObjects/field/yPlus/yPlus.C index f9b5f3a3b532e9eaa1a1bf5e51384d820a64ee25..f767e00f5bd345460c7c8a168ad2e9d6fc5edf35 100644 --- a/src/functionObjects/field/yPlus/yPlus.C +++ b/src/functionObjects/field/yPlus/yPlus.C @@ -211,25 +211,24 @@ bool Foam::functionObjects::yPlus::write() { const scalarField& yPlusp = yPlusBf[patchi]; - const scalar minYplus = gMin(yPlusp); - const scalar maxYplus = gMax(yPlusp); - const scalar avgYplus = gAverage(yPlusp); + auto limits = gMinMax(yPlusp); + auto avg = gAverage(yPlusp); if (UPstream::master()) { writeCurrentTime(file()); file() << token::TAB << patch.name() - << token::TAB << minYplus - << token::TAB << maxYplus - << token::TAB << avgYplus + << token::TAB << limits.min() + << token::TAB << limits.max() + << token::TAB << avg << endl; } Log << " patch " << patch.name() - << " y+ : min = " << minYplus - << ", max = " << maxYplus - << ", average = " << avgYplus << endl; + << " y+ : min = " << limits.min() + << ", max = " << limits.max() + << ", average = " << avg << endl; } } diff --git a/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchField.C b/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchField.C index 73f892343927fffc42ef4ce706d0dbb0a20e6113..d57ddb09a9acc3e70a78c793e4da1d04ae09510c 100644 --- a/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchField.C +++ b/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchField.C @@ -552,9 +552,12 @@ void Foam::timeVaryingMappedFixedValuePointPatchField<Type>::updateCoeffs() if (debug) { - Pout<< "updateCoeffs : set fixedValue to min:" << gMin(*this) - << " max:" << gMax(*this) - << " avg:" << gAverage(*this) << endl; + auto limits = gMinMax(*this); + auto avg = gAverage(*this); + + Pout<< "updateCoeffs : set fixedValue to min:" << limits.min() + << " max:" << limits.max() + << " avg:" << avg << endl; } fixedValuePointPatchField<Type>::updateCoeffs(); diff --git a/src/fvOptions/cellSetOption/cellSetOption.C b/src/fvOptions/cellSetOption/cellSetOption.C index b5117ada94d7c5b24d9f81548919c0f1088366f9..8b484a777530deea32e65f08dacf5e5d9534b244 100644 --- a/src/fvOptions/cellSetOption/cellSetOption.C +++ b/src/fvOptions/cellSetOption/cellSetOption.C @@ -314,7 +314,7 @@ void Foam::fv::cellSetOption::setCellSelection() { labelHashSet selectedCells; const cellCellStencilObject& overlap = Stencil::New(mesh_); - const labelList& cellTypes = overlap.cellTypes(); + const labelUList& cellTypes = overlap.cellTypes(); forAll(cellTypes, celli) { if (cellTypes[celli] == cellCellStencil::POROUS) diff --git a/src/fvOptions/sources/derived/heatExchangerSource/heatExchangerModels/effectivenessTable/effectivenessTable.C b/src/fvOptions/sources/derived/heatExchangerSource/heatExchangerModels/effectivenessTable/effectivenessTable.C index 08af91be268395b4d408379d7d287f69a577978f..b5e42d1af5926a85ad1f9a036aad1b24b82c31f6 100644 --- a/src/fvOptions/sources/derived/heatExchangerSource/heatExchangerModels/effectivenessTable/effectivenessTable.C +++ b/src/fvOptions/sources/derived/heatExchangerSource/heatExchangerModels/effectivenessTable/effectivenessTable.C @@ -195,23 +195,23 @@ Foam::heatExchangerModels::effectivenessTable::energyDensity secondaryInletT_ += targetQdotRelax_*dT; } - const scalarField TCells(T, cells); - scalarField deltaTCells(cells.size(), Zero); + // start with a copy + scalarField deltaTCells(T, cells); Tref_ = 0; if (Qt_ > 0) { - Tref_ = gMax(TCells); - forAll(deltaTCells, i) + Tref_ = gMax(deltaTCells); + for (scalar& delta : deltaTCells) { - deltaTCells[i] = max(Tref_ - TCells[i], scalar(0)); + delta = Foam::max(Tref_ - delta, scalar(0)); } } else { - Tref_ = gMin(TCells); - forAll(deltaTCells, i) + Tref_ = gMin(deltaTCells); + for (scalar& delta : deltaTCells) { - deltaTCells[i] = max(TCells[i] - Tref_, scalar(0)); + delta = Foam::max(delta - Tref_, scalar(0)); } } diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C index 776d3af8110b1896d5991a06ccaca941ec074933..a513fb2ffb263b41b42e86060be01588ef768f11 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C @@ -950,13 +950,12 @@ void Foam::KinematicCloud<CloudType>::info() alpha().write(); } - const scalar alphaMin = gMin(alpha().primitiveField()); - const scalar alphaMax = gMax(alpha().primitiveField()); + auto limits = gMinMax(alpha().primitiveField()); - Log_<< " Min cell volume fraction = " << alphaMin << nl - << " Max cell volume fraction = " << alphaMax << endl; + Log_<< " Min cell volume fraction = " << limits.min() << nl + << " Max cell volume fraction = " << limits.max() << endl; - if (alphaMax < SMALL) + if (limits.max() < SMALL) { return; } @@ -969,7 +968,7 @@ void Foam::KinematicCloud<CloudType>::info() if (n > 0) { - const scalar nPack = n*alphaMax/alpha()[celli]; + const scalar nPack = n*limits.max()/alpha()[celli]; if (nPack < nMin) { diff --git a/src/lagrangian/intermediate/clouds/Templates/MPPICCloud/MPPICCloud.C b/src/lagrangian/intermediate/clouds/Templates/MPPICCloud/MPPICCloud.C index 14dcb633edc390285c80ca2364d658cd5a179e67..3e7bb385603aa2d81ef8ee7ad81a6640682e5585 100644 --- a/src/lagrangian/intermediate/clouds/Templates/MPPICCloud/MPPICCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/MPPICCloud/MPPICCloud.C @@ -283,13 +283,12 @@ void Foam::MPPICCloud<CloudType>::info() tmp<volScalarField> alpha = this->theta(); - const scalar alphaMin = gMin(alpha().primitiveField()); - const scalar alphaMax = gMax(alpha().primitiveField()); + auto limits = gMinMax(alpha().primitiveField()); - Log_ << " Min cell volume fraction = " << alphaMin << nl - << " Max cell volume fraction = " << alphaMax << endl; + Log_ << " Min cell volume fraction = " << limits.min() << nl + << " Max cell volume fraction = " << limits.max() << endl; - if (alphaMax < SMALL) + if (limits.max() < SMALL) { return; } @@ -302,7 +301,7 @@ void Foam::MPPICCloud<CloudType>::info() if (n > 0) { - const scalar nPack = n*alphaMax/alpha()[celli]; + const scalar nPack = n*limits.max()/alpha()[celli]; if (nPack < nMin) { diff --git a/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairCollision.C b/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairCollision.C index 2dbed1a87b9dabf5f1bec28a23393a7f11f7df5f..4d631f7efc19d39e4792731622e77ccee130e7ac 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairCollision.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairCollision.C @@ -436,7 +436,7 @@ void Foam::PairCollision<CloudType>::wallInteraction() template<class CloudType> bool Foam::PairCollision<CloudType>::duplicatePointInList ( - const DynamicList<point>& existingPoints, + const UList<point>& existingPoints, const point& pointToTest, scalar duplicateRangeSqr ) const @@ -456,7 +456,7 @@ bool Foam::PairCollision<CloudType>::duplicatePointInList template<class CloudType> bool Foam::PairCollision<CloudType>::duplicatePointInList ( - const DynamicList<point>& existingPoints, + const UList<point>& existingPoints, const point& pointToTest, const scalarList& duplicateRangeSqr ) const diff --git a/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairCollision.H b/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairCollision.H index a5c2af2de370651c706424350cf4ee58f9eb2de2..acb9e05754f69f3c1f971ca42c8bd0d299ce41c8 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairCollision.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairCollision.H @@ -111,14 +111,14 @@ class PairCollision bool duplicatePointInList ( - const DynamicList<point>& existingPoints, + const UList<point>& existingPoints, const point& pointToTest, scalar duplicateRangeSqr ) const; bool duplicatePointInList ( - const DynamicList<point>& existingPoints, + const UList<point>& existingPoints, const point& pointToTest, const scalarList& duplicateRangeSqr ) const; diff --git a/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloudI.H b/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloudI.H index 8e2a817dab00797cf900603b00066a6f44089cc1..279bf2e807d307de4cc234e59d48d97063912acc 100644 --- a/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloudI.H +++ b/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloudI.H @@ -136,7 +136,7 @@ inline Foam::scalar Foam::SprayCloud<CloudType>::penetration const SortList<scalar> sortedDist(dist); const scalar mLimit = fraction*mTotal; - const labelList& indices = sortedDist.indices(); + const labelUList& indices = sortedDist.indices(); if (mLimit > (mTotal - mass[indices.last()])) { diff --git a/src/mesh/blockMesh/blockMesh/blockMeshCreate.C b/src/mesh/blockMesh/blockMesh/blockMeshCreate.C index baa9e9ecad6b2e728419eafe718cfdf88ab68dcb..199fe05b86c0a122f3b7eec50021ed14748e95f4 100644 --- a/src/mesh/blockMesh/blockMesh/blockMeshCreate.C +++ b/src/mesh/blockMesh/blockMesh/blockMeshCreate.C @@ -163,7 +163,7 @@ Foam::faceList Foam::blockMesh::createPatchFaces { const blockList& blocks = *this; - labelList blockLabels = patchTopologyFaces.polyPatch::faceCells(); + const labelUList& blockLabels = patchTopologyFaces.polyPatch::faceCells(); label nFaces = 0; diff --git a/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.C b/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.C index 5e3bafccad8cc3d94cf57e1ad4800c61abec6ca6..a0f40a2158b349d0f842bc22324663ae32e40d28 100644 --- a/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.C +++ b/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.C @@ -288,8 +288,8 @@ void Foam::meshRefinement::calcNeighbourData void Foam::meshRefinement::calcCellCellRays ( const pointField& neiCc, - const labelList& neiLevel, - const labelList& testFaces, + const labelUList& neiLevel, + const labelUList& testFaces, pointField& start, pointField& end, labelList& minLevel @@ -358,7 +358,7 @@ void Foam::meshRefinement::calcCellCellRays } -void Foam::meshRefinement::updateIntersections(const labelList& changedFaces) +void Foam::meshRefinement::updateIntersections(const labelUList& changedFaces) { // Stats on edges to test. Count proc faces only once. bitSet isMasterFace(syncTools::getMasterFaces(mesh_)); diff --git a/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.H b/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.H index cc87edc7623c623ec0135b99255e32aa0fa8f6fe..26bd899f03340f55431bf510984599cbaef3cfc9 100644 --- a/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.H +++ b/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.H @@ -259,8 +259,8 @@ private: void calcCellCellRays ( const pointField& neiCc, - const labelList& neiLevel, - const labelList& testFaces, + const labelUList& neiLevel, + const labelUList& testFaces, pointField& start, pointField& end, labelList& minLevel @@ -1589,7 +1589,7 @@ public: void selectSeparatedCoupledFaces(boolList&) const; //- Find any intersection of surface. Store in surfaceIndex_. - void updateIntersections(const labelList& changedFaces); + void updateIntersections(const labelUList& changedFaces); //- Calculate nearest intersection for selected mesh faces void nearestIntersection diff --git a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyLayerDriver.C b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyLayerDriver.C index d362fabd2844cec1e975c46c466a6bd6de9f028f..48ddfd48cfb121a503b3546186ddf0a92b34acc4 100644 --- a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyLayerDriver.C +++ b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyLayerDriver.C @@ -1676,8 +1676,7 @@ void Foam::snappyLayerDriver::calculateLayerThickness GREAT // null value ); - //Info<< "calculateLayerThickness : min:" << gMin(thickness) - // << " max:" << gMax(thickness) << endl; + //Info<< "calculateLayerThickness : " << gMinMax(thickness) << endl; // Print a bit { @@ -3098,7 +3097,7 @@ void Foam::snappyLayerDriver::printLayerData label sumSize = pp.size(); // Number of layers - const labelList& faceCells = pp.faceCells(); + const labelUList& faceCells = pp.faceCells(); label sumNLayers = 0; forAll(faceCells, i) { @@ -3266,7 +3265,7 @@ bool Foam::snappyLayerDriver::writeLayerData { label patchi = patchIDs[i]; const polyPatch& pp = pbm[patchi]; - const labelList& faceCells = pp.faceCells(); + const labelUList& faceCells = pp.faceCells(); scalarField pfld(faceCells.size()); forAll(faceCells, i) { @@ -5537,9 +5536,9 @@ void Foam::snappyLayerDriver::doLayers if (numLayers[patchi] > 0) { const polyPatch& pp = mesh.boundaryMesh()[patchi]; - forAll(pp.faceCells(), i) + for (const label celli : pp.faceCells()) { - cellWeights[pp.faceCells()[i]] += numLayers[patchi]; + cellWeights[celli] += numLayers[patchi]; } } } diff --git a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriver.C b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriver.C index a37f5de34104833f7db0dee4de3607d8dc4347be..d4372068a6ad38fbbc1f2398f91d45d087ff4a71 100644 --- a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriver.C +++ b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriver.C @@ -2087,10 +2087,12 @@ Foam::vectorField Foam::snappySnapDriver::calcNearestSurface scalarField magDisp(mag(patchDisp)); + auto limits = gMinMax(magDisp); + Info<< "Wanted displacement : average:" << meshRefinement::gAverage(isPatchMasterPoint, magDisp) - << " min:" << gMin(magDisp) - << " max:" << gMax(magDisp) << endl; + << " min:" << limits.min() + << " max:" << limits.max() << endl; } } diff --git a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriver.H b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriver.H index 0ed56c89a308ce036378b473831dbad12779132c..eec7f933a88417488f7bf39cb85eb168ec347195 100644 --- a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriver.H +++ b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriver.H @@ -327,8 +327,8 @@ class snappySnapDriver ) const; void correctAttraction ( - const DynamicList<point>& surfacePoints, - const DynamicList<label>& surfaceCounts, + const UList<point>& surfacePoints, + const UList<label>& surfaceCounts, const point& edgePt, const vector& edgeNormal, // normalised normal const point& pt, @@ -504,7 +504,7 @@ class snappySnapDriver ( const point& pt, const labelList& pfPatchID, - const DynamicList<vector>& surfaceNormals, + const UList<vector>& surfaceNormals, const labelList& faceToNormalBin ) const; @@ -513,7 +513,7 @@ class snappySnapDriver ( const scalar featureCos, const vector& faceSurfaceNormal, - const DynamicList<vector>& surfaceNormals + const UList<vector>& surfaceNormals ) const; //- Determine attraction and constraints for single point diff --git a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriverFeature.C b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriverFeature.C index b4aaa38fa32860c24ab139052aec1c27ef7f54aa..6f2174af82829d287b66f9577c2595000db227b6 100644 --- a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriverFeature.C +++ b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriverFeature.C @@ -757,8 +757,8 @@ void Foam::snappySnapDriver::calcNearestFacePointProperties // and if so attracts the point to that non-dominant plane. void Foam::snappySnapDriver::correctAttraction ( - const DynamicList<point>& surfacePoints, - const DynamicList<label>& surfaceCounts, + const UList<point>& surfacePoints, + const UList<label>& surfaceCounts, const point& edgePt, const vector& edgeNormal, // normalised normal const point& pt, @@ -820,7 +820,7 @@ Foam::label Foam::snappySnapDriver::findNormal ( const scalar featureCos, const vector& n, - const DynamicList<vector>& surfaceNormals + const UList<vector>& surfaceNormals ) const { label index = -1; @@ -853,7 +853,7 @@ Foam::pointIndexHit Foam::snappySnapDriver::findMultiPatchPoint ( const point& pt, const labelList& patchIDs, - const DynamicList<vector>& surfaceNormals, + const UList<vector>& surfaceNormals, const labelList& faceToNormalBin ) const { diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C index 4d2ab16688c6f30f008f53006ce529ab9eaa3bb4..472aaff4496ad2c245aadf0eac6ef989ad85645d 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C @@ -279,37 +279,31 @@ void Foam::AMIInterpolation::normaliseWeights } } - if (output && comm != -1) + if (output && comm != -1 && returnReduceOr(wght.size(), comm)) { - // Note: change global communicator since gMin,gAverage etc don't - // support user communicator - const label oldWorldComm(UPstream::worldComm); - UPstream::worldComm = comm; + auto limits = gMinMax(wghtSum, comm); + auto avg = gAverage(wghtSum, comm); - if (returnReduceOr(wght.size())) + label nLow = + returnReduce(nLowWeight, sumOp<label>(), UPstream::msgType(), comm); + + Info.masterStream(comm) + << indent + << "AMI: Patch " << patchName + << " sum(weights)" + << " min:" << limits.min() + << " max:" << limits.max() + << " average:" << avg << nl; + + if (nLow) { Info.masterStream(comm) << indent << "AMI: Patch " << patchName - << " sum(weights)" - << " min:" << gMin(wghtSum) - << " max:" << gMax(wghtSum) - << " average:" << gAverage(wghtSum) << nl; - - const label nLow = returnReduce(nLowWeight, sumOp<label>()); - - if (nLow) - { - Info.masterStream(comm) - << indent - << "AMI: Patch " << patchName - << " identified " << nLow - << " faces with weights less than " << lowWeightTol - << endl; - } + << " identified " << nLow + << " faces with weights less than " << lowWeightTol + << endl; } - - UPstream::worldComm = oldWorldComm; } } diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/advancingFrontAMI/advancingFrontAMI.C b/src/meshTools/AMIInterpolation/AMIInterpolation/advancingFrontAMI/advancingFrontAMI.C index 9cfb1c30c6f69f70870e7e75ebdfc3df628b2d15..ae54edff67c26f41f2b9ac5815fd7141048d6dbd 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/advancingFrontAMI/advancingFrontAMI.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/advancingFrontAMI/advancingFrontAMI.C @@ -364,7 +364,7 @@ void Foam::advancingFrontAMI::appendNbrFaces ( const label facei, const primitivePatch& patch, - const DynamicList<label>& visitedFaces, + const labelUList& visitedFaces, DynamicList<label>& faceIDs ) const { diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/advancingFrontAMI/advancingFrontAMI.H b/src/meshTools/AMIInterpolation/AMIInterpolation/advancingFrontAMI/advancingFrontAMI.H index 368d61fe2a0e0b0443f94582f0ff020120e9afe8..768ec7758f0c312c5be57c9da171dd1e940e6ec2 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/advancingFrontAMI/advancingFrontAMI.H +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/advancingFrontAMI/advancingFrontAMI.H @@ -211,7 +211,7 @@ protected: ( const label facei, const primitivePatch& patch, - const DynamicList<label>& visitedFaces, + const labelUList& visitedFaces, DynamicList<label>& faceIDs ) const; diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/faceAreaWeightAMI/faceAreaWeightAMI.C b/src/meshTools/AMIInterpolation/AMIInterpolation/faceAreaWeightAMI/faceAreaWeightAMI.C index c985cdc589ec68909b83ddce75a8414e0b32ae45..c62cc19c57b94fdcd56c569e4bd6325f96962101 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/faceAreaWeightAMI/faceAreaWeightAMI.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/faceAreaWeightAMI/faceAreaWeightAMI.C @@ -63,7 +63,7 @@ namespace Foam // Write out triangulated surfaces as OBJ files OBJstream srcTriObj("srcTris_" + Foam::name(nAMI) + ".obj"); const pointField& srcPts = src.points(); - for (const DynamicList<face>& faces : srcTris_) + for (const auto& faces : srcTris_) { for (const face& f : faces) { @@ -76,7 +76,7 @@ namespace Foam OBJstream tgtTriObj("tgtTris_" + Foam::name(nAMI) + ".obj"); const pointField& tgtPts = tgt.points(); - for (const DynamicList<face>& faces : tgtTris_) + for (const auto& faces : tgtTris_) { for (const face& f : faces) { @@ -258,7 +258,7 @@ bool Foam::faceAreaWeightAMI::setNextFaces label& tgtFacei, const bitSet& mapFlag, labelList& seedFaces, - const DynamicList<label>& visitedFaces, + const labelUList& visitedFaces, const bool errorOnNotFound ) const { diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/faceAreaWeightAMI/faceAreaWeightAMI.H b/src/meshTools/AMIInterpolation/AMIInterpolation/faceAreaWeightAMI/faceAreaWeightAMI.H index 5c3d61dbd84305daabcba4ab49a9f74c03e1f859..6eac3e4133f72ee17aa35b5f4f890b89d82a9806 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/faceAreaWeightAMI/faceAreaWeightAMI.H +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/faceAreaWeightAMI/faceAreaWeightAMI.H @@ -118,7 +118,7 @@ protected: label& tgtFacei, const bitSet& mapFlag, labelList& seedFaces, - const DynamicList<label>& visitedFaces, + const labelUList& visitedFaces, const bool errorOnNotFound = true ) const; diff --git a/src/meshTools/AMIInterpolation/GAMG/interfaceFields/cyclicACMIGAMGInterfaceField/cyclicACMIGAMGInterfaceField.C b/src/meshTools/AMIInterpolation/GAMG/interfaceFields/cyclicACMIGAMGInterfaceField/cyclicACMIGAMGInterfaceField.C index 6a68693944d345438e14c630e0ecadcfc9eb954c..0d1cc1f1d797a462cf88b21144b3b0a91fe7c349 100644 --- a/src/meshTools/AMIInterpolation/GAMG/interfaceFields/cyclicACMIGAMGInterfaceField/cyclicACMIGAMGInterfaceField.C +++ b/src/meshTools/AMIInterpolation/GAMG/interfaceFields/cyclicACMIGAMGInterfaceField/cyclicACMIGAMGInterfaceField.C @@ -202,7 +202,7 @@ void Foam::cyclicACMIGAMGInterfaceField::initInterfaceMatrixUpdate } // Get neighbouring field - const labelList& nbrFaceCells = + const labelUList& nbrFaceCells = lduAddr.patchAddr(cyclicACMIInterface_.neighbPatchID()); solveScalarField pnf(psiInternal, nbrFaceCells); @@ -315,7 +315,7 @@ void Foam::cyclicACMIGAMGInterfaceField::updateInterfaceMatrix else { // Get neighbouring field - const labelList& nbrFaceCells = + const labelUList& nbrFaceCells = lduAddr.patchAddr(cyclicACMIInterface_.neighbPatchID()); solveScalarField pnf(psiInternal, nbrFaceCells); diff --git a/src/meshTools/AMIInterpolation/GAMG/interfaceFields/cyclicAMIGAMGInterfaceField/cyclicAMIGAMGInterfaceField.C b/src/meshTools/AMIInterpolation/GAMG/interfaceFields/cyclicAMIGAMGInterfaceField/cyclicAMIGAMGInterfaceField.C index da63d6a0e94d766bb6c7a4c551a79806e0d1eb40..ee07f27441041089b212b495399a5e4f371219e3 100644 --- a/src/meshTools/AMIInterpolation/GAMG/interfaceFields/cyclicAMIGAMGInterfaceField/cyclicAMIGAMGInterfaceField.C +++ b/src/meshTools/AMIInterpolation/GAMG/interfaceFields/cyclicAMIGAMGInterfaceField/cyclicAMIGAMGInterfaceField.C @@ -203,7 +203,7 @@ void Foam::cyclicAMIGAMGInterfaceField::initInterfaceMatrixUpdate } // Get neighbouring field - const labelList& nbrFaceCells = + const labelUList& nbrFaceCells = lduAddr.patchAddr(cyclicAMIInterface_.neighbPatchID()); solveScalarField pnf(psiInternal, nbrFaceCells); @@ -329,7 +329,7 @@ void Foam::cyclicAMIGAMGInterfaceField::updateInterfaceMatrix else { // Get neighbouring field - const labelList& nbrFaceCells = + const labelUList& nbrFaceCells = lduAddr.patchAddr(cyclicAMIInterface_.neighbPatchID()); solveScalarField work(psiInternal, nbrFaceCells); diff --git a/src/meshTools/AMIInterpolation/faceAreaIntersect/faceAreaIntersect.H b/src/meshTools/AMIInterpolation/faceAreaIntersect/faceAreaIntersect.H index 7a45177352ebc39ab7fd6487b21cd885a50121c6..8c2cba4148979f6c52201debde9306babc6339bd 100644 --- a/src/meshTools/AMIInterpolation/faceAreaIntersect/faceAreaIntersect.H +++ b/src/meshTools/AMIInterpolation/faceAreaIntersect/faceAreaIntersect.H @@ -188,10 +188,16 @@ public: inline bool cacheTriangulation() const; //- Const access to the triangulation - inline const DynamicList<triPoints> triangles() const; + const DynamicList<triPoints>& triangles() const noexcept + { + return triangles_; + } //- Non-const access to the triangulation - inline DynamicList<triPoints>& triangles(); + DynamicList<triPoints>& triangles() noexcept + { + return triangles_; + } //- Decompose face into triangle fan static inline void triangleFan diff --git a/src/meshTools/AMIInterpolation/faceAreaIntersect/faceAreaIntersectI.H b/src/meshTools/AMIInterpolation/faceAreaIntersect/faceAreaIntersectI.H index 7541b14141cff5feace46313a2f501be49e59d21..e78cf0281ff44fbfc59af8ba0a83893931fd7e99 100644 --- a/src/meshTools/AMIInterpolation/faceAreaIntersect/faceAreaIntersectI.H +++ b/src/meshTools/AMIInterpolation/faceAreaIntersect/faceAreaIntersectI.H @@ -121,17 +121,4 @@ bool Foam::faceAreaIntersect::cacheTriangulation() const } -const Foam::DynamicList<Foam::triPoints> -Foam::faceAreaIntersect::triangles() const -{ - return triangles_; -} - - -Foam::DynamicList<Foam::triPoints>& Foam::faceAreaIntersect::triangles() -{ - return triangles_; -} - - // ************************************************************************* // diff --git a/src/meshTools/AMIInterpolation/patches/cyclicPeriodicAMI/cyclicPeriodicAMIPolyPatch/cyclicPeriodicAMIPolyPatch.C b/src/meshTools/AMIInterpolation/patches/cyclicPeriodicAMI/cyclicPeriodicAMIPolyPatch/cyclicPeriodicAMIPolyPatch.C index 410a797230c29ecc9a28d51f67fa250b83a3237a..6aba9c7b533c888b46e1af29ca66e1ec8ae3b5af 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicPeriodicAMI/cyclicPeriodicAMIPolyPatch/cyclicPeriodicAMIPolyPatch.C +++ b/src/meshTools/AMIInterpolation/patches/cyclicPeriodicAMI/cyclicPeriodicAMIPolyPatch/cyclicPeriodicAMIPolyPatch.C @@ -513,18 +513,29 @@ void Foam::cyclicPeriodicAMIPolyPatch::resetAMI() const tgtWghtSum[faceI] = sum(AMIPtr_->tgtWeights()[faceI]); } - Info<< indent - << "AMI: Patch " << name() - << " sum(weights)" - << " min:" << gMin(srcWghtSum) - << " max:" << gMax(srcWghtSum) - << " average:" << gAverage(srcWghtSum) << nl; - Info<< indent - << "AMI: Patch " << neighbPatch().name() - << " sum(weights)" - << " min:" << gMin(tgtWghtSum) - << " max:" << gMax(tgtWghtSum) - << " average:" << gAverage(tgtWghtSum) << nl; + { + auto limits = gMinMax(srcWghtSum); + auto avg = gAverage(srcWghtSum); + + Info<< indent + << "AMI: Patch " << name() + << " sum(weights)" + << " min:" << limits.min() + << " max:" << limits.max() + << " average:" << avg << nl; + } + + { + auto limits = gMinMax(tgtWghtSum); + auto avg = gAverage(tgtWghtSum); + + Info<< indent + << "AMI: Patch " << neighbPatch().name() + << " sum(weights)" + << " min:" << limits.min() + << " max:" << limits.max() + << " average:" << avg << nl; + } } } } diff --git a/src/meshTools/PatchFunction1/MappedFile/MappedFile.C b/src/meshTools/PatchFunction1/MappedFile/MappedFile.C index ef0856fe7bb7a4577615b968777a3121402e1934..2e6adb35f5403d6a04a9f5cc24e93ed679ed79ef 100644 --- a/src/meshTools/PatchFunction1/MappedFile/MappedFile.C +++ b/src/meshTools/PatchFunction1/MappedFile/MappedFile.C @@ -747,9 +747,13 @@ Foam::PatchFunction1Types::MappedFile<Type>::value if (debug) { - Pout<< "MappedFile<Type>::value : set fixedValue to min:" << gMin(fld) - << " max:" << gMax(fld) - << " avg:" << gAverage(fld) << endl; + auto limits = gMinMax(fld); + auto avg = gAverage(fld); + + Pout<< "MappedFile<Type>::value : set fixedValue to min:" + << limits.min() + << " max:" << limits.max() + << " avg:" << avg << endl; } return this->transform(tfld); diff --git a/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointBoundaryCondition/adjointBoundaryCondition.C b/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointBoundaryCondition/adjointBoundaryCondition.C index d7f399de4fc397739b49851c9c9a2f6f6e6bb491..9b100aaa45d767b22ff0b34291dd3ba4285b51dc 100644 --- a/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointBoundaryCondition/adjointBoundaryCondition.C +++ b/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointBoundaryCondition/adjointBoundaryCondition.C @@ -54,7 +54,7 @@ adjointBoundaryCondition<Type>::computePatchGrad(word name) auto tresGrad = tmp<Field<GradType>>::New(patch_.size(), Zero); auto& resGrad = tresGrad.ref(); - const labelList& faceCells = patch_.faceCells(); + const labelUList& faceCells = patch_.faceCells(); const fvMesh& mesh = patch_.boundaryMesh().mesh(); const cellList& cells = mesh.cells(); diff --git a/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointOutletVelocityFlux/adjointOutletVelocityFluxFvPatchVectorField.C b/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointOutletVelocityFlux/adjointOutletVelocityFluxFvPatchVectorField.C index 597cc61d62c540ef82694604b7599f8f36e231dc..8c37685b96015ec75f37ef815dfbe91e81ae8eee 100644 --- a/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointOutletVelocityFlux/adjointOutletVelocityFluxFvPatchVectorField.C +++ b/src/optimisation/adjointOptimisation/adjoint/adjointBoundaryConditions/adjointOutletVelocityFlux/adjointOutletVelocityFluxFvPatchVectorField.C @@ -101,7 +101,7 @@ void Foam::adjointOutletVelocityFluxFvPatchVectorField::manipulateMatrix ); vectorField& source = matrix.source(); const vectorField& Sf = patch().Sf(); - const labelList& faceCells = patch().faceCells(); + const labelUList& faceCells = patch().faceCells(); const scalarField& magSf = patch().magSf(); tmp<vectorField> tvelocitySource(boundaryContrPtr_->velocitySource()); const vectorField& velocitySource = tvelocitySource(); diff --git a/src/optimisation/adjointOptimisation/adjoint/finiteVolume/interpolation/surfaceInterpolation/schemes/limitedSchemes/linearUpwindNormal/linearUpwindNormal.C b/src/optimisation/adjointOptimisation/adjoint/finiteVolume/interpolation/surfaceInterpolation/schemes/limitedSchemes/linearUpwindNormal/linearUpwindNormal.C index 86f201430fe907a86fb6c152b9ecd55ac7c0dd9a..51f7f27f5fb29884a67d74bdd5955a2b1b01d84b 100644 --- a/src/optimisation/adjointOptimisation/adjoint/finiteVolume/interpolation/surfaceInterpolation/schemes/limitedSchemes/linearUpwindNormal/linearUpwindNormal.C +++ b/src/optimisation/adjointOptimisation/adjoint/finiteVolume/interpolation/surfaceInterpolation/schemes/limitedSchemes/linearUpwindNormal/linearUpwindNormal.C @@ -63,8 +63,8 @@ Foam::linearUpwindNormal<Type>::correction const surfaceScalarField& faceFlux = this->faceFlux_; - const labelList& owner = mesh.owner(); - const labelList& neighbour = mesh.neighbour(); + const auto& owner = mesh.owner(); + const auto& neighbour = mesh.neighbour(); const volVectorField& C = mesh.C(); const surfaceVectorField& Cf = mesh.Cf(); diff --git a/src/optimisation/adjointOptimisation/adjoint/optimisation/designVariables/topODesignVariables/regularisation/regularisationPDE/Helmoltz/Helmholtz.C b/src/optimisation/adjointOptimisation/adjoint/optimisation/designVariables/topODesignVariables/regularisation/regularisationPDE/Helmoltz/Helmholtz.C index 39980eece8be7cd14354275fde532050dc0f6664..ced36121cb08a7337352a78fc0a4302b5b436b4a 100644 --- a/src/optimisation/adjointOptimisation/adjoint/optimisation/designVariables/topODesignVariables/regularisation/regularisationPDE/Helmoltz/Helmholtz.C +++ b/src/optimisation/adjointOptimisation/adjoint/optimisation/designVariables/topODesignVariables/regularisation/regularisationPDE/Helmoltz/Helmholtz.C @@ -231,7 +231,7 @@ void Foam::Helmholtz::regularise ); // Map result back to original field result.rmap(resultSub, cellMap); - Info<< "min max " << gMin(result) << " " << gMax(result) << endl; + Info<< "min max " << gMinMax(result) << endl; return; } } diff --git a/src/optimisation/adjointOptimisation/adjoint/optimisation/designVariables/topODesignVariables/topODesignVariables.C b/src/optimisation/adjointOptimisation/adjoint/optimisation/designVariables/topODesignVariables/topODesignVariables.C index 6af1794f14ef561e20e15373d5f4be97453fd271..f4263cdbfa7630af0bc68464438fdac94d3bc26f 100644 --- a/src/optimisation/adjointOptimisation/adjoint/optimisation/designVariables/topODesignVariables/topODesignVariables.C +++ b/src/optimisation/adjointOptimisation/adjoint/optimisation/designVariables/topODesignVariables/topODesignVariables.C @@ -268,11 +268,7 @@ void Foam::topODesignVariables::initialize() { if (isA<wallFvPatch>(patch)) { - const labelList& faceCells = patch.faceCells(); - forAll(faceCells, cI) - { - alpha[faceCells[cI]] = 1.; - } + UIndirectList<scalar>(alpha, patch.faceCells()) = 1; } } } diff --git a/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/adjointSpalartAllmaras/adjointSpalartAllmaras.C b/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/adjointSpalartAllmaras/adjointSpalartAllmaras.C index 72bf06a488758b3aae7a28111cfc9ecbb41af5d8..3ca8d35f8f5db969686b835e094a2a4772edb671 100644 --- a/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/adjointSpalartAllmaras/adjointSpalartAllmaras.C +++ b/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/adjointSpalartAllmaras/adjointSpalartAllmaras.C @@ -907,7 +907,7 @@ tmp<volScalarField> adjointSpalartAllmaras::distanceSensitivities() const scalarField rt(tsource() & tf); const scalarField Uap_t(Uap & tf); - const labelList& faceCells = patch.faceCells(); + const labelUList& faceCells = patch.faceCells(); forAll(faceCells, faceI) { label cellI = faceCells[faceI]; diff --git a/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/adjointkOmegaSST/adjointkOmegaSST.C b/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/adjointkOmegaSST/adjointkOmegaSST.C index e04e223705972935db61a76f08f64c5beb0307ac..8ec6ae59d77615f07e45cd2dcdfcf617d328bec6 100644 --- a/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/adjointkOmegaSST/adjointkOmegaSST.C +++ b/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/adjointkOmegaSST/adjointkOmegaSST.C @@ -142,7 +142,7 @@ tmp<volScalarField> adjointkOmegaSST::zeroFirstCell() if (isA<omegaWallFunctionFvPatchScalarField>(omegab)) { const label patchi = patch.index(); - const labelList& faceCells = patch.faceCells(); + const labelUList& faceCells = patch.faceCells(); fvPatchScalarField& bf = zeroFirstCell.boundaryFieldRef()[patchi]; forAll(faceCells, faceI) { @@ -180,7 +180,7 @@ tmp<volScalarField> adjointkOmegaSST::dR_dnut() { const fvPatch& patch = mesh_.boundary()[pI]; const fvPatchScalarField& nutb = nutRef().boundaryField()[pI]; - const labelList& faceCells = patch.faceCells(); + const labelUList& faceCells = patch.faceCells(); if (isA<nutkWallFunctionFvPatchScalarField>(nutb)) { fvPatchScalarField& bf = dRdnut.boundaryFieldRef()[pI]; @@ -716,7 +716,7 @@ tmp<volScalarField> adjointkOmegaSST::dNutdbMult dev2(gradU_.boundaryField()[pI].patchInternalField()) ); const vectorField& Sfb = Sf.boundaryField()[pI]; - const labelList& faceCells = mesh_.boundary()[pI].faceCells(); + const labelUList& faceCells = mesh_.boundary()[pI].faceCells(); forAll(faceCells, fI) { const label celli = faceCells[fI]; @@ -969,7 +969,7 @@ void adjointkOmegaSST::addWallFunctionTerms const scalar Cmu25 = pow025(Cmu); - const labelList& faceCells = patch.faceCells(); + const labelUList& faceCells = patch.faceCells(); const fvPatchScalarField& dR_dnutw = dR_dnut.boundaryField()[patchi]; const fvPatchScalarField& omegaw = omega.boundaryField()[patchi]; @@ -1845,7 +1845,7 @@ tmp<fvVectorMatrix> adjointkOmegaSST::divDevReff(volVectorField& Ua) const const fvPatchScalarField& nuEffb = nuEff.boundaryField()[pI]; const vectorField nf = mesh_.boundary()[pI].nf(); const vectorField Uai = Ua.boundaryField()[pI].patchInternalField(); - const labelList& faceCells = mesh_.boundary()[pI].faceCells(); + const labelUList& faceCells = mesh_.boundary()[pI].faceCells(); const vectorField& Sfb = Sf.boundaryField()[pI]; forAll(faceCells, fI) @@ -1989,7 +1989,7 @@ tmp<volVectorField> adjointkOmegaSST::adjointMeanFlowSource() const scalar kappa = wallCoeffs.kappa(); const scalar Cmu25 = pow025(Cmu); - const labelList& faceCells = patch.faceCells(); + const labelUList& faceCells = patch.faceCells(); const fvPatchVectorField& Uw = primalVars_.U().boundaryField()[patchi]; diff --git a/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/derivedFvPatchFields/kaqRWallFunction/kaqRWallFunctionFvPatchScalarField.C b/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/derivedFvPatchFields/kaqRWallFunction/kaqRWallFunctionFvPatchScalarField.C index 0057310ad04869c4d649ce962bee1ac74c462f5a..8a9cd5eb44cd194b6ecb721b64be6d1dcbc27236 100644 --- a/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/derivedFvPatchFields/kaqRWallFunction/kaqRWallFunctionFvPatchScalarField.C +++ b/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/derivedFvPatchFields/kaqRWallFunction/kaqRWallFunctionFvPatchScalarField.C @@ -124,7 +124,7 @@ void Foam::kaqRWallFunctionFvPatchScalarField::manipulateMatrix const scalar Cmu25 = pow025(Cmu); - const labelList& faceCells = patch().faceCells(); + const labelUList& faceCells = patch().faceCells(); const fvPatchVectorField& Uw = boundaryContrPtr_->Ub(); const scalarField magGradUw(mag(Uw.snGrad())); diff --git a/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/derivedFvPatchFields/waWallFunction/waWallFunctionFvPatchScalarField.C b/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/derivedFvPatchFields/waWallFunction/waWallFunctionFvPatchScalarField.C index a3dc8d51c8723f2de06af821de35af032cafac54..6203105c77d8ec65aaad72f2f156a431c2cf29ad 100644 --- a/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/derivedFvPatchFields/waWallFunction/waWallFunctionFvPatchScalarField.C +++ b/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/derivedFvPatchFields/waWallFunction/waWallFunctionFvPatchScalarField.C @@ -136,7 +136,7 @@ void waWallFunctionFvPatchScalarField::manipulateMatrix FieldField<Field, scalar>& internalCoeffs = matrix.internalCoeffs(); FieldField<Field, scalar>& boundaryCoeffs = matrix.boundaryCoeffs(); const fvMesh& mesh = patch().boundaryMesh().mesh(); - const labelList& faceCells = patch().faceCells(); + const labelUList& faceCells = patch().faceCells(); // Add diag term from the omega expression next to the wall for (const label celli : faceCells) diff --git a/src/overset/cellCellStencil/cellCellStencil/cellCellStencil.C b/src/overset/cellCellStencil/cellCellStencil/cellCellStencil.C index f5f3522932dfc8f02c3237b89d3579a7e8141ad4..a19f48171af80076a73d484a56f2eabea64a95b7 100644 --- a/src/overset/cellCellStencil/cellCellStencil/cellCellStencil.C +++ b/src/overset/cellCellStencil/cellCellStencil/cellCellStencil.C @@ -423,7 +423,7 @@ void Foam::cellCellStencil::setUpFrontOnOversetPatch { if (isA<oversetFvPatch>(fvm[patchi])) { - const labelList& fc = fvm[patchi].faceCells(); + const labelUList& fc = fvm[patchi].faceCells(); forAll(fc, i) { const label celli = fc[i]; diff --git a/src/overset/cellCellStencil/cellCellStencil/cellCellStencilTemplates.C b/src/overset/cellCellStencil/cellCellStencil/cellCellStencilTemplates.C index f110df646323b6ec8edfdf52b1d987708976f99c..a93838a462986267b87a3c982b3dee2118bf023c 100644 --- a/src/overset/cellCellStencil/cellCellStencil/cellCellStencilTemplates.C +++ b/src/overset/cellCellStencil/cellCellStencil/cellCellStencilTemplates.C @@ -46,7 +46,7 @@ void Foam::cellCellStencil::interpolate } const mapDistribute& map = overlap.cellInterpolationMap(); - const labelList& cellIDs = overlap.interpolationCells(); + const labelUList& cellIDs = overlap.interpolationCells(); const scalarList& factor = overlap.cellInterpolationWeight(); Field<T> work(psi); diff --git a/src/overset/cellCellStencil/cellVolumeWeight/cellVolumeWeightCellCellStencil.C b/src/overset/cellCellStencil/cellVolumeWeight/cellVolumeWeightCellCellStencil.C index 602d31b07523501704673f08e2961ce73cf5cf57..892e2f652fc5eb84955672dda96af0b3a14517bf 100644 --- a/src/overset/cellCellStencil/cellVolumeWeight/cellVolumeWeightCellCellStencil.C +++ b/src/overset/cellCellStencil/cellVolumeWeight/cellVolumeWeightCellCellStencil.C @@ -197,16 +197,15 @@ void Foam::cellCellStencils::cellVolumeWeight::findHoles //Pout<< "Proper patch " << fvp.name() << " of type " << fvp.type() // << endl; - const labelList& fc = fvp.faceCells(); - forAll(fc, i) + for (const label celli : fvp.faceCells()) { - label regionI = cellRegion[fc[i]]; + label regionI = cellRegion[celli]; - if (cellTypes[fc[i]] != HOLE && regionType[regionI] != 2) + if (cellTypes[celli] != HOLE && regionType[regionI] != 2) { //Pout<< "reachable region : " << regionI - // << " at cell " << mesh.cellCentres()[fc[i]] - // << " on zone " << zoneID[fc[i]] << endl; + // << " at cell " << mesh.cellCentres()[celli] + // << " on zone " << zoneID[celli] << endl; regionType[regionI] = 2; } } @@ -301,7 +300,7 @@ void Foam::cellCellStencils::cellVolumeWeight::markPatchCells forAll(pbm, patchI) { const fvPatch& fvp = pbm[patchI]; - const labelList& fc = fvp.faceCells(); + const labelUList& fc = fvp.faceCells(); if (isA<oversetFvPatch>(fvp)) { diff --git a/src/overset/cellCellStencil/inverseDistance/inverseDistanceCellCellStencil.C b/src/overset/cellCellStencil/inverseDistance/inverseDistanceCellCellStencil.C index c09703ec5478dacba0ff170a5d955efa485f37f0..c416d825d610513700862e2dcd21d581868e37e2 100644 --- a/src/overset/cellCellStencil/inverseDistance/inverseDistanceCellCellStencil.C +++ b/src/overset/cellCellStencil/inverseDistance/inverseDistanceCellCellStencil.C @@ -181,7 +181,7 @@ void Foam::cellCellStencils::inverseDistance::markBoundaries forAll(pbm, patchI) { const fvPatch& fvp = pbm[patchI]; - const labelList& fc = fvp.faceCells(); + const labelUList& fc = fvp.faceCells(); if (!fvPatch::constraintType(fvp.type())) { @@ -209,7 +209,7 @@ void Foam::cellCellStencils::inverseDistance::markBoundaries forAll(pbm, patchI) { const fvPatch& fvp = pbm[patchI]; - const labelList& fc = fvp.faceCells(); + const labelUList& fc = fvp.faceCells(); if (isA<oversetFvPatch>(fvp)) { @@ -1074,12 +1074,11 @@ void Foam::cellCellStencils::inverseDistance::findHoles {} else if (!fvPatch::constraintType(fvp.type())) { - const labelList& fc = fvp.faceCells(); - forAll(fc, i) + for (const label celli : fvp.faceCells()) { - label regionI = cellRegion[fc[i]]; + label regionI = cellRegion[celli]; - if (cellTypes[fc[i]] != HOLE && regionType[regionI] != 2) + if (cellTypes[celli] != HOLE && regionType[regionI] != 2) { regionType[regionI] = 2; } diff --git a/src/overset/cellCellStencil/trackingInverseDistance/trackingInverseDistanceCellCellStencil.C b/src/overset/cellCellStencil/trackingInverseDistance/trackingInverseDistanceCellCellStencil.C index 07f3c25436206b5cef9da23c030200f215a306a7..815d7d701e8b70556496c282b7527eb6afb73719 100644 --- a/src/overset/cellCellStencil/trackingInverseDistance/trackingInverseDistanceCellCellStencil.C +++ b/src/overset/cellCellStencil/trackingInverseDistance/trackingInverseDistanceCellCellStencil.C @@ -77,7 +77,7 @@ bool Foam::cellCellStencils::trackingInverseDistance::markBoundaries forAll(pbm, patchi) { const fvPatch& fvp = pbm[patchi]; - const labelList& fc = fvp.faceCells(); + const labelUList& fc = fvp.faceCells(); if (!fvPatch::constraintType(fvp.type())) { @@ -112,7 +112,7 @@ bool Foam::cellCellStencils::trackingInverseDistance::markBoundaries forAll(pbm, patchi) { const fvPatch& fvp = pbm[patchi]; - const labelList& fc = fvp.faceCells(); + const labelUList& fc = fvp.faceCells(); if (isA<oversetFvPatch>(fvp)) { diff --git a/src/overset/include/setCellMask.H b/src/overset/include/setCellMask.H index 0e65bd585ab4e0ba0145224eb5242b6a67b2519d..850e87267a583a75fe8894750003c79c5d01e565 100644 --- a/src/overset/include/setCellMask.H +++ b/src/overset/include/setCellMask.H @@ -30,7 +30,7 @@ Description { const cellCellStencilObject& overlap = Stencil::New(mesh); - const labelList& cellTypes = overlap.cellTypes(); + const labelUList& cellTypes = overlap.cellTypes(); cellMask.primitiveFieldRef() = 1.0; forAll(cellMask, cellI) diff --git a/src/overset/include/setInterpolatedCells.H b/src/overset/include/setInterpolatedCells.H index 6e42e2c795a506f69235be00d886e41986f72636..d45585ec8e90bff2f9122c58f2e1f1c4f8ee3802 100644 --- a/src/overset/include/setInterpolatedCells.H +++ b/src/overset/include/setInterpolatedCells.H @@ -30,7 +30,7 @@ Description { const cellCellStencilObject& overlap = Stencil::New(mesh); - const labelList& cellTypes = overlap.cellTypes(); + const labelUList& cellTypes = overlap.cellTypes(); interpolatedCells.primitiveFieldRef() = 1.0; forAll(cellMask, cellI) diff --git a/src/overset/oversetAdjustPhi/oversetAdjustPhi.C b/src/overset/oversetAdjustPhi/oversetAdjustPhi.C index 4b858ab40c6ea91b74550edb48692b80ccda3bbe..f98de6d741aab166d0a74254c39a054d6fd14d66 100644 --- a/src/overset/oversetAdjustPhi/oversetAdjustPhi.C +++ b/src/overset/oversetAdjustPhi/oversetAdjustPhi.C @@ -43,8 +43,8 @@ bool Foam::oversetAdjustPhi { const fvMesh& mesh = U.mesh(); const cellCellStencilObject& overlap = Stencil::New(mesh); - const labelList& cellTypes = overlap.cellTypes(); - const labelList& zoneID = overlap.zoneID(); + const labelUList& cellTypes = overlap.cellTypes(); + const labelUList& zoneID = overlap.zoneID(); // Pass1: accumulate all fluxes, calculate correction factor diff --git a/src/overset/oversetFvMesh/oversetFvMeshBase.C b/src/overset/oversetFvMesh/oversetFvMeshBase.C index 9d8571dc4370c042a5bdf30a01a655a222ef3851..08883c1617c37a082a1d84f4ebb75a716197a68d 100644 --- a/src/overset/oversetFvMesh/oversetFvMeshBase.C +++ b/src/overset/oversetFvMesh/oversetFvMeshBase.C @@ -359,8 +359,8 @@ bool Foam::oversetFvMeshBase::updateAddressing() const Foam::scalar Foam::oversetFvMeshBase::cellAverage ( - const labelList& types, - const labelList& nbrTypes, + const labelUList& types, + const labelUList& nbrTypes, const scalarField& norm, const scalarField& nbrNorm, const label celli, diff --git a/src/overset/oversetFvMesh/oversetFvMeshBase.H b/src/overset/oversetFvMesh/oversetFvMeshBase.H index 04530c4da50b818b822fcbaf310514cab401ded7..9f0c2aa2275241191dcaf760ad64f4f3ad9bb255 100644 --- a/src/overset/oversetFvMesh/oversetFvMeshBase.H +++ b/src/overset/oversetFvMesh/oversetFvMeshBase.H @@ -142,8 +142,8 @@ protected: //- Average norm of valid neighbours scalar cellAverage ( - const labelList& types, - const labelList& nbrTypes, + const labelUList& types, + const labelUList& nbrTypes, const scalarField& norm, const scalarField& nbrNorm, const label celli, diff --git a/src/overset/oversetPolyPatch/oversetFvPatchField.C b/src/overset/oversetPolyPatch/oversetFvPatchField.C index 1ab511b730d0ca29c61e99f939b57cd34b17a199..1d23d779c4d4d9c5207075d7375739bd19956e92 100644 --- a/src/overset/oversetPolyPatch/oversetFvPatchField.C +++ b/src/overset/oversetPolyPatch/oversetFvPatchField.C @@ -168,8 +168,8 @@ void Foam::oversetFvPatchField<Type>::storeFringeCoefficients const fvMesh& mesh = this->internalField().mesh(); const cellCellStencilObject& overlap = Stencil::New(mesh); - const labelList& cellTypes = overlap.cellTypes(); - const labelList& zoneID = overlap.zoneID(); + const labelUList& cellTypes = overlap.cellTypes(); + const labelUList& zoneID = overlap.zoneID(); const labelUList& own = mesh.owner(); const labelUList& nei = mesh.neighbour(); @@ -345,8 +345,8 @@ void Foam::oversetFvPatchField<Type>::fringeFlux { const fvMesh& mesh = this->internalField().mesh(); const cellCellStencilObject& overlap = Stencil::New(mesh); - const labelList& cellTypes = overlap.cellTypes(); - const labelList& zoneID = overlap.zoneID(); + const labelUList& cellTypes = overlap.cellTypes(); + const labelUList& zoneID = overlap.zoneID(); // Check all faces on the outside of interpolated cells const labelUList& own = mesh.owner(); @@ -421,8 +421,8 @@ void Foam::oversetFvPatchField<Type>::adjustPsi const fvMesh& mesh = this->internalField().mesh(); const cellCellStencilObject& overlap = Stencil::New(mesh); - const labelList& cellTypes = overlap.cellTypes(); - const labelList& zoneID = overlap.zoneID(); + const labelUList& cellTypes = overlap.cellTypes(); + const labelUList& zoneID = overlap.zoneID(); // Pass-1: accumulate all fluxes, calculate correction factor diff --git a/src/parallel/decompose/faDecompose/faMeshDecomposition.C b/src/parallel/decompose/faDecompose/faMeshDecomposition.C index 006b556e5ad23416aebd13c46aea9d09716a9eeb..ff97ec03fda3a0ba74371a962fd4ee91257617ce 100644 --- a/src/parallel/decompose/faDecompose/faMeshDecomposition.C +++ b/src/parallel/decompose/faDecompose/faMeshDecomposition.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2016-2017 Wikki Ltd - Copyright (C) 2018-2024 OpenCFD Ltd. + Copyright (C) 2018-2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -85,7 +85,8 @@ void Foam::faMeshDecomposition::distributeFaces() ioAddr.rename("faceProcAddressing"); labelIOList fvFaceProcAddressing(ioAddr); - labelHashSet faceProcAddressingHash(2*fvFaceProcAddressing.size()); + labelHashSet faceProcAddressingHash; + faceProcAddressingHash.reserve(fvFaceProcAddressing.size()); // If faMesh's fvPatch is a part of the global face zones, faces of that // patch will be present on all processors. Because of that, looping @@ -941,10 +942,8 @@ void Foam::faMeshDecomposition::decomposeMesh() // Globally shared points are the ones used by more than 2 processors // Size the list approximately and gather the points - labelHashSet gSharedPoints - ( - min(100, nPoints()/1000) - ); + labelHashSet gSharedPoints; + gSharedPoints.reserve(Foam::min(128, nPoints()/1000)); // Loop through all the processors and mark up points used by // processor boundaries. When a point is used twice, it is a @@ -1318,19 +1317,19 @@ bool Foam::faMeshDecomposition::writeDecomposition() // pointProcAddressing ioAddr.rename("pointProcAddressing"); - IOListRef<label>(ioAddr, procPatchPointAddressing_[procI]).write(); + IOList<label>::writeContents(ioAddr, procPatchPointAddressing_[procI]); // edgeProcAddressing ioAddr.rename("edgeProcAddressing"); - IOListRef<label>(ioAddr, procEdgeAddressing_[procI]).write(); + IOList<label>::writeContents(ioAddr, procEdgeAddressing_[procI]); // faceProcAddressing ioAddr.rename("faceProcAddressing"); - IOListRef<label>(ioAddr, procFaceAddressing_[procI]).write(); + IOList<label>::writeContents(ioAddr, procFaceAddressing_[procI]); // boundaryProcAddressing ioAddr.rename("boundaryProcAddressing"); - IOListRef<label>(ioAddr, procBoundaryAddressing_[procI]).write(); + IOList<label>::writeContents(ioAddr, procBoundaryAddressing_[procI]); } diff --git a/src/parallel/reconstruct/faReconstruct/faMeshReconstructor.C b/src/parallel/reconstruct/faReconstruct/faMeshReconstructor.C index 4f6002839daaa65b878d04f1c45097cf39da0a39..8786ffb39556f73d520f3499d76fa6c0c81a7b1d 100644 --- a/src/parallel/reconstruct/faReconstruct/faMeshReconstructor.C +++ b/src/parallel/reconstruct/faReconstruct/faMeshReconstructor.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2021-2024 OpenCFD Ltd. + Copyright (C) 2021-2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -693,19 +693,19 @@ void Foam::faMeshReconstructor::writeAddressing // boundaryProcAddressing ioAddr.rename("boundaryProcAddressing"); - IOListRef<label>(ioAddr, faBoundaryProcAddr).write(); + IOList<label>::writeContents(ioAddr, faBoundaryProcAddr); // faceProcAddressing ioAddr.rename("faceProcAddressing"); - IOListRef<label>(ioAddr, faFaceProcAddr).write(); + IOList<label>::writeContents(ioAddr, faFaceProcAddr); // pointProcAddressing ioAddr.rename("pointProcAddressing"); - IOListRef<label>(ioAddr, faPointProcAddr).write(); + IOList<label>::writeContents(ioAddr, faPointProcAddr); // edgeProcAddressing ioAddr.rename("edgeProcAddressing"); - IOListRef<label>(ioAddr, faEdgeProcAddr).write(); + IOList<label>::writeContents(ioAddr, faEdgeProcAddr); } @@ -760,7 +760,7 @@ void Foam::faMeshReconstructor::writeMesh IOobject io(fullMesh.boundary()); io.rename("faceLabels"); - IOListRef<label>(io, singlePatchFaceLabels).write(); + IOList<label>::writeContents(io, singlePatchFaceLabels); fullMesh.boundary().write(); diff --git a/src/phaseSystemModels/reactingEuler/multiphaseSystem/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.C b/src/phaseSystemModels/reactingEuler/multiphaseSystem/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.C index e3a2be4b9ab3e2f4e0cfe420978722f177ddf985..ac4ee7ca4c14d9b4f990cba8e3c9e56682a36b2d 100644 --- a/src/phaseSystemModels/reactingEuler/multiphaseSystem/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.C +++ b/src/phaseSystemModels/reactingEuler/multiphaseSystem/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.C @@ -430,21 +430,29 @@ Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::correctInterfaceThermo() Tf = (H1*T1 + H2*T2 + iDmdtNew*L)/(H1 + H2); - Info<< "Tf." << pair.name() - << ": min = " << gMin(Tf.primitiveField()) - << ", mean = " << gAverage(Tf.primitiveField()) - << ", max = " << gMax(Tf.primitiveField()) - << endl; + { + auto limits = gMinMax(Tf.primitiveField()); + auto avg = gAverage(Tf.primitiveField()); + + Info<< "Tf." << pair.name() + << ": min = " << limits.min() + << ", mean = " << avg + << ", max = " << limits.max() + << endl; + } scalar iDmdtRelax(this->mesh().fieldRelaxationFactor("iDmdt")); iDmdt = (1 - iDmdtRelax)*iDmdt + iDmdtRelax*iDmdtNew; if (phaseChange_) { + auto limits = gMinMax(iDmdt.primitiveField()); + auto avg = gAverage(iDmdt.primitiveField()); + Info<< "iDmdt." << pair.name() - << ": min = " << gMin(iDmdt.primitiveField()) - << ", mean = " << gAverage(iDmdt.primitiveField()) - << ", max = " << gMax(iDmdt.primitiveField()) + << ": min = " << limits.min() + << ", mean = " << avg + << ", max = " << limits.max() << ", integral = " << fvc::domainIntegrate(iDmdt).value() << endl; } @@ -525,10 +533,13 @@ Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::correctInterfaceThermo() if (wallBoilingActive) { + auto limits = gMinMax(wDmdt.primitiveField()); + auto avg = gAverage(wDmdt.primitiveField()); + Info<< "wDmdt." << pair.name() - << ": min = " << gMin(wDmdt.primitiveField()) - << ", mean = " << gAverage(wDmdt.primitiveField()) - << ", max = " << gMax(wDmdt.primitiveField()) + << ": min = " << limits.min() + << ", mean = " << avg + << ", max = " << limits.max() << ", integral = " << fvc::domainIntegrate(wDmdt).value() << endl; } diff --git a/src/phaseSystemModels/reactingEuler/multiphaseSystem/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C b/src/phaseSystemModels/reactingEuler/multiphaseSystem/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C index 56cdee16f87cde930ef8ba623ed4cac0d1b4982c..efca2b963ccf408faf74bb6a9c232d05237a6c43 100644 --- a/src/phaseSystemModels/reactingEuler/multiphaseSystem/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C +++ b/src/phaseSystemModels/reactingEuler/multiphaseSystem/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C @@ -505,13 +505,12 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs() { Info<< "alphat for vapour : " << nl << endl; - Info<< " alphatEffv: " << gMin(vaporw*(*this + alphaw)) - << " - " << gMax(vaporw*(*this + alphaw)) << endl; + Info<< " alphatEffv: " << gMinMax(vaporw*(*this + alphaw)) + << endl; const scalarField qEff(vaporw*(*this + alphaw)*hewv.snGrad()); - Info<< " qEffVap: " << gMin(qEff) << " - " - << gMax(qEff) << endl; + Info<< " qEffVap: " << gMinMax(qEff) << endl; scalar Qeff = gWeightedSum(patch().magSf(), qEff); Info<< " Effective heat transfer rate to vapor:" << Qeff @@ -1096,24 +1095,16 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs() fLiquid*liquidw*(*this + alphaw)*hew.snGrad() ); - Info<< "alphat for liquid: " << nl << endl; + Info<< "alphat for liquid: " << nl << nl; + Info<< " qEffLiq: " << gMinMax(qEff) << nl; + Info<< " alphatl: " << gMinMax(*this) << nl; + Info<< " dmdt: " << gMinMax(dmdt_) << nl; + Info<< " alphatlEff: " + << gMinMax(liquidw*(*this + alphaw)) << nl; - Info<< " qEffLiq: " << gMin(qEff) << " - " - << gMax(qEff) << endl; - - - Info<< " alphatl: " << gMin((*this)) << " - " - << gMax((*this)) << endl; - - Info<< " dmdt: " << gMin((dmdt_)) << " - " - << gMax((dmdt_)) << endl; - - Info<< " alphatlEff: " << gMin(liquidw*(*this + alphaw)) - << " - " << gMax(liquidw*(*this + alphaw)) << endl; - - scalar Qeff = gWeightedSum(patch().magSf(), qEff); - Info<< " Effective heat transfer rate to liquid: " << Qeff - << endl << nl; + Info<< " Effective heat transfer rate to liquid: " + << gWeightedSum(patch().magSf(), qEff) + << nl << endl; if (debug == 2) { diff --git a/src/phaseSystemModels/reactingEuler/multiphaseSystem/derivedFvPatchFields/fixedMultiPhaseHeatFlux/fixedMultiPhaseHeatFluxFvPatchScalarField.C b/src/phaseSystemModels/reactingEuler/multiphaseSystem/derivedFvPatchFields/fixedMultiPhaseHeatFlux/fixedMultiPhaseHeatFluxFvPatchScalarField.C index 3f3274103303d388a25f86c6bf7337bf75173a06..9139ea3a549b47a34c89375a11065da2eb1a63e8 100644 --- a/src/phaseSystemModels/reactingEuler/multiphaseSystem/derivedFvPatchFields/fixedMultiPhaseHeatFlux/fixedMultiPhaseHeatFluxFvPatchScalarField.C +++ b/src/phaseSystemModels/reactingEuler/multiphaseSystem/derivedFvPatchFields/fixedMultiPhaseHeatFlux/fixedMultiPhaseHeatFluxFvPatchScalarField.C @@ -147,8 +147,11 @@ void Foam::fixedMultiPhaseHeatFluxFvPatchScalarField::updateCoeffs() const scalarField q0(T.snGrad()*alpha*kappaEff); Q += q0; + auto limits = gMinMax(q0); + Info<< patch().name() << " " << phase.name() - << ": Heat flux " << gMin(q0) << " - " << gMax(q0) << endl; + << ": Heat flux " + << limits.min() << " - " << limits.max() << endl; } A += T.patchInternalField()*alpha*kappaEff*patch().deltaCoeffs(); @@ -157,7 +160,7 @@ void Foam::fixedMultiPhaseHeatFluxFvPatchScalarField::updateCoeffs() if (debug) { - MinMax<scalar> limits = gMinMax(Q); + auto limits = gMinMax(Q); Info<< patch().name() << " " << ": overall heat flux " << limits.min() << " - " << limits.max() << " W/m2, power: " diff --git a/src/phaseSystemModels/reactingEuler/multiphaseSystem/populationBalanceModel/nucleationModels/wallBoiling/wallBoiling.C b/src/phaseSystemModels/reactingEuler/multiphaseSystem/populationBalanceModel/nucleationModels/wallBoiling/wallBoiling.C index 445162fcb6282037393e78989e505868f741387d..d5cdaa204d9fb2f7d33fb5acd2d1e2645992ccb3 100644 --- a/src/phaseSystemModels/reactingEuler/multiphaseSystem/populationBalanceModel/nucleationModels/wallBoiling/wallBoiling.C +++ b/src/phaseSystemModels/reactingEuler/multiphaseSystem/populationBalanceModel/nucleationModels/wallBoiling/wallBoiling.C @@ -175,7 +175,7 @@ Foam::diameterModels::nucleationModels::wallBoiling::addToNucleationRate const scalarField& dmdt = alphatw.dmdt(); const scalarField& dDep = alphatw.dDeparture(); - const labelList& faceCells = alphatw.patch().faceCells(); + const labelUList& faceCells = alphatw.patch().faceCells(); dimensionedScalar unitLength("unitLength", dimLength, 1.0); diff --git a/src/phaseSystemModels/reactingEuler/twoPhaseSystem/diameterModels/IATE/IATEsources/wallBoiling/wallBoiling.C b/src/phaseSystemModels/reactingEuler/twoPhaseSystem/diameterModels/IATE/IATEsources/wallBoiling/wallBoiling.C index e0b87ac0a9c6de88fd21e03e92edd3781a406767..1969cb88a140861dda77f0e5f5e98f2274ac3a63 100644 --- a/src/phaseSystemModels/reactingEuler/twoPhaseSystem/diameterModels/IATE/IATEsources/wallBoiling/wallBoiling.C +++ b/src/phaseSystemModels/reactingEuler/twoPhaseSystem/diameterModels/IATE/IATEsources/wallBoiling/wallBoiling.C @@ -122,7 +122,7 @@ Foam::diameterModels::IATEsources::wallBoiling::R const scalarField& dmdt = alphatw.dmdt(); const scalarField& dDep = alphatw.dDeparture(); - const labelList& faceCells = alphatw.patch().faceCells(); + const labelUList& faceCells = alphatw.patch().faceCells(); forAll(alphatw, facei) { diff --git a/src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModelCollection.C b/src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModelCollection.C index 7559047023f61a69e3d841be525e491d06c7a1d7..dd9ca6401bd973b15338d356d5070e68cb20fd75 100644 --- a/src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModelCollection.C +++ b/src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModelCollection.C @@ -163,7 +163,8 @@ scalar pyrolysisModelCollection::maxDiff() const scalar maxDiff = 0.0; forAll(*this, i) { - maxDiff = max(maxDiff, this->operator[](i).maxDiff()); + maxDiff = + Foam::max(maxDiff, this->operator[](i).maxDiff()); } return maxDiff; @@ -175,7 +176,8 @@ scalar pyrolysisModelCollection::solidRegionDiffNo() const scalar totalDiNum = GREAT; forAll(*this, i) { - totalDiNum = min(totalDiNum, this->operator[](i).solidRegionDiffNo()); + totalDiNum = + Foam::min(totalDiNum, this->operator[](i).solidRegionDiffNo()); } return totalDiNum; diff --git a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C index acadb10b20b8338d527e4992b8580c11dc0781db..2c81e9ac7c0dd10bf8cdaf283f3bd90736d64f88 100644 --- a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C +++ b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C @@ -694,11 +694,10 @@ void reactingOneDim::evolveRegion() solidThermo_->correct(); + auto limits = gMinMax(solidThermo_->T().primitiveField()); + Info<< "pyrolysis min/max(T) = " - << gMin(solidThermo_->T().primitiveField()) - << ", " - << gMax(solidThermo_->T().primitiveField()) - << endl; + << limits.min() << ", " << limits.max() << endl; } diff --git a/src/regionModels/regionModel/singleLayerRegion/singleLayerRegion.C b/src/regionModels/regionModel/singleLayerRegion/singleLayerRegion.C index 207d1c0a486ce4c3ed3b7476ddd0a6e067dd11e0..28812ae78b82afea12398b8b513707dc19c7951f 100644 --- a/src/regionModels/regionModel/singleLayerRegion/singleLayerRegion.C +++ b/src/regionModels/regionModel/singleLayerRegion/singleLayerRegion.C @@ -102,7 +102,7 @@ void Foam::regionModels::singleLayerRegion::initialise() { const label patchi = intCoupledPatchIDs_[i]; const polyPatch& pp = rbm[patchi]; - const labelList& fCells = pp.faceCells(); + const labelUList& fCells = pp.faceCells(); nBoundaryFaces += fCells.size(); diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/curvatureSeparation/curvatureSeparation.C b/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/curvatureSeparation/curvatureSeparation.C index da3827b43a519521577618e5cb189b5c1ef0d50a..ace7e58f91ef4305647146c7f0227c9f2929cc73 100644 --- a/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/curvatureSeparation/curvatureSeparation.C +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/curvatureSeparation/curvatureSeparation.C @@ -144,7 +144,7 @@ tmp<scalarField> curvatureSeparation::calcCosAngle { const fvsPatchScalarField& phip = phi.boundaryField()[patchi]; const fvPatch& pp = phip.patch(); - const labelList& faceCells = pp.faceCells(); + const labelUList& faceCells = pp.faceCells(); const vectorField nf(pp.nf()); forAll(phip, i) { @@ -166,7 +166,7 @@ tmp<scalarField> curvatureSeparation::calcCosAngle { const scalarField& phip = phi.boundaryField()[patchi]; const vectorField nf(pbm[patchi].nf()); - const labelList& faceCells = pbm[patchi].faceCells(); + const labelUList& faceCells = pbm[patchi].faceCells(); const label sizeBy2 = pbm[patchi].size()/2; for (label face0=0; face0<sizeBy2; face0++) diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/patchInjection/patchInjection.C b/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/patchInjection/patchInjection.C index 24acdaf03b4a59da0f9dbcc050e3b96e23c3f181..3eb24a5ff3adb62982f28131a461349f41ab76d3 100644 --- a/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/patchInjection/patchInjection.C +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/patchInjection/patchInjection.C @@ -115,12 +115,11 @@ void patchInjection::correct { label patchi = patchIDs_[pidi]; const polyPatch& pp = pbm[patchi]; - const labelList& faceCells = pp.faceCells(); // Accumulate the total mass removed from patch scalar dMassPatch = 0; - for (const label celli : faceCells) + for (const label celli : pp.faceCells()) { scalar ddelta = max(0.0, delta[celli] - deltaStable_); scalar dMass = ddelta*rho[celli]*magSf[celli]; diff --git a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C index ba9bf0b0cbdd2e94ce6d732a0936c97acfccc915..b62a18da607dc51425103b1ac3abc47453d81416 100644 --- a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C +++ b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C @@ -697,10 +697,11 @@ void thermoSingleLayer::info() const scalarField& Tinternal = T_; + auto limits = gMinMax(Tinternal); + auto avg = gAverage(Tinternal); + Info<< indent << "min/mean/max(T) = " - << gMin(Tinternal) << ", " - << gAverage(Tinternal) << ", " - << gMax(Tinternal) << nl; + << limits.min() << ", " << avg << ", " << limits.max() << nl; phaseChange_->info(Info); } diff --git a/src/sampling/meshToMesh/calcMethod/cellVolumeWeight/cellVolumeWeightMethod.C b/src/sampling/meshToMesh/calcMethod/cellVolumeWeight/cellVolumeWeightMethod.C index 4e4a426491fe915cf4f394c0247c9fc902229df5..474ef3f3df2b3e4324432a686c1cea5f93b781b4 100644 --- a/src/sampling/meshToMesh/calcMethod/cellVolumeWeight/cellVolumeWeightMethod.C +++ b/src/sampling/meshToMesh/calcMethod/cellVolumeWeight/cellVolumeWeightMethod.C @@ -236,7 +236,7 @@ void Foam::cellVolumeWeightMethod::setNextCells label& tgtCelli, const labelList& srcCellIDs, const boolList& mapFlag, - const DynamicList<label>& visitedCells, + const labelUList& visitedCells, labelList& seedCells ) const { diff --git a/src/sampling/meshToMesh/calcMethod/cellVolumeWeight/cellVolumeWeightMethod.H b/src/sampling/meshToMesh/calcMethod/cellVolumeWeight/cellVolumeWeightMethod.H index 44176deefdf37c2184869944e162b67a0e1dbfee..957015b15c2a82d7874976b4cf44bbcd1c420eaf 100644 --- a/src/sampling/meshToMesh/calcMethod/cellVolumeWeight/cellVolumeWeightMethod.H +++ b/src/sampling/meshToMesh/calcMethod/cellVolumeWeight/cellVolumeWeightMethod.H @@ -91,7 +91,7 @@ protected: label& tgtCelli, const labelList& srcCellIDs, const boolList& mapFlag, - const DynamicList<label>& visitedCells, + const labelUList& visitedCells, labelList& seedCells ) const; diff --git a/src/sampling/meshToMesh/calcMethod/meshToMeshMethod/meshToMeshMethod.C b/src/sampling/meshToMesh/calcMethod/meshToMeshMethod/meshToMeshMethod.C index f1cd0e78e5256627966cb5314cb45053b2d8936f..c62d149665744f9f7f8aabec05ca861bf892dbe0 100644 --- a/src/sampling/meshToMesh/calcMethod/meshToMeshMethod/meshToMeshMethod.C +++ b/src/sampling/meshToMesh/calcMethod/meshToMeshMethod/meshToMeshMethod.C @@ -157,7 +157,7 @@ void Foam::meshToMeshMethod::appendNbrCells ( const label celli, const polyMesh& mesh, - const DynamicList<label>& visitedCells, + const labelUList& visitedCells, DynamicList<label>& nbrCellIDs ) const { diff --git a/src/sampling/meshToMesh/calcMethod/meshToMeshMethod/meshToMeshMethod.H b/src/sampling/meshToMesh/calcMethod/meshToMeshMethod/meshToMeshMethod.H index 28f82d0f2792b5049a0283e58a8382fa9a5f3d8b..d90d9e538cfb3ba026aacad5be0f446b79cab789 100644 --- a/src/sampling/meshToMesh/calcMethod/meshToMeshMethod/meshToMeshMethod.H +++ b/src/sampling/meshToMesh/calcMethod/meshToMeshMethod/meshToMeshMethod.H @@ -100,7 +100,7 @@ protected: ( const label tgtCelli, const polyMesh& mesh, - const DynamicList<label>& visitedTgtCells, + const labelUList& visitedTgtCells, DynamicList<label>& nbrTgtCellIDs ) const; diff --git a/src/sampling/surface/isoSurface/isoSurfaceCell.H b/src/sampling/surface/isoSurface/isoSurfaceCell.H index 56ef23d34bf011bc27b05337605d3dda8b9a35ed..2e4f37bd76e31dd57d9f4158224ab9fa38966368 100644 --- a/src/sampling/surface/isoSurface/isoSurfaceCell.H +++ b/src/sampling/surface/isoSurface/isoSurfaceCell.H @@ -163,7 +163,7 @@ class isoSurfaceCell template<class Type> Type generatePoint ( - const DynamicList<Type>& snappedPoints, + const UList<Type>& snappedPoints, const scalar s0, const Type& p0, const label p0Index, @@ -175,7 +175,7 @@ class isoSurfaceCell template<class Type> void generateTriPoints ( - const DynamicList<Type>& snapped, + const UList<Type>& snapped, const scalar s0, const Type& p0, const label p0Index, @@ -200,7 +200,7 @@ class isoSurfaceCell const Field<Type>& cCoords, const Field<Type>& pCoords, - const DynamicList<Type>& snappedPoints, + const UList<Type>& snappedPoints, const labelList& snappedCc, const labelList& snappedPoint, diff --git a/src/sampling/surface/isoSurface/isoSurfaceCellTemplates.C b/src/sampling/surface/isoSurface/isoSurfaceCellTemplates.C index af1e5d5924c1b12aacd0cbff6531974f1e00579c..9082399494a1e58f8a0dcf3b686e7b11f986a934 100644 --- a/src/sampling/surface/isoSurface/isoSurfaceCellTemplates.C +++ b/src/sampling/surface/isoSurface/isoSurfaceCellTemplates.C @@ -36,7 +36,7 @@ License template<class Type> Type Foam::isoSurfaceCell::generatePoint ( - const DynamicList<Type>& snappedPoints, + const UList<Type>& snappedPoints, const scalar s0, const Type& p0, @@ -78,7 +78,7 @@ Type Foam::isoSurfaceCell::generatePoint template<class Type> void Foam::isoSurfaceCell::generateTriPoints ( - const DynamicList<Type>& snapped, + const UList<Type>& snapped, const scalar s0, const Type& p0, @@ -273,7 +273,7 @@ void Foam::isoSurfaceCell::generateTriPoints const Field<Type>& cCoords, const Field<Type>& pCoords, - const DynamicList<Type>& snappedPoints, + const UList<Type>& snappedPoints, const labelList& snappedCc, const labelList& snappedPoint, diff --git a/src/sampling/surface/isoSurface/isoSurfacePoint.H b/src/sampling/surface/isoSurface/isoSurfacePoint.H index c11241d2284f2224d0f938fad4507acdb81284e9..7421843ca7502183abe659f0a174ed9727c85464 100644 --- a/src/sampling/surface/isoSurface/isoSurfacePoint.H +++ b/src/sampling/surface/isoSurface/isoSurfacePoint.H @@ -259,7 +259,7 @@ class isoSurfacePoint const VolumeField<Type>& cCoords, const Field<Type>& pCoords, - const DynamicList<Type>& snappedPoints, + const UList<Type>& snappedPoints, const labelList& snappedCc, const labelList& snappedPoint, const label facei, @@ -282,7 +282,7 @@ class isoSurfacePoint const VolumeField<Type>& cCoords, const Field<Type>& pCoords, - const DynamicList<Type>& snappedPoints, + const UList<Type>& snappedPoints, const labelList& snappedCc, const labelList& snappedPoint, @@ -298,7 +298,7 @@ class isoSurfacePoint const labelList& interpolatedPoints, const List<FixedList<label, 3>>& interpolatedOldPoints, const List<FixedList<scalar, 3>>& interpolationWeights, - const DynamicList<Type>& unmergedValues + const UList<Type>& unmergedValues ); triSurface stitchTriPoints diff --git a/src/sampling/surface/isoSurface/isoSurfacePointTemplates.C b/src/sampling/surface/isoSurface/isoSurfacePointTemplates.C index 06d90de29e01efc905f209b34aaa1d00a432190d..37054e35665237735f679269a8761ec107c073df 100644 --- a/src/sampling/surface/isoSurface/isoSurfacePointTemplates.C +++ b/src/sampling/surface/isoSurface/isoSurfacePointTemplates.C @@ -438,7 +438,7 @@ Foam::label Foam::isoSurfacePoint::generateFaceTriPoints const VolumeField<Type>& cCoords, const Field<Type>& pCoords, - const DynamicList<Type>& snappedPoints, + const UList<Type>& snappedPoints, const labelList& snappedCc, const labelList& snappedPoint, const label facei, @@ -521,7 +521,7 @@ void Foam::isoSurfacePoint::generateTriPoints const VolumeField<Type>& cCoords, const Field<Type>& pCoords, - const DynamicList<Type>& snappedPoints, + const UList<Type>& snappedPoints, const labelList& snappedCc, const labelList& snappedPoint, @@ -738,7 +738,7 @@ Foam::isoSurfacePoint::interpolate const labelList& interpolatedPoints, const List<FixedList<label, 3>>& interpolatedOldPoints, const List<FixedList<scalar, 3>>& interpolationWeights, - const DynamicList<Type>& unmergedValues + const UList<Type>& unmergedValues ) { // One value per point diff --git a/src/thermoTools/derivedFvPatchFields/lumpedMassWallTemperature/lumpedMassWallTemperatureFvPatchScalarField.C b/src/thermoTools/derivedFvPatchFields/lumpedMassWallTemperature/lumpedMassWallTemperatureFvPatchScalarField.C index df66f3288c5a67897cda5b90aca7e172e53aa05d..215d17698fd75bbc9661a4599da939e960483d73 100644 --- a/src/thermoTools/derivedFvPatchFields/lumpedMassWallTemperature/lumpedMassWallTemperatureFvPatchScalarField.C +++ b/src/thermoTools/derivedFvPatchFields/lumpedMassWallTemperature/lumpedMassWallTemperatureFvPatchScalarField.C @@ -195,14 +195,17 @@ void Foam::lumpedMassWallTemperatureFvPatchScalarField::updateCoeffs() } } + auto limits = gMinMax(*this); + auto avg = gAverage(*this); + Info<< patch().boundaryMesh().mesh().name() << ':' << patch().name() << ':' << this->internalField().name() << " :" << " heat transfer rate:" << Q << " wall temperature " - << " min:" << gMin(*this) - << " max:" << gMax(*this) - << " avg:" << gAverage(*this) + << " min:" << limits.min() + << " max:" << limits.max() + << " avg:" << avg << " Qin [W]:" << Qin << " Qout [W]:" << Qout << endl; diff --git a/src/thermoTools/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.C b/src/thermoTools/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.C index bb3532b43d3a525176c833e9f6fd352414a6cf35..c73f38cd6205b5546ca1e228acd07c746d5f3c49 100644 --- a/src/thermoTools/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.C +++ b/src/thermoTools/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.C @@ -400,6 +400,10 @@ void thermalBaffle1DFvPatchScalarField<solidType>::updateCoeffs() if (debug) { scalar Q = gAverage(kappaw*snGrad()); + + auto limits = gMinMax(*this); + auto avg = gAverage(*this); + Info<< patch().boundaryMesh().mesh().name() << ':' << patch().name() << ':' << this->internalField().name() << " <- " @@ -407,9 +411,9 @@ void thermalBaffle1DFvPatchScalarField<solidType>::updateCoeffs() << this->internalField().name() << " :" << " heat[W]:" << Q << " walltemperature " - << " min:" << gMin(*this) - << " max:" << gMax(*this) - << " avg:" << gAverage(*this) + << " min:" << limits.min() + << " max:" << limits.max() + << " avg:" << avg << endl; } } diff --git a/src/thermoTools/derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.C b/src/thermoTools/derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.C index d2066bec6d8305de988dfbe273665061f3581121..dcd7821636c7097506033fb74c2a1b81192fc130 100644 --- a/src/thermoTools/derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.C +++ b/src/thermoTools/derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.C @@ -385,6 +385,9 @@ void turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::updateCoeffs() { scalar Q = gSum(kappaTp*patch().magSf()*snGrad()); + auto limits = gMinMax(*this); + auto avg = gAverage(*this); + Info<< patch().boundaryMesh().mesh().name() << ':' << patch().name() << ':' << this->internalField().name() << " <- " @@ -393,9 +396,9 @@ void turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::updateCoeffs() << this->internalField().name() << " :" << " heat transfer rate:" << Q << " walltemperature " - << " min:" << gMin(*this) - << " max:" << gMax(*this) - << " avg:" << gAverage(*this) + << " min:" << limits.min() + << " max:" << limits.max() + << " avg:" << avg << endl; } diff --git a/src/thermophysicalModels/basic/rhoThermo/rhoThermo.C b/src/thermophysicalModels/basic/rhoThermo/rhoThermo.C index 074cccfde8f83d418f8ad06a8e7b567fabc306b2..9ad65f87485bfd9df30af8e075c0737bfb3f6ba9 100644 --- a/src/thermophysicalModels/basic/rhoThermo/rhoThermo.C +++ b/src/thermophysicalModels/basic/rhoThermo/rhoThermo.C @@ -256,8 +256,7 @@ void Foam::rhoThermo::correctRho ) { rho_ += deltaRho; - rho_ = max(rho_, rhoMin); - rho_ = min(rho_, rhoMax); + rho_.clamp_range(rhoMin, rhoMax); } void Foam::rhoThermo::correctRho(const Foam::volScalarField& deltaRho) diff --git a/src/thermophysicalModels/radiation/radiationModels/solarLoad/solarLoad.C b/src/thermophysicalModels/radiation/radiationModels/solarLoad/solarLoad.C index 503a7489ce98957cf9713fada175232d8b02ea49..15f2c414f8a1165628b4659149d61f4182a81d0d 100644 --- a/src/thermophysicalModels/radiation/radiationModels/solarLoad/solarLoad.C +++ b/src/thermophysicalModels/radiation/radiationModels/solarLoad/solarLoad.C @@ -281,7 +281,7 @@ void Foam::radiation::solarLoad::updateSkyDiffusiveRadiation const scalarField& sf = mesh_.magSf().boundaryField()[patchID]; const vectorField n = pp.faceNormals(); - const labelList& cellids = pp.faceCells(); + const labelUList& cellids = pp.faceCells(); // Calculate diffusive radiance // contribution from sky and ground @@ -326,7 +326,7 @@ void Foam::radiation::solarLoad::updateSkyDiffusiveRadiation const polyPatch& pp = patches[patchID]; const scalarField& sf = mesh_.magSf().boundaryField()[patchID]; - const labelList& cellids = pp.faceCells(); + const labelUList& cellids = pp.faceCells(); forAll(pp, facei) { const label celli = cellids[facei]; @@ -697,7 +697,7 @@ void Foam::radiation::solarLoad::calculateQdiff else { const polyPatch& pp = patches[patchID]; - const labelList& cellids = pp.faceCells(); + const labelUList& cellids = pp.faceCells(); const scalarField& sf = mesh_.magSf().boundaryField()[patchID]; forAll(pp, facei) { diff --git a/src/thermophysicalModels/reactionThermo/derivedFvPatchFields/enthalpySorption/enthalpySorptionFvPatchScalarField.C b/src/thermophysicalModels/reactionThermo/derivedFvPatchFields/enthalpySorption/enthalpySorptionFvPatchScalarField.C index ca9bee458fadf018d9f249b77865f19a46fcd105..3a8d0004eefc49bc014598dfc1ce6e2c665735c4 100644 --- a/src/thermophysicalModels/reactionThermo/derivedFvPatchFields/enthalpySorption/enthalpySorptionFvPatchScalarField.C +++ b/src/thermophysicalModels/reactionThermo/derivedFvPatchFields/enthalpySorption/enthalpySorptionFvPatchScalarField.C @@ -234,8 +234,10 @@ patchSource() const if (debug) { + auto limits = gMinMax(dhdt); + Info<< " Patch enthalpy rate min/max [J/m3/sec]: " - << gMin(dhdt) << " - " << gMax(dhdt) << endl; + << limits.min() << " - " << limits.max() << endl; } return tmp<scalarField>::New(dhdt); @@ -282,8 +284,10 @@ void Foam::enthalpySorptionFvPatchScalarField::updateCoeffs() if (debug) { + auto limits = gMinMax(dhdt_); + Info<< " Enthalpy change min/max [J/kg]: " - << gMin(dhdt_) << " - " << gMax(dhdt_) << endl; + << limits.min() << " - " << limits.max() << endl; } zeroGradientFvPatchScalarField::updateCoeffs(); diff --git a/src/thermophysicalModels/reactionThermo/derivedFvPatchFields/speciesSorption/speciesSorptionFvPatchScalarField.C b/src/thermophysicalModels/reactionThermo/derivedFvPatchFields/speciesSorption/speciesSorptionFvPatchScalarField.C index 26a4a27fd63d6eda65afba29ca9b797abb51f7d1..2318c265508806694e5adfa893e6781bec56601f 100644 --- a/src/thermophysicalModels/reactionThermo/derivedFvPatchFields/speciesSorption/speciesSorptionFvPatchScalarField.C +++ b/src/thermophysicalModels/reactionThermo/derivedFvPatchFields/speciesSorption/speciesSorptionFvPatchScalarField.C @@ -321,8 +321,10 @@ patchSource() const if (debug) { + auto limits = gMinMax(dfldp); + Info<< " Patch mass rate min/max [kg/m3/sec]: " - << gMin(dfldp) << " - " << gMax(dfldp) << endl; + << limits.min() << " - " << limits.max() << endl; } return tmp<scalarField>::New(dfldp); @@ -391,8 +393,10 @@ void Foam::speciesSorptionFvPatchScalarField::updateCoeffs() if (debug) { + auto limits = gMinMax(dfldp_); + Info<< " Absorption rate min/max [mol/kg/sec]: " - << gMin(dfldp_) << " - " << gMax(dfldp_) << endl; + << limits.min() << " - " << limits.max() << endl; } zeroGradientFvPatchScalarField::updateCoeffs(); diff --git a/src/topoChangerFvMesh/movingConeTopoFvMesh/movingConeTopoFvMesh.C b/src/topoChangerFvMesh/movingConeTopoFvMesh/movingConeTopoFvMesh.C index 0b0d1e8bef5136639a9bdaed29285a770b60489d..be8b4aab6071be68354460a53da1f92879e07cf3 100644 --- a/src/topoChangerFvMesh/movingConeTopoFvMesh/movingConeTopoFvMesh.C +++ b/src/topoChangerFvMesh/movingConeTopoFvMesh/movingConeTopoFvMesh.C @@ -134,7 +134,7 @@ void Foam::movingConeTopoFvMesh::addZonesAndModifiers() && fc[facei].x() < -0.003499 ) { - if ((fa[facei] & vector(1, 0, 0)) < 0) + if (fa[facei].x() < 0) { flipZone1[nZoneFaces1] = true; } @@ -152,7 +152,7 @@ void Foam::movingConeTopoFvMesh::addZonesAndModifiers() { zone2[nZoneFaces2] = facei; - if ((fa[facei] & vector(1, 0, 0)) > 0) + if (fa[facei].x() > 0) { flipZone2[nZoneFaces2] = true; } diff --git a/src/transportModels/geometricVoF/advectionSchemes/isoAdvection/isoAdvection.C b/src/transportModels/geometricVoF/advectionSchemes/isoAdvection/isoAdvection.C index 6ecf2ad0176a77300c86985d68893001cabd6184..110f3127ba1736697ed7864626dd86358a257513 100644 --- a/src/transportModels/geometricVoF/advectionSchemes/isoAdvection/isoAdvection.C +++ b/src/transportModels/geometricVoF/advectionSchemes/isoAdvection/isoAdvection.C @@ -160,11 +160,9 @@ Foam::isoAdvection::isoAdvection if (porosityPtr_) { - if - ( - gMin(porosityPtr_->primitiveField()) <= 0 - || gMax(porosityPtr_->primitiveField()) > 1 + SMALL - ) + auto limits = gMinMax(porosityPtr_->primitiveField()); + + if (limits.min() <= 0 || limits.max() > 1 + SMALL) { FatalErrorInFunction << "Porosity field has values <= 0 or > 1" @@ -268,7 +266,7 @@ void Foam::isoAdvection::timeIntegratedFlux() // Storage for isoFace points. Only used if writeIsoFacesToFile_ DynamicList<List<point>> isoFacePts; - const DynamicField<label>& interfaceLabels = surf_->interfaceLabels(); + const labelUList& interfaceLabels = surf_->interfaceLabels(); // Calculating isoface normal velocity scalarField Un0(interfaceLabels.size()); @@ -680,7 +678,7 @@ void Foam::isoAdvection::writeSurfaceCells() const void Foam::isoAdvection::writeIsoFaces ( - const DynamicList<List<point>>& faces + const UList<List<point>>& faces ) const { if (!writeIsoFacesToFile_ || !mesh_.time().writeTime()) return; @@ -696,7 +694,7 @@ void Foam::isoAdvection::writeIsoFaces if (Pstream::parRun()) { // Collect points from all the processors - List<DynamicList<List<point>>> allProcFaces(Pstream::nProcs()); + List<List<List<point>>> allProcFaces(Pstream::nProcs()); allProcFaces[Pstream::myProcNo()] = faces; Pstream::gatherList(allProcFaces); @@ -707,13 +705,9 @@ void Foam::isoAdvection::writeIsoFaces Info<< nl << "isoAdvection: writing iso faces to file: " << os.name() << nl << endl; - for - ( - const DynamicList<List<point>>& procFacePts - : allProcFaces - ) + for (const auto& procFacePts : allProcFaces) { - for (const List<point>& facePts : procFacePts) + for (const auto& facePts : procFacePts) { os.writeFace(facePts, false); } @@ -727,7 +721,7 @@ void Foam::isoAdvection::writeIsoFaces Info<< nl << "isoAdvection: writing iso faces to file: " << os.name() << nl << endl; - for (const List<point>& facePts : faces) + for (const auto& facePts : faces) { os.writeFace(facePts, false); } diff --git a/src/transportModels/geometricVoF/advectionSchemes/isoAdvection/isoAdvection.H b/src/transportModels/geometricVoF/advectionSchemes/isoAdvection/isoAdvection.H index f741963733d1c45041ceec005c37120a36af14bb..e74589d9d27138cedf0f66631c5887fc51ad6758 100644 --- a/src/transportModels/geometricVoF/advectionSchemes/isoAdvection/isoAdvection.H +++ b/src/transportModels/geometricVoF/advectionSchemes/isoAdvection/isoAdvection.H @@ -400,10 +400,7 @@ public: } //- Write isoface points to .obj file - void writeIsoFaces - ( - const DynamicList<List<point>>& isoFacePts - ) const; + void writeIsoFaces(const UList<List<point>>& isoFacePts) const; }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/transportModels/geometricVoF/advectionSchemes/isoAdvection/isoAdvectionTemplates.C b/src/transportModels/geometricVoF/advectionSchemes/isoAdvection/isoAdvectionTemplates.C index 422d86c89634ba9e4c132ce02a72935a06a649e9..b0dc0607d77bea6ed077359c64f6c47bccebb9bb 100644 --- a/src/transportModels/geometricVoF/advectionSchemes/isoAdvection/isoAdvectionTemplates.C +++ b/src/transportModels/geometricVoF/advectionSchemes/isoAdvection/isoAdvectionTemplates.C @@ -121,9 +121,11 @@ void Foam::isoAdvection::limitFluxes addProfilingInFunction(geometricVoF); DebugInFunction << endl; + auto alpha1Limits = gMinMax(alpha1_); + const scalar aTol = 100*SMALL; // Note: tolerances - scalar maxAlphaMinus1 = gMax(alpha1_) - 1; // max(alphaNew - 1); - scalar minAlpha = gMin(alpha1_); // min(alphaNew); + scalar maxAlphaMinus1 = alpha1Limits.max() - 1; // max(alphaNew - 1); + scalar minAlpha = alpha1Limits.min(); // min(alphaNew); const label nOvershoots = 20; // sum(pos0(alphaNew - 1 - aTol)); const labelList& owner = mesh_.faceOwner(); @@ -232,8 +234,10 @@ void Foam::isoAdvection::limitFluxes break; } - maxAlphaMinus1 = gMax(alpha1_) - 1; // max(alphaNew - 1); - minAlpha = gMin(alpha1_); // min(alphaNew); + alpha1Limits = gMinMax(alpha1_); + + maxAlphaMinus1 = alpha1Limits.max() - 1; // max(alphaNew - 1); + minAlpha = alpha1Limits.min(); // min(alphaNew); if (debug) { @@ -486,11 +490,13 @@ void Foam::isoAdvection::advect(const SpType& Sp, const SuType& Su) // Adjust dVf for unbounded cells limitFluxes(Sp, Su); - scalar maxAlphaMinus1 = gMax(alpha1In_) - 1; - scalar minAlpha = gMin(alpha1In_); + { + auto limits = gMinMax(alpha1In_); - Info<< "isoAdvection: After conservative bounding: min(alpha) = " - << minAlpha << ", max(alpha) = 1 + " << maxAlphaMinus1 << endl; + Info<< "isoAdvection: After conservative bounding:" + << " min(alpha) = " << limits.min() + << ", max(alpha) = 1 + " << (limits.max()-1) << endl; + } // Apply non-conservative bounding mechanisms (clipping and snapping) // Note: We should be able to write out alpha before this is done!