diff --git a/applications/solvers/combustion/PDRFoam/PDRModels/XiGModels/basicXiSubG/basicXiSubG.C b/applications/solvers/combustion/PDRFoam/PDRModels/XiGModels/basicXiSubG/basicXiSubG.C index 26104e40ab9fecf9d4d238bd80a15016b2966a1a..04d3b6a5a494a5c7f7620a99102d832b5ada33f8 100644 --- a/applications/solvers/combustion/PDRFoam/PDRModels/XiGModels/basicXiSubG/basicXiSubG.C +++ b/applications/solvers/combustion/PDRFoam/PDRModels/XiGModels/basicXiSubG/basicXiSubG.C @@ -104,7 +104,7 @@ bool Foam::XiGModels::basicSubGrid::read(const dictionary& XiGProperties) { XiGModel::read(XiGProperties); - XiGModelCoeffs_.lookup("k1") >> k1; + XiGModelCoeffs_.readEntry("k1", k1); return true; } diff --git a/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/Gulder/Gulder.C b/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/Gulder/Gulder.C index c2b863087c85c0094ea2d64c017b8742960b527a..acbe023e0c697f6840364bd4b473b0f8273f742e 100644 --- a/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/Gulder/Gulder.C +++ b/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/Gulder/Gulder.C @@ -96,9 +96,9 @@ bool Foam::XiEqModels::Gulder::read(const dictionary& XiEqProperties) { XiEqModel::read(XiEqProperties); - XiEqModelCoeffs_.lookup("XiEqCoef") >> XiEqCoef_; - XiEqModelCoeffs_.lookup("uPrimeCoef") >> uPrimeCoef_; - XiEqModelCoeffs_.lookup("subGridSchelkin") >> subGridSchelkin_; + XiEqModelCoeffs_.readEntry("XiEqCoef", XiEqCoef_); + XiEqModelCoeffs_.readEntry("uPrimeCoef", uPrimeCoef_); + XiEqModelCoeffs_.readEntry("subGridSchelkin", subGridSchelkin_); return true; } diff --git a/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/SCOPEXiEq/SCOPEXiEq.C b/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/SCOPEXiEq/SCOPEXiEq.C index c7b55925cac2382c5ddaab5aa8e6d3db2be6ad7f..59758b889e9e6dc760b9257c9b0cd2dd36f3a3ca 100644 --- a/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/SCOPEXiEq/SCOPEXiEq.C +++ b/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/SCOPEXiEq/SCOPEXiEq.C @@ -147,11 +147,11 @@ bool Foam::XiEqModels::SCOPEXiEq::read(const dictionary& XiEqProperties) { XiEqModel::read(XiEqProperties); - XiEqModelCoeffs_.lookup("XiEqCoef") >> XiEqCoef_; - XiEqModelCoeffs_.lookup("XiEqExp") >> XiEqExp_; - XiEqModelCoeffs_.lookup("lCoef") >> lCoef_; - XiEqModelCoeffs_.lookup("uPrimeCoef") >> uPrimeCoef_; - XiEqModelCoeffs_.lookup("subGridSchelkin") >> subGridSchelkin_; + XiEqModelCoeffs_.readEntry("XiEqCoef", XiEqCoef_); + XiEqModelCoeffs_.readEntry("XiEqExp", XiEqExp_); + XiEqModelCoeffs_.readEntry("lCoef", lCoef_); + XiEqModelCoeffs_.readEntry("uPrimeCoef", uPrimeCoef_); + XiEqModelCoeffs_.readEntry("subGridSchelkin", subGridSchelkin_); return true; } diff --git a/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/instabilityXiEq/instabilityXiEq.C b/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/instabilityXiEq/instabilityXiEq.C index 9894fb166ef65830bee4f68313e4aa5655a1f88e..39651e983c9b8f6eb34f655abc6ed9682a1124a4 100644 --- a/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/instabilityXiEq/instabilityXiEq.C +++ b/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/instabilityXiEq/instabilityXiEq.C @@ -73,7 +73,7 @@ bool Foam::XiEqModels::instability::read(const dictionary& XiEqProperties) { XiEqModel::read(XiEqProperties); - XiEqModelCoeffs_.lookup("XiEqIn") >> XiEqIn; + XiEqModelCoeffs_.readEntry("XiEqIn", XiEqIn); return XiEqModel_->read(XiEqModelCoeffs_); } diff --git a/applications/solvers/combustion/PDRFoam/XiModels/XiGModels/KTS/KTS.C b/applications/solvers/combustion/PDRFoam/XiModels/XiGModels/KTS/KTS.C index aaddecc9d944a07202460998bea10a92cd4e96be..5750278f32d8aa714576f058622f883f99e25748 100644 --- a/applications/solvers/combustion/PDRFoam/XiModels/XiGModels/KTS/KTS.C +++ b/applications/solvers/combustion/PDRFoam/XiModels/XiGModels/KTS/KTS.C @@ -76,7 +76,7 @@ bool Foam::XiGModels::KTS::read(const dictionary& XiGProperties) { XiGModel::read(XiGProperties); - XiGModelCoeffs_.lookup("GEtaCoef") >> GEtaCoef_; + XiGModelCoeffs_.readEntry("GEtaCoef", GEtaCoef_); return true; } diff --git a/applications/solvers/combustion/PDRFoam/XiModels/XiGModels/instabilityG/instabilityG.C b/applications/solvers/combustion/PDRFoam/XiModels/XiGModels/instabilityG/instabilityG.C index eb3aeffeafd5028394651daf80d31c4145db6db1..a516bf0e46b2ce97718c4d1526236dc1e2efbff1 100644 --- a/applications/solvers/combustion/PDRFoam/XiModels/XiGModels/instabilityG/instabilityG.C +++ b/applications/solvers/combustion/PDRFoam/XiModels/XiGModels/instabilityG/instabilityG.C @@ -86,8 +86,8 @@ bool Foam::XiGModels::instabilityG::read(const dictionary& XiGProperties) { XiGModel::read(XiGProperties); - XiGModelCoeffs_.lookup("GIn") >> GIn_; - XiGModelCoeffs_.lookup("lambdaIn") >> lambdaIn_; + XiGModelCoeffs_.readEntry("GIn", GIn_); + XiGModelCoeffs_.readEntry("lambdaIn", lambdaIn_); return true; } diff --git a/applications/solvers/combustion/PDRFoam/XiModels/algebraic/algebraic.C b/applications/solvers/combustion/PDRFoam/XiModels/algebraic/algebraic.C index d744272d693bacaeb225d8af8cf379c9088de526..7908a578b565f07d894d8a15eef9b95f6c81eee3 100644 --- a/applications/solvers/combustion/PDRFoam/XiModels/algebraic/algebraic.C +++ b/applications/solvers/combustion/PDRFoam/XiModels/algebraic/algebraic.C @@ -89,7 +89,7 @@ bool Foam::XiModels::algebraic::read(const dictionary& XiProperties) { XiModel::read(XiProperties); - XiModelCoeffs_.lookup("XiShapeCoef") >> XiShapeCoef; + XiModelCoeffs_.readEntry("XiShapeCoef", XiShapeCoef); return true; } diff --git a/applications/solvers/combustion/PDRFoam/XiModels/transport/transport.C b/applications/solvers/combustion/PDRFoam/XiModels/transport/transport.C index a3eabb072197946078e86a4400b90ea402dd08ea..b23c057a6a2189b5ea403bf98816803f5e92b736 100644 --- a/applications/solvers/combustion/PDRFoam/XiModels/transport/transport.C +++ b/applications/solvers/combustion/PDRFoam/XiModels/transport/transport.C @@ -136,7 +136,7 @@ bool Foam::XiModels::transport::read(const dictionary& XiProperties) { XiModel::read(XiProperties); - XiModelCoeffs_.lookup("XiShapeCoef") >> XiShapeCoef; + XiModelCoeffs_.readEntry("XiShapeCoef", XiShapeCoef); return true; } diff --git a/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/createFields.H b/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/createFields.H index 53ef26b0ca33abe98965fd739ee6985f4e31a1aa..f70ef1a4722eeec293e6b716b7d6f20ab0eb65f3 100644 --- a/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/createFields.H +++ b/applications/solvers/incompressible/pimpleFoam/overPimpleDyMFoam/createFields.H @@ -52,7 +52,6 @@ mesh.setFluxRequired(p.name()); nonInt.insert("cellInterpolationWeight"); } - // Mask field for zeroing out contributions on hole cells #include "createCellMask.H" diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/VoFSolidificationMeltingSource/VoFSolidificationMeltingSourceIO.C b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/VoFSolidificationMeltingSource/VoFSolidificationMeltingSourceIO.C index 43e5df3da096f48a76d1a3903c24782b3fbc87ba..775fd10c3f3d64fbf1b7e70a9954e9634fc1d173 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/VoFSolidificationMeltingSource/VoFSolidificationMeltingSourceIO.C +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/VoFSolidificationMeltingSource/VoFSolidificationMeltingSourceIO.C @@ -32,7 +32,7 @@ bool Foam::fv::VoFSolidificationMeltingSource::read(const dictionary& dict) if (cellSetOption::read(dict)) { alphaSolidT_ = Function1<scalar>::New("alphaSolidT", coeffs_); - coeffs_.lookup("L") >> L_; + coeffs_.readEntry("L", L_); coeffs_.readIfPresent("relax", relax_); coeffs_.readIfPresent("Cu", Cu_); coeffs_.readIfPresent("q", q_); diff --git a/applications/solvers/multiphase/driftFluxFoam/incompressibleTwoPhaseInteractingMixture/incompressibleTwoPhaseInteractingMixture.C b/applications/solvers/multiphase/driftFluxFoam/incompressibleTwoPhaseInteractingMixture/incompressibleTwoPhaseInteractingMixture.C index 5058b55eaf89af0e818e1dd5a75f72984674283f..6bf159f2ff2d8f33f5bd57e0c73b86122253eb0e 100644 --- a/applications/solvers/multiphase/driftFluxFoam/incompressibleTwoPhaseInteractingMixture/incompressibleTwoPhaseInteractingMixture.C +++ b/applications/solvers/multiphase/driftFluxFoam/incompressibleTwoPhaseInteractingMixture/incompressibleTwoPhaseInteractingMixture.C @@ -122,8 +122,8 @@ bool Foam::incompressibleTwoPhaseInteractingMixture::read() && nucModel_().read(subDict(phase2Name_)) ) { - muModel_->viscosityProperties().lookup("rho") >> rhod_; - nucModel_->viscosityProperties().lookup("rho") >> rhoc_; + muModel_->viscosityProperties().readEntry("rho", rhod_); + nucModel_->viscosityProperties().readEntry("rho", rhoc_); dd_ = dimensionedScalar ( diff --git a/applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/BinghamPlastic/BinghamPlastic.C b/applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/BinghamPlastic/BinghamPlastic.C index 2711e79d9d84086e8ea5a42b816a461f75b19da5..45100db021a8a2c9e9bd1f3e03244b728bf74189 100644 --- a/applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/BinghamPlastic/BinghamPlastic.C +++ b/applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/BinghamPlastic/BinghamPlastic.C @@ -128,9 +128,9 @@ bool Foam::mixtureViscosityModels::BinghamPlastic::read { plastic::read(viscosityProperties); - plasticCoeffs_.lookup("yieldStressCoeff") >> yieldStressCoeff_; - plasticCoeffs_.lookup("yieldStressExponent") >> yieldStressExponent_; - plasticCoeffs_.lookup("yieldStressOffset") >> yieldStressOffset_; + plasticCoeffs_.readEntry("yieldStressCoeff", yieldStressCoeff_); + plasticCoeffs_.readEntry("yieldStressExponent", yieldStressExponent_); + plasticCoeffs_.readEntry("yieldStressOffset", yieldStressOffset_); return true; } diff --git a/applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/plastic/plastic.C b/applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/plastic/plastic.C index c096513474ab780f4a59e6dabf296c4ce4d65f5d..a11032ff1334f1205f22381590863c5cbb9c86e5 100644 --- a/applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/plastic/plastic.C +++ b/applications/solvers/multiphase/driftFluxFoam/mixtureViscosityModels/plastic/plastic.C @@ -119,9 +119,9 @@ bool Foam::mixtureViscosityModels::plastic::read plasticCoeffs_ = viscosityProperties.optionalSubDict(typeName + "Coeffs"); - plasticCoeffs_.lookup("k") >> plasticViscosityCoeff_; - plasticCoeffs_.lookup("n") >> plasticViscosityExponent_; - plasticCoeffs_.lookup("muMax") >> muMax_; + plasticCoeffs_.readEntry("k", plasticViscosityCoeff_); + plasticCoeffs_.readEntry("n", plasticViscosityExponent_); + plasticCoeffs_.readEntry("muMax", muMax_); return true; } diff --git a/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/phasesSystem/phaseSystem/multiphaseSystem/multiphaseSystem.C b/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/phasesSystem/phaseSystem/multiphaseSystem/multiphaseSystem.C index 93de23a99538587894ae8749fa4d302e21e55c3b..e7d8c066153a16f80e119738409304875f9dca1a 100644 --- a/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/phasesSystem/phaseSystem/multiphaseSystem/multiphaseSystem.C +++ b/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/phasesSystem/phaseSystem/multiphaseSystem/multiphaseSystem.C @@ -271,7 +271,7 @@ void Foam::multiphaseSystem::solve() const dictionary& alphaControls = mesh.solverDict("alpha"); label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles"))); label nAlphaCorr(readLabel(alphaControls.lookup("nAlphaCorr"))); - mesh.solverDict("alpha").lookup("cAlphas") >> cAlphas_; + mesh.solverDict("alpha").readEntry("cAlphas", cAlphas_); // Reset ddtAlphaMax ddtAlphaMax_ = dimensionedScalar(dimless, Zero); diff --git a/applications/solvers/multiphase/interCondensatingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/constant/constant.C b/applications/solvers/multiphase/interCondensatingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/constant/constant.C index 6a79460da6cbc7dcedb6184c5d8499557febffdd..f82f1f197c9eae16291efdd60b057c53224c3961 100644 --- a/applications/solvers/multiphase/interCondensatingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/constant/constant.C +++ b/applications/solvers/multiphase/interCondensatingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/constant/constant.C @@ -158,8 +158,8 @@ bool Foam::temperaturePhaseChangeTwoPhaseMixtures::constant::read() { if (temperaturePhaseChangeTwoPhaseMixture::read()) { - subDict(type() + "Coeffs").lookup("coeffC") >> coeffC_; - subDict(type() + "Coeffs").lookup("coeffE") >> coeffE_; + subDict(type() + "Coeffs").readEntry("coeffC", coeffC_); + subDict(type() + "Coeffs").readEntry("coeffE", coeffE_); return true; } diff --git a/applications/solvers/multiphase/interCondensatingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/thermoIncompressibleTwoPhaseMixture/thermoIncompressibleTwoPhaseMixture.C b/applications/solvers/multiphase/interCondensatingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/thermoIncompressibleTwoPhaseMixture/thermoIncompressibleTwoPhaseMixture.C index 4be68f4c269ca4f3ffb5df6b1fadcd2026efddab..2cfcbdbe7c527296035b5c2ecb5b3cbfd481fe32 100644 --- a/applications/solvers/multiphase/interCondensatingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/thermoIncompressibleTwoPhaseMixture/thermoIncompressibleTwoPhaseMixture.C +++ b/applications/solvers/multiphase/interCondensatingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/thermoIncompressibleTwoPhaseMixture/thermoIncompressibleTwoPhaseMixture.C @@ -109,17 +109,17 @@ bool Foam::thermoIncompressibleTwoPhaseMixture::read() { if (incompressibleTwoPhaseMixture::read()) { - subDict(phase1Name_).lookup("kappa") >> kappa1_; - subDict(phase2Name_).lookup("kappa") >> kappa2_; + subDict(phase1Name_).readEntry("kappa", kappa1_); + subDict(phase2Name_).readEntry("kappa", kappa2_); - subDict(phase1Name_).lookup("Cp") >> Cp1_; - subDict(phase2Name_).lookup("Cp") >> Cp2_; + subDict(phase1Name_).readEntry("Cp", Cp1_); + subDict(phase2Name_).readEntry("Cp", Cp2_); - subDict(phase1Name_).lookup("Cv") >> Cv1_; - subDict(phase2Name_).lookup("Cv") >> Cv2_; + subDict(phase1Name_).readEntry("Cv", Cv1_); + subDict(phase2Name_).readEntry("Cv", Cv2_); - subDict(phase1Name_).lookup("hf") >> Hf1_; - subDict(phase2Name_).lookup("hf") >> Hf2_; + subDict(phase1Name_).readEntry("hf", Hf1_); + subDict(phase2Name_).readEntry("hf", Hf2_); return true; } diff --git a/applications/solvers/multiphase/interCondensatingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/twoPhaseMixtureEThermo/twoPhaseMixtureEThermo.C b/applications/solvers/multiphase/interCondensatingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/twoPhaseMixtureEThermo/twoPhaseMixtureEThermo.C index 3910f68bcdfb39243762f41a31af36d399d066d6..8ef64f38c9b0ed975a57c34f8b6af992009bb27d 100644 --- a/applications/solvers/multiphase/interCondensatingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/twoPhaseMixtureEThermo/twoPhaseMixtureEThermo.C +++ b/applications/solvers/multiphase/interCondensatingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/twoPhaseMixtureEThermo/twoPhaseMixtureEThermo.C @@ -581,14 +581,12 @@ bool Foam::twoPhaseMixtureEThermo::read() { if (basicThermo::read() && thermoIncompressibleTwoPhaseMixture::read()) { - basicThermo::lookup("pDivU") >> pDivU_; - basicThermo::lookup("TSat") >> TSat_; + basicThermo::readEntry("pDivU", pDivU_); + basicThermo::readEntry("TSat", TSat_); return true; } - else - { - return false; - } + + return false; } diff --git a/applications/solvers/multiphase/interFoam/interMixingFoam/incompressibleThreePhaseMixture/incompressibleThreePhaseMixture.C b/applications/solvers/multiphase/interFoam/interMixingFoam/incompressibleThreePhaseMixture/incompressibleThreePhaseMixture.C index e68661b678ef0c994ba3a19c657d93865d86fb2c..1d9e81636f67edee9044ff4433f4cd8442228166 100644 --- a/applications/solvers/multiphase/interFoam/interMixingFoam/incompressibleThreePhaseMixture/incompressibleThreePhaseMixture.C +++ b/applications/solvers/multiphase/interFoam/interMixingFoam/incompressibleThreePhaseMixture/incompressibleThreePhaseMixture.C @@ -231,9 +231,9 @@ bool Foam::incompressibleThreePhaseMixture::read() && nuModel3_().read(*this) ) { - nuModel1_->viscosityProperties().lookup("rho") >> rho1_; - nuModel2_->viscosityProperties().lookup("rho") >> rho2_; - nuModel3_->viscosityProperties().lookup("rho") >> rho3_; + nuModel1_->viscosityProperties().readEntry("rho", rho1_); + nuModel2_->viscosityProperties().readEntry("rho", rho2_); + nuModel3_->viscosityProperties().readEntry("rho", rho3_); return true; } diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/Kunz/Kunz.C b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/Kunz/Kunz.C index 0a172e764af417b182022abbcbc115709479242a..a39647a35c6e87eda4d73c7f46cf540c87f2a033 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/Kunz/Kunz.C +++ b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/Kunz/Kunz.C @@ -104,10 +104,10 @@ bool Foam::phaseChangeTwoPhaseMixtures::Kunz::read() { phaseChangeTwoPhaseMixtureCoeffs_ = optionalSubDict(type() + "Coeffs"); - phaseChangeTwoPhaseMixtureCoeffs_.lookup("UInf") >> UInf_; - phaseChangeTwoPhaseMixtureCoeffs_.lookup("tInf") >> tInf_; - phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc") >> Cc_; - phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv") >> Cv_; + phaseChangeTwoPhaseMixtureCoeffs_.readEntry("UInf", UInf_); + phaseChangeTwoPhaseMixtureCoeffs_.readEntry("tInf", tInf_); + phaseChangeTwoPhaseMixtureCoeffs_.readEntry("Cc", Cc_); + phaseChangeTwoPhaseMixtureCoeffs_.readEntry("Cv", Cv_); mcCoeff_ = Cc_*rho2()/tInf_; mvCoeff_ = Cv_*rho2()/(0.5*rho1()*sqr(UInf_)*tInf_); diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/Merkle/Merkle.C b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/Merkle/Merkle.C index f682ed5725538395fb21e0b31c3758b751af373d..09e977d988fd290f32777ceed96eecf673f46350 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/Merkle/Merkle.C +++ b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/Merkle/Merkle.C @@ -99,10 +99,10 @@ bool Foam::phaseChangeTwoPhaseMixtures::Merkle::read() { phaseChangeTwoPhaseMixtureCoeffs_ = optionalSubDict(type() + "Coeffs"); - phaseChangeTwoPhaseMixtureCoeffs_.lookup("UInf") >> UInf_; - phaseChangeTwoPhaseMixtureCoeffs_.lookup("tInf") >> tInf_; - phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc") >> Cc_; - phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv") >> Cv_; + phaseChangeTwoPhaseMixtureCoeffs_.readEntry("UInf", UInf_); + phaseChangeTwoPhaseMixtureCoeffs_.readEntry("tInf", tInf_); + phaseChangeTwoPhaseMixtureCoeffs_.readEntry("Cc", Cc_); + phaseChangeTwoPhaseMixtureCoeffs_.readEntry("Cv", Cv_); mcCoeff_ = Cc_/(0.5*sqr(UInf_)*tInf_); mvCoeff_ = Cv_*rho1()/(0.5*sqr(UInf_)*tInf_*rho2()); diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/SchnerrSauer/SchnerrSauer.C b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/SchnerrSauer/SchnerrSauer.C index 7d02a651fe8609d6453650c69bd6f5a9a2737fe0..17d218fdae182cfbd136629ee73bdd64a7e69f1d 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/SchnerrSauer/SchnerrSauer.C +++ b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/SchnerrSauer/SchnerrSauer.C @@ -153,10 +153,10 @@ bool Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::read() { phaseChangeTwoPhaseMixtureCoeffs_ = optionalSubDict(type() + "Coeffs"); - phaseChangeTwoPhaseMixtureCoeffs_.lookup("n") >> n_; - phaseChangeTwoPhaseMixtureCoeffs_.lookup("dNuc") >> dNuc_; - phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc") >> Cc_; - phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv") >> Cv_; + phaseChangeTwoPhaseMixtureCoeffs_.readEntry("n", n_); + phaseChangeTwoPhaseMixtureCoeffs_.readEntry("dNuc", dNuc_); + phaseChangeTwoPhaseMixtureCoeffs_.readEntry("Cc", Cc_); + phaseChangeTwoPhaseMixtureCoeffs_.readEntry("Cv", Cv_); return true; } diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/phaseChangeTwoPhaseMixture/phaseChangeTwoPhaseMixture.C b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/phaseChangeTwoPhaseMixture/phaseChangeTwoPhaseMixture.C index c4fe701a2f779dcf37079b000e3db9e46c94421e..e8abc554f4262ae130b0d7bc8a59eeaa6443d0a1 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/phaseChangeTwoPhaseMixture/phaseChangeTwoPhaseMixture.C +++ b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/phaseChangeTwoPhaseMixture/phaseChangeTwoPhaseMixture.C @@ -78,14 +78,12 @@ bool Foam::phaseChangeTwoPhaseMixture::read() if (incompressibleTwoPhaseMixture::read()) { phaseChangeTwoPhaseMixtureCoeffs_ = optionalSubDict(type() + "Coeffs"); - lookup("pSat") >> pSat_; + readEntry("pSat", pSat_); return true; } - else - { - return false; - } + + return false; } diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C index 2815e566905540eeb6a1b0e5f629a98ce77dfd50..e48594f9705b5656b035d08fa5949fb475bdc259 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C +++ b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C @@ -944,16 +944,14 @@ bool Foam::multiphaseSystem::read() readOK &= iter().read(phaseData[phasei++].dict()); } - lookup("sigmas") >> sigmas_; - lookup("interfaceCompression") >> cAlphas_; - lookup("virtualMass") >> Cvms_; + readEntry("sigmas", sigmas_); + readEntry("interfaceCompression", cAlphas_); + readEntry("virtualMass", Cvms_); return readOK; } - else - { - return false; - } + + return false; } diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.C b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.C index 9b66605cf8b9368285da338d6df6d8f9ecec2b9f..d50c2b34c3b02f8419be5e21294f349b8c3ed47e 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.C +++ b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.C @@ -222,10 +222,10 @@ bool Foam::phaseModel::read(const dictionary& phaseDict) //if (nuModel_->read(phaseDict_)) { - phaseDict_.lookup("nu") >> nu_.value(); - phaseDict_.lookup("kappa") >> kappa_.value(); - phaseDict_.lookup("Cp") >> Cp_.value(); - phaseDict_.lookup("rho") >> rho_.value(); + phaseDict_.readEntry("nu", nu_.value()); + phaseDict_.readEntry("kappa", kappa_.value()); + phaseDict_.readEntry("Cp", Cp_.value()); + phaseDict_.readEntry("rho", rho_.value()); return true; } diff --git a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C index 27f1e937d4f2ec0ecc82e4ccb957abaf6eacf51e..c6c366951ddcc66de2f979bf9fd01f571340ac89 100644 --- a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C +++ b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C @@ -701,14 +701,12 @@ bool Foam::multiphaseMixture::read() readOK &= iter().read(phaseData[phasei++].dict()); } - lookup("sigmas") >> sigmas_; + readEntry("sigmas", sigmas_); return readOK; } - else - { - return false; - } + + return false; } diff --git a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/phase/phase.C b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/phase/phase.C index e7a5603c9f97ce03f20a73b0ad9838649940e542..63b3e0779bc260f30c4dd94daa917842e55279eb 100644 --- a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/phase/phase.C +++ b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/phase/phase.C @@ -84,7 +84,7 @@ bool Foam::phase::read(const dictionary& phaseDict) if (nuModel_->read(phaseDict_)) { - phaseDict_.lookup("rho") >> rho_; + phaseDict_.readEntry("rho", rho_); return true; } diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/diameterModels/constantDiameter/constantDiameter.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/diameterModels/constantDiameter/constantDiameter.C index 5d8ec7464d43f3118f70f5f41d3a34bd4d909478..8e787e776553b5f11f80310d427eb9d95429c200 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/diameterModels/constantDiameter/constantDiameter.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/diameterModels/constantDiameter/constantDiameter.C @@ -88,7 +88,7 @@ bool Foam::diameterModels::constant::read(const dictionary& phaseProperties) { diameterModel::read(phaseProperties); - diameterProperties_.lookup("d") >> d_; + diameterProperties_.readEntry("d", d_); return true; } diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/diameterModels/isothermalDiameter/isothermalDiameter.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/diameterModels/isothermalDiameter/isothermalDiameter.C index 921dbdba5b57f212228c6490b49cea00c06670cc..845e8b0d2582641ed53ff1a7923cdbae38873118 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/diameterModels/isothermalDiameter/isothermalDiameter.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/diameterModels/isothermalDiameter/isothermalDiameter.C @@ -81,8 +81,8 @@ bool Foam::diameterModels::isothermal::read(const dictionary& phaseProperties) { diameterModel::read(phaseProperties); - diameterProperties_.lookup("d0") >> d0_; - diameterProperties_.lookup("p0") >> p0_; + diameterProperties_.readEntry("d0", d0_); + diameterProperties_.readEntry("p0", p0_); return true; } diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C index 5e09566569e7c182850b61f508fa21de6fd02473..71fdca8d880a63095d7a1852afd1ebcab994fe40 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C @@ -212,7 +212,7 @@ bool Foam::RASModels::kineticTheoryModel::read() >::read() ) { - coeffDict().lookup("equilibrium") >> equilibrium_; + coeffDict().readEntry("equilibrium", equilibrium_); e_.readIfPresent(coeffDict()); alphaMax_.readIfPresent(coeffDict()); alphaMinFriction_.readIfPresent(coeffDict()); diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/phasePressureModel/phasePressureModel.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/phasePressureModel/phasePressureModel.C index 9176b7a1c8694aef1ddb7c9bc3273bae031cc93f..90549eda9c1b2a7bba2eb59de5298fd7e2356e6e 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/phasePressureModel/phasePressureModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/phasePressureModel/phasePressureModel.C @@ -94,9 +94,9 @@ bool Foam::RASModels::phasePressureModel::read() >::read() ) { - coeffDict().lookup("alphaMax") >> alphaMax_; - coeffDict().lookup("preAlphaExp") >> preAlphaExp_; - coeffDict().lookup("expMax") >> expMax_; + coeffDict().readEntry("alphaMax", alphaMax_); + coeffDict().readEntry("preAlphaExp", preAlphaExp_); + coeffDict().readEntry("expMax", expMax_); g0_.readIfPresent(coeffDict()); return true; diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATE.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATE.C index 9bae6c06e834d993e254fddb0a31a7fb8315f38a..b2d0547f5c52762f6eed5c6153ed5f8eb817f039 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATE.C +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATE.C @@ -174,8 +174,8 @@ bool Foam::diameterModels::IATE::read(const dictionary& phaseProperties) { diameterModel::read(phaseProperties); - diameterProperties_.lookup("dMax") >> dMax_; - diameterProperties_.lookup("dMin") >> dMin_; + diameterProperties_.readEntry("dMax", dMax_); + diameterProperties_.readEntry("dMin", dMin_); // Re-create all the sources updating number, type and coefficients PtrList<IATEsource> diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C index 5e09566569e7c182850b61f508fa21de6fd02473..71fdca8d880a63095d7a1852afd1ebcab994fe40 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C @@ -212,7 +212,7 @@ bool Foam::RASModels::kineticTheoryModel::read() >::read() ) { - coeffDict().lookup("equilibrium") >> equilibrium_; + coeffDict().readEntry("equilibrium", equilibrium_); e_.readIfPresent(coeffDict()); alphaMax_.readIfPresent(coeffDict()); alphaMinFriction_.readIfPresent(coeffDict()); diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/phasePressureModel/phasePressureModel.C b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/phasePressureModel/phasePressureModel.C index 4c272f8d579feb25fd04ed7605a55eb342f1aa24..b00f887c98cb2344dc5172a4be5da10fb027dd70 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/phasePressureModel/phasePressureModel.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/phasePressureModel/phasePressureModel.C @@ -100,9 +100,9 @@ bool Foam::RASModels::phasePressureModel::read() >::read() ) { - coeffDict().lookup("alphaMax") >> alphaMax_; - coeffDict().lookup("preAlphaExp") >> preAlphaExp_; - coeffDict().lookup("expMax") >> expMax_; + coeffDict().readEntry("alphaMax", alphaMax_); + coeffDict().readEntry("preAlphaExp", preAlphaExp_); + coeffDict().readEntry("expMax", expMax_); g0_.readIfPresent(coeffDict()); return true; diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATE.C b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATE.C index afa96a571a539155988123e43ba9af849d74166a..00f8188f78f7ed365be9f0641e1887e668fd1b08 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATE.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATE.C @@ -184,8 +184,8 @@ bool Foam::diameterModels::IATE::read(const dictionary& phaseProperties) { diameterModel::read(phaseProperties); - diameterProperties_.lookup("dMax") >> dMax_; - diameterProperties_.lookup("dMin") >> dMin_; + diameterProperties_.readEntry("dMax", dMax_); + diameterProperties_.readEntry("dMin", dMin_); // Re-create all the sources updating number, type and coefficients PtrList<IATEsource> diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/diameterModels/constantDiameter/constantDiameter.C b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/diameterModels/constantDiameter/constantDiameter.C index 1f6cf5c44187d7fe36f339d45898fbc836e9919b..5868057dd59d155ecad5012698f23fee7e697f35 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/diameterModels/constantDiameter/constantDiameter.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/diameterModels/constantDiameter/constantDiameter.C @@ -91,7 +91,7 @@ bool Foam::diameterModels::constant::read(const dictionary& phaseProperties) { diameterModel::read(phaseProperties); - diameterProperties_.lookup("d") >> d_; + diameterProperties_.readEntry("d", d_); return true; } diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/diameterModels/isothermalDiameter/isothermalDiameter.C b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/diameterModels/isothermalDiameter/isothermalDiameter.C index 2754ce8d731e6ebf6393c96efde2b495cf185f1a..ec349b7f18876bf605e368debab31733ef7e450f 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/diameterModels/isothermalDiameter/isothermalDiameter.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/diameterModels/isothermalDiameter/isothermalDiameter.C @@ -81,8 +81,8 @@ bool Foam::diameterModels::isothermal::read(const dictionary& phaseProperties) { diameterModel::read(phaseProperties); - diameterProperties_.lookup("d0") >> d0_; - diameterProperties_.lookup("p0") >> p0_; + diameterProperties_.readEntry("d0", d0_); + diameterProperties_.readEntry("p0", p0_); return true; } diff --git a/applications/test/decomposePar/Test-decomposePar.C b/applications/test/decomposePar/Test-decomposePar.C index 30445a26b71c915a127f616167063efdef54427b..26673bf6b1729bea026799b0267ab16dfc2ac0b3 100644 --- a/applications/test/decomposePar/Test-decomposePar.C +++ b/applications/test/decomposePar/Test-decomposePar.C @@ -121,41 +121,27 @@ int main(int argc, char *argv[]) fileName decompDictFile; args.readIfPresent("decomposeParDict", decompDictFile); + // Get all region names wordList regionNames; - wordList regionDirs; if (allRegions) { - Info<< "Decomposing all regions in regionProperties" << nl << endl; - regionProperties rp(runTime); - forAllConstIters(rp, iter) - { - const wordList& regions = iter(); - forAll(regions, i) - { - if (!regionNames.found(regions[i])) - { - regionNames.append(regions[i]); - } - } - } - regionDirs = regionNames; + regionNames = regionProperties(runTime).names(); + + Info<< "Decomposing all regions in regionProperties" << nl + << " " << flatOutput(regionNames) << nl << endl; } else { - regionNames.resize(1, fvMesh::defaultRegion); - regionDirs.resize(1, word::null); - - if (args.readIfPresent("region", regionNames.first())) - { - regionDirs.first() = regionNames.first(); - } + regionNames.resize(1); + regionNames.first() = + args.lookupOrDefault<word>("region", fvMesh::defaultRegion); } - forAll(regionNames, regioni) { const word& regionName = regionNames[regioni]; - const word& regionDir = regionDirs[regioni]; + const word& regionDir = + (regionName == fvMesh::defaultRegion ? word::null : regionName); Info<< "\n\nDecomposing mesh " << regionName << nl << endl; Info<< "Create mesh..." << flush; diff --git a/applications/test/dictionary2/Test-dictionary2.C b/applications/test/dictionary2/Test-dictionary2.C index 36460568e6c58543f26d585e455125bca75c86b3..fc883a9cf58e9380dad2a17ae5a8ddd6672c0c33 100644 --- a/applications/test/dictionary2/Test-dictionary2.C +++ b/applications/test/dictionary2/Test-dictionary2.C @@ -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 @@ -25,8 +25,7 @@ Application Test-dictionary2 Description - - Test dictionary insertion + Test dictionary insertion and some reading functionality. \*---------------------------------------------------------------------------*/ @@ -208,6 +207,83 @@ int main(int argc, char *argv[]) Info<< nl << "dictionary" << nl << nl; dict1.write(Info, false); + + { + Info<< nl << "Test reading good/bad/empty scalar entries" << nl; + dictionary dict2 + ( + IStringStream + ( + "good 3.14159;\n" + "empty;\n" + // "bad text;\n" // always fails + // "bad 3.14159 1234;\n" // fails for readScalar + )() + ); + dict2.write(Info); + + + // With readScalar + { + Info<< nl << "Test some bad input with readScalar()" << nl; + + const bool throwingIOError = FatalIOError.throwExceptions(); + const bool throwingError = FatalError.throwExceptions(); + + try + { + scalar val1 = readScalar(dict2.lookup("good")); + // scalar val2 = readScalar(dict2.lookup("bad")); + scalar val2 = -1; + scalar val3 = readScalar(dict2.lookup("empty")); + + Info<< "got good=" << val1 << " bad=" << val2 + << " empty=" << val3 << nl; + } + catch (Foam::IOerror& err) + { + Info<< "Caught FatalIOError " << err << nl << endl; + } + catch (Foam::error& err) + { + Info<< "Caught FatalError " << err << nl << endl; + } + FatalError.throwExceptions(throwingError); + FatalIOError.throwExceptions(throwingIOError); + } + + + // With get<scalar> + { + Info<< nl << "Test some bad input with get<scalar>()" << nl; + + const bool throwingIOError = FatalIOError.throwExceptions(); + const bool throwingError = FatalError.throwExceptions(); + + try + { + scalar val1 = dict2.get<scalar>("good"); + // scalar val2 = dict2.get<scalar>("bad"); + scalar val2 = -1; + scalar val3 = dict2.get<scalar>("empty"); + + Info<< "got good=" << val1 << " bad=" << val2 + << " empty=" << val3 << nl; + } + catch (Foam::IOerror& err) + { + Info<< "Caught FatalIOError " << err << nl << endl; + } + catch (Foam::error& err) + { + Info<< "Caught FatalError " << err << nl << endl; + } + FatalError.throwExceptions(throwingError); + FatalIOError.throwExceptions(throwingIOError); + } + } + + Info<< "\nDone\n" << endl; return 0; diff --git a/applications/test/fileName/Test-fileName.C b/applications/test/fileName/Test-fileName.C index 3ad28e5f778c17fed030fdae68b9f8c13b72ce71..8d97b9f1f5a9231b8562a73bf8ff3c65c423743a 100644 --- a/applications/test/fileName/Test-fileName.C +++ b/applications/test/fileName/Test-fileName.C @@ -621,12 +621,18 @@ int main(int argc, char *argv[]) << "pathName.name() = >" << pathName.name() << "<\n" << "pathName.path() = " << pathName.path() << nl << "pathName.ext() = >" << pathName.ext() << "<\n" - << "pathName.name(true) = >" << pathName.name(true) << "<\n"; + << "pathName.nameLessExt= >" << pathName.nameLessExt() << "<\n"; Info<< "pathName.components() = " << pathName.components() << nl << "pathName.component(2) = " << pathName.component(2) << nl << endl; + Info<< "hasPath = " << Switch(pathName.hasPath()) << nl; + pathName.removePath(); + Info<< "removed path = " << pathName << nl; + + Info<< nl << nl; + // try with different combination // The final one should emit warnings for (label start = 0; start <= wrdList.size(); ++start) diff --git a/applications/test/instant/Make/files b/applications/test/instant/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..c7dd9f81466639935c19ebdf3b67299fd02af890 --- /dev/null +++ b/applications/test/instant/Make/files @@ -0,0 +1,3 @@ +Test-instant.C + +EXE = $(FOAM_USER_APPBIN)/Test-instant diff --git a/applications/test/instant/Make/options b/applications/test/instant/Make/options new file mode 100644 index 0000000000000000000000000000000000000000..6a9e9810b3d5ce6684bdaf03143933480ff45e42 --- /dev/null +++ b/applications/test/instant/Make/options @@ -0,0 +1,2 @@ +/* EXE_INC = -I$(LIB_SRC)/cfdTools/include */ +/* EXE_LIBS = -lfiniteVolume */ diff --git a/applications/test/instant/Test-instant.C b/applications/test/instant/Test-instant.C new file mode 100644 index 0000000000000000000000000000000000000000..f0487c98576dd670b6feee97ed2231aef6f40986 --- /dev/null +++ b/applications/test/instant/Test-instant.C @@ -0,0 +1,82 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2018 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + 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. + + 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 with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Description + Test instant, fileNameInstant + +\*---------------------------------------------------------------------------*/ + +#include "argList.H" +#include "instant.H" +#include "fileNameInstant.H" +#include "DynamicList.H" + +using namespace Foam; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// Main program: + +int main(int argc, char *argv[]) +{ + DynamicList<instant> times; + + times.append(instant{}); + times.append({12, "abc"}); + times.append(instant{3.14159}); + times.append({300.456, "def"}); + times.append({454.456, "xyz"}); + times.append({10, "ten"}); + + { + word timeName("twenty"); + + Info<<"move append: " << timeName << nl; + times.append({20, std::move(timeName)}); + Info<<"after append: " << timeName << nl; + } + + Info<< nl << "times:" << times << nl; + sort(times); + Info<< "Sorted:" << times << nl; + + + DynamicList<fileNameInstant> files; + files.append(fileNameInstant{}); + files.append({12, "twelve"}); + files.append({3.14, "/path/almost-pi"}); + files.append({300, "/dev/value"}); + files.append({454, "/tmp/xyz"}); + files.append({10, "ten"}); + + Info<< nl << "files:" << files << nl; + sort(files); + Info<< "Sorted:" << files << nl; + + + Info<< "\nEnd\n" << endl; + + return 0; +} + + +// ************************************************************************* // diff --git a/applications/test/string/Test-string.C b/applications/test/string/Test-string.C index 81c126b8afbe9eb0a7237548a9bff83a64537118..52d2b58ab239bc7e611a665184b55a1da6314120 100644 --- a/applications/test/string/Test-string.C +++ b/applications/test/string/Test-string.C @@ -36,6 +36,7 @@ Description #include "uint.H" #include "scalar.H" #include "Switch.H" +#include "fileName.H" #include "stringList.H" using namespace Foam; @@ -64,6 +65,34 @@ int main(int argc, char *argv[]) subDict.add("value2", "test2"); dict.add("FOAM_RUN", subDict); + if (false) + { + typedef std::string inputType; + typedef string outputType; + + inputType in1("move-construct-from"); + + Info<<"move construct from " << in1.length() << nl; + + outputType out1(std::move(in1)); + + Info<<"after move construct " + << out1.size() << ", " << in1.size() << nl; + + in1 = "move-assign-from"; + out1 = "some-text-rubbish"; + out1.resize(10); + + Info<<"move assign from " << in1.length() << nl; + + out1 = std::move(in1); + + Info<<"after move assign " + << out1.size() << ", " << in1.size() << nl; + + return 0; + } + // basic expansions { diff --git a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C index ce99b04a4f3a4c488a4660115b7282c035e83430..26b33a8605e05be3128d14dde9fbedec4a9dec6d 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C +++ b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C @@ -362,7 +362,7 @@ int main(int argc, char *argv[]) /"processor" + Foam::name(Pstream::myProcNo()); } wordList sourcePatches; - dict.lookup("sourcePatches") >> sourcePatches; + dict.readEntry("sourcePatches", sourcePatches); if (sourcePatches.size() == 1) { @@ -581,7 +581,7 @@ int main(int argc, char *argv[]) labelList exposedPatchID; if (mode == PATCH) { - dict.lookup("exposedPatchName") >> backPatchName; + dict.readEntry("exposedPatchName", backPatchName); exposedPatchID.setSize ( extrudePatch.size(), diff --git a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C index c53ed699345d8e1564b824d8153218d33db7d100..e5dc81bbdf7d44d95bca273ecbaa6d6fe330d505 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C +++ b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C @@ -1514,7 +1514,7 @@ int main(int argc, char *argv[]) const bool hasZones = dict.found("faceZones"); if (hasZones) { - dict.lookup("faceZones") >> zoneNames; + dict.readEntry("faceZones", zoneNames); dict.readIfPresent("faceZonesShadow", zoneShadowNames); // Check @@ -1528,7 +1528,7 @@ int main(int argc, char *argv[]) } else { - dict.lookup("faceSets") >> zoneNames; + dict.readEntry("faceSets", zoneNames); dict.readIfPresent("faceSetsShadow", zoneShadowNames); } diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/surfaceOffsetLinearDistance/surfaceOffsetLinearDistance.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/surfaceOffsetLinearDistance/surfaceOffsetLinearDistance.C index 60892120efb720b140b09afdbcb79c8988fc473b..b186ae50b98e4337592ebcf949396de9fb25f881 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/surfaceOffsetLinearDistance/surfaceOffsetLinearDistance.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/surfaceOffsetLinearDistance/surfaceOffsetLinearDistance.C @@ -71,10 +71,9 @@ Foam::surfaceOffsetLinearDistance::surfaceOffsetLinearDistance totalDistance_(), totalDistanceSqr_() { - if (coeffsDict().found("totalDistanceCoeff")) + if (coeffsDict().readIfPresent("totalDistanceCoeff", totalDistance_)) { - totalDistance_ = - coeffsDict().get<scalar>("totalDistanceCoeff") * defaultCellSize; + totalDistance_ *= defaultCellSize; if (coeffsDict().found("linearDistanceCoeff")) { @@ -84,11 +83,10 @@ Foam::surfaceOffsetLinearDistance::surfaceOffsetLinearDistance << nl << exit(FatalError) << endl; } } - else if (coeffsDict().found("linearDistanceCoeff")) + else if (coeffsDict().readIfPresent("linearDistanceCoeff", totalDistance_)) { - totalDistance_ = - coeffsDict().get<scalar>("linearDistanceCoeff") * defaultCellSize - + surfaceOffset_; + totalDistance_ *= defaultCellSize; + totalDistance_ += surfaceOffset_; } else { diff --git a/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C b/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C index 6a9bac6bedd1bfe8f392bb410f286f91476ba0ff..4e15db3fe6bf69f84aa53eaf30ff3f5e90f5a706 100644 --- a/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C +++ b/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C @@ -749,7 +749,7 @@ int main(int argc, char *argv[]) << endl; } - renumberDict.lookup("writeMaps") >> writeMaps; + renumberDict.readEntry("writeMaps", writeMaps); if (writeMaps) { Info<< "Writing renumber maps (new to old) to polyMesh." << nl diff --git a/applications/utilities/miscellaneous/foamHelp/helpTypes/helpSolver/helpSolver.C b/applications/utilities/miscellaneous/foamHelp/helpTypes/helpSolver/helpSolver.C index 1da7406536e9c653e5ee3c3ffca0e0a063ff1a09..782580d5a236ea041dc9f608b1ec8cfc1b63b368 100644 --- a/applications/utilities/miscellaneous/foamHelp/helpTypes/helpSolver/helpSolver.C +++ b/applications/utilities/miscellaneous/foamHelp/helpTypes/helpSolver/helpSolver.C @@ -85,7 +85,7 @@ void Foam::helpTypes::helpSolver::execute } else if (args.found("read")) { - mesh.time().controlDict().lookup("application") >> solver; + mesh.time().controlDict().readEntry("application", solver); displayDoc(solver, ".*solvers/.*Foam/", true, "C"); } else diff --git a/applications/utilities/miscellaneous/foamHelp/helpTypes/helpType/helpType.C b/applications/utilities/miscellaneous/foamHelp/helpTypes/helpType/helpType.C index 93c628dafbfc720f799b9657456cc56f98415f8f..3b6d9130b8f82c31556973e24c544a6a954cbaf4 100644 --- a/applications/utilities/miscellaneous/foamHelp/helpTypes/helpType/helpType.C +++ b/applications/utilities/miscellaneous/foamHelp/helpTypes/helpType/helpType.C @@ -119,7 +119,7 @@ void Foam::helpType::displayDoc { const dictionary& docDict = debug::controlDict().subDict("Documentation"); - docDict.lookup("docBrowser") >> docBrowser; + docDict.readEntry("docBrowser", docBrowser); } doxygenXmlParser parser diff --git a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C index f11942fba950439eb6b8c2b89dbf8b5f19da97d4..e061325c846ef561f09a3e0bcc629344005f8411 100644 --- a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C +++ b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C @@ -330,19 +330,14 @@ int main(int argc, char *argv[]) fileName decompDictFile; args.readIfPresent("decomposeParDict", decompDictFile); + // Get all region names wordList regionNames; if (allRegions) { - Info<< "Decomposing all regions in regionProperties" << nl << nl; - regionProperties rp(runTime); + regionNames = regionProperties(runTime).names(); - wordHashSet names; - forAllConstIters(rp, iter) - { - names.insert(iter.object()); - } - - regionNames = names.sortedToc(); + Info<< "Decomposing all regions in regionProperties" << nl + << " " << flatOutput(regionNames) << nl << endl; } else { diff --git a/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C b/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C index 7645b9c91f9670c8fb19c06f3fc95d3a5544749a..37e179440d00b3ff42e65b71bd84ec6cfb3e18ec 100644 --- a/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C +++ b/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C @@ -180,17 +180,11 @@ int main(int argc, char *argv[]) wordList regionDirs; if (allRegions) { - Info<< "Reconstructing all regions in regionProperties" << nl << endl; - regionProperties rp(runTime); - - wordHashSet names; - forAllConstIters(rp, iter) - { - names.insert(iter.object()); - } - - regionNames = names.sortedToc(); + regionNames = regionProperties(runTime).names(); regionDirs = regionNames; + + Info<< "Reconstructing all regions in regionProperties" << nl + << " " << flatOutput(regionNames) << nl << endl; } else { diff --git a/applications/utilities/parallelProcessing/redistributePar/redistributePar.C b/applications/utilities/parallelProcessing/redistributePar/redistributePar.C index 664ba340781777945674cac07d1c72ba82bce8c5..b7ae617422d580f0c30579e2d646d2ba140e9b73 100644 --- a/applications/utilities/parallelProcessing/redistributePar/redistributePar.C +++ b/applications/utilities/parallelProcessing/redistributePar/redistributePar.C @@ -2499,21 +2499,16 @@ int main(int argc, char *argv[]) wordList regionNames; if (args.found("allRegions")) { - Info<< "Decomposing all regions in regionProperties" << nl << endl; - regionProperties rp(runTime); + regionNames = regionProperties(runTime).names(); - wordHashSet names; - forAllConstIters(rp, iter) - { - names.insert(iter.object()); - } - - regionNames = names.sortedToc(); + Info<< "Decomposing all regions in regionProperties" << nl + << " " << flatOutput(regionNames) << nl << endl; } else { - regionNames = {fvMesh::defaultRegion}; - args.readIfPresent("region", regionNames[0]); + regionNames.resize(1); + regionNames.first() = + args.lookupOrDefault<word>("region", fvMesh::defaultRegion); } diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/getTimeIndex.H b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/getTimeIndex.H index 91c718994f16c21fe2d336039b046049852551dc..8ce3150b75672bbc0c3c1739f3e5f08e6b0c9729 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/getTimeIndex.H +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/getTimeIndex.H @@ -29,7 +29,7 @@ io.readOpt() = IOobject::MUST_READ_IF_MODIFIED; IOdictionary timeObject(io); - timeObject.lookup("index") >> timeIndex; + timeObject.readEntry("index", timeIndex); } else { diff --git a/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/CMakeLists-Project.txt b/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/CMakeLists-Project.txt index f5b7e80988049a0f40a2347797cffa5bbd0c4709..0adeba5198324474a49bca71f9fbf1fdede1b70e 100644 --- a/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/CMakeLists-Project.txt +++ b/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/CMakeLists-Project.txt @@ -8,6 +8,7 @@ link_directories( include_directories( ${LIB_SRC}/OpenFOAM/lnInclude ${LIB_SRC}/OSspecific/${WM_OSTYPE}/lnInclude + ${LIB_SRC}/fileFormats/lnInclude ${LIB_SRC}/conversion/lnInclude ${LIB_SRC}/finiteArea/lnInclude ${LIB_SRC}/finiteVolume/lnInclude @@ -19,6 +20,7 @@ set(OPENFOAM_LIBRARIES OpenFOAM finiteVolume finiteArea + fileFormats conversion ) diff --git a/applications/utilities/postProcessing/postProcess/postProcess.C b/applications/utilities/postProcessing/postProcess/postProcess.C index 89deb92640e85e470406be3d72a772ea5082e995..f0a2b99b6483deb399ef860de6bec3b7970441a7 100644 --- a/applications/utilities/postProcessing/postProcess/postProcess.C +++ b/applications/utilities/postProcessing/postProcess/postProcess.C @@ -157,11 +157,11 @@ int main(int argc, char *argv[]) functionObjects::fileFieldSelection fields(mesh); if (args.found("fields")) { - args.lookup("fields")() >> fields; + fields.insert(args.getList<wordRe>("fields")); } if (args.found("field")) { - fields.insert(args.lookup("field")()); + fields.insert(args.opt<wordRe>("field")); } // Externally stored dictionary for functionObjectList diff --git a/applications/utilities/preProcessing/createZeroDirectory/caseInfo.C b/applications/utilities/preProcessing/createZeroDirectory/caseInfo.C index efb0cce16b245bf4f825983412772798e30733aa..65c2fea2506181c4c93940e1c4f2d18db84e9bc0 100644 --- a/applications/utilities/preProcessing/createZeroDirectory/caseInfo.C +++ b/applications/utilities/preProcessing/createZeroDirectory/caseInfo.C @@ -129,9 +129,9 @@ Foam::caseInfo::caseInfo(const Time& runTime, const word& regionName) forAll(conditionNames_, i) { const dictionary& dict = bcDict_.subDict(conditionNames_[i]); - dict.lookup("category") >> patchCategories_[i]; - dict.lookup("type") >> patchTypes_[i]; - dict.lookup("patches") >> patchNames_[i]; + dict.readEntry("category", patchCategories_[i]); + dict.readEntry("type", patchTypes_[i]); + dict.readEntry("patches", patchNames_[i]); } updateGeometricBoundaryField(); diff --git a/applications/utilities/preProcessing/createZeroDirectory/solverTemplate.C b/applications/utilities/preProcessing/createZeroDirectory/solverTemplate.C index 678c1e5b493eacde0407ca10f9f5fe8c1c6522cc..0c85961e7e65a43b8629c0c31c2751a42b7698a9 100644 --- a/applications/utilities/preProcessing/createZeroDirectory/solverTemplate.C +++ b/applications/utilities/preProcessing/createZeroDirectory/solverTemplate.C @@ -217,7 +217,7 @@ void Foam::solverTemplate::setRegionProperties const word& fieldName = fieldNames_[regionI][i]; const dictionary& dict = fieldDict.subDict(fieldName); - dict.lookup("type") >> fieldTypes_[regionI][i]; + dict.readEntry("type", fieldTypes_[regionI][i]); fieldDimensions_[regionI].set ( i, diff --git a/applications/utilities/preProcessing/mapFields/mapFields.C b/applications/utilities/preProcessing/mapFields/mapFields.C index 75afb798bc04cdc7909e5d14313b8bc82bc6631b..d6fe3578544ede6ac67b1579b2491cd1550bf872 100644 --- a/applications/utilities/preProcessing/mapFields/mapFields.C +++ b/applications/utilities/preProcessing/mapFields/mapFields.C @@ -361,8 +361,8 @@ int main(int argc, char *argv[]) ) ); - mapFieldsDict.lookup("patchMap") >> patchMap; - mapFieldsDict.lookup("cuttingPatches") >> cuttingPatches; + mapFieldsDict.readEntry("patchMap", patchMap); + mapFieldsDict.readEntry("cuttingPatches", cuttingPatches); } if (parallelSource && !parallelTarget) diff --git a/applications/utilities/preProcessing/mapFieldsPar/mapFieldsPar.C b/applications/utilities/preProcessing/mapFieldsPar/mapFieldsPar.C index 0d30bacc7827bfaf2cedc413ba5851ec778b829a..09ba335ea68e120a32dce35a4958792eb18f79c3 100644 --- a/applications/utilities/preProcessing/mapFieldsPar/mapFieldsPar.C +++ b/applications/utilities/preProcessing/mapFieldsPar/mapFieldsPar.C @@ -313,8 +313,8 @@ int main(int argc, char *argv[]) ) ); - mapFieldsDict.lookup("patchMap") >> patchMap; - mapFieldsDict.lookup("cuttingPatches") >> cuttingPatches; + mapFieldsDict.readEntry("patchMap", patchMap); + mapFieldsDict.readEntry("cuttingPatches", cuttingPatches); } #include "setTimeIndex.H" diff --git a/applications/utilities/surface/surfaceFeatureExtract/extractionMethod/extractFromFile.C b/applications/utilities/surface/surfaceFeatureExtract/extractionMethod/extractFromFile.C index 7cb51d0ccf1d70d7d50ad75c90266637ddf5dbcf..1287e1fba7fc614e0e902ee8a09618adf9c9134b 100644 --- a/applications/utilities/surface/surfaceFeatureExtract/extractionMethod/extractFromFile.C +++ b/applications/utilities/surface/surfaceFeatureExtract/extractionMethod/extractFromFile.C @@ -56,7 +56,7 @@ Foam::surfaceFeaturesExtraction::extractFromFile::extractFromFile const dictionary& coeffDict = dict.optionalSubDict("extractFromFileCoeffs"); - coeffDict.lookup("featureEdgeFile") >> featureEdgeFile_; + coeffDict.readEntry("featureEdgeFile", featureEdgeFile_); coeffDict.readIfPresent("geometricTestOnly", geometricTestOnly_); } diff --git a/applications/utilities/surface/surfaceFeatureExtract/extractionMethod/extractFromSurface.C b/applications/utilities/surface/surfaceFeatureExtract/extractionMethod/extractFromSurface.C index 6635a95a3e4dcd04db067b1b809ca3aa1ff5978d..9be509f85fbaea7f4beb2bef6d5a7459e8fab1a4 100644 --- a/applications/utilities/surface/surfaceFeatureExtract/extractionMethod/extractFromSurface.C +++ b/applications/utilities/surface/surfaceFeatureExtract/extractionMethod/extractFromSurface.C @@ -55,7 +55,7 @@ Foam::surfaceFeaturesExtraction::extractFromSurface::extractFromSurface const dictionary& coeffDict = dict.optionalSubDict("extractFromSurfaceCoeffs"); - coeffDict.lookup("includedAngle") >> includedAngle_; + coeffDict.readEntry("includedAngle", includedAngle_); coeffDict.readIfPresent("geometricTestOnly", geometricTestOnly_); } diff --git a/etc/codeTemplates/functionObject/FUNCTIONOBJECT.C b/etc/codeTemplates/functionObject/FUNCTIONOBJECT.C index a862aadf3b6257bba6e2f5b9c32ab8e2b4bb96b9..3accc508acf429f0985d8b2ba930baeef8204091 100644 --- a/etc/codeTemplates/functionObject/FUNCTIONOBJECT.C +++ b/etc/codeTemplates/functionObject/FUNCTIONOBJECT.C @@ -51,8 +51,8 @@ Foam::functionObjects::FUNCTIONOBJECT::FUNCTIONOBJECT : fvMeshFunctionObject(name, runTime, dict), wordData_(dict.lookupOrDefault<word>("wordData", "defaultWord")), - scalarData_(readScalar(dict.lookup("scalarData"))), - labelData_(readLabel(dict.lookup("labelData"))) + scalarData_(dict.get<scalar>("scalarData")), + labelData_(dict.get<label>("labelData")) { read(dict); } @@ -69,8 +69,9 @@ Foam::functionObjects::FUNCTIONOBJECT::~FUNCTIONOBJECT() bool Foam::functionObjects::FUNCTIONOBJECT::read(const dictionary& dict) { dict.readIfPresent("wordData", wordData_); - dict.lookup("scalarData") >> scalarData_; - dict.lookup("labelData") >> labelData_; + + dict.readEntry("scalarData", scalarData_); + dict.readEntry("labelData", labelData_); return true; } diff --git a/src/OpenFOAM/db/Time/instant/Instant.C b/src/OpenFOAM/db/Time/instant/Instant.C new file mode 100644 index 0000000000000000000000000000000000000000..7963c97e63415e137e77622a598270877e2c1276 --- /dev/null +++ b/src/OpenFOAM/db/Time/instant/Instant.C @@ -0,0 +1,119 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2018 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + 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. + + 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 with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "Instant.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template<class T> +Foam::Instant<T>::Instant() +: + val_(0), + key_() +{} + + +template<class T> +Foam::Instant<T>::Instant::Instant(scalar val, const T& key) +: + val_(val), + key_(key) +{} + + +template<class T> +Foam::Instant<T>::Instant::Instant(scalar val, T&& key) +: + val_(val), + key_(std::move(key)) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class T> +bool Foam::Instant<T>::equal(scalar val) const +{ + return ((val_ > val - SMALL) && (val_ < val + SMALL)); +} + + +template<class T> +template<class T2> +bool Foam::Instant<T>::equal(const Instant<T2>& other) const +{ + return this->equal(other.value()); +} + + +// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * // + +template<class T1, class T2> +bool Foam::operator==(const Instant<T1>& a, const Instant<T2>& b) +{ + return a.equal(b.value()); +} + + +template<class T1, class T2> +bool Foam::operator!=(const Instant<T1>& a, const Instant<T2>& b) +{ + return !a.equal(b.value()); +} + + +template<class T1, class T2> +bool Foam::operator<(const Instant<T1>& a, const Instant<T2>& b) +{ + return a.value() < b.value(); +} + + +template<class T1, class T2> +bool Foam::operator>(const Instant<T1>& a, const Instant<T2>& b) +{ + return a.value() > b.value(); +} + + +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // + +template<class T> +Foam::Istream& Foam::operator>>(Istream& is, Instant<T>& inst) +{ + is >> inst.value() >> inst.name(); + return is; +} + + +template<class T> +Foam::Ostream& Foam::operator<<(Ostream& os, const Instant<T>& inst) +{ + os << inst.value() << '\t' << inst.name(); + return os; +} + + +// ************************************************************************* // diff --git a/src/OpenFOAM/db/Time/instant/Instant.H b/src/OpenFOAM/db/Time/instant/Instant.H new file mode 100644 index 0000000000000000000000000000000000000000..8291714a5d0878dbeb5e74b83af8f8c6e8bfd9eb --- /dev/null +++ b/src/OpenFOAM/db/Time/instant/Instant.H @@ -0,0 +1,179 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2018 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + 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. + + 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 with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::Instant + +Description + A tuple of value and key. + The value often corresponds to a time value, thus the naming of the class. + The key will usually be a time name or a file name etc. + +SourceFiles + Instant.C + +\*---------------------------------------------------------------------------*/ + +#ifndef Instant_H +#define Instant_H + +#include "scalar.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class Instant Declaration +\*---------------------------------------------------------------------------*/ + +template<class T> +class Instant +{ + // Private Data + + //- The value (eg, time) + scalar val_; + + //- The name/key + T key_; + + +public: + + // Public classes + + //- Less function for sorting + struct less + { + bool operator()(const Instant& a, const Instant& b) const + { + return a.value() < b.value(); + } + }; + + + // Constructors + + //- Construct null, with value = 0. + Instant(); + + //- Copy construct from components + Instant(scalar val, const T& key); + + //- Move construct from components + Instant(scalar val, T&& key); + + //- Copy construct + Instant(const Instant&) = default; + + //- Move construct + Instant(Instant&&) = default; + + + // Member Functions + + //- The value (const access) + scalar value() const + { + return val_; + } + + //- The value (non-const access) + scalar& value() + { + return val_; + } + + //- The name/key (const access) + const T& name() const + { + return key_; + } + + //- The name/key (non-const access) + T& name() + { + return key_; + } + + //- True if values are equal (includes SMALL for rounding) + bool equal(scalar val) const; + + //- True if values are equal (includes SMALL for rounding) + template<class T2> + bool equal(const Instant<T2>& other) const; + + + // Operators + + //- Copy assignment + Instant& operator=(const Instant&) = default; + + //- Move assignment + Instant& operator=(Instant&&) = default; +}; + + +// IOstream Operators + +template<class T> Istream& operator>>(Istream& is, Instant<T>& inst); +template<class T> Ostream& operator<<(Ostream& os, const Instant<T>& inst); + + +// Global Operators + +//- Compare instant values for equality +template<class T1, class T2> +bool operator==(const Instant<T1>& a, const Instant<T2>& b); + +//- Compare instant values for inequality +template<class T1, class T2> +bool operator!=(const Instant<T1>& a, const Instant<T2>& b); + +//- Compare instant values for less-than +template<class T1, class T2> +bool operator<(const Instant<T1>& a, const Instant<T2>& b); + +//- Compare instant values for greater-than +template<class T1, class T2> +bool operator>(const Instant<T1>& a, const Instant<T2>& b); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "Instant.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/db/Time/instant/fileNameInstant.H b/src/OpenFOAM/db/Time/instant/fileNameInstant.H new file mode 100644 index 0000000000000000000000000000000000000000..8391d9591b41297d3bbe4713b7faa3cf7b2d3a32 --- /dev/null +++ b/src/OpenFOAM/db/Time/instant/fileNameInstant.H @@ -0,0 +1,50 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2018 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + 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. + + 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 with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Typedef + Foam::fileNameInstant + +Description + A tuple of value and fileName. + +\*---------------------------------------------------------------------------*/ + +#ifndef fileNameInstant_H +#define fileNameInstant_H + +#include "fileName.H" +#include "Instant.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef Instant<fileName> fileNameInstant; + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/db/Time/instant/instant.C b/src/OpenFOAM/db/Time/instant/instant.C index 0e3232efb64eef4de7dcc56dd6420a7bb88bbdcc..e59d65d12597aed4a3255a53202516896d5821d4 100644 --- a/src/OpenFOAM/db/Time/instant/instant.C +++ b/src/OpenFOAM/db/Time/instant/instant.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. @@ -23,8 +23,9 @@ License \*---------------------------------------------------------------------------*/ -#include "instantList.H" +#include "instant.H" #include "Time.H" +#include <cstdlib> // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -33,81 +34,22 @@ const char* const Foam::instant::typeName = "instant"; // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::instant::instant() -{} - - -Foam::instant::instant(const scalar val, const word& tname) +Foam::instant::instant(scalar timeValue) : - value_(val), - name_(tname) + Instant<word>(timeValue, Time::timeName(timeValue)) {} -Foam::instant::instant(const scalar val) +Foam::instant::instant(const word& timeName) : - value_(val), - name_(Time::timeName(val)) + Instant<word>(std::atof(timeName.c_str()), timeName) {} -Foam::instant::instant(const word& tname) +Foam::instant::instant(word&& timeName) : - value_(atof(tname.c_str())), - name_(tname) + Instant<word>(std::atof(timeName.c_str()), std::move(timeName)) {} -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -bool Foam::instant::equal(const scalar val) const -{ - return ((value_ > val - SMALL) && (value_ < val + SMALL)); -} - - -// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * // - -bool Foam::operator==(const instant& a, const instant& b) -{ - return a.equal(b.value()); -} - - -bool Foam::operator!=(const instant& a, const instant& b) -{ - return !a.equal(b.value()); -} - - -bool Foam::operator<(const instant& a, const instant& b) -{ - return a.value() < b.value(); -} - - -bool Foam::operator>(const instant& a, const instant& b) -{ - return a.value() > b.value(); -} - - -// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // - -Foam::Istream& Foam::operator>>(Istream& is, instant& inst) -{ - is >> inst.value_ >> inst.name_; - - return is; -} - - -Foam::Ostream& Foam::operator<<(Ostream& os, const instant& inst) -{ - os << inst.value() << tab << inst.name(); - - return os; -} - - // ************************************************************************* // diff --git a/src/OpenFOAM/db/Time/instant/instant.H b/src/OpenFOAM/db/Time/instant/instant.H index 72ceea24979cc9b48e2d182152f608db0b4e727a..23453f0588836111bff5c29eea35cb9b6a9e542c 100644 --- a/src/OpenFOAM/db/Time/instant/instant.H +++ b/src/OpenFOAM/db/Time/instant/instant.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 | + \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -36,113 +36,62 @@ SourceFiles #define instant_H #include "word.H" -#include "scalar.H" +#include "Instant.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { -// Forward declarations -class instant; - -Istream& operator>>(Istream& is, instant& inst); -Ostream& operator<<(Ostream& os, const instant& inst); - - /*---------------------------------------------------------------------------*\ Class instant Declaration \*---------------------------------------------------------------------------*/ class instant +: + public Instant<word> { - // Private data - - scalar value_; - - word name_; - public: - // Public classes - - //- Less function class used in sorting instants - class less - { - public: - - bool operator()(const instant& a, const instant& b) const - { - return a.value() < b.value(); - } - }; - - - // Static data members + // Static Data Members static const char* const typeName; // Constructors - //- Construct null - instant(); - - //- Construct from components - instant(const scalar val, const word& tname); - - //- Construct from time value - explicit instant(const scalar val); + //- Copy and move construct from components + using Instant<word>::Instant; - //- Construct from time name - explicit instant(const word& tname); + //- Construct null, with time-value = 0. + instant() = default; + //- Copy construct + instant(const instant&) = default; - // Member Functions + //- Move construct + instant(instant&&) = default; - //- Value (const access) - scalar value() const - { - return value_; - } + //- Construct from timeValue, auto generating the name + explicit instant(scalar timeValue); - //- Value (non-const access) - scalar& value() - { - return value_; - } + //- Construct from timeName, parsing timeName for a value + explicit instant(const word& timeName); - //- Name (const access) - const word& name() const - { - return name_; - } + //- Construct from timeName, parsing timeName for a value + explicit instant(word&& timeName); - //- Name (non-const access) - word& name() - { - return name_; - } - //- Compare instant values to be equal (includes SMALL for rounding) - bool equal(const scalar val) const; + // Operators + //- Copy assignment + instant& operator=(const instant&) = default; - // IOstream Operators + //- Move assignment + instant& operator=(instant&&) = default; - friend Istream& operator>>(Istream& is, instant& inst); - friend Ostream& operator<<(Ostream& os, const instant& inst); }; - -// Global Operators - -bool operator==(const instant& a, const instant& b); -bool operator!=(const instant& a, const instant& b); -bool operator<(const instant& a, const instant& b); -bool operator>(const instant& a, const instant& b); - - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/OpenFOAM/db/dictionary/dictionary.C b/src/OpenFOAM/db/dictionary/dictionary.C index 580744d06cea2a470fedff5fce39995ee0eeb8cc..125c73e127941f86ab595f1ed1a1ef8597fe20b2 100644 --- a/src/OpenFOAM/db/dictionary/dictionary.C +++ b/src/OpenFOAM/db/dictionary/dictionary.C @@ -48,24 +48,59 @@ bool Foam::dictionary::writeOptionalEntries // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -void Foam::dictionary::excessTokens +void Foam::dictionary::checkITstream ( const word& keyword, const ITstream& is ) const { - const label nExcess = is.nRemainingTokens(); - - if (!nExcess) + if (is.nRemainingTokens()) { - return; - } + const label remaining = is.nRemainingTokens(); + + // Similar to SafeFatalIOError + if (JobInfo::constructed) + { + OSstream& err = + FatalIOError + ( + "", // functionName + "", // sourceFileName + 0, // sourceFileLineNumber + this->name(), // ioFileName + is.lineNumber() // ioStartLineNumber + ); + + err << "'" << keyword << "' has " + << remaining << " 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 " + << remaining << " excess tokens in stream" << nl << nl; - // Similar to SafeFatalIOError + std::cerr + << "file: " << this->name() + << " at line " << is.lineNumber() << '.' << nl + << std::endl; - if (JobInfo::constructed) + ::exit(1); + } + } + else if (!is.size()) { - OSstream& err = + // Similar to SafeFatalIOError + if (JobInfo::constructed) + { FatalIOError ( "", // functionName @@ -73,31 +108,24 @@ void Foam::dictionary::excessTokens 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; + ) + << "'" << keyword << "' had no tokens in stream" << nl << nl + << exit(FatalIOError); + } + else + { + std::cerr + << nl + << "--> FOAM FATAL IO ERROR:" << nl + << "'" << keyword << "' had no tokens in stream" << nl << nl; - std::cerr - << "file: " << this->name() - << " at line " << is.lineNumber() << '.' << nl - << std::endl; + std::cerr + << "file: " << this->name() + << " at line " << is.lineNumber() << '.' << nl + << std::endl; - ::exit(1); + ::exit(1); + } } } diff --git a/src/OpenFOAM/db/dictionary/dictionary.H b/src/OpenFOAM/db/dictionary/dictionary.H index 384efa081b72b0428486c6e1d380519931ad37ac..dafb0b5179c2315106cca2438ff0b62736b80f4c 100644 --- a/src/OpenFOAM/db/dictionary/dictionary.H +++ b/src/OpenFOAM/db/dictionary/dictionary.H @@ -383,8 +383,10 @@ private: ) const; - //- Emit FatalIOError if excess tokens exist - void excessTokens(const word& keyword, const ITstream& is) const; + //- Check after reading if the input token stream has unconsumed + //- tokens remaining or if there were no tokens in the first place. + // Emits FatalIOError + void checkITstream(const word& keyword, const ITstream& is) const; public: diff --git a/src/OpenFOAM/db/dictionary/dictionaryTemplates.C b/src/OpenFOAM/db/dictionary/dictionaryTemplates.C index 95cd8ab8a720f5c0ea7b7651b45506d3553ba23b..fab47e648891b2e09ac68aef6cdeac7a22543bae 100644 --- a/src/OpenFOAM/db/dictionary/dictionaryTemplates.C +++ b/src/OpenFOAM/db/dictionary/dictionaryTemplates.C @@ -97,7 +97,7 @@ bool Foam::dictionary::readCompat ITstream& is = finder.ptr()->stream(); is >> val; - excessTokens(keyword, is); + checkITstream(keyword, is); return true; } @@ -144,7 +144,7 @@ T Foam::dictionary::lookupOrDefault ITstream& is = finder.ptr()->stream(); is >> val; - excessTokens(keyword, is); + checkITstream(keyword, is); return val; } @@ -178,7 +178,7 @@ T Foam::dictionary::lookupOrAddDefault ITstream& is = finder.ptr()->stream(); is >> val; - excessTokens(keyword, is); + checkITstream(keyword, is); return val; } @@ -212,7 +212,7 @@ bool Foam::dictionary::readEntry ITstream& is = finder.ptr()->stream(); is >> val; - excessTokens(keyword, is); + checkITstream(keyword, is); return true; } @@ -262,7 +262,7 @@ T Foam::dictionary::lookupOrDefaultCompat ITstream& is = finder.ptr()->stream(); is >> val; - excessTokens(keyword, is); + checkITstream(keyword, is); return val; } diff --git a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.C b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.C index 305768d711e338f33a0c9422ef03a1c261070670..09e89bc28a9c5fc8a96ff75252c536f0a28d6281 100644 --- a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.C +++ b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.C @@ -28,12 +28,7 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -namespace Foam -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -// check mesh for two fields +// Check mesh for two fields #define checkField(df1, df2, op) \ if (&(df1).mesh() != &(df2).mesh()) \ { \ @@ -69,7 +64,7 @@ void Foam::DimensionedField<Type, GeoMesh>::checkFieldSize() const // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template<class Type, class GeoMesh> -DimensionedField<Type, GeoMesh>::DimensionedField +Foam::DimensionedField<Type, GeoMesh>::DimensionedField ( const IOobject& io, const Mesh& mesh, @@ -88,7 +83,26 @@ DimensionedField<Type, GeoMesh>::DimensionedField template<class Type, class GeoMesh> -DimensionedField<Type, GeoMesh>::DimensionedField +Foam::DimensionedField<Type, GeoMesh>::DimensionedField +( + const IOobject& io, + const Mesh& mesh, + const dimensionSet& dims, + Field<Type>&& field +) +: + regIOobject(io), + Field<Type>(std::move(field)), + mesh_(mesh), + dimensions_(dims) +{ + //Info<<"Move construct dimensioned for " << io.name() << nl; + checkFieldSize(); +} + + +template<class Type, class GeoMesh> +Foam::DimensionedField<Type, GeoMesh>::DimensionedField ( const IOobject& io, const Mesh& mesh, @@ -101,12 +115,13 @@ DimensionedField<Type, GeoMesh>::DimensionedField mesh_(mesh), dimensions_(dims) { + //Info<<"Move construct dimensioned for " << io.name() << nl; checkFieldSize(); } template<class Type, class GeoMesh> -DimensionedField<Type, GeoMesh>::DimensionedField +Foam::DimensionedField<Type, GeoMesh>::DimensionedField ( const IOobject& io, const Mesh& mesh, @@ -128,7 +143,7 @@ DimensionedField<Type, GeoMesh>::DimensionedField template<class Type, class GeoMesh> -DimensionedField<Type, GeoMesh>::DimensionedField +Foam::DimensionedField<Type, GeoMesh>::DimensionedField ( const IOobject& io, const Mesh& mesh, @@ -150,7 +165,7 @@ DimensionedField<Type, GeoMesh>::DimensionedField template<class Type, class GeoMesh> -DimensionedField<Type, GeoMesh>::DimensionedField +Foam::DimensionedField<Type, GeoMesh>::DimensionedField ( const DimensionedField<Type, GeoMesh>& df ) @@ -164,7 +179,7 @@ DimensionedField<Type, GeoMesh>::DimensionedField template<class Type, class GeoMesh> -DimensionedField<Type, GeoMesh>::DimensionedField +Foam::DimensionedField<Type, GeoMesh>::DimensionedField ( DimensionedField<Type, GeoMesh>& df, bool reuse @@ -179,7 +194,7 @@ DimensionedField<Type, GeoMesh>::DimensionedField template<class Type, class GeoMesh> -DimensionedField<Type, GeoMesh>::DimensionedField +Foam::DimensionedField<Type, GeoMesh>::DimensionedField ( DimensionedField<Type, GeoMesh>&& df ) @@ -194,7 +209,7 @@ DimensionedField<Type, GeoMesh>::DimensionedField #ifndef NoConstructFromTmp template<class Type, class GeoMesh> -DimensionedField<Type, GeoMesh>::DimensionedField +Foam::DimensionedField<Type, GeoMesh>::DimensionedField ( const tmp<DimensionedField<Type, GeoMesh>>& tdf ) @@ -211,7 +226,7 @@ DimensionedField<Type, GeoMesh>::DimensionedField template<class Type, class GeoMesh> -DimensionedField<Type, GeoMesh>::DimensionedField +Foam::DimensionedField<Type, GeoMesh>::DimensionedField ( const IOobject& io, const DimensionedField<Type, GeoMesh>& df @@ -226,7 +241,7 @@ DimensionedField<Type, GeoMesh>::DimensionedField template<class Type, class GeoMesh> -DimensionedField<Type, GeoMesh>::DimensionedField +Foam::DimensionedField<Type, GeoMesh>::DimensionedField ( const IOobject& io, DimensionedField<Type, GeoMesh>& df, @@ -242,7 +257,7 @@ DimensionedField<Type, GeoMesh>::DimensionedField template<class Type, class GeoMesh> -DimensionedField<Type, GeoMesh>::DimensionedField +Foam::DimensionedField<Type, GeoMesh>::DimensionedField ( const word& newName, const DimensionedField<Type, GeoMesh>& df @@ -257,7 +272,7 @@ DimensionedField<Type, GeoMesh>::DimensionedField template<class Type, class GeoMesh> -DimensionedField<Type, GeoMesh>::DimensionedField +Foam::DimensionedField<Type, GeoMesh>::DimensionedField ( const word& newName, DimensionedField<Type, GeoMesh>& df, @@ -273,7 +288,7 @@ DimensionedField<Type, GeoMesh>::DimensionedField template<class Type, class GeoMesh> -DimensionedField<Type, GeoMesh>::DimensionedField +Foam::DimensionedField<Type, GeoMesh>::DimensionedField ( const word& newName, DimensionedField<Type, GeoMesh>&& df @@ -289,7 +304,7 @@ DimensionedField<Type, GeoMesh>::DimensionedField #ifndef NoConstructFromTmp template<class Type, class GeoMesh> -DimensionedField<Type, GeoMesh>::DimensionedField +Foam::DimensionedField<Type, GeoMesh>::DimensionedField ( const word& newName, const tmp<DimensionedField<Type, GeoMesh>>& tdf @@ -307,63 +322,54 @@ DimensionedField<Type, GeoMesh>::DimensionedField template<class Type, class GeoMesh> -tmp<DimensionedField<Type, GeoMesh>> -DimensionedField<Type, GeoMesh>::clone() const +Foam::tmp<Foam::DimensionedField<Type, GeoMesh>> +Foam::DimensionedField<Type, GeoMesh>::clone() const { - return tmp<DimensionedField<Type, GeoMesh>> - ( - new DimensionedField<Type, GeoMesh>(*this) - ); + return tmp<DimensionedField<Type, GeoMesh>>::New(*this); } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template<class Type, class GeoMesh> -DimensionedField<Type, GeoMesh>::~DimensionedField() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Type, class GeoMesh> -tmp +Foam::tmp < - DimensionedField - <typename DimensionedField<Type, GeoMesh>::cmptType, GeoMesh> + Foam::DimensionedField + < + typename Foam::DimensionedField<Type, GeoMesh>::cmptType, GeoMesh + > > -DimensionedField<Type, GeoMesh>::component +Foam::DimensionedField<Type, GeoMesh>::component ( const direction d ) const { - tmp<DimensionedField<cmptType, GeoMesh>> result + auto tresult = tmp<DimensionedField<cmptType, GeoMesh>>::New ( - new DimensionedField<cmptType, GeoMesh> + IOobject ( - IOobject - ( - name() + ".component(" + ::Foam::name(d) + ')', - instance(), - db() - ), - mesh_, - dimensions_ - ) + name() + ".component(" + ::Foam::name(d) + ')', + instance(), + db() + ), + mesh_, + dimensions_ ); - Foam::component(result(), *this, d); + Foam::component(tresult(), *this, d); - return result; + return tresult; } template<class Type, class GeoMesh> -void DimensionedField<Type, GeoMesh>::replace +void Foam::DimensionedField<Type, GeoMesh>::replace ( const direction d, const DimensionedField - <typename DimensionedField<Type, GeoMesh>::cmptType, GeoMesh>& df + < + typename DimensionedField<Type, GeoMesh>::cmptType, GeoMesh + >& df ) { Field<Type>::replace(d, df); @@ -371,13 +377,15 @@ void DimensionedField<Type, GeoMesh>::replace template<class Type, class GeoMesh> -void DimensionedField<Type, GeoMesh>::replace +void Foam::DimensionedField<Type, GeoMesh>::replace ( const direction d, const tmp < DimensionedField - <typename DimensionedField<Type, GeoMesh>::cmptType, GeoMesh> + < + typename DimensionedField<Type, GeoMesh>::cmptType, GeoMesh + > >& tdf ) { @@ -387,78 +395,72 @@ void DimensionedField<Type, GeoMesh>::replace template<class Type, class GeoMesh> -tmp<DimensionedField<Type, GeoMesh>> -DimensionedField<Type, GeoMesh>::T() const +Foam::tmp<Foam::DimensionedField<Type, GeoMesh>> +Foam::DimensionedField<Type, GeoMesh>::T() const { - tmp<DimensionedField<Type, GeoMesh>> result + auto tresult = tmp<DimensionedField<Type, GeoMesh>>::New ( - new DimensionedField<Type, GeoMesh> + IOobject ( - IOobject - ( - name() + ".T()", - instance(), - db() - ), - mesh_, - dimensions_ - ) + name() + ".T()", + instance(), + db() + ), + mesh_, + dimensions_ ); - Foam::T(result(), *this); + Foam::T(tresult(), *this); - return result; + return tresult; } template<class Type, class GeoMesh> -dimensioned<Type> DimensionedField<Type, GeoMesh>::average() const +Foam::dimensioned<Type> Foam::DimensionedField<Type, GeoMesh>::average() const { - dimensioned<Type> Average - ( - this->name() + ".average()", - this->dimensions(), - gAverage(field()) - ); - - return Average; + return + dimensioned<Type> + ( + this->name() + ".average()", + this->dimensions(), + gAverage(field()) + ); } template<class Type, class GeoMesh> -dimensioned<Type> DimensionedField<Type, GeoMesh>::weightedAverage +Foam::dimensioned<Type> Foam::DimensionedField<Type, GeoMesh>::weightedAverage ( const DimensionedField<scalar, GeoMesh>& weightField ) const { return - ( dimensioned<Type> ( this->name() + ".weightedAverage(weights)", this->dimensions(), gSum(weightField*field())/gSum(weightField) - ) - ); + ); } template<class Type, class GeoMesh> -dimensioned<Type> DimensionedField<Type, GeoMesh>::weightedAverage +Foam::dimensioned<Type> Foam::DimensionedField<Type, GeoMesh>::weightedAverage ( const tmp<DimensionedField<scalar, GeoMesh>>& tweightField ) const { - dimensioned<Type> wa = weightedAverage(tweightField()); + dimensioned<Type> result = weightedAverage(tweightField()); tweightField.clear(); - return wa; + return result; } // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // template<class Type, class GeoMesh> -void DimensionedField<Type, GeoMesh>::operator= +void Foam::DimensionedField<Type, GeoMesh>::operator= ( const DimensionedField<Type, GeoMesh>& df ) @@ -480,7 +482,7 @@ void DimensionedField<Type, GeoMesh>::operator= template<class Type, class GeoMesh> -void DimensionedField<Type, GeoMesh>::operator= +void Foam::DimensionedField<Type, GeoMesh>::operator= ( const tmp<DimensionedField<Type, GeoMesh>>& tdf ) @@ -505,7 +507,7 @@ void DimensionedField<Type, GeoMesh>::operator= template<class Type, class GeoMesh> -void DimensionedField<Type, GeoMesh>::operator= +void Foam::DimensionedField<Type, GeoMesh>::operator= ( const dimensioned<Type>& dt ) @@ -518,7 +520,7 @@ void DimensionedField<Type, GeoMesh>::operator= #define COMPUTED_ASSIGNMENT(TYPE, op) \ \ template<class Type, class GeoMesh> \ -void DimensionedField<Type, GeoMesh>::operator op \ +void Foam::DimensionedField<Type, GeoMesh>::operator op \ ( \ const DimensionedField<TYPE, GeoMesh>& df \ ) \ @@ -531,7 +533,7 @@ void DimensionedField<Type, GeoMesh>::operator op \ } \ \ template<class Type, class GeoMesh> \ -void DimensionedField<Type, GeoMesh>::operator op \ +void Foam::DimensionedField<Type, GeoMesh>::operator op \ ( \ const tmp<DimensionedField<TYPE, GeoMesh>>& tdf \ ) \ @@ -541,7 +543,7 @@ void DimensionedField<Type, GeoMesh>::operator op \ } \ \ template<class Type, class GeoMesh> \ -void DimensionedField<Type, GeoMesh>::operator op \ +void Foam::DimensionedField<Type, GeoMesh>::operator op \ ( \ const dimensioned<TYPE>& dt \ ) \ @@ -557,17 +559,12 @@ COMPUTED_ASSIGNMENT(scalar, /=) #undef COMPUTED_ASSIGNMENT - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #undef checkField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - #include "DimensionedFieldIO.C" #include "DimensionedFieldFunctions.C" diff --git a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.H b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.H index 6fbeeb80ac87f66ff0bad46a6e57e2a29c8db970..23d721f203005b63389b900dac1db0d717a28c01 100644 --- a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.H +++ b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.H @@ -75,10 +75,9 @@ class DimensionedField public regIOobject, public Field<Type> { - public: - // Public typedefs + // Public Typedefs //- Type of mesh on which this DimensionedField is instantiated typedef typename GeoMesh::Mesh Mesh; @@ -120,7 +119,7 @@ public: // Static Member Functions - //- Return a null DimensionedField + //- Return a NullObjectRef DimensionedField inline static const DimensionedField<Type, GeoMesh>& null(); @@ -135,7 +134,16 @@ public: const Field<Type>& field ); - //- Construct from components, transferring the initial field content + //- Construct from components, transferring initial field content + DimensionedField + ( + const IOobject& io, + const Mesh& mesh, + const dimensionSet& dims, + Field<Type>&& field + ); + + //- Construct from components, transferring initial field content DimensionedField ( const IOobject& io, @@ -261,7 +269,7 @@ public: //- Destructor - virtual ~DimensionedField(); + virtual ~DimensionedField() = default; // Member Functions diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C index ea2091d26befc3b9cdb6082b3adff80e45595277..d6fbc678db75a10bfc7e38f7c6b4b703478280b2 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C @@ -55,15 +55,15 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::readFields boundaryField_.readField(*this, dict.subDict("boundaryField")); - if (dict.found("referenceLevel")) - { - Type fieldAverage(pTraits<Type>(dict.lookup("referenceLevel"))); + Type refLevel; - Field<Type>::operator+=(fieldAverage); + if (dict.readIfPresent("referenceLevel", refLevel)) + { + Field<Type>::operator+=(refLevel); forAll(boundaryField_, patchi) { - boundaryField_[patchi] == boundaryField_[patchi] + fieldAverage; + boundaryField_[patchi] == boundaryField_[patchi] + refLevel; } } } @@ -159,11 +159,8 @@ bool Foam::GeometricField<Type, PatchField, GeoMesh>::readOldTimeIfPresent() ) ) { - if (debug) - { - InfoInFunction << "Reading old time level for field" - << endl << this->info() << endl; - } + DebugInFunction + << "Reading old time level for field" << nl << this->info() << endl; field0Ptr_ = new GeometricField<Type, PatchField, GeoMesh> ( @@ -207,10 +204,8 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField fieldPrevIterPtr_(nullptr), boundaryField_(mesh.boundary(), *this, patchFieldType) { - if (debug) - { - InfoInFunction << "Creating temporary" << endl << this->info() << endl; - } + DebugInFunction + << "Creating temporary" << nl << this->info() << endl; readIfPresent(); } @@ -232,10 +227,8 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField fieldPrevIterPtr_(nullptr), boundaryField_(mesh.boundary(), *this, patchFieldTypes, actualPatchTypes) { - if (debug) - { - InfoInFunction << "Creating temporary" << endl << this->info() << endl; - } + DebugInFunction + << "Creating temporary" << nl << this->info() << endl; readIfPresent(); } @@ -256,10 +249,8 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField fieldPrevIterPtr_(nullptr), boundaryField_(mesh.boundary(), *this, patchFieldType) { - if (debug) - { - InfoInFunction << "Creating temporary" << endl << this->info() << endl; - } + DebugInFunction + << "Creating temporary" << nl << this->info() << endl; boundaryField_ == dt.value(); @@ -283,10 +274,8 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField fieldPrevIterPtr_(nullptr), boundaryField_(mesh.boundary(), *this, patchFieldTypes, actualPatchTypes) { - if (debug) - { - InfoInFunction << "Creating temporary" << endl << this->info() << endl; - } + DebugInFunction + << "Creating temporary" << nl << this->info() << endl; boundaryField_ == dt.value(); @@ -308,11 +297,8 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField fieldPrevIterPtr_(nullptr), boundaryField_(this->mesh().boundary(), *this, ptfl) { - if (debug) - { - InfoInFunction - << "Constructing from components" << endl << this->info() << endl; - } + DebugInFunction + << "Copy construct from components" << nl << this->info() << endl; readIfPresent(); } @@ -334,11 +320,54 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField fieldPrevIterPtr_(nullptr), boundaryField_(mesh.boundary(), *this, ptfl) { - if (debug) - { - InfoInFunction - << "Constructing from components" << endl << this->info() << endl; - } + DebugInFunction + << "Copy construct from components" << nl << this->info() << endl; + + readIfPresent(); +} + + +template<class Type, template<class> class PatchField, class GeoMesh> +Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField +( + const IOobject& io, + const Mesh& mesh, + const dimensionSet& ds, + Field<Type>&& iField, + const PtrList<PatchField<Type>>& ptfl +) +: + Internal(io, mesh, ds, std::move(iField)), + timeIndex_(this->time().timeIndex()), + field0Ptr_(nullptr), + fieldPrevIterPtr_(nullptr), + boundaryField_(mesh.boundary(), *this, ptfl) +{ + DebugInFunction + << "Move construct from components" << nl << this->info() << endl; + + readIfPresent(); +} + + +template<class Type, template<class> class PatchField, class GeoMesh> +Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField +( + const IOobject& io, + const Mesh& mesh, + const dimensionSet& ds, + List<Type>&& iField, + const PtrList<PatchField<Type>>& ptfl +) +: + Internal(io, mesh, ds, std::move(iField)), + timeIndex_(this->time().timeIndex()), + field0Ptr_(nullptr), + fieldPrevIterPtr_(nullptr), + boundaryField_(mesh.boundary(), *this, ptfl) +{ + DebugInFunction + << "Move construct from components" << nl << this->info() << endl; readIfPresent(); } @@ -375,11 +404,8 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField readOldTimeIfPresent(); } - if (debug) - { - InfoInFunction - << "Finishing read-construction of" << endl << this->info() << endl; - } + DebugInFunction + << "Finishing read-construction" << nl << this->info() << endl; } @@ -409,12 +435,8 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField << exit(FatalIOError); } - if (debug) - { - InfoInFunction - << "Finishing dictionary-construct of " - << endl << this->info() << endl; - } + DebugInFunction + << "Finishing dictionary-construct" << nl << this->info() << endl; } @@ -430,11 +452,8 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField fieldPrevIterPtr_(nullptr), boundaryField_(*this, gf.boundaryField_) { - if (debug) - { - InfoInFunction - << "Constructing as copy" << endl << this->info() << endl; - } + DebugInFunction + << "Copy construct" << nl << this->info() << endl; if (gf.field0Ptr_) { @@ -461,11 +480,8 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField fieldPrevIterPtr_(nullptr), boundaryField_(*this, tgf().boundaryField_) { - if (debug) - { - InfoInFunction - << "Constructing from tmp" << endl << this->info() << endl; - } + DebugInFunction + << "Constructing from tmp" << nl << this->info() << endl; this->writeOpt() = IOobject::NO_WRITE; @@ -487,12 +503,9 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField fieldPrevIterPtr_(nullptr), boundaryField_(*this, gf.boundaryField_) { - if (debug) - { - InfoInFunction - << "Constructing as copy resetting IO params" - << endl << this->info() << endl; - } + DebugInFunction + << "Copy construct, resetting IO params" << nl + << this->info() << endl; if (!readIfPresent() && gf.field0Ptr_) { @@ -519,12 +532,9 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField fieldPrevIterPtr_(nullptr), boundaryField_(*this, tgf().boundaryField_) { - if (debug) - { - InfoInFunction - << "Constructing from tmp resetting IO params" - << endl << this->info() << endl; - } + DebugInFunction + << "Constructing from tmp resetting IO params" << nl + << this->info() << endl; tgf.clear(); @@ -546,12 +556,9 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField fieldPrevIterPtr_(nullptr), boundaryField_(*this, gf.boundaryField_) { - if (debug) - { - InfoInFunction - << "Constructing as copy resetting name" - << endl << this->info() << endl; - } + DebugInFunction + << "Copy construct, resetting name" << nl + << this->info() << endl; if (!readIfPresent() && gf.field0Ptr_) { @@ -578,12 +585,9 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField fieldPrevIterPtr_(nullptr), boundaryField_(*this, tgf().boundaryField_) { - if (debug) - { - InfoInFunction - << "Constructing from tmp resetting name" - << endl << this->info() << endl; - } + DebugInFunction + << "Constructing from tmp resetting name" << nl + << this->info() << endl; tgf.clear(); } @@ -604,12 +608,9 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField fieldPrevIterPtr_(nullptr), boundaryField_(this->mesh().boundary(), *this, patchFieldType) { - if (debug) - { - InfoInFunction - << "Constructing as copy resetting IO params" - << endl << this->info() << endl; - } + DebugInFunction + << "Copy construct, resetting IO params" << nl + << this->info() << endl; boundaryField_ == gf.boundaryField_; @@ -645,12 +646,9 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField actualPatchTypes ) { - if (debug) - { - InfoInFunction - << "Constructing as copy resetting IO params and patch types" - << endl << this->info() << endl; - } + DebugInFunction + << "Copy construct, resetting IO params and patch types" << nl + << this->info() << endl; boundaryField_ == gf.boundaryField_; @@ -687,12 +685,9 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField actualPatchTypes ) { - if (debug) - { - InfoInFunction - << "Constructing from tmp resetting IO params and patch types" - << endl << this->info() << endl; - } + DebugInFunction + << "Constructing from tmp resetting IO params and patch types" << nl + << this->info() << endl; boundaryField_ == tgf().boundaryField_; @@ -705,10 +700,7 @@ template<class Type, template<class> class PatchField, class GeoMesh> Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh>> Foam::GeometricField<Type, PatchField, GeoMesh>::clone() const { - return tmp<GeometricField<Type, PatchField, GeoMesh>> - ( - new GeometricField<Type, PatchField, GeoMesh>(*this) - ); + return tmp<GeometricField<Type, PatchField, GeoMesh>>::New(*this); } @@ -783,12 +775,8 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::storeOldTime() const { field0Ptr_->storeOldTime(); - if (debug) - { - InfoInFunction - << "Storing old time field for field" << endl - << this->info() << endl; - } + DebugInFunction + << "Storing old time field for field" << nl << this->info() << endl; *field0Ptr_ == *this; field0Ptr_->timeIndex_ = timeIndex_; @@ -871,12 +859,9 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::storePrevIter() const { if (!fieldPrevIterPtr_) { - if (debug) - { - InfoInFunction - << "Allocating previous iteration field" << endl - << this->info() << endl; - } + DebugInFunction + << "Allocating previous iteration field" << nl + << this->info() << endl; fieldPrevIterPtr_ = new GeometricField<Type, PatchField, GeoMesh> ( @@ -944,11 +929,8 @@ bool Foam::GeometricField<Type, PatchField, GeoMesh>::needReference() const template<class Type, template<class> class PatchField, class GeoMesh> void Foam::GeometricField<Type, PatchField, GeoMesh>::relax(const scalar alpha) { - if (debug) - { - InfoInFunction - << "Relaxing" << endl << this->info() << " by " << alpha << endl; - } + DebugInFunction + << "Relaxing" << nl << this->info() << " by " << alpha << endl; operator==(prevIter() + alpha*(*this - prevIter())); } @@ -1185,15 +1167,15 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::operator= const tmp<GeometricField<Type, PatchField, GeoMesh>>& tgf ) { - if (this == &(tgf())) + const auto& gf = tgf(); + + if (this == &gf) { FatalErrorInFunction << "attempted assignment to self" << abort(FatalError); } - const GeometricField<Type, PatchField, GeoMesh>& gf = tgf(); - checkField(*this, gf, "="); // Only assign field contents not ID @@ -1203,11 +1185,8 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::operator= if (tgf.movable()) { - // Transfer the storage from the tmp - primitiveFieldRef().transfer - ( - const_cast<Field<Type>&>(gf.primitiveField()) - ); + // Transfer storage from the tmp + primitiveFieldRef().transfer(tgf.constCast().primitiveFieldRef()); } else { @@ -1237,7 +1216,7 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::operator== const tmp<GeometricField<Type, PatchField, GeoMesh>>& tgf ) { - const GeometricField<Type, PatchField, GeoMesh>& gf = tgf(); + const auto& gf = tgf(); checkField(*this, gf, "=="); diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H index 202065d2a8f69e4c358389e3ba662b370888620c..b847f01c8bf40278e36d64d216aa02f2bb561376 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H @@ -298,7 +298,7 @@ public: const IOobject& io, const Mesh& mesh, const dimensionSet& ds, - const word& patchFieldType=PatchField<Type>::calculatedType() + const word& patchFieldType = PatchField<Type>::calculatedType() ); //- Construct given IOobject, mesh, dimensions and patch types. @@ -321,7 +321,7 @@ public: const IOobject& io, const Mesh& mesh, const dimensioned<Type>& dt, - const word& patchFieldType=PatchField<Type>::calculatedType() + const word& patchFieldType = PatchField<Type>::calculatedType() ); //- Construct given IOobject, mesh, dimensioned<Type> and patch types. @@ -336,7 +336,7 @@ public: const wordList& actualPatchTypes = wordList() ); - //- Constructor from components + //- Copy construct from components GeometricField ( const IOobject& io, @@ -344,7 +344,7 @@ public: const PtrList<PatchField<Type>>& ptfl ); - //- Constructor from components + //- Copy construct from components GeometricField ( const IOobject& io, @@ -354,6 +354,26 @@ public: const PtrList<PatchField<Type>>& ptfl ); + //- Construct from components, moving initial internal field + GeometricField + ( + const IOobject& io, + const Mesh& mesh, + const dimensionSet& ds, + Field<Type>&& iField, + const PtrList<PatchField<Type>>& ptfl + ); + + //- Construct from components, moving initial internal field + GeometricField + ( + const IOobject& io, + const Mesh& mesh, + const dimensionSet& ds, + List<Type>&& iField, + const PtrList<PatchField<Type>>& ptfl + ); + //- Construct and read given IOobject GeometricField ( diff --git a/src/OpenFOAM/fields/UniformDimensionedFields/UniformDimensionedField.C b/src/OpenFOAM/fields/UniformDimensionedFields/UniformDimensionedField.C index 9e722c6569a7806114fe3e9d11a15cf38c5e635b..123c3b68146614a21fd744511df5bb7eeb423b80 100644 --- a/src/OpenFOAM/fields/UniformDimensionedFields/UniformDimensionedField.C +++ b/src/OpenFOAM/fields/UniformDimensionedFields/UniformDimensionedField.C @@ -85,7 +85,7 @@ bool Foam::UniformDimensionedField<Type>::readData(Istream& is) dictionary dict(is); scalar multiplier; this->dimensions().read(dict.lookup("dimensions"), multiplier); - dict.lookup("value") >> this->value(); + dict.readEntry("value", this->value()); this->value() *= multiplier; return is.good(); diff --git a/src/OpenFOAM/global/argList/argList.C b/src/OpenFOAM/global/argList/argList.C index bb03845536a9dd571a28046414c5a197b78c3ac4..84a6736bd6abff4e444866c9a7a54b520c733758 100644 --- a/src/OpenFOAM/global/argList/argList.C +++ b/src/OpenFOAM/global/argList/argList.C @@ -202,32 +202,46 @@ static void printBuildInfo(const bool full=true) // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // -void Foam::argList::warnTrailing(const ITstream& is, const label index) +void Foam::argList::checkITstream(const ITstream& is, const label index) { - const label nExcess = is.nRemainingTokens(); + const label remaining = is.nRemainingTokens(); - if (nExcess) + if (remaining) { std::cerr << nl << "--> FOAM WARNING:" << nl << "argument " << index << " has " - << nExcess << " excess tokens" << nl << nl; + << remaining << " excess tokens" << nl << nl; + } + else if (!is.size()) + { + std::cerr + << nl + << "--> FOAM WARNING:" << nl + << "argument " << index << " had no tokens" << nl << nl; } } -void Foam::argList::warnTrailing(const ITstream& is, const word& optName) +void Foam::argList::checkITstream(const ITstream& is, const word& optName) { - const label nExcess = is.nRemainingTokens(); + const label remaining = is.nRemainingTokens(); - if (nExcess) + if (remaining) { std::cerr << nl << "--> FOAM WARNING:" << nl << "option -" << optName << " has " - << nExcess << " excess tokens" << nl << nl; + << remaining << " excess tokens" << nl << nl; + } + else if (!is.size()) + { + std::cerr + << nl + << "--> FOAM WARNING:" << nl + << "option -" << optName << " had no tokens" << nl << nl; } } @@ -1141,7 +1155,7 @@ void Foam::argList::parse source = "-hostRoots"; ITstream is = this->lookup("hostRoots"); List<Tuple2<wordRe, fileName>> hostRoots(is); - warnTrailing(is, "hostRoots"); + checkITstream(is, "hostRoots"); for (const auto& hostRoot : hostRoots) { diff --git a/src/OpenFOAM/global/argList/argList.H b/src/OpenFOAM/global/argList/argList.H index ba1baa8f3ae0fef5acb2b54ca90192381728469d..3bcc32ea1e23a2c84f8cc16dc790c5a34c402a08 100644 --- a/src/OpenFOAM/global/argList/argList.H +++ b/src/OpenFOAM/global/argList/argList.H @@ -161,11 +161,15 @@ class argList const string& str ); - //- Warn if there are input tokens remaining on the stream - static void warnTrailing(const ITstream& is, const label index); - - //- Warn if there are input tokens remaining on the stream - static void warnTrailing(const ITstream& is, const word& optName); + //- Check after reading if the input token stream has unconsumed + //- tokens remaining or if there were no tokens in the first place. + // Emits Warning + static void checkITstream(const ITstream& is, const label index); + + //- Check after reading if the input token stream has unconsumed + //- tokens remaining or if there were no tokens in the first place. + // Emits Warning + static void checkITstream(const ITstream& is, const word& optName); //- Read a List of values from ITstream, //- treating a single entry like a list of size 1. diff --git a/src/OpenFOAM/global/argList/argListI.H b/src/OpenFOAM/global/argList/argListI.H index 8457a4cf82e9d29c10faf1577e275b660586f2d2..c473becff175d198ede8c035cf1e6991aa350dfc 100644 --- a/src/OpenFOAM/global/argList/argListI.H +++ b/src/OpenFOAM/global/argList/argListI.H @@ -230,7 +230,7 @@ inline T Foam::argList::get(const label index) const T val; is >> val; - warnTrailing(is, index); + checkITstream(is, index); return val; } @@ -244,7 +244,7 @@ inline T Foam::argList::opt(const word& optName) const T val; is >> val; - warnTrailing(is, optName); + checkITstream(is, optName); return val; } @@ -309,7 +309,7 @@ inline Foam::List<T> Foam::argList::getList(const label index) const List<T> list; readList(is, list); - warnTrailing(is, index); + checkITstream(is, index); return list; } @@ -323,7 +323,7 @@ inline Foam::List<T> Foam::argList::getList(const word& optName) const List<T> list; readList(is, list); - warnTrailing(is, optName); + checkITstream(is, optName); return list; } @@ -341,7 +341,7 @@ inline bool Foam::argList::readListIfPresent ITstream is(optName, options_[optName]); readList(is, list); - warnTrailing(is, optName); + checkITstream(is, optName); return true; } diff --git a/src/OpenFOAM/interpolations/interpolationLookUpTable/interpolationLookUpTable.C b/src/OpenFOAM/interpolations/interpolationLookUpTable/interpolationLookUpTable.C index f317ae5f708c980ffa6cfa7d81cc98c6f9f8315d..affa384e78ca254607425f62a053794c4b4266f6 100644 --- a/src/OpenFOAM/interpolations/interpolationLookUpTable/interpolationLookUpTable.C +++ b/src/OpenFOAM/interpolations/interpolationLookUpTable/interpolationLookUpTable.C @@ -207,9 +207,9 @@ void Foam::interpolationLookUpTable<Type>::readTable ) ); - control.lookup("fields") >> entries_; - control.lookup("output") >> output_; - control.lookup("values") >> *this; + control.readEntry("fields", entries_); + control.readEntry("output", output_); + control.readEntry("values", *this); dimensionTable(); diff --git a/src/OpenFOAM/interpolations/uniformInterpolationTable/uniformInterpolationTable.C b/src/OpenFOAM/interpolations/uniformInterpolationTable/uniformInterpolationTable.C index dc1318b6ae26412b59295a759e7fb71d315b8458..58d3018e3e8e8e6ac980314cdca070eaf6a0454b 100644 --- a/src/OpenFOAM/interpolations/uniformInterpolationTable/uniformInterpolationTable.C +++ b/src/OpenFOAM/interpolations/uniformInterpolationTable/uniformInterpolationTable.C @@ -64,9 +64,9 @@ Foam::uniformInterpolationTable<Type>::uniformInterpolationTable { IOdictionary dict(io); - dict.lookup("data") >> *this; - dict.lookup("x0") >> x0_; - dict.lookup("dx") >> dx_; + dict.readEntry("data", *this); + dict.readEntry("x0", x0_); + dict.readEntry("dx", dx_); dict.readIfPresent("log10", log10_); dict.readIfPresent("bound", bound_); } @@ -107,7 +107,7 @@ Foam::uniformInterpolationTable<Type>::uniformInterpolationTable } else { - dict.lookup("data") >> *this; + dict.readEntry("data", *this); } checkTable(); diff --git a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixI.H b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixI.H index f1ab9e773cee9dd28c3a17dfdf4f61ecc972f4a5..394b246eac594e041073d0384f43ecfa91f033c8 100644 --- a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixI.H +++ b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixI.H @@ -34,10 +34,7 @@ inline void Foam::LduMatrix<Type, DType, LUType>::solver::readControl const word& controlName ) { - if (controlDict.found(controlName)) - { - controlDict.lookup(controlName) >> control; - } + controlDict.readIfPresent(controlName, control); } diff --git a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixPreconditioner.C b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixPreconditioner.C index 059721926da6f2cd803955dbf090b7af469e5fe7..892f6569d1c22e98910a930479c5d54456e93d14 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixPreconditioner.C +++ b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixPreconditioner.C @@ -47,7 +47,7 @@ Foam::word Foam::lduMatrix::preconditioner::getName const entry& e = solverControls.lookupEntry("preconditioner", false, false); if (e.isDict()) { - e.dict().lookup("preconditioner") >> name; + e.dict().readEntry("preconditioner", name); } else { @@ -71,7 +71,7 @@ Foam::lduMatrix::preconditioner::New const entry& e = solverControls.lookupEntry("preconditioner", false, false); if (e.isDict()) { - e.dict().lookup("preconditioner") >> name; + e.dict().readEntry("preconditioner", name); } else { diff --git a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixSmoother.C b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixSmoother.C index 03f62412c05b6bf71ba8a459ceea5250b621b7dc..33990232184b0b5b1f53d155e2a4e7e4aafdaf92 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixSmoother.C +++ b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixSmoother.C @@ -47,7 +47,7 @@ Foam::lduMatrix::smoother::getName const entry& e = solverControls.lookupEntry("smoother", false, false); if (e.isDict()) { - e.dict().lookup("smoother") >> name; + e.dict().readEntry("smoother", name); } else { @@ -74,7 +74,7 @@ Foam::autoPtr<Foam::lduMatrix::smoother> Foam::lduMatrix::smoother::New const entry& e = solverControls.lookupEntry("smoother", false, false); if (e.isDict()) { - e.dict().lookup("smoother") >> name; + e.dict().readEntry("smoother", name); } else { diff --git a/src/OpenFOAM/meshes/meshShapes/cellModel/cellModelIO.C b/src/OpenFOAM/meshes/meshShapes/cellModel/cellModelIO.C index 6b1a6aae04d5021209388fcd38660a9fa6b89206..08609fb9731ff69661c4a6903bb550dc41d5cae3 100644 --- a/src/OpenFOAM/meshes/meshShapes/cellModel/cellModelIO.C +++ b/src/OpenFOAM/meshes/meshShapes/cellModel/cellModelIO.C @@ -33,10 +33,10 @@ Foam::cellModel::cellModel(Istream& is) dictionaryEntry dict(dictionary::null, is); name_ = dict.keyword(); - dict.lookup("index") >> index_; - dict.lookup("numberOfPoints") >> nPoints_; - dict.lookup("faces") >> faces_; - dict.lookup("edges") >> edges_; + dict.readEntry("index", index_); + dict.readEntry("numberOfPoints", nPoints_); + dict.readEntry("faces", faces_); + dict.readEntry("edges", edges_); } diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C index 845977c910fd12a804053bfc368659cc9546d7ff..de5ae612edb63c04d7ec230d24e8e3aecc21e98a 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C @@ -681,8 +681,8 @@ Foam::cyclicPolyPatch::cyclicPolyPatch { case ROTATIONAL: { - dict.lookup("rotationAxis") >> rotationAxis_; - dict.lookup("rotationCentre") >> rotationCentre_; + dict.readEntry("rotationAxis", rotationAxis_); + dict.readEntry("rotationCentre", rotationCentre_); scalar magRot = mag(rotationAxis_); if (magRot < SMALL) @@ -698,7 +698,7 @@ Foam::cyclicPolyPatch::cyclicPolyPatch } case TRANSLATIONAL: { - dict.lookup("separationVector") >> separationVector_; + dict.readEntry("separationVector", separationVector_); break; } default: diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/oldCyclic/oldCyclicPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/oldCyclic/oldCyclicPolyPatch.C index b63e957266e90b19f54294a1ffbf47a5e4f3ed0d..05d4f41a3c5dd8a654582d6fe080b9e977d79567 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/oldCyclic/oldCyclicPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/oldCyclic/oldCyclicPolyPatch.C @@ -616,13 +616,13 @@ Foam::oldCyclicPolyPatch::oldCyclicPolyPatch { case ROTATIONAL: { - dict.lookup("rotationAxis") >> rotationAxis_; - dict.lookup("rotationCentre") >> rotationCentre_; + dict.readEntry("rotationAxis", rotationAxis_); + dict.readEntry("rotationCentre", rotationCentre_); break; } case TRANSLATIONAL: { - dict.lookup("separationVector") >> separationVector_; + dict.readEntry("separationVector", separationVector_); break; } default: diff --git a/src/OpenFOAM/primitives/demandDrivenEntry/demandDrivenEntryI.H b/src/OpenFOAM/primitives/demandDrivenEntry/demandDrivenEntryI.H index c22ec7f6da1619617229fb68f7a994eb9fd3321f..74b16ed0578c5b2f436786145ddb7fee4ff2d9e8 100644 --- a/src/OpenFOAM/primitives/demandDrivenEntry/demandDrivenEntryI.H +++ b/src/OpenFOAM/primitives/demandDrivenEntry/demandDrivenEntryI.H @@ -32,7 +32,7 @@ inline void Foam::demandDrivenEntry<Type>::initialise() const { if (!stored_) { - dict_.lookup(keyword_) >> value_; + dict_.readEntry(keyword_, value_); stored_ = true; } } diff --git a/src/OpenFOAM/primitives/functions/Function1/TableFile/TableFile.C b/src/OpenFOAM/primitives/functions/Function1/TableFile/TableFile.C index 4304aa1ee4ec455e516596186ceffe9cb10a9ed7..29535f59098705d95c483e5da4d17b25ce94d76f 100644 --- a/src/OpenFOAM/primitives/functions/Function1/TableFile/TableFile.C +++ b/src/OpenFOAM/primitives/functions/Function1/TableFile/TableFile.C @@ -37,7 +37,7 @@ Foam::Function1Types::TableFile<Type>::TableFile TableBase<Type>(entryName, dict), fName_("none") { - dict.lookup("file") >> fName_; + dict.readEntry("file", fName_); fileName expandedFile(fName_); //IFstream is(expandedFile.expand()); diff --git a/src/OpenFOAM/primitives/strings/fileName/fileName.C b/src/OpenFOAM/primitives/strings/fileName/fileName.C index 587a95ae81bba9a8bfb11d8b62f7feec0ebe0e4d..83a6d0b70a6195b871e46dd67d9a92a48a71e75d 100644 --- a/src/OpenFOAM/primitives/strings/fileName/fileName.C +++ b/src/OpenFOAM/primitives/strings/fileName/fileName.C @@ -24,10 +24,10 @@ License \*---------------------------------------------------------------------------*/ #include "fileName.H" +#include "wordRe.H" #include "wordList.H" #include "DynamicList.H" #include "OSspecific.H" -#include "wordRe.H" #include "fileOperation.H" #include "stringOps.H" @@ -142,7 +142,7 @@ bool Foam::fileName::isBackup(const std::string& str) return false; } - const std::string ending = str.substr(dot+1, npos); + const std::string ending = str.substr(dot+1); if (ending.empty()) { @@ -159,44 +159,40 @@ bool Foam::fileName::isBackup(const std::string& str) // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::fileName::fileName(const UList<word>& lst) +Foam::fileName::fileName(const UList<word>& list) { - // Estimate overall size - size_type sz = lst.size(); // Approx number of '/' needed - for (const word& item : lst) + size_type len = 0; + for (const word& item : list) { - sz += item.size(); + len += 1 + item.length(); // Include space for '/' needed } - reserve(sz); + reserve(len); - sz = 0; - for (const word& item : lst) + for (const word& item : list) { - if (item.size()) + if (item.length()) { - if (sz++) operator+=('/'); + if (length()) operator+=('/'); operator+=(item); } } } -Foam::fileName::fileName(std::initializer_list<word> lst) +Foam::fileName::fileName(std::initializer_list<word> list) { - // Estimate overall size - size_type sz = lst.size(); // Approx number of '/' needed - for (const word& item : lst) + size_type len = 0; + for (const word& item : list) { - sz += item.size(); + len += 1 + item.length(); // Include space for '/' needed } - reserve(sz); + reserve(len); - sz = 0; - for (const word& item : lst) + for (const word& item : list) { - if (item.size()) + if (item.length()) { - if (sz++) operator+=('/'); + if (length()) operator+=('/'); operator+=(item); } } @@ -238,11 +234,11 @@ bool Foam::fileName::clean(std::string& str) } // Number of output characters - std::string::size_type nChar = top+1; + auto nChar = top+1; - const string::size_type maxLen = str.size(); + const auto maxLen = str.size(); - for (string::size_type src = nChar; src < maxLen; /*nil*/) + for (auto src = nChar; src < maxLen; /*nil*/) { const char c = str[src++]; @@ -329,29 +325,10 @@ Foam::fileName Foam::fileName::clean() const } -std::string Foam::fileName::name(const std::string& str) -{ - const auto beg = str.rfind('/'); - - if (beg == npos) - { - return str; - } - - return str.substr(beg+1); -} - - -Foam::word Foam::fileName::name() const -{ - return fileName::name(*this); -} - - std::string Foam::fileName::nameLessExt(const std::string& str) { - size_type beg = str.rfind('/'); - size_type dot = str.rfind('.'); + auto beg = str.rfind('/'); + auto dot = str.rfind('.'); if (beg == npos) { @@ -376,35 +353,6 @@ std::string Foam::fileName::nameLessExt(const std::string& str) } -Foam::word Foam::fileName::nameLessExt() const -{ - return nameLessExt(*this); -} - - -std::string Foam::fileName::path(const std::string& str) -{ - const auto i = str.rfind('/'); - - if (i == npos) - { - return "."; - } - else if (i) - { - return str.substr(0, i); - } - - return "/"; -} - - -Foam::fileName Foam::fileName::path() const -{ - return path(*this); -} - - Foam::fileName Foam::fileName::relative(const fileName& parent) const { const auto top = parent.size(); @@ -424,38 +372,6 @@ Foam::fileName Foam::fileName::relative(const fileName& parent) const } -Foam::fileName Foam::fileName::lessExt() const -{ - const auto i = find_ext(); - - if (i == npos) - { - return *this; - } - - return substr(0, i); -} - - -Foam::word Foam::fileName::ext() const -{ - return string::ext(); -} - - -Foam::fileName& Foam::fileName::ext(const word& ending) -{ - string::ext(ending); - return *this; -} - - -bool Foam::fileName::hasExt(const word& ending) const -{ - return string::hasExt(ending); -} - - bool Foam::fileName::hasExt(const wordRe& ending) const { return string::hasExt(ending); @@ -500,39 +416,6 @@ Foam::word Foam::fileName::component // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // -void Foam::fileName::operator=(const fileName& str) -{ - assign(str); -} - - -void Foam::fileName::operator=(const word& str) -{ - assign(str); -} - - -void Foam::fileName::operator=(const string& str) -{ - assign(str); - stripInvalid(); -} - - -void Foam::fileName::operator=(const std::string& str) -{ - assign(str); - stripInvalid(); -} - - -void Foam::fileName::operator=(const char* str) -{ - assign(str); - stripInvalid(); -} - - Foam::fileName& Foam::fileName::operator/=(const string& other) { fileName& s = *this; diff --git a/src/OpenFOAM/primitives/strings/fileName/fileName.H b/src/OpenFOAM/primitives/strings/fileName/fileName.H index f771b431c4d90d64b6123b9bcd528e999b82d62d..385c91c92eb7a5f8cc8a369c548f27d0165ab4c3 100644 --- a/src/OpenFOAM/primitives/strings/fileName/fileName.H +++ b/src/OpenFOAM/primitives/strings/fileName/fileName.H @@ -102,28 +102,40 @@ public: // Constructors //- Construct null - inline fileName(); + fileName() = default; - //- Construct as copy - inline fileName(const fileName& fn); + //- Copy construct + fileName(const fileName&) = default; - //- Construct as copy of word - inline fileName(const word& w); + //- Move construct + fileName(fileName&&) = default; - //- Construct as copy of string - inline fileName(const string& s, const bool doStripInvalid=true); + //- Copy construct from word + inline fileName(const word& s); - //- Construct as copy of std::string - inline fileName(const std::string& s, const bool doStripInvalid=true); + //- Move construct from word + inline fileName(word&& s); - //- Construct as copy of character array - inline fileName(const char* s, const bool doStripInvalid=true); + //- Copy construct from string + inline fileName(const string& s, bool doStrip=true); + + //- Move construct from string + inline fileName(string&& s, bool doStrip=true); + + //- Copy construct from std::string + inline fileName(const std::string& s, bool doStrip=true); + + //- Move construct from std::string + inline fileName(std::string&& s, bool doStrip=true); + + //- Copy construct from character array + inline fileName(const char* s, bool doStrip=true); //- Construct by concatenating elements of wordList separated by '/' - explicit fileName(const UList<word>& lst); + explicit fileName(const UList<word>& list); //- Construct by concatenating words separated by '/' - explicit fileName(std::initializer_list<word> lst); + explicit fileName(std::initializer_list<word> list); //- Construct from Istream @@ -226,17 +238,17 @@ public: // "/foo/bar" "bar" "bar" // "/foo/bar/" "" "bar" // \endverbatim - static std::string name(const std::string& str); + inline static std::string name(const std::string& str); //- Return basename (part beyond last /), including its extension - word name() const; + inline word name() const; //- Return basename, without extension // The result normally corresponds to a Foam::word static std::string nameLessExt(const std::string& str); //- Return basename, without extension - word nameLessExt() const; + inline word nameLessExt() const; //- Return basename, optionally without extension // \deprecated in favour of name() or nameLessExt() which describe @@ -260,30 +272,36 @@ public: // "/foo/bar" "/foo" "/foo" // "/foo/bar/" "/foo/bar/" "/foo" // \endverbatim - static std::string path(const std::string& str); + inline static std::string path(const std::string& str); //- Return directory path name (part before last /) - fileName path() const; + inline fileName path() const; + + //- Return true if it contains a '/' character + inline bool hasPath() const; + + //- Remove leading path, returning true if string changed. + inline bool removePath(); //- Return name after stripping off the parent directory fileName relative(const fileName& parent) const; //- Return file name without extension (part before last .) - fileName lessExt() const; + inline fileName lessExt() const; //- Return file name extension (part after last .) - word ext() const; + inline word ext() const; //- Append a '.' and the ending, and return the object. // The '.' and ending will not be added when the ending is empty, // or when the file name is empty or ended with a '/'. - fileName& ext(const word& ending); + inline fileName& ext(const word& ending); //- Return true if it has an extension or simply ends with a '.' inline bool hasExt() const; //- Return true if the extension is the same as the given ending. - bool hasExt(const word& ending) const; + inline bool hasExt(const word& ending) const; //- Return true if the extension matches the given ending. bool hasExt(const wordRe& ending) const; @@ -318,20 +336,32 @@ public: // Assignment - //- Copy, no character validation required - void operator=(const fileName& str); + //- Copy assignment, no character validation required + fileName& operator=(const fileName&) = default; - //- Copy, no character validation required - void operator=(const word& str); + //- Move assignment, no character validation required + fileName& operator=(fileName&&) = default; - //- Copy, stripping invalid characters - void operator=(const string& str); + //- Copy assignment, no character validation required + inline fileName& operator=(const word& str); - //- Copy, stripping invalid characters - void operator=(const std::string& str); + //- Move assignment, no character validation required + inline fileName& operator=(word&& str); + + //- Copy assignment, stripping invalid characters + inline fileName& operator=(const string& str); + + //- Move assignment, stripping invalid characters + inline fileName& operator=(string&& str); + + //- Copy assignment, stripping invalid characters + inline fileName& operator=(const std::string& str); + + //- Move assignment, stripping invalid characters + inline fileName& operator=(std::string&& str); //- Copy, stripping invalid characters - void operator=(const char* str); + inline fileName& operator=(const char* str); // Other operators diff --git a/src/OpenFOAM/primitives/strings/fileName/fileNameI.H b/src/OpenFOAM/primitives/strings/fileName/fileNameI.H index f626a87d383094732db45f35bfe823dce928d35a..b135a69ede9deb80e5c3999dce3aa9be015baa42 100644 --- a/src/OpenFOAM/primitives/strings/fileName/fileNameI.H +++ b/src/OpenFOAM/primitives/strings/fileName/fileNameI.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011 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. @@ -52,51 +52,67 @@ inline void Foam::fileName::stripInvalid() // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -inline Foam::fileName::fileName() +inline Foam::fileName::fileName(const word& s) : - string() + string(s) {} -inline Foam::fileName::fileName(const fileName& fn) +inline Foam::fileName::fileName(word&& s) : - string(fn) + string(std::move(s)) {} -inline Foam::fileName::fileName(const word& w) +inline Foam::fileName::fileName(const string& s, bool doStrip) : - string(w) -{} + string(s) +{ + if (doStrip) + { + stripInvalid(); + } +} -inline Foam::fileName::fileName(const string& s, const bool doStripInvalid) +inline Foam::fileName::fileName(string&& s, bool doStrip) : - string(s) + string(std::move(s)) { - if (doStripInvalid) + if (doStrip) { stripInvalid(); } } -inline Foam::fileName::fileName(const std::string& s, const bool doStripInvalid) +inline Foam::fileName::fileName(const std::string& s, bool doStrip) : string(s) { - if (doStripInvalid) + if (doStrip) + { + stripInvalid(); + } +} + + +inline Foam::fileName::fileName(std::string&& s, bool doStrip) +: + string(std::move(s)) +{ + if (doStrip) { stripInvalid(); } } -inline Foam::fileName::fileName(const char* s, const bool doStripInvalid) +inline Foam::fileName::fileName(const char* s, bool doStrip) : string(s) { - if (doStripInvalid) + if (doStrip) { stripInvalid(); } @@ -134,16 +150,164 @@ inline bool Foam::fileName::isBackup() const } +inline bool Foam::fileName::hasPath() const +{ + return string::hasPath(); +} + + inline bool Foam::fileName::hasExt() const { return string::hasExt(); } +inline bool Foam::fileName::hasExt(const word& ending) const +{ + return string::hasExt(ending); +} + + +inline std::string Foam::fileName::path(const std::string& str) +{ + const auto i = str.rfind('/'); + + if (i == npos) + { + return "."; + } + else if (i) + { + return str.substr(0, i); + } + + return "/"; +} + + +inline Foam::fileName Foam::fileName::path() const +{ + return path(*this); +} + + +inline std::string Foam::fileName::name(const std::string& str) +{ + const auto i = str.rfind('/'); + + if (npos == i) + { + return str; + } + + return str.substr(i+1); +} + + +inline Foam::word Foam::fileName::name() const +{ + return fileName::name(*this); +} + + +Foam::word Foam::fileName::ext() const +{ + return string::ext(); +} + + +inline Foam::word Foam::fileName::nameLessExt() const +{ + return nameLessExt(*this); +} + + +inline Foam::fileName Foam::fileName::lessExt() const +{ + const auto i = find_ext(); + + if (i == npos) + { + return *this; + } + + return substr(0, i); +} + + +inline bool Foam::fileName::removePath() +{ + return string::removePath(); +} + + inline bool Foam::fileName::removeExt() { return string::removeExt(); } +inline Foam::fileName& Foam::fileName::ext(const word& ending) +{ + string::ext(ending); + return *this; +} + + +// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // + +inline Foam::fileName& Foam::fileName::operator=(const word& str) +{ + assign(str); + return *this; +} + + +inline Foam::fileName& Foam::fileName::operator=(word&& str) +{ + assign(std::move(str)); + return *this; +} + + +inline Foam::fileName& Foam::fileName::operator=(const string& str) +{ + assign(str); + stripInvalid(); + return *this; +} + + +inline Foam::fileName& Foam::fileName::operator=(string&& str) +{ + assign(std::move(str)); + stripInvalid(); + return *this; +} + + +inline Foam::fileName& Foam::fileName::operator=(const std::string& str) +{ + assign(str); + stripInvalid(); + return *this; +} + + +inline Foam::fileName& Foam::fileName::operator=(std::string&& str) +{ + assign(std::move(str)); + stripInvalid(); + return *this; +} + + +inline Foam::fileName& Foam::fileName::operator=(const char* str) +{ + assign(str); + stripInvalid(); + return *this; +} + + // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/strings/keyType/keyType.H b/src/OpenFOAM/primitives/strings/keyType/keyType.H index 033ce40c42e21b79ae8f4eaa1e04cd2a008509aa..188c66e738fa7a693a4d23e440b2a95745c32b9d 100644 --- a/src/OpenFOAM/primitives/strings/keyType/keyType.H +++ b/src/OpenFOAM/primitives/strings/keyType/keyType.H @@ -75,6 +75,7 @@ class keyType //- No assignment where we cannot determine string/word type void operator=(const std::string&) = delete; + public: // Static data members @@ -91,14 +92,13 @@ public: //- Copy construct, retaining type (literal or regex) inline keyType(const keyType& s); - //- Copy construct from word. Not treated as a regular expression + //- Copy construct from word, treat as literal. inline keyType(const word& s); - //- Copy construct from string. Treat as regular expression. + //- Copy construct from string, treat as regular expression. inline keyType(const string& s); - //- Construct as copy of character array. - // Not treated as a regular expression + //- Construct as copy of character array, treat as literal. inline keyType(const char* s); //- Copy construct from std::string with specified treatment @@ -149,18 +149,18 @@ public: //- Copy assignment, retaining type (literal or regex) inline void operator=(const keyType& s); - //- Assign as word, not treated as a regular expression. + //- Move assignment, retaining type (literal or regex) + inline void operator=(keyType&& s); + + //- Assign as word, treat as literal inline void operator=(const word& s); - //- Assign from Foam::string as regular expression + //- Assign from Foam::string, treat as regular expression inline void operator=(const string& s); - //- Assign as word, not treated as a regular expression. + //- Assign as word, treat as literal inline void operator=(const char* s); - //- Move assignment, retaining type (literal or regex) - inline void operator=(keyType&& s); - // IOstream operators diff --git a/src/OpenFOAM/primitives/strings/keyType/keyTypeI.H b/src/OpenFOAM/primitives/strings/keyType/keyTypeI.H index 2f0ec27aac7a1127847a3d7af9cada3d1f963b12..3885e6ecf2ba22dd200ad8cb174101158b8dd7e7 100644 --- a/src/OpenFOAM/primitives/strings/keyType/keyTypeI.H +++ b/src/OpenFOAM/primitives/strings/keyType/keyTypeI.H @@ -145,6 +145,13 @@ inline void Foam::keyType::operator=(const keyType& s) } +inline void Foam::keyType::operator=(keyType&& s) +{ + clear(); + swap(s); +} + + inline void Foam::keyType::operator=(const word& s) { assign(s); // Bypasses char checking @@ -166,11 +173,4 @@ inline void Foam::keyType::operator=(const char* s) } -inline void Foam::keyType::operator=(keyType&& s) -{ - clear(); - swap(s); -} - - // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/strings/string/string.H b/src/OpenFOAM/primitives/strings/string/string.H index 60c4849cd38ebb60d963e802beb5c34a36ddb258..17fce9c385829b2d48ff109184e7a8ee1f2e82c5 100644 --- a/src/OpenFOAM/primitives/strings/string/string.H +++ b/src/OpenFOAM/primitives/strings/string/string.H @@ -58,14 +58,12 @@ SourceFiles namespace Foam { -// Forward declaration of classes +// Forward Declarations class word; class wordRe; +class string; class Istream; class Ostream; - -// Forward declaration of friend functions and operators -class string; Istream& operator>>(Istream& is, string& s); Ostream& operator<<(Ostream& os, const string& s); Ostream& operator<<(Ostream& os, const std::string& s); @@ -119,6 +117,9 @@ protected: // \return True if append occurred. bool ext(const word& ending); + //- Return true if it contains a '/' character + inline bool hasPath() const; + //- Return true if it has an extension or simply ends with a '.' inline bool hasExt() const; @@ -131,6 +132,9 @@ protected: //- Remove extension, returning true if string changed. inline bool removeExt(); + //- Remove leading path, returning true if string changed. + inline bool removePath(); + public: @@ -157,11 +161,14 @@ public: // Constructors //- Construct null - inline string(); + string() = default; - //- Construct from std::string + //- Copy construct from std::string inline string(const std::string& str); + //- Move construct from std::string + inline string(std::string&& str); + //- Construct as copy of character array inline string(const char* str); @@ -174,9 +181,6 @@ public: //- Construct fill copies of a single character inline string(const size_type len, const char c); - //- Move construct from std::string - inline string(std::string&& str); - //- Construct from Istream string(Istream& is); diff --git a/src/OpenFOAM/primitives/strings/string/stringI.H b/src/OpenFOAM/primitives/strings/string/stringI.H index f8d7e4b9f434626b3e25f19544980e36f040775d..8a967c1736cefc09e819ba28f0cd327e7e81a8b9 100644 --- a/src/OpenFOAM/primitives/strings/string/stringI.H +++ b/src/OpenFOAM/primitives/strings/string/stringI.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -44,9 +44,29 @@ inline std::string::size_type Foam::string::find_ext() const } +inline bool Foam::string::hasPath() const +{ + return (npos != find('/')); +} + + inline bool Foam::string::hasExt() const { - return (find_ext() != npos); + return (npos != find_ext()); +} + + +inline bool Foam::string::removePath() +{ + const auto i = rfind('/'); + + if (npos == i) + { + return false; + } + + this->erase(0, i+1); + return true; } @@ -54,7 +74,7 @@ inline bool Foam::string::removeExt() { const auto i = find_ext(); - if (i == npos) + if (npos == i) { return false; } @@ -64,17 +84,18 @@ inline bool Foam::string::removeExt() } + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -inline Foam::string::string() +inline Foam::string::string(const std::string& str) : - std::string() + std::string(str) {} -inline Foam::string::string(const std::string& str) +inline Foam::string::string(std::string&& str) : - std::string(str) + std::string(std::move(str)) {} @@ -102,12 +123,6 @@ inline Foam::string::string(const size_type len, const char c) {} -inline Foam::string::string(std::string&& str) -: - std::string(std::move(str)) -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class String> diff --git a/src/OpenFOAM/primitives/strings/word/word.C b/src/OpenFOAM/primitives/strings/word/word.C index ae751a58d06e949541f7a5c1f3f10265bd69efde..a0154ae665add734335b09cba8544b9a633214cf 100644 --- a/src/OpenFOAM/primitives/strings/word/word.C +++ b/src/OpenFOAM/primitives/strings/word/word.C @@ -30,7 +30,9 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // const char* const Foam::word::typeName = "word"; + int Foam::word::debug(Foam::debug::debugSwitch(word::typeName, 0)); + const Foam::word Foam::word::null; diff --git a/src/OpenFOAM/primitives/strings/word/word.H b/src/OpenFOAM/primitives/strings/word/word.H index fc77c8c22212cf4eb504a09436625696fe33cf10..7f07140e355cebe53738893f85d683127dc5285d 100644 --- a/src/OpenFOAM/primitives/strings/word/word.H +++ b/src/OpenFOAM/primitives/strings/word/word.H @@ -82,36 +82,31 @@ public: // Constructors //- Construct null - inline word(); + word() = default; //- Copy construct - inline word(const word& w); + word(const word&) = default; - //- Construct as copy of character array - inline word(const char* s, const bool doStripInvalid=true); + //- Move construct + word(word&& w) = default; - //- Construct as copy with a maximum number of characters - inline word - ( - const char* s, - const size_type len, - const bool doStripInvalid - ); + //- Copy construct from Foam::string + inline word(const string& s, bool doStrip=true); - //- Construct as copy of Foam::string - inline word(const string& s, const bool doStripInvalid=true); + //- Move construct from Foam::string + inline word(string&& s, bool doStrip=true); - //- Construct as copy of std::string - inline word(const std::string& s, const bool doStripInvalid=true); + //- Copy construct from std::string + inline word(const std::string& s, bool doStrip=true); - //- Move construct - inline word(word&& w); + //- Move construct from std::string + inline word(std::string&& s, bool doStrip=true); - //- Move construct from Foam::string - inline word(string&& s, const bool doStripInvalid=true); + //- Copy from character array + inline word(const char* s, bool doStrip=true); - //- Move construct from std::string - inline word(std::string&& s, const bool doStripInvalid=true); + //- Copy from buffer for a maximum number of characters + inline word(const char* s, size_type len, bool doStrip); //- Construct from Istream word(Istream& is); @@ -190,25 +185,25 @@ public: // Assignment //- Copy assignment, no character validation required - inline void operator=(const word& w); - - //- Copy assignment from Foam::string, stripping invalid characters - inline void operator=(const string& s); + word& operator=(const word&) = default; - //- Copy assignment from std::string, stripping invalid characters - inline void operator=(const std::string& s); + //- Move assignment, no character validation required + word& operator=(word&& w) = default; - //- Copy, stripping invalid characters - inline void operator=(const char* s); - - //- Move assignment - inline void operator=(word&& w); + //- Copy assignment from Foam::string, stripping invalid characters + inline word& operator=(const string& s); //- Move assignment from Foam::string, stripping invalid characters - inline void operator=(string&& s); + inline word& operator=(string&& s); + + //- Copy assignment from std::string, stripping invalid characters + inline word& operator=(const std::string& s); //- Move assignment from std::string, stripping invalid characters - inline void operator=(std::string&& s); + inline word& operator=(std::string&& s); + + //- Copy, stripping invalid characters + inline word& operator=(const char* s); // IOstream operators diff --git a/src/OpenFOAM/primitives/strings/word/wordI.H b/src/OpenFOAM/primitives/strings/word/wordI.H index 3aa394d87ef9f6796395957cf09a906ccac8bae0..09841d17bc6914b6b71705ffedeb3f003d4c40af 100644 --- a/src/OpenFOAM/primitives/strings/word/wordI.H +++ b/src/OpenFOAM/primitives/strings/word/wordI.H @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include <cctype> -#include <iostream> // for std::cerr +#include <iostream> // For std::cerr // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // @@ -78,89 +78,66 @@ inline void Foam::word::stripInvalid() // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -inline Foam::word::word() -: - string() -{} - - -inline Foam::word::word(const word& w) -: - string(w) -{} - - -inline Foam::word::word(const string& s, const bool doStripInvalid) +inline Foam::word::word(const string& s, bool doStrip) : string(s) { - if (doStripInvalid) + if (doStrip) { stripInvalid(); } } -inline Foam::word::word(const std::string& s, const bool doStripInvalid) +inline Foam::word::word(string&& s, bool doStrip) : - string(s) + string(std::move(s)) { - if (doStripInvalid) + if (doStrip) { stripInvalid(); } } -inline Foam::word::word(const char* s, const bool doStripInvalid) +inline Foam::word::word(std::string&& s, bool doStrip) : - string(s) + string(std::move(s)) { - if (doStripInvalid) + if (doStrip) { stripInvalid(); } } -inline Foam::word::word -( - const char* s, - const size_type len, - const bool doStripInvalid -) +inline Foam::word::word(const std::string& s, bool doStrip) : - string(s, len) + string(s) { - if (doStripInvalid) + if (doStrip) { stripInvalid(); } } -inline Foam::word::word(word&& w) +inline Foam::word::word(const char* s, bool doStrip) : - string(std::move(w)) -{} - - -inline Foam::word::word(string&& s, const bool doStripInvalid) -: - string(std::move(s)) + string(s) { - if (doStripInvalid) + if (doStrip) { stripInvalid(); } } -inline Foam::word::word(std::string&& s, const bool doStripInvalid) +inline Foam::word::word(const char* s, size_type len, bool doStrip) : - string(std::move(s)) + string(s, len) { - if (doStripInvalid) + if (doStrip) { stripInvalid(); } @@ -198,50 +175,43 @@ inline bool Foam::word::removeExt() // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // -inline void Foam::word::operator=(const word& w) -{ - assign(w); -} - - -inline void Foam::word::operator=(word&& w) -{ - assign(std::move(w)); -} - - -inline void Foam::word::operator=(const string& s) +inline Foam::word& Foam::word::operator=(const string& s) { assign(s); stripInvalid(); + return *this; } -inline void Foam::word::operator=(string&& s) +inline Foam::word& Foam::word::operator=(string&& s) { assign(std::move(s)); stripInvalid(); + return *this; } -inline void Foam::word::operator=(const std::string& s) +inline Foam::word& Foam::word::operator=(const std::string& s) { assign(s); stripInvalid(); + return *this; } -inline void Foam::word::operator=(std::string&& s) +inline Foam::word& Foam::word::operator=(std::string&& s) { assign(std::move(s)); stripInvalid(); + return *this; } -inline void Foam::word::operator=(const char* s) +inline Foam::word& Foam::word::operator=(const char* s) { assign(s); stripInvalid(); + return *this; } diff --git a/src/OpenFOAM/primitives/strings/word/wordIO.C b/src/OpenFOAM/primitives/strings/word/wordIO.C index 476dde86fa4c264f72d1734a70f1e46b25c68746..e2a172b98aa31cebfd156f935cb74c3feb5bf423 100644 --- a/src/OpenFOAM/primitives/strings/word/wordIO.C +++ b/src/OpenFOAM/primitives/strings/word/wordIO.C @@ -52,17 +52,17 @@ Foam::Istream& Foam::operator>>(Istream& is, word& w) } else if (t.isString()) { - // try a bit harder and convert string to word + // Try a bit harder and convert string to word w = t.stringToken(); string::stripInvalid<word>(w); - // flag empty strings and bad chars as an error + // Flag empty strings and bad chars as an error if (w.empty() || w.size() != t.stringToken().size()) { is.setBad(); FatalIOErrorInFunction(is) - << "wrong token type - expected word, found " - "non-word characters " + << "wrong token type - expected word," + " found non-word characters " << t.info() << exit(FatalIOError); return is; diff --git a/src/OpenFOAM/primitives/strings/wordRe/wordRe.H b/src/OpenFOAM/primitives/strings/wordRe/wordRe.H index 00e211d2fa353fbdf2ae60b8f2e8ae6cafb93755..4c7294aab98fbe801d5744ff9d42c63a328b8f11 100644 --- a/src/OpenFOAM/primitives/strings/wordRe/wordRe.H +++ b/src/OpenFOAM/primitives/strings/wordRe/wordRe.H @@ -122,42 +122,42 @@ public: //- Construct null inline wordRe(); - //- Construct as copy + //- Copy construct inline wordRe(const wordRe& str); + //- Move construct + inline wordRe(wordRe&& str); + //- Construct from keyType, using its compile information inline explicit wordRe(const keyType& str); - //- Construct as copy of character array, treat as a literal + //- Copy from character array, treat as a literal inline explicit wordRe(const char* str); - //- Construct as copy of std::string, treat as a literal + //- Copy from std::string, treat as a literal inline explicit wordRe(const std::string& str); - //- Construct as copy of string, treat as a literal + //- Copy from string, treat as a literal inline explicit wordRe(const string& str); - //- Construct as copy of word, treat as a literal + //- Copy from word, treat as a literal inline explicit wordRe(const word& str); - //- Construct from keyType, use specified compile option + //- Copy from keyType, use specified compile option inline wordRe(const keyType& str, const compOption opt); - //- Construct as copy of character array, use specified compile option + //- Copy from character array, use specified compile option inline wordRe(const char* str, const compOption opt); - //- Construct as copy of std::string, use specified compile option + //- Copy from std::string, use specified compile option inline wordRe(const std::string& str, const compOption opt); - //- Construct as copy of string, use specified compile option + //- Copy from string, use specified compile option inline wordRe(const string& str, const compOption opt); - //- Construct as copy of word, use specified compile option + //- Copy from word, use specified compile option inline wordRe(const word& str, const compOption opt); - //- Move construct - inline wordRe(wordRe&& str); - //- Construct from Istream // Words are treated as literals, strings with an auto-test wordRe(Istream& is); @@ -181,7 +181,7 @@ public: //- Make wordRe a literal again, instead of a regular expression. // Optionally strip invalid word characters. - inline void uncompile(const bool doStripInvalid = false) const; + inline void uncompile(bool doStrip = false) const; // Editing diff --git a/src/OpenFOAM/primitives/strings/wordRe/wordReI.H b/src/OpenFOAM/primitives/strings/wordRe/wordReI.H index 90020b4674dac27271fe49e68189505f5a96fceb..5e9532c7b922bf052fa1a1004cb94d84dc4bff39 100644 --- a/src/OpenFOAM/primitives/strings/wordRe/wordReI.H +++ b/src/OpenFOAM/primitives/strings/wordRe/wordReI.H @@ -64,6 +64,13 @@ inline Foam::wordRe::wordRe(const wordRe& str) } +inline Foam::wordRe::wordRe(wordRe&& str) +: + word(std::move(static_cast<word&>(str))), + re_(std::move(str.re_)) +{} + + inline Foam::wordRe::wordRe(const keyType& str) : word(str, false), @@ -148,13 +155,6 @@ inline Foam::wordRe::wordRe(const word& str, const compOption opt) } -inline Foam::wordRe::wordRe(wordRe&& str) -: - word(std::move(static_cast<word&>(str))), - re_(std::move(str.re_)) -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // inline bool Foam::wordRe::isPattern() const @@ -200,9 +200,9 @@ inline bool Foam::wordRe::compile() const } -inline void Foam::wordRe::uncompile(const bool doStripInvalid) const +inline void Foam::wordRe::uncompile(bool doStrip) const { - if (re_.clear() && doStripInvalid) + if (re_.clear() && doStrip) { // Skip stripping unless debug is active to avoid costly operations if (word::debug) diff --git a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C index f87c8c9b394ea5a2045db945187d94a355d9a96e..e0834f3b58a52c2927a0dd007b41b2b70daf2636 100644 --- a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C +++ b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C @@ -100,7 +100,7 @@ externalWallHeatFluxTemperatureFvPatchScalarField { case fixedPower: { - dict.lookup("Q") >> Q_; + dict.readEntry("Q", Q_); break; } @@ -115,10 +115,9 @@ externalWallHeatFluxTemperatureFvPatchScalarField h_ = scalarField("h", dict, p.size()); Ta_ = Function1<scalar>::New("Ta", dict); - if (dict.found("thicknessLayers")) + if (dict.readIfPresent("thicknessLayers", thicknessLayers_)) { - dict.lookup("thicknessLayers") >> thicknessLayers_; - dict.lookup("kappaLayers") >> kappaLayers_; + dict.readEntry("kappaLayers", kappaLayers_); if (thicknessLayers_.size() != kappaLayers_.size()) { diff --git a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.C b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.C index ff02c97357b3e0455dfdf58b319828d2232fc5d3..e3b6a88015419c83ab93534d2c6d264ce222f450 100644 --- a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.C +++ b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.C @@ -101,10 +101,9 @@ turbulentTemperatureCoupledBaffleMixedFvPatchScalarField << exit(FatalError); } - if (dict.found("thicknessLayers")) + if (dict.readIfPresent("thicknessLayers", thicknessLayers_)) { - dict.lookup("thicknessLayers") >> thicknessLayers_; - dict.lookup("kappaLayers") >> kappaLayers_; + dict.readEntry("kappaLayers", kappaLayers_); if (thicknessLayers_.size() > 0) { diff --git a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C index edcdabfa3b0e7f49f093e748399a9662afa9235b..2a761d2a49f47568b4e5875e3ed095bb0404efc0 100644 --- a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C +++ b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C @@ -111,10 +111,9 @@ turbulentTemperatureRadCoupledMixedFvPatchScalarField << exit(FatalError); } - if (dict.found("thicknessLayers")) + if (dict.readIfPresent("thicknessLayers", thicknessLayers_)) { - dict.lookup("thicknessLayers") >> thicknessLayers_; - dict.lookup("kappaLayers") >> kappaLayers_; + dict.readEntry("kappaLayers", kappaLayers_); if (thicknessLayers_.size() > 0) { diff --git a/src/TurbulenceModels/turbulenceModels/LES/LESModel/LESModel.C b/src/TurbulenceModels/turbulenceModels/LES/LESModel/LESModel.C index 927434b0f293ef07e5d77cbafe7fc8cef8364a50..1d69b010a2d957ceeae5f5bceb5b88e7e56b569b 100644 --- a/src/TurbulenceModels/turbulenceModels/LES/LESModel/LESModel.C +++ b/src/TurbulenceModels/turbulenceModels/LES/LESModel/LESModel.C @@ -180,7 +180,7 @@ bool Foam::LESModel<BasicTurbulenceModel>::read() if (BasicTurbulenceModel::read()) { LESDict_ <<= this->subDict("LES"); - LESDict_.lookup("turbulence") >> turbulence_; + LESDict_.readEntry("turbulence", turbulence_); coeffDict_ <<= LESDict_.optionalSubDict(type() + "Coeffs"); diff --git a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/smoothDelta/smoothDelta.C b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/smoothDelta/smoothDelta.C index a93225c735519947e7f4879ee822bf61edd6f820..d12932df9a7945bea22a4658a020c19fec613fe8 100644 --- a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/smoothDelta/smoothDelta.C +++ b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/smoothDelta/smoothDelta.C @@ -178,7 +178,7 @@ void Foam::LESModels::smoothDelta::read(const dictionary& dict) const dictionary& coeffsDict(dict.optionalSubDict(type() + "Coeffs")); geometricDelta_().read(coeffsDict); - coeffsDict.lookup("maxDeltaRatio") >> maxDeltaRatio_; + coeffsDict.readEntry("maxDeltaRatio", maxDeltaRatio_); calcDelta(); } diff --git a/src/TurbulenceModels/turbulenceModels/LES/LESfilters/anisotropicFilter/anisotropicFilter.C b/src/TurbulenceModels/turbulenceModels/LES/LESfilters/anisotropicFilter/anisotropicFilter.C index 052183a1aed4a3200b809dc00863d190833a22af..b4ef0a2bb839b9a4f8ef01ffafd3bed0b801b069 100644 --- a/src/TurbulenceModels/turbulenceModels/LES/LESfilters/anisotropicFilter/anisotropicFilter.C +++ b/src/TurbulenceModels/turbulenceModels/LES/LESfilters/anisotropicFilter/anisotropicFilter.C @@ -121,7 +121,7 @@ Foam::anisotropicFilter::anisotropicFilter void Foam::anisotropicFilter::read(const dictionary& bd) { - bd.optionalSubDict(type() + "Coeffs").lookup("widthCoeff") >> widthCoeff_; + bd.optionalSubDict(type() + "Coeffs").readEntry("widthCoeff", widthCoeff_); } diff --git a/src/TurbulenceModels/turbulenceModels/LES/LESfilters/laplaceFilter/laplaceFilter.C b/src/TurbulenceModels/turbulenceModels/LES/LESfilters/laplaceFilter/laplaceFilter.C index 3b3490f5d7dc0efe5ab8e867a60493363acf463b..8f2e985c983182ba2d651367089c382a57aee98a 100644 --- a/src/TurbulenceModels/turbulenceModels/LES/LESfilters/laplaceFilter/laplaceFilter.C +++ b/src/TurbulenceModels/turbulenceModels/LES/LESfilters/laplaceFilter/laplaceFilter.C @@ -89,7 +89,7 @@ Foam::laplaceFilter::laplaceFilter(const fvMesh& mesh, const dictionary& bd) void Foam::laplaceFilter::read(const dictionary& bd) { - bd.optionalSubDict(type() + "Coeffs").lookup("widthCoeff") >> widthCoeff_; + bd.optionalSubDict(type() + "Coeffs").readEntry("widthCoeff", widthCoeff_); } diff --git a/src/TurbulenceModels/turbulenceModels/RAS/RASModel/RASModel.C b/src/TurbulenceModels/turbulenceModels/RAS/RASModel/RASModel.C index b897734eeae394313c30c8bf7a19de6c430108b9..928b99aa813ad0d6d130aa635c696ed97202b7ae 100644 --- a/src/TurbulenceModels/turbulenceModels/RAS/RASModel/RASModel.C +++ b/src/TurbulenceModels/turbulenceModels/RAS/RASModel/RASModel.C @@ -170,7 +170,7 @@ bool Foam::RASModel<BasicTurbulenceModel>::read() if (BasicTurbulenceModel::read()) { RASDict_ <<= this->subDict("RAS"); - RASDict_.lookup("turbulence") >> turbulence_; + RASDict_.readEntry("turbulence", turbulence_); coeffDict_ <<= RASDict_.optionalSubDict(type() + "Coeffs"); diff --git a/src/combustionModels/FSD/FSD.C b/src/combustionModels/FSD/FSD.C index e5f853a2875bc27d75ecee0be2a4289b8a5d5a79..aef2d8a24ab1912abba57020a07427adca6450c0 100644 --- a/src/combustionModels/FSD/FSD.C +++ b/src/combustionModels/FSD/FSD.C @@ -347,8 +347,8 @@ bool FSD<ReactionThermo, ThermoType>::read() { if (singleStepCombustion<ReactionThermo, ThermoType>::read()) { - this->coeffs().lookup("Cv") >> Cv_ ; - this->coeffs().lookup("ftVarMin") >> ftVarMin_; + this->coeffs().readEntry("Cv", Cv_); + this->coeffs().readEntry("ftVarMin", ftVarMin_); reactionRateFlameArea_->read(this->coeffs()); return true; } diff --git a/src/combustionModels/FSD/reactionRateFlameAreaModels/consumptionSpeed/consumptionSpeed.C b/src/combustionModels/FSD/reactionRateFlameAreaModels/consumptionSpeed/consumptionSpeed.C index e60293bd6fff2f3576fa99e05b2d9b6e778541bd..4e87601c0f48164b6b0d191601a7927b0dbbfe48 100644 --- a/src/combustionModels/FSD/reactionRateFlameAreaModels/consumptionSpeed/consumptionSpeed.C +++ b/src/combustionModels/FSD/reactionRateFlameAreaModels/consumptionSpeed/consumptionSpeed.C @@ -127,10 +127,10 @@ Foam::tmp<Foam::volScalarField> Foam::consumptionSpeed::omega0Sigma void Foam::consumptionSpeed::read(const dictionary& dict) { - dict.lookup("omega0") >> omega0_ ; - dict.lookup("eta") >> eta_ ; - dict.lookup("sigmaExt") >> sigmaExt_; - dict.lookup("omegaMin") >> omegaMin_; + dict.readEntry("omega0", omega0_); + dict.readEntry("eta", eta_); + dict.readEntry("sigmaExt", sigmaExt_); + dict.readEntry("omegaMin", omegaMin_); } diff --git a/src/combustionModels/FSD/reactionRateFlameAreaModels/reactionRateFlameArea/reactionRateFlameArea.C b/src/combustionModels/FSD/reactionRateFlameAreaModels/reactionRateFlameArea/reactionRateFlameArea.C index 1208979f7d6e55cc85ffd0594336ed5057434f9e..6ac79080e3a21dda22345049fc46d1411bf2ded3 100644 --- a/src/combustionModels/FSD/reactionRateFlameAreaModels/reactionRateFlameArea/reactionRateFlameArea.C +++ b/src/combustionModels/FSD/reactionRateFlameAreaModels/reactionRateFlameArea/reactionRateFlameArea.C @@ -73,7 +73,7 @@ Foam::reactionRateFlameArea::~reactionRateFlameArea() bool Foam::reactionRateFlameArea::read(const dictionary& dict) { - dict.lookup("fuel") >> fuel_; + dict.readEntry("fuel", fuel_); return true; } diff --git a/src/combustionModels/FSD/reactionRateFlameAreaModels/relaxation/relaxation.C b/src/combustionModels/FSD/reactionRateFlameAreaModels/relaxation/relaxation.C index 3ae9d31c297ba2b860452511b982cc935d6fa5e6..5d17baa771ed3767e30e86cfefc48f111275dd39 100644 --- a/src/combustionModels/FSD/reactionRateFlameAreaModels/relaxation/relaxation.C +++ b/src/combustionModels/FSD/reactionRateFlameAreaModels/relaxation/relaxation.C @@ -152,8 +152,8 @@ bool Foam::reactionRateFlameAreaModels::relaxation::read if (reactionRateFlameArea::read(dict)) { coeffDict_ = dict.optionalSubDict(typeName + "Coeffs"); - coeffDict_.lookup("C") >> C_; - coeffDict_.lookup("alpha") >> alpha_; + coeffDict_.readEntry("C", C_); + coeffDict_.readEntry("alpha", alpha_); correlation_.read ( coeffDict_.subDict(fuel_) diff --git a/src/combustionModels/PaSR/PaSR.C b/src/combustionModels/PaSR/PaSR.C index 7e205e12d0924c3e6a4ca2258f2b46f3636a31d7..2dd35b878e43e457d7a8d0d1acca015b9be1a3c1 100644 --- a/src/combustionModels/PaSR/PaSR.C +++ b/src/combustionModels/PaSR/PaSR.C @@ -128,7 +128,7 @@ bool Foam::combustionModels::PaSR<ReactionThermo>::read() { if (laminar<ReactionThermo>::read()) { - this->coeffs().lookup("Cmix") >> Cmix_; + this->coeffs().readEntry("Cmix", Cmix_); return true; } else diff --git a/src/combustionModels/combustionModel/combustionModel.C b/src/combustionModels/combustionModel/combustionModel.C index 8f4771bc37063a786067a62976ac50762d18ca8e..5d99d9354b0fba4c07d02d98bd75d5b5da567d08 100644 --- a/src/combustionModels/combustionModel/combustionModel.C +++ b/src/combustionModels/combustionModel/combustionModel.C @@ -99,14 +99,12 @@ bool Foam::combustionModel::read() { if (regIOobject::read()) { - this->lookup("active") >> active_; + this->readEntry("active", active_); coeffs_ = optionalSubDict(modelType_ + "Coeffs"); return true; } - else - { - return false; - } + + return false; } diff --git a/src/combustionModels/combustionModel/combustionModelTemplates.C b/src/combustionModels/combustionModel/combustionModelTemplates.C index 953578277cf873228d245e1849e38879cab2a894..b0a72137c257fa298d85d5712452918dcc0bb636 100644 --- a/src/combustionModels/combustionModel/combustionModelTemplates.C +++ b/src/combustionModels/combustionModel/combustionModelTemplates.C @@ -46,7 +46,7 @@ Foam::autoPtr<CombustionModel> Foam::combustionModel::New word combModelName("none"); if (combIO.typeHeaderOk<IOdictionary>(false)) { - IOdictionary(combIO).lookup("combustionModel") >> combModelName; + IOdictionary(combIO).readEntry("combustionModel", combModelName); } else { diff --git a/src/combustionModels/diffusion/diffusion.C b/src/combustionModels/diffusion/diffusion.C index ffa80d45785ff2f7006a619d87974b57d1e6a66c..b4a919e0c4d357f610e478fea3483085a27bd164 100644 --- a/src/combustionModels/diffusion/diffusion.C +++ b/src/combustionModels/diffusion/diffusion.C @@ -96,7 +96,7 @@ bool diffusion<ReactionThermo, ThermoType>::read() { if (singleStepCombustion<ReactionThermo, ThermoType>::read()) { - this->coeffs().lookup("C") >> C_ ; + this->coeffs().readEntry("C", C_); this->coeffs().readIfPresent("oxidant", oxidantName_); return true; } diff --git a/src/combustionModels/eddyDissipationDiffusionModel/eddyDissipationDiffusionModel.C b/src/combustionModels/eddyDissipationDiffusionModel/eddyDissipationDiffusionModel.C index b86638dbe076d534b9e2c67235cede98f20ad3af..4f95db380f9f53bd95649fb02978383edfd16f87 100644 --- a/src/combustionModels/eddyDissipationDiffusionModel/eddyDissipationDiffusionModel.C +++ b/src/combustionModels/eddyDissipationDiffusionModel/eddyDissipationDiffusionModel.C @@ -107,7 +107,7 @@ bool eddyDissipationDiffusionModel<ReactionThermo, ThermoType>::read() { if (eddyDissipationModelBase<ReactionThermo, ThermoType>::read()) { - this->coeffs().lookup("Cd") >> Cd_; + this->coeffs().readEntry("Cd", Cd_); return true; } else diff --git a/src/combustionModels/eddyDissipationModelBase/eddyDissipationModelBase.C b/src/combustionModels/eddyDissipationModelBase/eddyDissipationModelBase.C index 45eeff1972512f1ced67aae55918ae5e347b4add..a2f280f5b825a2f2c744152d1e6d6f9a28ae9bdb 100644 --- a/src/combustionModels/eddyDissipationModelBase/eddyDissipationModelBase.C +++ b/src/combustionModels/eddyDissipationModelBase/eddyDissipationModelBase.C @@ -116,7 +116,7 @@ bool eddyDissipationModelBase<ReactionThermo, ThermoType>::read() { if (singleStepCombustion<ReactionThermo, ThermoType>::read()) { - this->coeffs().lookup("CEDC") >> CEDC_; + this->coeffs().readEntry("CEDC", CEDC_); return true; } else diff --git a/src/combustionModels/infinitelyFastChemistry/infinitelyFastChemistry.C b/src/combustionModels/infinitelyFastChemistry/infinitelyFastChemistry.C index 48df67eaf79da7570c31c831f4c2a74e205b7b06..eb80809febd600360ffa97358ccf7c7714385b8d 100644 --- a/src/combustionModels/infinitelyFastChemistry/infinitelyFastChemistry.C +++ b/src/combustionModels/infinitelyFastChemistry/infinitelyFastChemistry.C @@ -94,7 +94,7 @@ bool infinitelyFastChemistry<ReactionThermo, ThermoType>::read() { if (singleStepCombustion<ReactionThermo, ThermoType>::read()) { - this->coeffs().lookup("C") >> C_ ; + this->coeffs().readEntry("C", C_); return true; } else diff --git a/src/combustionModels/laminar/laminar.C b/src/combustionModels/laminar/laminar.C index 1d59abe7b08c73e341083aec63f7119da8ae180d..425920e9bfdb02b48d723382a8ce50d43139022b 100644 --- a/src/combustionModels/laminar/laminar.C +++ b/src/combustionModels/laminar/laminar.C @@ -90,16 +90,12 @@ void Foam::combustionModels::laminar<ReactionThermo>::correct() const scalarField& rDeltaT = fv::localEulerDdt::localRDeltaT(this->mesh()); - if (this->coeffs().found("maxIntegrationTime")) + scalar maxTime; + if (this->coeffs().readIfPresent("maxIntegrationTime", maxTime)) { - scalar maxIntegrationTime - ( - readScalar(this->coeffs().lookup("maxIntegrationTime")) - ); - this->chemistryPtr_->solve ( - min(1.0/rDeltaT, maxIntegrationTime)() + min(1.0/rDeltaT, maxTime)() ); } else diff --git a/src/conversion/ensight/mesh/ensightMesh.C b/src/conversion/ensight/mesh/ensightMesh.C index c17901fb03a89d1a5a1cb501f2a44d2a99217bdb..918ef7325390022c9a0f1246e43a1158722b6912 100644 --- a/src/conversion/ensight/mesh/ensightMesh.C +++ b/src/conversion/ensight/mesh/ensightMesh.C @@ -131,11 +131,8 @@ void Foam::ensightMesh::correct() wordList patchNames = mesh_.boundaryMesh().names(); if (Pstream::parRun()) { - patchNames.setSize - ( - mesh_.boundary().size() - - mesh_.globalData().processorPatches().size() - ); + // Do not include processor patches in matching + patchNames.setSize(mesh_.boundaryMesh().nNonProcessor()); } labelList matched; @@ -158,9 +155,8 @@ void Foam::ensightMesh::correct() matched = identity(patchNames.size()); } - forAll(matched, matchi) + for (const label patchId : matched) { - const label patchId = matched[matchi]; const word& patchName = patchNames[patchId]; // use fvPatch (not polyPatch) to automatically remove empty patches @@ -224,9 +220,8 @@ void Foam::ensightMesh::correct() // Mark boundary faces to be excluded from export bitSet excludeFace(mesh_.nFaces()); // all false - forAll(mesh_.boundaryMesh(), patchi) + for (const polyPatch& pp : mesh_.boundaryMesh()) { - const polyPatch& pp = mesh_.boundaryMesh()[patchi]; if ( isA<processorPolyPatch>(pp) @@ -250,9 +245,8 @@ void Foam::ensightMesh::correct() Foam::sort(selectZones); // Count face types in each selected faceZone - forAll(selectZones, zonei) + for (const word& zoneName : selectZones) { - const word& zoneName = selectZones[zonei]; const label zoneID = mesh_.faceZones().findZoneID(zoneName); const faceZone& fz = mesh_.faceZones()[zoneID]; @@ -318,9 +312,8 @@ void Foam::ensightMesh::write(ensightGeoFile& os) const // use sortedToc for extra safety // const labelList patchIds = patchLookup_.sortedToc(); - forAll(patchIds, listi) + for (const label patchId : patchIds) { - const label patchId = patchIds[listi]; const word& patchName = patchLookup_[patchId]; const ensightFaces& ensFaces = boundaryPatchFaces_[patchName]; @@ -341,9 +334,9 @@ void Foam::ensightMesh::write(ensightGeoFile& os) const // Renumber the patch faces, // from local patch indexing to unique global index faceList patchFaces(pp.localFaces()); - forAll(patchFaces, i) + for (face& f : patchFaces) { - inplaceRenumber(pointToGlobal, patchFaces[i]); + inplaceRenumber(pointToGlobal, f); } writeAllPoints @@ -363,9 +356,8 @@ void Foam::ensightMesh::write(ensightGeoFile& os) const // write faceZones, if requested // const wordList zoneNames = faceZoneFaces_.sortedToc(); - forAll(zoneNames, zonei) + for (const word& zoneName : zoneNames) { - const word& zoneName = zoneNames[zonei]; const ensightFaces& ensFaces = faceZoneFaces_[zoneName]; // Use the properly sorted faceIds (ensightFaces) and do NOT use the diff --git a/src/conversion/ensight/mesh/ensightMesh.H b/src/conversion/ensight/mesh/ensightMesh.H index ee4bed65ed05458ee8cb41ef0f02c2e7076061ec..16ec9645b947e1fa7c6791ccd0f9620cbbb5ed21 100644 --- a/src/conversion/ensight/mesh/ensightMesh.H +++ b/src/conversion/ensight/mesh/ensightMesh.H @@ -98,14 +98,14 @@ private: // Parallel merged points - //- Global numbering for merged points - autoPtr<globalIndex> globalPointsPtr_; + //- Global numbering for merged points + autoPtr<globalIndex> globalPointsPtr_; - //- From mesh point to global merged point - labelList pointToGlobal_; + //- From mesh point to global merged point + labelList pointToGlobal_; - //- Local points that are unique - labelList uniquePointMap_; + //- Local points that are unique + labelList uniquePointMap_; // Private Member Functions @@ -117,122 +117,130 @@ private: //- Inplace renumber of cell-shapes static cellShapeList& renumberShapes ( - cellShapeList&, + cellShapeList& shapes, const labelUList& pointToGlobal ); static cellShapeList map ( - const cellShapeList&, - const labelUList& prims, + const cellShapeList& shapes, + const labelUList& addr, const labelUList& pointToGlobal ); //- Write list of faces static void writeFaceList ( - const faceList&, - ensightGeoFile& + const faceList& faces, + ensightGeoFile& os ); //- Write list of faces static void writeFaceList ( - const UIndirectList<face>&, - ensightGeoFile& + const UIndirectList<face>& faces, + ensightGeoFile& os ); //- Write sizes of faces in the list static void writeFaceSizes ( - const faceList&, - ensightGeoFile& + const faceList& faces, + ensightGeoFile& os ); //- Write sizes of faces in the list static void writeFaceSizes ( - const UIndirectList<face>&, - ensightGeoFile& + const UIndirectList<face>& faces, + ensightGeoFile& os ); - //- Write cell connectivity via shell shapes + //- Write cell connectivity via cell shapes static void writeCellShapes ( - const cellShapeList&, - ensightGeoFile& + const cellShapeList& shapes, + ensightGeoFile& os ); + //- Write the number of faces per poly element void writePolysNFaces ( - const labelList& polys, + const labelUList& polys, const cellList& cellFaces, - ensightGeoFile& + ensightGeoFile& os ) const; + //- Write the number of points per poly element void writePolysNPointsPerFace ( - const labelList& polys, + const labelUList& polys, const cellList& cellFaces, const faceList& faces, ensightGeoFile& ) const; + //- Write the point ids per poly element void writePolysPoints ( - const labelList& polys, + const labelUList& addr, const cellList& cellFaces, const faceList& faces, const labelList& faceOwner, ensightGeoFile& ) const; + //- Write the poly connectivity void writePolysConnectivity ( - const labelList& addr, + const labelUList& polys, const labelList& pointToGlobal, ensightGeoFile& ) const; + //- Write the regular cell connectivity for all types void writeCellConnectivity ( - const ensightCells&, + const ensightCells& ensCells, const labelList& pointToGlobal, - ensightGeoFile& + ensightGeoFile& os ) const; + //- Write the regular cell connectivity for specified type void writeCellConnectivity ( ensightCells::elemType elemType, - const ensightCells&, + const ensightCells& ensCells, const labelList& pointToGlobal, - ensightGeoFile& + ensightGeoFile& os ) const; + //- Write the regular face connectivity for specified type and + //- and specified faces void writeFaceConnectivity ( ensightFaces::elemType elemType, const label nTotal, - const faceList& faceLst, - const labelList& addr, + const faceList& faces, + const labelUList& addr, ensightGeoFile& ) const; - + //- Write the regular face connectivity for specified type void writeFaceConnectivity ( ensightFaces::elemType elemType, const label nTotal, - const faceList& faceLst, - ensightGeoFile& + const faceList& faces, + ensightGeoFile& os ) const; void writeFaceConnectivity ( - const ensightFaces&, - const faceList& faceLst, - ensightGeoFile&, + const ensightFaces& ensFaces, + const faceList& faces, + ensightGeoFile& os, const bool raw = false ) const; diff --git a/src/conversion/ensight/mesh/ensightMeshIO.C b/src/conversion/ensight/mesh/ensightMeshIO.C index 037b8d98a2d2772723fd03f4fbff00b958cf038a..6e342bf22304cc8a70b5f94cfff43a0a0c5e4287 100644 --- a/src/conversion/ensight/mesh/ensightMeshIO.C +++ b/src/conversion/ensight/mesh/ensightMeshIO.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 | Copyright (C) 2016-2017 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -42,9 +42,9 @@ Foam::cellShapeList& Foam::ensightMesh::renumberShapes const labelUList& pointToGlobal ) { - forAll(shapes, i) + for (cellShape& shape : shapes) { - inplaceRenumber(pointToGlobal, shapes[i]); + inplaceRenumber(pointToGlobal, shape); } return shapes; @@ -58,15 +58,15 @@ Foam::cellShapeList Foam::ensightMesh::map const labelUList& pointToGlobal ) { - cellShapeList lst(addr.size()); + cellShapeList list(addr.size()); forAll(addr, i) { - lst[i] = shapes[addr[i]]; - inplaceRenumber(pointToGlobal, lst[i]); + list[i] = shapes[addr[i]]; + inplaceRenumber(pointToGlobal, list[i]); } - return lst; + return list; } @@ -76,13 +76,11 @@ void Foam::ensightMesh::writeFaceList ensightGeoFile& os ) { - forAll(faceLst, i) + for (const face& f : faceLst) { - const face& f = faceLst[i]; - - forAll(f, fp) + for (const label labi : f) { - os.write(f[fp] + 1); + os.write(labi + 1); } os.newline(); @@ -96,13 +94,11 @@ void Foam::ensightMesh::writeFaceList ensightGeoFile& os ) { - forAll(faceLst, i) + for (const face& f : faceLst) { - const face& f = faceLst[i]; - - forAll(f, fp) + for (const label labi : f) { - os.write(f[fp] + 1); + os.write(labi + 1); } os.newline(); @@ -116,10 +112,8 @@ void Foam::ensightMesh::writeFaceSizes ensightGeoFile& os ) { - forAll(faceLst, i) + for (const face& f : faceLst) { - const face& f = faceLst[i]; - os.write(f.size()); os.newline(); } @@ -132,10 +126,8 @@ void Foam::ensightMesh::writeFaceSizes ensightGeoFile& os ) { - forAll(faceLst, i) + for (const face& f : faceLst) { - const face& f = faceLst[i]; - os.write(f.size()); os.newline(); } @@ -148,17 +140,15 @@ void Foam::ensightMesh::writeCellShapes ensightGeoFile& os ) { - forAll(shapes, i) + for (const cellShape& cellPoints : shapes) { - const cellShape& cellPoints = shapes[i]; - // convert global -> local index // (note: Ensight indices start with 1) // In ASCII, write one cell per line - forAll(cellPoints, pointI) + for (const label pointi : cellPoints) { - os.write(cellPoints[pointI] + 1); + os.write(pointi + 1); } os.newline(); @@ -170,15 +160,15 @@ void Foam::ensightMesh::writeCellShapes void Foam::ensightMesh::writePolysNFaces ( - const labelList& addr, - const cellList& cellFaces, + const labelUList& addr, + const cellList& cellFaces, ensightGeoFile& os ) const { - // write the number of faces per element (1/line in ASCII) - forAll(addr, i) + // Write the number of faces per element (1/line in ASCII) + for (const label cellId : addr) { - const labelUList& cf = cellFaces[addr[i]]; + const labelUList& cf = cellFaces[cellId]; os.write(cf.size()); os.newline(); @@ -188,20 +178,20 @@ void Foam::ensightMesh::writePolysNFaces void Foam::ensightMesh::writePolysNPointsPerFace ( - const labelList& addr, + const labelUList& addr, const cellList& cellFaces, const faceList& faces, ensightGeoFile& os ) const { - // write the number of points per element face (1/line in ASCII) - forAll(addr, i) + // Write the number of points per element face (1/line in ASCII) + for (const label cellId : addr) { - const labelUList& cf = cellFaces[addr[i]]; + const labelUList& cf = cellFaces[cellId]; - forAll(cf, facei) + for (const label facei : cf) { - os.write(faces[cf[facei]].size()); + os.write(faces[facei].size()); os.newline(); } } @@ -210,21 +200,19 @@ void Foam::ensightMesh::writePolysNPointsPerFace void Foam::ensightMesh::writePolysPoints ( - const labelList& addr, + const labelUList& addr, const cellList& cellFaces, const faceList& faces, const labelList& faceOwner, ensightGeoFile& os ) const { - forAll(addr, i) + for (const label cellId : addr) { - const label cellId = addr[i]; const labelUList& cf = cellFaces[cellId]; - forAll(cf, facei) + for (const label faceId : cf) { - const label faceId = cf[facei]; const face& f = faces[faceId]; // face points (in global points) if (faceId < faceOwner.size() && faceOwner[faceId] != cellId) @@ -234,16 +222,16 @@ void Foam::ensightMesh::writePolysPoints // as per face::reverseFace(), but without copying os.write(f[0] + 1); - for (label ptI = f.size()-1; ptI > 0; --ptI) + for (label pti = f.size()-1; pti > 0; --pti) { - os.write(f[ptI] + 1); + os.write(f[pti] + 1); } } else { - forAll(f, ptI) + for (const label labi : f) { - os.write(f[ptI] + 1); + os.write(labi + 1); } } @@ -255,7 +243,7 @@ void Foam::ensightMesh::writePolysPoints void Foam::ensightMesh::writePolysConnectivity ( - const labelList& addr, + const labelUList& addr, const labelList& pointToGlobal, ensightGeoFile& os ) const @@ -329,9 +317,9 @@ void Foam::ensightMesh::writePolysConnectivity // Renumber faces to use global point numbers faceList faces(mesh_.faces()); - forAll(faces, i) + for (face& f : faces) { - inplaceRenumber(pointToGlobal, faces[i]); + inplaceRenumber(pointToGlobal, f); } // List of points id for each face of the above list @@ -409,11 +397,14 @@ void Foam::ensightMesh::writeCellConnectivity } else { - const cellShapeList shapes = map + const cellShapeList shapes ( - mesh_.cellShapes(), - addr, - pointToGlobal + map + ( + mesh_.cellShapes(), + addr, + pointToGlobal + ) ); @@ -454,7 +445,8 @@ void Foam::ensightMesh::writeCellConnectivity { for (label typei=0; typei < ensightCells::nTypes; ++typei) { - const ensightCells::elemType what = ensightCells::elemType(typei); + const ensightCells::elemType what = + ensightCells::elemType(typei); writeCellConnectivity(what, ensCells, pointToGlobal, os); } @@ -489,9 +481,9 @@ void Foam::ensightMesh::writeFaceConnectivity for (int slave=1; slave<Pstream::nProcs(); ++slave) { IPstream fromSlave(Pstream::commsTypes::scheduled, slave); - faceList received(fromSlave); + faceList recv(fromSlave); - writeFaceSizes(received, os); + writeFaceSizes(recv, os); } } else @@ -516,9 +508,9 @@ void Foam::ensightMesh::writeFaceConnectivity for (int slave=1; slave<Pstream::nProcs(); ++slave) { IPstream fromSlave(Pstream::commsTypes::scheduled, slave); - faceList received(fromSlave); + faceList recv(fromSlave); - writeFaceList(received, os); + writeFaceList(recv, os); } } else @@ -541,7 +533,7 @@ void Foam::ensightMesh::writeFaceConnectivity ensightFaces::elemType elemType, const label nTotal, const faceList& faceLst, - const labelList& addr, + const labelUList& addr, ensightGeoFile& os ) const { @@ -621,12 +613,13 @@ void Foam::ensightMesh::writeFaceConnectivity const bool raw ) const { - if (raw) + for (label typei=0; typei < ensightFaces::nTypes; ++typei) { - for (label typei=0; typei < ensightFaces::nTypes; ++typei) - { - const ensightFaces::elemType what = ensightFaces::elemType(typei); + const ensightFaces::elemType what = + ensightFaces::elemType(typei); + if (raw) + { writeFaceConnectivity ( what, @@ -640,13 +633,8 @@ void Foam::ensightMesh::writeFaceConnectivity os ); } - } - else - { - for (label typei=0; typei < ensightFaces::nTypes; ++typei) + else { - const ensightFaces::elemType what = ensightFaces::elemType(typei); - writeFaceConnectivity ( what, diff --git a/src/conversion/ensight/mesh/ensightMeshOptions.C b/src/conversion/ensight/mesh/ensightMeshOptions.C index 7dbafafab2e3c792a03eb29b3df4c0142620f0f6..1c253606fc10477a16239933e6bd6eae679134a8 100644 --- a/src/conversion/ensight/mesh/ensightMeshOptions.C +++ b/src/conversion/ensight/mesh/ensightMeshOptions.C @@ -25,7 +25,6 @@ License #include "ensightMesh.H" - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::ensightMesh::options::options(IOstream::streamFormat format) diff --git a/src/conversion/ensight/output/ensightOutputTemplates.C b/src/conversion/ensight/output/ensightOutputTemplates.C index 3ffb0661498a18c70a72400afed499b11b886a9e..8dd3f1a59b8cf46af2e95bb34769a85e6eb1040b 100644 --- a/src/conversion/ensight/output/ensightOutputTemplates.C +++ b/src/conversion/ensight/output/ensightOutputTemplates.C @@ -144,7 +144,9 @@ bool Foam::ensightOutput::writeFaceSubField label start = 0; // start of sublist for (label typei=0; typei < ensightFaces::nTypes; ++typei) { - const ensightFaces::elemType what = ensightFaces::elemType(typei); + const ensightFaces::elemType what = + ensightFaces::elemType(typei); + const label size = ensFaces.faceIds(what).size(); writeFieldContent @@ -159,10 +161,8 @@ bool Foam::ensightOutput::writeFaceSubField return true; } - else - { - return false; - } + + return false; } @@ -183,7 +183,8 @@ bool Foam::ensightOutput::writeCellField for (label typei=0; typei < ensightCells::nTypes; ++typei) { - const ensightCells::elemType what = ensightCells::elemType(typei); + const ensightCells::elemType what = + ensightCells::elemType(typei); writeFieldContent ( @@ -195,10 +196,8 @@ bool Foam::ensightOutput::writeCellField return true; } - else - { - return false; - } + + return false; } @@ -229,9 +228,8 @@ bool Foam::ensightOutput::writeField // use sortedToc for extra safety // const labelList patchIds = patchLookup.sortedToc(); - forAll(patchIds, listi) + for (const label patchId : patchIds) { - const label patchId = patchIds[listi]; const word& patchName = patchLookup[patchId]; const ensightFaces& ensFaces = patchFaces[patchName]; @@ -293,9 +291,8 @@ bool Foam::ensightOutput::writeField } } - forAll(zoneNames, zonei) + for (const word& zoneName : zoneNames) { - const word& zoneName = zoneNames[zonei]; const ensightFaces& ensFaces = zoneFaces[zoneName]; // field (local size) @@ -362,9 +359,8 @@ bool Foam::ensightOutput::ensightPointField // use sortedToc for extra safety // const labelList patchIds = patchLookup.sortedToc(); - forAll(patchIds, listi) + for (const label patchId : patchIds) { - const label patchId = patchIds[listi]; const word& patchName = patchLookup[patchId]; const ensightFaces& ensFaces = patchFaces[patchName]; @@ -399,9 +395,8 @@ bool Foam::ensightOutput::ensightPointField // write faceZones, if requested // const wordList zoneNames = zoneFaces.sortedToc(); - forAll(zoneNames, zonei) + for (const word& zoneName : zoneNames) { - const word& zoneName = zoneNames[zonei]; const ensightFaces& ensFaces = zoneFaces[zoneName]; uindirectPrimitivePatch p diff --git a/src/conversion/ensight/output/ensightSerialOutputTemplates.C b/src/conversion/ensight/output/ensightSerialOutputTemplates.C index ae15572f4c8f50f35287f5c3fd845298bcfb94d1..3a027ab6dddf1699e2ffa41cc5ccb8de8fd1ac3a 100644 --- a/src/conversion/ensight/output/ensightSerialOutputTemplates.C +++ b/src/conversion/ensight/output/ensightSerialOutputTemplates.C @@ -115,7 +115,8 @@ bool Foam::ensightSerialOutput::writeField for (label typei=0; typei < ensightCells::nTypes; ++typei) { - const ensightCells::elemType what = ensightCells::elemType(typei); + const ensightCells::elemType what = + ensightCells::elemType(typei); writeFieldContent ( diff --git a/src/dynamicMesh/extrudePatchMesh/extrudePatchMesh.C b/src/dynamicMesh/extrudePatchMesh/extrudePatchMesh.C index 2790c62e5224f00a5634fb9d99c80ef3f30a6fc8..da956b34035f7ae030a215fa908b747b43701e06 100644 --- a/src/dynamicMesh/extrudePatchMesh/extrudePatchMesh.C +++ b/src/dynamicMesh/extrudePatchMesh/extrudePatchMesh.C @@ -117,8 +117,8 @@ extrudePatchMesh::extrudePatchMesh forAll(dicts, patchi) { - dicts[patchi].lookup("name") >> patchNames[patchi]; - dicts[patchi].lookup("type") >> patchTypes[patchi]; + dicts[patchi].readEntry("name", patchNames[patchi]); + dicts[patchi].readEntry("type", patchTypes[patchi]); } forAll(regionPatches, patchi) @@ -273,8 +273,8 @@ void extrudePatchMesh::extrudeMesh(const List<polyPatch*>& regionPatches) forAll(dicts, patchi) { - dicts[patchi].lookup("name") >> patchNames[patchi]; - dicts[patchi].lookup("type") >> patchTypes[patchi]; + dicts[patchi].readEntry("name", patchNames[patchi]); + dicts[patchi].readEntry("type", patchTypes[patchi]); } forAll(regionPatches, patchi) diff --git a/src/dynamicMesh/fvMeshSubset/fvMeshSubsetInterpolate.C b/src/dynamicMesh/fvMeshSubset/fvMeshSubsetInterpolate.C index df9ec2aacfb622cc2a12ef892f2b0a8103731cc9..b65dbea1dcd573b3084773f6d26efac9c5891ca0 100644 --- a/src/dynamicMesh/fvMeshSubset/fvMeshSubsetInterpolate.C +++ b/src/dynamicMesh/fvMeshSubset/fvMeshSubsetInterpolate.C @@ -96,6 +96,7 @@ fvMeshSubset::interpolate ), sMesh, vf.dimensions(), + // Move construct for internal field Field<Type>(vf.primitiveField(), cellMap), patchFields ); @@ -231,14 +232,11 @@ fvMeshSubset::interpolate ), sMesh, vf.dimensions(), + // Move construct for internal field Field<Type> ( vf.primitiveField(), - SubList<label> - ( - faceMap, - sMesh.nInternalFaces() - ) + SubList<label>(faceMap, sMesh.nInternalFaces()) ), patchFields ); @@ -411,6 +409,7 @@ fvMeshSubset::interpolate ), sMesh, vf.dimensions(), + // Move construct for internal field Field<Type>(vf.primitiveField(), pointMap), patchFields ); diff --git a/src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionFunctions/SDA/SDA.C b/src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionFunctions/SDA/SDA.C index 4c9dbed484dd5c4a6f3d2e85ba0b07ae1efe5705..ebb9583020c1a5bf3e06ce315608bf296df6571f 100644 --- a/src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionFunctions/SDA/SDA.C +++ b/src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionFunctions/SDA/SDA.C @@ -103,17 +103,17 @@ bool Foam::solidBodyMotionFunctions::SDA::read(const dictionary& SBMFCoeffs) { solidBodyMotionFunction::read(SBMFCoeffs); - SBMFCoeffs_.lookup("CofG") >> CofG_; - SBMFCoeffs_.lookup("lamda") >> lamda_; - SBMFCoeffs_.lookup("rollAmax") >> rollAmax_; - SBMFCoeffs_.lookup("rollAmin") >> rollAmin_; - SBMFCoeffs_.lookup("heaveA") >> heaveA_; - SBMFCoeffs_.lookup("swayA") >> swayA_; - SBMFCoeffs_.lookup("Q") >> Q_; - SBMFCoeffs_.lookup("Tp") >> Tp_; - SBMFCoeffs_.lookup("Tpn") >> Tpn_; - SBMFCoeffs_.lookup("dTi") >> dTi_; - SBMFCoeffs_.lookup("dTp") >> dTp_; + SBMFCoeffs_.readEntry("CofG", CofG_); + SBMFCoeffs_.readEntry("lamda", lamda_); + SBMFCoeffs_.readEntry("rollAmax", rollAmax_); + SBMFCoeffs_.readEntry("rollAmin", rollAmin_); + SBMFCoeffs_.readEntry("heaveA", heaveA_); + SBMFCoeffs_.readEntry("swayA", swayA_); + SBMFCoeffs_.readEntry("Q", Q_); + SBMFCoeffs_.readEntry("Tp", Tp_); + SBMFCoeffs_.readEntry("Tpn", Tpn_); + SBMFCoeffs_.readEntry("dTi", dTi_); + SBMFCoeffs_.readEntry("dTp", dTp_); // Rescale parameters according to the given scale parameter if (lamda_ > 1 + SMALL) diff --git a/src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionFunctions/axisRotationMotion/axisRotationMotion.C b/src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionFunctions/axisRotationMotion/axisRotationMotion.C index fb5d430704d52ce6ee6fc6fbfbfefb0929638683..06dc0697ded4caecc48a5687497fb764a4088521 100644 --- a/src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionFunctions/axisRotationMotion/axisRotationMotion.C +++ b/src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionFunctions/axisRotationMotion/axisRotationMotion.C @@ -98,8 +98,8 @@ bool Foam::solidBodyMotionFunctions::axisRotationMotion::read { solidBodyMotionFunction::read(SBMFCoeffs); - SBMFCoeffs_.lookup("origin") >> origin_; - SBMFCoeffs_.lookup("radialVelocity") >> radialVelocity_; + SBMFCoeffs_.readEntry("origin", origin_); + SBMFCoeffs_.readEntry("radialVelocity", radialVelocity_); return true; } diff --git a/src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionFunctions/linearMotion/linearMotion.C b/src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionFunctions/linearMotion/linearMotion.C index a382d190630aab729b4e1b201935d43bbb3d6b27..1b1ff9f5609ef08b6ca5e38359eeac480f49030a 100644 --- a/src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionFunctions/linearMotion/linearMotion.C +++ b/src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionFunctions/linearMotion/linearMotion.C @@ -89,7 +89,7 @@ bool Foam::solidBodyMotionFunctions::linearMotion::read { solidBodyMotionFunction::read(SBMFCoeffs); - SBMFCoeffs_.lookup("velocity") >> velocity_; + SBMFCoeffs_.readEntry("velocity", velocity_); return true; } diff --git a/src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionFunctions/oscillatingLinearMotion/oscillatingLinearMotion.C b/src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionFunctions/oscillatingLinearMotion/oscillatingLinearMotion.C index 3b469090153d9e395c6e75a79b18c7def4e233b4..1aa8aa1a9d4b33ae38e931e33fe22e97ae928a3c 100644 --- a/src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionFunctions/oscillatingLinearMotion/oscillatingLinearMotion.C +++ b/src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionFunctions/oscillatingLinearMotion/oscillatingLinearMotion.C @@ -89,8 +89,8 @@ bool Foam::solidBodyMotionFunctions::oscillatingLinearMotion::read { solidBodyMotionFunction::read(SBMFCoeffs); - SBMFCoeffs_.lookup("amplitude") >> amplitude_; - SBMFCoeffs_.lookup("omega") >> omega_; + SBMFCoeffs_.readEntry("amplitude", amplitude_); + SBMFCoeffs_.readEntry("omega", omega_); return true; } diff --git a/src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionFunctions/oscillatingRotatingMotion/oscillatingRotatingMotion.C b/src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionFunctions/oscillatingRotatingMotion/oscillatingRotatingMotion.C index eff5e30fc2db2d431eeb638b665095d27ec508c2..30d36c16c124f11a565ea2491b82a27f151dab1e 100644 --- a/src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionFunctions/oscillatingRotatingMotion/oscillatingRotatingMotion.C +++ b/src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionFunctions/oscillatingRotatingMotion/oscillatingRotatingMotion.C @@ -97,9 +97,9 @@ bool Foam::solidBodyMotionFunctions::oscillatingRotatingMotion::read { solidBodyMotionFunction::read(SBMFCoeffs); - SBMFCoeffs_.lookup("origin") >> origin_; - SBMFCoeffs_.lookup("amplitude") >> amplitude_; - SBMFCoeffs_.lookup("omega") >> omega_; + SBMFCoeffs_.readEntry("origin", origin_); + SBMFCoeffs_.readEntry("amplitude", amplitude_); + SBMFCoeffs_.readEntry("omega", omega_); return true; } diff --git a/src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionFunctions/tabulated6DoFMotion/tabulated6DoFMotion.C b/src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionFunctions/tabulated6DoFMotion/tabulated6DoFMotion.C index f185693c85c2f3b06e2a5dd37511a776010b7625..1e3dd7ced38dd92569f2c7838ff475578bea8f16 100644 --- a/src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionFunctions/tabulated6DoFMotion/tabulated6DoFMotion.C +++ b/src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionFunctions/tabulated6DoFMotion/tabulated6DoFMotion.C @@ -157,7 +157,7 @@ bool Foam::solidBodyMotionFunctions::tabulated6DoFMotion::read } } - SBMFCoeffs_.lookup("CofG") >> CofG_; + SBMFCoeffs_.readEntry("CofG", CofG_); return true; } diff --git a/src/fileFormats/ensight/file/ensightCase.C b/src/fileFormats/ensight/file/ensightCase.C index 1193d3a691a704262e9788933879ed0b338abbd6..f1db3a2a74c6e454674dd03aec215b3688ea86f4 100644 --- a/src/fileFormats/ensight/file/ensightCase.C +++ b/src/fileFormats/ensight/file/ensightCase.C @@ -66,7 +66,8 @@ void Foam::ensightCase::initialize() } else { - Info<<"Warning: re-using existing directory" << nl + DetailInfo + <<"Warning: re-using existing directory" << nl << " " << ensightDir_ << endl; } } diff --git a/src/fileFormats/ensight/file/ensightCase.H b/src/fileFormats/ensight/file/ensightCase.H index d8da24bf0450bddd2d70fc40c4fa6bba28faa085..67ff0eb3710326a850adf62b4d23c210513f2495 100644 --- a/src/fileFormats/ensight/file/ensightCase.H +++ b/src/fileFormats/ensight/file/ensightCase.H @@ -87,7 +87,7 @@ private: //- Case name (with ".case" ending) word caseName_; - //- Output stream + //- Output stream (master only) mutable OFstream* os_; //- Track state changes since last write diff --git a/src/fileFormats/ensight/file/ensightFile.C b/src/fileFormats/ensight/file/ensightFile.C index b60b8db10c4bf51f02262ffb7ddba62f5ec0f483..69a24d5b4c61d24e40640dc52547557c061dd960 100644 --- a/src/fileFormats/ensight/file/ensightFile.C +++ b/src/fileFormats/ensight/file/ensightFile.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 | Copyright (C) 2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -123,12 +123,6 @@ Foam::ensightFile::ensightFile } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::ensightFile::~ensightFile() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // bool Foam::ensightFile::allowUndef() @@ -137,10 +131,10 @@ bool Foam::ensightFile::allowUndef() } -bool Foam::ensightFile::allowUndef(bool value) +bool Foam::ensightFile::allowUndef(bool enabled) { bool old = allowUndef_; - allowUndef_ = value; + allowUndef_ = enabled; return old; } diff --git a/src/fileFormats/ensight/file/ensightFile.H b/src/fileFormats/ensight/file/ensightFile.H index 4d2592521dde04c0eb87088da68eb9f0ebe90786..2ee73905345f88190ec5cd247d9583efe08ff359 100644 --- a/src/fileFormats/ensight/file/ensightFile.H +++ b/src/fileFormats/ensight/file/ensightFile.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -112,7 +112,7 @@ public: //- Destructor - ~ensightFile(); + ~ensightFile() = default; // Access @@ -136,12 +136,13 @@ public: // Edit - static bool allowUndef(bool); + //- Enable/disable use of \c undef keyword and value + static bool allowUndef(bool enabled); //- Assign the value to represent undef in the results // Returns the previous value // NB: do not use values larger than floatScalarVGREAT - static scalar undefValue(const scalar); + static scalar undefValue(const scalar value); // Output @@ -150,10 +151,10 @@ public: using Ostream::write; //- Binary write - virtual Ostream& write(const char*, std::streamsize count); + virtual Ostream& write(const char* buf, std::streamsize count); //- Write element keyword with trailing newline, optionally with undef - virtual Ostream& writeKeyword(const keyType&); + virtual Ostream& writeKeyword(const keyType& key); //- Write "C Binary" for binary files (eg, geometry/measured) Ostream& writeBinaryHeader(); @@ -182,7 +183,7 @@ public: // Convenience Output Methods - //- Begin a part (0-based index). + //- Begin a part (0-based index internally). void beginPart(const label index); //- Begin a "particle coordinates" block (measured data) diff --git a/src/fileFormats/ensight/file/ensightGeoFile.C b/src/fileFormats/ensight/file/ensightGeoFile.C index e45b70a50b13a75b893fa80f6a98e42dfa46859f..c84e91dc1caa1ff3eb05d4c0f81b93c2a15b4688 100644 --- a/src/fileFormats/ensight/file/ensightGeoFile.C +++ b/src/fileFormats/ensight/file/ensightGeoFile.C @@ -80,17 +80,11 @@ Foam::ensightGeoFile::ensightGeoFile } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::ensightGeoFile::~ensightGeoFile() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // Foam::Ostream& Foam::ensightGeoFile::writeKeyword(const keyType& key) { - // ensure we get ensightFile::write(const string&) + // Ensure we get ensightFile::write(const string&) write(static_cast<const string&>(key)); newline(); diff --git a/src/fileFormats/ensight/file/ensightGeoFile.H b/src/fileFormats/ensight/file/ensightGeoFile.H index eb83526c658b9522f391dd5f95f9204b6dd23835..6abc98adb5ac2a559f7cc5db45fddfdb55ab8049 100644 --- a/src/fileFormats/ensight/file/ensightGeoFile.H +++ b/src/fileFormats/ensight/file/ensightGeoFile.H @@ -91,7 +91,7 @@ public: //- Destructor - ~ensightGeoFile(); + ~ensightGeoFile() = default; // Output @@ -102,6 +102,7 @@ public: // Convenience Output Methods + //- Begin a part (0-based index). using ensightFile::beginPart; //- Begin a "part" (0-based index), with a description. diff --git a/src/fileFormats/ensight/name/ensightFileName.H b/src/fileFormats/ensight/name/ensightFileName.H index 1452730107ae2772e89bf972f2ead996cc1c74d5..57971ad6a031795e9452df33ff3ea5780cc435c1 100644 --- a/src/fileFormats/ensight/name/ensightFileName.H +++ b/src/fileFormats/ensight/name/ensightFileName.H @@ -65,25 +65,25 @@ public: // Constructors - //- Construct as copy - inline explicit FileName(const FileName&); + //- Copy construct + inline FileName(const FileName& fn); //- Construct as copy of character array - inline explicit FileName(const char*); + inline explicit FileName(const char* s); //- Construct as copy of std::string - inline explicit FileName(const std::string&); + inline explicit FileName(const std::string& s); // Member functions //- Is this character valid for an ensight file-name - inline static bool valid(char); + inline static bool valid(char c); - // Member operators + // Member Operators - // Assignment (disabled) + // Assignment (disabled) void operator=(const fileName&) = delete; void operator=(const word&) = delete; diff --git a/src/fileFormats/ensight/name/ensightVarName.H b/src/fileFormats/ensight/name/ensightVarName.H index 2ffff6ae193f930adeb188716cbdd38dee2c0cf9..4158240ef62d6c097a040caef688a797a84b2ee5 100644 --- a/src/fileFormats/ensight/name/ensightVarName.H +++ b/src/fileFormats/ensight/name/ensightVarName.H @@ -67,25 +67,26 @@ public: // Constructors - //- Construct as copy - inline explicit VarName(const VarName&); + //- Copy construct + inline VarName(const VarName& vn); //- Construct as copy of character array - inline explicit VarName(const char*); + inline explicit VarName(const char* s); //- Construct as copy of std::string - inline explicit VarName(const std::string&); + inline explicit VarName(const std::string& s); - // Member functions + // Member Functions //- Is this character valid for an ensight var-name - inline static bool valid(char); + inline static bool valid(char c); - // Member operators + // Member Operators + + // Assignment (disabled) - // Assignment (disabled) void operator=(const word&) = delete; void operator=(const string&) = delete; void operator=(const std::string&) = delete; diff --git a/src/fileFormats/ensight/part/ensightCells.C b/src/fileFormats/ensight/part/ensightCells.C index 039f62c1cc1fb736cc20487d1401b63c7709999a..8d734bf7f4699b285c24c363c58ae8b86d394231 100644 --- a/src/fileFormats/ensight/part/ensightCells.C +++ b/src/fileFormats/ensight/part/ensightCells.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -30,8 +30,6 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -const Foam::label Foam::ensightCells::nTypes = 5; - const char* Foam::ensightCells::elemNames[5] = { "tetra4", "pyramid5", "penta6", "hexa8", "nfaced" }; @@ -62,6 +60,12 @@ void Foam::ensightCells::resizeAll() // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // +Foam::ensightCells::ensightCells() +: + ensightCells(0) +{} + + Foam::ensightCells::ensightCells(const label partIndex) : index_(partIndex), @@ -93,12 +97,6 @@ Foam::ensightCells::ensightCells(const ensightCells& obj) } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::ensightCells::~ensightCells() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // Foam::FixedList<Foam::label, 5> Foam::ensightCells::sizes() const diff --git a/src/fileFormats/ensight/part/ensightCells.H b/src/fileFormats/ensight/part/ensightCells.H index 8dd096dd8708fd88fb99ba53f7d2305e98161066..54b4dbb35bcabada4e435d7fc735244809e68611 100644 --- a/src/fileFormats/ensight/part/ensightCells.H +++ b/src/fileFormats/ensight/part/ensightCells.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -41,6 +41,7 @@ Description namespace Foam { +// Forward declarations class polyMesh; /*---------------------------------------------------------------------------*\ @@ -64,7 +65,7 @@ public: }; //- Number of element types (5) - static const label nTypes; + static constexpr label nTypes = 5; //- The ensight element type names static const char* elemNames[5]; @@ -108,15 +109,18 @@ public: // Constructors - //- Construct null, optionally with index - ensightCells(label partIndex = 0); + //- Construct null, with part index 0 + ensightCells(); + + //- Construct null, with specified part index + explicit ensightCells(const label partIndex); //- Copy constructor. Needed for lists etc. ensightCells(const ensightCells& obj); //- Destructor - ~ensightCells(); + ~ensightCells() = default; // Member Functions diff --git a/src/fileFormats/ensight/part/ensightFaces.C b/src/fileFormats/ensight/part/ensightFaces.C index 21489d7d01f3303cddf01bb99afe8618af4d8bfa..8eda22616e506ffd3fdafb71f5dbb56272ad3235 100644 --- a/src/fileFormats/ensight/part/ensightFaces.C +++ b/src/fileFormats/ensight/part/ensightFaces.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -30,8 +30,6 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -const Foam::label Foam::ensightFaces::nTypes = 3; - const char* Foam::ensightFaces::elemNames[3] = { "tria3", "quad4", "nsided" }; @@ -101,7 +99,13 @@ void Foam::ensightFaces::resizeAll() // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::ensightFaces::ensightFaces(label partIndex) +Foam::ensightFaces::ensightFaces() +: + ensightFaces(0) +{} + + +Foam::ensightFaces::ensightFaces(const label partIndex) : index_(partIndex), address_(), @@ -134,12 +138,6 @@ Foam::ensightFaces::ensightFaces(const ensightFaces& obj) } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::ensightFaces::~ensightFaces() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // Foam::FixedList<Foam::label, 3> Foam::ensightFaces::sizes() const diff --git a/src/fileFormats/ensight/part/ensightFaces.H b/src/fileFormats/ensight/part/ensightFaces.H index abea086e3ba910213592d2470f6b4b8e9d062049..b159832617b188f13b8fd9eccf85ff2373e8a612 100644 --- a/src/fileFormats/ensight/part/ensightFaces.H +++ b/src/fileFormats/ensight/part/ensightFaces.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -62,7 +62,7 @@ public: }; //- Number of element types (3) - static const label nTypes; + static constexpr label nTypes = 3; //- The ensight element type names static const char* elemNames[3]; @@ -115,15 +115,18 @@ public: // Constructors - //- Construct null, optionally with index - ensightFaces(label partIndex = 0); + //- Construct null, with part index 0 + ensightFaces(); + + //- Construct null, with specified part index + explicit ensightFaces(const label partIndex); //- Copy constructor. Needed for lists etc. ensightFaces(const ensightFaces& obj); //- Destructor - ~ensightFaces(); + ~ensightFaces() = default; // Member Functions diff --git a/src/fileFormats/ensight/read/ensightReadFile.C b/src/fileFormats/ensight/read/ensightReadFile.C index 3331176816286b821509e2e853da80fd5fcff1b1..c2b0d4c4ca070f56a77d5b4836b117bef3a78fda 100644 --- a/src/fileFormats/ensight/read/ensightReadFile.C +++ b/src/fileFormats/ensight/read/ensightReadFile.C @@ -37,12 +37,6 @@ Foam::ensightReadFile::ensightReadFile {} -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::ensightReadFile::~ensightReadFile() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // Foam::Istream& Foam::ensightReadFile::read diff --git a/src/fileFormats/ensight/read/ensightReadFile.H b/src/fileFormats/ensight/read/ensightReadFile.H index 680056f27fdfa26aa7647600b83f8edaedc8d26c..055face5468f8f3ef65d1323555cd780170a268c 100644 --- a/src/fileFormats/ensight/read/ensightReadFile.H +++ b/src/fileFormats/ensight/read/ensightReadFile.H @@ -62,7 +62,7 @@ public: // Constructors - //- Construct from pathname + //- Construct from pathname. Default format is binary. ensightReadFile ( const fileName& pathname, @@ -71,7 +71,7 @@ public: //- Destructor - ~ensightReadFile(); + ~ensightReadFile() = default; // Output diff --git a/src/fileFormats/vtk/format/foamVtkAppendBase64Formatter.H b/src/fileFormats/vtk/format/foamVtkAppendBase64Formatter.H index 77e3c5ee675c2dc1a8030fb98bc970fcba405433..2384289f679b37e2f702606f71b1fdae1782c8c9 100644 --- a/src/fileFormats/vtk/format/foamVtkAppendBase64Formatter.H +++ b/src/fileFormats/vtk/format/foamVtkAppendBase64Formatter.H @@ -76,7 +76,7 @@ public: appendBase64Formatter(std::ostream& os); - //- Destructor + //- Destructor. Closes/flushes the underlying layer. virtual ~appendBase64Formatter(); diff --git a/src/fileFormats/vtk/format/foamVtkAppendRawFormatter.C b/src/fileFormats/vtk/format/foamVtkAppendRawFormatter.C index 0ff9e5c4cd74b228be7193f07e200588ec1739df..ee230f3d3666df525ef5e5d75eb07351aab0fe55 100644 --- a/src/fileFormats/vtk/format/foamVtkAppendRawFormatter.C +++ b/src/fileFormats/vtk/format/foamVtkAppendRawFormatter.C @@ -55,12 +55,6 @@ Foam::vtk::appendRawFormatter::appendRawFormatter(std::ostream& os) {} -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::vtk::appendRawFormatter::~appendRawFormatter() -{} - - // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // const Foam::vtk::outputOptions& diff --git a/src/fileFormats/vtk/format/foamVtkAppendRawFormatter.H b/src/fileFormats/vtk/format/foamVtkAppendRawFormatter.H index 4f6d58336a455f2c686b609df0f4e001887f6030..dbbcf0788ae8f008a22871ba2d530306bac990e7 100644 --- a/src/fileFormats/vtk/format/foamVtkAppendRawFormatter.H +++ b/src/fileFormats/vtk/format/foamVtkAppendRawFormatter.H @@ -85,7 +85,7 @@ public: //- Destructor - virtual ~appendRawFormatter(); + virtual ~appendRawFormatter() = default; // Member Functions diff --git a/src/fileFormats/vtk/format/foamVtkAsciiFormatter.H b/src/fileFormats/vtk/format/foamVtkAsciiFormatter.H index 588d80b58a89fe4cee571b7dea955a9f068a1fd5..b050d6573c31ba01f348e0bfe99b3b6d1c4fac18 100644 --- a/src/fileFormats/vtk/format/foamVtkAsciiFormatter.H +++ b/src/fileFormats/vtk/format/foamVtkAsciiFormatter.H @@ -90,7 +90,7 @@ public: asciiFormatter(std::ostream& os, unsigned precision); - //- Destructor + //- Destructor. Finishes the output line as required. virtual ~asciiFormatter(); diff --git a/src/fileFormats/vtk/format/foamVtkBase64Formatter.H b/src/fileFormats/vtk/format/foamVtkBase64Formatter.H index 94a009da9993b74cbe49a6b0f72e0ef46ba59d4f..cd733e643e5d6388ae385fce3bed1936cef50532 100644 --- a/src/fileFormats/vtk/format/foamVtkBase64Formatter.H +++ b/src/fileFormats/vtk/format/foamVtkBase64Formatter.H @@ -74,7 +74,7 @@ public: base64Formatter(std::ostream& os); - //- Destructor + //- Destructor. Closes/flushes the underlying layer. virtual ~base64Formatter(); diff --git a/src/fileFormats/vtk/format/foamVtkBase64Layer.H b/src/fileFormats/vtk/format/foamVtkBase64Layer.H index 79b5397ea59b69c6965c0fef04f21031d10f4a41..d965c6348ddb176ba3c2328b9036857c48cac301 100644 --- a/src/fileFormats/vtk/format/foamVtkBase64Layer.H +++ b/src/fileFormats/vtk/format/foamVtkBase64Layer.H @@ -80,7 +80,7 @@ protected: public: - //- Destructor + //- Destructor. Closes/flushes the underlying layer virtual ~foamVtkBase64Layer(); diff --git a/src/fileFormats/vtk/format/foamVtkLegacyAsciiFormatter.C b/src/fileFormats/vtk/format/foamVtkLegacyAsciiFormatter.C index fe8728854cfdf726ed709a9db4215dbe418073cd..d1c3bb2369b204422546a8760cda7d42f1e618dc 100644 --- a/src/fileFormats/vtk/format/foamVtkLegacyAsciiFormatter.C +++ b/src/fileFormats/vtk/format/foamVtkLegacyAsciiFormatter.C @@ -55,12 +55,6 @@ Foam::vtk::legacyAsciiFormatter::legacyAsciiFormatter {} -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::vtk::legacyAsciiFormatter::~legacyAsciiFormatter() -{} - - // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // const Foam::vtk::outputOptions& diff --git a/src/fileFormats/vtk/format/foamVtkLegacyAsciiFormatter.H b/src/fileFormats/vtk/format/foamVtkLegacyAsciiFormatter.H index f298a545f6fb52876e178505c1b4d36676961eb9..e191d1eb937561ae4fe7c055f5cb0c6c177347f3 100644 --- a/src/fileFormats/vtk/format/foamVtkLegacyAsciiFormatter.H +++ b/src/fileFormats/vtk/format/foamVtkLegacyAsciiFormatter.H @@ -80,7 +80,7 @@ public: //- Destructor - virtual ~legacyAsciiFormatter(); + virtual ~legacyAsciiFormatter() = default; // Member Functions diff --git a/src/fileFormats/vtk/format/foamVtkLegacyRawFormatter.C b/src/fileFormats/vtk/format/foamVtkLegacyRawFormatter.C index 28b042c1959732dc78893606ffbac2c58fdc2762..3582033eb2f127488e08d5119fefed760291f49d 100644 --- a/src/fileFormats/vtk/format/foamVtkLegacyRawFormatter.C +++ b/src/fileFormats/vtk/format/foamVtkLegacyRawFormatter.C @@ -58,12 +58,6 @@ Foam::vtk::legacyRawFormatter::legacyRawFormatter {} -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::vtk::legacyRawFormatter::~legacyRawFormatter() -{} - - // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // const Foam::vtk::outputOptions& diff --git a/src/fileFormats/vtk/format/foamVtkLegacyRawFormatter.H b/src/fileFormats/vtk/format/foamVtkLegacyRawFormatter.H index 263332867678b5e6ff72e8cc6eccb89030bacdd0..ae88684b052675aa32a56fbc2a0c8bed2a6938ff 100644 --- a/src/fileFormats/vtk/format/foamVtkLegacyRawFormatter.H +++ b/src/fileFormats/vtk/format/foamVtkLegacyRawFormatter.H @@ -87,7 +87,7 @@ public: //- Destructor - virtual ~legacyRawFormatter(); + virtual ~legacyRawFormatter() = default; // Member Functions diff --git a/src/fileFormats/vtk/output/foamVtkOutputOptions.H b/src/fileFormats/vtk/output/foamVtkOutputOptions.H index 00e715b15cb6c7a1394f78f2e37974c7c9bf950f..fb15f9dd00dc786923d3e9ecb30e7b5cfa07ab5f 100644 --- a/src/fileFormats/vtk/output/foamVtkOutputOptions.H +++ b/src/fileFormats/vtk/output/foamVtkOutputOptions.H @@ -92,7 +92,7 @@ public: // Member Functions - // Access + // Access //- The output format type inline formatType fmt() const; @@ -116,7 +116,7 @@ public: inline unsigned precision() const; - // Edit + // Edit //- Toggle ASCII mode on/off. // In XML append mode, this switches between base64 and raw binary. diff --git a/src/fileFormats/vtk/read/vtkUnstructuredReader.C b/src/fileFormats/vtk/read/vtkUnstructuredReader.C index 3094f203e35de4490b82798a3d9446ba73a3aa3a..a79283fb8e38711785333134473f0bec387e1a9e 100644 --- a/src/fileFormats/vtk/read/vtkUnstructuredReader.C +++ b/src/fileFormats/vtk/read/vtkUnstructuredReader.C @@ -376,18 +376,10 @@ void Foam::vtkUnstructuredReader::readField case VTK_ULONG: case VTK_ID: { - autoPtr<labelIOField> fieldVals + auto fieldVals = autoPtr<labelIOField>::New ( - new labelIOField - ( - IOobject - ( - arrayName, - "", - obj - ), - size - ) + IOobject(arrayName, "", obj), + size ); readBlock(inFile, fieldVals().size(), fieldVals()); regIOobject::store(fieldVals); @@ -397,18 +389,10 @@ void Foam::vtkUnstructuredReader::readField case VTK_FLOAT: case VTK_DOUBLE: { - autoPtr<scalarIOField> fieldVals + auto fieldVals = autoPtr<scalarIOField>::New ( - new scalarIOField - ( - IOobject - ( - arrayName, - "", - obj - ), - size - ) + IOobject(arrayName, "", obj), + size ); readBlock(inFile, fieldVals().size(), fieldVals()); regIOobject::store(fieldVals); @@ -421,18 +405,10 @@ void Foam::vtkUnstructuredReader::readField { Info<< "Reading strings:" << size << endl; } - autoPtr<stringIOList> fieldVals + auto fieldVals = autoPtr<stringIOList>::New ( - new stringIOList - ( - IOobject - ( - arrayName, - "", - obj - ), - size - ) + IOobject(arrayName, "", obj), + size ); // Consume current line. inFile.getLine(fieldVals()[0]); @@ -536,10 +512,8 @@ Foam::objectRegistry& Foam::vtkUnstructuredReader::selectRegistry { return pointData_; } - else - { - return otherData_; - } + + return otherData_; } @@ -827,18 +801,10 @@ void Foam::vtkUnstructuredReader::read(ISstream& inFile) objectRegistry::iterator iter = reg.find(dataName); scalarField s(*dynamic_cast<const scalarField*>(iter())); reg.erase(iter); - autoPtr<vectorIOField> fieldVals + auto fieldVals = autoPtr<vectorIOField>::New ( - new vectorIOField - ( - IOobject - ( - dataName, - "", - reg - ), - s.size()/3 - ) + IOobject(dataName, "", reg), + s.size()/3 ); label elemI = 0; diff --git a/src/fileFormats/vtk/read/vtkUnstructuredReader.H b/src/fileFormats/vtk/read/vtkUnstructuredReader.H index 159fbdb7309d15b070987b78c8466b7de572cb29..482d553f7b38ce03a00fcd43f5a58863363323f3 100644 --- a/src/fileFormats/vtk/read/vtkUnstructuredReader.H +++ b/src/fileFormats/vtk/read/vtkUnstructuredReader.H @@ -163,7 +163,7 @@ private: ( Istream& inFile, const label n, - List<T>& lst + List<T>& list ) const; void warnUnhandledType diff --git a/src/fileFormats/vtk/read/vtkUnstructuredReaderTemplates.C b/src/fileFormats/vtk/read/vtkUnstructuredReaderTemplates.C index 17e6ec326be05aef90d57e7ef91eca4d044cab5c..3e21d230791dd09704a8b8818bb031754ae08fcd 100644 --- a/src/fileFormats/vtk/read/vtkUnstructuredReaderTemplates.C +++ b/src/fileFormats/vtk/read/vtkUnstructuredReaderTemplates.C @@ -37,13 +37,13 @@ void Foam::vtkUnstructuredReader::readBlock ( Istream& inFile, const label n, - List<T>& lst + List<T>& list ) const { - lst.setSize(n); - forAll(lst, i) + list.setSize(n); + forAll(list, i) { - inFile >> lst[i]; + inFile >> list[i]; } } @@ -59,13 +59,14 @@ void Foam::vtkUnstructuredReader::printFieldStats if (fieldNames.size()) { Info<< "Read " << fieldNames.size() << " " << Type::typeName - << " fields:" << endl; - Info<< "Size\tName" << nl + << " fields:" << nl + << "Size\tName" << nl << "----\t----" << endl; - forAll(fieldNames, i) + + for (const word& fieldName : fieldNames) { - Info<< obj.lookupObject<Type>(fieldNames[i]).size() - << "\t" << fieldNames[i] + Info<< obj.lookupObject<Type>(fieldName).size() + << "\t" << fieldName << endl; } Info<< endl; diff --git a/src/finiteArea/fields/faPatchFields/derived/inletOutlet/inletOutletFaPatchField.C b/src/finiteArea/fields/faPatchFields/derived/inletOutlet/inletOutletFaPatchField.C index d5643b1018703efbe017b0052270325aa73f0dc0..f05745ca68d0a0b1bff146cf23b1475fb38fe0bd 100644 --- a/src/finiteArea/fields/faPatchFields/derived/inletOutlet/inletOutletFaPatchField.C +++ b/src/finiteArea/fields/faPatchFields/derived/inletOutlet/inletOutletFaPatchField.C @@ -87,10 +87,7 @@ Foam::inletOutletFaPatchField<Type>::inletOutletFaPatchField this->refGrad() = pTraits<Type>::zero; this->valueFraction() = 0.0; - if (dict.found("phi")) - { - dict.lookup("phi") >> phiName_; - } + dict.readIfPresent("phi", phiName_); } diff --git a/src/finiteVolume/cfdTools/general/MRF/MRFZone.C b/src/finiteVolume/cfdTools/general/MRF/MRFZone.C index c68537c81fc8d7cde8315f5f6f2d697ba6b93567..69bb43ebe8ebd99e6607507f77534cd673715cd7 100644 --- a/src/finiteVolume/cfdTools/general/MRF/MRFZone.C +++ b/src/finiteVolume/cfdTools/general/MRF/MRFZone.C @@ -257,7 +257,7 @@ Foam::MRFZone::MRFZone { if (cellZoneName_ == word::null) { - coeffs_.lookup("cellZone") >> cellZoneName_; + coeffs_.readEntry("cellZone", cellZoneName_); } if (!active_) @@ -593,7 +593,7 @@ bool Foam::MRFZone::read(const dictionary& dict) coeffs_ = dict; active_ = coeffs_.lookupOrDefault("active", true); - coeffs_.lookup("cellZone") >> cellZoneName_; + coeffs_.readEntry("cellZone", cellZoneName_); cellZoneID_ = mesh_.cellZones().findZoneID(cellZoneName_); return true; diff --git a/src/finiteVolume/cfdTools/general/coupling/externalFileCoupler.C b/src/finiteVolume/cfdTools/general/coupling/externalFileCoupler.C index 8f3579be540b9464a3aa8f2bbc08f570eb9b93c8..59a0fde68475bdba51e672cf69a5d07839750096 100644 --- a/src/finiteVolume/cfdTools/general/coupling/externalFileCoupler.C +++ b/src/finiteVolume/cfdTools/general/coupling/externalFileCoupler.C @@ -150,7 +150,7 @@ bool Foam::externalFileCoupler::readDict(const dictionary& dict) // if things have already been initialized if (!initialized()) { - dict.lookup("commsDir") >> commsDir_; + dict.readEntry("commsDir", commsDir_); commsDir_.expand(); commsDir_.clean(); slaveFirst_ = dict.lookupOrDefault("initByExternal", false); diff --git a/src/finiteVolume/cfdTools/general/porosityModel/fixedCoeff/fixedCoeff.C b/src/finiteVolume/cfdTools/general/porosityModel/fixedCoeff/fixedCoeff.C index 64a81304ea850a452f099f17267db6c030f77605..b94fbde938c996d29916c64ae8b21737d8ab0b77 100644 --- a/src/finiteVolume/cfdTools/general/porosityModel/fixedCoeff/fixedCoeff.C +++ b/src/finiteVolume/cfdTools/general/porosityModel/fixedCoeff/fixedCoeff.C @@ -216,7 +216,7 @@ void Foam::porosityModels::fixedCoeff::correct scalar rho = 1.0; if (UEqn.dimensions() == dimForce) { - coeffs_.lookup("rhoRef") >> rho; + coeffs_.readEntry("rhoRef", rho); } apply(Udiag, Usource, V, U, rho); @@ -238,7 +238,7 @@ void Foam::porosityModels::fixedCoeff::correct scalar rho = 1.0; if (UEqn.dimensions() == dimForce) { - coeffs_.lookup("rhoRef") >> rho; + coeffs_.readEntry("rhoRef", rho); } apply(Udiag, Usource, V, U, rho); @@ -256,7 +256,7 @@ void Foam::porosityModels::fixedCoeff::correct scalar rho = 1.0; if (UEqn.dimensions() == dimForce) { - coeffs_.lookup("rhoRef") >> rho; + coeffs_.readEntry("rhoRef", rho); } apply(AU, U, rho); diff --git a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.C b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.C index 34d8717dad106bf75bd1ff2c5308f8c14b157082..19f9bbb3d4400a1a5657e8862876bac50ebb22df 100644 --- a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.C +++ b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.C @@ -106,7 +106,7 @@ Foam::porosityModel::porosityModel if (zoneName_ == word::null) { dict.readIfPresent("active", active_); - dict_.lookup("cellZone") >> zoneName_; + dict_.readEntry("cellZone", zoneName_); } cellZoneIDs_ = mesh_.cellZones().indices(zoneName_); diff --git a/src/finiteVolume/fields/fvPatchFields/derived/activePressureForceBaffleVelocity/activePressureForceBaffleVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/activePressureForceBaffleVelocity/activePressureForceBaffleVelocityFvPatchVectorField.C index 575490bac424b9ff2df1678c2406638e3327de53..9981cc14513799c5a9b5c2af21336c9e9f38d750 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/activePressureForceBaffleVelocity/activePressureForceBaffleVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/activePressureForceBaffleVelocity/activePressureForceBaffleVelocityFvPatchVectorField.C @@ -120,10 +120,7 @@ activePressureForceBaffleVelocityFvPatchVectorField ).neighbFvPatch().Sf(); } - if (dict.found("p")) - { - dict.lookup("p") >> pName_; - } + dict.readIfPresent("p", pName_); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.C index fe7567c9afea1901b2dd6dbfeb02daa8893a6df3..2e352f8baf2053288f42c784eba0d06f4858759c 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.C @@ -103,7 +103,7 @@ Foam::advectiveFvPatchField<Type>::advectiveFvPatchField if (dict.readIfPresent("lInf", lInf_)) { - dict.lookup("fieldInf") >> fieldInf_; + dict.readEntry("fieldInf", fieldInf_); if (lInf_ < 0.0) { diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C index 9cd231a9c2323b3a436ef38ddef71e3803cfe5f2..f4edba311ea081f36bae915469f5cea0ec299806 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C @@ -74,8 +74,8 @@ Foam::fanFvPatchField<Type>::fanFvPatchField { if (nonDimensional_) { - dict.lookup("rpm") >> rpm_; - dict.lookup("dm") >> dm_; + dict.readEntry("rpm", rpm_); + dict.readEntry("dm", dm_); } } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fanPressure/fanPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/fanPressure/fanPressureFvPatchScalarField.C index 957633b0c4d05ad61e88ec49360de0284c3d0a44..15fc6dcaec75e8f3a2627db98a3e466eecb6d131 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fanPressure/fanPressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fanPressure/fanPressureFvPatchScalarField.C @@ -91,8 +91,8 @@ Foam::fanPressureFvPatchScalarField::fanPressureFvPatchScalarField { if (nonDimensional_) { - dict.lookup("rpm") >> rpm_; - dict.lookup("dm") >> dm_; + dict.readEntry("rpm", rpm_); + dict.readEntry("dm", dm_); } } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/plenumPressure/plenumPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/plenumPressure/plenumPressureFvPatchScalarField.C index 7b910c6ddeb14a42dc1e5ad23b91152abc930c45..2b10b1441ae8896ee2668b1f8cbdd305edc7d3e5 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/plenumPressure/plenumPressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/plenumPressure/plenumPressureFvPatchScalarField.C @@ -87,11 +87,7 @@ Foam::plenumPressureFvPatchScalarField::plenumPressureFvPatchScalarField phiName_(dict.lookupOrDefault<word>("phi", "phi")), UName_(dict.lookupOrDefault<word>("U", "U")) { - if (dict.found("rho")) - { - rho_ = readScalar(dict.lookup("rho")); - hasRho_ = true; - } + hasRho_ = dict.readIfPresent("rho", rho_); } diff --git a/src/finiteVolume/functionObjects/fieldSelection/fieldSelection.C b/src/finiteVolume/functionObjects/fieldSelection/fieldSelection.C index b8f9ad29ba9265773b8f85d0155690db91dd46cc..63fa608ef51785623e8b7a5ef4503f4ee7a9e51c 100644 --- a/src/finiteVolume/functionObjects/fieldSelection/fieldSelection.C +++ b/src/finiteVolume/functionObjects/fieldSelection/fieldSelection.C @@ -50,7 +50,7 @@ Foam::functionObjects::fieldSelection::~fieldSelection() bool Foam::functionObjects::fieldSelection::read(const dictionary& dict) { - dict.lookup("fields") >> *this; + dict.readEntry("fields", *this); return true; } diff --git a/src/finiteVolume/functionObjects/volRegion/volRegion.C b/src/finiteVolume/functionObjects/volRegion/volRegion.C index 34efa8a1e65f546f55f77cbe8de25ce0c84b3da9..5071085ec80edc1a872c48539f3b96b1537f6872 100644 --- a/src/finiteVolume/functionObjects/volRegion/volRegion.C +++ b/src/finiteVolume/functionObjects/volRegion/volRegion.C @@ -111,7 +111,7 @@ bool Foam::functionObjects::volRegion::read { case vrtCellZone: { - dict.lookup("name") >> regionName_; + dict.readEntry("name", regionName_); regionID_ = mesh_.cellZones().findZoneID(regionName_); diff --git a/src/lagrangian/distributionModels/binned/binned.C b/src/lagrangian/distributionModels/binned/binned.C index a5cf7e1f2b632fc9f86abbafa09a0671f65287aa..2c53ffe7fad8cf1f4ba295eab189041b655a78b5 100644 --- a/src/lagrangian/distributionModels/binned/binned.C +++ b/src/lagrangian/distributionModels/binned/binned.C @@ -247,7 +247,7 @@ Foam::dictionary Foam::distributionModels::binned::writeDict void Foam::distributionModels::binned::readDict(const dictionary& dict) { // distributionModel::readDict(dict); - dict.lookup("distribution") >> xy_; + dict.readEntry("distribution", xy_); } diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/cloudSolution/cloudSolution.C b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/cloudSolution/cloudSolution.C index cc5ad7063d8f96773b34ebc4a439df55dd55c4b5..daedfd2a0620dec989dea2cb213cc939085df10d 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/cloudSolution/cloudSolution.C +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/cloudSolution/cloudSolution.C @@ -145,15 +145,15 @@ void Foam::cloudSolution::read() } } - dict_.lookup("coupled") >> coupled_; - dict_.lookup("cellValueSourceCorrection") >> cellValueSourceCorrection_; + dict_.readEntry("coupled", coupled_); + dict_.readEntry("cellValueSourceCorrection", cellValueSourceCorrection_); dict_.readIfPresent("maxCo", maxCo_); dict_.readIfPresent("deltaTMax", deltaTMax_); if (steadyState()) { - dict_.lookup("calcFrequency") >> calcFrequency_; - dict_.lookup("maxTrackTime") >> maxTrackTime_; + dict_.readEntry("calcFrequency", calcFrequency_); + dict_.readEntry("maxTrackTime", maxTrackTime_); if (coupled_) { diff --git a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C index ebe2ba25d4fcc87a3c8aa84f655982c7d9c14c6b..0d20d12b952b9f6782bc3bbd74111794eb398492 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C @@ -51,7 +51,7 @@ void Foam::ThermoCloud<CloudType>::setModels() ).ptr() ); - this->subModelProperties().lookup("radiation") >> radiation_; + this->subModelProperties().readEntry("radiation", radiation_); if (radiation_) { diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.C index d8bca67835d45cc6f662099cbf22e5880485b77e..988eca02c4e8ec75d98c06b3e1dde66da9804766 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.C +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.C @@ -157,7 +157,7 @@ void Foam::ParticleCollector<CloudType>::initConcentricCircles() vector origin(this->coeffDict().lookup("origin")); - this->coeffDict().lookup("radius") >> radius_; + this->coeffDict().readEntry("radius", radius_); nSector_ = readLabel(this->coeffDict().lookup("nSector")); label nS = nSector_; diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.C index eba6578fcbe66d053a928ec14441864c0bdcab2e..0f9be704859e9890d6545611f9335ba17381dc00 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.C @@ -92,7 +92,7 @@ void Foam::ConeNozzleInjection<CloudType>::setFlowType() { case flowType::ftConstantVelocity: { - this->coeffDict().lookup("UMag") >> UMag_; + this->coeffDict().readEntry("UMag", UMag_); break; } case flowType::ftPressureDrivenVelocity: diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C index 48286f170db457902df79d5164a57b2a370e8cf5..2d0d2ec92f0d25135a1caba9760a710d2aaa174d 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C @@ -328,8 +328,8 @@ Foam::InjectionModel<CloudType>::InjectionModel { if (owner.solution().transient()) { - this->coeffDict().lookup("massTotal") >> massTotal_; - this->coeffDict().lookup("SOI") >> SOI_; + this->coeffDict().readEntry("massTotal", massTotal_); + this->coeffDict().readEntry("SOI", SOI_); } else { diff --git a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/patchInteractionData.C b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/patchInteractionData.C index 1b54ba2c3cd9140706651f683acb16755f4b2294..1d22022f846a5b4824ab5c750d29398899c6ed5a 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/patchInteractionData.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/patchInteractionData.C @@ -77,7 +77,7 @@ Foam::Istream& Foam::operator>> const dictionaryEntry entry(dictionary::null, is); pid.patchName_ = entry.keyword(); - entry.lookup("type") >> pid.interactionTypeName_; + entry.readEntry("type", pid.interactionTypeName_); pid.e_ = entry.lookupOrDefault<scalar>("e", 1.0); pid.mu_ = entry.lookupOrDefault<scalar>("mu", 0.0); diff --git a/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/SingleMixtureFraction/SingleMixtureFraction.C b/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/SingleMixtureFraction/SingleMixtureFraction.C index e86974da9c27420478989f022374a3be260549a5..ce9b1c0e9520b46a4db5ad867d45ba090a0ba7c2 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/SingleMixtureFraction/SingleMixtureFraction.C +++ b/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/SingleMixtureFraction/SingleMixtureFraction.C @@ -105,9 +105,9 @@ Foam::SingleMixtureFraction<CloudType>::SingleMixtureFraction << exit(FatalError); } - this->coeffDict().lookup("YGasTot0") >> YMixture0_[idGas_]; - this->coeffDict().lookup("YLiquidTot0") >> YMixture0_[idLiquid_]; - this->coeffDict().lookup("YSolidTot0") >> YMixture0_[idSolid_]; + this->coeffDict().readEntry("YGasTot0", YMixture0_[idGas_]); + this->coeffDict().readEntry("YLiquidTot0", YMixture0_[idLiquid_]); + this->coeffDict().readEntry("YSolidTot0", YMixture0_[idSolid_]); if (mag(sum(YMixture0_) - 1.0) > SMALL) { diff --git a/src/lagrangian/intermediate/submodels/Thermodynamic/SurfaceFilmModel/ThermoSurfaceFilm/ThermoSurfaceFilm.C b/src/lagrangian/intermediate/submodels/Thermodynamic/SurfaceFilmModel/ThermoSurfaceFilm/ThermoSurfaceFilm.C index a34947bf851a9dd8244746d36c85bf93ff6dd86d..dd7627397b4483b262f26d387978ed651afe8569 100644 --- a/src/lagrangian/intermediate/submodels/Thermodynamic/SurfaceFilmModel/ThermoSurfaceFilm/ThermoSurfaceFilm.C +++ b/src/lagrangian/intermediate/submodels/Thermodynamic/SurfaceFilmModel/ThermoSurfaceFilm/ThermoSurfaceFilm.C @@ -504,14 +504,14 @@ Foam::ThermoSurfaceFilm<CloudType>::ThermoSurfaceFilm if (interactionType_ == itSplashBai) { - this->coeffDict().lookup("deltaWet") >> deltaWet_; + this->coeffDict().readEntry("deltaWet", deltaWet_); splashParcelType_ = this->coeffDict().lookupOrDefault("splashParcelType", -1); parcelsPerSplash_ = this->coeffDict().lookupOrDefault("parcelsPerSplash", 2); - this->coeffDict().lookup("Adry") >> Adry_; - this->coeffDict().lookup("Awet") >> Awet_; - this->coeffDict().lookup("Cf") >> Cf_; + this->coeffDict().readEntry("Adry", Adry_); + this->coeffDict().readEntry("Awet", Awet_); + this->coeffDict().readEntry("Cf", Cf_); } } diff --git a/src/lagrangian/molecularDynamics/potential/energyScalingFunction/derived/doubleSigmoid/doubleSigmoid.C b/src/lagrangian/molecularDynamics/potential/energyScalingFunction/derived/doubleSigmoid/doubleSigmoid.C index aed42de82595232ff5f98476882822aa819f3366..bfefd67c51d68bf785877620614f19ce7713b78d 100644 --- a/src/lagrangian/molecularDynamics/potential/energyScalingFunction/derived/doubleSigmoid/doubleSigmoid.C +++ b/src/lagrangian/molecularDynamics/potential/energyScalingFunction/derived/doubleSigmoid/doubleSigmoid.C @@ -93,10 +93,10 @@ bool doubleSigmoid::read(const dictionary& energyScalingFunctionProperties) doubleSigmoidCoeffs_ = energyScalingFunctionProperties.subDict(typeName + "Coeffs"); - doubleSigmoidCoeffs_.lookup("shift1") >> shift1_; - doubleSigmoidCoeffs_.lookup("scale1") >> scale1_; - doubleSigmoidCoeffs_.lookup("shift2") >> shift2_; - doubleSigmoidCoeffs_.lookup("scale2") >> scale2_; + doubleSigmoidCoeffs_.readEntry("shift1", shift1_); + doubleSigmoidCoeffs_.readEntry("scale1", scale1_); + doubleSigmoidCoeffs_.readEntry("shift2", shift2_); + doubleSigmoidCoeffs_.readEntry("scale2", scale2_); return true; } diff --git a/src/lagrangian/molecularDynamics/potential/energyScalingFunction/derived/sigmoid/sigmoid.C b/src/lagrangian/molecularDynamics/potential/energyScalingFunction/derived/sigmoid/sigmoid.C index 49dcac1c63a2ce154e29385c5727b5596ac4bcbc..5784f3f10b548493c9a88afbac89110533fa98c5 100644 --- a/src/lagrangian/molecularDynamics/potential/energyScalingFunction/derived/sigmoid/sigmoid.C +++ b/src/lagrangian/molecularDynamics/potential/energyScalingFunction/derived/sigmoid/sigmoid.C @@ -92,8 +92,8 @@ bool sigmoid::read(const dictionary& energyScalingFunctionProperties) sigmoidCoeffs_ = energyScalingFunctionProperties.subDict(typeName + "Coeffs"); - sigmoidCoeffs_.lookup("shift") >> shift_; - sigmoidCoeffs_.lookup("scale") >> shift_; + sigmoidCoeffs_.readEntry("shift", shift_); + sigmoidCoeffs_.readEntry("scale", shift_); return true; } diff --git a/src/lagrangian/molecularDynamics/potential/pairPotential/derived/azizChen/azizChen.C b/src/lagrangian/molecularDynamics/potential/pairPotential/derived/azizChen/azizChen.C index fa906e9e926fe01b3266918a36a4fe5f733dbc77..7f318d4e87439c5dd8346acf0bc5e22336342443 100644 --- a/src/lagrangian/molecularDynamics/potential/pairPotential/derived/azizChen/azizChen.C +++ b/src/lagrangian/molecularDynamics/potential/pairPotential/derived/azizChen/azizChen.C @@ -102,15 +102,15 @@ bool azizChen::read(const dictionary& azizChen) azizChenCoeffs_ = azizChen.subDict(typeName + "Coeffs"); - azizChenCoeffs_.lookup("epsilon") >> epsilon_; - azizChenCoeffs_.lookup("rm") >> rm_; - azizChenCoeffs_.lookup("A") >> A_; - azizChenCoeffs_.lookup("alpha") >> alpha_; - azizChenCoeffs_.lookup("C6") >> C6_; - azizChenCoeffs_.lookup("C8") >> C8_; - azizChenCoeffs_.lookup("C10") >> C10_; - azizChenCoeffs_.lookup("D") >> D_; - azizChenCoeffs_.lookup("gamma") >> gamma_; + azizChenCoeffs_.readEntry("epsilon", epsilon_); + azizChenCoeffs_.readEntry("rm", rm_); + azizChenCoeffs_.readEntry("A", A_); + azizChenCoeffs_.readEntry("alpha", alpha_); + azizChenCoeffs_.readEntry("C6", C6_); + azizChenCoeffs_.readEntry("C8", C8_); + azizChenCoeffs_.readEntry("C10", C10_); + azizChenCoeffs_.readEntry("D", D_); + azizChenCoeffs_.readEntry("gamma", gamma_); return true; } diff --git a/src/lagrangian/molecularDynamics/potential/pairPotential/derived/dampedCoulomb/dampedCoulomb.C b/src/lagrangian/molecularDynamics/potential/pairPotential/derived/dampedCoulomb/dampedCoulomb.C index 7438711d66687cb2fe3f4ff978de645e5def4d05..d492c7669f241663c2affc85b8718adfcf8741f2 100644 --- a/src/lagrangian/molecularDynamics/potential/pairPotential/derived/dampedCoulomb/dampedCoulomb.C +++ b/src/lagrangian/molecularDynamics/potential/pairPotential/derived/dampedCoulomb/dampedCoulomb.C @@ -83,7 +83,7 @@ bool dampedCoulomb::read(const dictionary& pairPotentialProperties) dampedCoulombCoeffs_ = pairPotentialProperties.subDict(typeName + "Coeffs"); - dampedCoulombCoeffs_.lookup("alpha") >> alpha_; + dampedCoulombCoeffs_.readEntry("alpha", alpha_); return true; } diff --git a/src/lagrangian/molecularDynamics/potential/pairPotential/derived/exponentialRepulsion/exponentialRepulsion.C b/src/lagrangian/molecularDynamics/potential/pairPotential/derived/exponentialRepulsion/exponentialRepulsion.C index 30e2b680450c0c6d8d3f596a5c7454596ff7fd8b..4b5473d859b35f4de0cebb334e1913cb7c99eeda 100644 --- a/src/lagrangian/molecularDynamics/potential/pairPotential/derived/exponentialRepulsion/exponentialRepulsion.C +++ b/src/lagrangian/molecularDynamics/potential/pairPotential/derived/exponentialRepulsion/exponentialRepulsion.C @@ -80,8 +80,8 @@ bool exponentialRepulsion::read(const dictionary& exponentialRepulsion) exponentialRepulsionCoeffs_ = exponentialRepulsion.subDict(typeName + "Coeffs"); - exponentialRepulsionCoeffs_.lookup("rm") >> rm_; - exponentialRepulsionCoeffs_.lookup("epsilon") >> epsilon_; + exponentialRepulsionCoeffs_.readEntry("rm", rm_); + exponentialRepulsionCoeffs_.readEntry("epsilon", epsilon_); return true; } diff --git a/src/lagrangian/molecularDynamics/potential/pairPotential/derived/lennardJones/lennardJones.C b/src/lagrangian/molecularDynamics/potential/pairPotential/derived/lennardJones/lennardJones.C index a8777454f672f89104758bb118baf69350f2ae8d..1a33f97e5801acc96cbdb01202b47fccf8d7064f 100644 --- a/src/lagrangian/molecularDynamics/potential/pairPotential/derived/lennardJones/lennardJones.C +++ b/src/lagrangian/molecularDynamics/potential/pairPotential/derived/lennardJones/lennardJones.C @@ -82,8 +82,8 @@ bool lennardJones::read(const dictionary& pairPotentialProperties) lennardJonesCoeffs_ = pairPotentialProperties.subDict(typeName + "Coeffs"); - lennardJonesCoeffs_.lookup("sigma") >> sigma_; - lennardJonesCoeffs_.lookup("epsilon") >> epsilon_; + lennardJonesCoeffs_.readEntry("sigma", sigma_); + lennardJonesCoeffs_.readEntry("epsilon", epsilon_); return true; } diff --git a/src/lagrangian/molecularDynamics/potential/pairPotential/derived/maitlandSmith/maitlandSmith.C b/src/lagrangian/molecularDynamics/potential/pairPotential/derived/maitlandSmith/maitlandSmith.C index c8d296d7c1ef924e8f406e7a34ae6542609bd48c..07e5cd7042408b9b8d2f4d13220c9fd18eca25ba 100644 --- a/src/lagrangian/molecularDynamics/potential/pairPotential/derived/maitlandSmith/maitlandSmith.C +++ b/src/lagrangian/molecularDynamics/potential/pairPotential/derived/maitlandSmith/maitlandSmith.C @@ -84,10 +84,10 @@ bool maitlandSmith::read(const dictionary& maitlandSmith) maitlandSmithCoeffs_ = maitlandSmith.subDict(typeName + "Coeffs"); - maitlandSmithCoeffs_.lookup("m") >> m_; - maitlandSmithCoeffs_.lookup("gamma") >> gamma_; - maitlandSmithCoeffs_.lookup("rm") >> rm_; - maitlandSmithCoeffs_.lookup("epsilon") >> epsilon_; + maitlandSmithCoeffs_.readEntry("m", m_); + maitlandSmithCoeffs_.readEntry("gamma", gamma_); + maitlandSmithCoeffs_.readEntry("rm", rm_); + maitlandSmithCoeffs_.readEntry("epsilon", epsilon_); return true; } diff --git a/src/lagrangian/molecularDynamics/potential/potential/potential.C b/src/lagrangian/molecularDynamics/potential/potential/potential.C index e5c87bc2732067c21d3985a11dd9440b62f6135f..e01f75dfcfc8156190f4d306c6a56ac828053573 100644 --- a/src/lagrangian/molecularDynamics/potential/potential/potential.C +++ b/src/lagrangian/molecularDynamics/potential/potential/potential.C @@ -137,12 +137,8 @@ void Foam::potential::potential::readPotentialDict() << pairPotentialSiteIdList << endl; - List<word> tetherSiteIdList(0); - - if (idListDict.found("tetherSiteIdList")) - { - tetherSiteIdList = List<word>(idListDict.lookup("tetherSiteIdList")); - } + List<word> tetherSiteIdList; + idListDict.readIfPresent("tetherSiteIdList", tetherSiteIdList); IOdictionary potentialDict ( diff --git a/src/lagrangian/molecularDynamics/potential/tetherPotential/derived/harmonicSpring/harmonicSpring.C b/src/lagrangian/molecularDynamics/potential/tetherPotential/derived/harmonicSpring/harmonicSpring.C index 5c53cec52f634e46f0c17ffa4dc835494cee9844..61c74200ea1d34a19b9226a798b4c11e5f0aa14e 100644 --- a/src/lagrangian/molecularDynamics/potential/tetherPotential/derived/harmonicSpring/harmonicSpring.C +++ b/src/lagrangian/molecularDynamics/potential/tetherPotential/derived/harmonicSpring/harmonicSpring.C @@ -83,7 +83,7 @@ bool harmonicSpring::read(const dictionary& tetherPotentialProperties) harmonicSpringCoeffs_ = tetherPotentialProperties.subDict(typeName + "Coeffs"); - harmonicSpringCoeffs_.lookup("springConstant") >> springConstant_; + harmonicSpringCoeffs_.readEntry("springConstant", springConstant_); return true; } diff --git a/src/lagrangian/molecularDynamics/potential/tetherPotential/derived/pitchForkRing/pitchForkRing.C b/src/lagrangian/molecularDynamics/potential/tetherPotential/derived/pitchForkRing/pitchForkRing.C index caaa7a68ce686c51538c73c43ecaf6fc767d5738..6aac89c4a895dddc9a646fdd94d788094312dba9 100644 --- a/src/lagrangian/molecularDynamics/potential/tetherPotential/derived/pitchForkRing/pitchForkRing.C +++ b/src/lagrangian/molecularDynamics/potential/tetherPotential/derived/pitchForkRing/pitchForkRing.C @@ -101,9 +101,9 @@ bool pitchForkRing::read(const dictionary& tetherPotentialProperties) pitchForkRingCoeffs_ = tetherPotentialProperties.subDict(typeName + "Coeffs"); - pitchForkRingCoeffs_.lookup("mu") >> mu_; - pitchForkRingCoeffs_.lookup("alpha") >> alpha_; - pitchForkRingCoeffs_.lookup("rOrbit") >> rOrbit_; + pitchForkRingCoeffs_.readEntry("mu", mu_); + pitchForkRingCoeffs_.readEntry("alpha", alpha_); + pitchForkRingCoeffs_.readEntry("rOrbit", rOrbit_); return true; } diff --git a/src/lagrangian/molecularDynamics/potential/tetherPotential/derived/restrainedHarmonicSpring/restrainedHarmonicSpring.C b/src/lagrangian/molecularDynamics/potential/tetherPotential/derived/restrainedHarmonicSpring/restrainedHarmonicSpring.C index d867c5e918a3c4fad2b1bb578182d4725e61d650..b2f31b16d437252348ac9268ca603212cce6805c 100644 --- a/src/lagrangian/molecularDynamics/potential/tetherPotential/derived/restrainedHarmonicSpring/restrainedHarmonicSpring.C +++ b/src/lagrangian/molecularDynamics/potential/tetherPotential/derived/restrainedHarmonicSpring/restrainedHarmonicSpring.C @@ -111,8 +111,8 @@ bool restrainedHarmonicSpring::read restrainedHarmonicSpringCoeffs_ = tetherPotentialProperties.subDict(typeName + "Coeffs"); - restrainedHarmonicSpringCoeffs_.lookup("springConstant") >> springConstant_; - restrainedHarmonicSpringCoeffs_.lookup("rR") >> rR_; + restrainedHarmonicSpringCoeffs_.readEntry("springConstant", springConstant_); + restrainedHarmonicSpringCoeffs_.readEntry("rR", rR_); return true; } diff --git a/src/lagrangian/spray/submodels/BreakupModel/BreakupModel/BreakupModel.C b/src/lagrangian/spray/submodels/BreakupModel/BreakupModel/BreakupModel.C index ff89670dc6178296631a8d42d09fb8e0e35c8fa6..e8c8627443870161e4b8a5feba63ed2be2c063e0 100644 --- a/src/lagrangian/spray/submodels/BreakupModel/BreakupModel/BreakupModel.C +++ b/src/lagrangian/spray/submodels/BreakupModel/BreakupModel/BreakupModel.C @@ -79,8 +79,8 @@ Foam::BreakupModel<CloudType>::BreakupModel if (solveOscillationEq_ && dict.found("TABCoeffs")) { const dictionary coeffs(dict.subDict("TABCoeffs")); - coeffs.lookup("Comega") >> TABComega_; - coeffs.lookup("Cmu") >> TABCmu_; + coeffs.readEntry("Comega", TABComega_); + coeffs.readEntry("Cmu", TABCmu_); scalar WeCrit(readScalar(coeffs.lookup("WeCrit"))); TABtwoWeCrit_ = 2*WeCrit; } diff --git a/src/lagrangian/spray/submodels/BreakupModel/ETAB/ETAB.C b/src/lagrangian/spray/submodels/BreakupModel/ETAB/ETAB.C index c30ded6d7c89553fe6e28a33afbcf575437ca698..fb45b30ddff50e94ffe43da7c55088856387d274 100644 --- a/src/lagrangian/spray/submodels/BreakupModel/ETAB/ETAB.C +++ b/src/lagrangian/spray/submodels/BreakupModel/ETAB/ETAB.C @@ -42,9 +42,9 @@ Foam::ETAB<CloudType>::ETAB { if (!this->defaultCoeffs(true)) { - this->coeffDict().lookup("k1") >> k1_; - this->coeffDict().lookup("k2") >> k2_; - this->coeffDict().lookup("WeTransition") >> WeTransition_; + this->coeffDict().readEntry("k1", k1_); + this->coeffDict().readEntry("k2", k2_); + this->coeffDict().readEntry("WeTransition", WeTransition_); } scalar k21 = k2_/k1_; diff --git a/src/lagrangian/spray/submodels/BreakupModel/PilchErdman/PilchErdman.C b/src/lagrangian/spray/submodels/BreakupModel/PilchErdman/PilchErdman.C index e6863ad0db7c34dfffa327079244576080d02c4e..61041ae1beb793d94404f343b77fabe5a89174a0 100644 --- a/src/lagrangian/spray/submodels/BreakupModel/PilchErdman/PilchErdman.C +++ b/src/lagrangian/spray/submodels/BreakupModel/PilchErdman/PilchErdman.C @@ -40,8 +40,8 @@ Foam::PilchErdman<CloudType>::PilchErdman { if (!this->defaultCoeffs(true)) { - this->coeffDict().lookup("B1") >> B1_; - this->coeffDict().lookup("B2") >> B2_; + this->coeffDict().readEntry("B1", B1_); + this->coeffDict().readEntry("B2", B2_); } } diff --git a/src/lagrangian/spray/submodels/BreakupModel/ReitzDiwakar/ReitzDiwakar.C b/src/lagrangian/spray/submodels/BreakupModel/ReitzDiwakar/ReitzDiwakar.C index 504b681dc631f5482cfd819617cf46757ef997de..9f5bbcd8c8735fb52b56e5d0f44f12bd086c9403 100644 --- a/src/lagrangian/spray/submodels/BreakupModel/ReitzDiwakar/ReitzDiwakar.C +++ b/src/lagrangian/spray/submodels/BreakupModel/ReitzDiwakar/ReitzDiwakar.C @@ -42,10 +42,10 @@ Foam::ReitzDiwakar<CloudType>::ReitzDiwakar { if (!this->defaultCoeffs(true)) { - this->coeffDict().lookup("Cbag") >> Cbag_; - this->coeffDict().lookup("Cb") >> Cb_; - this->coeffDict().lookup("Cstrip") >> Cstrip_; - this->coeffDict().lookup("Cs") >> Cs_; + this->coeffDict().readEntry("Cbag", Cbag_); + this->coeffDict().readEntry("Cb", Cb_); + this->coeffDict().readEntry("Cstrip", Cstrip_); + this->coeffDict().readEntry("Cs", Cs_); } } diff --git a/src/lagrangian/spray/submodels/BreakupModel/ReitzKHRT/ReitzKHRT.C b/src/lagrangian/spray/submodels/BreakupModel/ReitzKHRT/ReitzKHRT.C index 0d158f8566d657a4da0109214ab494b618dbe6eb..16522b098ffcddd576f87cc4761c0a8a04fe841e 100644 --- a/src/lagrangian/spray/submodels/BreakupModel/ReitzKHRT/ReitzKHRT.C +++ b/src/lagrangian/spray/submodels/BreakupModel/ReitzKHRT/ReitzKHRT.C @@ -44,12 +44,12 @@ Foam::ReitzKHRT<CloudType>::ReitzKHRT { if (!this->defaultCoeffs(true)) { - this->coeffDict().lookup("B0") >> b0_; - this->coeffDict().lookup("B1") >> b1_; - this->coeffDict().lookup("Ctau") >> cTau_; - this->coeffDict().lookup("CRT") >> cRT_; - this->coeffDict().lookup("msLimit") >> msLimit_; - this->coeffDict().lookup("WeberLimit") >> weberLimit_; + this->coeffDict().readEntry("B0", b0_); + this->coeffDict().readEntry("B1", b1_); + this->coeffDict().readEntry("Ctau", cTau_); + this->coeffDict().readEntry("CRT", cRT_); + this->coeffDict().readEntry("msLimit", msLimit_); + this->coeffDict().readEntry("WeberLimit", weberLimit_); } } diff --git a/src/mesh/snappyHexMesh/refinementSurfaces/surfaceZonesInfo.C b/src/mesh/snappyHexMesh/refinementSurfaces/surfaceZonesInfo.C index d65d7e0eac8a01d194aa8f7d1404e3606df7342a..647c8dd6148d612ec5f81ed410f29bfcf5b8ee28 100644 --- a/src/mesh/snappyHexMesh/refinementSurfaces/surfaceZonesInfo.C +++ b/src/mesh/snappyHexMesh/refinementSurfaces/surfaceZonesInfo.C @@ -82,7 +82,7 @@ Foam::surfaceZonesInfo::surfaceZonesInfo zoneInside_ = areaSelectionAlgoNames[method]; if (zoneInside_ == INSIDEPOINT) { - surfacesDict.lookup("insidePoint") >> zoneInsidePoint_; + surfacesDict.readEntry("insidePoint", zoneInsidePoint_); } } diff --git a/src/mesh/snappyHexMesh/shellSurfaces/shellSurfaces.C b/src/mesh/snappyHexMesh/shellSurfaces/shellSurfaces.C index dfa08a65c8e6d5ba5d5839331d17a9e5fc3f870d..210a42324841488f8944417471ff8515ccfafd59 100644 --- a/src/mesh/snappyHexMesh/shellSurfaces/shellSurfaces.C +++ b/src/mesh/snappyHexMesh/shellSurfaces/shellSurfaces.C @@ -684,8 +684,8 @@ Foam::shellSurfaces::shellSurfaces if (smoothDirection_[shellI] != vector::zero) { - dict.lookup("nSmoothExpansion") >> nSmoothExpansion_[shellI]; - dict.lookup("nSmoothPosition") >> nSmoothPosition_[shellI]; + dict.readEntry("nSmoothExpansion", nSmoothExpansion_[shellI]); + dict.readEntry("nSmoothPosition", nSmoothPosition_[shellI]); } diff --git a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C index 795397fc2910430bbdb43872db34e63537718f37..e8a6556361ac034e6f55185bff332cc24176d20e 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C +++ b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C @@ -567,8 +567,8 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch { case ROTATIONAL: { - dict.lookup("rotationAxis") >> rotationAxis_; - dict.lookup("rotationCentre") >> rotationCentre_; + dict.readEntry("rotationAxis", rotationAxis_); + dict.readEntry("rotationCentre", rotationCentre_); if (dict.readIfPresent("rotationAngle", rotationAngle_)) { rotationAngleDefined_ = true; @@ -597,7 +597,7 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch } case TRANSLATIONAL: { - dict.lookup("separationVector") >> separationVector_; + dict.readEntry("separationVector", separationVector_); break; } default: diff --git a/src/meshTools/Make/files b/src/meshTools/Make/files index 56dc286f3a9cb384b481beb518e59699a10a006c..83d30309b7c0e6a0aa61c7377ebbc8f2d4bbae15 100644 --- a/src/meshTools/Make/files +++ b/src/meshTools/Make/files @@ -56,18 +56,20 @@ cellDist/wallPoint/wallPoint.C cellFeatures/cellFeatures.C -csys = coordinateSystems +csys = coordinate/systems $(csys)/coordinateSystem.C $(csys)/coordinateSystemNew.C $(csys)/coordinateSystems.C $(csys)/cylindricalCS.C $(csys)/cartesianCS.C -$(csys)/coordinateRotation/axesRotation.C -$(csys)/coordinateRotation/coordinateRotation.C -$(csys)/coordinateRotation/coordinateRotationNew.C -$(csys)/coordinateRotation/EulerCoordinateRotation.C -$(csys)/coordinateRotation/STARCDCoordinateRotation.C -$(csys)/coordinateRotation/cylindrical.C + +crot = coordinate/rotation +$(crot)/axesRotation.C +$(crot)/coordinateRotation.C +$(crot)/coordinateRotationNew.C +$(crot)/EulerCoordinateRotation.C +$(crot)/STARCDCoordinateRotation.C +$(crot)/cylindrical.C polyMeshZipUpCells/polyMeshZipUpCells.C primitiveMeshGeometry/primitiveMeshGeometry.C diff --git a/src/meshTools/coordinateSystems/coordinateRotation/EulerCoordinateRotation.C b/src/meshTools/coordinate/rotation/EulerCoordinateRotation.C similarity index 69% rename from src/meshTools/coordinateSystems/coordinateRotation/EulerCoordinateRotation.C rename to src/meshTools/coordinate/rotation/EulerCoordinateRotation.C index 5a7d86e8289abd916cd690334396094f69c60320..495adc57d01a358373b96d567e823da0f48fe5c9 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/EulerCoordinateRotation.C +++ b/src/meshTools/coordinate/rotation/EulerCoordinateRotation.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) 2017 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -24,8 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "EulerCoordinateRotation.H" - -#include "mathematicalConstants.H" +#include "unitConversion.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -47,6 +46,44 @@ namespace Foam ); } +// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // + +Foam::tensor Foam::EulerCoordinateRotation::rotation +( + const vector& angles, + bool degrees +) +{ + scalar phi = angles.component(vector::X); // 1. Rotate about Z + scalar theta = angles.component(vector::Y); // 2. Rotate about X + scalar psi = angles.component(vector::Z); // 3. Rotate about Z + + if (degrees) + { + phi *= degToRad(); + theta *= degToRad(); + psi *= degToRad(); + } + + const scalar c1 = cos(phi); const scalar s1 = sin(phi); + const scalar c2 = cos(theta); const scalar s2 = sin(theta); + const scalar c3 = cos(psi); const scalar s3 = sin(psi); + + // Compare + // https://en.wikipedia.org/wiki/Euler_angles#Rotation_matrix + // + // Z1-X2-Z3 rotation + + return + tensor + ( + c1*c3 - c2*s1*s3, -c1*s3 - c2*c3*s1, s1*s2, + c3*s1 + c1*c2*s3, c1*c2*c3 - s1*s3, -c1*s2, + s2*s3, c3*s2, c2 + ); +} + + // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // Foam::vector Foam::EulerCoordinateRotation::transform(const vector& st) const @@ -147,49 +184,6 @@ Foam::symmTensor Foam::EulerCoordinateRotation::transformVector } -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -void Foam::EulerCoordinateRotation::calcTransform -( - const scalar phiAngle, - const scalar thetaAngle, - const scalar psiAngle, - const bool inDegrees -) -{ - scalar phi = phiAngle; - scalar theta = thetaAngle; - scalar psi = psiAngle; - - if (inDegrees) - { - phi *= constant::mathematical::pi/180.0; - theta *= constant::mathematical::pi/180.0; - psi *= constant::mathematical::pi/180.0; - } - - R_ = - ( - tensor - ( - cos(phi)*cos(psi) - sin(phi)*sin(psi)*cos(theta), - -sin(phi)*cos(psi)*cos(theta) - cos(phi)*sin(psi), - sin(phi)*sin(theta), - - cos(phi)*sin(psi)*cos(theta) + sin(phi)*cos(psi), - cos(phi)*cos(psi)*cos(theta) - sin(phi)*sin(psi), - -cos(phi)*sin(theta), - - sin(psi)*sin(theta), - cos(psi)*sin(theta), - cos(theta) - ) - ); - - Rtr_ = R_.T(); -} - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::EulerCoordinateRotation::EulerCoordinateRotation() @@ -212,35 +206,25 @@ Foam::EulerCoordinateRotation::EulerCoordinateRotation Foam::EulerCoordinateRotation::EulerCoordinateRotation ( const vector& phiThetaPsi, - const bool inDegrees + const bool degrees ) : - R_(sphericalTensor::I), - Rtr_(sphericalTensor::I) -{ - calcTransform - ( - phiThetaPsi.component(vector::X), - phiThetaPsi.component(vector::Y), - phiThetaPsi.component(vector::Z), - inDegrees - ); -} + R_(rotation(phiThetaPsi, degrees)), + Rtr_(R_.T()) +{} Foam::EulerCoordinateRotation::EulerCoordinateRotation ( - const scalar phiAngle, - const scalar thetaAngle, - const scalar psiAngle, - const bool inDegrees + const scalar phi, + const scalar theta, + const scalar psi, + const bool degrees ) : - R_(sphericalTensor::I), - Rtr_(sphericalTensor::I) -{ - calcTransform(phiAngle, thetaAngle, psiAngle, inDegrees); -} + R_(rotation(vector(phi, theta, psi), degrees)), + Rtr_(R_.T()) +{} Foam::EulerCoordinateRotation::EulerCoordinateRotation @@ -248,19 +232,16 @@ Foam::EulerCoordinateRotation::EulerCoordinateRotation const dictionary& dict ) : - R_(sphericalTensor::I), - Rtr_(sphericalTensor::I) -{ - const vector rotation(dict.lookup("rotation")); - - calcTransform + R_ ( - rotation.component(vector::X), - rotation.component(vector::Y), - rotation.component(vector::Z), - dict.lookupOrDefault("degrees", true) - ); -} + rotation + ( + dict.get<vector>("rotation"), + dict.lookupOrDefault("degrees", true) + ) + ), + Rtr_(R_.T()) +{} Foam::EulerCoordinateRotation::EulerCoordinateRotation diff --git a/src/meshTools/coordinateSystems/coordinateRotation/EulerCoordinateRotation.H b/src/meshTools/coordinate/rotation/EulerCoordinateRotation.H similarity index 89% rename from src/meshTools/coordinateSystems/coordinateRotation/EulerCoordinateRotation.H rename to src/meshTools/coordinate/rotation/EulerCoordinateRotation.H index 6b2c44f809a1d880d14881dc0ba9016a5ceb3c08..4a60558ff54ad89b32708731f0b354564644c866 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/EulerCoordinateRotation.H +++ b/src/meshTools/coordinate/rotation/EulerCoordinateRotation.H @@ -32,14 +32,9 @@ Description The order of the parameter arguments matches this rotation order. For reference and illustration, see - http://mathworld.wolfram.com/EulerAngles.html - and - https://en.wikipedia.org/wiki/Euler_angles#Conventions + https://en.wikipedia.org/wiki/Euler_angles - Note, however, that it is the reverse transformation - (local->global) that is defined here. - - - the rotation angles are in degrees, unless otherwise explicitly specified: + The rotation angles are in degrees, unless otherwise explicitly specified: \verbatim coordinateRotation @@ -73,7 +68,6 @@ class EulerCoordinateRotation : public coordinateRotation { - // Private Member Data //- Local-to-global transformation tensor @@ -83,18 +77,6 @@ class EulerCoordinateRotation tensor Rtr_; - // Private Member Functions - - //- Calculate transformation tensor - void calcTransform - ( - const scalar phiAngle, - const scalar thetaAngle, - const scalar psiAngle, - const bool inDegrees - ); - - public: //- Runtime type information @@ -113,16 +95,16 @@ public: EulerCoordinateRotation ( const vector& phiThetaPsi, - const bool inDegrees + const bool degrees ); //- Construct from components of rotation vector EulerCoordinateRotation ( - const scalar phiAngle, - const scalar thetaAngle, - const scalar psiAngle, - const bool inDegrees + const scalar phi, + const scalar theta, + const scalar psi, + const bool degrees ); //- Construct from dictionary @@ -144,6 +126,13 @@ public: } + // Static Member Functions + + //- The rotation tensor calculated for the specified Euler angles + //- interpreted as phi/theta/psi (z-x-z order) + static tensor rotation(const vector& angles, bool degrees); + + // Member Functions //- Reset rotation to an identity rotation diff --git a/src/meshTools/coordinateSystems/coordinateRotation/STARCDCoordinateRotation.C b/src/meshTools/coordinate/rotation/STARCDCoordinateRotation.C similarity index 72% rename from src/meshTools/coordinateSystems/coordinateRotation/STARCDCoordinateRotation.C rename to src/meshTools/coordinate/rotation/STARCDCoordinateRotation.C index 2cb61d9d1df474347cee17190eb0277e930ac4d6..00276ca92d46c714f7d3c5dd654ea886eac1c05b 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/STARCDCoordinateRotation.C +++ b/src/meshTools/coordinate/rotation/STARCDCoordinateRotation.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) 2017 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -24,8 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "STARCDCoordinateRotation.H" - -#include "mathematicalConstants.H" +#include "unitConversion.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -148,46 +147,37 @@ Foam::symmTensor Foam::STARCDCoordinateRotation::transformVector } -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // +// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // -void Foam::STARCDCoordinateRotation::calcTransform +Foam::tensor Foam::STARCDCoordinateRotation::rotation ( - const scalar rotZ, - const scalar rotX, - const scalar rotY, - const bool inDegrees + const vector& angles, + const bool degrees ) { - scalar x = rotX; - scalar y = rotY; - scalar z = rotZ; + scalar z = angles.component(vector::X); // 1. Rotate about Z + scalar x = angles.component(vector::Y); // 2. Rotate about X + scalar y = angles.component(vector::Z); // 3. Rotate about Y - if (inDegrees) + if (degrees) { - x *= constant::mathematical::pi/180.0; - y *= constant::mathematical::pi/180.0; - z *= constant::mathematical::pi/180.0; + x *= degToRad(); + y *= degToRad(); + z *= degToRad(); } - R_ = - ( - tensor - ( - cos(y)*cos(z) - sin(x)*sin(y)*sin(z), - -cos(x)*sin(z), - sin(x)*cos(y)*sin(z) + sin(y)*cos(z), + const scalar cx = cos(x); const scalar sx = sin(x); + const scalar cy = cos(y); const scalar sy = sin(y); + const scalar cz = cos(z); const scalar sz = sin(z); - cos(y)*sin(z) + sin(x)*sin(y)*cos(z), - cos(x)*cos(z), - sin(y)*sin(z) - sin(x)*cos(y)*cos(z), - -cos(x)*sin(y), - sin(x), - cos(x)*cos(y) - ) - ); - - Rtr_ = R_.T(); + return + tensor + ( + cy*cz - sx*sy*sz, -cx*sz, sx*cy*sz + sy*cz, + cy*sz + sx*sy*cz, cx*cz, sy*sz - sx*cy*cz, + -cx*sy, sx, cx*cy + ); } @@ -213,20 +203,12 @@ Foam::STARCDCoordinateRotation::STARCDCoordinateRotation Foam::STARCDCoordinateRotation::STARCDCoordinateRotation ( const vector& rotZrotXrotY, - const bool inDegrees + const bool degrees ) : - R_(sphericalTensor::I), - Rtr_(sphericalTensor::I) -{ - calcTransform - ( - rotZrotXrotY.component(vector::X), - rotZrotXrotY.component(vector::Y), - rotZrotXrotY.component(vector::Z), - inDegrees - ); -} + R_(rotation(rotZrotXrotY, degrees)), + Rtr_(R_.T()) +{} Foam::STARCDCoordinateRotation::STARCDCoordinateRotation @@ -234,14 +216,12 @@ Foam::STARCDCoordinateRotation::STARCDCoordinateRotation const scalar rotZ, const scalar rotX, const scalar rotY, - const bool inDegrees + const bool degrees ) : - R_(sphericalTensor::I), - Rtr_(sphericalTensor::I) -{ - calcTransform(rotZ, rotX, rotY, inDegrees); -} + R_(rotation(vector(rotZ, rotX, rotY), degrees)), + Rtr_(R_.T()) +{} Foam::STARCDCoordinateRotation::STARCDCoordinateRotation @@ -249,19 +229,16 @@ Foam::STARCDCoordinateRotation::STARCDCoordinateRotation const dictionary& dict ) : - R_(sphericalTensor::I), - Rtr_(sphericalTensor::I) -{ - const vector rotation(dict.lookup("rotation")); - - calcTransform + R_ ( - rotation.component(vector::X), - rotation.component(vector::Y), - rotation.component(vector::Z), - dict.lookupOrDefault("degrees", true) - ); -} + rotation + ( + dict.get<vector>("rotation"), + dict.lookupOrDefault("degrees", true) + ) + ), + Rtr_(R_.T()) +{} Foam::STARCDCoordinateRotation::STARCDCoordinateRotation diff --git a/src/meshTools/coordinateSystems/coordinateRotation/STARCDCoordinateRotation.H b/src/meshTools/coordinate/rotation/STARCDCoordinateRotation.H similarity index 94% rename from src/meshTools/coordinateSystems/coordinateRotation/STARCDCoordinateRotation.H rename to src/meshTools/coordinate/rotation/STARCDCoordinateRotation.H index 13625e34ba7569f64e64a34c9893efbd3db6e9b2..a6094a8653f6eb43e3e09482e4c404ad433381ba 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/STARCDCoordinateRotation.H +++ b/src/meshTools/coordinate/rotation/STARCDCoordinateRotation.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) 2017 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -65,7 +65,6 @@ class STARCDCoordinateRotation : public coordinateRotation { - // Private Member Data //- Local-to-Global transformation tensor @@ -75,18 +74,6 @@ class STARCDCoordinateRotation tensor Rtr_; - // Private Member Functions - - //- Calculate transformation tensor - void calcTransform - ( - const scalar rotZ, - const scalar rotX, - const scalar rotY, - const bool inDegrees - ); - - public: //- Runtime type information @@ -105,7 +92,7 @@ public: STARCDCoordinateRotation ( const vector& rotZrotXrotY, - const bool inDegrees + const bool degrees ); //- Construct from components of rotation vector @@ -114,7 +101,7 @@ public: const scalar rotZ, const scalar rotX, const scalar rotY, - const bool inDegrees + const bool degrees ); //- Construct from dictionary @@ -137,6 +124,13 @@ public: } + // Static Member Functions + + //- The rotation tensor calculated for the specified STARCD angles + //- interpreted as rotate-Z, rotate-X, rotate-Y + static tensor rotation(const vector& angles, bool degrees); + + // Member Functions //- Reset rotation to an identity rotation diff --git a/src/meshTools/coordinateSystems/coordinateRotation/axesRotation.C b/src/meshTools/coordinate/rotation/axesRotation.C similarity index 64% rename from src/meshTools/coordinateSystems/coordinateRotation/axesRotation.C rename to src/meshTools/coordinate/rotation/axesRotation.C index 95ec8f0e763ab90e9366b5f36545eed68a5daea5..e40e11fe9ea6bd3cda6c58f153f1960f8e39ae09 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/axesRotation.C +++ b/src/meshTools/coordinate/rotation/axesRotation.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) 2017 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -47,6 +47,151 @@ namespace Foam } +// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // + +Foam::tensor Foam::axesRotation::rotation +( + const vector& axis1, + const vector& axis2, + axisOrder order +) +{ + const scalar magAxis1(mag(axis1)); + scalar magAxis2(mag(axis2)); + + if (magAxis1 < ROOTVSMALL) + { + FatalErrorInFunction + << "Dominant coordinate axis cannot have zero length" + << nl << endl + << abort(FatalError); + } + + const vector ax1(axis1 / magAxis1); // normalise + vector ax2(axis2); + + if (magAxis2 < ROOTVSMALL) + { + // axis2 == Zero : Use best-guess for the second axis. + ax2 = findOrthogonal(axis1); + } + + // Remove colinear component + ax2 -= ((ax1 & ax2) * ax1); + + magAxis2 = mag(ax2); + + if (magAxis2 < SMALL) + { + WarningInFunction + << "axis1, axis2 appear to be co-linear: " + << axis1 << ", " << axis2 << " Revert to guessing axis2" + << nl << endl; + + ax2 = findOrthogonal(axis1); + + // Remove colinear component + ax2 -= ((ax1 & ax2) * ax1); + + magAxis2 = mag(ax2); + + if (magAxis2 < SMALL) + { + FatalErrorInFunction + << "Could not find an appropriate second axis" + << nl << endl + << abort(FatalError); + } + } + + ax2 /= magAxis2; // normalise + + + // The local axes are columns of the rotation matrix + + tensor rotTensor; + + switch (order) + { + case E1_E2: + { + rotTensor.col<0>(ax1); + rotTensor.col<1>(ax2); + rotTensor.col<2>(ax1^ax2); + break; + } + case E2_E3: + { + rotTensor.col<0>(ax1^ax2); + rotTensor.col<1>(ax1); + rotTensor.col<2>(ax2); + break; + } + case E3_E1: + case E3_E1_COMPAT: + { + rotTensor.col<0>(ax2); + rotTensor.col<1>(ax1^ax2); + rotTensor.col<2>(ax1); + break; + } + } + + return rotTensor; +} + + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +void Foam::axesRotation::read(const dictionary& dict) +{ + vector axis1, axis2; + axisOrder order = E3_E1; + + if + ( + dict.readIfPresent("e1", axis1) + && dict.readIfPresent("e2", axis2) + ) + { + order = E1_E2; + } + else if + ( + dict.readIfPresent("e2", axis1) + && dict.readIfPresent("e3", axis2) + ) + { + order = E2_E3; + } + else if + ( + dict.readIfPresent("e3", axis1) + && dict.readIfPresent("e1", axis2) + ) + { + order = E3_E1; + } + else if + ( + dict.readIfPresent("axis", axis1) + && dict.readIfPresent("direction", axis2) + ) + { + order = E3_E1_COMPAT; + } + else + { + FatalErrorInFunction + << "No entries of the type (e1, e2) or (e2, e3) or (e3, e1) found" + << exit(FatalError); + } + + R_ = rotation(axis1, axis2, order); + Rtr_ = R_.T(); +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::axesRotation::axesRotation() @@ -77,11 +222,9 @@ Foam::axesRotation::axesRotation const axisOrder& order ) : - R_(sphericalTensor::I), - Rtr_(sphericalTensor::I) -{ - setTransform(axis, dir, order); -} + R_(rotation(axis, dir, order)), + Rtr_(R_.T()) +{} Foam::axesRotation::axesRotation @@ -89,37 +232,9 @@ Foam::axesRotation::axesRotation const vector& axis ) : - R_(sphericalTensor::I), - Rtr_(sphericalTensor::I) -{ - direction maxCmpt = 0, dirCmpt = 1; - - scalar maxVal = mag(axis[maxCmpt]); - bool negative = (axis[maxCmpt] < 0); - - for (direction cmpt = 1; cmpt < vector::nComponents; ++cmpt) - { - const scalar val = mag(axis[cmpt]); - - if (maxVal < val) - { - maxVal = val; - maxCmpt = cmpt; - dirCmpt = maxCmpt+1; - negative = (axis[cmpt] < 0); - - if (dirCmpt >= vector::nComponents) - { - dirCmpt = 0; - } - } - } - - vector dir = Zero; - dir.component(dirCmpt) = (negative ? -1 : 1); - - setTransform(axis, dir, E3_E1); -} + R_(rotation(axis, findOrthogonal(axis), E3_E1)), + Rtr_(R_.T()) +{} Foam::axesRotation::axesRotation @@ -130,7 +245,7 @@ Foam::axesRotation::axesRotation R_(sphericalTensor::I), Rtr_(sphericalTensor::I) { - operator=(dict); + read(dict); } @@ -146,62 +261,6 @@ Foam::axesRotation::axesRotation // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // -void Foam::axesRotation::setTransform -( - const vector& axis1, - const vector& axis2, - const axisOrder& order -) -{ - const vector a = axis1/mag(axis1); - vector b = axis2; - - b = b - (b & a)*a; - - if (mag(b) < SMALL) - { - FatalErrorInFunction - << "axis1, axis2 appear to be co-linear: " - << axis1 << ", " << axis2 << endl - << abort(FatalError); - } - - b = b/mag(b); - const vector c = a^b; - - // Global->local transformation - switch (order) - { - case E1_E2: - { - Rtr_ = tensor(a, b, c); - break; - } - case E2_E3: - { - Rtr_ = tensor(c, a, b); - break; - } - case E3_E1: - { - Rtr_ = tensor(b, c, a); - break; - } - default: - { - FatalErrorInFunction - << "Unhandled axes specification" << endl - << abort(FatalError); - - break; - } - } - - // Local->global transformation - R_ = Rtr_.T(); -} - - const Foam::tensorField& Foam::axesRotation::Tr() const { NotImplemented; @@ -298,36 +357,7 @@ Foam::symmTensor Foam::axesRotation::transformVector void Foam::axesRotation::operator=(const dictionary& dict) { - vector axis1, axis2; - - if (dict.readIfPresent("e1", axis1) && dict.readIfPresent("e2", axis2)) - { - setTransform(axis1, axis2, E1_E2); - } - else if (dict.readIfPresent("e2", axis1) && dict.readIfPresent("e3", axis2)) - { - setTransform(axis1, axis2, E2_E3); - } - else if (dict.readIfPresent("e3", axis1) && dict.readIfPresent("e1", axis2)) - { - setTransform(axis1, axis2, E3_E1); - } - else if (dict.found("axis") || dict.found("direction")) - { - // Both "axis" and "direction" are required - // If one is missing the appropriate error message will be generated - dict.lookup("axis") >> axis1; - dict.lookup("direction") >> axis2; - - setTransform(axis1, axis2, E3_E1); - } - else - { - FatalErrorInFunction - << "not entry of the type (e1, e2) or (e2, e3) or (e3, e1) " - << "found " - << exit(FatalError); - } + read(dict); } diff --git a/src/meshTools/coordinateSystems/coordinateRotation/axesRotation.H b/src/meshTools/coordinate/rotation/axesRotation.H similarity index 91% rename from src/meshTools/coordinateSystems/coordinateRotation/axesRotation.H rename to src/meshTools/coordinate/rotation/axesRotation.H index 4ac0a04928863905126f8d314277101a064c9760..3a3583211bdd691689bc806a35ec686fa4d94199 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/axesRotation.H +++ b/src/meshTools/coordinate/rotation/axesRotation.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) 2017 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -73,9 +73,10 @@ public: // Note that these follow the right-hand rule. enum axisOrder { - E1_E2, //!< The axis is X-dominant, the direction is Y-dominant - E2_E3, //!< The axis is Y-dominant, the direction is Z-dominant - E3_E1 //!< The axis is Z-dominant, the direction is X-dominant + E1_E2, //!< The axis1 (dominant) is local X, axis2 is local Y. + E2_E3, //!< The axis1 (dominant) is local Y, axis2 is local Z. + E3_E1, //!< The axis1 (dominant) is local Z, axis2 is local X. + E3_E1_COMPAT, //!< E3_E1 specified as axis/direction. }; @@ -90,6 +91,12 @@ private: tensor Rtr_; + // Protected Member Functions + + //- Read from dictionary + void read(const dictionary& dict); + + public: //- Runtime type information @@ -149,14 +156,19 @@ public: Rtr_ = sphericalTensor::I; } - //- Set the transformation tensors from two axes (axis and direction) - void setTransform + + // Static Member Functions + + //- The rotation tensor calculated from two axes and their order. + // The input axes will be normalised. + static tensor rotation ( const vector& axis1, const vector& axis2, - const axisOrder& order = E3_E1 + axisOrder order = E3_E1 ); + //- Update the rotation for a list of cells virtual void updateCells(const polyMesh&, const labelList&) {} diff --git a/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.C b/src/meshTools/coordinate/rotation/coordinateRotation.C similarity index 60% rename from src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.C rename to src/meshTools/coordinate/rotation/coordinateRotation.C index 57565dbc451c3dd8c8a456f3cab50c5598e64174..41892d013d340187faca65389a575a3d40eaefdf 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.C +++ b/src/meshTools/coordinate/rotation/coordinateRotation.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -37,41 +37,65 @@ namespace Foam } -// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // + +Foam::vector Foam::coordinateRotation::findOrthogonal(const vector& axis) +{ + direction maxCmpt = 0; + scalar maxVal = mag(axis[maxCmpt]); + + for (direction cmpt=1; cmpt < vector::nComponents; ++cmpt) + { + const scalar val = mag(axis[cmpt]); + + if (maxVal < val) + { + maxVal = val; + maxCmpt = cmpt; + } + } + + direction cmpt = ((maxCmpt == vector::nComponents-1) ? 0 : (maxCmpt+1)); + + vector dirn(Zero); + dirn.component(cmpt) = ((axis[maxCmpt] < 0) ? -1 : 1); + + return dirn; +} + Foam::symmTensor Foam::coordinateRotation::transformPrincipal ( const tensor& tt, - const vector& st -) const + const vector& v +) { return symmTensor ( - tt.xx()*st.x()*tt.xx() - + tt.xy()*st.y()*tt.xy() - + tt.xz()*st.z()*tt.xz(), + tt.xx()*v.x()*tt.xx() + + tt.xy()*v.y()*tt.xy() + + tt.xz()*v.z()*tt.xz(), - tt.xx()*st.x()*tt.yx() - + tt.xy()*st.y()*tt.yy() - + tt.xz()*st.z()*tt.yz(), + tt.xx()*v.x()*tt.yx() + + tt.xy()*v.y()*tt.yy() + + tt.xz()*v.z()*tt.yz(), - tt.xx()*st.x()*tt.zx() - + tt.xy()*st.y()*tt.zy() - + tt.xz()*st.z()*tt.zz(), + tt.xx()*v.x()*tt.zx() + + tt.xy()*v.y()*tt.zy() + + tt.xz()*v.z()*tt.zz(), - tt.yx()*st.x()*tt.yx() - + tt.yy()*st.y()*tt.yy() - + tt.yz()*st.z()*tt.yz(), + tt.yx()*v.x()*tt.yx() + + tt.yy()*v.y()*tt.yy() + + tt.yz()*v.z()*tt.yz(), - tt.yx()*st.x()*tt.zx() - + tt.yy()*st.y()*tt.zy() - + tt.yz()*st.z()*tt.zz(), + tt.yx()*v.x()*tt.zx() + + tt.yy()*v.y()*tt.zy() + + tt.yz()*v.z()*tt.zz(), - tt.zx()*st.x()*tt.zx() - + tt.zy()*st.y()*tt.zy() - + tt.zz()*st.z()*tt.zz() + tt.zx()*v.x()*tt.zx() + + tt.zy()*v.y()*tt.zy() + + tt.zz()*v.z()*tt.zz() ); - } diff --git a/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.H b/src/meshTools/coordinate/rotation/coordinateRotation.H similarity index 95% rename from src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.H rename to src/meshTools/coordinate/rotation/coordinateRotation.H index 3a8396b5095d0d2be14e505b4e48ace1100e1671..4c725756a17d4e14530de2fc10b194df52098eff 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.H +++ b/src/meshTools/coordinate/rotation/coordinateRotation.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -75,11 +75,13 @@ protected: // Protected member functions //- Transform principal - symmTensor transformPrincipal(const tensor&, const vector&) const; + static symmTensor transformPrincipal(const tensor&, const vector&); + //- Determine best-guess for an orthogonal axis + static vector findOrthogonal(const vector& axis); -public: +public: //- Runtime type information TypeName("coordinateRotation"); @@ -135,8 +137,7 @@ public: //- Destructor - virtual ~coordinateRotation() - {} + virtual ~coordinateRotation() = default; // Member Functions diff --git a/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotationNew.C b/src/meshTools/coordinate/rotation/coordinateRotationNew.C similarity index 100% rename from src/meshTools/coordinateSystems/coordinateRotation/coordinateRotationNew.C rename to src/meshTools/coordinate/rotation/coordinateRotationNew.C diff --git a/src/meshTools/coordinateSystems/coordinateRotation/cylindrical.C b/src/meshTools/coordinate/rotation/cylindrical.C similarity index 99% rename from src/meshTools/coordinateSystems/coordinateRotation/cylindrical.C rename to src/meshTools/coordinate/rotation/cylindrical.C index 17303cf7a50cd7dae89d7b03e39eaeba46309178..d6253fd8a4c8b43b92e0a521a17dbb395d05dbb3 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/cylindrical.C +++ b/src/meshTools/coordinate/rotation/cylindrical.C @@ -140,7 +140,7 @@ Foam::cylindrical::cylindrical dict.parent().readIfPresent("origin", origin_); // Rotation axis - dict.lookup("e3") >> e3_; + dict.readEntry("e3", e3_); init(obr); } diff --git a/src/meshTools/coordinateSystems/coordinateRotation/cylindrical.H b/src/meshTools/coordinate/rotation/cylindrical.H similarity index 100% rename from src/meshTools/coordinateSystems/coordinateRotation/cylindrical.H rename to src/meshTools/coordinate/rotation/cylindrical.H diff --git a/src/meshTools/coordinateSystems/cartesianCS.C b/src/meshTools/coordinate/systems/cartesianCS.C similarity index 100% rename from src/meshTools/coordinateSystems/cartesianCS.C rename to src/meshTools/coordinate/systems/cartesianCS.C diff --git a/src/meshTools/coordinateSystems/cartesianCS.H b/src/meshTools/coordinate/systems/cartesianCS.H similarity index 100% rename from src/meshTools/coordinateSystems/cartesianCS.H rename to src/meshTools/coordinate/systems/cartesianCS.H diff --git a/src/meshTools/coordinateSystems/coordinateSystem.C b/src/meshTools/coordinate/systems/coordinateSystem.C similarity index 99% rename from src/meshTools/coordinateSystems/coordinateSystem.C rename to src/meshTools/coordinate/systems/coordinateSystem.C index 5ec436197423e97c00e4eb3f764c12e635c59cb7..0428153c8eb8ab3d008499cf556aa61b550cb49d 100644 --- a/src/meshTools/coordinateSystems/coordinateSystem.C +++ b/src/meshTools/coordinate/systems/coordinateSystem.C @@ -366,7 +366,7 @@ void Foam::coordinateSystem::operator=(coordinateSystem&& cs) void Foam::coordinateSystem::init(const dictionary& dict) { - dict.lookup("origin") >> origin_; + dict.readEntry("origin", origin_); note_.clear(); dict.readIfPresent("note", note_); R_ = coordinateRotation::New(dict.subDict("coordinateRotation")); @@ -379,7 +379,7 @@ void Foam::coordinateSystem::init const objectRegistry& obr ) { - dict.lookup("origin") >> origin_; + dict.readEntry("origin", origin_); // The 'note' entry is optional note_.clear(); diff --git a/src/meshTools/coordinateSystems/coordinateSystem.H b/src/meshTools/coordinate/systems/coordinateSystem.H similarity index 100% rename from src/meshTools/coordinateSystems/coordinateSystem.H rename to src/meshTools/coordinate/systems/coordinateSystem.H diff --git a/src/meshTools/coordinateSystems/coordinateSystemNew.C b/src/meshTools/coordinate/systems/coordinateSystemNew.C similarity index 100% rename from src/meshTools/coordinateSystems/coordinateSystemNew.C rename to src/meshTools/coordinate/systems/coordinateSystemNew.C diff --git a/src/meshTools/coordinateSystems/coordinateSystems.C b/src/meshTools/coordinate/systems/coordinateSystems.C similarity index 100% rename from src/meshTools/coordinateSystems/coordinateSystems.C rename to src/meshTools/coordinate/systems/coordinateSystems.C diff --git a/src/meshTools/coordinateSystems/coordinateSystems.H b/src/meshTools/coordinate/systems/coordinateSystems.H similarity index 100% rename from src/meshTools/coordinateSystems/coordinateSystems.H rename to src/meshTools/coordinate/systems/coordinateSystems.H diff --git a/src/meshTools/coordinateSystems/cylindricalCS.C b/src/meshTools/coordinate/systems/cylindricalCS.C similarity index 100% rename from src/meshTools/coordinateSystems/cylindricalCS.C rename to src/meshTools/coordinate/systems/cylindricalCS.C diff --git a/src/meshTools/coordinateSystems/cylindricalCS.H b/src/meshTools/coordinate/systems/cylindricalCS.H similarity index 100% rename from src/meshTools/coordinateSystems/cylindricalCS.H rename to src/meshTools/coordinate/systems/cylindricalCS.H diff --git a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C index 97fe0ab615c46233e5cbef3a23fa0299a302439b..cfa8e9fbdccc693cf757ef84f7235defe93f542a 100644 --- a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C +++ b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C @@ -1050,7 +1050,7 @@ Foam::mappedPatchBase::mappedPatchBase { case UNIFORM: { - offset_ = point(dict.lookup("offset")); + dict.readEntry("offset", offset_); } break; @@ -1063,15 +1063,14 @@ Foam::mappedPatchBase::mappedPatchBase case NORMAL: { - distance_ = readScalar(dict.lookup("distance")); + dict.readEntry("distance", distance_); } break; } } - else if (dict.found("offset")) + else if (dict.readIfPresent("offset", offset_)) { offsetMode_ = UNIFORM; - offset_ = point(dict.lookup("offset")); } else if (dict.found("offsets")) { diff --git a/src/parallel/decompose/decompositionMethods/geomDecomp/geomDecomp.C b/src/parallel/decompose/decompositionMethods/geomDecomp/geomDecomp.C index aaddd063a3023c17fba0043640c1862943d8629c..d4eeb2424107588075cb8a14166c7a3351b99075 100644 --- a/src/parallel/decompose/decompositionMethods/geomDecomp/geomDecomp.C +++ b/src/parallel/decompose/decompositionMethods/geomDecomp/geomDecomp.C @@ -31,7 +31,7 @@ void Foam::geomDecomp::readCoeffs() { coeffsDict_.readIfPresent("delta", delta_); - coeffsDict_.lookup("n") >> n_; + coeffsDict_.readEntry("n", n_); // Verify that the input makes sense if (nDomains_ != n_.x()*n_.y()*n_.z()) diff --git a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C index 520a061e58c1d6bc209023cfd598a1a6f64ee541..285135f61cad073f5f5ea9d35f199750e2c4eee3 100644 --- a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C +++ b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C @@ -52,11 +52,11 @@ addToRunTimeSelectionTable(pyrolysisModel, reactingOneDim, dictionary); void reactingOneDim::readReactingOneDimControls() { const dictionary& solution = this->solution().subDict("SIMPLE"); - solution.lookup("nNonOrthCorr") >> nNonOrthCorr_; - time().controlDict().lookup("maxDi") >> maxDiff_; - coeffs().lookup("minimumDelta") >> minimumDelta_; + solution.readEntry("nNonOrthCorr", nNonOrthCorr_); + time().controlDict().readEntry("maxDi", maxDiff_); + coeffs().readEntry("minimumDelta", minimumDelta_); gasHSource_ = coeffs().lookupOrDefault("gasHSource", false); - coeffs().lookup("qrHSource") >> qrHSource_; + coeffs().readEntry("qrHSource", qrHSource_); useChemistrySolvers_ = coeffs().lookupOrDefault("useChemistrySolvers", true); } diff --git a/src/regionModels/pyrolysisModels/thermo/thermo.C b/src/regionModels/pyrolysisModels/thermo/thermo.C index f3177a7fdfc109f5db97eaa44cf0aec3c4f6b10a..caf891afb093f9186f697389d5822f86abd45aae 100644 --- a/src/regionModels/pyrolysisModels/thermo/thermo.C +++ b/src/regionModels/pyrolysisModels/thermo/thermo.C @@ -50,8 +50,8 @@ addToRunTimeSelectionTable(pyrolysisModel, thermo, dictionary); void thermo::readControls() { const dictionary& solution = this->solution().subDict("SIMPLE"); - solution.lookup("nNonOrthCorr") >> nNonOrthCorr_; - time().controlDict().lookup("maxDi") >> maxDiff_; + solution.readEntry("nNonOrthCorr", nNonOrthCorr_); + time().controlDict().readEntry("maxDi", maxDiff_); } diff --git a/src/regionModels/regionModel/regionProperties/regionProperties.C b/src/regionModels/regionModel/regionProperties/regionProperties.C index 7a7d6a646e7ad7a93b002ce58c565dff6632fdaf..6d91d2bf341fcf8021faf0a2d5ab530413ff5da5 100644 --- a/src/regionModels/regionModel/regionProperties/regionProperties.C +++ b/src/regionModels/regionModel/regionProperties/regionProperties.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -25,32 +25,106 @@ License #include "regionProperties.H" #include "IOdictionary.H" +#include "Time.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::regionProperties::regionProperties(const Time& runTime) : - HashTable<wordList> + regionProperties(runTime, IOobject::MUST_READ_IF_MODIFIED) +{} + + +Foam::regionProperties::regionProperties +( + const Time& runTime, + IOobject::readOption rOpt +) +{ + HashTable<wordList>& props = *this; + + IOdictionary iodict ( - IOdictionary + IOobject ( - IOobject - ( - "regionProperties", - runTime.time().constant(), - runTime.db(), - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE - ) - ).lookup("regions") + "regionProperties", + runTime.time().constant(), + runTime.db(), + rOpt, + IOobject::NO_WRITE + ) + ); + + if + ( + (rOpt == IOobject::MUST_READ || rOpt == IOobject::MUST_READ_IF_MODIFIED) + || iodict.size() ) -{} + { + iodict.readEntry("regions", props); + } +} -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -Foam::regionProperties::~regionProperties() -{} +Foam::label Foam::regionProperties::count() const +{ + label n = 0; + + const HashTable<wordList>& props = *this; + + forAllConstIters(props, iter) + { + n += iter.object().size(); + } + + return n; +} + + +Foam::wordList Foam::regionProperties::names() const +{ + wordList list(this->count()); + + label n = 0; + + const HashTable<wordList>& props = *this; + + for (const word& grp : props.sortedToc()) + { + for (const word& name : props[grp]) + { + list[n] = name; + ++n; + } + } + + return list; +} + + +Foam::wordList Foam::regionProperties::sortedNames() const +{ + wordList list(this->count()); + + label n = 0; + + const HashTable<wordList>& props = *this; + + forAllConstIters(props, iter) + { + for (const word& name : iter.object()) + { + list[n] = name; + ++n; + } + } + + Foam::sort(list); + + return list; +} // ************************************************************************* // diff --git a/src/regionModels/regionModel/regionProperties/regionProperties.H b/src/regionModels/regionModel/regionProperties/regionProperties.H index 579a8a0e1f5697b9bdfbfd1ce330702d2e7364d3..28640822b7065f7c53f0d7975237d81d453a6ea2 100644 --- a/src/regionModels/regionModel/regionProperties/regionProperties.H +++ b/src/regionModels/regionModel/regionProperties/regionProperties.H @@ -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. @@ -39,14 +39,18 @@ SourceFiles #ifndef regionProperties_H #define regionProperties_H -#include "Time.H" #include "HashTable.H" +#include "wordList.H" +#include "IOobject.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { +// Forward Declarations +class Time; + /*---------------------------------------------------------------------------*\ Class regionProperties Declaration \*---------------------------------------------------------------------------*/ @@ -55,23 +59,35 @@ class regionProperties : public HashTable<wordList> { - - //- No copy construct - regionProperties(const regionProperties&) = delete; - - //- No copy assignment - void operator=(const regionProperties&) = delete; - public: // Constructors - //- Construct from components - regionProperties(const Time& runTime); + //- Construct from Time + explicit regionProperties(const Time& runTime); + + //- Construct from Time with specified read options + regionProperties + ( + const Time& runTime, + IOobject::readOption rOpt + ); //- Destructor - ~regionProperties(); + ~regionProperties() = default; + + + // Member Functions + + //- Total count of all region names. + label count() const; + + //- The region names. Sorted by region type. + wordList names() const; + + //- The region names in sorted order. + wordList sortedNames() const; }; diff --git a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C index a7e07f1447c897cd8c2f3285ebf629bb5a84b869..1ccbd5ca8cb95a4d064c6ad1c8c10d588956b53e 100644 --- a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C +++ b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C @@ -58,10 +58,10 @@ bool kinematicSingleLayer::read() if (surfaceFilmRegionModel::read()) { const dictionary& solution = this->solution().subDict("PISO"); - solution.lookup("momentumPredictor") >> momentumPredictor_; + solution.readEntry("momentumPredictor", momentumPredictor_); solution.readIfPresent("nOuterCorr", nOuterCorr_); - solution.lookup("nCorr") >> nCorr_; - solution.lookup("nNonOrthCorr") >> nNonOrthCorr_; + solution.readEntry("nCorr", nCorr_); + solution.readEntry("nNonOrthCorr", nNonOrthCorr_); return true; } diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/filmThermoModel/constantFilmThermo/constantFilmThermo.C b/src/regionModels/surfaceFilmModels/submodels/kinematic/filmThermoModel/constantFilmThermo/constantFilmThermo.C index 15a870171bde328a22c5a89192f2a67e12965758..e88110b3f16a569496bc21e24869142af81f5bcd 100644 --- a/src/regionModels/surfaceFilmModels/submodels/kinematic/filmThermoModel/constantFilmThermo/constantFilmThermo.C +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/filmThermoModel/constantFilmThermo/constantFilmThermo.C @@ -113,7 +113,7 @@ scalar constantFilmThermo::rho { if (!rho0_.set_) { - coeffDict_.lookup(rho0_.name_) >> rho0_.value_; + coeffDict_.readEntry(rho0_.name_, rho0_.value_); rho0_.set_ = true; } @@ -129,7 +129,7 @@ scalar constantFilmThermo::mu { if (!mu0_.set_) { - coeffDict_.lookup(mu0_.name_) >> mu0_.value_; + coeffDict_.readEntry(mu0_.name_, mu0_.value_); mu0_.set_ = true; } @@ -145,7 +145,7 @@ scalar constantFilmThermo::sigma { if (!sigma0_.set_) { - coeffDict_.lookup(sigma0_.name_) >> sigma0_.value_; + coeffDict_.readEntry(sigma0_.name_, sigma0_.value_); sigma0_.set_ = true; } @@ -161,7 +161,7 @@ scalar constantFilmThermo::Cp { if (!Cp0_.set_) { - coeffDict_.lookup(Cp0_.name_) >> Cp0_.value_; + coeffDict_.readEntry(Cp0_.name_, Cp0_.value_); Cp0_.set_ = true; } @@ -177,7 +177,7 @@ scalar constantFilmThermo::kappa { if (!kappa0_.set_) { - coeffDict_.lookup(kappa0_.name_) >> kappa0_.value_; + coeffDict_.readEntry(kappa0_.name_, kappa0_.value_); kappa0_.set_ = true; } @@ -193,7 +193,7 @@ scalar constantFilmThermo::D { if (!D0_.set_) { - coeffDict_.lookup(D0_.name_) >> D0_.value_; + coeffDict_.readEntry(D0_.name_, D0_.value_); D0_.set_ = true; } @@ -209,7 +209,7 @@ scalar constantFilmThermo::hl { if (!hl0_.set_) { - coeffDict_.lookup(hl0_.name_) >> hl0_.value_; + coeffDict_.readEntry(hl0_.name_, hl0_.value_); hl0_.set_ = true; } @@ -225,7 +225,7 @@ scalar constantFilmThermo::pv { if (!pv0_.set_) { - coeffDict_.lookup(pv0_.name_) >> pv0_.value_; + coeffDict_.readEntry(pv0_.name_, pv0_.value_); pv0_.set_ = true; } @@ -237,7 +237,7 @@ scalar constantFilmThermo::W() const { if (!W0_.set_) { - coeffDict_.lookup(W0_.name_) >> W0_.value_; + coeffDict_.readEntry(W0_.name_, W0_.value_); W0_.set_ = true; } @@ -249,7 +249,7 @@ scalar constantFilmThermo::Tb(const scalar p) const { if (!Tb0_.set_) { - coeffDict_.lookup(Tb0_.name_) >> Tb0_.value_; + coeffDict_.readEntry(Tb0_.name_, Tb0_.value_); Tb0_.set_ = true; } diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/filmThermoModel/liquidFilmThermo/liquidFilmThermo.C b/src/regionModels/surfaceFilmModels/submodels/kinematic/filmThermoModel/liquidFilmThermo/liquidFilmThermo.C index b210d1aa6db2ca70b2c4ee8c5e7316f748f25cb0..8160f7a2ba4ce9f164be27d50c19667eb486d4a4 100644 --- a/src/regionModels/surfaceFilmModels/submodels/kinematic/filmThermoModel/liquidFilmThermo/liquidFilmThermo.C +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/filmThermoModel/liquidFilmThermo/liquidFilmThermo.C @@ -76,7 +76,7 @@ void liquidFilmThermo::initLiquid(const dictionary& dict) return; } - dict.lookup("liquid") >> name_; + dict.readEntry("liquid", name_); if (filmModel_.primaryMesh().foundObject<SLGThermo>("SLGThermo")) { @@ -119,8 +119,8 @@ liquidFilmThermo::liquidFilmThermo if (useReferenceValues_) { - coeffDict_.lookup("pRef") >> pRef_; - coeffDict_.lookup("TRef") >> TRef_; + coeffDict_.readEntry("pRef", pRef_); + coeffDict_.readEntry("TRef", TRef_); } } diff --git a/src/regionModels/surfaceFilmModels/surfaceFilmModel/surfaceFilmModelNew.C b/src/regionModels/surfaceFilmModels/surfaceFilmModel/surfaceFilmModelNew.C index 55008f36744878cc0d1754c5ade8fc1d4fca1cf2..d96f701bdb7b78703cc86d74f2937b0a359703dd 100644 --- a/src/regionModels/surfaceFilmModels/surfaceFilmModel/surfaceFilmModelNew.C +++ b/src/regionModels/surfaceFilmModels/surfaceFilmModel/surfaceFilmModelNew.C @@ -62,7 +62,7 @@ autoPtr<surfaceFilmModel> surfaceFilmModel::New surfaceFilmPropertiesDictHeader ); - surfaceFilmPropertiesDict.lookup("surfaceFilmModel") >> modelType; + surfaceFilmPropertiesDict.readEntry("surfaceFilmModel", modelType); } else { diff --git a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C index 69ccdac22ed8c25a4ed0ba51c9459f6627c350a2..4876ae4bc415142cda3dc501e27fedb3f2b55c2b 100644 --- a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C +++ b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C @@ -533,8 +533,8 @@ thermoSingleLayer::thermoSingleLayer if (hydrophilic_) { - coeffs_.lookup("hydrophilicDryScale") >> hydrophilicDryScale_; - coeffs_.lookup("hydrophilicWetScale") >> hydrophilicWetScale_; + coeffs_.readEntry("hydrophilicDryScale", hydrophilicDryScale_); + coeffs_.readEntry("hydrophilicWetScale", hydrophilicWetScale_); } if (readFields) diff --git a/src/regionModels/thermalBaffleModels/thermalBaffle/thermalBaffle.C b/src/regionModels/thermalBaffleModels/thermalBaffle/thermalBaffle.C index 9e75ffaeab7310b5f125145539ca4c0e856e624a..75ec4d10863c4393dc2c18aabef7738ef81dc1e5 100644 --- a/src/regionModels/thermalBaffleModels/thermalBaffle/thermalBaffle.C +++ b/src/regionModels/thermalBaffleModels/thermalBaffle/thermalBaffle.C @@ -52,14 +52,14 @@ addToRunTimeSelectionTable(thermalBaffleModel, thermalBaffle, dictionary); bool thermalBaffle::read() { - this->solution().lookup("nNonOrthCorr") >> nNonOrthCorr_; + this->solution().readEntry("nNonOrthCorr", nNonOrthCorr_); return regionModel1D::read(); } bool thermalBaffle::read(const dictionary& dict) { - this->solution().lookup("nNonOrthCorr") >> nNonOrthCorr_; + this->solution().readEntry("nNonOrthCorr", nNonOrthCorr_); return regionModel1D::read(dict); } diff --git a/src/rigidBodyDynamics/restraints/linearAxialAngularSpring/linearAxialAngularSpring.C b/src/rigidBodyDynamics/restraints/linearAxialAngularSpring/linearAxialAngularSpring.C index 277de2ecf98668cf372d53750a5b3275a13a87f7..9bcd058092f9c09e6a0122fb43a4fdd570e25492 100644 --- a/src/rigidBodyDynamics/restraints/linearAxialAngularSpring/linearAxialAngularSpring.C +++ b/src/rigidBodyDynamics/restraints/linearAxialAngularSpring/linearAxialAngularSpring.C @@ -170,8 +170,8 @@ bool Foam::RBD::restraints::linearAxialAngularSpring::read << abort(FatalError); } - coeffs_.lookup("stiffness") >> stiffness_; - coeffs_.lookup("damping") >> damping_; + coeffs_.readEntry("stiffness", stiffness_); + coeffs_.readEntry("damping", damping_); return true; } diff --git a/src/rigidBodyDynamics/restraints/linearDamper/linearDamper.C b/src/rigidBodyDynamics/restraints/linearDamper/linearDamper.C index e397a87ee5f8dd37fb5e84b3cd74b635d5828495..11f9959a0a700aae8d1ebb80739bac3d796dc6df 100644 --- a/src/rigidBodyDynamics/restraints/linearDamper/linearDamper.C +++ b/src/rigidBodyDynamics/restraints/linearDamper/linearDamper.C @@ -96,7 +96,7 @@ bool Foam::RBD::restraints::linearDamper::read { restraint::read(dict); - coeffs_.lookup("coeff") >> coeff_; + coeffs_.readEntry("coeff", coeff_); return true; } diff --git a/src/rigidBodyDynamics/restraints/linearSpring/linearSpring.C b/src/rigidBodyDynamics/restraints/linearSpring/linearSpring.C index 189a7e9a9b40b134a28136cc9e2ec2b0f328ffac..60ba4a71e44f23eefc60fa036dcbc0c1afecc414 100644 --- a/src/rigidBodyDynamics/restraints/linearSpring/linearSpring.C +++ b/src/rigidBodyDynamics/restraints/linearSpring/linearSpring.C @@ -117,11 +117,11 @@ bool Foam::RBD::restraints::linearSpring::read { restraint::read(dict); - coeffs_.lookup("anchor") >> anchor_; - coeffs_.lookup("refAttachmentPt") >> refAttachmentPt_; - coeffs_.lookup("stiffness") >> stiffness_; - coeffs_.lookup("damping") >> damping_; - coeffs_.lookup("restLength") >> restLength_; + coeffs_.readEntry("anchor", anchor_); + coeffs_.readEntry("refAttachmentPt", refAttachmentPt_); + coeffs_.readEntry("stiffness", stiffness_); + coeffs_.readEntry("damping", damping_); + coeffs_.readEntry("restLength", restLength_); return true; } diff --git a/src/rigidBodyDynamics/restraints/sphericalAngularDamper/sphericalAngularDamper.C b/src/rigidBodyDynamics/restraints/sphericalAngularDamper/sphericalAngularDamper.C index 44806465a3d90e410dfad2b727ae03c5350ef3d7..672767b3329e2162ad30e54dc83832ce807f78d3 100644 --- a/src/rigidBodyDynamics/restraints/sphericalAngularDamper/sphericalAngularDamper.C +++ b/src/rigidBodyDynamics/restraints/sphericalAngularDamper/sphericalAngularDamper.C @@ -96,7 +96,7 @@ bool Foam::RBD::restraints::sphericalAngularDamper::read { restraint::read(dict); - coeffs_.lookup("coeff") >> coeff_; + coeffs_.readEntry("coeff", coeff_); return true; } diff --git a/src/rigidBodyDynamics/rigidBodyMotion/rigidBodyMotion.C b/src/rigidBodyDynamics/rigidBodyMotion/rigidBodyMotion.C index de24982df7a395c256c1f53478afb0bd64792a92..0e1f144685d518f620eb131fa92c2330487e8eb5 100644 --- a/src/rigidBodyDynamics/rigidBodyMotion/rigidBodyMotion.C +++ b/src/rigidBodyDynamics/rigidBodyMotion/rigidBodyMotion.C @@ -70,7 +70,7 @@ Foam::RBD::rigidBodyMotion::rigidBodyMotion { if (dict.found("g")) { - g() = vector(dict.lookup("g")); + g() = dict.get<vector>("g"); } initialize(); @@ -95,7 +95,7 @@ Foam::RBD::rigidBodyMotion::rigidBodyMotion { if (dict.found("g")) { - g() = vector(dict.lookup("g")); + g() = dict.get<vector>("g"); } initialize(); diff --git a/src/rigidBodyMeshMotion/rigidBodyMeshMotion/rigidBodyMeshMotion.C b/src/rigidBodyMeshMotion/rigidBodyMeshMotion/rigidBodyMeshMotion.C index d69537ff5e7c087a7f6661a6d463969c628fab65..e46c901565afef6f99a56d7a0ca436ecd59463a9 100644 --- a/src/rigidBodyMeshMotion/rigidBodyMeshMotion/rigidBodyMeshMotion.C +++ b/src/rigidBodyMeshMotion/rigidBodyMeshMotion/rigidBodyMeshMotion.C @@ -122,7 +122,7 @@ Foam::rigidBodyMeshMotion::rigidBodyMeshMotion { if (rhoName_ == "rhoInf") { - rhoInf_ = readScalar(coeffDict().lookup("rhoInf")); + readEntry("rhoInf", rhoInf_); } if (coeffDict().found("ramp")) diff --git a/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/constraints/axis/sixDoFRigidBodyMotionAxisConstraint.C b/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/constraints/axis/sixDoFRigidBodyMotionAxisConstraint.C index 0650986bfd2c0de4d8035a11b833b1dc058f6051..81e61fcd5388b6c93464dd5b6b61d565954eea31 100644 --- a/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/constraints/axis/sixDoFRigidBodyMotionAxisConstraint.C +++ b/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/constraints/axis/sixDoFRigidBodyMotionAxisConstraint.C @@ -92,7 +92,7 @@ bool Foam::sixDoFRigidBodyMotionConstraints::axis::read { sixDoFRigidBodyMotionConstraint::read(sDoFRBMCDict); - sDoFRBMCCoeffs_.lookup("axis") >> axis_; + sDoFRBMCCoeffs_.readEntry("axis", axis_); scalar magFixedAxis(mag(axis_)); diff --git a/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/constraints/line/sixDoFRigidBodyMotionLineConstraint.C b/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/constraints/line/sixDoFRigidBodyMotionLineConstraint.C index 6da64ea471bed7d6b636a6a408907f144934f12c..0cdbf4364aa682fdfbc9e3b6290995d2c15d4710 100644 --- a/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/constraints/line/sixDoFRigidBodyMotionLineConstraint.C +++ b/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/constraints/line/sixDoFRigidBodyMotionLineConstraint.C @@ -106,7 +106,7 @@ bool Foam::sixDoFRigidBodyMotionConstraints::line::read motion_.initialCentreOfMass() ); - sDoFRBMCCoeffs_.lookup("direction") >> direction_; + sDoFRBMCCoeffs_.readEntry("direction", direction_); scalar magDir(mag(direction_)); diff --git a/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/constraints/plane/sixDoFRigidBodyMotionPlaneConstraint.C b/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/constraints/plane/sixDoFRigidBodyMotionPlaneConstraint.C index 90190f2c63f9b36f48cdeef191a652d49b966234..389ba407d285f0fe6f8567b889bf1d9f1a5a28e9 100644 --- a/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/constraints/plane/sixDoFRigidBodyMotionPlaneConstraint.C +++ b/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/constraints/plane/sixDoFRigidBodyMotionPlaneConstraint.C @@ -106,7 +106,7 @@ bool Foam::sixDoFRigidBodyMotionConstraints::plane::read motion_.initialCentreOfMass() ); - sDoFRBMCCoeffs_.lookup("normal") >> normal_; + sDoFRBMCCoeffs_.readEntry("normal", normal_); return true; } diff --git a/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/restraints/linearAxialAngularSpring/linearAxialAngularSpring.C b/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/restraints/linearAxialAngularSpring/linearAxialAngularSpring.C index 8575a52e774d6a6f59681cb634561e65a02f8156..9e146fddff53aa143cdb8847c3e884e3ac8375f0 100644 --- a/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/restraints/linearAxialAngularSpring/linearAxialAngularSpring.C +++ b/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/restraints/linearAxialAngularSpring/linearAxialAngularSpring.C @@ -174,8 +174,8 @@ bool Foam::sixDoFRigidBodyMotionRestraints::linearAxialAngularSpring::read << abort(FatalError); } - sDoFRBMRCoeffs_.lookup("stiffness") >> stiffness_; - sDoFRBMRCoeffs_.lookup("damping") >> damping_; + sDoFRBMRCoeffs_.readEntry("stiffness", stiffness_); + sDoFRBMRCoeffs_.readEntry("damping", damping_); return true; } diff --git a/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/restraints/linearDamper/linearDamper.C b/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/restraints/linearDamper/linearDamper.C index 1e6d31ce8ea39bec9f5aa1ecc22a75bca5c99c92..e814a02a63eee305d7d17677d19e90400615f179 100644 --- a/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/restraints/linearDamper/linearDamper.C +++ b/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/restraints/linearDamper/linearDamper.C @@ -94,7 +94,7 @@ bool Foam::sixDoFRigidBodyMotionRestraints::linearDamper::read { sixDoFRigidBodyMotionRestraint::read(sDoFRBMRDict); - sDoFRBMRCoeffs_.lookup("coeff") >> coeff_; + sDoFRBMRCoeffs_.readEntry("coeff", coeff_); return true; } diff --git a/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/restraints/linearSpring/linearSpring.C b/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/restraints/linearSpring/linearSpring.C index c993c4d814354eede2c89af0e2abaab0a4ca3683..fdcac1592bc10a9fb8644cbe57bcc8de6f842bc6 100644 --- a/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/restraints/linearSpring/linearSpring.C +++ b/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/restraints/linearSpring/linearSpring.C @@ -110,11 +110,11 @@ bool Foam::sixDoFRigidBodyMotionRestraints::linearSpring::read { sixDoFRigidBodyMotionRestraint::read(sDoFRBMRDict); - sDoFRBMRCoeffs_.lookup("anchor") >> anchor_; - sDoFRBMRCoeffs_.lookup("refAttachmentPt") >> refAttachmentPt_; - sDoFRBMRCoeffs_.lookup("stiffness") >> stiffness_; - sDoFRBMRCoeffs_.lookup("damping") >> damping_; - sDoFRBMRCoeffs_.lookup("restLength") >> restLength_; + sDoFRBMRCoeffs_.readEntry("anchor", anchor_); + sDoFRBMRCoeffs_.readEntry("refAttachmentPt", refAttachmentPt_); + sDoFRBMRCoeffs_.readEntry("stiffness", stiffness_); + sDoFRBMRCoeffs_.readEntry("damping", damping_); + sDoFRBMRCoeffs_.readEntry("restLength", restLength_); return true; } diff --git a/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/restraints/sphericalAngularDamper/sphericalAngularDamper.C b/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/restraints/sphericalAngularDamper/sphericalAngularDamper.C index 27f890590a052a9cf0da809e78f8ca0f0d04e37a..0f99aa169567ed2d09825ab623593248bb2e9873 100644 --- a/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/restraints/sphericalAngularDamper/sphericalAngularDamper.C +++ b/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/restraints/sphericalAngularDamper/sphericalAngularDamper.C @@ -96,7 +96,7 @@ bool Foam::sixDoFRigidBodyMotionRestraints::sphericalAngularDamper::read { sixDoFRigidBodyMotionRestraint::read(sDoFRBMRDict); - sDoFRBMRCoeffs_.lookup("coeff") >> coeff_; + sDoFRBMRCoeffs_.readEntry("coeff", coeff_); return true; } diff --git a/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/restraints/sphericalAngularSpring/sphericalAngularSpring.C b/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/restraints/sphericalAngularSpring/sphericalAngularSpring.C index 35db712d8f4fa784de68dbbbbf53e7be121ab0a5..b797b7118ea0a8c05786c808d00371a43902cd2f 100644 --- a/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/restraints/sphericalAngularSpring/sphericalAngularSpring.C +++ b/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/restraints/sphericalAngularSpring/sphericalAngularSpring.C @@ -133,8 +133,8 @@ bool Foam::sixDoFRigidBodyMotionRestraints::sphericalAngularSpring::read << exit(FatalError); } - sDoFRBMRCoeffs_.lookup("stiffness") >> stiffness_; - sDoFRBMRCoeffs_.lookup("damping") >> damping_; + sDoFRBMRCoeffs_.readEntry("stiffness", stiffness_); + sDoFRBMRCoeffs_.readEntry("damping", damping_); return true; } diff --git a/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/restraints/tabulatedAxialAngularSpring/tabulatedAxialAngularSpring.C b/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/restraints/tabulatedAxialAngularSpring/tabulatedAxialAngularSpring.C index 601184e0a5d729f0c0bc76be22c43164ace28d68..f19bc98f060356e946eafdbde429e895fe4e10af 100644 --- a/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/restraints/tabulatedAxialAngularSpring/tabulatedAxialAngularSpring.C +++ b/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/restraints/tabulatedAxialAngularSpring/tabulatedAxialAngularSpring.C @@ -194,7 +194,7 @@ bool Foam::sixDoFRigidBodyMotionRestraints::tabulatedAxialAngularSpring::read << abort(FatalError); } - sDoFRBMRCoeffs_.lookup("damping") >> damping_; + sDoFRBMRCoeffs_.readEntry("damping", damping_); return true; } diff --git a/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionIO.C b/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionIO.C index 4b54e45b175b5a27f83e819663b85771bf006224..7c8bcc5d9341664b1806ff5185844a9b80ba6063 100644 --- a/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionIO.C +++ b/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionIO.C @@ -31,8 +31,8 @@ License bool Foam::sixDoFRigidBodyMotion::read(const dictionary& dict) { - dict.lookup("mass") >> mass_; - dict.lookup("momentOfInertia") >> momentOfInertia_; + dict.readEntry("mass", mass_); + dict.readEntry("momentOfInertia", momentOfInertia_); aRelax_ = dict.lookupOrDefault<scalar>("accelerationRelaxation", 1.0); aDamp_ = dict.lookupOrDefault<scalar>("accelerationDamping", 1.0); report_ = dict.lookupOrDefault<Switch>("report", false); diff --git a/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionSolver/sixDoFRigidBodyMotionSolver.C b/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionSolver/sixDoFRigidBodyMotionSolver.C index 76f65c6693c4b4d7a2cff0e0c13db9402857b53e..ef88a6c2225fefafe4ff36389eedb93dfa836485 100644 --- a/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionSolver/sixDoFRigidBodyMotionSolver.C +++ b/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionSolver/sixDoFRigidBodyMotionSolver.C @@ -193,9 +193,9 @@ void Foam::sixDoFRigidBodyMotionSolver::solve() { g = db().lookupObject<uniformDimensionedVectorField>("g"); } - else if (coeffDict().found("g")) + else { - coeffDict().lookup("g") >> g; + coeffDict().readIfPresent("g", g); } // const scalar ramp = min(max((this->db().time().value() - 5)/10, 0), 1); diff --git a/src/thermophysicalModels/barotropicCompressibilityModel/Chung/Chung.C b/src/thermophysicalModels/barotropicCompressibilityModel/Chung/Chung.C index 3c626b94ec414ec8fd7ca02741fde001bb1f2603..3864dd14e4f336d02a85480a12207c3897cebf27 100644 --- a/src/thermophysicalModels/barotropicCompressibilityModel/Chung/Chung.C +++ b/src/thermophysicalModels/barotropicCompressibilityModel/Chung/Chung.C @@ -109,10 +109,10 @@ bool Foam::compressibilityModels::Chung::read { barotropicCompressibilityModel::read(compressibilityProperties); - compressibilityProperties_.lookup("psiv") >> psiv_; - compressibilityProperties_.lookup("psil") >> psil_; - compressibilityProperties_.lookup("rhovSat") >> rhovSat_; - compressibilityProperties_.lookup("rholSat") >> rholSat_; + compressibilityProperties_.readEntry("psiv", psiv_); + compressibilityProperties_.readEntry("psil", psil_); + compressibilityProperties_.readEntry("rhovSat", rhovSat_); + compressibilityProperties_.readEntry("rholSat", rholSat_); return true; } diff --git a/src/thermophysicalModels/barotropicCompressibilityModel/Wallis/Wallis.C b/src/thermophysicalModels/barotropicCompressibilityModel/Wallis/Wallis.C index 4717c5b0a7d1cb1b52b8a7aa09230d343b3353ae..eb81370c435b62d040c9ae58b9543d88010f7b79 100644 --- a/src/thermophysicalModels/barotropicCompressibilityModel/Wallis/Wallis.C +++ b/src/thermophysicalModels/barotropicCompressibilityModel/Wallis/Wallis.C @@ -98,10 +98,10 @@ bool Foam::compressibilityModels::Wallis::read { barotropicCompressibilityModel::read(compressibilityProperties); - compressibilityProperties_.lookup("psiv") >> psiv_; - compressibilityProperties_.lookup("psil") >> psil_; - compressibilityProperties_.lookup("rhovSat") >> rhovSat_; - compressibilityProperties_.lookup("rholSat") >> rholSat_; + compressibilityProperties_.readEntry("psiv", psiv_); + compressibilityProperties_.readEntry("psil", psil_); + compressibilityProperties_.readEntry("rhovSat", rhovSat_); + compressibilityProperties_.readEntry("rholSat", rholSat_); return true; } diff --git a/src/thermophysicalModels/barotropicCompressibilityModel/linear/linear.C b/src/thermophysicalModels/barotropicCompressibilityModel/linear/linear.C index 6edaad6ebdc66dfdc4b312c3d56bc534fd9d24af..1ea3f47aacaf0d71905f8a28eaa5d3f4b58ab4c9 100644 --- a/src/thermophysicalModels/barotropicCompressibilityModel/linear/linear.C +++ b/src/thermophysicalModels/barotropicCompressibilityModel/linear/linear.C @@ -85,8 +85,8 @@ bool Foam::compressibilityModels::linear::read { barotropicCompressibilityModel::read(compressibilityProperties); - compressibilityProperties_.lookup("psiv") >> psiv_; - compressibilityProperties_.lookup("psil") >> psil_; + compressibilityProperties_.readEntry("psiv", psiv_); + compressibilityProperties_.readEntry("psil", psil_); return true; } diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/TDACChemistryModel/reduction/DRGEP/DRGEP.C b/src/thermophysicalModels/chemistryModel/chemistryModel/TDACChemistryModel/reduction/DRGEP/DRGEP.C index 202cead82f55b2fbfbeb7a43b45c778903f29787..8b4976db0c8501d5db9d28ab926a9c123fb9713c 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/TDACChemistryModel/reduction/DRGEP/DRGEP.C +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/TDACChemistryModel/reduction/DRGEP/DRGEP.C @@ -61,10 +61,7 @@ Foam::chemistryReductionMethods::DRGEP<CompType, ThermoType>::DRGEP << exit(FatalError); } - if (this->coeffsDict_.found("NGroupBased")) - { - NGroupBased_ = readLabel(this->coeffsDict_.lookup("NGroupBased")); - } + this->coeffsDict_.readIfPresent("NGroupBased", NGroupBased_); const List<List<specieElement>>& specieComposition = this->chemistry_.specieComp(); diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/TDACChemistryModel/reduction/EFA/EFA.C b/src/thermophysicalModels/chemistryModel/chemistryModel/TDACChemistryModel/reduction/EFA/EFA.C index d19711e0a8c8e9e141451c508789e12f678879dd..acd3e3fa7939513c4b63a69c18898a1dbc937b6f 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/TDACChemistryModel/reduction/EFA/EFA.C +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/TDACChemistryModel/reduction/EFA/EFA.C @@ -75,10 +75,8 @@ Foam::chemistryReductionMethods::EFA<CompType, ThermoType>::EFA } } } - if (this->coeffsDict_.found("sortPart")) - { - sortPart_ = readScalar(this->coeffsDict_.lookup("sortPart")); - } + + this->coeffsDict_.readIfPresent("sortPart", sortPart_); } diff --git a/src/thermophysicalModels/radiation/radiationModels/fvDOM/absorptionCoeffs/absorptionCoeffs.C b/src/thermophysicalModels/radiation/radiationModels/fvDOM/absorptionCoeffs/absorptionCoeffs.C index 3edf6b2c7a841e4b3e8b5e73f8dbdd4f24be17e5..04e5cf7618ee3fb08550e770594786001e71854c 100644 --- a/src/thermophysicalModels/radiation/radiationModels/fvDOM/absorptionCoeffs/absorptionCoeffs.C +++ b/src/thermophysicalModels/radiation/radiationModels/fvDOM/absorptionCoeffs/absorptionCoeffs.C @@ -67,12 +67,12 @@ Foam::radiation::absorptionCoeffs::coeffs void Foam::radiation::absorptionCoeffs::initialise(const dictionary& dict) { - dict.lookup("Tcommon") >> Tcommon_; - dict.lookup("Tlow") >> Tlow_; - dict.lookup("Thigh") >> Thigh_; - dict.lookup("invTemp") >> invTemp_; - dict.lookup("loTcoeffs") >> lowACoeffs_; - dict.lookup("hiTcoeffs") >> highACoeffs_; + dict.readEntry("Tcommon", Tcommon_); + dict.readEntry("Tlow", Tlow_); + dict.readEntry("Thigh", Thigh_); + dict.readEntry("invTemp", invTemp_); + dict.readEntry("loTcoeffs", lowACoeffs_); + dict.readEntry("hiTcoeffs", highACoeffs_); } diff --git a/src/thermophysicalModels/radiation/radiationModels/fvDOM/fvDOM/fvDOM.C b/src/thermophysicalModels/radiation/radiationModels/fvDOM/fvDOM/fvDOM.C index af7b79b5d149682a7d25ff6fae7d69e85087d9e8..e587e3f94fdce6b10a4c72ccacf4b272bc2c4f41 100644 --- a/src/thermophysicalModels/radiation/radiationModels/fvDOM/fvDOM/fvDOM.C +++ b/src/thermophysicalModels/radiation/radiationModels/fvDOM/fvDOM/fvDOM.C @@ -186,10 +186,7 @@ void Foam::radiation::fvDOM::initialise() Info<< endl; - if (this->found("useSolarLoad")) - { - this->lookup("useSolarLoad") >> useSolarLoad_; - } + this->readIfPresent("useSolarLoad", useSolarLoad_); if (useSolarLoad_) { diff --git a/src/thermophysicalModels/radiation/radiationModels/radiationModel/radiationModel.C b/src/thermophysicalModels/radiation/radiationModels/radiationModel/radiationModel.C index 17255386ba371e541f6fcab8d385e9cc84984167..31e3c478e8316a6f7991fff91048fd4c9fb8895a 100644 --- a/src/thermophysicalModels/radiation/radiationModels/radiationModel/radiationModel.C +++ b/src/thermophysicalModels/radiation/radiationModels/radiationModel/radiationModel.C @@ -198,7 +198,7 @@ bool Foam::radiation::radiationModel::read() { if (regIOobject::read()) { - lookup("radiation") >> radiation_; + readEntry("radiation", radiation_); coeffs_ = subOrEmptyDict(type() + "Coeffs"); solverFreq_ = lookupOrDefault<label>("solverFreq", 1); @@ -206,10 +206,8 @@ bool Foam::radiation::radiationModel::read() return true; } - else - { - return false; - } + + return false; } diff --git a/src/thermophysicalModels/radiation/radiationModels/radiationModel/radiationModelNew.C b/src/thermophysicalModels/radiation/radiationModels/radiationModel/radiationModelNew.C index 5aec71b774f853a9ea875c8301bccfe6602a8131..9f023aba899cce727d48b91365ee2906332073bf 100644 --- a/src/thermophysicalModels/radiation/radiationModels/radiationModel/radiationModelNew.C +++ b/src/thermophysicalModels/radiation/radiationModels/radiationModel/radiationModelNew.C @@ -47,7 +47,7 @@ Foam::radiation::radiationModel::New word modelType("none"); if (radIO.typeHeaderOk<IOdictionary>(true)) { - IOdictionary(radIO).lookup("radiationModel") >> modelType; + IOdictionary(radIO).readEntry("radiationModel", modelType); } else { diff --git a/src/thermophysicalModels/radiation/radiationModels/solarLoad/solarLoad.C b/src/thermophysicalModels/radiation/radiationModels/solarLoad/solarLoad.C index 973482e8ddb603ffd7a577b11cc80b01d11b3943..bec15a012a65b69bb091492586fa0f8af6246e58 100644 --- a/src/thermophysicalModels/radiation/radiationModels/solarLoad/solarLoad.C +++ b/src/thermophysicalModels/radiation/radiationModels/solarLoad/solarLoad.C @@ -307,9 +307,9 @@ void Foam::radiation::solarLoad::initialise(const dictionary& coeffs) includePatches_ = mesh_.boundaryMesh().indices(viewFactorWalls); - coeffs.lookup("useVFbeamToDiffuse") >> useVFbeamToDiffuse_; + coeffs.readEntry("useVFbeamToDiffuse", useVFbeamToDiffuse_); - coeffs.lookup("spectralDistribution") >> spectralDistribution_; + coeffs.readEntry("spectralDistribution", spectralDistribution_); spectralDistribution_ = spectralDistribution_/sum(spectralDistribution_); diff --git a/src/thermophysicalModels/radiation/radiationModels/viewFactor/viewFactor.C b/src/thermophysicalModels/radiation/radiationModels/viewFactor/viewFactor.C index d3ed841a75e142c35836cc49d66893d17045ed2c..d9da6157ffac194f469bcc100962e8606e2489fe 100644 --- a/src/thermophysicalModels/radiation/radiationModels/viewFactor/viewFactor.C +++ b/src/thermophysicalModels/radiation/radiationModels/viewFactor/viewFactor.C @@ -192,10 +192,7 @@ void Foam::radiation::viewFactor::initialise() } } - if (this->found("useSolarLoad")) - { - this->lookup("useSolarLoad") >> useSolarLoad_; - } + this->readIfPresent("useSolarLoad", useSolarLoad_); if (useSolarLoad_) { diff --git a/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/greyMeanSolidAbsorptionEmission/greyMeanSolidAbsorptionEmission.C b/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/greyMeanSolidAbsorptionEmission/greyMeanSolidAbsorptionEmission.C index 7317d02a213fe8cf3e32e096f6905953e5ba198d..ffc8c9a5a8cd923b2cea427fb61de24f553ab447 100644 --- a/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/greyMeanSolidAbsorptionEmission/greyMeanSolidAbsorptionEmission.C +++ b/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/greyMeanSolidAbsorptionEmission/greyMeanSolidAbsorptionEmission.C @@ -123,8 +123,8 @@ greyMeanSolidAbsorptionEmission } speciesNames_.insert(key, nFunc); const dictionary& dict = iter().dict(); - dict.lookup("absorptivity") >> solidData_[nFunc][absorptivity]; - dict.lookup("emissivity") >> solidData_[nFunc][emissivity]; + dict.readEntry("absorptivity", solidData_[nFunc][absorptivity]); + dict.readEntry("emissivity", solidData_[nFunc][emissivity]); nFunc++; } diff --git a/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/multiBandSolidAbsorptionEmission/multiBandSolidAbsorptionEmission.C b/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/multiBandSolidAbsorptionEmission/multiBandSolidAbsorptionEmission.C index bb713ec3162d632095b4d83fc855b1ff80cdb504..e989bb2795ca99a2ee0cbcddb92a8845bc66a297 100644 --- a/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/multiBandSolidAbsorptionEmission/multiBandSolidAbsorptionEmission.C +++ b/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/multiBandSolidAbsorptionEmission/multiBandSolidAbsorptionEmission.C @@ -59,8 +59,8 @@ multiBandSolidAbsorptionEmission emiCoeffs_(maxBands_), nBands_(0) { - coeffsDict_.lookup("absorptivity") >> absCoeffs_; - coeffsDict_.lookup("emissivity") >> emiCoeffs_; + coeffsDict_.readEntry("absorptivity", absCoeffs_); + coeffsDict_.readEntry("emissivity", emiCoeffs_); nBands_ = absCoeffs_.size(); } diff --git a/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/wideBandAbsorptionEmission/wideBandAbsorptionEmission.C b/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/wideBandAbsorptionEmission/wideBandAbsorptionEmission.C index cbb35e3a9993d2dfc4353d8b3dfd7ebad8ab1204..1d7dfddf787f674fb5e4ec7d75ac1923802753f9 100644 --- a/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/wideBandAbsorptionEmission/wideBandAbsorptionEmission.C +++ b/src/thermophysicalModels/radiation/submodels/absorptionEmissionModel/wideBandAbsorptionEmission/wideBandAbsorptionEmission.C @@ -74,8 +74,8 @@ Foam::radiation::wideBandAbsorptionEmission::wideBandAbsorptionEmission } const dictionary& dict = iter().dict(); - dict.lookup("bandLimits") >> iBands_[nBand]; - dict.lookup("EhrrCoeff") >> iEhrrCoeffs_[nBand]; + dict.readEntry("bandLimits", iBands_[nBand]); + dict.readEntry("EhrrCoeff", iEhrrCoeffs_[nBand]); totalWaveLength_ += iBands_[nBand][1] - iBands_[nBand][0]; label nSpec = 0; diff --git a/src/thermophysicalModels/radiation/submodels/solarCalculator/solarCalculator.C b/src/thermophysicalModels/radiation/submodels/solarCalculator/solarCalculator.C index f95d517c188f42f99b7c20d8baa318b9127176f6..af4662addf901dce745c68e82c669078df066605 100644 --- a/src/thermophysicalModels/radiation/submodels/solarCalculator/solarCalculator.C +++ b/src/thermophysicalModels/radiation/submodels/solarCalculator/solarCalculator.C @@ -180,8 +180,11 @@ void Foam::solarCalculator::init() << " case is steady " << nl << exit(FatalError); } - dict_.lookup("sunTrackingUpdateInterval") >> - sunTrackingUpdateInterval_; + dict_.readEntry + ( + "sunTrackingUpdateInterval", + sunTrackingUpdateInterval_ + ); calculateBetaTetha(); calculateSunDirection(); @@ -193,8 +196,8 @@ void Foam::solarCalculator::init() { case mSunLoadConstant: { - dict_.lookup("directSolarRad") >> directSolarRad_; - dict_.lookup("diffuseSolarRad") >> diffuseSolarRad_; + dict_.readEntry("directSolarRad", directSolarRad_); + dict_.readEntry("diffuseSolarRad", diffuseSolarRad_); break; } case mSunLoadFairWeatherConditions: @@ -205,14 +208,10 @@ void Foam::solarCalculator::init() skyCloudCoverFraction_ ); - A_ = readScalar(dict_.lookup("A")); - B_ = readScalar(dict_.lookup("B")); + A_ = dict_.get<scalar>("A"); + B_ = dict_.get<scalar>("B"); - if (dict_.found("beta")) - { - dict_.lookup("beta") >> beta_; - } - else + if (!dict_.readIfPresent("beta",beta_)) { calculateBetaTetha(); } @@ -221,19 +220,16 @@ void Foam::solarCalculator::init() (1.0 - 0.75*pow(skyCloudCoverFraction_, 3.0)) * A_/exp(B_/sin(beta_)); - groundReflectivity_ = - readScalar(dict_.lookup("groundReflectivity")); - + dict_.readEntry("groundReflectivity", groundReflectivity_); break; } case mSunLoadTheoreticalMaximum: { - Setrn_ = readScalar(dict_.lookup("Setrn")); - SunPrime_ = readScalar(dict_.lookup("SunPrime")); + dict_.readEntry("Setrn", Setrn_); + dict_.readEntry("SunPrime", SunPrime_); directSolarRad_ = Setrn_*SunPrime_; - groundReflectivity_ = - readScalar(dict_.lookup("groundReflectivity")); + dict_.readEntry("groundReflectivity", groundReflectivity_); break; } } diff --git a/src/thermophysicalModels/radiation/submodels/sootModel/sootModel/sootModelNew.C b/src/thermophysicalModels/radiation/submodels/sootModel/sootModel/sootModelNew.C index a9af94a66f54589b52e6444e60b22bcb160148c0..9304ab7505fc472bba5e0ca732dc843767a532da 100644 --- a/src/thermophysicalModels/radiation/submodels/sootModel/sootModel/sootModelNew.C +++ b/src/thermophysicalModels/radiation/submodels/sootModel/sootModel/sootModelNew.C @@ -37,10 +37,8 @@ Foam::radiation::sootModel::New { word modelType("none"); - if (dict.found("sootModel")) + if (dict.readIfPresent("sootModel", modelType)) { - dict.lookup("sootModel") >> modelType; - Info<< "Selecting sootModel " << modelType << endl; } diff --git a/src/thermophysicalModels/radiation/submodels/transmissivityModel/multiBandSolidTransmissivity/multiBandSolidTransmissivity.C b/src/thermophysicalModels/radiation/submodels/transmissivityModel/multiBandSolidTransmissivity/multiBandSolidTransmissivity.C index 1db1944b91964f48147d6a4e7d88d4a1a85f5004..e1aaf73cf5361b6e25f733facb87bfadb49c9a5b 100644 --- a/src/thermophysicalModels/radiation/submodels/transmissivityModel/multiBandSolidTransmissivity/multiBandSolidTransmissivity.C +++ b/src/thermophysicalModels/radiation/submodels/transmissivityModel/multiBandSolidTransmissivity/multiBandSolidTransmissivity.C @@ -57,7 +57,7 @@ Foam::radiation::multiBandSolidTransmissivity::multiBandSolidTransmissivity tauCoeffs_(), nBands_(0) { - coeffsDict_.lookup("transmissivity") >> tauCoeffs_; + coeffsDict_.readEntry("transmissivity", tauCoeffs_); nBands_ = tauCoeffs_.size(); } diff --git a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.C b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.C index 0d030b585eff0bb48488b8122945f50c416622c4..afe555a764139dc440f896e92df75776e3b3685f 100644 --- a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.C +++ b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.C @@ -865,19 +865,15 @@ Foam::chemkinReader::chemkinReader Info<< "Reading CHEMKIN thermo data in new file format" << endl; } - fileName chemkinFile(fileName(thermoDict.lookup("CHEMKINFile")).expand()); + fileName chemkinFile(thermoDict.get<fileName>("CHEMKINFile")); + chemkinFile.expand(); fileName thermoFile = fileName::null; + thermoDict.readIfPresent("CHEMKINThermoFile", thermoFile); + thermoFile.expand(); - if (thermoDict.found("CHEMKINThermoFile")) - { - thermoFile = fileName(thermoDict.lookup("CHEMKINThermoFile")).expand(); - } - - fileName transportFile - ( - fileName(thermoDict.lookup("CHEMKINTransportFile")).expand() - ); + fileName transportFile(thermoDict.get<fileName>("CHEMKINTransportFile")); + transportFile.expand(); // allow relative file names fileName relPath = thermoDict.name().path(); diff --git a/src/thermophysicalModels/specie/reaction/reactionRate/thirdBodyEfficiencies/thirdBodyEfficienciesI.H b/src/thermophysicalModels/specie/reaction/reactionRate/thirdBodyEfficiencies/thirdBodyEfficienciesI.H index bcec76284b9a6918d12f8354a8ad4114ac7cf396..f2f87bccae3fafdd92ff6c5422c8367bcaa5de99 100644 --- a/src/thermophysicalModels/specie/reaction/reactionRate/thirdBodyEfficiencies/thirdBodyEfficienciesI.H +++ b/src/thermophysicalModels/specie/reaction/reactionRate/thirdBodyEfficiencies/thirdBodyEfficienciesI.H @@ -55,9 +55,9 @@ inline Foam::thirdBodyEfficiencies::thirdBodyEfficiencies scalarList(species.size()), species_(species) { - if (dict.found("coeffs")) + List<Tuple2<word, scalar>> coeffs; + if (dict.readIfPresent("coeffs", coeffs)) { - List<Tuple2<word, scalar>> coeffs(dict.lookup("coeffs")); if (coeffs.size() != species_.size()) { FatalErrorInFunction @@ -73,7 +73,7 @@ inline Foam::thirdBodyEfficiencies::thirdBodyEfficiencies } else { - scalar defaultEff = readScalar(dict.lookup("defaultEfficiency")); + scalar defaultEff = dict.get<scalar>("defaultEfficiency"); scalarList::operator=(defaultEff); } }