diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C b/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C index a6d98559a7..24ce0fe938 100644 --- a/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C +++ b/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C @@ -29,14 +29,9 @@ License #include "volFields.H" #include "mathematicalConstants.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField +Foam::smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField ( const fvPatch& p, const DimensionedField& iF @@ -52,7 +47,8 @@ smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField valueFraction() = 0.0; } -smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField + +Foam::smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField ( const smoluchowskiJumpTFvPatchScalarField& ptf, const fvPatch& p, @@ -67,7 +63,7 @@ smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField {} -smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField +Foam::smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField ( const fvPatch& p, const DimensionedField& iF, @@ -118,7 +114,7 @@ smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField } -smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField +Foam::smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField ( const smoluchowskiJumpTFvPatchScalarField& ptpsf, const DimensionedField& iF @@ -134,7 +130,7 @@ smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // Map from self -void smoluchowskiJumpTFvPatchScalarField::autoMap +void Foam::smoluchowskiJumpTFvPatchScalarField::autoMap ( const fvPatchFieldMapper& m ) @@ -144,7 +140,7 @@ void smoluchowskiJumpTFvPatchScalarField::autoMap // Reverse-map the given fvPatchField onto this fvPatchField -void smoluchowskiJumpTFvPatchScalarField::rmap +void Foam::smoluchowskiJumpTFvPatchScalarField::rmap ( const fvPatchField& ptf, const labelList& addr @@ -155,7 +151,7 @@ void smoluchowskiJumpTFvPatchScalarField::rmap // Update the coefficients associated with the patch field -void smoluchowskiJumpTFvPatchScalarField::updateCoeffs() +void Foam::smoluchowskiJumpTFvPatchScalarField::updateCoeffs() { if (updated()) { @@ -174,11 +170,16 @@ void smoluchowskiJumpTFvPatchScalarField::updateCoeffs() // Prandtl number reading consistent with rhoCentralFoam const dictionary& thermophysicalProperties = db().lookupObject("thermophysicalProperties"); - dimensionedScalar Pr = dimensionedScalar("Pr", dimless, 1.0); - if (thermophysicalProperties.found("Pr")) - { - Pr = thermophysicalProperties.lookup("Pr"); - } + + dimensionedScalar Pr + ( + dimensionedScalar::lookupOrDefault + ( + "Pr", + thermophysicalProperties, + 1.0 + ) + ); Field C2 = pmu/prho *sqrt(ppsi*constant::mathematical::piByTwo) @@ -197,7 +198,7 @@ void smoluchowskiJumpTFvPatchScalarField::updateCoeffs() // Write -void smoluchowskiJumpTFvPatchScalarField::write(Ostream& os) const +void Foam::smoluchowskiJumpTFvPatchScalarField::write(Ostream& os) const { fvPatchScalarField::write(os); os.writeKeyword("accommodationCoeff") @@ -211,10 +212,12 @@ void smoluchowskiJumpTFvPatchScalarField::write(Ostream& os) const // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +namespace Foam +{ + makePatchTypeField(fvPatchScalarField, smoluchowskiJumpTFvPatchScalarField); -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +} -} // End namespace Foam // ************************************************************************* // diff --git a/applications/solvers/compressible/rhoCentralFoam/readFluxScheme.H b/applications/solvers/compressible/rhoCentralFoam/readFluxScheme.H index 9f54c43ef3..13f8f02c9c 100644 --- a/applications/solvers/compressible/rhoCentralFoam/readFluxScheme.H +++ b/applications/solvers/compressible/rhoCentralFoam/readFluxScheme.H @@ -1,7 +1,6 @@ word fluxScheme("Kurganov"); -if (mesh.schemesDict().found("fluxScheme")) +if (mesh.schemesDict().readIfPresent("fluxScheme", fluxScheme)) { - fluxScheme = word(mesh.schemesDict().lookup("fluxScheme")); if ((fluxScheme == "Tadmor") || (fluxScheme == "Kurganov")) { Info<< "fluxScheme: " << fluxScheme << endl; diff --git a/applications/solvers/compressible/rhoCentralFoam/readThermophysicalProperties.H b/applications/solvers/compressible/rhoCentralFoam/readThermophysicalProperties.H index 5a63169d12..f9e309ffec 100644 --- a/applications/solvers/compressible/rhoCentralFoam/readThermophysicalProperties.H +++ b/applications/solvers/compressible/rhoCentralFoam/readThermophysicalProperties.H @@ -14,9 +14,13 @@ IOdictionary thermophysicalProperties ) ); -dimensionedScalar Pr = dimensionedScalar("Pr", dimless, 1.0); +dimensionedScalar Pr +( + dimensionedScalar::lookupOrDefault + ( + "Pr", + thermophysicalProperties, + 1.0 + ) +); -if (thermophysicalProperties.found("Pr")) -{ - Pr = thermophysicalProperties.lookup("Pr"); -} diff --git a/applications/solvers/compressible/rhoPorousSimpleFoam/createFields.H b/applications/solvers/compressible/rhoPorousSimpleFoam/createFields.H index 5285e6e3b2..efad823a91 100644 --- a/applications/solvers/compressible/rhoPorousSimpleFoam/createFields.H +++ b/applications/solvers/compressible/rhoPorousSimpleFoam/createFields.H @@ -70,22 +70,13 @@ dimensionedScalar initialMass = fvc::domainIntegrate(rho); thermalPorousZones pZones(mesh); - Switch pressureImplicitPorosity(false); + // nUCorrectors used for pressureImplicitPorosity int nUCorr = 0; - if (pZones.size()) - { - // nUCorrectors for pressureImplicitPorosity - if (mesh.solutionDict().subDict("SIMPLE").found("nUCorrectors")) - { - nUCorr = readInt - ( - mesh.solutionDict().subDict("SIMPLE").lookup("nUCorrectors") - ); - } + const bool pressureImplicitPorosity = + ( + pZones.size() + && mesh.solutionDict().subDict("SIMPLE").readIfPresent("nUCorrectors", nUCorr) + && (nUCorr > 0) + ); - if (nUCorr > 0) - { - pressureImplicitPorosity = true; - } - } diff --git a/applications/solvers/compressible/rhopSonicFoam/readThermodynamicProperties.H b/applications/solvers/compressible/rhopSonicFoam/readThermodynamicProperties.H index 2be7ce63ff..2064187a2f 100644 --- a/applications/solvers/compressible/rhopSonicFoam/readThermodynamicProperties.H +++ b/applications/solvers/compressible/rhopSonicFoam/readThermodynamicProperties.H @@ -26,8 +26,13 @@ dimensionedScalar gamma = Cp/Cv; - dimensionedScalar Pr = dimensionedScalar("Pr", dimless, 1.0); - if (thermodynamicProperties.found("Pr")) - { - Pr = thermodynamicProperties.lookup("Pr"); - } + dimensionedScalar Pr + ( + dimensionedScalar::lookupOrDefault + ( + "Pr", + thermodynamicProperties, + 1.0 + ) + ); + diff --git a/applications/solvers/electromagnetics/mhdFoam/readBPISOControls.H b/applications/solvers/electromagnetics/mhdFoam/readBPISOControls.H index 4363850cdf..5ddbdab95e 100644 --- a/applications/solvers/electromagnetics/mhdFoam/readBPISOControls.H +++ b/applications/solvers/electromagnetics/mhdFoam/readBPISOControls.H @@ -1,3 +1,4 @@ -const dictionary& Bpiso = mesh.solutionDict().subDict("BPISO"); + const dictionary& Bpiso = mesh.solutionDict().subDict("BPISO"); + + const int nBcorr = Bpiso.lookupOrDefault("nCorrectors", 1); -int nBcorr(readInt(Bpiso.lookup("nCorrectors"))); diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/readFluidMultiRegionSIMPLEControls.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/readFluidMultiRegionSIMPLEControls.H index 3054562d5d..f8a11b7159 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/readFluidMultiRegionSIMPLEControls.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/readFluidMultiRegionSIMPLEControls.H @@ -1,25 +1,11 @@ - dictionary simple = fluidRegions[i].solutionDict().subDict("SIMPLE"); + const dictionary& simple = fluidRegions[i].solutionDict().subDict("SIMPLE"); - int nNonOrthCorr = 0; - if (simple.found("nNonOrthogonalCorrectors")) - { - nNonOrthCorr = readInt(simple.lookup("nNonOrthogonalCorrectors")); - } + const int nNonOrthCorr = + simple.lookupOrDefault("nNonOrthogonalCorrectors", 0); - bool momentumPredictor = true; - if (simple.found("momentumPredictor")) - { - momentumPredictor = Switch(simple.lookup("momentumPredictor")); - } + const bool momentumPredictor = + simple.lookupOrDefault("momentumPredictor", true); - bool fluxGradp = false; - if (simple.found("fluxGradp")) - { - fluxGradp = Switch(simple.lookup("fluxGradp")); - } + const bool transonic = + simple.lookupOrDefault("transonic", false); - bool transonic = false; - if (simple.found("transonic")) - { - transonic = Switch(simple.lookup("transonic")); - } diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/solid/readSolidMultiRegionSIMPLEControls.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/solid/readSolidMultiRegionSIMPLEControls.H index 22e9b177f1..e1d58d9f65 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/solid/readSolidMultiRegionSIMPLEControls.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/solid/readSolidMultiRegionSIMPLEControls.H @@ -1,7 +1,5 @@ - dictionary simple = solidRegions[i].solutionDict().subDict("SIMPLE"); + const dictionary& simple = solidRegions[i].solutionDict().subDict("SIMPLE"); + + const int nNonOrthCorr = + simple.lookupOrDefault("nNonOrthogonalCorrectors", 0); - int nNonOrthCorr = 0; - if (simple.found("nNonOrthogonalCorrectors")) - { - nNonOrthCorr = readInt(simple.lookup("nNonOrthogonalCorrectors")); - } diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/readFluidMultiRegionPIMPLEControls.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/readFluidMultiRegionPIMPLEControls.H index 413c0225f0..71e49a33a8 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/readFluidMultiRegionPIMPLEControls.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/readFluidMultiRegionPIMPLEControls.H @@ -1,9 +1,11 @@ const dictionary& pimple = mesh.solutionDict().subDict("PIMPLE"); - int nCorr(readInt(pimple.lookup("nCorrectors"))); + const int nCorr = + pimple.lookupOrDefault("nCorrectors", 1); - int nNonOrthCorr = + const int nNonOrthCorr = pimple.lookupOrDefault("nNonOrthogonalCorrectors", 0); - bool momentumPredictor = - pimple.lookupOrDefault("momentumPredictor", true); + const bool momentumPredictor = + pimple.lookupOrDefault("momentumPredictor", true); + diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/readFluidMultiRegionPISOControls.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/readFluidMultiRegionPISOControls.H index 75d6d96d11..1f8cdb82a3 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/readFluidMultiRegionPISOControls.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/readFluidMultiRegionPISOControls.H @@ -1,27 +1,17 @@ - dictionary piso = fluidRegions[i].solutionDict().subDict("PISO"); + const dictionary& piso = fluidRegions[i].solutionDict().subDict("PISO"); - int nCorr(readInt(piso.lookup("nCorrectors"))); + const int nOuterCorr = + piso.lookupOrDefault("nOuterCorrectors", 1); - int nNonOrthCorr = 0; - if (piso.found("nNonOrthogonalCorrectors")) - { - nNonOrthCorr = readInt(piso.lookup("nNonOrthogonalCorrectors")); - } + const int nCorr = + piso.lookupOrDefault("nCorrectors", 1); - bool momentumPredictor = true; - if (piso.found("momentumPredictor")) - { - momentumPredictor = Switch(piso.lookup("momentumPredictor")); - } + const int nNonOrthCorr = + piso.lookupOrDefault("nNonOrthogonalCorrectors", 0); - bool transonic = false; - if (piso.found("transonic")) - { - transonic = Switch(piso.lookup("transonic")); - } + const bool momentumPredictor = + piso.lookupOrDefault("momentumPredictor", true); + + const bool transonic = + piso.lookupOrDefault("transonic", false); - int nOuterCorr = 1; - if (piso.found("nOuterCorrectors")) - { - nOuterCorr = readInt(piso.lookup("nOuterCorrectors")); - } diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/readPIMPLEControls.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/readPIMPLEControls.H index 42793d9b9f..f6371c47cb 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/readPIMPLEControls.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/readPIMPLEControls.H @@ -4,4 +4,6 @@ const dictionary& pimple = solutionDict.subDict("PIMPLE"); - int nOuterCorr(readInt(pimple.lookup("nOuterCorrectors"))); + const int nOuterCorr = + pimple.lookupOrDefault("nOuterCorrectors", 1); + diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/readSolidMultiRegionPISOControls.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/readSolidMultiRegionPISOControls.H index ce6a1c5bb2..0c965a8322 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/readSolidMultiRegionPISOControls.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/readSolidMultiRegionPISOControls.H @@ -1,7 +1,5 @@ const dictionary& piso = solidRegions[i].solutionDict().subDict("PISO"); - int nNonOrthCorr = 0; - if (piso.found("nNonOrthogonalCorrectors")) - { - nNonOrthCorr = readInt(piso.lookup("nNonOrthogonalCorrectors")); - } + const int nNonOrthCorr = + piso.lookupOrDefault("nNonOrthogonalCorrectors", 0); + diff --git a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/readControls.H b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/readControls.H index ef396ec9ff..8789bd0ab4 100644 --- a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/readControls.H +++ b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/readControls.H @@ -1,14 +1,9 @@ #include "readTimeControls.H" #include "readPIMPLEControls.H" - bool correctPhi = false; - if (pimple.found("correctPhi")) - { - correctPhi = Switch(pimple.lookup("correctPhi")); - } + const bool correctPhi = + pimple.lookupOrDefault("correctPhi", false); + + const bool checkMeshCourantNo = + pimple.lookupOrDefault("checkMeshCourantNo", false); - bool checkMeshCourantNo = false; - if (pimple.found("checkMeshCourantNo")) - { - checkMeshCourantNo = Switch(pimple.lookup("checkMeshCourantNo")); - } diff --git a/applications/solvers/incompressible/porousSimpleFoam/createFields.H b/applications/solvers/incompressible/porousSimpleFoam/createFields.H index 6861ae0005..7ce03c1967 100644 --- a/applications/solvers/incompressible/porousSimpleFoam/createFields.H +++ b/applications/solvers/incompressible/porousSimpleFoam/createFields.H @@ -43,22 +43,13 @@ porousZones pZones(mesh); - Switch pressureImplicitPorosity(false); + // nUCorrectors used for pressureImplicitPorosity int nUCorr = 0; - if (pZones.size()) - { - // nUCorrectors for pressureImplicitPorosity - if (mesh.solutionDict().subDict("SIMPLE").found("nUCorrectors")) - { - nUCorr = readInt - ( - mesh.solutionDict().subDict("SIMPLE").lookup("nUCorrectors") - ); - } + const bool pressureImplicitPorosity = + ( + pZones.size() + && mesh.solutionDict().subDict("SIMPLE").readIfPresent("nUCorrectors", nUCorr) + && (nUCorr > 0) + ); - if (nUCorr > 0) - { - pressureImplicitPorosity = true; - } - } diff --git a/applications/solvers/multiphase/bubbleFoam/createRASTurbulence.H b/applications/solvers/multiphase/bubbleFoam/createRASTurbulence.H index 015cfbb837..049b6c0b36 100644 --- a/applications/solvers/multiphase/bubbleFoam/createRASTurbulence.H +++ b/applications/solvers/multiphase/bubbleFoam/createRASTurbulence.H @@ -96,7 +96,7 @@ ) ); - if (RASProperties.lookupOrDefault("printCoeffs", false)) + if (RASProperties.lookupOrDefault("printCoeffs", false)) { Info<< "kEpsilonCoeffs" << kEpsilonDict << nl << "wallFunctionCoeffs" << wallFunctionDict << endl; diff --git a/applications/solvers/multiphase/compressibleInterDyMFoam/readControls.H b/applications/solvers/multiphase/compressibleInterDyMFoam/readControls.H index a2e4ef3747..a5a2a183e5 100644 --- a/applications/solvers/multiphase/compressibleInterDyMFoam/readControls.H +++ b/applications/solvers/multiphase/compressibleInterDyMFoam/readControls.H @@ -1,5 +1,5 @@ - #include "readPISOControls.H" - #include "readTimeControls.H" + #include "readPISOControls.H" + #include "readTimeControls.H" label nAlphaCorr ( @@ -19,14 +19,9 @@ << exit(FatalError); } - bool correctPhi = true; - if (piso.found("correctPhi")) - { - correctPhi = Switch(piso.lookup("correctPhi")); - } + const bool correctPhi = + piso.lookupOrDefault("correctPhi", true); + + const bool checkMeshCourantNo = + piso.lookupOrDefault("checkMeshCourantNo", false); - bool checkMeshCourantNo = false; - if (piso.found("checkMeshCourantNo")) - { - checkMeshCourantNo = Switch(piso.lookup("checkMeshCourantNo")); - } diff --git a/applications/solvers/multiphase/interDyMFoam/readControls.H b/applications/solvers/multiphase/interDyMFoam/readControls.H index 3640d73adc..10b09bf8ff 100644 --- a/applications/solvers/multiphase/interDyMFoam/readControls.H +++ b/applications/solvers/multiphase/interDyMFoam/readControls.H @@ -1,14 +1,9 @@ # include "readTimeControls.H" # include "readPISOControls.H" - bool correctPhi = true; - if (piso.found("correctPhi")) - { - correctPhi = Switch(piso.lookup("correctPhi")); - } + const bool correctPhi = + piso.lookupOrDefault("correctPhi", true); + + const bool checkMeshCourantNo = + piso.lookupOrDefault("checkMeshCourantNo", false); - bool checkMeshCourantNo = false; - if (piso.found("checkMeshCourantNo")) - { - checkMeshCourantNo = Switch(piso.lookup("checkMeshCourantNo")); - } diff --git a/applications/solvers/multiphase/settlingFoam/createFields.H b/applications/solvers/multiphase/settlingFoam/createFields.H index 75d19c6779..a2a5707b9e 100644 --- a/applications/solvers/multiphase/settlingFoam/createFields.H +++ b/applications/solvers/multiphase/settlingFoam/createFields.H @@ -276,7 +276,7 @@ ) ); - if (RASProperties.lookupOrDefault("printCoeffs", false)) + if (RASProperties.lookupOrDefault("printCoeffs", false)) { Info<< "kEpsilonCoeffs" << kEpsilonDict << nl << "wallFunctionCoeffs" << wallFunctionDict << endl; diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/createFields.H b/applications/solvers/multiphase/twoPhaseEulerFoam/createFields.H index 308a1089fb..65761d9ec9 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/createFields.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/createFields.H @@ -175,10 +175,8 @@ ); word dragPhase("blended"); - if (interfacialProperties.found("dragPhase")) + if (interfacialProperties.readIfPresent("dragPhase", dragPhase)) { - dragPhase = word(interfacialProperties.lookup("dragPhase")); - bool validDrag = dragPhase == "a" || dragPhase == "b" || dragPhase == "blended"; diff --git a/applications/solvers/stressAnalysis/solidDisplacementFoam/readSolidDisplacementFoamControls.H b/applications/solvers/stressAnalysis/solidDisplacementFoam/readSolidDisplacementFoamControls.H index 343b7bcaed..8b59cc497e 100644 --- a/applications/solvers/stressAnalysis/solidDisplacementFoam/readSolidDisplacementFoamControls.H +++ b/applications/solvers/stressAnalysis/solidDisplacementFoam/readSolidDisplacementFoamControls.H @@ -1,5 +1,6 @@ const dictionary& stressControl = mesh.solutionDict().subDict("stressAnalysis"); -int nCorr(readInt(stressControl.lookup("nCorrectors"))); +const int nCorr = stressControl.lookupOrDefault("nCorrectors", 1); + scalar convergenceTolerance(readScalar(stressControl.lookup("D"))); Switch compactNormalStress(stressControl.lookup("compactNormalStress")); diff --git a/applications/test/Hashing/hashingTests b/applications/test/Hashing/hashingTests index 162854bbef..2ccc793e74 100644 --- a/applications/test/Hashing/hashingTests +++ b/applications/test/Hashing/hashingTests @@ -1,10 +1,10 @@ -/*-------------------------------*- C++ -*---------------------------------*\ -| ========= | -| \\ / OpenFOAM | -| \\ / | -| \\ / The Open Source CFD Toolbox | -| \\/ http://www.OpenFOAM.org | -\*-------------------------------------------------------------------------*/ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/test/dictionary/testDictRegex b/applications/test/dictionary/testDictRegex index 01d4274ba8..e1833efb3f 100644 --- a/applications/test/dictionary/testDictRegex +++ b/applications/test/dictionary/testDictRegex @@ -1,10 +1,10 @@ -/*-------------------------------*- C++ -*---------------------------------*\ -| ========= | -| \\ / OpenFOAM | -| \\ / | -| \\ / The Open Source CFD Toolbox | -| \\/ http://www.OpenFOAM.org | -\*-------------------------------------------------------------------------*/ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ FoamFile { version 2.0; diff --git a/applications/test/regex/testRegexps b/applications/test/regex/testRegexps index 72287eea43..fca98249c6 100644 --- a/applications/test/regex/testRegexps +++ b/applications/test/regex/testRegexps @@ -1,10 +1,10 @@ -/*-------------------------------*- C++ -*---------------------------------*\ -| ========= | -| \\ / OpenFOAM | -| \\ / | -| \\ / The Open Source CFD Toolbox | -| \\/ http://www.OpenFOAM.org | -\*-------------------------------------------------------------------------*/ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/test/router/routerDict b/applications/test/router/routerDict index b21e5544fe..310c2653e3 100644 --- a/applications/test/router/routerDict +++ b/applications/test/router/routerDict @@ -2,7 +2,7 @@ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 1.6 | -| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile diff --git a/applications/test/spline/test-splines b/applications/test/spline/test-splines index 63f7bd17dd..05ab2185cd 100644 --- a/applications/test/spline/test-splines +++ b/applications/test/spline/test-splines @@ -2,7 +2,7 @@ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 1.6 | -| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ ( diff --git a/applications/test/wordRe/testRegexps b/applications/test/wordRe/testRegexps index c18cac8028..0eefa0f781 100644 --- a/applications/test/wordRe/testRegexps +++ b/applications/test/wordRe/testRegexps @@ -1,10 +1,10 @@ -/*-------------------------------*- C++ -*---------------------------------*\ -| ========= | -| \\ / OpenFOAM | -| \\ / | -| \\ / The Open Source CFD Toolbox | -| \\/ http://www.OpenFOAM.org | -\*-------------------------------------------------------------------------*/ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/utilities/mesh/advanced/autoRefineMesh/autoRefineMeshDict b/applications/utilities/mesh/advanced/autoRefineMesh/autoRefineMeshDict index 9c57e17dbf..334ea8cd30 100644 --- a/applications/utilities/mesh/advanced/autoRefineMesh/autoRefineMeshDict +++ b/applications/utilities/mesh/advanced/autoRefineMesh/autoRefineMeshDict @@ -2,7 +2,7 @@ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 1.6 | -| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile diff --git a/applications/utilities/mesh/advanced/modifyMesh/modifyMeshDict b/applications/utilities/mesh/advanced/modifyMesh/modifyMeshDict index f2cf261692..b656cbffca 100644 --- a/applications/utilities/mesh/advanced/modifyMesh/modifyMeshDict +++ b/applications/utilities/mesh/advanced/modifyMesh/modifyMeshDict @@ -2,7 +2,7 @@ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 1.6 | -| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile diff --git a/applications/utilities/mesh/advanced/selectCells/selectCellsDict b/applications/utilities/mesh/advanced/selectCells/selectCellsDict index 87f91eafb4..10b73f34b5 100644 --- a/applications/utilities/mesh/advanced/selectCells/selectCellsDict +++ b/applications/utilities/mesh/advanced/selectCells/selectCellsDict @@ -2,7 +2,7 @@ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 1.6 | -| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile diff --git a/applications/utilities/mesh/conversion/Optional/ccm26ToFoam/ccm26ToFoam.C b/applications/utilities/mesh/conversion/Optional/ccm26ToFoam/ccm26ToFoam.C index 58070fc473..decabfeae0 100644 --- a/applications/utilities/mesh/conversion/Optional/ccm26ToFoam/ccm26ToFoam.C +++ b/applications/utilities/mesh/conversion/Optional/ccm26ToFoam/ccm26ToFoam.C @@ -579,12 +579,17 @@ void ReadCells int main(int argc, char *argv[]) { + argList::addNote + ( + "read CCM files as written by proSTAR/ccm\n" + " - does not handle 'interfaces' (couples), cyclics or data\n" + " - does not handle mesh regions (porosity, solids, ...)\n" + ); argList::noParallel(); - argList::validArgs.append("ccm26 file"); - -# include "setRootCase.H" -# include "createTime.H" + argList::validArgs.append("ccmFile"); + #include "setRootCase.H" + #include "createTime.H" // Foam mesh data // ~~~~~~~~~~~~~~ @@ -615,6 +620,7 @@ int main(int argc, char *argv[]) { const fileName ccmFile = args[1]; + const word ccmExt = ccmFile.ext(); if (!isFile(ccmFile)) { @@ -623,8 +629,6 @@ int main(int argc, char *argv[]) << exit(FatalError); } - word ccmExt = ccmFile.ext(); - if (ccmExt != "ccm" && ccmExt != "ccmg") { FatalErrorIn(args.executable()) diff --git a/applications/utilities/mesh/conversion/fluentMeshToFoam/create3DCellShape.C b/applications/utilities/mesh/conversion/fluentMeshToFoam/create3DCellShape.C index ddf722d324..adcce3869d 100644 --- a/applications/utilities/mesh/conversion/fluentMeshToFoam/create3DCellShape.C +++ b/applications/utilities/mesh/conversion/fluentMeshToFoam/create3DCellShape.C @@ -90,7 +90,7 @@ cellShape create3DCellShape // make a list of outward-pointing faces labelListList localFaces(faceLabels.size()); - forAll (faceLabels, faceI) + forAll(faceLabels, faceI) { const label curFaceLabel = faceLabels[faceI]; diff --git a/applications/utilities/mesh/conversion/foamToStarMesh/foamToStarMesh.C b/applications/utilities/mesh/conversion/foamToStarMesh/foamToStarMesh.C index 09e34235e5..2587a5d457 100644 --- a/applications/utilities/mesh/conversion/foamToStarMesh/foamToStarMesh.C +++ b/applications/utilities/mesh/conversion/foamToStarMesh/foamToStarMesh.C @@ -62,6 +62,10 @@ using namespace Foam; int main(int argc, char *argv[]) { + argList::addNote + ( + "read OpenFOAM mesh and write a pro-STAR (v4) bnd/cel/vrt format" + ); argList::noParallel(); timeSelector::addOptions(); @@ -74,7 +78,7 @@ int main(int argc, char *argv[]) argList::addBoolOption ( "noBnd", - "suppress writing the .bnd file" + "suppress writing a boundary (.bnd) file" ); # include "setRootCase.H" diff --git a/applications/utilities/mesh/conversion/star3ToFoam/star3ToFoam.C b/applications/utilities/mesh/conversion/star3ToFoam/star3ToFoam.C index de32c0f5b3..8d8c565387 100644 --- a/applications/utilities/mesh/conversion/star3ToFoam/star3ToFoam.C +++ b/applications/utilities/mesh/conversion/star3ToFoam/star3ToFoam.C @@ -38,8 +38,13 @@ Description int main(int argc, char *argv[]) { + argList::addNote + ( + "convert pro-STAR (v3) mesh to OpenFOAM" + ); + argList::noParallel(); - argList::validArgs.append("STAR mesh file prefix"); + argList::validArgs.append("pro-STAR prefix"); argList::addOption ( "scale", @@ -56,7 +61,7 @@ int main(int argc, char *argv[]) const scalar scaleFactor = args.optionLookupOrDefault("scale", 1.0); -# include "createTime.H" + #include "createTime.H" starMesh makeMesh(args[1], runTime, scaleFactor); diff --git a/applications/utilities/mesh/conversion/star4ToFoam/star4ToFoam.C b/applications/utilities/mesh/conversion/star4ToFoam/star4ToFoam.C index fc956582b3..53dd66c234 100644 --- a/applications/utilities/mesh/conversion/star4ToFoam/star4ToFoam.C +++ b/applications/utilities/mesh/conversion/star4ToFoam/star4ToFoam.C @@ -59,6 +59,11 @@ using namespace Foam; int main(int argc, char *argv[]) { + argList::addNote + ( + "convert pro-STAR (v4) mesh to OpenFOAM" + ); + argList::noParallel(); argList::validArgs.append("pro-STAR prefix"); argList::addBoolOption diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudeProperties b/applications/utilities/mesh/generation/extrudeMesh/extrudeProperties index 9a047e7822..4fe5c4321d 100644 --- a/applications/utilities/mesh/generation/extrudeMesh/extrudeProperties +++ b/applications/utilities/mesh/generation/extrudeMesh/extrudeProperties @@ -2,7 +2,7 @@ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 1.6 | -| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict index 788b154a6e..f83ccc4854 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict @@ -2,7 +2,7 @@ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 1.6 | -| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile diff --git a/applications/utilities/mesh/manipulation/createPatch/createPatchDict b/applications/utilities/mesh/manipulation/createPatch/createPatchDict index 10fd55e5a1..fae13ed51b 100644 --- a/applications/utilities/mesh/manipulation/createPatch/createPatchDict +++ b/applications/utilities/mesh/manipulation/createPatch/createPatchDict @@ -2,7 +2,7 @@ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 1.6 | -| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile diff --git a/applications/utilities/mesh/manipulation/mirrorMesh/mirrorMeshDict b/applications/utilities/mesh/manipulation/mirrorMesh/mirrorMeshDict index 0405c7cfed..a891f605d2 100644 --- a/applications/utilities/mesh/manipulation/mirrorMesh/mirrorMeshDict +++ b/applications/utilities/mesh/manipulation/mirrorMesh/mirrorMeshDict @@ -2,7 +2,7 @@ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 1.6 | -| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile diff --git a/applications/utilities/mesh/conversion/polyDualMesh/Make/files b/applications/utilities/mesh/manipulation/polyDualMesh/Make/files similarity index 100% rename from applications/utilities/mesh/conversion/polyDualMesh/Make/files rename to applications/utilities/mesh/manipulation/polyDualMesh/Make/files diff --git a/applications/utilities/mesh/conversion/polyDualMesh/Make/options b/applications/utilities/mesh/manipulation/polyDualMesh/Make/options similarity index 100% rename from applications/utilities/mesh/conversion/polyDualMesh/Make/options rename to applications/utilities/mesh/manipulation/polyDualMesh/Make/options diff --git a/applications/utilities/mesh/conversion/polyDualMesh/meshDualiser.C b/applications/utilities/mesh/manipulation/polyDualMesh/meshDualiser.C similarity index 99% rename from applications/utilities/mesh/conversion/polyDualMesh/meshDualiser.C rename to applications/utilities/mesh/manipulation/polyDualMesh/meshDualiser.C index 74a89fdc5e..bdfb35bd50 100644 --- a/applications/utilities/mesh/conversion/polyDualMesh/meshDualiser.C +++ b/applications/utilities/mesh/manipulation/polyDualMesh/meshDualiser.C @@ -881,9 +881,6 @@ Foam::meshDualiser::meshDualiser(const polyMesh& mesh) {} -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // void Foam::meshDualiser::setRefinement @@ -1469,14 +1466,4 @@ void Foam::meshDualiser::setRefinement } - -// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // - - -// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * // - - -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // - - // ************************************************************************* // diff --git a/applications/utilities/mesh/conversion/polyDualMesh/meshDualiser.H b/applications/utilities/mesh/manipulation/polyDualMesh/meshDualiser.H similarity index 100% rename from applications/utilities/mesh/conversion/polyDualMesh/meshDualiser.H rename to applications/utilities/mesh/manipulation/polyDualMesh/meshDualiser.H diff --git a/applications/utilities/mesh/conversion/polyDualMesh/polyDualMeshApp.C b/applications/utilities/mesh/manipulation/polyDualMesh/polyDualMeshApp.C similarity index 100% rename from applications/utilities/mesh/conversion/polyDualMesh/polyDualMeshApp.C rename to applications/utilities/mesh/manipulation/polyDualMesh/polyDualMeshApp.C diff --git a/applications/utilities/mesh/manipulation/refineMesh/refineMeshDict b/applications/utilities/mesh/manipulation/refineMesh/refineMeshDict index 5a460c5d2e..c8b6a44f48 100644 --- a/applications/utilities/mesh/manipulation/refineMesh/refineMeshDict +++ b/applications/utilities/mesh/manipulation/refineMesh/refineMeshDict @@ -2,7 +2,7 @@ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 1.6 | -| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile diff --git a/applications/utilities/mesh/manipulation/topoSet/topoSetDict b/applications/utilities/mesh/manipulation/topoSet/topoSetDict index 40afc5ecb9..334a12b2ce 100644 --- a/applications/utilities/mesh/manipulation/topoSet/topoSetDict +++ b/applications/utilities/mesh/manipulation/topoSet/topoSetDict @@ -2,7 +2,7 @@ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 1.6 | -| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile diff --git a/applications/utilities/miscellaneous/expandDictionary/expandDictionary.C b/applications/utilities/miscellaneous/expandDictionary/expandDictionary.C index 08e8f29f24..86b1caec44 100644 --- a/applications/utilities/miscellaneous/expandDictionary/expandDictionary.C +++ b/applications/utilities/miscellaneous/expandDictionary/expandDictionary.C @@ -42,6 +42,12 @@ using namespace Foam; int main(int argc, char *argv[]) { + argList::addNote + ( + "Read the specified dictionary file, expand the macros etc. and write\n" + "the resulting dictionary to standard output." + ); + argList::noBanner(); argList::noParallel(); argList::validArgs.append("inputDict"); @@ -49,9 +55,10 @@ int main(int argc, char *argv[]) const string dictName = args[1]; - Info<<"//\n// expansion of dictionary " << dictName << "\n//\n"; + IOobject::writeBanner(Info) + <<"//\n// " << dictName << "\n//\n"; - dictionary(IFstream(dictName)()).write(Info, false); + dictionary(IFstream(dictName)(), true).write(Info, false); IOobject::writeDivider(Info); diff --git a/applications/utilities/parallelProcessing/decomposePar/decomposeParDict b/applications/utilities/parallelProcessing/decomposePar/decomposeParDict index a183ebd0cb..88d620ced1 100644 --- a/applications/utilities/parallelProcessing/decomposePar/decomposeParDict +++ b/applications/utilities/parallelProcessing/decomposePar/decomposeParDict @@ -1,10 +1,10 @@ -/*-------------------------------*- C++ -*---------------------------------*\ -| ========= | -| \\ / OpenFOAM | -| \\ / | -| \\ / The Open Source CFD Toolbox | -| \\/ http://www.OpenFOAM.org | -\*-------------------------------------------------------------------------*/ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ FoamFile { version 2.0; diff --git a/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C index 2cc5c26b1a..16444cd4cd 100644 --- a/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C +++ b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C @@ -112,11 +112,7 @@ Foam::domainDecomposition::domainDecomposition(const IOobject& io) procProcessorPatchSubPatchIDs_(nProcs_), procProcessorPatchSubPatchStarts_(nProcs_) { - if (decompositionDict_.found("distributed")) - { - Switch distributed(decompositionDict_.lookup("distributed")); - distributed_ = distributed; - } + decompositionDict_.readIfPresent("distributed", distributed_); } diff --git a/applications/utilities/parallelProcessing/decomposePar/domainDecompositionMesh.C b/applications/utilities/parallelProcessing/decomposePar/domainDecompositionMesh.C index 46febf2b44..2cc678ce7a 100644 --- a/applications/utilities/parallelProcessing/decomposePar/domainDecompositionMesh.C +++ b/applications/utilities/parallelProcessing/decomposePar/domainDecompositionMesh.C @@ -130,7 +130,7 @@ void Foam::domainDecomposition::decomposeMesh() procFaceAddressing_.setSize(nProcs_); // Internal faces - forAll (neighbour, facei) + forAll(neighbour, facei) { if (cellToProc_[owner[facei]] == cellToProc_[neighbour[facei]]) { @@ -141,16 +141,16 @@ void Foam::domainDecomposition::decomposeMesh() // for all processors, set the size of start index and patch size // lists to the number of patches in the mesh - forAll (procPatchSize_, procI) + forAll(procPatchSize_, procI) { procPatchSize_[procI].setSize(patches.size()); procPatchStartIndex_[procI].setSize(patches.size()); } - forAll (patches, patchi) + forAll(patches, patchi) { // Reset size and start index for all processors - forAll (procPatchSize_, procI) + forAll(procPatchSize_, procI) { procPatchSize_[procI][patchi] = 0; procPatchStartIndex_[procI][patchi] = @@ -167,7 +167,7 @@ void Foam::domainDecomposition::decomposeMesh() const unallocLabelList& patchFaceCells = patches[patchi].faceCells(); - forAll (patchFaceCells, facei) + forAll(patchFaceCells, facei) { const label curProc = cellToProc_[patchFaceCells[facei]]; @@ -190,7 +190,7 @@ void Foam::domainDecomposition::decomposeMesh() const unallocLabelList& nbrPatchFaceCells = pp.neighbPatch().faceCells(); - forAll (patchFaceCells, facei) + forAll(patchFaceCells, facei) { const label curProc = cellToProc_[patchFaceCells[facei]]; const label nbrProc = cellToProc_[nbrPatchFaceCells[facei]]; @@ -216,7 +216,7 @@ void Foam::domainDecomposition::decomposeMesh() List > > interPatchFaces(nProcs_); // Processor boundaries from internal faces - forAll (neighbour, facei) + forAll(neighbour, facei) { label ownerProc = cellToProc_[owner[facei]]; label nbrProc = cellToProc_[neighbour[facei]]; @@ -249,7 +249,7 @@ void Foam::domainDecomposition::decomposeMesh() } // Processor boundaries from split cyclics - forAll (patches, patchi) + forAll(patches, patchi) { if (isA(patches[patchi])) { @@ -279,7 +279,7 @@ void Foam::domainDecomposition::decomposeMesh() } // Add faces with different owner and neighbour processors - forAll (patchFaceCells, facei) + forAll(patchFaceCells, facei) { const label ownerProc = cellToProc_[patchFaceCells[facei]]; const label nbrProc = cellToProc_[nbrPatchFaceCells[facei]]; diff --git a/applications/utilities/postProcessing/dataConversion/foamDataToFluent/foamDataToFluentDict b/applications/utilities/postProcessing/dataConversion/foamDataToFluent/foamDataToFluentDict index da3b4fef6e..455a58afcb 100644 --- a/applications/utilities/postProcessing/dataConversion/foamDataToFluent/foamDataToFluentDict +++ b/applications/utilities/postProcessing/dataConversion/foamDataToFluent/foamDataToFluentDict @@ -2,7 +2,7 @@ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 1.6 | -| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile diff --git a/applications/utilities/postProcessing/miscellaneous/pdfPlot/pdfDict b/applications/utilities/postProcessing/miscellaneous/pdfPlot/pdfDict index d236d5ea8b..a6df8ead18 100644 --- a/applications/utilities/postProcessing/miscellaneous/pdfPlot/pdfDict +++ b/applications/utilities/postProcessing/miscellaneous/pdfPlot/pdfDict @@ -2,7 +2,7 @@ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 1.6 | -| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile diff --git a/applications/utilities/postProcessing/miscellaneous/postChannel/postChannelDict b/applications/utilities/postProcessing/miscellaneous/postChannel/postChannelDict index 37739bb859..c19349de64 100644 --- a/applications/utilities/postProcessing/miscellaneous/postChannel/postChannelDict +++ b/applications/utilities/postProcessing/miscellaneous/postChannel/postChannelDict @@ -2,7 +2,7 @@ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 1.6 | -| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile diff --git a/applications/utilities/postProcessing/sampling/probeLocations/probesDict b/applications/utilities/postProcessing/sampling/probeLocations/probesDict index 3f7679f0de..835ca7a2fb 100644 --- a/applications/utilities/postProcessing/sampling/probeLocations/probesDict +++ b/applications/utilities/postProcessing/sampling/probeLocations/probesDict @@ -1,10 +1,10 @@ -/*-------------------------------*- C++ -*---------------------------------*\ -| ========= | -| \\ / OpenFOAM 1.4.1 | -| \\ / | -| \\ / The Open Source CFD Toolbox | -| \\/ http://www.OpenFOAM.org | -\*-------------------------------------------------------------------------*/ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ FoamFile { version 2.0; diff --git a/applications/utilities/postProcessing/sampling/sample/sampleDict b/applications/utilities/postProcessing/sampling/sample/sampleDict index e892508a92..8584bdec95 100644 --- a/applications/utilities/postProcessing/sampling/sample/sampleDict +++ b/applications/utilities/postProcessing/sampling/sample/sampleDict @@ -2,7 +2,7 @@ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 1.6 | -| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ diff --git a/applications/utilities/preProcessing/changeDictionary/changeDictionaryDict b/applications/utilities/preProcessing/changeDictionary/changeDictionaryDict index 164641cc1d..20b92e066d 100644 --- a/applications/utilities/preProcessing/changeDictionary/changeDictionaryDict +++ b/applications/utilities/preProcessing/changeDictionary/changeDictionaryDict @@ -2,7 +2,7 @@ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 1.6 | -| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile diff --git a/applications/utilities/preProcessing/mapFields/mapFieldsDict b/applications/utilities/preProcessing/mapFields/mapFieldsDict index f2d3602472..af5db49b83 100644 --- a/applications/utilities/preProcessing/mapFields/mapFieldsDict +++ b/applications/utilities/preProcessing/mapFields/mapFieldsDict @@ -2,7 +2,7 @@ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 1.6 | -| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile diff --git a/applications/utilities/preProcessing/setFields/setFieldsDict b/applications/utilities/preProcessing/setFields/setFieldsDict index af1bf61845..58a745dac1 100644 --- a/applications/utilities/preProcessing/setFields/setFieldsDict +++ b/applications/utilities/preProcessing/setFields/setFieldsDict @@ -2,7 +2,7 @@ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 1.6 | -| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile diff --git a/applications/utilities/surface/surfaceMeshConvert/coordinateSystems b/applications/utilities/surface/surfaceMeshConvert/coordinateSystems index 0ce72e67bc..7ea094c1f4 100644 --- a/applications/utilities/surface/surfaceMeshConvert/coordinateSystems +++ b/applications/utilities/surface/surfaceMeshConvert/coordinateSystems @@ -2,7 +2,7 @@ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 1.6 | -| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile diff --git a/applications/utilities/surface/surfaceSubset/surfaceSubset.C b/applications/utilities/surface/surfaceSubset/surfaceSubset.C index 3246358d9b..51255242ef 100644 --- a/applications/utilities/surface/surfaceSubset/surfaceSubset.C +++ b/applications/utilities/surface/surfaceSubset/surfaceSubset.C @@ -102,7 +102,7 @@ int main(int argc, char *argv[]) ); const bool invertSelection = - meshSubsetDict.lookupOrDefault("invertSelection", false); + meshSubsetDict.lookupOrDefault("invertSelection", false); // Mark the cells for the subset diff --git a/applications/utilities/surface/surfaceSubset/surfaceSubsetDict b/applications/utilities/surface/surfaceSubset/surfaceSubsetDict index f956a24789..ede8e0658d 100644 --- a/applications/utilities/surface/surfaceSubset/surfaceSubsetDict +++ b/applications/utilities/surface/surfaceSubset/surfaceSubsetDict @@ -2,7 +2,7 @@ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 1.6 | -| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile diff --git a/applications/utilities/thermophysical/adiabaticFlameT/Hydrogen.log b/applications/utilities/thermophysical/adiabaticFlameT/Hydrogen.log index cd2ea615d4..2e4d05dd35 100644 --- a/applications/utilities/thermophysical/adiabaticFlameT/Hydrogen.log +++ b/applications/utilities/thermophysical/adiabaticFlameT/Hydrogen.log @@ -2,7 +2,7 @@ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 1.6 | -| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ Exec : adiabaticFlameT -case . controlDict diff --git a/applications/utilities/thermophysical/adiabaticFlameT/Methane.log b/applications/utilities/thermophysical/adiabaticFlameT/Methane.log index 1e65197392..93a5fb01eb 100644 --- a/applications/utilities/thermophysical/adiabaticFlameT/Methane.log +++ b/applications/utilities/thermophysical/adiabaticFlameT/Methane.log @@ -2,7 +2,7 @@ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 1.6 | -| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ Exec : adiabaticFlameT -case . controlDict diff --git a/applications/utilities/thermophysical/adiabaticFlameT/Propane.log b/applications/utilities/thermophysical/adiabaticFlameT/Propane.log index 45e2b912f6..a4fdd46fa1 100644 --- a/applications/utilities/thermophysical/adiabaticFlameT/Propane.log +++ b/applications/utilities/thermophysical/adiabaticFlameT/Propane.log @@ -2,7 +2,7 @@ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 1.6 | -| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ Exec : adiabaticFlameT -case . controlDict diff --git a/applications/utilities/thermophysical/adiabaticFlameT/controlDict b/applications/utilities/thermophysical/adiabaticFlameT/controlDict index 289c973381..8663ce69f5 100644 --- a/applications/utilities/thermophysical/adiabaticFlameT/controlDict +++ b/applications/utilities/thermophysical/adiabaticFlameT/controlDict @@ -2,7 +2,7 @@ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 1.6 | -| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile diff --git a/applications/utilities/thermophysical/equilibriumFlameT/Hydrogen.log b/applications/utilities/thermophysical/equilibriumFlameT/Hydrogen.log index 20f74642e8..32c6070c77 100644 --- a/applications/utilities/thermophysical/equilibriumFlameT/Hydrogen.log +++ b/applications/utilities/thermophysical/equilibriumFlameT/Hydrogen.log @@ -2,7 +2,7 @@ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 1.6 | -| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ Exec : equilibriumFlameT -case . controlDict diff --git a/applications/utilities/thermophysical/equilibriumFlameT/controlDict b/applications/utilities/thermophysical/equilibriumFlameT/controlDict index 666313208b..88ddd86d3a 100644 --- a/applications/utilities/thermophysical/equilibriumFlameT/controlDict +++ b/applications/utilities/thermophysical/equilibriumFlameT/controlDict @@ -2,7 +2,7 @@ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 1.6 | -| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile diff --git a/bin/org-pdflatex b/bin/org-pdflatex new file mode 120000 index 0000000000..b7b47c1517 --- /dev/null +++ b/bin/org-pdflatex @@ -0,0 +1 @@ +tools/org-batch \ No newline at end of file diff --git a/bin/tools/org-batch b/bin/tools/org-batch index 90b60f0464..ae97370dbd 100755 --- a/bin/tools/org-batch +++ b/bin/tools/org-batch @@ -37,8 +37,9 @@ usage() { Usage: ${0##*/} [OPTIONS] file1 [.. fileN] options: - -html create html (default) - -latex create LaTeX + -html create html (default) + -latex create LaTeX + -pdflatex create pdf via pdflatex * Batch process emacs org-mode files to create html/LaTeX etc. @@ -49,8 +50,14 @@ USAGE # default is html export: mode=html +unset makePDF +echo "have $Script" case $Script in +*pdflatex) + mode=latex + makePDF=pdflatex + ;; *latex) mode=latex ;; @@ -59,7 +66,6 @@ case $Script in ;; esac - # parse options while [ "$#" -gt 0 ] do @@ -75,6 +81,11 @@ do mode=latex shift ;; + -pdflatex) + mode=latex + makePDF=pdflatex + shift + ;; -*) usage "unknown option: '$*'" ;; @@ -98,6 +109,21 @@ do then emacs --batch -l org --visit=$org \ --funcall org-export-as-$mode-batch + + # post-processing step to create pdf + case "$makePDF" in + pdflatex) + input="${org%.org}.tex" + + if [ -f "$input" ] + then + pdflatex "$input" + else + echo "No $input to convert to pdf" + fi + ;; + esac + else echo "File not found" fi diff --git a/doc/codingStyleGuide.org b/doc/codingStyleGuide.org index 94a1b51536..589f946839 100644 --- a/doc/codingStyleGuide.org +++ b/doc/codingStyleGuide.org @@ -2,7 +2,7 @@ # #+TITLE: OpenFOAM C++ style guide #+AUTHOR: OpenCFD Ltd. -#+DATE: May 2010 +#+DATE: June 2010 #+LINK: http://www.opencfd.co.uk #+OPTIONS: author:nil ^:{} @@ -13,9 +13,12 @@ + The normal indentation is 4 spaces per logical level. + Use spaces for indentation, not tab characters. + Avoid trailing whitespace. - + The body of control statements (eg, =if=, =else=, =while=, etc). + + The body of control statements (eg, =if=, =else=, =while=, etc). is always delineated with brace brackets. A possible exception can be - made with =break= or =continue= as part of a control structure. + made in conjunction with =break= or =continue= as part of a control + structure. + + The body of =case= statements is usually delineated with brace brackets. + + A fall-through =case= should be commented as such. + stream output + =<<= is always four characters after the start of the stream, @@ -132,22 +135,25 @@ + Use two empty lines between functions *** Coding Practice - + passing data as arguments or return - Pass bool, label and scalar as copy, anything larger by reference. + + passing data as arguments or return values. + + Pass bool, label and scalar as copy, anything larger by reference. + const - Use everywhere it is applicable. + + Use everywhere it is applicable. - + variable initialisation using = - - : const className& variableName = otherClass.data(); + + variable initialisation using +#+BEGIN_EXAMPLE + const className& variableName = otherClass.data(); +#+END_EXAMPLE NOT - : const className& variableName(otherClass.data()); +#+BEGIN_EXAMPLE + const className& variableName(otherClass.data()); +#+END_EXAMPLE + virtual functions - If a class is virtual - make all derived classes virtual. + + If a class is virtual, make all derived classes virtual. *** Conditional Statements #+BEGIN_EXAMPLE @@ -169,7 +175,7 @@ } #+END_EXAMPLE - NOT (no space between =if= and =(=) + NOT (no space between =if= and =(= used) #+BEGIN_EXAMPLE if(condition) @@ -201,7 +207,7 @@ } #+END_EXAMPLE - NOT (no space between =for= and =(=) + NOT this (no space between =for= and =(= used) #+BEGIN_EXAMPLE for(i = 0; i < maxI; i++) @@ -349,7 +355,7 @@ * (k + t); #+END_EXAMPLE - This is sometime more legible when surrounded by extra parentheses: + This is sometimes more legible when surrounded by extra parentheses: #+BEGIN_EXAMPLE variableName = @@ -437,15 +443,15 @@ *** Doxygen Special Commands - Doxygen has a large number of special commands with a '\' prefix or a - (alternatively) an '@' prefix. + Doxygen has a large number of special commands with a =\= prefix or + (alternatively) an =@= prefix. - The '@' prefix form is recommended for most Doxygen specials, since it + The =@= prefix form is recommended for most Doxygen specials, since it has the advantage of standing out. It also happens to be what projects like gcc and VTK are using. - The '\' prefix form, however, looks a bit better for the '\n' newline - command and when escaping single characters - eg, '\@', '\<', '\>', etc. + The =\= prefix form, however, looks a bit better for the =\n= newline + command and when escaping single characters - eg, =\@=, =\<=, =\>=, etc. Since the filtering removes the leading 4 spaces within the blocks, the Doxygen commmands can be inserted within the block without problems. @@ -514,7 +520,7 @@ #+END_EXAMPLE -*** Documenting Typedefs and classes defined via macros +*** Documenting typedefs and classes defined via macros ... not yet properly resolved diff --git a/etc/cellModels b/etc/cellModels index ca710a777b..b4aa84f39b 100644 --- a/etc/cellModels +++ b/etc/cellModels @@ -2,7 +2,7 @@ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 1.6 | -| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ diff --git a/etc/controlDict b/etc/controlDict index fe7ab2d9ca..9f628abd8e 100644 --- a/etc/controlDict +++ b/etc/controlDict @@ -2,7 +2,7 @@ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 1.6 | -| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile diff --git a/src/OpenFOAM/containers/NamedEnum/NamedEnum.C b/src/OpenFOAM/containers/NamedEnum/NamedEnum.C index 76b8c58765..b39664af24 100644 --- a/src/OpenFOAM/containers/NamedEnum/NamedEnum.C +++ b/src/OpenFOAM/containers/NamedEnum/NamedEnum.C @@ -33,25 +33,25 @@ Foam::NamedEnum::NamedEnum() : HashTable(2*nEnum) { - for (int i=0; i::NamedEnum()") - << "Illegal enumeration name at position " << i << endl + << "Illegal enumeration name at position " << enumI << endl << "after entries " << goodNames << ".\n" << "Possibly your NamedEnum::names array" << " is not of size " << nEnum << endl << abort(FatalError); } - insert(names[i], i); + insert(names[enumI], enumI); } } @@ -61,7 +61,7 @@ Foam::NamedEnum::NamedEnum() template Enum Foam::NamedEnum::read(Istream& is) const { - word name(is); + const word name(is); HashTable::const_iterator iter = find(name); @@ -71,7 +71,7 @@ Enum Foam::NamedEnum::read(Istream& is) const ( "NamedEnum::read(Istream&) const", is ) << name << " is not in enumeration: " - << toc() << exit(FatalIOError); + << sortedToc() << exit(FatalIOError); } return Enum(iter()); diff --git a/src/OpenFOAM/db/Time/Time.C b/src/OpenFOAM/db/Time/Time.C index 90772004e9..4b106077c7 100644 --- a/src/OpenFOAM/db/Time/Time.C +++ b/src/OpenFOAM/db/Time/Time.C @@ -597,8 +597,9 @@ bool Foam::Time::end() const } -void Foam::Time::stopAt(const stopAtControls sa) const +bool Foam::Time::stopAt(const stopAtControls sa) const { + const bool changed = (stopAt_ != sa); stopAt_ = sa; // adjust endTime @@ -610,6 +611,7 @@ void Foam::Time::stopAt(const stopAtControls sa) const { endTime_ = GREAT; } + return changed; } diff --git a/src/OpenFOAM/db/Time/Time.H b/src/OpenFOAM/db/Time/Time.H index 1021ba012e..c644c757be 100644 --- a/src/OpenFOAM/db/Time/Time.H +++ b/src/OpenFOAM/db/Time/Time.H @@ -434,7 +434,8 @@ public: //- Adjust the current stopAtControl. Note that this value // only persists until the next time the dictionary is read. - virtual void stopAt(const stopAtControls) const; + // Return true if the stopAtControl changed. + virtual bool stopAt(const stopAtControls) const; //- Reset the time and time-index to those of the given time virtual void setTime(const Time&); diff --git a/src/OpenFOAM/db/dictionary/dictionary.H b/src/OpenFOAM/db/dictionary/dictionary.H index c483aed557..3c3d504353 100644 --- a/src/OpenFOAM/db/dictionary/dictionary.H +++ b/src/OpenFOAM/db/dictionary/dictionary.H @@ -191,10 +191,14 @@ public: Istream& ); - //- Construct top-level dictionary from Istream, reading entries - // until EOF + //- Construct top-level dictionary from Istream, + // reading entries until EOF dictionary(Istream&); + //- Construct top-level dictionary from Istream, + // reading entries until EOF, optionally keeping the header + dictionary(Istream&, const bool keepHeader); + //- Construct as copy given the parent dictionary dictionary(const dictionary& parentDict, const dictionary&); @@ -441,6 +445,9 @@ public: //- Read dictionary from Istream bool read(Istream&); + //- Read dictionary from Istream, optionally keeping the header + bool read(Istream&, const bool keepHeader); + // Write diff --git a/src/OpenFOAM/db/dictionary/dictionaryIO.C b/src/OpenFOAM/db/dictionary/dictionaryIO.C index 1c452bafaf..54d2877da2 100644 --- a/src/OpenFOAM/db/dictionary/dictionaryIO.C +++ b/src/OpenFOAM/db/dictionary/dictionaryIO.C @@ -28,68 +28,6 @@ License #include "inputModeEntry.H" #include "regExp.H" -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -bool Foam::dictionary::read(Istream& is) -{ - if (!is.good()) - { - FatalIOErrorIn("dictionary::read(Istream&, const word&)", is) - << "Istream not OK for reading dictionary " - << exit(FatalIOError); - - return false; - } - - token currToken(is); - if (currToken != token::BEGIN_BLOCK) - { - is.putBack(currToken); - } - - while (!is.eof() && entry::New(*this, is)) - {} - - // Remove the FoamFile header entry if it exists - remove("FoamFile"); - - if (is.bad()) - { - Info<< "dictionary::read(Istream&, const word&) : " - << "Istream not OK after reading dictionary " << name() - << endl; - - return false; - } - - return true; -} - - -bool Foam::dictionary::substituteKeyword(const word& keyword) -{ - word varName = keyword(1, keyword.size()-1); - - // lookup the variable name in the given dictionary - const entry* ePtr = lookupEntryPtr(varName, true, true); - - // if defined insert its entries into this dictionary - if (ePtr != NULL) - { - const dictionary& addDict = ePtr->dict(); - - forAllConstIter(IDLList, addDict, iter) - { - add(iter()); - } - - return true; - } - - return false; -} - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::dictionary::dictionary @@ -118,12 +56,97 @@ Foam::dictionary::dictionary(Istream& is) } +Foam::dictionary::dictionary(Istream& is, const bool keepHeader) +: + dictionaryName(is.name()), + parent_(dictionary::null) +{ + // Reset input mode as this is a "top-level" dictionary + functionEntries::inputModeEntry::clear(); + + read(is, keepHeader); +} + + +// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // + Foam::autoPtr Foam::dictionary::New(Istream& is) { return autoPtr(new dictionary(is)); } +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +bool Foam::dictionary::read(Istream& is, const bool keepHeader) +{ + if (!is.good()) + { + FatalIOErrorIn("dictionary::read(Istream&, bool)", is) + << "Istream not OK for reading dictionary " + << exit(FatalIOError); + + return false; + } + + token currToken(is); + if (currToken != token::BEGIN_BLOCK) + { + is.putBack(currToken); + } + + while (!is.eof() && entry::New(*this, is)) + {} + + // normally remove the FoamFile header entry if it exists + if (!keepHeader) + { + remove("FoamFile"); + } + + if (is.bad()) + { + Info<< "dictionary::read(Istream&, bool) : " + << "Istream not OK after reading dictionary " << name() + << endl; + + return false; + } + + return true; +} + + +bool Foam::dictionary::read(Istream& is) +{ + return this->read(is, false); +} + + +bool Foam::dictionary::substituteKeyword(const word& keyword) +{ + word varName = keyword(1, keyword.size()-1); + + // lookup the variable name in the given dictionary + const entry* ePtr = lookupEntryPtr(varName, true, true); + + // if defined insert its entries into this dictionary + if (ePtr != NULL) + { + const dictionary& addDict = ePtr->dict(); + + forAllConstIter(IDLList, addDict, iter) + { + add(iter()); + } + + return true; + } + + return false; +} + + // * * * * * * * * * * * * * * Istream Operator * * * * * * * * * * * * * * // Foam::Istream& Foam::operator>>(Istream& is, dictionary& dict) @@ -145,7 +168,7 @@ void Foam::dictionary::write(Ostream& os, bool subDict) const { if (subDict) { - os << nl << indent << token::BEGIN_BLOCK << incrIndent << nl; + os << nl << indent << token::BEGIN_BLOCK << incrIndent << nl; } forAllConstIter(IDLList, *this, iter) @@ -153,12 +176,12 @@ void Foam::dictionary::write(Ostream& os, bool subDict) const const entry& e = *iter; // Write entry - os << e; + os << e; // Add extra new line between entries for "top-level" dictionaries if (!subDict && parent() == dictionary::null && e != *last()) { - os << nl; + os << nl; } // Check stream before going to next entry. @@ -173,7 +196,7 @@ void Foam::dictionary::write(Ostream& os, bool subDict) const if (subDict) { - os << decrIndent << indent << token::END_BLOCK << endl; + os << decrIndent << indent << token::END_BLOCK << endl; } } diff --git a/src/OpenFOAM/db/functionObjects/outputFilterOutputControl/outputFilterOutputControl.C b/src/OpenFOAM/db/functionObjects/outputFilterOutputControl/outputFilterOutputControl.C index 2644b0d000..82e74c55c7 100644 --- a/src/OpenFOAM/db/functionObjects/outputFilterOutputControl/outputFilterOutputControl.C +++ b/src/OpenFOAM/db/functionObjects/outputFilterOutputControl/outputFilterOutputControl.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -68,17 +68,27 @@ Foam::outputFilterOutputControl::~outputFilterOutputControl() void Foam::outputFilterOutputControl::read(const dictionary& dict) { - outputControl_ = outputControlNames_.read(dict.lookup("outputControl")); + if (dict.found("outputControl")) + { + outputControl_ = outputControlNames_.read(dict.lookup("outputControl")); + } + else + { + outputControl_ = ocTimeStep; + } switch (outputControl_) { case ocTimeStep: { - dict.lookup("outputInterval") >> outputInterval_; + outputInterval_ = dict.lookupOrDefault