Merge branch 'namespace-qualify_code-style' into 'develop'

Improve namespace qualification of min/max, other minor code improvements

See merge request Development/openfoam!736
This commit is contained in:
Mark OLESEN 2025-04-09 14:37:41 +00:00
commit efacb1c905
257 changed files with 1630 additions and 1295 deletions

View File

@ -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

View File

@ -1,5 +1,6 @@
if (adjustTimeStep)
{
runTime.setDeltaT(min(dtChem, maxDeltaT));
runTime.setDeltaT(Foam::min(dtChem, maxDeltaT));
Info<< "deltaT = " << runTime.deltaTValue() << endl;
}

View File

@ -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
)
);

View File

@ -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);
rDeltaT.ref() = max(rDeltaT(), rDeltaTY);
auto limits = gMinMax(rDeltaTY.field());
limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL));
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;
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -1,7 +1,7 @@
scalar CoNum = -GREAT;
forAll(fluidRegions, regionI)
{
CoNum = max
CoNum = Foam::max
(
compressibleCourantNo
(

View File

@ -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() << ' '

View File

@ -387,15 +387,18 @@ updateCoeffs()
{
scalar Q = gSum(kappa(Tp)*patch().magSf()*snGrad());
Info<< "T solid : " << nl << endl;
auto limits = gMinMax(Tp);
auto avg = gAverage(Tp);
Info
<< " heat transfer rate from solid:" << Q
<< " walltemperature "
<< " min:" << gMin(Tp)
<< " max:" << gMax(Tp)
<< " avg:" << gAverage(Tp) << nl
<< endl;
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;
}
}

View File

@ -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));
}
}

View File

@ -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
(

View File

@ -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;

View File

@ -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
)
);

View File

@ -22,7 +22,7 @@ forAll(solidRegions, i)
tmp<volScalarField> trho = thermo.rho();
const volScalarField& rho = trho();
DiNum = max
DiNum = Foam::max
(
solidRegionDiffNo
(

View File

@ -17,7 +17,7 @@ scalar DiNum = -GREAT;
tmp<volScalarField> trho = thermo.rho();
const volScalarField& rho = trho();
DiNum = max
DiNum = Foam::max
(
solidRegionDiffNo
(

View File

@ -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;
}

View File

@ -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
(

View File

@ -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())

View File

@ -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;
}
}

View File

@ -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
@ -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;
}

View File

@ -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

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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));
// Limit rate of change of time scale
Info<< "Smoothed flow time scale min/max = "
<< limits.min() << ", " << limits.max() << endl;
}
// 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;
}
}

View File

@ -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

View File

@ -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

View File

@ -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);
}
}

View File

@ -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;

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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;
}

View File

@ -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())

View File

@ -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;
}

View File

@ -8,5 +8,5 @@
Info<< "Max Ur Courant Number = " << UrCoNum << endl;
CoNum = max(CoNum, UrCoNum);
CoNum = Foam::max(CoNum, UrCoNum);
}

View File

@ -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;
}

View File

@ -8,5 +8,5 @@
Info<< "Max Ur Courant Number = " << UrCoNum << endl;
CoNum = max(CoNum, UrCoNum);
CoNum = Foam::max(CoNum, UrCoNum);
}

View File

@ -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");

View File

@ -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."

View File

@ -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."

View File

@ -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;
}

View File

@ -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>());

View File

@ -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)

View File

@ -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

View File

@ -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;
<< " 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_ == 0)
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())
)
);
}
}

View File

@ -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;
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();
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;
<< " 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 == 0)
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())
)
);
}
}

View File

@ -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]

View File

@ -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;

View File

@ -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

View File

@ -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()

View File

@ -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;

View File

@ -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));

View File

@ -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)

View File

@ -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());
}
}

View File

@ -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);

View File

@ -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());

View File

@ -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

View File

@ -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);

View File

@ -47,7 +47,7 @@ namespace Foam
Foam::autoPtr<Foam::mapDistribute> Foam::backgroundMeshDecomposition::buildMap
(
const List<label>& toProc
const labelUList& toProc
)
{
// Determine send map

View File

@ -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.

View File

@ -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)
{

View File

@ -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)

View File

@ -130,7 +130,7 @@ public:
inline bool addPointPair
(
const labelPair& master,
const DynamicList<labelPair>& slaves
const UList<labelPair>& slaves
);
inline bool addPointPair

View File

@ -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
);

View File

@ -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
)
{

View File

@ -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())

View File

@ -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)

View File

@ -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

View File

@ -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())

View File

@ -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
{

View File

@ -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;

View File

@ -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];
vector eVec(e.vec(mesh.points()));
scalar eMag = mag(eVec);
eVec /= eMag;
if (mag(eVec.x()) > 1-edgeTol)
{
const edge& e = edges[edgeI];
vector eVec(e.vec(mesh.points()));
scalar eMag = mag(eVec);
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);
}
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;
}

View File

@ -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());
}
}

View File

@ -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));
}
}

View File

@ -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)

View File

@ -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

View File

@ -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);
}

View File

@ -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++
)
{

View File

@ -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();

View File

@ -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

View File

@ -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);
}
}

View File

@ -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]);
}
}
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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]));
}
}

View File

@ -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();
Info<< "sum(alpha*V):" << gSum(mesh.V()*alpha)
<< ", 1-max(alpha1): " << 1 - gMax(alpha)
<< " min(alpha1): " << gMin(alpha) << endl;
auto limits = gMinMax(alpha);
auto total = gWeightedSum(mesh.V(), alpha);
Info<< "sum(alpha*V):" << total
<< ", 1-max(alpha1): " << 1 - limits.max()
<< " min(alpha1): " << limits.min() << endl;
}
Info<< "\nEnd\n" << endl;

View File

@ -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"

View File

@ -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;

View File

@ -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]

View File

@ -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>());

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