diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C b/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C index d0183e9f7d..8f1ebe37c8 100644 --- a/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C +++ b/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -93,7 +93,7 @@ Foam::smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField dict ) << "unphysical accommodationCoeff specified" << "(0 < accommodationCoeff <= 1)" << endl - << exit(FatalError); + << exit(FatalIOError); } if (dict.found("value")) diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.C b/applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.C index 875e42683e..61861b33fa 100644 --- a/applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.C +++ b/applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.C @@ -94,7 +94,7 @@ maxwellSlipUFvPatchVectorField::maxwellSlipUFvPatchVectorField dict ) << "unphysical accommodationCoeff_ specified" << "(0 < accommodationCoeff_ <= 1)" << endl - << exit(FatalError); + << exit(FatalIOError); } if (dict.found("value")) diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.C b/applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.C index 8f31a2b460..5c1459381f 100644 --- a/applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.C +++ b/applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -98,6 +98,7 @@ mixedFixedValueSlipFvPatchField::mixedFixedValueSlipFvPatchField valueFraction_(ptf.valueFraction_) {} + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // Map from self diff --git a/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C b/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C index 6f8712a0b3..097330487e 100644 --- a/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C +++ b/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -104,60 +104,50 @@ int main(int argc, char *argv[]) polyMeshDir = polyMesh::meshSubDir; } - autoPtr meshDictIoPtr; + IOobject meshDictIO + ( + dictName, + runTime.constant(), + polyMeshDir, + runTime, + IOobject::MUST_READ, + IOobject::NO_WRITE, + false + ); if (args.optionFound("dict")) { const fileName dictPath = args["dict"]; - meshDictIoPtr.set + meshDictIO = IOobject ( - new IOobject ( - ( - isDir(dictPath) - ? dictPath/dictName - : dictPath - ), - runTime, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE, - false - ) - ); - } - else - { - meshDictIoPtr.set - ( - new IOobject - ( - dictName, - runTime.constant(), - polyMeshDir, - runTime, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE, - false - ) + isDir(dictPath) + ? dictPath/dictName + : dictPath + ), + runTime, + IOobject::MUST_READ, + IOobject::NO_WRITE, + false ); } - if (!meshDictIoPtr->headerOk()) + if (!meshDictIO.headerOk()) { FatalErrorIn(args.executable()) << "Cannot open mesh description file\n " - << meshDictIoPtr->objectPath() + << meshDictIO.objectPath() << nl << exit(FatalError); } Info<< "Creating block mesh from\n " - << meshDictIoPtr->objectPath() << endl; + << meshDictIO.objectPath() << endl; blockMesh::verbose(true); - IOdictionary meshDict(meshDictIoPtr()); + IOdictionary meshDict(meshDictIO); blockMesh blocks(meshDict, regionName); diff --git a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C index be4fffa8df..b159f9c096 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C +++ b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C @@ -1241,8 +1241,7 @@ int main(int argc, char *argv[]) #include "addRegionOption.H" #include "addOverwriteOption.H" - argList::addOption("dict", "name", "specify alternative dictionary"); - + #include "addDictOption.H" #include "setRootCase.H" #include "createTime.H" #include "createNamedMesh.H" @@ -1263,19 +1262,14 @@ int main(int argc, char *argv[]) const word oldInstance = mesh.pointsInstance(); bool overwrite = args.optionFound("overwrite"); - const word dictName - (args.optionLookupOrDefault("dict", "extrudeToRegionMeshDict")); - IOdictionary dict - ( - IOobject - ( - dictName, - runTime.system(), - runTime, - IOobject::MUST_READ_IF_MODIFIED - ) - ); + + const word dictName("extrudeToRegionMeshDict"); + + #include "setSystemMeshDictionaryIO.H" + + IOdictionary dict(dictIO); + // Point generator autoPtr model(extrudeModel::New(dict)); diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C index 6b63430918..2406cb667c 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C @@ -369,7 +369,10 @@ int main(int argc, char *argv[]) // Add all the surface regions as patches // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - labelList globalToPatch; + //- Global surface region to patch (non faceZone surface) or patches + // (faceZone surfaces) + labelList globalToMasterPatch; + labelList globalToSlavePatch; { Info<< nl << "Adding patches for surface regions" << nl @@ -377,7 +380,8 @@ int main(int argc, char *argv[]) << endl; // From global region number to mesh patch. - globalToPatch.setSize(surfaces.nRegions(), -1); + globalToMasterPatch.setSize(surfaces.nRegions(), -1); + globalToSlavePatch.setSize(surfaces.nRegions(), -1); Info<< "Patch\tType\tRegion" << nl << "-----\t----\t------" @@ -394,36 +398,111 @@ int main(int argc, char *argv[]) Info<< surfaces.names()[surfI] << ':' << nl << nl; - forAll(regNames, i) + if (surfaces.faceZoneNames()[surfI].empty()) { - label globalRegionI = surfaces.globalRegion(surfI, i); - - label patchI; - - if (surfacePatchInfo.set(globalRegionI)) + // 'Normal' surface + forAll(regNames, i) { - patchI = meshRefiner.addMeshedPatch - ( - regNames[i], - surfacePatchInfo[globalRegionI] - ); + label globalRegionI = surfaces.globalRegion(surfI, i); + + label patchI; + + if (surfacePatchInfo.set(globalRegionI)) + { + patchI = meshRefiner.addMeshedPatch + ( + regNames[i], + surfacePatchInfo[globalRegionI] + ); + } + else + { + dictionary patchInfo; + patchInfo.set("type", wallPolyPatch::typeName); + + patchI = meshRefiner.addMeshedPatch + ( + regNames[i], + patchInfo + ); + } + + Info<< patchI << '\t' << mesh.boundaryMesh()[patchI].type() + << '\t' << regNames[i] << nl; + + globalToMasterPatch[globalRegionI] = patchI; + globalToSlavePatch[globalRegionI] = patchI; } - else + } + else + { + // Zoned surface + forAll(regNames, i) { - dictionary patchInfo; - patchInfo.set("type", wallPolyPatch::typeName); + label globalRegionI = surfaces.globalRegion(surfI, i); - patchI = meshRefiner.addMeshedPatch - ( - regNames[i], - patchInfo - ); + // Add master side patch + { + label patchI; + + if (surfacePatchInfo.set(globalRegionI)) + { + patchI = meshRefiner.addMeshedPatch + ( + regNames[i], + surfacePatchInfo[globalRegionI] + ); + } + else + { + dictionary patchInfo; + patchInfo.set("type", wallPolyPatch::typeName); + + patchI = meshRefiner.addMeshedPatch + ( + regNames[i], + patchInfo + ); + } + + Info<< patchI << '\t' + << mesh.boundaryMesh()[patchI].type() + << '\t' << regNames[i] << nl; + + globalToMasterPatch[globalRegionI] = patchI; + } + // Add slave side patch + { + const word slaveName = regNames[i] + "_slave"; + label patchI; + + if (surfacePatchInfo.set(globalRegionI)) + { + patchI = meshRefiner.addMeshedPatch + ( + slaveName, + surfacePatchInfo[globalRegionI] + ); + } + else + { + dictionary patchInfo; + patchInfo.set("type", wallPolyPatch::typeName); + + patchI = meshRefiner.addMeshedPatch + ( + slaveName, + patchInfo + ); + } + + Info<< patchI << '\t' + << mesh.boundaryMesh()[patchI].type() + << '\t' << slaveName << nl; + + globalToSlavePatch[globalRegionI] = patchI; + } } - - Info<< patchI << '\t' << mesh.boundaryMesh()[patchI].type() - << '\t' << regNames[i] << nl; - - globalToPatch[globalRegionI] = patchI; } Info<< nl; @@ -479,7 +558,8 @@ int main(int argc, char *argv[]) meshRefiner, decomposer, distributor, - globalToPatch + globalToMasterPatch, + globalToSlavePatch ); // Refinement parameters @@ -510,7 +590,8 @@ int main(int argc, char *argv[]) autoSnapDriver snapDriver ( meshRefiner, - globalToPatch + globalToMasterPatch, + globalToSlavePatch ); // Snap parameters @@ -544,7 +625,12 @@ int main(int argc, char *argv[]) { cpuTime timer; - autoLayerDriver layerDriver(meshRefiner, globalToPatch); + autoLayerDriver layerDriver + ( + meshRefiner, + globalToMasterPatch, + globalToSlavePatch + ); // Layer addition parameters layerParameters layerParams(layerDict, mesh.boundaryMesh()); diff --git a/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C b/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C index c2e2a06ebb..89beec32ef 100644 --- a/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C +++ b/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C @@ -117,14 +117,9 @@ int main(int argc, char *argv[]) "Makes internal faces into boundary faces.\n" "Does not duplicate points." ); - + #include "addDictOption.H" #include "addOverwriteOption.H" - argList::addOption - ( - "dict", - "file", - "specify alternative dictionary for the createBaffles description" - ); + #include "addDictOption.H" #include "addRegionOption.H" #include "setRootCase.H" #include "createTime.H" @@ -136,14 +131,8 @@ int main(int argc, char *argv[]) const word oldInstance = mesh.pointsInstance(); - const word dictName - ( - args.optionLookupOrDefault - ( - "dict", - "createBafflesDict" - ) - ); + const word dictName("createBafflesDict"); + #include "setSystemMeshDictionaryIO.H" Switch internalFacesOnly(false); @@ -152,17 +141,7 @@ int main(int argc, char *argv[]) PtrList selectors; { Info<< "Reading baffle criteria from " << dictName << nl << endl; - IOdictionary dict - ( - IOobject - ( - dictName, - mesh.time().system(), - mesh, - IOobject::MUST_READ, - IOobject::NO_WRITE - ) - ); + IOdictionary dict(dictIO); dict.lookup("internalFacesOnly") >> internalFacesOnly; noFields = dict.lookupOrDefault("noFields", false); diff --git a/applications/utilities/mesh/manipulation/createPatch/createPatch.C b/applications/utilities/mesh/manipulation/createPatch/createPatch.C index 7a969e15d1..9e89c8d4df 100644 --- a/applications/utilities/mesh/manipulation/createPatch/createPatch.C +++ b/applications/utilities/mesh/manipulation/createPatch/createPatch.C @@ -505,13 +505,7 @@ int main(int argc, char *argv[]) { #include "addOverwriteOption.H" #include "addRegionOption.H" - argList::addOption - ( - "dict", - "word", - "name of dictionary to provide patch information" - ); - + #include "addDictOption.H" #include "setRootCase.H" #include "createTime.H" runTime.functionObjects().off(); @@ -521,38 +515,20 @@ int main(int argc, char *argv[]) const bool overwrite = args.optionFound("overwrite"); - word dictName - ( - args.optionLookupOrDefault("dict", "createPatchDict") - ); + #include "createNamedPolyMesh.H" + + const word oldInstance = mesh.pointsInstance(); + + const word dictName("createPatchDict"); + #include "setSystemMeshDictionaryIO.H" Info<< "Reading " << dictName << nl << endl; - IOdictionary dict - ( - IOobject - ( - dictName, - runTime.system(), - ( - meshRegionName != polyMesh::defaultRegion - ? meshRegionName - : word::null - ), - runTime, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE, - false - ) - ); - + IOdictionary dict(dictIO); // Whether to synchronise points const Switch pointSync(dict.lookup("pointSync")); - #include "createNamedPolyMesh.H" - - const word oldInstance = mesh.pointsInstance(); const polyBoundaryMesh& patches = mesh.boundaryMesh(); diff --git a/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C b/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C index f8a206e651..098864102d 100644 --- a/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C +++ b/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C @@ -298,12 +298,7 @@ int main(int argc, char *argv[]) #include "addOverwriteOption.H" #include "addRegionOption.H" - argList::addBoolOption - ( - "dict", - "refine according to system/refineMeshDict" - ); - + #include "addDictOption.H" #include "setRootCase.H" #include "createTime.H" runTime.functionObjects().off(); @@ -327,19 +322,12 @@ int main(int argc, char *argv[]) if (readDict) { - Info<< "Refining according to refineMeshDict" << nl << endl; + const word dictName("refineMeshDict"); + #include "setSystemMeshDictionaryIO.H" - refineDict = IOdictionary - ( - IOobject - ( - "refineMeshDict", - runTime.system(), - mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE - ) - ); + Info<< "Refining according to " << dictName << nl << endl; + + refineDict = IOdictionary(dictIO); const word setName(refineDict.lookup("set")); diff --git a/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C b/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C index 7eede94626..d03f24cd7c 100644 --- a/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C +++ b/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C @@ -614,11 +614,7 @@ int main(int argc, char *argv[]) # include "addRegionOption.H" # include "addOverwriteOption.H" # include "addTimeOptions.H" - argList::addBoolOption - ( - "dict", - "renumber according to system/renumberMeshDict" - ); +# include "addDictOption.H" argList::addBoolOption ( "frontWidth", @@ -700,23 +696,13 @@ int main(int argc, char *argv[]) if (readDict) { - Info<< "Renumber according to renumberMeshDict." << nl << endl; + const word dictName("renumberMeshDict"); + #include "setSystemMeshDictionaryIO.H" - renumberDictPtr.reset - ( - new IOdictionary - ( - IOobject - ( - "renumberMeshDict", - runTime.system(), - mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE - ) - ) - ); - const IOdictionary renumberDict = renumberDictPtr(); + Info<< "Renumber according to " << dictName << nl << endl; + + renumberDictPtr.reset(new IOdictionary(dictIO)); + const IOdictionary& renumberDict = renumberDictPtr(); renumberPtr = renumberMethod::New(renumberDict); diff --git a/applications/utilities/mesh/manipulation/subsetMesh/cellSelection/outsideCellSelection.C b/applications/utilities/mesh/manipulation/subsetMesh/cellSelection/outsideCellSelection.C index 556ae4e07e..7cb4eec518 100644 --- a/applications/utilities/mesh/manipulation/subsetMesh/cellSelection/outsideCellSelection.C +++ b/applications/utilities/mesh/manipulation/subsetMesh/cellSelection/outsideCellSelection.C @@ -156,10 +156,21 @@ Foam::boolList Foam::cellSelections::outsideCellSelection::findRegions reduce(keepRegionI, maxOp