diff --git a/applications/solvers/DNS/dnsFoam/dnsFoam.C b/applications/solvers/DNS/dnsFoam/dnsFoam.C index 87720db898c6264bd45bae02a663ad82d6168078..cf5da63f97f20cabc78e6b2bc555b2e58969bc88 100644 --- a/applications/solvers/DNS/dnsFoam/dnsFoam.C +++ b/applications/solvers/DNS/dnsFoam/dnsFoam.C @@ -66,7 +66,7 @@ int main(int argc, char *argv[]) fft::reverseTransform ( K/(mag(K) + 1.0e-6) ^ forceGen.newField(), K.nn() - ) + )*recRootN ); #include "globalProperties.H" diff --git a/applications/solvers/DNS/dnsFoam/readTurbulenceProperties.H b/applications/solvers/DNS/dnsFoam/readTurbulenceProperties.H index 0d6b417d5ab7084596f490151e2fa393516703f0..0b44eed10cfea2bf319a713ac20a21240e9a5832 100644 --- a/applications/solvers/DNS/dnsFoam/readTurbulenceProperties.H +++ b/applications/solvers/DNS/dnsFoam/readTurbulenceProperties.H @@ -19,3 +19,10 @@ Kmesh K(mesh); UOprocess forceGen(K, runTime.deltaTValue(), turbulenceProperties); + + label ntot = 1; + forAll(K.nn(), idim) + { + ntot *= K.nn()[idim]; + } + const scalar recRootN = 1.0/Foam::sqrt(scalar(ntot)); diff --git a/applications/solvers/combustion/PDRFoam/PDRFoam.C b/applications/solvers/combustion/PDRFoam/PDRFoam.C index 4e6173894678eeefc30f436ccbada9ba4ffaf0c8..2511b8da1237bd2caa04145359b416c48dcdcd93 100644 --- a/applications/solvers/combustion/PDRFoam/PDRFoam.C +++ b/applications/solvers/combustion/PDRFoam/PDRFoam.C @@ -78,7 +78,6 @@ Description #include "XiModel.H" #include "PDRDragModel.H" #include "ignition.H" -#include "Switch.H" #include "bound.H" #include "pimpleControl.H" #include "fvOptions.H" diff --git a/applications/solvers/combustion/PDRFoam/PDRFoamAutoRefine.C b/applications/solvers/combustion/PDRFoam/PDRFoamAutoRefine.C index 60618232e0384edfd652cc446cc3d1d42bd0b998..48a9aaf5c86bc36ec845bc0c170a709c8ad2eca8 100644 --- a/applications/solvers/combustion/PDRFoam/PDRFoamAutoRefine.C +++ b/applications/solvers/combustion/PDRFoam/PDRFoamAutoRefine.C @@ -63,7 +63,6 @@ Description #include "XiModel.H" #include "PDRDragModel.H" #include "ignition.H" -#include "Switch.H" #include "bound.H" #include "dynamicRefineFvMesh.H" #include "pimpleControl.H" diff --git a/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/PDRDragModel/PDRDragModel.C b/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/PDRDragModel/PDRDragModel.C index 2b2cd7c4fdbe21cc37115da1b050dffceaa40ded..175c5f4f1cd050e7c2c7ec445f52f7297d366511 100644 --- a/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/PDRDragModel/PDRDragModel.C +++ b/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/PDRDragModel/PDRDragModel.C @@ -58,14 +58,14 @@ Foam::PDRDragModel::PDRDragModel ( PDRProperties.subDict ( - word(PDRProperties.lookup("PDRDragModel")) + "Coeffs" + PDRProperties.get<word>("PDRDragModel") + "Coeffs" ) ), turbulence_(turbulence), rho_(rho), U_(U), phi_(phi), - on_(PDRDragModelCoeffs_.lookup("drag")) + on_(PDRDragModelCoeffs_.get<bool>("drag")) {} @@ -81,7 +81,7 @@ bool Foam::PDRDragModel::read(const dictionary& PDRProperties) { PDRDragModelCoeffs_ = PDRProperties.optionalSubDict(type() + "Coeffs"); - PDRDragModelCoeffs_.lookup("drag") >> on_; + PDRDragModelCoeffs_.read("drag", on_); return true; } diff --git a/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/PDRDragModel/PDRDragModel.H b/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/PDRDragModel/PDRDragModel.H index 66c1abb44a7680250e8068118cc88375247521ce..c4a52f3f022403088869f69c901058476b68e027 100644 --- a/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/PDRDragModel/PDRDragModel.H +++ b/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/PDRDragModel/PDRDragModel.H @@ -67,7 +67,7 @@ protected: const volVectorField& U_; const surfaceScalarField& phi_; - Switch on_; + bool on_; private: diff --git a/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/PDRDragModel/PDRDragModelNew.C b/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/PDRDragModel/PDRDragModelNew.C index 25a4a2098edcf0197458e5d45a2d03d3ce7662fd..0069477baca7ec241ad920f5f8cb4ad750307ca8 100644 --- a/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/PDRDragModel/PDRDragModelNew.C +++ b/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/PDRDragModel/PDRDragModelNew.C @@ -36,9 +36,9 @@ Foam::autoPtr<Foam::PDRDragModel> Foam::PDRDragModel::New const surfaceScalarField& phi ) { - const word modelType(PDRProperties.lookup("PDRDragModel")); + const word modelType(PDRProperties.get<word>("PDRDragModel")); - Info<< "Selecting flame-wrinkling model " << modelType << endl; + Info<< "Selecting drag model " << modelType << endl; auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType); diff --git a/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/basic/basic.C b/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/basic/basic.C index 5f3e6f1bc5640252cbdaa5e2b6723ee199feac23..821380fe04c71d82520fb490198a9db0f01f2571 100644 --- a/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/basic/basic.C +++ b/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/basic/basic.C @@ -165,8 +165,8 @@ bool Foam::PDRDragModels::basic::read(const dictionary& PDRProperties) { PDRDragModel::read(PDRProperties); - PDRDragModelCoeffs_.lookup("Csu") >> Csu.value(); - PDRDragModelCoeffs_.lookup("Csk") >> Csk.value(); + PDRDragModelCoeffs_.read("Csu", Csu.value()); + PDRDragModelCoeffs_.read("Csk", Csk.value()); return true; } diff --git a/applications/solvers/combustion/chemFoam/createControls.H b/applications/solvers/combustion/chemFoam/createControls.H index 6aeb2fff15ac894a9faaba86e84228f9ed9492b4..f06814dc2beb415969da08a68fb99705501b6373 100644 --- a/applications/solvers/combustion/chemFoam/createControls.H +++ b/applications/solvers/combustion/chemFoam/createControls.H @@ -1,2 +1,3 @@ -Switch adjustTimeStep(runTime.controlDict().lookup("adjustTimeStep")); -scalar maxDeltaT(readScalar(runTime.controlDict().lookup("maxDeltaT"))); +bool adjustTimeStep(runTime.controlDict().get<bool>("adjustTimeStep")); + +scalar maxDeltaT(runTime.controlDict().get<scalar>("maxDeltaT")); diff --git a/applications/solvers/combustion/chemFoam/readControls.H b/applications/solvers/combustion/chemFoam/readControls.H index c56206df1acce4568adf02b6dc7587f687d6d356..09937a19a623363cabc5b71d476d342f2dbd104e 100644 --- a/applications/solvers/combustion/chemFoam/readControls.H +++ b/applications/solvers/combustion/chemFoam/readControls.H @@ -1,3 +1,3 @@ -runTime.controlDict().lookup("adjustTimeStep") >> adjustTimeStep; +runTime.controlDict().read("adjustTimeStep", adjustTimeStep); -maxDeltaT = readScalar(runTime.controlDict().lookup("maxDeltaT")); +runTime.controlDict().read("maxDeltaT", maxDeltaT); diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/createZones.H b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/createZones.H index fe3d1186087af2b57fcfaa1268b5c5c00676c115..7435c6d5554ad7410e9a17cfe031359b506c6a8f 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/createZones.H +++ b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/createZones.H @@ -1,5 +1,5 @@ IOporosityModelList pZones(mesh); - Switch pressureImplicitPorosity(false); + bool pressureImplicitPorosity(false); // nUCorrectors used for pressureImplicitPorosity int nUCorr = 0; diff --git a/applications/solvers/incompressible/shallowWaterFoam/readGravitationalAcceleration.H b/applications/solvers/incompressible/shallowWaterFoam/readGravitationalAcceleration.H index d8a8bf8d0629529a7adc7e6e8c3f3eedbf0c76e0..b960a2f6406ec7762d27f7a0a9a8b7eb82552dc1 100644 --- a/applications/solvers/incompressible/shallowWaterFoam/readGravitationalAcceleration.H +++ b/applications/solvers/incompressible/shallowWaterFoam/readGravitationalAcceleration.H @@ -13,9 +13,11 @@ IOdictionary gravitationalProperties ); const dimensionedVector g(gravitationalProperties.lookup("g")); -const Switch rotating(gravitationalProperties.lookup("rotating")); +const bool rotating(gravitationalProperties.get<bool>("rotating")); const dimensionedVector Omega = +( rotating ? gravitationalProperties.lookup("Omega") - : dimensionedVector("Omega", -dimTime, vector(0,0,0)); + : dimensionedVector("Omega", -dimTime, vector(0,0,0)) +); const dimensionedScalar magg = mag(g); const dimensionedVector gHat = g/magg; diff --git a/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/createPorousZones.H b/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/createPorousZones.H index 5c6dbea19c4122682311089f3a5f3ddb16d870f6..f67c6d7890a480636a0dbcc8a9b38fb8dda7e190 100644 --- a/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/createPorousZones.H +++ b/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/createPorousZones.H @@ -1,5 +1,5 @@ IOporosityModelList pZones(mesh); - Switch pressureImplicitPorosity(false); + bool pressureImplicitPorosity(false); // nUCorrectors used for pressureImplicitPorosity int nUCorr = 0; diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.C index d63ca7d058509397cd848d73fe2d0d1563014b68..0a2377b2f3761988f803c1ac39d74b5cfbeb2be7 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.C @@ -39,7 +39,7 @@ ThermalPhaseChangePhaseSystem HeatAndMassTransferPhaseSystem<BasePhaseSystem>(mesh), volatile_(this->lookup("volatile")), saturationModel_(saturationModel::New(this->subDict("saturationModel"))), - massTransfer_(this->lookup("massTransfer")) + massTransfer_(this->template get<bool>("massTransfer")) { forAllConstIters(this->phasePairs_, phasePairIter) @@ -357,7 +357,7 @@ void Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::correctThermo() volScalarField iDmdtNew(iDmdt); - if (massTransfer_ ) + if (massTransfer_) { volScalarField H1 ( diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.H b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.H index 611666eddc37e40fb51fa49cd75762456c631bff..7ce10e6c7a9257c2c6af86d1b89c0148483cc28a 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.H +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.H @@ -43,7 +43,6 @@ SourceFiles #include "HeatAndMassTransferPhaseSystem.H" #include "saturationModel.H" -#include "Switch.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -71,7 +70,7 @@ protected: autoPtr<saturationModel> saturationModel_; // Mass transfer enabled - Switch massTransfer_; + bool massTransfer_; //- Interfacial Mass transfer rate HashPtrTable<volScalarField, phasePairKey, phasePairKey::hash> diff --git a/applications/solvers/stressAnalysis/solidDisplacementFoam/createControl.H b/applications/solvers/stressAnalysis/solidDisplacementFoam/createControl.H index edd35297d52bc9c2261301c61f0e0c49095edae2..40e35f8c0593206d6ee6c308da26c494eede55ce 100644 --- a/applications/solvers/stressAnalysis/solidDisplacementFoam/createControl.H +++ b/applications/solvers/stressAnalysis/solidDisplacementFoam/createControl.H @@ -1,3 +1,3 @@ const dictionary& stressControl = mesh.solutionDict().subDict("stressAnalysis"); -Switch compactNormalStress(stressControl.lookup("compactNormalStress")); +bool compactNormalStress(stressControl.get<bool>("compactNormalStress")); diff --git a/applications/solvers/stressAnalysis/solidDisplacementFoam/createControls.H b/applications/solvers/stressAnalysis/solidDisplacementFoam/createControls.H index dec25226f115e1660d8d364dffb3371de219fafc..b35e04e26ed8a93b90a7f0dc29d97598aed83eb0 100644 --- a/applications/solvers/stressAnalysis/solidDisplacementFoam/createControls.H +++ b/applications/solvers/stressAnalysis/solidDisplacementFoam/createControls.H @@ -2,4 +2,4 @@ int nCorr = stressControl.lookupOrDefault<int>("nCorrectors", 1); -scalar convergenceTolerance(readScalar(stressControl.lookup("D"))); +scalar convergenceTolerance(stressControl.get<scalar>("D")); diff --git a/applications/solvers/stressAnalysis/solidDisplacementFoam/readMechanicalProperties.H b/applications/solvers/stressAnalysis/solidDisplacementFoam/readMechanicalProperties.H index a912d80e0716d2735d3cb73ce864618f058d82aa..a592de04e93df2f95f7950f023071fad52204894 100644 --- a/applications/solvers/stressAnalysis/solidDisplacementFoam/readMechanicalProperties.H +++ b/applications/solvers/stressAnalysis/solidDisplacementFoam/readMechanicalProperties.H @@ -184,9 +184,7 @@ volScalarField lambda(nu*E/((1.0 + nu)*(1.0 - 2.0*nu))); volScalarField threeK(E/(1.0 - 2.0*nu)); - Switch planeStress(mechanicalProperties.lookup("planeStress")); - - if (planeStress) + if (mechanicalProperties.get<bool>("planeStress")) { Info<< "Plane Stress\n" << endl; diff --git a/applications/solvers/stressAnalysis/solidDisplacementFoam/readSolidDisplacementFoamControls.H b/applications/solvers/stressAnalysis/solidDisplacementFoam/readSolidDisplacementFoamControls.H index 5ffe09b9e84931fde3ff9e8079100959b8fe8bdf..78beb0e717087994b29f81052081f6b4ceb7a60c 100644 --- a/applications/solvers/stressAnalysis/solidDisplacementFoam/readSolidDisplacementFoamControls.H +++ b/applications/solvers/stressAnalysis/solidDisplacementFoam/readSolidDisplacementFoamControls.H @@ -1,3 +1,3 @@ nCorr = stressControl.lookupOrDefault<int>("nCorrectors", 1); -convergenceTolerance = readScalar(stressControl.lookup("D")); -stressControl.lookup("compactNormalStress") >> compactNormalStress; +convergenceTolerance = stressControl.get<scalar>("D"); +compactNormalStress = stressControl.get<bool>("compactNormalStress"); diff --git a/applications/solvers/stressAnalysis/solidDisplacementFoam/readThermalProperties.H b/applications/solvers/stressAnalysis/solidDisplacementFoam/readThermalProperties.H index ef7a53028c9576fe5ce91d681b6a33e08a955800..3c889fc1c82016a104cef05067b067fdd8e007e5 100644 --- a/applications/solvers/stressAnalysis/solidDisplacementFoam/readThermalProperties.H +++ b/applications/solvers/stressAnalysis/solidDisplacementFoam/readThermalProperties.H @@ -12,7 +12,7 @@ IOdictionary thermalProperties ) ); -Switch thermalStress(thermalProperties.lookup("thermalStress")); +bool thermalStress(thermalProperties.get<bool>("thermalStress")); volScalarField threeKalpha ( @@ -46,7 +46,6 @@ volScalarField DT if (thermalStress) { - autoPtr<volScalarField> CPtr; IOobject CIO diff --git a/applications/solvers/stressAnalysis/solidDisplacementFoam/solidDisplacementFoam.C b/applications/solvers/stressAnalysis/solidDisplacementFoam/solidDisplacementFoam.C index 9d6a3e9dbb3ea0b0d76965e9e79b119893f90120..eb5707d2922a39ce4eec5c0a2c4f662bae65befe 100644 --- a/applications/solvers/stressAnalysis/solidDisplacementFoam/solidDisplacementFoam.C +++ b/applications/solvers/stressAnalysis/solidDisplacementFoam/solidDisplacementFoam.C @@ -39,7 +39,6 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" -#include "Switch.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/stressAnalysis/solidDisplacementFoam/tractionDisplacement/tractionDisplacementFvPatchVectorField.C b/applications/solvers/stressAnalysis/solidDisplacementFoam/tractionDisplacement/tractionDisplacementFvPatchVectorField.C index 49d62b804e1118af581be860e9dbfdc777f4536d..d4ba30045917b34df2e41d96822266cbcb4efb7e 100644 --- a/applications/solvers/stressAnalysis/solidDisplacementFoam/tractionDisplacement/tractionDisplacementFvPatchVectorField.C +++ b/applications/solvers/stressAnalysis/solidDisplacementFoam/tractionDisplacement/tractionDisplacementFvPatchVectorField.C @@ -164,9 +164,7 @@ void tractionDisplacementFvPatchVectorField::updateCoeffs() scalarField lambda(nu*E/((1.0 + nu)*(1.0 - 2.0*nu))); scalarField threeK(E/(1.0 - 2.0*nu)); - Switch planeStress(mechanicalProperties.lookup("planeStress")); - - if (planeStress) + if (mechanicalProperties.get<bool>("planeStress")) { lambda = nu*E/((1.0 + nu)*(1.0 - nu)); threeK = E/(1.0 - nu); @@ -185,9 +183,7 @@ void tractionDisplacementFvPatchVectorField::updateCoeffs() + twoMuLambda*fvPatchField<vector>::snGrad() - (n & sigmaD) )/twoMuLambda; - Switch thermalStress(thermalProperties.lookup("thermalStress")); - - if (thermalStress) + if (thermalProperties.get<bool>("thermalStress")) { const fvPatchField<scalar>& threeKalpha= patch().lookupPatchField<volScalarField, scalar>("threeKalpha"); diff --git a/applications/solvers/stressAnalysis/solidEquilibriumDisplacementFoam/solidEquilibriumDisplacementFoam.C b/applications/solvers/stressAnalysis/solidEquilibriumDisplacementFoam/solidEquilibriumDisplacementFoam.C index 61f209d3cde6590e16bbdacf4e1d09c3c0e3a332..29e8b701084b90c4eb1253b147ff9877833368f0 100644 --- a/applications/solvers/stressAnalysis/solidEquilibriumDisplacementFoam/solidEquilibriumDisplacementFoam.C +++ b/applications/solvers/stressAnalysis/solidEquilibriumDisplacementFoam/solidEquilibriumDisplacementFoam.C @@ -39,7 +39,6 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" -#include "Switch.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/stressAnalysis/solidEquilibriumDisplacementFoam/tractionDisplacementCorrection/tractionDisplacementCorrectionFvPatchVectorField.C b/applications/solvers/stressAnalysis/solidEquilibriumDisplacementFoam/tractionDisplacementCorrection/tractionDisplacementCorrectionFvPatchVectorField.C index 33c1e8a8c692dabd694b723d350212b503f1b5cd..2b90cacfdf47c035d63bd9974e31bf971b92e5ca 100644 --- a/applications/solvers/stressAnalysis/solidEquilibriumDisplacementFoam/tractionDisplacementCorrection/tractionDisplacementCorrectionFvPatchVectorField.C +++ b/applications/solvers/stressAnalysis/solidEquilibriumDisplacementFoam/tractionDisplacementCorrection/tractionDisplacementCorrectionFvPatchVectorField.C @@ -163,9 +163,7 @@ void tractionDisplacementCorrectionFvPatchVectorField::updateCoeffs() scalarField mu(E/(2.0*(1.0 + nu))); scalarField lambda(nu*E/((1.0 + nu)*(1.0 - 2.0*nu))); - Switch planeStress(mechanicalProperties.lookup("planeStress")); - - if (planeStress) + if (mechanicalProperties.get<bool>("planeStress")) { lambda = nu*E/((1.0 + nu)*(1.0 - nu)); } diff --git a/applications/utilities/mesh/advanced/refineWallLayer/refineWallLayer.C b/applications/utilities/mesh/advanced/refineWallLayer/refineWallLayer.C index 0f8b5c1ed0310a290666e89f284707f6f604ac33..256b84ee106b3916c33618f4b7425e0f0ad32b14 100644 --- a/applications/utilities/mesh/advanced/refineWallLayer/refineWallLayer.C +++ b/applications/utilities/mesh/advanced/refineWallLayer/refineWallLayer.C @@ -137,10 +137,9 @@ int main(int argc, char *argv[]) << cells.instance()/cells.local()/cells.name() << nl << endl; - for (const label celli : cells) - { - cutCells.erase(celli); - } + + cutCells.retain(cells); + Info<< "Removed from cells to cut all the ones not in set " << setName << nl << endl; } diff --git a/applications/utilities/mesh/advanced/selectCells/edgeStats.C b/applications/utilities/mesh/advanced/selectCells/edgeStats.C index 8d2fada35d8991ebbf346089df0475493075228d..c7d7f9aab74ef293297acae5836813e4133f9b17 100644 --- a/applications/utilities/mesh/advanced/selectCells/edgeStats.C +++ b/applications/utilities/mesh/advanced/selectCells/edgeStats.C @@ -89,9 +89,7 @@ Foam::edgeStats::edgeStats(const polyMesh& mesh) IOdictionary motionProperties(motionObj); - Switch twoDMotion(motionProperties.lookup("twoDMotion")); - - if (twoDMotion) + if (motionProperties.get<bool>("twoDMotion")) { Info<< "Correcting for 2D motion" << endl << endl; diff --git a/applications/utilities/mesh/advanced/snappyRefineMesh/snappyRefineMesh.C b/applications/utilities/mesh/advanced/snappyRefineMesh/snappyRefineMesh.C index 2f268c447ab3da10d60139782d198356af130ad6..6cf09730590fe40a079a7e03b6258b44c65108e0 100644 --- a/applications/utilities/mesh/advanced/snappyRefineMesh/snappyRefineMesh.C +++ b/applications/utilities/mesh/advanced/snappyRefineMesh/snappyRefineMesh.C @@ -658,9 +658,7 @@ int main(int argc, char *argv[]) IOdictionary motionProperties(motionObj); - Switch twoDMotion(motionProperties.lookup("twoDMotion")); - - if (twoDMotion) + if (motionProperties.get<bool>("twoDMotion")) { Info<< "Correcting for 2D motion" << endl << endl; correct2DPtr = new twoDPointCorrector(mesh); diff --git a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C index a19d87ad10cb25f97ba67ae3f7c596e600425ed9..ce99b04a4f3a4c488a4660115b7282c035e83430 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C +++ b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C @@ -297,7 +297,7 @@ int main(int argc, char *argv[]) autoPtr<extrudeModel> model(extrudeModel::New(dict)); // Whether to flip normals - const Switch flipNormals(dict.lookup("flipNormals")); + const bool flipNormals(dict.get<bool>("flipNormals")); // What to extrude const ExtrudeMode mode = ExtrudeModeNames.lookup @@ -983,8 +983,7 @@ int main(int argc, char *argv[]) // Merging front and back patch faces // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Switch mergeFaces(dict.lookup("mergeFaces")); - if (mergeFaces) + if (dict.get<bool>("mergeFaces")) { if (mode == MESH) { @@ -1009,7 +1008,6 @@ int main(int argc, char *argv[]) } - polyTopoChanger stitcher(mesh); stitcher.setSize(1); diff --git a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C index 3251cc203aa8dccbef4f656b73e934a492559d83..1bf2ee31385b6cef40eb5e88e6d1a029d5cc72bf 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C +++ b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C @@ -1536,8 +1536,8 @@ int main(int argc, char *argv[]) mappedPatchBase::sampleMode sampleMode = mappedPatchBase::sampleModeNames_[dict.lookup("sampleMode")]; - const Switch oneD(dict.lookup("oneD")); - Switch oneDNonManifoldEdges(false); + const bool oneD(dict.get<bool>("oneD")); + bool oneDNonManifoldEdges(false); word oneDPatchType(emptyPolyPatch::typeName); if (oneD) { @@ -1545,7 +1545,7 @@ int main(int argc, char *argv[]) dict.lookup("oneDPolyPatchType") >> oneDPatchType; } - const Switch adaptMesh(dict.lookup("adaptMesh")); + const bool adaptMesh(dict.get<bool>("adaptMesh")); if (hasZones) { diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/automatic/automatic.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/automatic/automatic.C index 302bd61b55360b706d8ee68df909e1cc79fcb2c2..b3b09022b379031f4d9addfc35c7ad5e41679364 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/automatic/automatic.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/automatic/automatic.C @@ -97,7 +97,7 @@ Foam::automatic::automatic ( const dictionary& cellSizeCalcTypeDict, const triSurfaceMesh& surface, - const scalar& defaultCellSize + const scalar defaultCellSize ) : cellSizeCalculationType @@ -109,12 +109,15 @@ Foam::automatic::automatic ), coeffsDict_(cellSizeCalcTypeDict.optionalSubDict(typeName + "Coeffs")), surfaceName_(surface.searchableSurface::name()), - readCurvature_(Switch(coeffsDict_.lookup("curvature"))), - curvatureFile_(coeffsDict_.lookup("curvatureFile")), - readFeatureProximity_(Switch(coeffsDict_.lookup("featureProximity"))), - featureProximityFile_(coeffsDict_.lookup("featureProximityFile")), - readInternalCloseness_(Switch(coeffsDict_.lookup("internalCloseness"))), - internalClosenessFile_(coeffsDict_.lookup("internalClosenessFile")), + + readCurvature_(coeffsDict_.get<bool>("curvature")), + readFeatureProximity_(coeffsDict_.get<bool>("featureProximity")), + readInternalCloseness_(coeffsDict_.get<bool>("internalCloseness")), + + curvatureFile_(coeffsDict_.get<word>("curvatureFile")), + featureProximityFile_(coeffsDict_.get<word>("featureProximityFile")), + internalClosenessFile_(coeffsDict_.get<word>("internalClosenessFile")), + curvatureCellSizeCoeff_ ( readScalar(coeffsDict_.lookup("curvatureCellSizeCoeff")) diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/automatic/automatic.H b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/automatic/automatic.H index 07f4e9442d24b4fe988fc6417b1181caa6420e6d..11cf52ff86ef7da2d46a7f11d31044947b44724f 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/automatic/automatic.H +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/automatic/automatic.H @@ -37,7 +37,6 @@ SourceFiles #include "cellSizeCalculationType.H" #include "triSurfaceFields.H" #include "PrimitivePatchInterpolation.H" -#include "Switch.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -54,9 +53,6 @@ class automatic : public cellSizeCalculationType { - -private: - // Private data //- Dictionary of coefficients for automatic cell sizing @@ -65,13 +61,12 @@ private: //- Name of the surface. Used to write the cell size field const fileName surfaceName_; - const Switch readCurvature_; - const word curvatureFile_; + const bool readCurvature_; + const bool readFeatureProximity_; + const bool readInternalCloseness_; - const Switch readFeatureProximity_; + const word curvatureFile_; const word featureProximityFile_; - - const Switch readInternalCloseness_; const word internalClosenessFile_; //- The curvature values are multiplied by the inverse of this value to @@ -100,13 +95,12 @@ public: ( const dictionary& cellSizeCalcTypeDict, const triSurfaceMesh& surface, - const scalar& defaultCellSize + const scalar defaultCellSize ); //- Destructor - virtual ~automatic() - {} + virtual ~automatic() = default; // Member Functions diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cvControls/cvControls.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cvControls/cvControls.C index 3274c0ad0ae48035c41b8704480bcf02ea4b772f..58db69d92ee5389a3cd1f43404d7806960a0fff6 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cvControls/cvControls.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cvControls/cvControls.C @@ -42,43 +42,30 @@ Foam::cvControls::cvControls foamyHexMeshDict_.subDict("surfaceConformation") ); - pointPairDistanceCoeff_ = readScalar - ( - surfDict.lookup("pointPairDistanceCoeff") - ); + pointPairDistanceCoeff_ = + surfDict.get<scalar>("pointPairDistanceCoeff"); - mixedFeaturePointPPDistanceCoeff_ = readScalar - ( - surfDict.lookup("mixedFeaturePointPPDistanceCoeff") - ); + mixedFeaturePointPPDistanceCoeff_ = + surfDict.get<scalar>("mixedFeaturePointPPDistanceCoeff"); - featurePointExclusionDistanceCoeff_ = readScalar - ( - surfDict.lookup("featurePointExclusionDistanceCoeff") - ); + featurePointExclusionDistanceCoeff_ = + surfDict.get<scalar>("featurePointExclusionDistanceCoeff"); - featureEdgeExclusionDistanceCoeff_ = readScalar - ( - surfDict.lookup("featureEdgeExclusionDistanceCoeff") - ); + featureEdgeExclusionDistanceCoeff_ = + surfDict.get<scalar>("featureEdgeExclusionDistanceCoeff"); + surfaceSearchDistanceCoeff_ = + surfDict.get<scalar>("surfaceSearchDistanceCoeff"); - surfaceSearchDistanceCoeff_ = readScalar - ( - surfDict.lookup("surfaceSearchDistanceCoeff") - ); + maxSurfaceProtrusionCoeff_ = + surfDict.get<scalar>("maxSurfaceProtrusionCoeff"); - maxSurfaceProtrusionCoeff_ = readScalar - ( - surfDict.lookup("maxSurfaceProtrusionCoeff") - ); - - maxQuadAngle_ = readScalar(surfDict.lookup("maxQuadAngle")); + maxQuadAngle_ = surfDict.get<scalar>("maxQuadAngle"); surfaceConformationRebuildFrequency_ = max ( 1, - readLabel(surfDict.lookup("surfaceConformationRebuildFrequency")) + surfDict.get<label>("surfaceConformationRebuildFrequency") ); @@ -87,33 +74,23 @@ Foam::cvControls::cvControls surfDict.subDict("featurePointControls") ); - specialiseFeaturePoints_ = Switch - ( - featurePointControlsDict.lookup("specialiseFeaturePoints") - ); + specialiseFeaturePoints_ = + featurePointControlsDict.get<Switch>("specialiseFeaturePoints"); - guardFeaturePoints_ = Switch - ( - featurePointControlsDict.lookup("guardFeaturePoints") - ); + guardFeaturePoints_ = + featurePointControlsDict.get<Switch>("guardFeaturePoints"); - edgeAiming_ = Switch - ( - featurePointControlsDict.lookup("edgeAiming") - ); + edgeAiming_ = + featurePointControlsDict.get<Switch>("edgeAiming"); if (!guardFeaturePoints_) { - snapFeaturePoints_ = Switch - ( - featurePointControlsDict.lookup("snapFeaturePoints") - ); + snapFeaturePoints_ = + featurePointControlsDict.get<Switch>("snapFeaturePoints"); } - circulateEdges_ = Switch - ( - featurePointControlsDict.lookup("circulateEdges") - ); + circulateEdges_ = + featurePointControlsDict.get<Switch>("circulateEdges"); // Controls for coarse surface conformation @@ -122,62 +99,47 @@ Foam::cvControls::cvControls surfDict.subDict("conformationControls") ); - surfacePtExclusionDistanceCoeff_ = readScalar - ( - conformationControlsDict.lookup("surfacePtExclusionDistanceCoeff") - ); + surfacePtExclusionDistanceCoeff_ = + conformationControlsDict.get<scalar>("surfacePtExclusionDistanceCoeff"); edgeSearchDistCoeffSqr_ = sqr ( - readScalar - ( - conformationControlsDict.lookup("edgeSearchDistCoeff") - ) + conformationControlsDict.get<scalar>("edgeSearchDistCoeff") ); surfacePtReplaceDistCoeffSqr_ = sqr ( - readScalar - ( - conformationControlsDict.lookup("surfacePtReplaceDistCoeff") - ) + conformationControlsDict.get<scalar>("surfacePtReplaceDistCoeff") ); - maxConformationIterations_ = readLabel - ( - conformationControlsDict.lookup("maxIterations") - ); + maxConformationIterations_ = + conformationControlsDict.get<label>("maxIterations"); - iterationToInitialHitRatioLimit_ = readScalar - ( - conformationControlsDict.lookup("iterationToInitialHitRatioLimit") - ); + iterationToInitialHitRatioLimit_ = + conformationControlsDict.get<scalar>("iterationToInitialHitRatioLimit"); // Motion control controls const dictionary& motionDict(foamyHexMeshDict_.subDict("motionControl")); - defaultCellSize_ = readScalar(motionDict.lookup("defaultCellSize")); + defaultCellSize_ = motionDict.get<scalar>("defaultCellSize"); minimumCellSize_ = - readScalar(motionDict.lookup("minimumCellSizeCoeff"))*defaultCellSize_; + motionDict.get<scalar>("minimumCellSizeCoeff")*defaultCellSize_; - objOutput_ = Switch(motionDict.lookupOrDefault<Switch>("objOutput", false)); + objOutput_ = + motionDict.lookupOrDefault<Switch>("objOutput", false); - timeChecks_ = Switch - ( - motionDict.lookupOrDefault<Switch>("timeChecks", false) - ); + timeChecks_ = + motionDict.lookupOrDefault<Switch>("timeChecks", false); - printVertexInfo_ = Switch - ( - motionDict.lookupOrDefault<Switch>("printVertexInfo", false) - ); + printVertexInfo_ = + motionDict.lookupOrDefault<Switch>("printVertexInfo", false); if (Pstream::parRun()) { - maxLoadUnbalance_ = readScalar(motionDict.lookup("maxLoadUnbalance")); + maxLoadUnbalance_ = motionDict.get<scalar>("maxLoadUnbalance"); } else { @@ -186,7 +148,7 @@ Foam::cvControls::cvControls cosAlignmentAcceptanceAngle_ = cos ( - degToRad(readScalar(motionDict.lookup("alignmentAcceptanceAngle"))) + degToRad(motionDict.get<scalar>("alignmentAcceptanceAngle")) ); @@ -197,19 +159,15 @@ Foam::cvControls::cvControls motionDict.subDict("pointInsertionCriteria") ); - insertionDistCoeff_ = readScalar - ( - insertionDict.lookup("cellCentreDistCoeff") - ); + insertionDistCoeff_ = + insertionDict.get<scalar>("cellCentreDistCoeff"); - faceAreaRatioCoeff_ = readScalar - ( - insertionDict.lookup("faceAreaRatioCoeff") - ); + faceAreaRatioCoeff_ = + insertionDict.get<scalar>("faceAreaRatioCoeff"); cosInsertionAcceptanceAngle_ = cos ( - degToRad(readScalar(insertionDict.lookup("acceptanceAngle"))) + degToRad(insertionDict.get<scalar>("acceptanceAngle")) ); // Point removal criteria @@ -219,10 +177,8 @@ Foam::cvControls::cvControls motionDict.subDict("pointRemovalCriteria") ); - removalDistCoeff_ = readScalar - ( - removalDict.lookup("cellCentreDistCoeff") - ); + removalDistCoeff_ = + removalDict.get<scalar>("cellCentreDistCoeff"); // polyMesh filtering controls @@ -231,34 +187,31 @@ Foam::cvControls::cvControls foamyHexMeshDict_.subDict("polyMeshFiltering") ); - filterEdges_ = Switch - ( - filteringDict.lookupOrDefault<Switch>("filterEdges", true) - ); + filterEdges_ = + filteringDict.lookupOrDefault<Switch>("filterEdges", true); - filterFaces_ = Switch - ( - filteringDict.lookupOrDefault<Switch>("filterFaces", false) - ); + filterFaces_ = + filteringDict.lookupOrDefault<Switch>("filterFaces", false); if (filterFaces_) { - filterEdges_ = Switch::ON; + filterEdges_ = filterFaces_; } - writeTetDualMesh_ = Switch(filteringDict.lookup("writeTetDualMesh")); + writeTetDualMesh_ = + filteringDict.get<Switch>("writeTetDualMesh"); writeCellShapeControlMesh_ = - Switch(filteringDict.lookup("writeCellShapeControlMesh")); + filteringDict.get<Switch>("writeCellShapeControlMesh"); if (Pstream::parRun()) { writeBackgroundMeshDecomposition_ = - Switch(filteringDict.lookup("writeBackgroundMeshDecomposition")); + filteringDict.get<Switch>("writeBackgroundMeshDecomposition"); } else { - writeBackgroundMeshDecomposition_ = Switch(false); + writeBackgroundMeshDecomposition_ = Switch::FALSE; } } diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/initialPointsMethod/initialPointsMethod.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/initialPointsMethod/initialPointsMethod.C index 7ffba4ad14c68d08ee57edf512fa0d732894d9b1..81af0c80854ca38230c118def8ade0b6899b5731 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/initialPointsMethod/initialPointsMethod.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/initialPointsMethod/initialPointsMethod.C @@ -58,13 +58,10 @@ Foam::initialPointsMethod::initialPointsMethod ( sqr ( - readScalar - ( - initialPointsDict.lookup("minimumSurfaceDistanceCoeff") - ) + initialPointsDict.get<scalar>("minimumSurfaceDistanceCoeff") ) ), - fixInitialPoints_(Switch(initialPointsDict.lookup("fixInitialPoints"))) + fixInitialPoints_(initialPointsDict.get<bool>("fixInitialPoints")) {} @@ -80,7 +77,7 @@ Foam::autoPtr<Foam::initialPointsMethod> Foam::initialPointsMethod::New const autoPtr<backgroundMeshDecomposition>& decomposition ) { - const word methodName(initialPointsDict.lookup("initialPointsMethod")); + const word methodName(initialPointsDict.get<word>("initialPointsMethod")); Info<< nl << "Selecting initialPointsMethod " << methodName << endl; diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/initialPointsMethod/initialPointsMethod.H b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/initialPointsMethod/initialPointsMethod.H index a7c40743729925deae0f4b0e887bc9358ef03cd6..a4fde2da6904e604714784d6fb51e84e88e50aca 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/initialPointsMethod/initialPointsMethod.H +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/initialPointsMethod/initialPointsMethod.H @@ -40,7 +40,6 @@ SourceFiles #include "backgroundMeshDecomposition.H" #include "dictionary.H" #include "Random.H" -#include "Switch.H" #include "autoPtr.H" #include "runTimeSelectionTables.H" @@ -80,7 +79,7 @@ protected: // the local target cell size. Store square of value. scalar minimumSurfaceDistanceCoeffSqr_; - Switch fixInitialPoints_; + bool fixInitialPoints_; private: @@ -194,7 +193,7 @@ public: return detailsDict_; } - Switch fixInitialPoints() const + bool fixInitialPoints() const { return fixInitialPoints_; } diff --git a/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/CV2D.C b/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/CV2D.C index 8e4543a07d322c26192d6c8cdee964f18f410eb1..697f90eb98396be7aca9eef15cd300dd130be9f0 100644 --- a/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/CV2D.C +++ b/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/CV2D.C @@ -150,7 +150,7 @@ Foam::CV2D::CV2D ), z_ ( - point + Foam::point ( cvMeshDict.subDict("surfaceConformation").lookup("locationInMesh") ).z() @@ -260,7 +260,7 @@ void Foam::CV2D::insertGrid() { for (int j=0; j<nj; j++) { - point p(x0 + i*deltax, y0 + j*deltay, 0); + Foam::point p(x0 + i*deltax, y0 + j*deltay, 0); if (meshControls().randomiseInitialGrid()) { diff --git a/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/CV2D.H b/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/CV2D.H index c0e0e48987e7b1ababfa047e09d49e63454f67c6..5a8eda8a5c5622e9eec4d643519c89213b4767a4 100644 --- a/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/CV2D.H +++ b/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/CV2D.H @@ -347,9 +347,9 @@ public: // Conversion functions between point2D, point and Point - inline const point2D& toPoint2D(const point&) const; + inline const point2D& toPoint2D(const Foam::point&) const; inline const point2DField toPoint2D(const pointField&) const; - inline point toPoint3D(const point2D&) const; + inline Foam::point toPoint3D(const point2D&) const; #ifdef CGAL_INEXACT typedef const point2D& point2DFromPoint; @@ -361,7 +361,7 @@ public: inline point2DFromPoint toPoint2D(const Point&) const; inline PointFromPoint2D toPoint(const point2D&) const; - inline point toPoint3D(const Point&) const; + inline Foam::point toPoint3D(const Point&) const; // Point insertion diff --git a/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/CV2DI.H b/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/CV2DI.H index e2720cc5ed8f2d15796ed5f811c0fecb16e0a4ca..5f848212d5de766793f0b6d4bcf392b1587e1de6 100644 --- a/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/CV2DI.H +++ b/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/CV2DI.H @@ -121,7 +121,7 @@ inline const Foam::cv2DControls& Foam::CV2D::meshControls() const } -inline const Foam::point2D& Foam::CV2D::toPoint2D(const point& p) const +inline const Foam::point2D& Foam::CV2D::toPoint2D(const Foam::point& p) const { return reinterpret_cast<const point2D&>(p); } @@ -140,7 +140,7 @@ inline const Foam::point2DField Foam::CV2D::toPoint2D(const pointField& p) const inline Foam::point Foam::CV2D::toPoint3D(const point2D& p) const { - return point(p.x(), p.y(), z_); + return Foam::point(p.x(), p.y(), z_); } @@ -175,7 +175,7 @@ inline Foam::CV2D::PointFromPoint2D Foam::CV2D::toPoint(const point2D& p) const inline Foam::point Foam::CV2D::toPoint3D(const Point& P) const { - return point(CGAL::to_double(P.x()), CGAL::to_double(P.y()), z_); + return Foam::point(CGAL::to_double(P.x()), CGAL::to_double(P.y()), z_); } diff --git a/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/CV2DIO.C b/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/CV2DIO.C index d370880aeeef287f2808df9d85dd88a5522d99f6..b8e8518eb5fcb2f767a7270e99703ef71864b263 100644 --- a/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/CV2DIO.C +++ b/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/CV2DIO.C @@ -210,8 +210,8 @@ void Foam::CV2D::extractPatches || (vB->internalOrBoundaryPoint() && !vA->internalOrBoundaryPoint()) ) { - point ptA = toPoint3D(vA->point()); - point ptB = toPoint3D(vB->point()); + Foam::point ptA = toPoint3D(vA->point()); + Foam::point ptB = toPoint3D(vB->point()); label patchIndex = qSurf_.findPatch(ptA, ptB); diff --git a/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/foamyQuadMesh.C b/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/foamyQuadMesh.C index 86a394271aa3723c663a3b16150aea86b1fda92f..367e554b3b82963c547d52e33307fbaf1bb55cfe 100644 --- a/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/foamyQuadMesh.C +++ b/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/foamyQuadMesh.C @@ -81,7 +81,7 @@ int main(int argc, char *argv[]) ); const dictionary& extrusionDict(controlDict.subDict("extrusion")); - Switch extrude(extrusionDict.lookup("extrude")); + const bool extrude = extrusionDict.get<bool>("extrude"); const bool overwrite = args.found("overwrite"); // Read and triangulation diff --git a/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/insertBoundaryConformPointPairs.C b/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/insertBoundaryConformPointPairs.C index 0f69268500ecd73fd975bfbf533cba807f095633..3017c72a9e7a5f5ce40030d3ba9b0d22b1bd06ad 100644 --- a/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/insertBoundaryConformPointPairs.C +++ b/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/insertBoundaryConformPointPairs.C @@ -295,7 +295,7 @@ void Foam::CV2D::markNearBoundaryPoints() { if (vit->internalPoint()) { - point vert(toPoint3D(vit->point())); + Foam::point vert(toPoint3D(vit->point())); pointIndexHit pHit; label hitSurface = -1; diff --git a/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/insertFeaturePoints.C b/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/insertFeaturePoints.C index 1cf848eec4672b81b4ddffd70e868c53e394c2d3..c746d95dc62021238e97951f1c270d1699a547b5 100644 --- a/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/insertFeaturePoints.C +++ b/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/insertFeaturePoints.C @@ -109,8 +109,8 @@ void Foam::CV2D::insertFeaturePoints() { const edge& e = feMesh.edges()[edgeI]; - const point& ep0 = points[e.start()]; - const point& ep1 = points[e.end()]; + const Foam::point& ep0 = points[e.start()]; + const Foam::point& ep1 = points[e.end()]; const linePointRef line(ep0, ep1); diff --git a/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/insertSurfaceNearestPointPairs.C b/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/insertSurfaceNearestPointPairs.C index 7578920f824409d84e7f0a6d319cc3cd5dd5fb6f..6cec128d71d40f72619408adf1970410653fb06b 100644 --- a/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/insertSurfaceNearestPointPairs.C +++ b/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/insertSurfaceNearestPointPairs.C @@ -39,7 +39,7 @@ bool Foam::CV2D::dualCellSurfaceIntersection { if (!is_infinite(ec)) { - point e0 = toPoint3D(circumcenter(ec->first)); + Foam::point e0 = toPoint3D(circumcenter(ec->first)); // If edge end is outside bounding box then edge cuts boundary if (!qSurf_.globalBounds().contains(e0)) @@ -47,7 +47,8 @@ bool Foam::CV2D::dualCellSurfaceIntersection return true; } - point e1 = toPoint3D(circumcenter(ec->first->neighbor(ec->second))); + Foam::point e1 = + toPoint3D(circumcenter(ec->first->neighbor(ec->second))); // If other edge end is outside bounding box then edge cuts boundary if (!qSurf_.globalBounds().contains(e1)) diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C index e1f9707cd4b74db25547d3a7f25776bd6c9afeda..6e47c75a28b35355d56b24ccda80621a4dd74158 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C @@ -141,12 +141,13 @@ autoPtr<refinementSurfaces> createRefinementSurfaces // Invert surfaceCellSize to get the refinementLevel const word scsFuncName = - shapeDict.lookup("surfaceCellSizeFunction"); + shapeDict.get<word>("surfaceCellSizeFunction"); + const dictionary& scsDict = shapeDict.optionalSubDict(scsFuncName + "Coeffs"); const scalar surfaceCellSize = - readScalar(scsDict.lookup("surfaceCellSizeCoeff")); + scsDict.get<scalar>("surfaceCellSizeCoeff"); const label refLevel = sizeCoeffToRefinement ( @@ -222,7 +223,7 @@ autoPtr<refinementSurfaces> createRefinementSurfaces ); const word scsFuncName = - shapeControlRegionDict.lookup + shapeControlRegionDict.get<word> ( "surfaceCellSizeFunction" ); @@ -233,10 +234,7 @@ autoPtr<refinementSurfaces> createRefinementSurfaces ); const scalar surfaceCellSize = - readScalar - ( - scsDict.lookup("surfaceCellSizeCoeff") - ); + scsDict.get<scalar>("surfaceCellSizeCoeff"); const label refLevel = sizeCoeffToRefinement ( @@ -780,10 +778,10 @@ int main(int argc, char *argv[]) const scalar mergeDist = getMergeDistance ( mesh, - readScalar(meshDict.lookup("mergeTolerance")) + meshDict.get<scalar>("mergeTolerance") ); - const Switch keepPatches(meshDict.lookupOrDefault("keepPatches", false)); + const bool keepPatches(meshDict.lookupOrDefault("keepPatches", false)); // Read decomposePar dictionary @@ -958,7 +956,7 @@ int main(int argc, char *argv[]) // Calculate current ratio of hex cells v.s. wanted cell size const scalar defaultCellSize = - readScalar(motionDict.lookup("defaultCellSize")); + motionDict.get<scalar>("defaultCellSize"); const scalar initialCellSize = ::pow(meshPtr().V()[0], 1.0/3.0); @@ -1020,7 +1018,7 @@ int main(int argc, char *argv[]) if (patchInfo.set(globalRegioni)) { patchTypes[geomi][regioni] = - word(patchInfo[globalRegioni].lookup("type")); + patchInfo[globalRegioni].get<word>("type"); } else { @@ -1449,11 +1447,11 @@ int main(int argc, char *argv[]) // Now do the real work -refinement -snapping -layers // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - const Switch wantRefine(meshDict.lookup("castellatedMesh")); - const Switch wantSnap(meshDict.lookup("snap")); - const Switch wantLayers(meshDict.lookup("addLayers")); + const bool wantRefine(meshDict.get<bool>("castellatedMesh")); + const bool wantSnap(meshDict.get<bool>("snap")); + const bool wantLayers(meshDict.get<bool>("addLayers")); - const Switch mergePatchFaces + const bool mergePatchFaces ( meshDict.lookupOrDefault("mergePatchFaces", true) ); diff --git a/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C b/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C index 727aa805cf8cfaf4c353c63566f603655b0d6b1f..52195b3c6fd3ac3d0cff2ef04ed69ef216de92cd 100644 --- a/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C +++ b/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C @@ -457,16 +457,16 @@ int main(int argc, char *argv[]) const word dictName("createBafflesDict"); #include "setSystemMeshDictionaryIO.H" - Switch internalFacesOnly(false); + bool internalFacesOnly(false); - Switch noFields(false); + bool noFields(false); PtrList<faceSelection> selectors; { Info<< "Reading baffle criteria from " << dictName << nl << endl; IOdictionary dict(dictIO); - dict.lookup("internalFacesOnly") >> internalFacesOnly; + internalFacesOnly = dict.get<bool>("internalFacesOnly"); noFields = dict.lookupOrDefault("noFields", false); const dictionary& selectionsDict = dict.subDict("baffles"); @@ -730,10 +730,9 @@ int main(int argc, char *argv[]) // master and slave in different groupNames // (ie 3D thermal baffles) - Switch sameGroup - ( - patchSource.lookupOrDefault("sameGroup", true) - ); + const bool sameGroup = + patchSource.lookupOrDefault("sameGroup", true); + if (!sameGroup) { groupNameMaster = groupName + "Group_master"; @@ -813,7 +812,6 @@ int main(int argc, char *argv[]) } - createFaces ( internalFacesOnly, @@ -910,10 +908,8 @@ int main(int argc, char *argv[]) { const dictionary& patchSource = dict.subDict("patchPairs"); - Switch sameGroup - ( - patchSource.lookupOrDefault("sameGroup", true) - ); + const bool sameGroup = + patchSource.lookupOrDefault("sameGroup", true); const word& groupName = selectors[selectorI].name(); diff --git a/applications/utilities/mesh/manipulation/createBaffles/faceSelection/faceSelection.H b/applications/utilities/mesh/manipulation/createBaffles/faceSelection/faceSelection.H index 04a95cf0ceceac7a8be016287170431528018229..c79a21cc27bb933d781d4b70c57e1fb61f121c19 100644 --- a/applications/utilities/mesh/manipulation/createBaffles/faceSelection/faceSelection.H +++ b/applications/utilities/mesh/manipulation/createBaffles/faceSelection/faceSelection.H @@ -41,7 +41,6 @@ SourceFiles #include "autoPtr.H" #include "boolList.H" #include "labelList.H" -#include "Switch.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -71,7 +70,7 @@ protected: const dictionary dict_; //- Switch direction? - const Switch flip_; + const bool flip_; public: diff --git a/applications/utilities/mesh/manipulation/createPatch/createPatch.C b/applications/utilities/mesh/manipulation/createPatch/createPatch.C index 795a61f76ef6460ddc6163745cf87cce6df79f67..8055fdafb72b5ba18f1f59bf82209fe6939ce6ea 100644 --- a/applications/utilities/mesh/manipulation/createPatch/createPatch.C +++ b/applications/utilities/mesh/manipulation/createPatch/createPatch.C @@ -540,8 +540,7 @@ int main(int argc, char *argv[]) IOdictionary dict(dictIO); // Whether to synchronise points - const Switch pointSync(dict.lookup("pointSync")); - + const bool pointSync(dict.get<bool>("pointSync")); const polyBoundaryMesh& patches = mesh.boundaryMesh(); diff --git a/applications/utilities/miscellaneous/foamDictionary/foamDictionary.C b/applications/utilities/miscellaneous/foamDictionary/foamDictionary.C index c8d972fd512c7437ee8ce71940329e8c56d26c3f..b15a09c15ac4f0430ab8c04c3b5afc47a71a1011 100644 --- a/applications/utilities/miscellaneous/foamDictionary/foamDictionary.C +++ b/applications/utilities/miscellaneous/foamDictionary/foamDictionary.C @@ -50,7 +50,7 @@ Usage Write differences with respect to the specified dictionary (or sub entry if -entry specified) - - \par -diffEtc \<dictionary\> + - \par -diff-etc \<dictionary\> Write differences with respect to the specified dictionary (or sub entry if -entry specified) @@ -94,13 +94,13 @@ Usage - Write the differences with respect to a template dictionary: \verbatim - foamDictionary 0/U -diffEtc templates/closedVolume/0/U + foamDictionary 0/U -diff-etc templates/closedVolume/0/U \endverbatim - Write the differences in boundaryField with respect to a template dictionary: \verbatim - foamDictionary 0/U -diffEtc templates/closedVolume/0/U \ + foamDictionary 0/U -diff-etc templates/closedVolume/0/U \ -entry boundaryField \endverbatim @@ -217,11 +217,9 @@ const dictionary& lookupScopedDict if (!eptr || !eptr->isDict()) { FatalIOErrorInFunction(dict) - << "keyword " << subDictName - << " is undefined in dictionary " - << dict.name() << " or is not a dictionary" - << endl - << "Valid keywords are " << dict.keys() + << "'" << subDictName << "' not found in dictionary " + << dict.name() << " or is not a dictionary" << nl + << "Known entries are " << dict.keys() << exit(FatalIOError); } @@ -300,10 +298,12 @@ int main(int argc, char *argv[]) ); argList::addOption ( - "diffEtc", + "diff-etc", "dict", "As per -diff, but locate the file as per foamEtcFile" ); + argList::addOptionCompat("diff-etc", {"diffEtc", 1712}); + argList::addBoolOption ( "includes", @@ -371,10 +371,10 @@ int main(int argc, char *argv[]) } - // Has "diff" or "diffEtc" + // Has "diff" or "diff-etc" bool optDiff = false; - // Reference dictionary for -diff / -diffEtc + // Reference dictionary for -diff / -diff-etc dictionary diffDict; { fileName diffFileName; @@ -392,7 +392,7 @@ int main(int argc, char *argv[]) diffDict.read(diffFile, true); optDiff = true; } - else if (args.readIfPresent("diffEtc", diffFileName)) + else if (args.readIfPresent("diff-etc", diffFileName)) { fileName foundName = findEtcFile(diffFileName); if (foundName.empty()) diff --git a/applications/utilities/postProcessing/noise/noise.C b/applications/utilities/postProcessing/noise/noise.C index 61653947eaa78b1c6def79881c8bbecda449ad9b..a97edc185418e1df5941edde9a5933306398cbff 100644 --- a/applications/utilities/postProcessing/noise/noise.C +++ b/applications/utilities/postProcessing/noise/noise.C @@ -55,8 +55,8 @@ Usage } - // Input file - inputFile "postProcessing/faceSource1/surface/patch/patch.case"; + // Input files list + files ("postProcessing/faceSource1/surface/patch/patch.case";) // Surface reader reader ensight; diff --git a/applications/utilities/surface/surfaceSubset/surfaceSubset.C b/applications/utilities/surface/surfaceSubset/surfaceSubset.C index f9c1e79978703a826ff874fcf9f1c4f8cffc9ea7..3349fa8a7aa1516de6dfba5ec51a123d6df772d5 100644 --- a/applications/utilities/surface/surfaceSubset/surfaceSubset.C +++ b/applications/utilities/surface/surfaceSubset/surfaceSubset.C @@ -37,7 +37,6 @@ Description #include "triSurfaceSearch.H" #include "argList.H" #include "Fstream.H" -#include "Switch.H" #include "IOdictionary.H" #include "boundBox.H" #include "indexedOctree.H" @@ -102,10 +101,8 @@ int main(int argc, char *argv[]) << exit(FatalError); } - Switch addFaceNeighbours - ( - meshSubsetDict.lookup("addFaceNeighbours") - ); + const bool addFaceNeighbours = + meshSubsetDict.get<bool>("addFaceNeighbours"); const bool invertSelection = meshSubsetDict.lookupOrDefault("invertSelection", false); @@ -231,7 +228,7 @@ int main(int argc, char *argv[]) fileName surfName(surfDict.lookup("name")); - Switch outside(surfDict.lookup("outside")); + const bool outside(surfDict.get<bool>("outside")); if (outside) { diff --git a/bin/tools/foamLog.db b/bin/tools/foamLog.db index ed9f55c5abbab16b57c382b59cff72a3202b8719..f97c8f27b389decfa105ef668a7a3f0cff2b9408 100644 --- a/bin/tools/foamLog.db +++ b/bin/tools/foamLog.db @@ -63,4 +63,6 @@ alpha1Min/Min\(alpha1\) =/Min(alpha1) = alpha1Max/Max\(alpha1\) =/Max(alpha1) = # AMI -AMIMin/AMI: Patch source sum/average = +AMIMin/AMI: Patch source sum/min = +AMIMax/AMI: Patch source sum/max = +AMIAvg/AMI: Patch source sum/average = diff --git a/etc/config.csh/paraview b/etc/config.csh/paraview index 19239e6980b67c478511e72294cab35cf39cf597..7c10950c1590175d2547a8ddcb46655671cab0e5 100644 --- a/etc/config.csh/paraview +++ b/etc/config.csh/paraview @@ -43,7 +43,7 @@ #------------------------------------------------------------------------------ # USER EDITABLE PART: Changes made here may be lost with the next upgrade -setenv ParaView_VERSION 5.5.0 +setenv ParaView_VERSION 5.5.1 set ParaView_QT=qt-system set cmake_version=cmake-system @@ -126,7 +126,7 @@ if ( $?ParaView_VERSION ) then set qtDir="$archDir/$ParaView_QT" if ( -d "$qtDir" ) then switch ($ParaView_QT) - case *-qt*: + case *-5*: setenv Qt5_DIR $qtDir breaksw endsw diff --git a/etc/config.sh/bash_completion b/etc/config.sh/bash_completion index 493837b2eed33c72b0b0361823de2c552cbaa9ff..afa2f7c60a6eac062a8b67b553ba160d3565675f 100644 --- a/etc/config.sh/bash_completion +++ b/etc/config.sh/bash_completion @@ -2,7 +2,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. +# \\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd. # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -109,7 +109,7 @@ _of_complete_() local choices case ${prev} in - -help|-help-full|-doc|-doc-source) + -help | -help-full | -doc | -doc-source) # These options are usage - we can stop now. COMPREPLY=() return 0 @@ -126,7 +126,7 @@ _of_complete_() COMPREPLY=($(compgen -W "$choices" -- ${cur})) ;; -fileHandler) - choices="collated uncollated masterUncollated" + choices="collated uncollated hostCollated masterUncollated" COMPREPLY=($(compgen -W "$choices" -- ${cur})) ;; *) diff --git a/etc/config.sh/paraview b/etc/config.sh/paraview index 33a8b327557d4fde3ad8254d0ca32bdbaf448ae1..194b1952a3bb0cba85dacc6cb2c33a36c8fc6137 100644 --- a/etc/config.sh/paraview +++ b/etc/config.sh/paraview @@ -46,7 +46,7 @@ #------------------------------------------------------------------------------ # USER EDITABLE PART: Changes made here may be lost with the next upgrade -ParaView_VERSION=5.5.0 +ParaView_VERSION=5.5.1 ParaView_QT=qt-system cmake_version=cmake-system diff --git a/src/OpenFOAM/containers/Dictionaries/DictionaryBase/DictionaryBase.C b/src/OpenFOAM/containers/Dictionaries/DictionaryBase/DictionaryBase.C index 2f95d40f713993a5b5ba4888845696ab0b68e738..0661cbf8d9110630010c182e572653fa7924a7bb 100644 --- a/src/OpenFOAM/containers/Dictionaries/DictionaryBase/DictionaryBase.C +++ b/src/OpenFOAM/containers/Dictionaries/DictionaryBase/DictionaryBase.C @@ -138,7 +138,7 @@ const T* Foam::DictionaryBase<IDLListType, T>::lookup(const word& keyword) const if (iter == hashedTs_.end()) { FatalErrorInFunction - << keyword << " is undefined" + << "'" << keyword << "' not found" << exit(FatalError); } @@ -154,7 +154,7 @@ T* Foam::DictionaryBase<IDLListType, T>::lookup(const word& keyword) if (iter == hashedTs_.end()) { FatalErrorInFunction - << keyword << " is undefined" + << "'" << keyword << "' not found" << exit(FatalError); } diff --git a/src/OpenFOAM/db/dictionary/dictionary.C b/src/OpenFOAM/db/dictionary/dictionary.C index 6223da9e0f59ea402f5ae8edcbd30f1277aaf3b3..f2adc1b5980a206a1ba01244389e5fc242eb7811 100644 --- a/src/OpenFOAM/db/dictionary/dictionary.C +++ b/src/OpenFOAM/db/dictionary/dictionary.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -24,6 +24,8 @@ License \*---------------------------------------------------------------------------*/ #include "dictionary.H" +#include "error.H" +#include "JobInfo.H" #include "primitiveEntry.H" #include "dictionaryEntry.H" #include "regExp.H" @@ -48,7 +50,6 @@ bool Foam::dictionary::writeOptionalEntries void Foam::dictionary::excessTokens ( - OSstream& msg, const word& keyword, const ITstream& is ) const @@ -60,12 +61,44 @@ void Foam::dictionary::excessTokens return; } - msg << "entry '" << keyword << "' has " - << nExcess << " excess tokens, near line: " << is.lineNumber() << nl - << "dictionary: " << name() << nl - << "stream: "; - is.writeList(msg, 0); - msg << nl; + // Similar to SafeFatalIOError + + if (JobInfo::constructed) + { + OSstream& err = + FatalIOError + ( + "", // functionName + "", // sourceFileName + 0, // sourceFileLineNumber + this->name(), // ioFileName + is.lineNumber() // ioStartLineNumber + ); + + err << "'" << keyword << "' has " + << nExcess << " excess tokens in stream" << nl << nl + << " "; + is.writeList(err, 0); + + err << exit(FatalIOError); + } + else + { + std::cerr + << nl + << "--> FOAM FATAL IO ERROR:" << nl; + + std::cerr + << "'" << keyword << "' has " + << nExcess << " excess tokens in stream" << nl << nl; + + std::cerr + << "file: " << this->name() + << " at line " << is.lineNumber() << '.' << nl + << std::endl; + + ::exit(1); + } } @@ -296,10 +329,8 @@ const Foam::entry& Foam::dictionary::lookupEntry if (!finder.found()) { - FatalIOErrorInFunction - ( - *this - ) << "keyword " << keyword << " is undefined in dictionary " + FatalIOErrorInFunction(*this) + << "'" << keyword << "' not found in dictionary " << name() << exit(FatalIOError); } @@ -422,10 +453,8 @@ const Foam::dictionary& Foam::dictionary::subDict(const word& keyword) const if (!finder.found()) { - FatalIOErrorInFunction - ( - *this - ) << "keyword " << keyword << " is undefined in dictionary " + FatalIOErrorInFunction(*this) + << "'" << keyword << "' not found in dictionary " << name() << exit(FatalIOError); } @@ -441,10 +470,8 @@ Foam::dictionary& Foam::dictionary::subDict(const word& keyword) if (!finder.found()) { - FatalIOErrorInFunction - ( - *this - ) << "keyword " << keyword << " is undefined in dictionary " + FatalIOErrorInFunction(*this) + << "'" << keyword << "' not found in dictionary " << name() << exit(FatalIOError); } @@ -470,20 +497,18 @@ Foam::dictionary Foam::dictionary::subOrEmptyDict if (mustRead) { - FatalIOErrorInFunction - ( - *this - ) << "keyword " << keyword - << " is not a sub-dictionary in dictionary " + FatalIOErrorInFunction(*this) + << "'" << keyword + << "' is not a sub-dictionary in dictionary " << name() << exit(FatalIOError); } if (finder.found()) { - IOWarningInFunction((*this)) - << "keyword " << keyword - << " found but not a sub-dictionary in dictionary " + IOWarningInFunction(*this) + << "'" << keyword + << "' found but not a sub-dictionary in dictionary " << name() << endl; } @@ -506,9 +531,9 @@ const Foam::dictionary& Foam::dictionary::optionalSubDict if (finder.found()) { - IOWarningInFunction((*this)) - << "keyword " << keyword - << " found but not a sub-dictionary in dictionary " + IOWarningInFunction(*this) + << "'" << keyword + << "' found but not a sub-dictionary in dictionary " << name() << endl; } @@ -597,7 +622,7 @@ Foam::entry* Foam::dictionary::add(entry* entryPtr, bool mergeEntry) } - IOWarningInFunction((*this)) + IOWarningInFunction(*this) << "problem replacing entry "<< entryPtr->keyword() << " in dictionary " << name() << endl; @@ -626,7 +651,7 @@ Foam::entry* Foam::dictionary::add(entry* entryPtr, bool mergeEntry) } - IOWarningInFunction((*this)) + IOWarningInFunction(*this) << "attempt to add entry " << entryPtr->keyword() << " which already exists in dictionary " << name() << endl; diff --git a/src/OpenFOAM/db/dictionary/dictionary.H b/src/OpenFOAM/db/dictionary/dictionary.H index e5e6641b4d514cab2e6ab16144e3a76e2641aaff..2a8f95ec254792d031eb38dab6db783e40d2fa0f 100644 --- a/src/OpenFOAM/db/dictionary/dictionary.H +++ b/src/OpenFOAM/db/dictionary/dictionary.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -143,18 +143,18 @@ public: return name_; } - //- Return the dictionary name + //- Return the dictionary name for modification (use with caution). fileName& name() { return name_; } //- Return the local dictionary name (final part of scoped name) - const word dictName() const + word dictName() const { - const word scopedName = name_.name(); - const auto i = scopedName.rfind('.'); + word scopedName(name_.name()); + const auto i = scopedName.rfind('.'); if (i == std::string::npos) { return scopedName; @@ -383,13 +383,8 @@ private: ) const; - //- Add report of excess tokens to the messageStream - void excessTokens - ( - OSstream& msg, - const word& keyword, - const ITstream& is - ) const; + //- Emit FatalIOError if excess tokens exist + void excessTokens(const word& keyword, const ITstream& is) const; public: @@ -505,7 +500,7 @@ public: ) const; //- Find and return an entry pointer for manipulation if present, - // or return a nullptr. + //- or return a nullptr. // // \param recursive search parent dictionaries // \param patternMatch use regular expressions @@ -516,7 +511,7 @@ public: bool patternMatch ); - //- Find and return an entry if present otherwise error. + //- Find and return an entry if present, otherwise FatalIOError. // // \param recursive search parent dictionaries // \param patternMatch use regular expressions @@ -528,7 +523,7 @@ public: ) const; //- Find and return a T. - //- FatalError if not found, or if there are excess tokens. + //- FatalIOError if not found, or if there are excess tokens. // Default search: non-recursive with patterns. // // \param recursive search parent dictionaries @@ -554,13 +549,13 @@ public: ) const; //- Find and return a T. - //- FatalError if not found, or if there are excess tokens. + //- FatalIOError if not found, or if there are excess tokens. // Default search: non-recursive with patterns. // // \param recursive search parent dictionaries // \param patternMatch use regular expressions // - // \note same as get() + // \deprecated - same as the get() method template<class T> T lookupType ( @@ -570,7 +565,7 @@ public: ) const; //- Find and return a T, or return the given default value - //- FatalError if it is found and there are excess tokens. + //- FatalIOError if it is found and there are excess tokens. // Default search: non-recursive with patterns. // // \param recursive search parent dictionaries @@ -586,7 +581,7 @@ public: //- Find and return a T, or return the given default value //- and add it to dictionary. - //- FatalError if it is found and there are excess tokens. + //- FatalIOError if it is found and there are excess tokens. // Default search: non-recursive with patterns. // // \param recursive search parent dictionaries @@ -600,8 +595,26 @@ public: bool patternMatch = true ); + //- Find entry and assign to T val. + //- FatalIOError if it is found and there are excess tokens. + // Default search: non-recursive with patterns. + // + // \param recursive search parent dictionaries + // \param patternMatch use regular expressions + // + // \return true if the entry was found. + template<class T> + bool read + ( + const word& keyword, + T& val, + bool recursive = false, + bool patternMatch = true, + bool mandatory = true + ) const; + //- Find an entry if present, and assign to T val. - //- FatalError if it is found and there are excess tokens. + //- FatalIOError if it is found and there are excess tokens. // Default search: non-recursive with patterns. // // \param val the value to read @@ -662,7 +675,7 @@ public: dictionary& subDict(const word& keyword); //- Find and return a sub-dictionary as a copy, otherwise return - // an empty dictionary. + //- an empty dictionary. // Warn if the entry exists but is not a sub-dictionary. // // Search type: non-recursive with patterns. @@ -984,7 +997,7 @@ public: bool patternMatch ) const; - //- Find and return an entry if present otherwise error, + //- Find and return an entry if present, otherwise FatalIOError, //- using any compatibility names if needed. // // \param compat list of old compatibility keywords and the last @@ -999,6 +1012,24 @@ public: bool patternMatch ) const; + //- Find and return a T + //- using any compatibility names if needed. + //- FatalIOError if not found, or if there are excess tokens. + // Default search: non-recursive with patterns. + // + // \param compat list of old compatibility keywords and the last + // OpenFOAM version for which they were used. + // \param recursive search parent dictionaries + // \param patternMatch use regular expressions + template<class T> + T getCompat + ( + const word& keyword, + std::initializer_list<std::pair<const char*,int>> compat, + bool recursive = false, + bool patternMatch = true + ) const; + //- Find and return an entry data stream, //- using any compatibility names if needed. // Default search: non-recursive with patterns. @@ -1033,8 +1064,32 @@ public: bool patternMatch = true ) const; + //- Find entry and assign to T val + //- using any compatibility names if needed. + //- FatalIOError if there are excess tokens. + // Default search: non-recursive with patterns. + // + // \param compat list of old compatibility keywords and the last + // OpenFOAM version for which they were used. + // \param val the value to read + // \param recursive search parent dictionaries + // \param patternMatch use regular expressions + // + // \return true if the entry was found. + template<class T> + bool readCompat + ( + const word& keyword, + std::initializer_list<std::pair<const char*,int>> compat, + T& val, + bool recursive = false, + bool patternMatch = true, + bool mandatory = true + ) const; + //- Find an entry if present, and assign to T val //- using any compatibility names if needed. + //- FatalIOError if it is found and there are excess tokens. // Default search: non-recursive with patterns. // // \param compat list of old compatibility keywords and the last diff --git a/src/OpenFOAM/db/dictionary/dictionaryCompat.C b/src/OpenFOAM/db/dictionary/dictionaryCompat.C index 46567b61266e8700aad57b39adc5f952b5f43485..ab8e50001469943cf475a28d28529719f53cba12 100644 --- a/src/OpenFOAM/db/dictionary/dictionaryCompat.C +++ b/src/OpenFOAM/db/dictionary/dictionaryCompat.C @@ -52,7 +52,7 @@ Foam::dictionary::const_searcher Foam::dictionary::csearchCompat bool patternMatch ) const { - const_searcher finder(csearch(keyword, recursive,patternMatch)); + const_searcher finder(csearch(keyword, recursive, patternMatch)); if (finder.found()) { @@ -61,7 +61,7 @@ Foam::dictionary::const_searcher Foam::dictionary::csearchCompat for (const std::pair<const char*,int>& iter : compat) { - finder = csearch(word::validate(iter.first), recursive,patternMatch); + finder = csearch(word::validate(iter.first), recursive, patternMatch); if (finder.found()) { @@ -95,7 +95,7 @@ bool Foam::dictionary::foundCompat bool patternMatch ) const { - return csearchCompat(keyword, compat, recursive,patternMatch).found(); + return csearchCompat(keyword, compat, recursive, patternMatch).found(); } @@ -107,7 +107,7 @@ const Foam::entry* Foam::dictionary::lookupEntryPtrCompat bool patternMatch ) const { - return csearchCompat(keyword, compat, recursive,patternMatch).ptr(); + return csearchCompat(keyword, compat, recursive, patternMatch).ptr(); } @@ -120,14 +120,12 @@ const Foam::entry& Foam::dictionary::lookupEntryCompat ) const { const const_searcher - finder(csearchCompat(keyword, compat, recursive,patternMatch)); + finder(csearchCompat(keyword, compat, recursive, patternMatch)); if (!finder.found()) { - FatalIOErrorInFunction - ( - *this - ) << "keyword " << keyword << " is undefined in dictionary " + FatalIOErrorInFunction(*this) + << "'" << keyword << "' not found in dictionary " << name() << exit(FatalIOError); } @@ -144,7 +142,8 @@ Foam::ITstream& Foam::dictionary::lookupCompat bool patternMatch ) const { - return lookupEntryCompat(keyword, compat, recursive,patternMatch).stream(); + return + lookupEntryCompat(keyword, compat, recursive, patternMatch).stream(); } diff --git a/src/OpenFOAM/db/dictionary/dictionarySearch.C b/src/OpenFOAM/db/dictionary/dictionarySearch.C index cea0844cdfcfc377a96cadd2ccd2b73dfba001e0..34bdd4bca9525294757410fe52827dfb22d674ae 100644 --- a/src/OpenFOAM/db/dictionary/dictionarySearch.C +++ b/src/OpenFOAM/db/dictionary/dictionarySearch.C @@ -27,18 +27,17 @@ License #include "dictionaryEntry.H" #include "stringOps.H" -/* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */ +// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * // -namespace Foam +namespace { - // file-scope - //- Walk lists of patterns and regexps for an exact match - // or regular expression match + // Walk lists of patterns and regexps for an exact match + // or a regular expression match template<class WcIterator, class ReIterator> static bool findInPatterns ( const bool patternMatch, - const word& keyword, + const Foam::word& keyword, WcIterator& wcIter, ReIterator& reIter ) @@ -61,7 +60,8 @@ namespace Foam return false; } -} + +} // End anonymous namespace // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -73,7 +73,7 @@ Foam::dictionary::const_searcher Foam::dictionary::csearchDotScoped bool patternMatch ) const { - std::string::size_type scopePos = keyword.find('.'); + auto scopePos = keyword.find('.'); if (scopePos == string::npos) { @@ -101,10 +101,8 @@ Foam::dictionary::const_searcher Foam::dictionary::csearchDotScoped } else { - FatalIOErrorInFunction - ( - *this - ) << "No parent of current dictionary when searching for " + FatalIOErrorInFunction(*this) + << "No parent of current dictionary when searching for " << keyword.substr(1) << exit(FatalIOError); @@ -210,10 +208,8 @@ Foam::dictionary::const_searcher Foam::dictionary::csearchSlashScoped } else { - FatalIOErrorInFunction - ( - *dictPtr - ) << "No parent of current dictionary when searching for " + FatalIOErrorInFunction(*dictPtr) + << "No parent of current dictionary when searching for " << keyword << " at " << cmpt << exit(FatalIOError); break; @@ -424,10 +420,8 @@ const Foam::dictionary* Foam::dictionary::cfindScopedDictPtr } else { - FatalIOErrorInFunction - ( - *dictPtr - ) << "No parent for dictionary while searching " + FatalIOErrorInFunction(*dictPtr) + << "No parent for dictionary while searching " << path << exit(FatalIOError); @@ -451,10 +445,8 @@ const Foam::dictionary* Foam::dictionary::cfindScopedDictPtr } else { - FatalIOErrorInFunction - ( - *dictPtr - ) << "Found entry '" << cmpt + FatalIOErrorInFunction(*dictPtr) + << "Found entry '" << cmpt << "' but not a dictionary, while searching scoped" << nl << " " << path @@ -533,10 +525,8 @@ Foam::dictionary* Foam::dictionary::makeScopedDictPtr(const fileName& dictPath) } else { - FatalIOErrorInFunction - ( - *dictPtr - ) << "No parent for dictionary while searching " + FatalIOErrorInFunction(*dictPtr) + << "No parent for dictionary while searching " << path << exit(FatalIOError); @@ -561,10 +551,8 @@ Foam::dictionary* Foam::dictionary::makeScopedDictPtr(const fileName& dictPath) } else { - FatalIOErrorInFunction - ( - *dictPtr - ) << "Cannot create sub-dictionary entry '" << cmptName + FatalIOErrorInFunction(*dictPtr) + << "Cannot create sub-dictionary entry '" << cmptName << "' - a non-dictionary entry is in the way" << nl << "Encountered in scope" << nl << " " << path @@ -621,10 +609,8 @@ bool Foam::dictionary::remove(const word& keyword) return true; } - else - { - return false; - } + + return false; } @@ -651,10 +637,8 @@ bool Foam::dictionary::changeKeyword if (iter()->keyword().isPattern()) { - FatalIOErrorInFunction - ( - *this - ) << "Old keyword "<< oldKeyword + FatalIOErrorInFunction(*this) + << "Old keyword "<< oldKeyword << " is a pattern." << "Pattern replacement not yet implemented." << exit(FatalIOError); @@ -688,10 +672,8 @@ bool Foam::dictionary::changeKeyword } else { - IOWarningInFunction - ( - *this - ) << "cannot rename keyword "<< oldKeyword + IOWarningInFunction(*this) + << "cannot rename keyword "<< oldKeyword << " to existing keyword " << newKeyword << " in dictionary " << name() << endl; return false; diff --git a/src/OpenFOAM/db/dictionary/dictionaryTemplates.C b/src/OpenFOAM/db/dictionary/dictionaryTemplates.C index e2a5ab621d6632bbcdce1b92f91ac83a82e9ab84..dc13b26d142f9a6dc1d2c4ae4aed7659e54cd4ae 100644 --- a/src/OpenFOAM/db/dictionary/dictionaryTemplates.C +++ b/src/OpenFOAM/db/dictionary/dictionaryTemplates.C @@ -57,31 +57,63 @@ T Foam::dictionary::get bool patternMatch ) const { - const const_searcher finder(csearch(keyword, recursive, patternMatch)); + T val; + read<T>(keyword, val, recursive, patternMatch); + return val; +} - if (!finder.found()) - { - FatalIOErrorInFunction(*this) - << "keyword " << keyword << " is undefined in dictionary " - << name() - << exit(FatalIOError); - } +template<class T> +T Foam::dictionary::getCompat +( + const word& keyword, + std::initializer_list<std::pair<const char*,int>> compat, + bool recursive, + bool patternMatch +) const +{ T val; - ITstream& is = finder.ptr()->stream(); - is >> val; + readCompat<T>(keyword, compat, val, recursive, patternMatch); + return val; +} + - if (!is.eof()) +template<class T> +bool Foam::dictionary::readCompat +( + const word& keyword, + std::initializer_list<std::pair<const char*,int>> compat, + T& val, + bool recursive, + bool patternMatch, + bool mandatory +) const +{ + const const_searcher + finder(csearchCompat(keyword, compat, recursive, patternMatch)); + + if (finder.found()) { - auto err = FatalIOErrorInFunction(*this); - excessTokens(err, keyword, is); - err << exit(FatalIOError); + ITstream& is = finder.ptr()->stream(); + is >> val; + + excessTokens(keyword, is); + + return true; + } + else if (mandatory) + { + FatalIOErrorInFunction(*this) + << "'" << keyword << "' not found in dictionary " + << name() + << exit(FatalIOError); } - return val; + return false; } +// older name template<class T> T Foam::dictionary::lookupType ( @@ -112,21 +144,15 @@ T Foam::dictionary::lookupOrDefault ITstream& is = finder.ptr()->stream(); is >> val; - if (!is.eof()) - { - auto err = FatalIOErrorInFunction(*this); - excessTokens(err, keyword, is); - err << exit(FatalIOError); - } + excessTokens(keyword, is); return val; } - - if (writeOptionalEntries) + else if (writeOptionalEntries) { IOInfoInFunction(*this) - << "Optional entry '" << keyword << "' is not present," - << " returning the default value '" << deflt << "'" + << "Optional entry '" << keyword << "' not found," + << " using default value '" << deflt << "'" << endl; } @@ -152,21 +178,15 @@ T Foam::dictionary::lookupOrAddDefault ITstream& is = finder.ptr()->stream(); is >> val; - if (!is.eof()) - { - auto err = FatalIOErrorInFunction(*this); - excessTokens(err, keyword, is); - err << exit(FatalIOError); - } + excessTokens(keyword, is); return val; } - - if (writeOptionalEntries) + else if (writeOptionalEntries) { IOInfoInFunction(*this) - << "Optional entry '" << keyword << "' is not present," - << " adding and returning the default value '" << deflt << "'" + << "Optional entry '" << keyword << "' not found," + << " adding default value '" << deflt << "'" << endl; } @@ -176,12 +196,13 @@ T Foam::dictionary::lookupOrAddDefault template<class T> -bool Foam::dictionary::readIfPresent +bool Foam::dictionary::read ( const word& keyword, T& val, bool recursive, - bool patternMatch + bool patternMatch, + bool mandatory ) const { const const_searcher finder(csearch(keyword, recursive, patternMatch)); @@ -191,28 +212,36 @@ bool Foam::dictionary::readIfPresent ITstream& is = finder.ptr()->stream(); is >> val; - if (!is.eof()) - { - auto err = FatalIOErrorInFunction(*this); - excessTokens(err, keyword, is); - err << exit(FatalIOError); - } + excessTokens(keyword, is); return true; } - - if (writeOptionalEntries) + else if (mandatory) { - IOInfoInFunction(*this) - << "Optional entry '" << keyword << "' is not present," - << " the default value '" << val << "' will be used." - << endl; + FatalIOErrorInFunction(*this) + << "'" << keyword << "' not found in dictionary " + << name() + << exit(FatalIOError); } return false; } +template<class T> +bool Foam::dictionary::readIfPresent +( + const word& keyword, + T& val, + bool recursive, + bool patternMatch +) const +{ + // Read is non-mandatory + return read<T>(keyword, val, recursive, patternMatch, false); +} + + template<class T> T Foam::dictionary::lookupOrDefaultCompat ( @@ -233,21 +262,15 @@ T Foam::dictionary::lookupOrDefaultCompat ITstream& is = finder.ptr()->stream(); is >> val; - if (!is.eof()) - { - auto err = FatalIOErrorInFunction(*this); - excessTokens(err, keyword, is); - err << exit(FatalIOError); - } + excessTokens(keyword, is); return val; } - - if (writeOptionalEntries) + else if (writeOptionalEntries) { IOInfoInFunction(*this) - << "Optional entry '" << keyword << "' is not present," - << " returning the default value '" << deflt << "'" + << "Optional entry '" << keyword << "' not found," + << " using default value '" << deflt << "'" << endl; } @@ -265,33 +288,8 @@ bool Foam::dictionary::readIfPresentCompat bool patternMatch ) const { - const const_searcher - finder(csearchCompat(keyword, compat, recursive, patternMatch)); - - if (finder.found()) - { - ITstream& is = finder.ptr()->stream(); - is >> val; - - if (!is.eof()) - { - auto err = FatalIOErrorInFunction(*this); - excessTokens(err, keyword, is); - err << exit(FatalIOError); - } - - return true; - } - - if (writeOptionalEntries) - { - IOInfoInFunction(*this) - << "Optional entry '" << keyword << "' is not present," - << " the default value '" << val << "' will be used." - << endl; - } - - return false; + // Read is non-mandatory + return readCompat<T>(keyword, compat, recursive, patternMatch, false); } diff --git a/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C b/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C index 641a051a41d59da9b35ec196c244d2320fd1679b..2c64282612975077b59f46a5c618c376291e56d8 100644 --- a/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C +++ b/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -79,104 +79,92 @@ Foam::dlLibraryTable::~dlLibraryTable() bool Foam::dlLibraryTable::open ( - const fileName& functionLibName, + const fileName& libName, const bool verbose ) { - if (functionLibName.size()) + if (libName.empty()) { - void* functionLibPtr = dlOpen - ( - fileName(functionLibName).expand(), - verbose - ); + return false; + } - if (debug) - { - InfoInFunction - << "Opened " << functionLibName - << " resulting in handle " << uintptr_t(functionLibPtr) << endl; - } + void* ptr = dlOpen(fileName(libName).expand(), verbose); - if (!functionLibPtr) - { - if (verbose) - { - WarningInFunction - << "could not load " << functionLibName - << endl; - } + if (debug) + { + InfoInFunction + << "Opened " << libName + << " resulting in handle " << uintptr_t(ptr) << endl; + } - return false; - } - else - { - libPtrs_.append(functionLibPtr); - libNames_.append(functionLibName); - return true; - } + if (ptr) + { + libPtrs_.append(ptr); + libNames_.append(libName); + return true; } - else + + if (verbose) { - return false; + WarningInFunction + << "could not load " << libName + << endl; } + + return false; } bool Foam::dlLibraryTable::close ( - const fileName& functionLibName, + const fileName& libName, const bool verbose ) { label index = -1; forAllReverse(libNames_, i) { - if (libNames_[i] == functionLibName) + if (libName == libNames_[i]) { index = i; break; } } - if (index != -1) + if (index == -1) { - if (debug) - { - InfoInFunction - << "Closing " << functionLibName - << " with handle " << uintptr_t(libPtrs_[index]) << endl; - } + return false; + } - bool ok = dlClose(libPtrs_[index]); + if (debug) + { + InfoInFunction + << "Closing " << libName + << " with handle " << uintptr_t(libPtrs_[index]) << endl; + } - libPtrs_[index] = nullptr; - libNames_[index] = fileName::null; + const bool ok = dlClose(libPtrs_[index]); - if (!ok) - { - if (verbose) - { - WarningInFunction - << "could not close " << functionLibName - << endl; - } - - return false; - } + libPtrs_[index] = nullptr; + libNames_[index].clear(); - return true; + if (!ok && verbose) + { + WarningInFunction + << "could not close " << libName + << endl; } - return false; + + return ok; } -void* Foam::dlLibraryTable::findLibrary(const fileName& functionLibName) +void* Foam::dlLibraryTable::findLibrary(const fileName& libName) { label index = -1; forAllReverse(libNames_, i) { - if (libNames_[i] == functionLibName) + if (libName == libNames_[i]) { index = i; break; @@ -187,6 +175,7 @@ void* Foam::dlLibraryTable::findLibrary(const fileName& functionLibName) { return libPtrs_[index]; } + return nullptr; } @@ -197,23 +186,20 @@ bool Foam::dlLibraryTable::open const word& libsEntry ) { - if (dict.found(libsEntry)) - { - fileNameList libNames(dict.lookup(libsEntry)); + fileNameList libNames; + dict.readIfPresent(libsEntry, libNames); - bool allOpened = !libNames.empty(); + label nOpen = 0; - forAll(libNames, i) + for (const fileName& libName : libNames) + { + if (dlLibraryTable::open(libName)) { - allOpened = dlLibraryTable::open(libNames[i]) && allOpened; + ++nOpen; } - - return allOpened; - } - else - { - return false; } + + return nOpen && nOpen == libNames.size(); } diff --git a/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.H b/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.H index b40c4c495393c32ce0b67d999a127bc362f9ff82..04f51fd5ad8cb717115ce87d5998e0775bae5b07 100644 --- a/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.H +++ b/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.H @@ -49,13 +49,15 @@ namespace Foam class dlLibraryTable { - // Private Member Functions + // Private data DynamicList<void*> libPtrs_; DynamicList<fileName> libNames_; + // Private Member Functions + //- No copy construct dlLibraryTable(const dlLibraryTable&) = delete; @@ -73,9 +75,9 @@ public: //- Construct null dlLibraryTable(); - //- Construct from dictionary and name of 'libs' entry giving - // the libraries to load - dlLibraryTable(const dictionary&, const word&); + //- Open all libraries listed in the 'libsEntry' entry in the + //- given dictionary. + dlLibraryTable(const dictionary& dict, const word& libsEntry); //- Destructor @@ -85,25 +87,25 @@ public: // Member Functions //- Open the named library, optionally with warnings if problems occur - bool open(const fileName& name, const bool verbose = true); + bool open(const fileName& libName, const bool verbose = true); //- Close the named library, optionally with warnings if problems occur - bool close(const fileName& name, const bool verbose = true); + bool close(const fileName& libName, const bool verbose = true); //- Find the handle of the named library - void* findLibrary(const fileName& name); + void* findLibrary(const fileName& libName); - //- Open all the libraries listed in the 'libsEntry' entry in the - // given dictionary if present - bool open(const dictionary&, const word& libsEntry); + //- Open all libraries listed in the 'libsEntry' entry in the + //- given dictionary. + bool open(const dictionary& dict, const word& libsEntry); - //- Open all the libraries listed in the 'libsEntry' entry in the - // given dictionary if present and check the additions - // to the given constructor table + //- Open all libraries listed in the 'libsEntry' entry in the + //- given dictionary and check the additions + //- to the given constructor table template<class TablePtr> bool open ( - const dictionary&, + const dictionary& dict, const word& libsEntry, const TablePtr& tablePtr ); diff --git a/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTableTemplates.C b/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTableTemplates.C index 62796ab0624045cf4bb14e0102d5f9b745852917..08491cb03a2562e75dd97dc3aee2464a18f3bcea 100644 --- a/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTableTemplates.C +++ b/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTableTemplates.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -37,47 +37,36 @@ bool Foam::dlLibraryTable::open const TablePtr& tablePtr ) { - if (dict.found(libsEntry)) - { - fileNameList libNames(dict.lookup(libsEntry)); - - bool allOpened = (libNames.size() > 0); + fileNameList libNames; + dict.readIfPresent(libsEntry, libNames); - forAll(libNames, i) - { - const fileName& libName = libNames[i]; + label nOpen = 0; - label nEntries = 0; - - if (tablePtr) - { - nEntries = tablePtr->size(); - } + for (const fileName& libName : libNames) + { + const label nEntries = (tablePtr ? tablePtr->size() : 0); - bool opened = dlLibraryTable::open(libName); - allOpened = opened && allOpened; + if (dlLibraryTable::open(libName)) + { + ++nOpen; - if (!opened) - { - WarningInFunction - << "Could not open library " << libName - << endl << endl; - } - else if (debug && (!tablePtr || tablePtr->size() <= nEntries)) + if (debug && (!tablePtr || tablePtr->size() <= nEntries)) { WarningInFunction << "library " << libName << " did not introduce any new entries" - << endl << endl; + << nl << endl; } } - - return allOpened; - } - else - { - return false; + else + { + WarningInFunction + << "Could not open library " << libName + << nl << endl; + } } + + return nOpen && nOpen == libNames.size(); } diff --git a/src/OpenFOAM/db/error/IOerror.C b/src/OpenFOAM/db/error/IOerror.C index d200c578ab06e7aa1a78632259170d9f0fc66b48..9b6eea93c9ae30cf36a41d6b6c08a7ad1f72c591 100644 --- a/src/OpenFOAM/db/error/IOerror.C +++ b/src/OpenFOAM/db/error/IOerror.C @@ -139,15 +139,15 @@ void Foam::IOerror::SafeFatalIOError else { std::cerr - << std::endl - << "--> FOAM FATAL IO ERROR:" << std::endl + << nl + << "--> FOAM FATAL IO ERROR:" << nl << msg - << std::endl + << nl << "file: " << ioStream.name() << " at line " << ioStream.lineNumber() << '.' - << std::endl << std::endl + << nl << nl << " From function " << functionName - << std::endl + << nl << " in file " << sourceFileName << " at line " << sourceFileLineNumber << '.' << std::endl; diff --git a/src/OpenFOAM/dimensionedTypes/dimensionedType/dimensionedType.C b/src/OpenFOAM/dimensionedTypes/dimensionedType/dimensionedType.C index 855d3e900ea8220bc02832294217b84c5366ea18..e34cf0edc4baa1645955c8bee620e6d3256bc49d 100644 --- a/src/OpenFOAM/dimensionedTypes/dimensionedType/dimensionedType.C +++ b/src/OpenFOAM/dimensionedTypes/dimensionedType/dimensionedType.C @@ -199,7 +199,7 @@ Foam::dimensioned<Type> Foam::dimensioned<Type>::lookupOrDefault { if (dict.found(name)) { - return dimensioned<Type>(name, dims, dict.lookup(name)); + return dimensioned<Type>(name, dims, dict.get<Type>(name)); } return dimensioned<Type>(name, dims, defaultValue); @@ -316,7 +316,7 @@ void Foam::dimensioned<Type>::replace template<class Type> void Foam::dimensioned<Type>::read(const dictionary& dict) { - dict.lookup(name_) >> value_; + dict.read(name_, value_); } diff --git a/src/OpenFOAM/dimensionedTypes/dimensionedType/dimensionedType.H b/src/OpenFOAM/dimensionedTypes/dimensionedType/dimensionedType.H index 65e8aa1d6fa5ad742028fa75b6657e761c8ead07..b761462ab315589566ab476d27aefd4555b9c3a4 100644 --- a/src/OpenFOAM/dimensionedTypes/dimensionedType/dimensionedType.H +++ b/src/OpenFOAM/dimensionedTypes/dimensionedType/dimensionedType.H @@ -141,6 +141,7 @@ public: // Static member functions //- Construct from dictionary, with default dimensions and value. + //- FatalIOError if there are excess tokens. static dimensioned<Type> lookupOrDefault ( const word& name, @@ -149,7 +150,8 @@ public: const Type& defaultValue = Type(Zero) ); - //- Construct from dictionary dimensionless with value. + //- Construct from dictionary, dimensionless and with a value. + // FatalIOError if it is found and there are excess tokens. static dimensioned<Type> lookupOrDefault ( const word& name, @@ -159,6 +161,7 @@ public: //- Construct from dictionary, with default value. // If the value is not found, it is added into the dictionary. + // FatalIOError if it is found and there are excess tokens. static dimensioned<Type> lookupOrAddToDict ( const word& name, @@ -169,6 +172,7 @@ public: //- Construct from dictionary, dimensionless with default value. // If the value is not found, it is added into the dictionary. + // FatalIOError if it is found and there are excess tokens. static dimensioned<Type> lookupOrAddToDict ( const word& name, diff --git a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.H index 2029249ed3b8886af3793cfdfb8f6b81454b98d5..1e0ab218491e9ee1f26f9cf79f04c8a064d68e1a 100644 --- a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.H +++ b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.H @@ -35,7 +35,7 @@ Description SourceFiles pointPatchField.C - newPointPatchField.C + pointPatchFieldNew.C \*---------------------------------------------------------------------------*/ diff --git a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchFieldNew.C b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchFieldNew.C index a3ce7e0d8a7cd3e0098732b25fd0c89a66e1bf86..5e88a183dc8912f4448c43b82f22c1d53b277f72 100644 --- a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchFieldNew.C +++ b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchFieldNew.C @@ -6,20 +6,20 @@ \\/ M anipulation | ------------------------------------------------------------------------------- License - This file is part of2011 OpenFOAM. + This file is part of OpenFOAM. - 2011 OpenFOAM is free software: you can redistribute it and/or modify it + OpenFOAM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - 2011 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with2011 OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. \*---------------------------------------------------------------------------*/ diff --git a/src/OpenFOAM/global/profiling/profilingInformation.H b/src/OpenFOAM/global/profiling/profilingInformation.H index 6a8ee2a7ab10fdc2266ea4c4b1be121b39e88593..1e19b06c2fcb29870f2fb112b54d156fc649b389 100644 --- a/src/OpenFOAM/global/profiling/profilingInformation.H +++ b/src/OpenFOAM/global/profiling/profilingInformation.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2009-2016 Bernhard Gschaider - \\/ M anipulation | Copyright (C) 2016-2107 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. diff --git a/src/OpenFOAM/primitives/enums/Enum.C b/src/OpenFOAM/primitives/enums/Enum.C index 671af7fe2dc658f02e8f2f1e4e944106368b02f9..3863af757f20ea8a3bf77a7ed7b3a19b66e9baec 100644 --- a/src/OpenFOAM/primitives/enums/Enum.C +++ b/src/OpenFOAM/primitives/enums/Enum.C @@ -186,7 +186,7 @@ EnumType Foam::Enum<EnumType>::lookup const dictionary& dict ) const { - const word enumName(dict.lookup(key)); + const word enumName(dict.get<word>(key)); const label idx = getIndex(enumName); if (idx < 0) @@ -228,7 +228,7 @@ EnumType Foam::Enum<EnumType>::lookupOrFailsafe { if (dict.found(key)) { - const word enumName(dict.lookup(key)); + const word enumName(dict.get<word>(key)); const label idx = getIndex(enumName); if (idx >= 0) diff --git a/src/OpenFOAM/primitives/functions/Function1/ramp/ramp.C b/src/OpenFOAM/primitives/functions/Function1/ramp/ramp.C index 773a072f2ef794b5a6889a3fb6dd6f6ab3f660ea..1f39dafa3edf6e266d37e4a044f75c27be95d8dc 100644 --- a/src/OpenFOAM/primitives/functions/Function1/ramp/ramp.C +++ b/src/OpenFOAM/primitives/functions/Function1/ramp/ramp.C @@ -30,7 +30,7 @@ License void Foam::Function1Types::ramp::read(const dictionary& coeffs) { start_ = coeffs.lookupOrDefault<scalar>("start", 0); - duration_ = coeffs.lookupType<scalar>("duration"); + duration_ = coeffs.get<scalar>("duration"); } diff --git a/src/combustionModels/eddyDissipationModelBase/eddyDissipationModelBase.H b/src/combustionModels/eddyDissipationModelBase/eddyDissipationModelBase.H index e85c8b7526143a1045c3d20995dd55e8ca885f90..1a4c20137b86e9292faffcc466569c2c881e993c 100644 --- a/src/combustionModels/eddyDissipationModelBase/eddyDissipationModelBase.H +++ b/src/combustionModels/eddyDissipationModelBase/eddyDissipationModelBase.H @@ -100,6 +100,12 @@ public: //- Calculate time scale virtual tmp<volScalarField> timeScale() = 0; + //- Return the CEDC coefficient + scalar CEDC() const + { + return CEDC_; + } + // I-O diff --git a/src/combustionModels/singleStepCombustion/singleStepCombustion.H b/src/combustionModels/singleStepCombustion/singleStepCombustion.H index 43c69b10ecf192a119c1f8cdac8ce0a175365c6d..039971f7e031accd6685d26f157a22ace032e785 100644 --- a/src/combustionModels/singleStepCombustion/singleStepCombustion.H +++ b/src/combustionModels/singleStepCombustion/singleStepCombustion.H @@ -40,6 +40,7 @@ SourceFiles #include "singleStepReactingMixture.H" #include "ThermoCombustion.H" +#include "fvScalarMatrix.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/conversion/vtk/output/foamVtkOutputFields.H b/src/conversion/vtk/output/foamVtkOutputFields.H index 22f9a8d60f3a122f2604f575f1bdd030e5491fd5..9cd9766263b36eab32f1abc7ef9f364c34fc00ca 100644 --- a/src/conversion/vtk/output/foamVtkOutputFields.H +++ b/src/conversion/vtk/output/foamVtkOutputFields.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016-2107 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/conversion/vtk/output/foamVtkOutputFieldsTemplates.C b/src/conversion/vtk/output/foamVtkOutputFieldsTemplates.C index b3852dad2b3c5f8aa3d3d5b1ff6fb5cc8e6b204d..74cb846a1b4db8d29465a5129d1e90e80d7d90c9 100644 --- a/src/conversion/vtk/output/foamVtkOutputFieldsTemplates.C +++ b/src/conversion/vtk/output/foamVtkOutputFieldsTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016-2107 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C b/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C index 982cf21b536c80ffc735f955120a07c9e004e4c0..25dc0c9687f20bc7b1f7746531c29712e9001914 100644 --- a/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C +++ b/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C @@ -203,7 +203,7 @@ void Foam::dynamicRefineFvMesh::readDict() correctFluxes_.insert(fluxVelocities[i][0], fluxVelocities[i][1]); } - dumpLevel_ = Switch(refineDict.lookup("dumpLevel")); + dumpLevel_ = refineDict.get<bool>("dumpLevel"); } diff --git a/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.H b/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.H index dc3443e9c14735270c81452bd9ae7811ffcde201..babbceabea16533c071745a7768ccd93f4100865 100644 --- a/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.H +++ b/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.H @@ -71,7 +71,6 @@ SourceFiles #include "dynamicFvMesh.H" #include "hexRef8.H" #include "bitSet.H" -#include "Switch.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -92,7 +91,7 @@ protected: hexRef8 meshCutter_; //- Dump cellLevel for post-processing - Switch dumpLevel_; + bool dumpLevel_; //- Fluxes to map HashTable<word> correctFluxes_; diff --git a/src/dynamicMesh/attachDetach/attachDetach.C b/src/dynamicMesh/attachDetach/attachDetach.C index aa8f22f8437e3aeecef6d97ebfc209bf30b1fcbe..2b3ef5ae55c1d7c8bc21ba3918d6160229231464 100644 --- a/src/dynamicMesh/attachDetach/attachDetach.C +++ b/src/dynamicMesh/attachDetach/attachDetach.C @@ -266,7 +266,7 @@ Foam::attachDetach::attachDetach const polyTopoChanger& mme ) : - polyMeshModifier(name, index, mme, Switch(dict.lookup("active"))), + polyMeshModifier(name, index, mme, dict.get<bool>("active")), faceZoneID_ ( dict.lookup("faceZoneName"), diff --git a/src/dynamicMesh/layerAdditionRemoval/layerAdditionRemoval.C b/src/dynamicMesh/layerAdditionRemoval/layerAdditionRemoval.C index 0913f7fba79f5b4b4b676bc2c8072b61bcf2a973..631f247c5cf99c9f2f0ec589e8cce8aac6fcbdef 100644 --- a/src/dynamicMesh/layerAdditionRemoval/layerAdditionRemoval.C +++ b/src/dynamicMesh/layerAdditionRemoval/layerAdditionRemoval.C @@ -140,7 +140,7 @@ Foam::layerAdditionRemoval::layerAdditionRemoval const word& zoneName, const scalar minThickness, const scalar maxThickness, - const Switch thicknessFromVolume + const bool thicknessFromVolume ) : polyMeshModifier(name, index, ptc, true), @@ -166,14 +166,11 @@ Foam::layerAdditionRemoval::layerAdditionRemoval const polyTopoChanger& ptc ) : - polyMeshModifier(name, index, ptc, Switch(dict.lookup("active"))), + polyMeshModifier(name, index, ptc, dict.get<bool>("active")), faceZoneID_(dict.lookup("faceZoneName"), ptc.mesh().faceZones()), minLayerThickness_(readScalar(dict.lookup("minLayerThickness"))), maxLayerThickness_(readScalar(dict.lookup("maxLayerThickness"))), - thicknessFromVolume_ - ( - dict.lookupOrDefault<Switch>("thicknessFromVolume", true) - ), + thicknessFromVolume_(dict.lookupOrDefault("thicknessFromVolume", true)), oldLayerThickness_(readOldThickness(dict)), pointsPairingPtr_(nullptr), facesPairingPtr_(nullptr), diff --git a/src/dynamicMesh/layerAdditionRemoval/layerAdditionRemoval.H b/src/dynamicMesh/layerAdditionRemoval/layerAdditionRemoval.H index 2a2e14c259c08a0dc9fed7e2de3c314aa8f45043..34f739260dafc34951a5c4713c21559e1aa1db77 100644 --- a/src/dynamicMesh/layerAdditionRemoval/layerAdditionRemoval.H +++ b/src/dynamicMesh/layerAdditionRemoval/layerAdditionRemoval.H @@ -158,7 +158,7 @@ public: const word& zoneName, const scalar minThickness, const scalar maxThickness, - const Switch thicknessFromVolume = true + const bool thicknessFromVolume = true ); //- Construct from dictionary diff --git a/src/dynamicMesh/meshCut/directions/directions.C b/src/dynamicMesh/meshCut/directions/directions.C index b959dfa4eda22449c721cfd74ee4d0d8e468a3a0..b5258913447df7894863134abd695c164729c034 100644 --- a/src/dynamicMesh/meshCut/directions/directions.C +++ b/src/dynamicMesh/meshCut/directions/directions.C @@ -31,7 +31,6 @@ License #include "OFstream.H" #include "meshTools.H" #include "hexMatcher.H" -#include "Switch.H" #include "globalMeshData.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -371,7 +370,7 @@ Foam::directions::directions << tan1 << endl << endl; } - Switch useTopo(dict.lookup("useHexTopology")); + const bool useTopo(dict.get<bool>("useHexTopology")); vectorField normalDirs; vectorField tan1Dirs; diff --git a/src/dynamicMesh/meshCut/meshModifiers/multiDirRefinement/multiDirRefinement.C b/src/dynamicMesh/meshCut/meshModifiers/multiDirRefinement/multiDirRefinement.C index 9bc0314842ab7c1b180abcfb2f90358e821fefb4..814cdeffc67e141b3b0daf8fbf4b95959dd8f091 100644 --- a/src/dynamicMesh/meshCut/meshModifiers/multiDirRefinement/multiDirRefinement.C +++ b/src/dynamicMesh/meshCut/meshModifiers/multiDirRefinement/multiDirRefinement.C @@ -450,7 +450,7 @@ void Foam::multiDirRefinement::refineFromDict ) { // How to walk cell circumference. - Switch pureGeomCut(dict.lookup("geometricCut")); + const bool pureGeomCut(dict.get<bool>("geometricCut")); autoPtr<cellLooper> cellWalker; if (pureGeomCut) @@ -486,9 +486,9 @@ Foam::multiDirRefinement::multiDirRefinement cellLabels_(cellLabels), addedCells_(mesh.nCells()) { - Switch useHex(dict.lookup("useHexTopology")); + const bool useHex(dict.get<bool>("useHexTopology")); - Switch writeMesh(dict.lookup("writeMesh")); + const bool writeMesh(dict.get<bool>("writeMesh")); wordList dirNames(dict.lookup("directions")); @@ -529,9 +529,9 @@ Foam::multiDirRefinement::multiDirRefinement cellLabels_(cellLabels), addedCells_(mesh.nCells()) { - Switch useHex(dict.lookup("useHexTopology")); + const bool useHex(dict.get<bool>("useHexTopology")); - Switch writeMesh(dict.lookup("writeMesh")); + const bool writeMesh(dict.get<bool>("writeMesh")); wordList dirNames(dict.lookup("directions")); diff --git a/src/dynamicMesh/setUpdater/setUpdater.C b/src/dynamicMesh/setUpdater/setUpdater.C index 290de7124d35e5a64c52076adaa5a2f478cc1779..0c8d7aa6afa76f46c41fabde6b903fd333a31c12 100644 --- a/src/dynamicMesh/setUpdater/setUpdater.C +++ b/src/dynamicMesh/setUpdater/setUpdater.C @@ -56,7 +56,7 @@ Foam::setUpdater::setUpdater const polyTopoChanger& mme ) : - polyMeshModifier(name, index, mme, Switch(dict.lookup("active"))) + polyMeshModifier(name, index, mme, dict.get<bool>("active")) {} diff --git a/src/dynamicMesh/slidingInterface/slidingInterface.C b/src/dynamicMesh/slidingInterface/slidingInterface.C index 093391c36bd7600be9c4593672051063a908a7ff..400ce29ec00e74054a1dae23bbea50771a5b622e 100644 --- a/src/dynamicMesh/slidingInterface/slidingInterface.C +++ b/src/dynamicMesh/slidingInterface/slidingInterface.C @@ -210,7 +210,7 @@ Foam::slidingInterface::slidingInterface const polyTopoChanger& mme ) : - polyMeshModifier(name, index, mme, Switch(dict.lookup("active"))), + polyMeshModifier(name, index, mme, dict.get<bool>("active")), masterFaceZoneID_ ( dict.lookup("masterFaceZoneName"), diff --git a/src/fileFormats/vtk/output/foamVtkOutput.H b/src/fileFormats/vtk/output/foamVtkOutput.H index 0ad5f384887ca70b9e99991691b375453ec70c34..4a71b5208d310885e04cfcfc5a14e42cd1f99906 100644 --- a/src/fileFormats/vtk/output/foamVtkOutput.H +++ b/src/fileFormats/vtk/output/foamVtkOutput.H @@ -59,9 +59,7 @@ namespace vtk // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - // Constants - - // General Functions +// General Functions //- Return a default asciiFormatter autoPtr<vtk::formatter> newFormatter(std::ostream& os); @@ -94,7 +92,7 @@ namespace vtk void writeList ( vtk::formatter& fmt, - const UList<Type>& lst + const UList<Type>& list ); //- Write a list of values. @@ -103,7 +101,7 @@ namespace vtk void writeList ( vtk::formatter& fmt, - const FixedList<Type, Size>& lst + const FixedList<Type, Size>& list ); @@ -113,7 +111,7 @@ namespace vtk void writeList ( vtk::formatter& fmt, - const UList<Type>& lst, + const UList<Type>& list, const labelUList& addressing ); @@ -126,7 +124,7 @@ namespace vtk namespace legacy { - // Constants +// Constants //- Strings corresponding to the (POLYDATA, UNSTRUCTURED_GRID) elements extern const Foam::Enum<vtk::fileTag> contentNames; @@ -135,7 +133,7 @@ namespace legacy extern const Foam::Enum<vtk::fileTag> dataTypeNames; - // Functions +// Functions //- Emit header for legacy file. // Writes "ASCII" or "BINARY" depending on specified type. diff --git a/src/fileFormats/vtk/output/foamVtkOutputTemplates.C b/src/fileFormats/vtk/output/foamVtkOutputTemplates.C index 3cc030a3bc3d5c985a41aa9726b82923040faba9..7a398f8d9d0c6199ecb3fd2e4d40e20156251c86 100644 --- a/src/fileFormats/vtk/output/foamVtkOutputTemplates.C +++ b/src/fileFormats/vtk/output/foamVtkOutputTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016-2107 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -44,12 +44,12 @@ template<class Type> void Foam::vtk::writeList ( vtk::formatter& fmt, - const UList<Type>& lst + const UList<Type>& list ) { - forAll(lst, i) + for (const Type& val : list) { - write(fmt, lst[i]); + write(fmt, val); } } @@ -58,12 +58,12 @@ template<class Type, unsigned Size> void Foam::vtk::writeList ( vtk::formatter& fmt, - const FixedList<Type, Size>& lst + const FixedList<Type, Size>& list ) { - for (unsigned i=0; i<Size; ++i) + for (const Type& val : list) { - write(fmt, lst[i]); + write(fmt, val); } } @@ -72,13 +72,13 @@ template<class Type> void Foam::vtk::writeList ( vtk::formatter& fmt, - const UList<Type>& lst, + const UList<Type>& list, const labelUList& addressing ) { - forAll(addressing, i) + for (const label idx : addressing) { - write(fmt, lst[addressing[i]]); + write(fmt, list[idx]); } } diff --git a/src/finiteArea/finiteArea/faSchemes/faSchemes.C b/src/finiteArea/finiteArea/faSchemes/faSchemes.C index cb4c58c9f671793ab66e0eca9bff2571b55cf535..ef38e9c6321c53bca212009e0ea9181473a236bb 100644 --- a/src/finiteArea/finiteArea/faSchemes/faSchemes.C +++ b/src/finiteArea/finiteArea/faSchemes/faSchemes.C @@ -179,10 +179,10 @@ void Foam::faSchemes::read(const dictionary& dict) if ( fluxRequired_.found("default") - && word(fluxRequired_.lookup("default")) != "none" + && fluxRequired_.get<word>("default") != "none" ) { - defaultFluxRequired_ = Switch(fluxRequired_.lookup("default")); + defaultFluxRequired_ = fluxRequired_.get<bool>("default"); } } } diff --git a/src/finiteVolume/finiteVolume/fvSchemes/fvSchemes.C b/src/finiteVolume/finiteVolume/fvSchemes/fvSchemes.C index 2841fb85e347f5d3a4a7d54292d7f125b8820a08..15d4c9150e8dfc36e51a868b49f6a0c241a85090 100644 --- a/src/finiteVolume/finiteVolume/fvSchemes/fvSchemes.C +++ b/src/finiteVolume/finiteVolume/fvSchemes/fvSchemes.C @@ -181,10 +181,10 @@ void Foam::fvSchemes::read(const dictionary& dict) if ( fluxRequired_.found("default") - && word(fluxRequired_.lookup("default")) != "none" + && fluxRequired_.get<word>("default") != "none" ) { - defaultFluxRequired_ = Switch(fluxRequired_.lookup("default")); + defaultFluxRequired_ = fluxRequired_.get<bool>("default"); } } } diff --git a/src/lagrangian/basic/InteractionLists/InteractionLists.C b/src/lagrangian/basic/InteractionLists/InteractionLists.C index d38bfae3bae085858a90655591744e38a2f4f988..922ee09185867b97a0af10dc605842b991bbbcae 100644 --- a/src/lagrangian/basic/InteractionLists/InteractionLists.C +++ b/src/lagrangian/basic/InteractionLists/InteractionLists.C @@ -1114,7 +1114,7 @@ Foam::InteractionLists<ParticleType>::InteractionLists ( const polyMesh& mesh, scalar maxDistance, - Switch writeCloud, + bool writeCloud, const word& UName ) : diff --git a/src/lagrangian/basic/InteractionLists/InteractionLists.H b/src/lagrangian/basic/InteractionLists/InteractionLists.H index b7f8a550a4df45f77cc8ef00dd76964f34e13caf..0f5802e95b027283a3851e772cce9e80c7a322d1 100644 --- a/src/lagrangian/basic/InteractionLists/InteractionLists.H +++ b/src/lagrangian/basic/InteractionLists/InteractionLists.H @@ -89,7 +89,7 @@ class InteractionLists //- Switch controlling whether or not the cloud gets populated // with the referred particles, hence gets written out - const Switch writeCloud_; + const bool writeCloud_; //- mapDistribute to exchange referred particles into referred cells autoPtr<mapDistribute> cellMapPtr_; @@ -218,7 +218,7 @@ public: ( const polyMesh& mesh, scalar maxDistance, - Switch writeCloud = false, + bool writeCloud = false, const word& UName = "U" ); diff --git a/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationIntrinsicRate/COxidationIntrinsicRate.C b/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationIntrinsicRate/COxidationIntrinsicRate.C index 1a260dac90e6e7fc3a49cc31cc891730095e1898..77435d66b48130a125332b23ad70a976a094c8e5 100644 --- a/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationIntrinsicRate/COxidationIntrinsicRate.C +++ b/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationIntrinsicRate/COxidationIntrinsicRate.C @@ -180,7 +180,7 @@ Foam::scalar Foam::COxidationIntrinsicRate<CloudType>::calculate max(0.5*d*sqrt(Sb_*rhop*Ag_*ki*ppO2/(De*rhoO2)), ROOTVSMALL); // Effectiveness factor [] - const scalar eta = max(3.0*sqr(phi)*(phi/tanh(phi) - 1.0), 0.0); + const scalar eta = max(3.0/sqr(phi)*(phi/tanh(phi) - 1.0), 0.0); // Chemical rate [kmol/m2/s] const scalar R = eta*d/6.0*rhop*Ag_*ki; diff --git a/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairCollision.C b/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairCollision.C index 05402b48933edcabea66a7e9bb05ea34d909d7c4..7d68828701da8dd440f70f354ac2d6650df8fd50 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairCollision.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairCollision.C @@ -553,13 +553,10 @@ Foam::PairCollision<CloudType>::PairCollision ( owner.mesh(), readScalar(this->coeffDict().lookup("maxInteractionDistance")), - Switch + this->coeffDict().lookupOrDefault ( - this->coeffDict().lookupOrDefault - ( - "writeReferredParticleCloud", - false - ) + "writeReferredParticleCloud", + false ), this->coeffDict().lookupOrDefault("U", word("U")) ) diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.C index d141ce77fecf3d955b341ed8aabc2d87b28267d8..db0296b9147308243770bc074301dbdf3185407d 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.C @@ -198,12 +198,12 @@ Foam::label Foam::ConeInjection<CloudType>::parcelsToInject { const scalar targetVolume = flowRateProfile_.integrate(0, time1); - const label targetParcels = - parcelsPerInjector_*targetVolume/this->volumeTotal_; + const scalar volumeFraction = targetVolume/this->volumeTotal_; - const label nToInject = targetParcels - nInjected_; + const label targetParcels = + ceil(positionAxis_.size()*parcelsPerInjector_*volumeFraction); - return positionAxis_.size()*nToInject; + return targetParcels - nInjected_; } else { diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.C index 245bb27f85b7092cbb76b3f9481eb7dddbb43de7..065bf8124840aa067ce9a6763e894a7e1f26a880 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.C @@ -214,7 +214,7 @@ Foam::ConeNozzleInjection<CloudType>::ConeNozzleInjection while(magTangent < SMALL) { - vector v = rndGen.sample01<vector>(); + vector v = rndGen.globalSample01<vector>(); tangent = v - (v & direction_)*direction_; magTangent = mag(tangent); @@ -354,7 +354,7 @@ void Foam::ConeNozzleInjection<CloudType>::setPositionAndCell { Random& rndGen = this->owner().rndGen(); - scalar beta = mathematical::twoPi*rndGen.sample01<scalar>(); + scalar beta = mathematical::twoPi*rndGen.globalSample01<scalar>(); normal_ = tanVec1_*cos(beta) + tanVec2_*sin(beta); switch (injectionMethod_) diff --git a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/MultiInteraction/MultiInteraction.C b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/MultiInteraction/MultiInteraction.C index 65b884b9b3cafdb4bd8e49d6cb82b253994a7118..735b3b5ba8a7dce43710de45e6d70022fdba4583 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/MultiInteraction/MultiInteraction.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/MultiInteraction/MultiInteraction.C @@ -64,7 +64,7 @@ bool Foam::MultiInteraction<CloudType>::read(const dictionary& dict) } } - oneInteractionOnly_ = Switch(dict.lookup("oneInteractionOnly")); + oneInteractionOnly_ = dict.get<bool>("oneInteractionOnly"); if (oneInteractionOnly_) { diff --git a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/MultiInteraction/MultiInteraction.H b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/MultiInteraction/MultiInteraction.H index 1de14934c3772233d400e59e240cf67330f117c5..babd3e7b78b57e8f05130b29e9368e848a8f7da9 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/MultiInteraction/MultiInteraction.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/MultiInteraction/MultiInteraction.H @@ -94,7 +94,7 @@ class MultiInteraction { // Private data - Switch oneInteractionOnly_; + bool oneInteractionOnly_; //- Submodels PtrList<PatchInteractionModel<CloudType>> models_; diff --git a/src/lagrangian/molecularDynamics/molecule/mdTools/createAutoCorrelationFunctions.H b/src/lagrangian/molecularDynamics/molecule/mdTools/createAutoCorrelationFunctions.H index 55fbe14bbcec6974ffc056d9dca4cd9961779e36..60e3fa95e9bf23aab49dfb7800530471ece5b1e0 100644 --- a/src/lagrangian/molecularDynamics/molecule/mdTools/createAutoCorrelationFunctions.H +++ b/src/lagrangian/molecularDynamics/molecule/mdTools/createAutoCorrelationFunctions.H @@ -59,7 +59,7 @@ correlationFunction<vector> vacf molecules.size() ); -bool writeVacf(Switch(velocityACFDict.lookup("writeFile"))); +bool writeVacf(velocityACFDict.get<bool>("writeFile")); //- Pressure autocorrelation function @@ -77,7 +77,7 @@ correlationFunction<vector> pacf 1 ); -bool writePacf(Switch(pressureACFDict.lookup("writeFile"))); +bool writePacf(pressureACFDict.get<bool>("writeFile")); //- Heat flux autocorrelation function @@ -95,4 +95,4 @@ correlationFunction<vector> hfacf 1 ); -bool writeHFacf(Switch(heatFluxACFDict.lookup("writeFile"))); +bool writeHFacf(heatFluxACFDict.get<bool>("writeFile")); diff --git a/src/lagrangian/molecularDynamics/potential/pairPotential/basic/pairPotential.C b/src/lagrangian/molecularDynamics/potential/pairPotential/basic/pairPotential.C index 18724c978781b7e6e9cc07fa4657f6e0a3347492..988ef418fc9a17a45559f61c37250047b3c18a26 100644 --- a/src/lagrangian/molecularDynamics/potential/pairPotential/basic/pairPotential.C +++ b/src/lagrangian/molecularDynamics/potential/pairPotential/basic/pairPotential.C @@ -68,7 +68,7 @@ Foam::pairPotential::pairPotential forceLookup_(0), energyLookup_(0), esfPtr_(nullptr), - writeTables_(Switch(pairPotentialProperties_.lookup("writeTables"))) + writeTables_(pairPotentialProperties_.get<bool>("writeTables")) {} diff --git a/src/lagrangian/molecularDynamics/potential/pairPotential/basic/pairPotentialI.H b/src/lagrangian/molecularDynamics/potential/pairPotential/basic/pairPotentialI.H index 564249135938d6b51706e2686fdfa35695918cbd..8b27ee6d935da522abd4555218239593180514ee 100644 --- a/src/lagrangian/molecularDynamics/potential/pairPotential/basic/pairPotentialI.H +++ b/src/lagrangian/molecularDynamics/potential/pairPotential/basic/pairPotentialI.H @@ -54,4 +54,5 @@ inline bool Foam::pairPotential::writeTables() const return writeTables_; } + // ************************************************************************* // diff --git a/src/lagrangian/spray/submodels/StochasticCollision/ORourkeCollision/ORourkeCollision.C b/src/lagrangian/spray/submodels/StochasticCollision/ORourkeCollision/ORourkeCollision.C index 376953ba90f496a6b0415b321e8639709f76772e..558404cff1bd10b1c8acf8a76e49676beee78f74 100644 --- a/src/lagrangian/spray/submodels/StochasticCollision/ORourkeCollision/ORourkeCollision.C +++ b/src/lagrangian/spray/submodels/StochasticCollision/ORourkeCollision/ORourkeCollision.C @@ -301,7 +301,10 @@ Foam::ORourkeCollision<CloudType>::ORourkeCollision ( owner.db().template lookupObject<SLGThermo>("SLGThermo").liquids() ), - coalescence_(this->coeffDict().lookup("coalescence")) + coalescence_ + ( + this->coeffDict().template get<bool>("coalescence") + ) {} diff --git a/src/lagrangian/spray/submodels/StochasticCollision/ORourkeCollision/ORourkeCollision.H b/src/lagrangian/spray/submodels/StochasticCollision/ORourkeCollision/ORourkeCollision.H index 7972ac83e66957bb1a4c6fa37226166a14b3da27..17bfb757e98961caa269ee7138be4a35f29eead3 100644 --- a/src/lagrangian/spray/submodels/StochasticCollision/ORourkeCollision/ORourkeCollision.H +++ b/src/lagrangian/spray/submodels/StochasticCollision/ORourkeCollision/ORourkeCollision.H @@ -58,8 +58,8 @@ protected: const liquidMixtureProperties& liquids_; - //- Coalescence activation switch - Switch coalescence_; + //- Coalescence activated? + bool coalescence_; // Protected Member Functions diff --git a/src/mesh/extrudeModel/offsetSurface/offsetSurface.H b/src/mesh/extrudeModel/offsetSurface/offsetSurface.H index f5df55cfd8d6859a89b7ff9abdf14489dcab7966..96d7db926184db0cf6e81ed67b00ca29b0ee4615 100644 --- a/src/mesh/extrudeModel/offsetSurface/offsetSurface.H +++ b/src/mesh/extrudeModel/offsetSurface/offsetSurface.H @@ -36,7 +36,6 @@ Description #include "point.H" #include "extrudeModel.H" -#include "Switch.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -73,7 +72,7 @@ class offsetSurface autoPtr<triSurfaceSearch> offsetSearchPtr_; // Whether to re-project onto offsetted surface - const Switch project_; + const bool project_; public: diff --git a/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.C b/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.C index 2bf1272938db8b1fd5977ca5a1b32fa5250de4bc..cb31a5c87882973e70a285ee8aaa7e96022d9eff 100644 --- a/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.C +++ b/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.C @@ -2754,9 +2754,9 @@ const label nMasterFaces = 0; forAll(isMasterFace, i) { - if (isMasterFace[i]) + if (isMasterFace.test(i)) { - nMasterFaces++; + ++nMasterFaces; } } @@ -2764,9 +2764,9 @@ const label nMasterPoints = 0; forAll(isMeshMasterPoint, i) { - if (isMeshMasterPoint[i]) + if (isMeshMasterPoint.test(i)) { - nMasterPoints++; + ++nMasterPoints; } } diff --git a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBaffles.C b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBaffles.C index 34ae55b76e2cef086647935208568fac9e540be3..03279701c4c4f81174b40280a2c81398257a6cb6 100644 --- a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBaffles.C +++ b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementBaffles.C @@ -2333,20 +2333,20 @@ void Foam::meshRefinement::getIntersections ) { namedSurfaceIndex[faceI] = surface2[i]; - posOrientation[faceI] = ((area&normal2[i]) > 0); + posOrientation.set(faceI, ((area&normal2[i]) > 0)); nSurfFaces[surface2[i]]++; } else { namedSurfaceIndex[faceI] = surface1[i]; - posOrientation[faceI] = ((area&normal1[i]) > 0); + posOrientation.set(faceI, ((area&normal1[i]) > 0)); nSurfFaces[surface1[i]]++; } } else if (surface2[i] != -1) { namedSurfaceIndex[faceI] = surface2[i]; - posOrientation[faceI] = ((area&normal2[i]) > 0); + posOrientation.set(faceI, ((area&normal2[i]) > 0)); nSurfFaces[surface2[i]]++; } } diff --git a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementProblemCells.C b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementProblemCells.C index 9a6fe089dfa611a29d4a7a14179a3d1aaa2ab141..714aad7bc93f768f8eb51bab853c37c278bc05ab 100644 --- a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementProblemCells.C +++ b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementProblemCells.C @@ -1025,9 +1025,9 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCells else { facePatch[facei] = nearestAdaptPatch[facei]; - if (isMasterFace[facei]) + if (isMasterFace.test(facei)) { - nBaffleFaces++; + ++nBaffleFaces; } // Do NOT update boundary data since this would grow diff --git a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementRefine.C b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementRefine.C index 9954987315aa98aa3bab3b1563f3dc2b825e0c78..7643ab1822c93e07b363927b6698c29fb400339f 100644 --- a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementRefine.C +++ b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementRefine.C @@ -261,7 +261,7 @@ Foam::labelList Foam::meshRefinement::getChangedFaces forAll(changedFace, faceI) { - if (changedFace[faceI] && isMasterFace[faceI]) + if (changedFace[faceI] && isMasterFace.test(faceI)) { nMasterChanged++; } diff --git a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyLayerDriver.C b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyLayerDriver.C index 989426026588dd1aba2854a332971481d86ff091..e109e96d304e5e92b9e4302c1f5984e4272b9b45 100644 --- a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyLayerDriver.C +++ b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyLayerDriver.C @@ -634,7 +634,7 @@ void Foam::snappyLayerDriver::handleNonManifolds ( pp.edgeFaces()[edgei].size() == 1 && edgeGlobalFaces[edgei].size() == 1 - && isCoupledEdge[meshEdgei] + && isCoupledEdge.test(meshEdgei) ) { // Edge of patch but no continuation across processor. @@ -4336,7 +4336,7 @@ void Foam::snappyLayerDriver::addLayers ) { label oldFacei = map.faceMap()[facei]; - if (oldFacei != -1 && oldBaffleFace[oldFacei]) + if (oldFacei != -1 && oldBaffleFace.test(oldFacei)) { const face& f = mesh.faces()[facei]; forAll(f, fp) @@ -4680,7 +4680,7 @@ void Foam::snappyLayerDriver::doLayers facei++ ) { - if (intOrCoupled[facei] && isExtrudedZoneFace[facei]) + if (intOrCoupled[facei] && isExtrudedZoneFace.test(facei)) { faceZoneOnCoupledFace = true; break; diff --git a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyRefineDriver.C b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyRefineDriver.C index 3eeeae6b432de242e41c9f713ca1ab5920945bb5..7a20491291c028152c9cd7002df4f3abe04897ee 100644 --- a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyRefineDriver.C +++ b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyRefineDriver.C @@ -46,22 +46,19 @@ License namespace Foam { - -defineTypeNameAndDebug(snappyRefineDriver, 0); - + defineTypeNameAndDebug(snappyRefineDriver, 0); } // End namespace Foam // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct from components Foam::snappyRefineDriver::snappyRefineDriver ( meshRefinement& meshRefiner, decompositionMethod& decomposer, fvMeshDistribute& distributor, - const labelList& globalToMasterPatch, - const labelList& globalToSlavePatch + const labelUList& globalToMasterPatch, + const labelUList& globalToSlavePatch ) : meshRefiner_(meshRefiner), @@ -1629,8 +1626,7 @@ Foam::label Foam::snappyRefineDriver::directionalShellRefine List<labelVector> dirCellLevel(cellLevel.size()); forAll(cellLevel, celli) { - label l = cellLevel[celli]; - dirCellLevel[celli] = labelVector(l, l, l); + dirCellLevel[celli] = labelVector::uniform(cellLevel[celli]); } label iter; diff --git a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyRefineDriver.H b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyRefineDriver.H index 3e86f08b6492d72d33820a4d1791a7753c745c71..63d721509c39454a9493cb5dd90c0304a276f4e0 100644 --- a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyRefineDriver.H +++ b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyRefineDriver.H @@ -36,15 +36,13 @@ SourceFiles #include "wordPairHashTable.H" #include "labelList.H" -#include "PackedBoolList.H" -#include "labelVector.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { -// Forward declaration of classes +// Forward declarations class refinementParameters; class snapParameters; @@ -206,8 +204,8 @@ public: meshRefinement& meshRefiner, decompositionMethod& decomposer, fvMeshDistribute& distributor, - const labelList& globalToMasterPatch, - const labelList& globalToSlavePatch + const labelUList& globalToMasterPatch, + const labelUList& globalToSlavePatch ); diff --git a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriver.C b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriver.C index c7a165672a948ce8fab64d8ec16cf144569b3973..e25b4185fa67c570635c3bfb157e2ef8f46353af 100644 --- a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriver.C +++ b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriver.C @@ -183,7 +183,7 @@ Foam::tmp<Foam::pointField> Foam::snappySnapDriver::smoothInternalDisplacement label ownLevel = cellLevel[mesh.faceOwner()[facei]]; label neiLevel = cellLevel[mesh.faceNeighbour()[facei]]; - if (!isFront[facei] && ownLevel != neiLevel) + if (!isFront.test(facei) && ownLevel != neiLevel) { const face& f = mesh.faces()[facei]; isMovingPoint.set(f); @@ -200,7 +200,7 @@ Foam::tmp<Foam::pointField> Foam::snappySnapDriver::smoothInternalDisplacement label ownLevel = cellLevel[mesh.faceOwner()[facei]]; label neiLevel = neiCellLevel[facei-mesh.nInternalFaces()]; - if (!isFront[facei] && ownLevel != neiLevel) + if (!isFront.test(facei) && ownLevel != neiLevel) { const face& f = mesh.faces()[facei]; isMovingPoint.set(f); @@ -239,7 +239,7 @@ Foam::tmp<Foam::pointField> Foam::snappySnapDriver::smoothInternalDisplacement forAll(isMovingPoint, pointi) { - if (isMovingPoint[pointi]) + if (isMovingPoint.test(pointi)) { const labelList& pCells = mesh.pointCells(pointi); diff --git a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriverFeature.C b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriverFeature.C index b4c2dc996a521e66e490865723ab12a3afb8b33a..e7f391fdc4ede11800565a824c1f0ef3f0b96959 100644 --- a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriverFeature.C +++ b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriverFeature.C @@ -271,7 +271,7 @@ void Foam::snappySnapDriver::calcNearestFace << exit(FatalError); } const faceZone& fZone = mesh.faceZones()[zonei]; - bitSet isZonedFace(mesh.nFaces(), fZone); + const bitSet isZonedFace(mesh.nFaces(), fZone); DynamicList<label> ppFaces(fZone.size()); DynamicList<label> meshFaces(fZone.size()); @@ -451,7 +451,7 @@ void Foam::snappySnapDriver::calcNearestFacePointProperties List<List<point>>& pointFaceSurfNormals, List<List<point>>& pointFaceDisp, List<List<point>>& pointFaceCentres, - List<labelList>& pointFacePatchID + List<labelList>& pointFacePatchID ) const { const fvMesh& mesh = meshRefiner_.mesh(); @@ -603,7 +603,7 @@ void Foam::snappySnapDriver::calcNearestFacePointProperties { label pointi = meshToPatchPoint[f[fp]]; - if (pointi != -1 && isBoundaryPoint[pointi]) + if (pointi != -1 && isBoundaryPoint.test(pointi)) { List<point>& pNormals = pointFaceSurfNormals[pointi]; List<point>& pDisp = pointFaceDisp[pointi]; @@ -1440,13 +1440,13 @@ void Foam::snappySnapDriver::releasePointsNextToMultiPatch pointFacePatchID[pointi], pointFaceCentres[pointi] ); - isMultiPatchPoint[pointi] = multiPatchPt.hit(); + isMultiPatchPoint.set(pointi, multiPatchPt.hit()); } // 2. Make sure multi-patch points are also attracted forAll(isMultiPatchPoint, pointi) { - if (isMultiPatchPoint[pointi]) + if (isMultiPatchPoint.test(pointi)) { if ( @@ -1484,11 +1484,11 @@ void Foam::snappySnapDriver::releasePointsNextToMultiPatch label pointi = f[fp]; if ( - isMultiPatchPoint[pointi] + isMultiPatchPoint.test(pointi) && patchConstraints[pointi].first() > 1 ) { - nMultiPatchPoints++; + ++nMultiPatchPoints; } } @@ -1499,7 +1499,7 @@ void Foam::snappySnapDriver::releasePointsNextToMultiPatch label pointi = f[fp]; if ( - !isMultiPatchPoint[pointi] + !isMultiPatchPoint.test(pointi) && patchConstraints[pointi].first() > 1 ) { @@ -2870,7 +2870,7 @@ void Foam::snappySnapDriver::determineBaffleFeatures if (efn.size() == 2 && (efn[0]&efn[1]) < baffleFeatureCos) { isBaffleEdge.set(edgei); - nBaffleEdges++; + ++nBaffleEdges; const edge& e = pp.edges()[edgei]; pointStatus[e[0]] = 0; pointStatus[e[1]] = 0; diff --git a/src/mesh/snappyHexMesh/trackedParticle/trackedParticle.H b/src/mesh/snappyHexMesh/trackedParticle/trackedParticle.H index 2a30d95915695df7e0a3ea9137d9c3ca6223c93a..59db354d5f65936f5d53458fce4666988e0f3668 100644 --- a/src/mesh/snappyHexMesh/trackedParticle/trackedParticle.H +++ b/src/mesh/snappyHexMesh/trackedParticle/trackedParticle.H @@ -36,6 +36,7 @@ SourceFiles #ifndef trackedParticle_H #define trackedParticle_H +#include "bitSet.H" #include "particle.H" #include "autoPtr.H" @@ -44,11 +45,9 @@ SourceFiles namespace Foam { -class trackedParticleCloud; - - -// Forward declaration of friend functions and operators +// Forward declarations +class trackedParticleCloud; class trackedParticle; Ostream& operator<<(Ostream&, const trackedParticle&); diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C index 48bc0230f796c0fff70cfbab5da89dea49e6d529..c521cc49ce51b1ff2d8d090ea1a886ee9cef58fd 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C @@ -265,10 +265,10 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::normaliseWeights { Info<< indent << "AMI: Patch " << patchName - << " sum(weights) min/max/average = " - << gMin(wghtSum) << ", " - << gMax(wghtSum) << ", " - << gAverage(wghtSum) << endl; + << " sum(weights)" + << " min = " << gMin(wghtSum) + << " max = " << gMax(wghtSum) + << " average = " << gAverage(wghtSum) << nl; const label nLow = returnReduce(nLowWeight, sumOp<label>()); diff --git a/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatch.C b/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatch.C index 4fbd6e39c9441dd84306cf3f2974bb75d34887eb..242f83097f8a580475a4145d75175cddc798ae06 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatch.C +++ b/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatch.C @@ -98,7 +98,7 @@ void Foam::cyclicACMIPolyPatch::resetAMI const_cast<AMIPatchToPatchInterpolation&>(this->AMI()); // Output some stats. AMIInterpolation will have already output the - // average weights ("sum(weights) min/max/average = 1, 1, 1") + // average weights ("sum(weights) min = 1 max = 1 average = 1") { const scalarField& wghtsSum = AMI.srcWeightsSum(); diff --git a/src/meshTools/AMIInterpolation/patches/cyclicPeriodicAMI/cyclicPeriodicAMIPolyPatch/cyclicPeriodicAMIPolyPatch.C b/src/meshTools/AMIInterpolation/patches/cyclicPeriodicAMI/cyclicPeriodicAMIPolyPatch/cyclicPeriodicAMIPolyPatch.C index 6e4206e650ccae852e0faf8e2858cc4067da3d6f..032315e09fbfe7bffe0f254f90c4700ee9ecc447 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicPeriodicAMI/cyclicPeriodicAMIPolyPatch/cyclicPeriodicAMIPolyPatch.C +++ b/src/meshTools/AMIInterpolation/patches/cyclicPeriodicAMI/cyclicPeriodicAMIPolyPatch/cyclicPeriodicAMIPolyPatch.C @@ -547,12 +547,12 @@ void Foam::cyclicPeriodicAMIPolyPatch::resetAMI if (nFace) { - scalarField srcWghtSum(size(), 0); + scalarField srcWghtSum(size(), Zero); forAll(srcWghtSum, faceI) { srcWghtSum[faceI] = sum(AMIPtr_->srcWeights()[faceI]); } - scalarField tgtWghtSum(neighbPatch().size(), 0); + scalarField tgtWghtSum(neighbPatch().size(), Zero); forAll(tgtWghtSum, faceI) { tgtWghtSum[faceI] = sum(AMIPtr_->tgtWeights()[faceI]); @@ -560,16 +560,16 @@ void Foam::cyclicPeriodicAMIPolyPatch::resetAMI Info<< indent << "AMI: Patch " << name() - << " sum(weights) min/max/average = " - << gMin(srcWghtSum) << ", " - << gMax(srcWghtSum) << ", " - << gAverage(srcWghtSum) << endl; + << " sum(weights)" + << " min = " << gMin(srcWghtSum) + << " max = " << gMax(srcWghtSum) + << " average = " << gAverage(srcWghtSum) << nl; Info<< indent << "AMI: Patch " << neighbPatch().name() - << " sum(weights) min/max/average = " - << gMin(tgtWghtSum) << ", " - << gMax(tgtWghtSum) << ", " - << gAverage(tgtWghtSum) << endl; + << " sum(weights)" + << " min = " << gMin(tgtWghtSum) + << " max = " << gMax(tgtWghtSum) + << " average = " << gAverage(tgtWghtSum) << nl; } } } diff --git a/src/parallel/decompose/ptscotchDecomp/Make/options b/src/parallel/decompose/ptscotchDecomp/Make/options index 733441c3fc7c175eee31ea441da4c30a58b8dc3e..4d8690985afd93ff5e234354d28e59e23f225f2f 100644 --- a/src/parallel/decompose/ptscotchDecomp/Make/options +++ b/src/parallel/decompose/ptscotchDecomp/Make/options @@ -16,4 +16,9 @@ LIB_LIBS = \ -L$(FOAM_EXT_LIBBIN) \ -L$(FOAM_EXT_LIBBIN)/$(FOAM_MPI) \ -lptscotch -lptscotcherrexit \ - -lscotch -lrt + -lscotch + +/* May require librt, but scotch does not declare the dependency */ +ifeq ("$(SO)","so") + LIB_LIBS += -lrt +endif diff --git a/src/parallel/decompose/scotchDecomp/Make/options b/src/parallel/decompose/scotchDecomp/Make/options index d2165b174daf7024a31d66867f544a48c774543b..6846910c047d5b99af377adbe16d1cd9289a3994 100644 --- a/src/parallel/decompose/scotchDecomp/Make/options +++ b/src/parallel/decompose/scotchDecomp/Make/options @@ -12,4 +12,9 @@ EXE_INC = \ LIB_LIBS = \ -L$(SCOTCH_LIB_DIR) \ - -lscotch -lscotcherrexit -lrt + -lscotch -lscotcherrexit + +/* May require librt, but scotch does not declare the dependency */ +ifeq ("$(SO)","so") + LIB_LIBS += -lrt +endif diff --git a/src/randomProcesses/turbulence/turbGen.C b/src/randomProcesses/turbulence/turbGen.C index b942ee49b6de741cfc4162be196af82fa9fdcbb1..9d1a74b6494c2016407be049a0c6acbbd9b6a16c 100644 --- a/src/randomProcesses/turbulence/turbGen.C +++ b/src/randomProcesses/turbulence/turbGen.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -60,6 +60,13 @@ Foam::vectorField Foam::turbGen::U() s = Ek(Ea, k0, mag(K))*s; + label ntot = 1; + forAll(K.nn(), idim) + { + ntot *= K.nn()[idim]; + } + const scalar recRootN = 1.0/sqrt(scalar(ntot)); + complexVectorField up ( fft::reverseTransform @@ -67,7 +74,7 @@ Foam::vectorField Foam::turbGen::U() ComplexField(cos(constant::mathematical::twoPi*rndPhases)*s, sin(constant::mathematical::twoPi*rndPhases)*s), K.nn() - ) + )*recRootN ); return ReImSum(up); diff --git a/src/regionModels/regionModel/regionModel/regionModel.C b/src/regionModels/regionModel/regionModel/regionModel.C index d4bda62d8b29d7f297456c6b0fd94d4f0d72bab1..c2abb3cd236b276336d752491ccf7d17544165cf 100644 --- a/src/regionModels/regionModel/regionModel/regionModel.C +++ b/src/regionModels/regionModel/regionModel/regionModel.C @@ -398,7 +398,7 @@ Foam::regionModels::regionModel::regionModel ), primaryMesh_(mesh), time_(mesh.time()), - active_(lookup("active")), + active_(get<Switch>("active")), infoOutput_(true), modelName_(modelName), regionMeshPtr_(nullptr), @@ -446,7 +446,7 @@ Foam::regionModels::regionModel::regionModel ), primaryMesh_(mesh), time_(mesh.time()), - active_(dict.lookup("active")), + active_(dict.get<Switch>("active")), infoOutput_(false), modelName_(modelName), regionMeshPtr_(nullptr), diff --git a/src/renumber/renumberMethods/structuredRenumber/structuredRenumber.C b/src/renumber/renumberMethods/structuredRenumber/structuredRenumber.C index 030ba6dffcec215bb40c98cdebf068329d821a75..a113e3cb9cd872a60fb7db4670d0e8c1d428fe1f 100644 --- a/src/renumber/renumberMethods/structuredRenumber/structuredRenumber.C +++ b/src/renumber/renumberMethods/structuredRenumber/structuredRenumber.C @@ -55,8 +55,8 @@ Foam::structuredRenumber::structuredRenumber methodDict_(renumberDict.optionalSubDict(typeName + "Coeffs")), patches_(methodDict_.lookup("patches")), nLayers_(methodDict_.lookupOrDefault<label>("nLayers", labelMax)), - depthFirst_(methodDict_.lookup("depthFirst")), - reverse_(methodDict_.lookup("reverse")), + depthFirst_(methodDict_.get<bool>("depthFirst")), + reverse_(methodDict_.get<bool>("reverse")), method_(renumberMethod::New(methodDict_)) {} diff --git a/src/renumber/renumberMethods/structuredRenumber/structuredRenumber.H b/src/renumber/renumberMethods/structuredRenumber/structuredRenumber.H index 65ad63fe198179f779d877ba266db6270fac1a2b..b4669aaa1c7d4519978bf948c74075fdbd8550db 100644 --- a/src/renumber/renumberMethods/structuredRenumber/structuredRenumber.H +++ b/src/renumber/renumberMethods/structuredRenumber/structuredRenumber.H @@ -42,7 +42,6 @@ SourceFiles #include "renumberMethod.H" #include "topoDistanceData.H" -#include "Switch.H" namespace Foam { @@ -63,7 +62,7 @@ public: // column and layer class layerLess { - const Switch depthFirst_; + const bool depthFirst_; const labelList& order_; const List<topoDistanceData>& distance_; @@ -71,7 +70,7 @@ public: layerLess ( - const Switch depthFirst, + const bool depthFirst, const labelList& order, const List<topoDistanceData>& distance ) @@ -93,9 +92,9 @@ public: const label nLayers_; - const Switch depthFirst_; + const bool depthFirst_; - const Switch reverse_; + const bool reverse_; const autoPtr<renumberMethod> method_; diff --git a/src/sampling/sampledSurface/distanceSurface/sampledDistanceSurface.H b/src/sampling/sampledSurface/distanceSurface/sampledDistanceSurface.H index 783707e8d05848231c497c45f57f6cbfebc27bf2..5202bb8673eb76a302d112e0e1e4179060408ae5 100644 --- a/src/sampling/sampledSurface/distanceSurface/sampledDistanceSurface.H +++ b/src/sampling/sampledSurface/distanceSurface/sampledDistanceSurface.H @@ -85,7 +85,7 @@ class sampledDistanceSurface // Private data //- Whether to recalculate cell values as average of point values - const Switch average_; + const bool average_; //- Track if the surface needs an update mutable bool needsUpdate_; diff --git a/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.H b/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.H index 3c83c5c5bb85d1eea2a451b7a70804a849938b56..9ecc52b9cc9ed2dbfb4ac4897d63c9c126cfd7ef 100644 --- a/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.H +++ b/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.H @@ -98,11 +98,11 @@ class sampledIsoSurface //- Merge tolerance const scalar mergeTol_; - //- Whether to coarse - const Switch regularise_; + //- Whether to coarsen + const bool regularise_; //- Whether to recalculate cell values as average of point values - const Switch average_; + const bool average_; //- Zone name/index (if restricted to zones) mutable cellZoneID zoneID_; diff --git a/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceCell.H b/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceCell.H index 86188f264ad117f20da834c1645edbc0c07e3caf..a197649e5dc3103a7b52705036f87749cf1bd573 100644 --- a/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceCell.H +++ b/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceCell.H @@ -97,10 +97,10 @@ class sampledIsoSurfaceCell const boundBox bounds_; //- Whether to coarse - const Switch regularise_; + const bool regularise_; //- Whether to recalculate cell values as average of point values - const Switch average_; + const bool average_; //- If restricted to zones, name of this zone or a regular expression keyType zoneKey_; diff --git a/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.H b/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.H index 915ee45b5c4bc501d4f94b348cb8ecfd481e93c9..3f67de6f5eea3ae98772533a98deb0dac8ac69d3 100644 --- a/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.H +++ b/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.H @@ -102,10 +102,10 @@ class sampledCuttingPlane const scalar mergeTol_; //- Whether to coarsen - const Switch regularise_; + const bool regularise_; //- Whether to recalculate cell values as average of point values - const Switch average_; + const bool average_; //- Zone name/index (if restricted to zones) mutable cellZoneID zoneID_; diff --git a/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMeshTemplates.C b/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMeshTemplates.C index 48bd03308e725c436bf0104a24bc5eccbf02b858..b4f83b373621b5448206ab761b8491d364b713c8 100644 --- a/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMeshTemplates.C +++ b/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMeshTemplates.C @@ -58,14 +58,14 @@ Foam::sampledTriSurfaceMesh::sampleOnFaces auto& values = tvalues.ref(); const polyBoundaryMesh& pbm = mesh().boundaryMesh(); - + const label nBnd = mesh().nFaces()-mesh().nInternalFaces(); // Create flat boundary field - const label nBnd = mesh().nFaces()-mesh().nInternalFaces(); Field<Type> bVals(nBnd, Zero); const auto& bField = sampler.psi().boundaryField(); + forAll(bField, patchi) { const label bFacei = (pbm[patchi].start() - mesh().nInternalFaces()); diff --git a/src/sampling/surfMeshSample/triSurfaceMesh/surfMeshSampleDiscrete.C b/src/sampling/surfMeshSample/triSurfaceMesh/surfMeshSampleDiscrete.C index 2e02fa1982d287cce2473cdd9cc772f3d475434a..dce44e0e63c5ec1b473edd66492b3bfa335d211c 100644 --- a/src/sampling/surfMeshSample/triSurfaceMesh/surfMeshSampleDiscrete.C +++ b/src/sampling/surfMeshSample/triSurfaceMesh/surfMeshSampleDiscrete.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-2018 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/sampling/surfMeshSample/triSurfaceMesh/surfMeshSampleDiscrete.H b/src/sampling/surfMeshSample/triSurfaceMesh/surfMeshSampleDiscrete.H index 4dd47e2c8922d2a25321c8190ecfb3ef5400ed91..c7a9b90b9dd1df344594a798743a9218534b84ea 100644 --- a/src/sampling/surfMeshSample/triSurfaceMesh/surfMeshSampleDiscrete.H +++ b/src/sampling/surfMeshSample/triSurfaceMesh/surfMeshSampleDiscrete.H @@ -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-2018 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -91,6 +91,13 @@ class surfMeshSampleDiscrete //- Transfer mesh content from SurfaceSource to surfMesh void transferContent(); + //- Sample field (from volume field) onto surface faces + template<class Type> + tmp<Field<Type>> sampleOnFaces + ( + const interpolation<Type>& sampler + ) const; + //- Sample field on surface. template<class Type> bool sampleType diff --git a/src/sampling/surfMeshSample/triSurfaceMesh/surfMeshSampleDiscreteTemplates.C b/src/sampling/surfMeshSample/triSurfaceMesh/surfMeshSampleDiscreteTemplates.C index 4d56412539d5a676b0ed9ee993c0b80e87f53d94..78cf386c52147f43a567a4960f4d91f6254d3fb5 100644 --- a/src/sampling/surfMeshSample/triSurfaceMesh/surfMeshSampleDiscreteTemplates.C +++ b/src/sampling/surfMeshSample/triSurfaceMesh/surfMeshSampleDiscreteTemplates.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-2018 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -24,11 +24,32 @@ License \*---------------------------------------------------------------------------*/ #include "surfMeshSampleDiscrete.H" -#include "dimensionedType.H" -#include "error.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // +template<class Type> +Foam::tmp<Foam::Field<Type>> +Foam::surfMeshSampleDiscrete::sampleOnFaces +( + const interpolation<Type>& sampler +) const +{ + if (onBoundary()) + { + return SurfaceSource::sampleOnFaces(sampler); + } + + // Sample cells + return surfMeshSample::sampleOnFaces + ( + sampler, + sampleElements(), //< sampleElements == meshCells + surface().faces(), + surface().points() + ); +} + + template<class Type> bool Foam::surfMeshSampleDiscrete::sampleType ( @@ -38,7 +59,7 @@ bool Foam::surfMeshSampleDiscrete::sampleType { typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType; - const auto volFldPtr = + const auto* volFldPtr = SurfaceSource::mesh().lookupObjectPtr<VolFieldType>(fieldName); if (!volFldPtr) @@ -48,52 +69,11 @@ bool Foam::surfMeshSampleDiscrete::sampleType auto samplerPtr = interpolation<Type>::New(sampleScheme, *volFldPtr); - getOrCreateSurfField<Type>(*volFldPtr).field() - = SurfaceSource::sampleOnFaces(*samplerPtr); + getOrCreateSurfField<Type>(*volFldPtr).field() = + sampleOnFaces(*samplerPtr); return true; } -// template<class Type> -// Foam::tmp<Foam::DimensionedField<Type, Foam::surfGeoMesh>> -// Foam::surfMeshSampleDiscrete::sampleOnFaces -// ( -// const GeometricField<Type, fvPatchField, volMesh>& fld -// ) const -// { -// typedef DimensionedField<Type, surfGeoMesh> SurfFieldType; -// -// tmp<Field<Type>> tfield = SurfaceSource::sampleOnFaces(fld); -// SurfFieldType& result = getOrCreateSurfField<Type>(fld); -// -// // need to verify if this will be needed (in the future) -// const surfMesh& s = surface(); -// if (result.size() != s.size()) -// { -// // maybe resampling changed the surfMesh, -// // but the existing surfField wasn't updated -// -// result.resize(s.size(), Zero); -// } -// -// if (result.size() != sampleElements().size()) -// { -// FatalErrorInFunction -// << "mismatch in field/mesh sizes " -// << result.name() << nl -// << " field has " << result.size() -// << " but sampleElements has " << sampleElements().size() << nl -// << endl -// << exit(FatalError); -// -// Info<< "WARNING: " -// << endl; -// } -// -// result = tfield; -// return result; -// } - - // ************************************************************************* // diff --git a/src/sampling/surface/distanceSurface/distanceSurface.C b/src/sampling/surface/distanceSurface/distanceSurface.C index 90e934b72809371aa0ed59fac7db42f9d7ac9f71..c6960bb81af850e3cd31469418dac71d0a8b21c5 100644 --- a/src/sampling/surface/distanceSurface/distanceSurface.C +++ b/src/sampling/surface/distanceSurface/distanceSurface.C @@ -66,7 +66,7 @@ Foam::distanceSurface::distanceSurface ) ), distance_(readScalar(dict.lookup("distance"))), - signed_(readBool(dict.lookup("signed"))), + signed_(dict.get<bool>("signed")), cell_(dict.lookupOrDefault("cell", true)), regularise_(dict.lookupOrDefault("regularise", true)), bounds_(dict.lookupOrDefault("bounds", boundBox::invertedBox)), @@ -85,7 +85,7 @@ Foam::distanceSurface::distanceSurface const scalar distance, const bool signedDistance, const bool cell, - const Switch regularise, + const bool regularise, const boundBox& bounds ) : diff --git a/src/sampling/surface/distanceSurface/distanceSurface.H b/src/sampling/surface/distanceSurface/distanceSurface.H index 8db021340416a23944e3d37f785a67237b8f1e63..c20166e6dd6119f57d9f73183567625ae2dddd18 100644 --- a/src/sampling/surface/distanceSurface/distanceSurface.H +++ b/src/sampling/surface/distanceSurface/distanceSurface.H @@ -84,7 +84,7 @@ class distanceSurface const bool cell_; //- Whether to coarsen - const Switch regularise_; + const bool regularise_; //- Optional bounding box to trim triangles against const boundBox bounds_; @@ -131,7 +131,7 @@ public: const scalar distance, const bool signedDistance, const bool cell, - const Switch regularise, + const bool regularise, const boundBox& bounds = boundBox::invertedBox ); diff --git a/src/sampling/surface/isoSurface/isoSurface.H b/src/sampling/surface/isoSurface/isoSurface.H index f2da5f6abd0489f5aaf6801d5d72d2fe2a1e4261..1fd72e6550cdb4dc8d6b1a3bf000d2f45339a87f 100644 --- a/src/sampling/surface/isoSurface/isoSurface.H +++ b/src/sampling/surface/isoSurface/isoSurface.H @@ -122,7 +122,7 @@ class isoSurface const scalar iso_; //- Regularise? - const Switch regularise_; + const bool regularise_; //- Optional bounds const boundBox bounds_; diff --git a/src/sampling/surface/triSurfaceMesh/discreteSurface.C b/src/sampling/surface/triSurfaceMesh/discreteSurface.C index ad7ea4313199ad84d8ac295defa2c061818e4aa3..2c67b787c4b23f4b3d3778526df7c9559b58556d 100644 --- a/src/sampling/surface/triSurfaceMesh/discreteSurface.C +++ b/src/sampling/surface/triSurfaceMesh/discreteSurface.C @@ -744,6 +744,7 @@ bool Foam::discreteSurface::interpolate() const return interpolate_; } + bool Foam::discreteSurface::interpolate(bool b) { if (interpolate_ == b) diff --git a/src/sampling/surface/triSurfaceMesh/discreteSurfaceTemplates.C b/src/sampling/surface/triSurfaceMesh/discreteSurfaceTemplates.C index a1a7b8a2c9a13805eb7e0047f63e44c22371e4d3..74256346f42d0a65645a07f77f5553649d9c7d93 100644 --- a/src/sampling/surface/triSurfaceMesh/discreteSurfaceTemplates.C +++ b/src/sampling/surface/triSurfaceMesh/discreteSurfaceTemplates.C @@ -175,24 +175,26 @@ Foam::discreteSurface::sampleOnFaces Field<Type> bVals(nBnd, Zero); - forAll(vField.boundaryField(), patchi) + const auto& bField = vField.boundaryField(); + + forAll(bField, patchi) { - label bFacei = pbm[patchi].start() - mesh().nInternalFaces(); + const label bFacei = pbm[patchi].start() - mesh().nInternalFaces(); SubList<Type> ( bVals, - vField.boundaryField()[patchi].size(), + bField[patchi].size(), bFacei - ) = vField.boundaryField()[patchi]; + ) = bField[patchi]; } // Sample in flat boundary field for (label i=0; i < len; ++i) { - label facei = elements[i]; - values[i] = bVals[facei-mesh().nInternalFaces()]; + const label bFacei = (elements[i] - mesh().nInternalFaces()); + values[i] = bVals[bFacei]; } } @@ -230,7 +232,7 @@ Foam::discreteSurface::sampleOnPoints forAll(samplePoints_, pointi) { - label facei = sampleElements_[pointi]; + const label facei = sampleElements_[pointi]; values[pointi] = interpolator.interpolate ( diff --git a/src/surfMesh/surfaceFormats/vtk/VTKsurfaceFormat.C b/src/surfMesh/surfaceFormats/vtk/VTKsurfaceFormat.C index d2d398d58e5a445efaf993d04eb55908a6b65bf4..7e376b2f14181fa225b2ec462e7876c4a722c0bc 100644 --- a/src/surfMesh/surfaceFormats/vtk/VTKsurfaceFormat.C +++ b/src/surfMesh/surfaceFormats/vtk/VTKsurfaceFormat.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2016-2107 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. diff --git a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.H b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.H index fc550d30637dc09bced5b59ca1f61bbba132a9a6..1d4e19975596b33fe9b636a55b3832cec35dd6b2 100644 --- a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.H +++ b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.H @@ -42,7 +42,6 @@ SourceFiles #include "chemistryReader.H" #include "fileName.H" #include "typeInfo.H" -#include "Switch.H" #include "HashPtrTable.H" #include "ReactionList.H" #include "DynamicList.H" @@ -187,7 +186,7 @@ private: dictionary transportDict_; //- Flag to indicate that file is in new format - Switch newFormat_; + bool newFormat_; //- Tolerance for element imbalance in a reaction scalar imbalanceTol_; diff --git a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/liquidProperties/liquidProperties.C b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/liquidProperties/liquidProperties.C index aa14a2c91f8026fc001c48b292f7679f1e2ef15c..ef91f7c3c943c47b01b2ae3c855f63da1004eb1b 100644 --- a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/liquidProperties/liquidProperties.C +++ b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/liquidProperties/liquidProperties.C @@ -25,7 +25,6 @@ License #include "liquidProperties.H" #include "HashTable.H" -#include "Switch.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -121,38 +120,36 @@ Foam::autoPtr<Foam::liquidProperties> Foam::liquidProperties::New InfoInFunction << "Constructing liquidProperties" << endl; } - const word& liquidType = dict.dictName(); + const word liquidType(dict.dictName()); if (dict.found("defaultCoeffs")) { // Backward-compatibility - if (Switch(dict.lookup("defaultCoeffs"))) + if (dict.get<bool>("defaultCoeffs")) { return New(liquidType); } - else + + auto cstrIter = dictionaryConstructorTablePtr_->cfind(liquidType); + + if (!cstrIter.found()) { - auto cstrIter = dictionaryConstructorTablePtr_->cfind(liquidType); - - if (!cstrIter.found()) - { - FatalErrorInFunction - << "Unknown liquidProperties type " - << liquidType << nl << nl - << "Valid liquidProperties types :" << nl - << dictionaryConstructorTablePtr_->sortedToc() - << exit(FatalError); - } - - return autoPtr<liquidProperties> - ( - cstrIter() - ( - dict.optionalSubDict(liquidType + "Coeffs") - ) - ); + FatalErrorInFunction + << "Unknown liquidProperties type " + << liquidType << nl << nl + << "Valid liquidProperties types :" << nl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); } + + return autoPtr<liquidProperties> + ( + cstrIter() + ( + dict.optionalSubDict(liquidType + "Coeffs") + ) + ); } auto cstrIter = dictionaryConstructorTablePtr_->cfind(liquidType); diff --git a/src/thermophysicalModels/thermophysicalProperties/solidProperties/solidProperties/solidPropertiesNew.C b/src/thermophysicalModels/thermophysicalProperties/solidProperties/solidProperties/solidPropertiesNew.C index 6f25fc40e5502a3374c3e7357405ace72c85d263..8a320ebe4f4b3d17c0cdb76bf229eb5b0cc2ed52 100644 --- a/src/thermophysicalModels/thermophysicalProperties/solidProperties/solidProperties/solidPropertiesNew.C +++ b/src/thermophysicalModels/thermophysicalProperties/solidProperties/solidProperties/solidPropertiesNew.C @@ -70,7 +70,7 @@ Foam::autoPtr<Foam::solidProperties> Foam::solidProperties::New { // Backward-compatibility - if (Switch(dict.lookup("defaultCoeffs"))) + if (dict.get<bool>("defaultCoeffs")) { return New(solidType); } diff --git a/src/thermophysicalModels/thermophysicalPropertiesFvPatchFields/liquidProperties/humidityTemperatureCoupledMixed/humidityTemperatureCoupledMixedFvPatchScalarField.H b/src/thermophysicalModels/thermophysicalPropertiesFvPatchFields/liquidProperties/humidityTemperatureCoupledMixed/humidityTemperatureCoupledMixedFvPatchScalarField.H index 555d28b0489fbffcadc52ac6fdb405c7f3eefb82..a53d7f8b79af7292f1967e8bf1d286b97283bccf 100644 --- a/src/thermophysicalModels/thermophysicalPropertiesFvPatchFields/liquidProperties/humidityTemperatureCoupledMixed/humidityTemperatureCoupledMixedFvPatchScalarField.H +++ b/src/thermophysicalModels/thermophysicalPropertiesFvPatchFields/liquidProperties/humidityTemperatureCoupledMixed/humidityTemperatureCoupledMixedFvPatchScalarField.H @@ -32,7 +32,7 @@ Description This boundary condition can operate in four modes: - \c constantMass: thermal inertia only - - requires \c rho, \c thickness and \cp + - requires \c rho, \c thickness and \c p - \c condensation: condensation only - when the wall temperature (Tw) is below the dew temperature (Tdew) condesation takes place and the resulting condensed mass is stored @@ -60,21 +60,26 @@ Description The mass transfer correlation used is: - \f[ h_m = D_{ab} \frac{Sc}{L} \f] + \f[ h_m = D_{ab} \frac{Sh}{L} \f] where: \vartable D_{ab} | mass vapour difussivity L | characteristic length - Sc | Schmidt number + Sh | Sherwood number \endvartable - The Schmidt number is calculated using: + The Sherwood number is calculated using: \f{eqnarray*}{ 0.664 Re^\frac{1}{2} Sc^\frac{1}{3} & Re < 5.0E+05 \\ 0.037 Re^\frac{4}{5} Sc^\frac{1}{3} & Re > 5.0E+05 \f} + where: + \vartable + Re | Reynolds number + Sc | Schmidt number + \endvartable NOTE: - The correlation used to calculate Tdew is for water vapour. diff --git a/tutorials/lagrangian/reactingParcelFoam/hotBoxes/constant/reactingCloud1Properties b/tutorials/lagrangian/reactingParcelFoam/hotBoxes/constant/reactingCloud1Properties index 593d1c3cc3bbbc778a55a55c480b23d3765b4544..07dd23e0528ce90a2962396ee70adc12b5c87873 100644 --- a/tutorials/lagrangian/reactingParcelFoam/hotBoxes/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/reactingParcelFoam/hotBoxes/constant/reactingCloud1Properties @@ -85,9 +85,8 @@ subModels massTotal 10; parcelsPerInjector 20000; - parcelsPerSecond 500; parcelBasisType mass; - flowRateProfile constant 0.1; + flowRateProfile constant 1; Umag constant 3.0; thetaInner constant 0; thetaOuter constant 45; diff --git a/wmake/rules/darwin64Gcc/c b/wmake/rules/darwin64Gcc/c deleted file mode 100644 index 50539d091fd7584ae35f5f8e4ee8c6bb252eb67b..0000000000000000000000000000000000000000 --- a/wmake/rules/darwin64Gcc/c +++ /dev/null @@ -1,16 +0,0 @@ -SUFFIXES += .c - -cc = gcc -m64 -Ddarwin - -cWARN = -Wall - -include $(DEFAULT_RULES)/c$(WM_COMPILE_OPTION) - -cFLAGS = $(GFLAGS) $(cWARN) $(cOPT) $(cDBUG) $(LIB_HEADER_DIRS) -fPIC - -ctoo = $(WM_SCHEDULER) $(cc) $(cFLAGS) -c $< -o $@ - -LINK_LIBS = $(cDBUG) - -LINKLIBSO = $(cc) -Wl,-dylib,-undefined,dynamic_lookup -LINKEXE = $(cc) -Wl,-execute,-undefined,dynamic_lookup diff --git a/wmake/rules/darwin64Gcc/c++ b/wmake/rules/darwin64Gcc/c++ deleted file mode 100644 index 59d505f1afc563d0e23aff5339a23e31e7eae63f..0000000000000000000000000000000000000000 --- a/wmake/rules/darwin64Gcc/c++ +++ /dev/null @@ -1,17 +0,0 @@ -include $(GENERAL_RULES)/Gcc/c++ - -CC = g++ -std=c++11 -m64 -Ddarwin - -include $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION) - -c++FLAGS = $(GFLAGS) $(c++WARN) $(c++OPT) $(c++DBUG) $(ptFLAGS) $(LIB_HEADER_DIRS) -fPIC - -Ctoo = $(WM_SCHEDULER) $(CC) $(c++FLAGS) -c $< -o $@ -cxxtoo = $(Ctoo) -cctoo = $(Ctoo) -cpptoo = $(Ctoo) - -LINK_LIBS = $(c++DBUG) - -LINKLIBSO = $(CC) $(c++FLAGS) -Wl,-dylib,-undefined,dynamic_lookup -LINKEXE = $(CC) $(c++FLAGS) -Wl,-execute,-undefined,dynamic_lookup diff --git a/wmake/rules/darwin64Gcc/c++Debug b/wmake/rules/darwin64Gcc/c++Debug deleted file mode 100644 index 08680a0e4aa011a94ce3318e5c869f3db9de286d..0000000000000000000000000000000000000000 --- a/wmake/rules/darwin64Gcc/c++Debug +++ /dev/null @@ -1,2 +0,0 @@ -c++DBUG = -ggdb3 -DFULLDEBUG -c++OPT = -O0 -fdefault-inline diff --git a/wmake/rules/darwin64Gcc/c++Opt b/wmake/rules/darwin64Gcc/c++Opt deleted file mode 100644 index 599e6aba611dab95225e37204a5763288c546893..0000000000000000000000000000000000000000 --- a/wmake/rules/darwin64Gcc/c++Opt +++ /dev/null @@ -1,4 +0,0 @@ -c++DBUG = -c++OPT = -O3 - -ROUNDING_MATH = -frounding-math diff --git a/wmake/rules/darwin64Gcc/c++Prof b/wmake/rules/darwin64Gcc/c++Prof deleted file mode 100644 index 3bda4dad55e898a8198f6e8bfe21e8d829d7230a..0000000000000000000000000000000000000000 --- a/wmake/rules/darwin64Gcc/c++Prof +++ /dev/null @@ -1,2 +0,0 @@ -c++DBUG = -pg -c++OPT = -O2 diff --git a/wmake/rules/darwin64Gcc/cDebug b/wmake/rules/darwin64Gcc/cDebug deleted file mode 100644 index 72b638f458220e329d52b59e3566a3c807101f9d..0000000000000000000000000000000000000000 --- a/wmake/rules/darwin64Gcc/cDebug +++ /dev/null @@ -1,2 +0,0 @@ -cDBUG = -ggdb -DFULLDEBUG -cOPT = -O1 -fdefault-inline -finline-functions diff --git a/wmake/rules/darwin64Gcc/cOpt b/wmake/rules/darwin64Gcc/cOpt deleted file mode 100644 index 17318709f1fa39e6bf89cbe87778bc6fa459de17..0000000000000000000000000000000000000000 --- a/wmake/rules/darwin64Gcc/cOpt +++ /dev/null @@ -1,2 +0,0 @@ -cDBUG = -cOPT = -O3 diff --git a/wmake/rules/darwin64Gcc/cProf b/wmake/rules/darwin64Gcc/cProf deleted file mode 100644 index ca3ac9bf5f0cd61fe99e0f05fa1bd4bdf9fa6cf7..0000000000000000000000000000000000000000 --- a/wmake/rules/darwin64Gcc/cProf +++ /dev/null @@ -1,2 +0,0 @@ -cDBUG = -pg -cOPT = -O2 diff --git a/wmake/rules/darwin64Gcc/general b/wmake/rules/darwin64Gcc/general deleted file mode 100644 index 2457a3c5b6b9d62d0256184f297956f93e04a01a..0000000000000000000000000000000000000000 --- a/wmake/rules/darwin64Gcc/general +++ /dev/null @@ -1,9 +0,0 @@ -CPP = cpp -traditional-cpp $(GFLAGS) -Ddarwin - -PROJECT_LIBS = -l$(WM_PROJECT) -ldl - -include $(GENERAL_RULES)/standard -include $(GENERAL_RULES)/Gcc/openmp - -include $(DEFAULT_RULES)/c -include $(DEFAULT_RULES)/c++