diff --git a/src/lagrangian/intermediate/clouds/Templates/CollidingCloud/CollidingCloudI.H b/src/lagrangian/intermediate/clouds/Templates/CollidingCloud/CollidingCloudI.H index 67a2c6ba111d5e71f6d74944939375d1d40d9844..d4ee6db22ef531b001241675be08cdc42fccb565 100644 --- a/src/lagrangian/intermediate/clouds/Templates/CollidingCloud/CollidingCloudI.H +++ b/src/lagrangian/intermediate/clouds/Templates/CollidingCloud/CollidingCloudI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011, 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2016 OpenFOAM Foundation @@ -65,10 +65,8 @@ Foam::CollidingCloud<CloudType>::rotationalKineticEnergyOfSystem() const { scalar rotationalKineticEnergy = 0.0; - forAllConstIter(typename CollidingCloud<CloudType>, *this, iter) + for (const parcelType& p : *this) { - const parcelType& p = iter(); - rotationalKineticEnergy += p.nParticle()*0.5*p.momentOfInertia()*(p.omega() & p.omega()); } diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C index 0b46a37273d1e281ee214767b2ba9c91c0b8c96e..df77062b181cc7ccb687b0527e65444396261578 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2008-2011, 2016 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011, 2016-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2017 OpenFOAM Foundation @@ -155,14 +155,14 @@ void Foam::KinematicCloud<CloudType>::buildCellOccupancy() List<DynamicList<parcelType*>>& cellOccupancy = cellOccupancyPtr_(); - forAll(cellOccupancy, cO) + for (auto& list : cellOccupancy) { - cellOccupancy[cO].clear(); + list.clear(); } - forAllIter(typename KinematicCloud<CloudType>, *this, iter) + for (parcelType& p : *this) { - cellOccupancy[iter().cell()].append(&iter()); + cellOccupancy[p.cell()].append(&p); } } diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H index a06ad6e202f1b5ef18f94d1feac37abc9c88ece2..3be30970c3b31725a1c0e41e47e62e3702a207fa 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011, 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2017 OpenFOAM Foundation @@ -273,10 +273,9 @@ template<class CloudType> inline Foam::scalar Foam::KinematicCloud<CloudType>::massInSystem() const { scalar sysMass = 0.0; - forAllConstIter(typename KinematicCloud<CloudType>, *this, iter) + for (const parcelType& p : *this) { - const parcelType& p = iter(); - sysMass += p.nParticle()*p.mass(); + sysMass += p.nParticle()*p.mass(); } return sysMass; @@ -289,10 +288,8 @@ Foam::KinematicCloud<CloudType>::linearMomentumOfSystem() const { vector linearMomentum(Zero); - forAllConstIter(typename KinematicCloud<CloudType>, *this, iter) + for (const parcelType& p : *this) { - const parcelType& p = iter(); - linearMomentum += p.nParticle()*p.mass()*p.U(); } @@ -306,10 +303,8 @@ Foam::KinematicCloud<CloudType>::linearKineticEnergyOfSystem() const { scalar linearKineticEnergy = 0.0; - forAllConstIter(typename KinematicCloud<CloudType>, *this, iter) + for (const parcelType& p : *this) { - const parcelType& p = iter(); - linearKineticEnergy += p.nParticle()*0.5*p.mass()*(p.U() & p.U()); } @@ -326,9 +321,8 @@ inline Foam::scalar Foam::KinematicCloud<CloudType>::Dij { scalar si = 0.0; scalar sj = 0.0; - forAllConstIter(typename KinematicCloud<CloudType>, *this, iter) + for (const parcelType& p : *this) { - const parcelType& p = iter(); si += p.nParticle()*pow(p.d(), i); sj += p.nParticle()*pow(p.d(), j); } @@ -345,9 +339,8 @@ template<class CloudType> inline Foam::scalar Foam::KinematicCloud<CloudType>::Dmax() const { scalar d = -GREAT; - forAllConstIter(typename KinematicCloud<CloudType>, *this, iter) + for (const parcelType& p : *this) { - const parcelType& p = iter(); d = max(d, p.d()); } @@ -477,9 +470,8 @@ Foam::KinematicCloud<CloudType>::vDotSweep() const ); volScalarField& vDotSweep = tvDotSweep.ref(); - forAllConstIter(typename KinematicCloud<CloudType>, *this, iter) + for (const parcelType& p : *this) { - const parcelType& p = iter(); const label celli = p.cell(); vDotSweep[celli] += p.nParticle()*p.areaP()*mag(p.U() - U_[celli]); @@ -516,9 +508,8 @@ Foam::KinematicCloud<CloudType>::theta() const ); volScalarField& theta = ttheta.ref(); - forAllConstIter(typename KinematicCloud<CloudType>, *this, iter) + for (const parcelType& p : *this) { - const parcelType& p = iter(); const label celli = p.cell(); theta[celli] += p.nParticle()*p.volume(); @@ -554,9 +545,8 @@ Foam::KinematicCloud<CloudType>::alpha() const ); scalarField& alpha = talpha.ref().primitiveFieldRef(); - forAllConstIter(typename KinematicCloud<CloudType>, *this, iter) + for (const parcelType& p : *this) { - const parcelType& p = iter(); const label celli = p.cell(); alpha[celli] += p.nParticle()*p.mass(); @@ -591,9 +581,8 @@ Foam::KinematicCloud<CloudType>::rhoEff() const ); scalarField& rhoEff = trhoEff.ref().primitiveFieldRef(); - forAllConstIter(typename KinematicCloud<CloudType>, *this, iter) + for (const parcelType& p : *this) { - const parcelType& p = iter(); const label celli = p.cell(); rhoEff[celli] += p.nParticle()*p.mass(); diff --git a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloudI.H b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloudI.H index cb496e428a97ba2802f12515e1b8e26659749b2d..9bfb3794578493757a82d57371a01666caea7b02 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloudI.H +++ b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloudI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011, 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2017 OpenFOAM Foundation @@ -374,48 +374,42 @@ Foam::ThermoCloud<CloudType>::sigmap() const template<class CloudType> inline Foam::scalar Foam::ThermoCloud<CloudType>::Tmax() const { - scalar T = -GREAT; - scalar n = 0; - forAllConstIter(typename ThermoCloud<CloudType>, *this, iter) + scalar val = -GREAT; + bool nonEmpty = false; + + for (const parcelType& p : *this) { - const parcelType& p = iter(); - T = max(T, p.T()); - n++; + val = max(val, p.T()); + nonEmpty = true; } - reduce(T, maxOp<scalar>()); - reduce(n, sumOp<label>()); - - if (n > 0) + if (returnReduce(nonEmpty, orOp<bool>())) { - return T; + return returnReduce(val, maxOp<scalar>()); } - return 0.0; + return 0; } template<class CloudType> inline Foam::scalar Foam::ThermoCloud<CloudType>::Tmin() const { - scalar T = GREAT; - scalar n = 0; - forAllConstIter(typename ThermoCloud<CloudType>, *this, iter) + scalar val = GREAT; + bool nonEmpty = false; + + for (const parcelType& p : *this) { - const parcelType& p = iter(); - T = min(T, p.T()); - n++; + val = min(val, p.T()); + nonEmpty = true; } - reduce(T, minOp<scalar>()); - reduce(n, sumOp<label>()); - - if (n > 0) + if (returnReduce(nonEmpty, orOp<bool>())) { - return T; + return returnReduce(val, minOp<scalar>()); } - return 0.0; + return 0; } diff --git a/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollidingParcelIO.C b/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollidingParcelIO.C index 73a1b728d8132a4302557bd57331fbde2f58c7d9..afdba6e2c78616584845861a8ef2fe73dbc2461a 100644 --- a/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollidingParcelIO.C +++ b/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollidingParcelIO.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2011-2011, 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2017 OpenFOAM Foundation @@ -164,10 +164,8 @@ void Foam::CollidingParcel<ParcelType>::readFields(CloudType& c) label i = 0; - forAllIter(typename CloudType, c, iter) + for (CollidingParcel<ParcelType>& p : c) { - CollidingParcel<ParcelType>& p = iter(); - p.f_ = f[i]; p.angularMomentum_ = angularMomentum[i]; p.torque_ = torque[i]; @@ -183,7 +181,7 @@ void Foam::CollidingParcel<ParcelType>::readFields(CloudType& c) collisionRecordsWallData[i] ); - i++; + ++i; } } @@ -245,11 +243,8 @@ void Foam::CollidingParcel<ParcelType>::writeFields(const CloudType& c) ); label i = 0; - - forAllConstIter(typename CloudType, c, iter) + for (const CollidingParcel<ParcelType>& p : c) { - const CollidingParcel<ParcelType>& p = iter(); - f[i] = p.f(); angularMomentum[i] = p.angularMomentum(); torque[i] = p.torque(); @@ -264,7 +259,7 @@ void Foam::CollidingParcel<ParcelType>::writeFields(const CloudType& c) collisionRecordsWallPRel[i] = p.collisionRecords().wallPRel(); collisionRecordsWallData[i] = p.collisionRecords().wallData(); - i++; + ++i; } const bool valid = (np > 0); @@ -303,15 +298,13 @@ void Foam::CollidingParcel<ParcelType>::writeObjects IOField<vector>& torque(cloud::createIOField<vector>("torque", np, obr)); label i = 0; - forAllConstIter(typename CloudType, c, iter) + for (const CollidingParcel<ParcelType>& p : c) { - const CollidingParcel<ParcelType>& p = iter(); - f[i] = p.f(); angularMomentum[i] = p.angularMomentum(); torque[i] = p.torque(); - i++; + ++i; } } diff --git a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelIO.C b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelIO.C index 218aebf2e22959793fa27f51da306401784018ce..2ccab76918d12e8d33038ab4bc903dbcdfefdbe3 100644 --- a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelIO.C +++ b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelIO.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2008-2011, 2016 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011, 2016-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2017 OpenFOAM Foundation @@ -176,10 +176,8 @@ void Foam::KinematicParcel<ParcelType>::readFields(CloudType& c) label i = 0; - forAllIter(typename CloudType, c, iter) + for (KinematicParcel<ParcelType>& p : c) { - KinematicParcel<ParcelType>& p = iter(); - p.active_ = active[i]; p.typeId_ = typeId[i]; p.nParticle_ = nParticle[i]; @@ -191,7 +189,7 @@ void Foam::KinematicParcel<ParcelType>::readFields(CloudType& c) p.tTurb_ = tTurb[i]; p.UTurb_ = UTurb[i]; - i++; + ++i; } } @@ -221,10 +219,8 @@ void Foam::KinematicParcel<ParcelType>::writeFields(const CloudType& c) label i = 0; - forAllConstIter(typename CloudType, c, iter) + for (const KinematicParcel<ParcelType>& p : c) { - const KinematicParcel<ParcelType>& p = iter(); - active[i] = p.active(); typeId[i] = p.typeId(); nParticle[i] = p.nParticle(); @@ -236,7 +232,7 @@ void Foam::KinematicParcel<ParcelType>::writeFields(const CloudType& c) tTurb[i] = p.tTurb(); UTurb[i] = p.UTurb(); - i++; + ++i; } const bool valid = np > 0; @@ -282,10 +278,8 @@ void Foam::KinematicParcel<ParcelType>::writeObjects label i = 0; - forAllConstIter(typename CloudType, c, iter) + for (const KinematicParcel<ParcelType>& p : c) { - const KinematicParcel<ParcelType>& p = iter(); - active[i] = p.active(); typeId[i] = p.typeId(); nParticle[i] = p.nParticle(); @@ -297,7 +291,7 @@ void Foam::KinematicParcel<ParcelType>::writeObjects tTurb[i] = p.tTurb(); UTurb[i] = p.UTurb(); - i++; + ++i; } } diff --git a/src/lagrangian/intermediate/parcels/Templates/MPPICParcel/MPPICParcelIO.C b/src/lagrangian/intermediate/parcels/Templates/MPPICParcel/MPPICParcelIO.C index eca3721a9fb1395a569cb3157ae06808acb3a501..f300d89c0c9fdfaa13cae34cf9808c1554a8bc04 100644 --- a/src/lagrangian/intermediate/parcels/Templates/MPPICParcel/MPPICParcelIO.C +++ b/src/lagrangian/intermediate/parcels/Templates/MPPICParcel/MPPICParcelIO.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2013-2017 OpenFOAM Foundation @@ -92,14 +92,11 @@ void Foam::MPPICParcel<ParcelType>::readFields(CloudType& c) c.checkFieldIOobject(c, UCorrect); label i = 0; - - forAllIter(typename CloudType, c, iter) + for (MPPICParcel<ParcelType>& p : c) { - MPPICParcel<ParcelType>& p = iter(); - p.UCorrect_ = UCorrect[i]; - i++; + ++i; } } @@ -117,13 +114,11 @@ void Foam::MPPICParcel<ParcelType>::writeFields(const CloudType& c) label i = 0; - forAllConstIter(typename CloudType, c, iter) + for (const MPPICParcel<ParcelType>& p : c) { - const MPPICParcel<ParcelType>& p = iter(); - UCorrect[i] = p.UCorrect(); - i++; + ++i; } UCorrect.write(np > 0); @@ -147,13 +142,11 @@ void Foam::MPPICParcel<ParcelType>::writeObjects label i = 0; - forAllConstIter(typename CloudType, c, iter) + for (const MPPICParcel<ParcelType>& p : c) { - const MPPICParcel<ParcelType>& p = iter(); - UCorrect[i] = p.UCorrect(); - i++; + ++i; } } diff --git a/src/lagrangian/intermediate/parcels/Templates/MPPICParcel/MPPICParcelTrackingDataI.H b/src/lagrangian/intermediate/parcels/Templates/MPPICParcel/MPPICParcelTrackingDataI.H index e9416d8784125df72430b7a74e9cc652a9ffb119..c0f585445943cc330580b2dc416589bd9956f25a 100644 --- a/src/lagrangian/intermediate/parcels/Templates/MPPICParcel/MPPICParcelTrackingDataI.H +++ b/src/lagrangian/intermediate/parcels/Templates/MPPICParcel/MPPICParcelTrackingDataI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | + \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2013-2017 OpenFOAM Foundation @@ -174,9 +174,8 @@ inline void Foam::MPPICParcel<ParcelType>::trackingData::updateAverages AveragingMethod<scalar>& weightAverage = weightAveragePtr(); // averaging sums - forAllConstIter(typename TrackCloudType, cloud, iter) + for (const typename TrackCloudType::parcelType& p : cloud) { - const typename TrackCloudType::parcelType& p = iter(); const tetIndices tetIs = p.currentTetIndices(); const scalar m = p.nParticle()*p.mass(); @@ -192,9 +191,8 @@ inline void Foam::MPPICParcel<ParcelType>::trackingData::updateAverages uAverage_->average(*massAverage_); // squared velocity deviation - forAllConstIter(typename TrackCloudType, cloud, iter) + for (const typename TrackCloudType::parcelType& p : cloud) { - const typename TrackCloudType::parcelType& p = iter(); const tetIndices tetIs = p.currentTetIndices(); const vector u = uAverage_->interpolate(p.coordinates(), tetIs); @@ -211,9 +209,8 @@ inline void Foam::MPPICParcel<ParcelType>::trackingData::updateAverages // sauter mean radius radiusAverage_() = volumeAverage_(); weightAverage = 0; - forAllConstIter(typename TrackCloudType, cloud, iter) + for (const typename TrackCloudType::parcelType& p : cloud) { - const typename TrackCloudType::parcelType& p = iter(); const tetIndices tetIs = p.currentTetIndices(); weightAverage.add @@ -228,9 +225,8 @@ inline void Foam::MPPICParcel<ParcelType>::trackingData::updateAverages // collision frequency weightAverage = 0; - forAllConstIter(typename TrackCloudType, cloud, iter) + for (const typename TrackCloudType::parcelType& p : cloud) { - const typename TrackCloudType::parcelType& p = iter(); const tetIndices tetIs = p.currentTetIndices(); const scalar a = volumeAverage_->interpolate(p.coordinates(), tetIs); diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelIO.C b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelIO.C index 05c0dc33f265e610a37c2c5fa72648e3bd4a87d0..601c238ae30cd7fe1e0e0802467b9f7a35658b7e 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelIO.C +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelIO.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2008-2011, 2016 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011, 2016-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2017 OpenFOAM Foundation @@ -115,9 +115,8 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::readFields const wordList& stateLabels = compModel.stateLabels(); // Set storage for each Y... for each parcel - forAllIter(typename Cloud<ReactingMultiphaseParcel<ParcelType>>, c, iter) + for (ReactingMultiphaseParcel<ParcelType>& p : c) { - ReactingMultiphaseParcel<ParcelType>& p = iter(); p.YGas_.setSize(gasNames.size(), 0.0); p.YLiquid_.setSize(liquidNames.size(), 0.0); p.YSolid_.setSize(solidNames.size(), 0.0); @@ -137,14 +136,8 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::readFields ); label i = 0; - forAllIter - ( - typename Cloud<ReactingMultiphaseParcel<ParcelType>>, - c, - iter - ) + for (ReactingMultiphaseParcel<ParcelType>& p : c) { - ReactingMultiphaseParcel<ParcelType>& p = iter(); p.YGas_[j] = YGas[i++]/(p.Y()[GAS] + ROOTVSMALL); } } @@ -162,14 +155,8 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::readFields ); label i = 0; - forAllIter - ( - typename Cloud<ReactingMultiphaseParcel<ParcelType>>, - c, - iter - ) + for (ReactingMultiphaseParcel<ParcelType>& p : c) { - ReactingMultiphaseParcel<ParcelType>& p = iter(); p.YLiquid_[j] = YLiquid[i++]/(p.Y()[LIQ] + ROOTVSMALL); } } @@ -187,14 +174,8 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::readFields ); label i = 0; - forAllIter - ( - typename Cloud<ReactingMultiphaseParcel<ParcelType>>, - c, - iter - ) + for (ReactingMultiphaseParcel<ParcelType>& p : c) { - ReactingMultiphaseParcel<ParcelType>& p = iter(); p.YSolid_[j] = YSolid[i++]/(p.Y()[SLD] + ROOTVSMALL); } } @@ -240,14 +221,8 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::writeFields ); label i = 0; - forAllConstIter - ( - typename Cloud<ReactingMultiphaseParcel<ParcelType>>, - c, - iter - ) + for (const ReactingMultiphaseParcel<ParcelType>& p0 : c) { - const ReactingMultiphaseParcel<ParcelType>& p0 = iter(); YGas[i++] = p0.YGas()[j]*p0.Y()[GAS]; } @@ -269,14 +244,8 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::writeFields ); label i = 0; - forAllConstIter - ( - typename Cloud<ReactingMultiphaseParcel<ParcelType>>, - c, - iter - ) + for (const ReactingMultiphaseParcel<ParcelType>& p0 : c) { - const ReactingMultiphaseParcel<ParcelType>& p0 = iter(); YLiquid[i++] = p0.YLiquid()[j]*p0.Y()[LIQ]; } @@ -298,14 +267,8 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::writeFields ); label i = 0; - forAllConstIter - ( - typename Cloud<ReactingMultiphaseParcel<ParcelType>>, - c, - iter - ) + for (const ReactingMultiphaseParcel<ParcelType>& p0 : c) { - const ReactingMultiphaseParcel<ParcelType>& p0 = iter(); YSolid[i++] = p0.YSolid()[j]*p0.Y()[SLD]; } @@ -356,14 +319,8 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::writeObjects ); label i = 0; - forAllConstIter - ( - typename Cloud<ReactingMultiphaseParcel<ParcelType>>, - c, - iter - ) + for (const ReactingMultiphaseParcel<ParcelType>& p0 : c) { - const ReactingMultiphaseParcel<ParcelType>& p0 = iter(); YGas[i++] = p0.YGas()[j]*p0.Y()[GAS]; } } @@ -379,14 +336,8 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::writeObjects ); label i = 0; - forAllConstIter - ( - typename Cloud<ReactingMultiphaseParcel<ParcelType>>, - c, - iter - ) + for (const ReactingMultiphaseParcel<ParcelType>& p0 : c) { - const ReactingMultiphaseParcel<ParcelType>& p0 = iter(); YLiquid[i++] = p0.YLiquid()[j]*p0.Y()[LIQ]; } } @@ -402,14 +353,8 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::writeObjects ); label i = 0; - forAllConstIter - ( - typename Cloud<ReactingMultiphaseParcel<ParcelType>>, - c, - iter - ) + for (const ReactingMultiphaseParcel<ParcelType>& p0 : c) { - const ReactingMultiphaseParcel<ParcelType>& p0 = iter(); YSolid[i++] = p0.YSolid()[j]*p0.Y()[SLD]; } } diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelIO.C b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelIO.C index 6af4f3c2a93de42c025d76224ae2bdeca3ba39c5..49a0ef0cf958ba24d58bf7b7fd7430f6841436e2 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelIO.C +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelIO.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2008-2011, 2016 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011, 2016-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2017 OpenFOAM Foundation @@ -109,10 +109,11 @@ void Foam::ReactingParcel<ParcelType>::readFields c.checkFieldIOobject(c, mass0); label i = 0; - forAllIter(typename Cloud<ReactingParcel<ParcelType>>, c, iter) + for (ReactingParcel<ParcelType>& p : c) { - ReactingParcel<ParcelType>& p = iter(); - p.mass0_ = mass0[i++]; + p.mass0_ = mass0[i]; + + ++i; } // Get names and sizes for each Y... @@ -126,9 +127,8 @@ void Foam::ReactingParcel<ParcelType>::readFields // Set storage for each Y... for each parcel - forAllIter(typename Cloud<ReactingParcel<ParcelType>>, c, iter) + for (ReactingParcel<ParcelType>& p : c) { - ReactingParcel<ParcelType>& p = iter(); p.Y_.setSize(nPhases, 0.0); } @@ -146,10 +146,11 @@ void Foam::ReactingParcel<ParcelType>::readFields ); label i = 0; - forAllIter(typename Cloud<ReactingParcel<ParcelType>>, c, iter) + for (ReactingParcel<ParcelType>& p : c) { - ReactingParcel<ParcelType>& p = iter(); - p.Y_[j] = Y[i++]; + p.Y_[j] = Y[i]; + + ++i; } } } @@ -179,10 +180,11 @@ void Foam::ReactingParcel<ParcelType>::writeFields IOField<scalar> mass0(c.fieldIOobject("mass0", IOobject::NO_READ), np); label i = 0; - forAllConstIter(typename Cloud<ReactingParcel<ParcelType>>, c, iter) + for (const ReactingParcel<ParcelType>& p : c) { - const ReactingParcel<ParcelType>& p = iter(); mass0[i++] = p.mass0_; + + ++i; } mass0.write(np > 0); @@ -205,16 +207,13 @@ void Foam::ReactingParcel<ParcelType>::writeFields ), np ); + label i = 0; - forAllConstIter - ( - typename Cloud<ReactingParcel<ParcelType>>, - c, - iter - ) + for (const ReactingParcel<ParcelType>& p : c) { - const ReactingParcel<ParcelType>& p = iter(); - Y[i++] = p.Y()[j]; + Y[i] = p.Y()[j]; + + ++i; } Y.write(np > 0); @@ -253,10 +252,11 @@ void Foam::ReactingParcel<ParcelType>::writeObjects IOField<scalar>& mass0(cloud::createIOField<scalar>("mass0", np, obr)); label i = 0; - forAllConstIter(typename Cloud<ReactingParcel<ParcelType>>, c, iter) + for (const ReactingParcel<ParcelType>& p : c) { - const ReactingParcel<ParcelType>& p = iter(); - mass0[i++] = p.mass0_; + mass0[i] = p.mass0_; + + ++i; } // Write the composition fractions @@ -276,15 +276,11 @@ void Foam::ReactingParcel<ParcelType>::writeObjects ); label i = 0; - forAllConstIter - ( - typename Cloud<ReactingParcel<ParcelType>>, - c, - iter - ) + for (const ReactingParcel<ParcelType>& p : c) { - const ReactingParcel<ParcelType>& p = iter(); - Y[i++] = p.Y()[j]; + Y[i] = p.Y()[j]; + + ++i; } } } diff --git a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcelIO.C b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcelIO.C index 2384cac0fd92b79ec5b401d8c6a5be51d073a23d..1a90e14169b31126b2980506998088e3606cfabc 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcelIO.C +++ b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcelIO.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2008-2011, 2016 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011, 2016-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2017 OpenFOAM Foundation @@ -94,13 +94,11 @@ void Foam::ThermoParcel<ParcelType>::readFields(CloudType& c) label i = 0; - forAllIter(typename Cloud<ThermoParcel<ParcelType>>, c, iter) + for (ThermoParcel<ParcelType>& p : c) { - ThermoParcel<ParcelType>& p = iter(); - p.T_ = T[i]; p.Cp_ = Cp[i]; - i++; + ++i; } } @@ -117,13 +115,11 @@ void Foam::ThermoParcel<ParcelType>::writeFields(const CloudType& c) IOField<scalar> Cp(c.fieldIOobject("Cp", IOobject::NO_READ), np); label i = 0; - forAllConstIter(typename Cloud<ThermoParcel<ParcelType>>, c, iter) + for (const ThermoParcel<ParcelType>& p : c) { - const ThermoParcel<ParcelType>& p = iter(); - T[i] = p.T_; Cp[i] = p.Cp_; - i++; + ++i; } T.write(np > 0); @@ -147,13 +143,11 @@ void Foam::ThermoParcel<ParcelType>::writeObjects IOField<scalar>& Cp(cloud::createIOField<scalar>("Cp", np, obr)); label i = 0; - forAllConstIter(typename Cloud<ThermoParcel<ParcelType>>, c, iter) + for (const ThermoParcel<ParcelType>& p : c) { - const ThermoParcel<ParcelType>& p = iter(); - T[i] = p.T_; Cp[i] = p.Cp_; - i++; + ++i; } } diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracks.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracks.C index d08125c27c745083d00bc76ceea52f008aa283c8..57cd2f07178175b3b513aeef603c23288e7033a3 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracks.C +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracks.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011, 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2017 OpenFOAM Foundation @@ -46,10 +46,7 @@ void Foam::ParticleTracks<CloudType>::write() } else { - if (debug) - { - InfoInFunction << "cloupPtr invalid" << endl; - } + DebugInFunction << "invalid cloud pointer" << endl; } } @@ -125,23 +122,12 @@ void Foam::ParticleTracks<CloudType>::postFace(const parcelType& p, bool&) << "Cloud storage not allocated" << abort(FatalError); } - labelPairLookup::iterator iter = - faceHitCounter_.find(labelPair(p.origProc(), p.origId())); + const label count = + ++(faceHitCounter_(labelPair(p.origProc(), p.origId()), 0)); - label localI = -1; - if (iter != faceHitCounter_.end()) - { - iter()++; - localI = iter(); - } - else - { - localI = 1; - faceHitCounter_.insert(labelPair(p.origProc(), p.origId()), localI); - } + const label nSamples = floor(count/trackInterval_); - label nSamples = floor(localI/trackInterval_); - if ((localI % trackInterval_ == 0) && (nSamples < maxSamples_)) + if ((count % trackInterval_) == 0 && nSamples < maxSamples_) { cloudPtr_->append ( diff --git a/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairCollision.C b/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairCollision.C index 95248bb19f8aa108a68943ea86347bdf509c71b0..8cdf240b3b7868ca2749a5b9af30957575d31a58 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairCollision.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairCollision.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2009-2011, 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2017 OpenFOAM Foundation @@ -45,10 +45,8 @@ template<class CloudType> void Foam::PairCollision<CloudType>::preInteraction() { // Set accumulated quantities to zero - forAllIter(typename CloudType, this->owner(), iter) + for (typename CloudType::parcelType& p : this->owner()) { - typename CloudType::parcelType& p = iter(); - p.f() = Zero; p.torque() = Zero; @@ -145,11 +143,10 @@ void Foam::PairCollision<CloudType>::realReferredInteraction() // Loop over all referred parcels in the referred cell - forAllIter + for ( - typename IDLList<typename CloudType::parcelType>, - refCellRefParticles, - referredParcel + typename CloudType::parcelType& referredParcel + : refCellRefParticles ) { // Loop over all real cells in that the referred cell is @@ -165,7 +162,7 @@ void Foam::PairCollision<CloudType>::realReferredInteraction() evaluatePair ( *realCellParcels[realParcelI], - referredParcel() + referredParcel ); } } @@ -481,10 +478,8 @@ void Foam::PairCollision<CloudType>::postInteraction() { // Delete any collision records where no collision occurred this step - forAllIter(typename CloudType, this->owner(), iter) + for (typename CloudType::parcelType& p : this->owner()) { - typename CloudType::parcelType& p = iter(); - p.collisionRecords().update(); } } diff --git a/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairModel/PairSpringSliderDashpot/PairSpringSliderDashpot.C b/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairModel/PairSpringSliderDashpot/PairSpringSliderDashpot.C index b0a118d2dc53c9c7abbfad66c7fc96862f059637..165d923e136e2c11c10424b37230f2942c5a2f96 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairModel/PairSpringSliderDashpot/PairSpringSliderDashpot.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairModel/PairSpringSliderDashpot/PairSpringSliderDashpot.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2008-2011, 2018 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011, 2018-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2017 OpenFOAM Foundation @@ -41,10 +41,8 @@ void Foam::PairSpringSliderDashpot<CloudType>::findMinMaxProperties rhoMax = -VGREAT; UMagMax = -VGREAT; - forAllConstIter(typename CloudType, this->owner(), iter) + for (const typename CloudType::parcelType& p : this->owner()) { - const typename CloudType::parcelType& p = iter(); - // Finding minimum diameter to avoid excessive arithmetic scalar dEff = p.d(); @@ -125,13 +123,6 @@ Foam::PairSpringSliderDashpot<CloudType>::PairSpringSliderDashpot } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template<class CloudType> -Foam::PairSpringSliderDashpot<CloudType>::~PairSpringSliderDashpot() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class CloudType> diff --git a/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairModel/PairSpringSliderDashpot/PairSpringSliderDashpot.H b/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairModel/PairSpringSliderDashpot/PairSpringSliderDashpot.H index 3430d4c2b2aa882450efc8e0a58aa441165c4307..60c2bb5e9d3f2a8297d1ec8c392b79e43e491311 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairModel/PairSpringSliderDashpot/PairSpringSliderDashpot.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairModel/PairSpringSliderDashpot/PairSpringSliderDashpot.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011, 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2016 OpenFOAM Foundation @@ -136,7 +136,7 @@ public: //- Destructor - virtual ~PairSpringSliderDashpot(); + virtual ~PairSpringSliderDashpot() = default; // Member Functions diff --git a/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/WallModel/WallLocalSpringSliderDashpot/WallLocalSpringSliderDashpot.C b/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/WallModel/WallLocalSpringSliderDashpot/WallLocalSpringSliderDashpot.C index ba3c76d69fcb3564173109c5a5ea535626a12b26..f065942eb0329f41a293feef767b10c34a45d983 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/WallModel/WallLocalSpringSliderDashpot/WallLocalSpringSliderDashpot.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/WallModel/WallLocalSpringSliderDashpot/WallLocalSpringSliderDashpot.C @@ -41,10 +41,8 @@ void Foam::WallLocalSpringSliderDashpot<CloudType>::findMinMaxProperties rhoMax = -VGREAT; UMagMax = -VGREAT; - forAllConstIter(typename CloudType, this->owner(), iter) + for (const typename CloudType::parcelType& p : this->owner()) { - const typename CloudType::parcelType& p = iter(); - // Finding minimum diameter to avoid excessive arithmetic scalar dEff = p.d(); @@ -213,11 +211,11 @@ Foam::WallLocalSpringSliderDashpot<CloudType>::WallLocalSpringSliderDashpot DynamicList<label> wallPatchIndices; - forAll(bMesh, patchi) + for (const polyPatch& pp : bMesh) { - if (isA<wallPolyPatch>(bMesh[patchi])) + if (isA<wallPolyPatch>(pp)) { - wallPatchIndices.append(bMesh[patchi].index()); + wallPatchIndices.append(pp.index()); } } @@ -271,13 +269,6 @@ Foam::WallLocalSpringSliderDashpot<CloudType>::WallLocalSpringSliderDashpot } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template<class CloudType> -Foam::WallLocalSpringSliderDashpot<CloudType>::~WallLocalSpringSliderDashpot() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class CloudType> diff --git a/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/WallModel/WallLocalSpringSliderDashpot/WallLocalSpringSliderDashpot.H b/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/WallModel/WallLocalSpringSliderDashpot/WallLocalSpringSliderDashpot.H index 270c2f42a7b98eb7c07a6ca9c93004479b6e055e..6aa075a2197626ba430f2c4e71f5a9fbe4e3939f 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/WallModel/WallLocalSpringSliderDashpot/WallLocalSpringSliderDashpot.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/WallModel/WallLocalSpringSliderDashpot/WallLocalSpringSliderDashpot.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011, 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2016 OpenFOAM Foundation @@ -150,7 +150,7 @@ public: //- Destructor - virtual ~WallLocalSpringSliderDashpot(); + virtual ~WallLocalSpringSliderDashpot() = default; // Member Functions diff --git a/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/WallModel/WallSpringSliderDashpot/WallSpringSliderDashpot.C b/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/WallModel/WallSpringSliderDashpot/WallSpringSliderDashpot.C index 3e5532ac85339de9832f5cc0b98a6e5ff86559ba..7737e87d0a871d8e6014f0345e352fa5fb497a0c 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/WallModel/WallSpringSliderDashpot/WallSpringSliderDashpot.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/WallModel/WallSpringSliderDashpot/WallSpringSliderDashpot.C @@ -41,10 +41,8 @@ void Foam::WallSpringSliderDashpot<CloudType>::findMinMaxProperties rhoMax = -VGREAT; UMagMax = -VGREAT; - forAllConstIter(typename CloudType, this->owner(), iter) + for (const typename CloudType::parcelType& p : this->owner()) { - const typename CloudType::parcelType& p = iter(); - // Finding minimum diameter to avoid excessive arithmetic scalar dEff = p.d(); diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectedParticleDistributionInjection/InjectedParticleDistributionInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectedParticleDistributionInjection/InjectedParticleDistributionInjection.C index 024abb64b6888a8dd767e7b08f27bcc1f4e34309..4dead397e3cd54a4c2c7e957a8a9b477bf39ade4 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectedParticleDistributionInjection/InjectedParticleDistributionInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectedParticleDistributionInjection/InjectedParticleDistributionInjection.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2015-2016 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2015-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -45,9 +45,8 @@ void Foam::InjectedParticleDistributionInjection<CloudType>::initialise() // Flatten all data label particlei = 0; - forAllConstIter(injectedParticleCloud, ipCloud, iter) + for (const injectedParticle& p : ipCloud) { - const injectedParticle& p = iter(); tag[particlei] = p.tag(); position[particlei] = p.position(); U[particlei] = p.U(); diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectedParticleInjection/InjectedParticleInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectedParticleInjection/InjectedParticleInjection.C index 47a0102e736819d6bd86f63ed448f4cb34144976..58a4a28b680d71f4cb2239cadfa263dfd3641a58 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectedParticleInjection/InjectedParticleInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectedParticleInjection/InjectedParticleInjection.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2015-2016 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2015-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -46,16 +46,14 @@ void Foam::InjectedParticleInjection<CloudType>::initialise() label particlei = 0; - forAllConstIter(injectedParticleCloud, cloud, iter) + for (const injectedParticle& p : cloud) { - const injectedParticle& p = iter(); - time[particlei] = p.soi(); position[particlei] = p.position() + positionOffset_; diameter[particlei] = p.d(); U[particlei] = p.U(); - particlei++; + ++particlei; } // Combine all proc data @@ -218,13 +216,6 @@ Foam::InjectedParticleInjection<CloudType>::InjectedParticleInjection {} -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template<class CloudType> -Foam::InjectedParticleInjection<CloudType>::~InjectedParticleInjection() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class CloudType> @@ -289,7 +280,7 @@ Foam::label Foam::InjectedParticleInjection<CloudType>::parcelsToInject { if ((time_[particlei] >= time0) && (time_[particlei] < time1)) { - nParticles++; + ++nParticles; } } diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectedParticleInjection/InjectedParticleInjection.H b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectedParticleInjection/InjectedParticleInjection.H index a87c72ecfda57e2326c19f97f570fe6f8d5f2508..71f607b02d4f5960a33a5fc8c3a095027fb2b5ce 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectedParticleInjection/InjectedParticleInjection.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectedParticleInjection/InjectedParticleInjection.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2015-2016 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2015-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -155,7 +155,7 @@ public: //- Destructor - virtual ~InjectedParticleInjection(); + virtual ~InjectedParticleInjection() = default; // Member Functions diff --git a/src/lagrangian/intermediate/submodels/MPPIC/IsotropyModels/Stochastic/Stochastic.C b/src/lagrangian/intermediate/submodels/MPPIC/IsotropyModels/Stochastic/Stochastic.C index b3363396d058c2521d5fa2e0fe44914d363b6d08..997298ce25e4c7b29cee2e09243bbdf97b24c971 100644 --- a/src/lagrangian/intermediate/submodels/MPPIC/IsotropyModels/Stochastic/Stochastic.C +++ b/src/lagrangian/intermediate/submodels/MPPIC/IsotropyModels/Stochastic/Stochastic.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | + \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2013-2017 OpenFOAM Foundation @@ -165,9 +165,8 @@ void Foam::IsotropyModels::Stochastic<CloudType>::calculate() )(); // random sampling - forAllIter(typename CloudType, this->owner(), iter) + for (typename CloudType::parcelType& p : this->owner()) { - typename CloudType::parcelType& p = iter(); const tetIndices tetIs(p.currentTetIndices()); const scalar x = exponentAverage.interpolate(p.coordinates(), tetIs); @@ -200,9 +199,8 @@ void Foam::IsotropyModels::Stochastic<CloudType>::calculate() ) ); AveragingMethod<vector>& uTildeAverage = uTildeAveragePtr(); - forAllIter(typename CloudType, this->owner(), iter) + for (typename CloudType::parcelType& p : this->owner()) { - typename CloudType::parcelType& p = iter(); const tetIndices tetIs(p.currentTetIndices()); uTildeAverage.add(p.coordinates(), tetIs, p.nParticle()*p.mass()*p.U()); } @@ -223,9 +221,8 @@ void Foam::IsotropyModels::Stochastic<CloudType>::calculate() ) ); AveragingMethod<scalar>& uTildeSqrAverage = uTildeSqrAveragePtr(); - forAllIter(typename CloudType, this->owner(), iter) + for (typename CloudType::parcelType& p : this->owner()) { - typename CloudType::parcelType& p = iter(); const tetIndices tetIs(p.currentTetIndices()); const vector uTilde = uTildeAverage.interpolate(p.coordinates(), tetIs); uTildeSqrAverage.add @@ -238,9 +235,8 @@ void Foam::IsotropyModels::Stochastic<CloudType>::calculate() uTildeSqrAverage.average(massAverage); // conservation correction - forAllIter(typename CloudType, this->owner(), iter) + for (typename CloudType::parcelType& p : this->owner()) { - typename CloudType::parcelType& p = iter(); const tetIndices tetIs(p.currentTetIndices()); const vector u = uAverage.interpolate(p.coordinates(), tetIs); diff --git a/src/lagrangian/intermediate/submodels/ReactingMultiphase/StochasticCollision/SuppressionCollision/SuppressionCollision.C b/src/lagrangian/intermediate/submodels/ReactingMultiphase/StochasticCollision/SuppressionCollision/SuppressionCollision.C index 96dc5b9bce9274172179ab6cb680759be321d9df..98add17f05a8727530d9a3ee7bfb7c59056fd8f0 100644 --- a/src/lagrangian/intermediate/submodels/ReactingMultiphase/StochasticCollision/SuppressionCollision/SuppressionCollision.C +++ b/src/lagrangian/intermediate/submodels/ReactingMultiphase/StochasticCollision/SuppressionCollision/SuppressionCollision.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | + \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2013-2017 OpenFOAM Foundation @@ -46,10 +46,9 @@ void Foam::SuppressionCollision<CloudType>::collide dimensionedScalar Dt("dt", dimTime, dt); volScalarField P(type() + ":p", 1.0 - exp(-vDotSweep*Dt)); - forAllIter(typename CloudType, this->owner(), iter) + for (typename CloudType::parcelType& p : this->owner()) { - typename CloudType::parcelType& p = iter(); - label celli = p.cell(); + const label celli = p.cell(); scalar xx = this->owner().rndGen().template sample01<scalar>();