diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C b/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C index a6d98559a755ccfb3d6d8b6496645f43e0697695..24ce0fe938dccdf09b21b4f413ee2ae0d3f9d324 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<scalar, volMesh>& 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<scalar, volMesh>& iF, @@ -118,7 +114,7 @@ smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField } -smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField +Foam::smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField ( const smoluchowskiJumpTFvPatchScalarField& ptpsf, const DimensionedField<scalar, volMesh>& 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<scalar>& 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<IOdictionary>("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<scalar> 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 9f54c43ef33c943eb9afcd67af5bb90259c68577..13f8f02c9c607e14dba0882d6f1b142108e1d411 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 435bcb7745e8c32b89a1c2991f6b0fd9192a42a5..2f4e267e5ed45ab48d5e6088407c1d4d4edf38df 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/rhopSonicFoam/readThermodynamicProperties.H b/applications/solvers/compressible/rhopSonicFoam/readThermodynamicProperties.H index 3b8c82c8e5976907c6d6143caf91401e2d247c87..3f8a17b43e2313a305b2ca3d5d5fda12f38c9a19 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/multiphase/twoPhaseEulerFoam/createFields.H b/applications/solvers/multiphase/twoPhaseEulerFoam/createFields.H index 8a1269058106f9edd37a2a4124c68f6410c95021..5f800bcfedae67045daea255d1152cd1c8351c4b 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/utilities/parallelProcessing/decomposePar/domainDecomposition.C b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C index b144e757583409c559607482288d43e783f50a47..0d90c2ab086a2baebd88a920eb1ddc1cd1109ad6 100644 --- a/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C +++ b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C @@ -110,11 +110,7 @@ Foam::domainDecomposition::domainDecomposition(const IOobject& io) procProcessorPatchStartIndex_(nProcs_), cyclicParallel_(false) { - if (decompositionDict_.found("distributed")) - { - Switch distributed(decompositionDict_.lookup("distributed")); - distributed_ = distributed; - } + decompositionDict_.readIfPresent("distributed", distributed_); } diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C index 1341d8083da274298d94d58457f0b31aaef489de..d77552cf0ce9eb5e625e59c7fcd474800cd7b2a9 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C @@ -43,10 +43,10 @@ namespace Foam addToRunTimeSelectionTable(polyPatch, cyclicPolyPatch, word); addToRunTimeSelectionTable(polyPatch, cyclicPolyPatch, dictionary); - +} template<> -const char* NamedEnum<cyclicPolyPatch::transformType, 4>::names[] = +const char* Foam::NamedEnum<Foam::cyclicPolyPatch::transformType, 4>::names[] = { "unknown", "rotational", @@ -54,9 +54,8 @@ const char* NamedEnum<cyclicPolyPatch::transformType, 4>::names[] = "noOrdering" }; -const NamedEnum<cyclicPolyPatch::transformType, 4> - cyclicPolyPatch::transformTypeNames; -} +const Foam::NamedEnum<Foam::cyclicPolyPatch::transformType, 4> + Foam::cyclicPolyPatch::transformTypeNames; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/engine/engineMesh/fvMotionSolverEngineMesh/fvMotionSolverEngineMesh.C b/src/engine/engineMesh/fvMotionSolverEngineMesh/fvMotionSolverEngineMesh.C index a7d107a0fdab192ef02f98d0488063eb0d884c8d..a9dc31ff2291f8035d3e11d6d923f3f2ecbaf6a1 100644 --- a/src/engine/engineMesh/fvMotionSolverEngineMesh/fvMotionSolverEngineMesh.C +++ b/src/engine/engineMesh/fvMotionSolverEngineMesh/fvMotionSolverEngineMesh.C @@ -45,10 +45,7 @@ Foam::fvMotionSolverEngineMesh::fvMotionSolverEngineMesh(const IOobject& io) pistonLayers_("pistonLayers", dimLength, 0.0), motionSolver_(*this, engineDB_.engineDict().lookup("motionSolver")) { - if (engineDB_.engineDict().found("pistonLayers")) - { - engineDB_.engineDict().lookup("pistonLayers") >> pistonLayers_; - } + engineDB_.engineDict().readIfPresent("pistonLayers", pistonLayers_); } diff --git a/src/engine/engineMesh/layeredEngineMesh/layeredEngineMesh.C b/src/engine/engineMesh/layeredEngineMesh/layeredEngineMesh.C index 17ce100ed67c074758cfb1b6440b06ae7db5405f..e3caab294d6d2e3cb93c1e433ef9aeb5f2241b52 100644 --- a/src/engine/engineMesh/layeredEngineMesh/layeredEngineMesh.C +++ b/src/engine/engineMesh/layeredEngineMesh/layeredEngineMesh.C @@ -44,10 +44,7 @@ Foam::layeredEngineMesh::layeredEngineMesh(const IOobject& io) engineMesh(io), pistonLayers_("pistonLayers", dimLength, 0.0) { - if (engineDB_.engineDict().found("pistonLayers")) - { - engineDB_.engineDict().lookup("pistonLayers") >> pistonLayers_; - } + engineDB_.engineDict().readIfPresent("pistonLayers", pistonLayers_); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/freestream/freestreamFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/freestream/freestreamFvPatchField.C index 6b0dab35833e6c6fe7db4b20412b93c12a7d58b0..8153405f0ba3e6ba708c4aa509b1e4c4c005e02a 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/freestream/freestreamFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/freestream/freestreamFvPatchField.C @@ -80,10 +80,7 @@ freestreamFvPatchField<Type>::freestreamFvPatchField fvPatchField<Type>::operator=(freestreamValue()); } - if (dict.found("phi")) - { - dict.lookup("phi") >> this->phiName_; - } + dict.readIfPresent("phi", this->phiName_); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C index 82e21eea9db5e5bdcf9e19dc8cc76d749f694e43..ed0f8504c0fdb6b829138c48e568c99dd837321d 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C @@ -130,10 +130,7 @@ timeVaryingMappedFixedValueFvPatchField << endl; } - if (dict.found("fieldTableName")) - { - dict.lookup("fieldTableName") >> fieldTableName_; - } + dict.readIfPresent("fieldTableName", fieldTableName_); if (dict.found("value")) { diff --git a/src/lagrangian/molecularDynamics/potential/potential/potential.C b/src/lagrangian/molecularDynamics/potential/potential/potential.C index a54ef7f153d0a285460028187223c95864f552ab..3bc593263418a960cc1a62bc706cc6ad50d97f4f 100644 --- a/src/lagrangian/molecularDynamics/potential/potential/potential.C +++ b/src/lagrangian/molecularDynamics/potential/potential/potential.C @@ -229,18 +229,12 @@ void Foam::potential::potential::readPotentialDict() if (potentialDict.found("external")) { - Info<< nl << "Reading external forces:" << endl; const dictionary& externalDict = potentialDict.subDict("external"); - // ********************************************************************* // gravity - - if (externalDict.found("gravity")) - { - gravity_ = externalDict.lookup("gravity"); - } + externalDict.readIfPresent("gravity", gravity_); } Info<< nl << tab << "gravity = " << gravity_ << endl; diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.C index 348f9ce4142389f3627ccba8f746e298ff7e7acd..99b231f23457f9f04d8ce0fe6a554741d4f5d07d 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.C @@ -218,10 +218,7 @@ Foam::layerParameters::layerParameters << endl; } - if (dict.found("nRelaxedIter")) - { - dict.lookup("nRelaxedIter") >> nRelaxedIter_; - } + dict.readIfPresent("nRelaxedIter", nRelaxedIter_); if (nLayerIter_ < 0 || nRelaxedIter_ < 0) { @@ -303,10 +300,8 @@ Foam::layerParameters::layerParameters << endl; } - if (dict.found("nRelaxedIter")) - { - dict.lookup("nRelaxedIter") >> nRelaxedIter_; - } + dict.readIfPresent("nRelaxedIter", nRelaxedIter_); + if (nLayerIter_ < 0 || nRelaxedIter_ < 0) { FatalErrorIn("layerParameters::layerParameters(..)") diff --git a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementProblemCells.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementProblemCells.C index f4a887279ead27b9f88ca46db27b4e3f11f957c9..03dda28ede76ef0c4ba27cadc4a476bf227c6492 100644 --- a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementProblemCells.C +++ b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementProblemCells.C @@ -522,11 +522,9 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCells // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Collapse checking parameters - scalar volFraction = -1; - if (motionDict.found("minVolCollapseRatio")) - { - volFraction = readScalar(motionDict.lookup("minVolCollapseRatio")); - } + const scalar volFraction = + motionDict.lookupOrDefault<scalar>("minVolCollapseRatio", -1); + const bool checkCollapse = (volFraction > 0); scalar minArea = -1; scalar maxNonOrtho = -1; diff --git a/src/mesh/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.C b/src/mesh/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.C index e53d7ae03f8d4194e6234b89bd4afd2684ff97a9..f10b815b9d5a7bc839b3007500a8137e0c4b05e0 100644 --- a/src/mesh/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.C +++ b/src/mesh/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.C @@ -151,17 +151,10 @@ Foam::refinementSurfaces::refinementSurfaces } // Global perpendicular angle - if (dict.found("perpendicularAngle")) - { - globalAngle[surfI] = readScalar(dict.lookup("perpendicularAngle")); - } + dict.readIfPresent("perpendicularAngle", globalAngle[surfI]); //// Global patch name per surface - //if (dict.found("patchType")) - //{ - // dict.lookup("patchType") >> globalPatchType[surfI]; - //} - + //dict.readIfPresent("patchType", globalPatchType[surfI]); if (dict.found("regions")) { @@ -446,13 +439,7 @@ Foam::refinementSurfaces::refinementSurfaces } // Global perpendicular angle - if (dict.found("perpendicularAngle")) - { - globalAngle[surfI] = readScalar - ( - dict.lookup("perpendicularAngle") - ); - } + dict.readIfPresent("perpendicularAngle", globalAngle[surfI]); if (dict.found("regions")) { diff --git a/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C b/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C index cded55bcd7a48f1d88c84e6e8e93d0cbf7d5fe4a..5a75055df2bf9b0fa391699dddef3c891f5f9d6d 100644 --- a/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C +++ b/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C @@ -22,8 +22,8 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. From scotch forum: - - By: Francois PELLEGRINI RE: Graph mapping 'strategy' string [ reply ] + + By: Francois PELLEGRINI RE: Graph mapping 'strategy' string [ reply ] 2008-08-22 10:09 Strategy handling in Scotch is a bit tricky. In order not to be confused, you must have a clear view of how they are built. Here are some rules: @@ -178,45 +178,39 @@ Foam::label Foam::ptscotchDecomp::decompose // const dictionary& scotchCoeffs = // decompositionDict_.subDict("ptscotchCoeffs"); // -// if (scotchCoeffs.found("writeGraph")) +// if (scotchCoeffs.lookupOrDefault("writeGraph", false)) // { -// Switch writeGraph(scotchCoeffs.lookup("writeGraph")); +// OFstream str(mesh_.time().path() / mesh_.name() + ".grf"); // -// if (writeGraph) -// { -// OFstream str(mesh_.time().path() / mesh_.name() + ".grf"); +// Info<< "Dumping Scotch graph file to " << str.name() << endl +// << "Use this in combination with gpart." << endl; // -// Info<< "Dumping Scotch graph file to " << str.name() << endl -// << "Use this in combination with gpart." << endl; +// label version = 0; +// str << version << nl; +// // Numer of vertices +// str << xadj.size()-1 << ' ' << adjncy.size() << nl; +// // Numbering starts from 0 +// label baseval = 0; +// // Has weights? +// label hasEdgeWeights = 0; +// label hasVertexWeights = 0; +// label numericflag = 10*hasEdgeWeights+hasVertexWeights; +// str << baseval << ' ' << numericflag << nl; +// for (label cellI = 0; cellI < xadj.size()-1; cellI++) +// { +// label start = xadj[cellI]; +// label end = xadj[cellI+1]; +// str << end-start; // -// label version = 0; -// str << version << nl; -// // Numer of vertices -// str << xadj.size()-1 << ' ' << adjncy.size() << nl; -// // Numbering starts from 0 -// label baseval = 0; -// // Has weights? -// label hasEdgeWeights = 0; -// label hasVertexWeights = 0; -// label numericflag = 10*hasEdgeWeights+hasVertexWeights; -// str << baseval << ' ' << numericflag << nl; -// for (label cellI = 0; cellI < xadj.size()-1; cellI++) +// for (label i = start; i < end; i++) // { -// label start = xadj[cellI]; -// label end = xadj[cellI+1]; -// str << end-start; -// -// for (label i = start; i < end; i++) -// { -// str << ' ' << adjncy[i]; -// } -// str << nl; +// str << ' ' << adjncy[i]; // } +// str << nl; // } // } // } - // Strategy // ~~~~~~~~ diff --git a/src/parallel/decompose/scotchDecomp/scotchDecomp.C b/src/parallel/decompose/scotchDecomp/scotchDecomp.C index 534044646f0271cc2d5f65086cf8c020d04044aa..95b7fd25490e67cb15344682731d3e4fabaddf18 100644 --- a/src/parallel/decompose/scotchDecomp/scotchDecomp.C +++ b/src/parallel/decompose/scotchDecomp/scotchDecomp.C @@ -22,8 +22,8 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. From scotch forum: - - By: Francois PELLEGRINI RE: Graph mapping 'strategy' string [ reply ] + + By: Francois PELLEGRINI RE: Graph mapping 'strategy' string [ reply ] 2008-08-22 10:09 Strategy handling in Scotch is a bit tricky. In order not to be confused, you must have a clear view of how they are built. Here are some rules: @@ -178,40 +178,35 @@ Foam::label Foam::scotchDecomp::decompose const dictionary& scotchCoeffs = decompositionDict_.subDict("scotchCoeffs"); - if (scotchCoeffs.found("writeGraph")) + if (scotchCoeffs.lookupOrDefault("writeGraph", false)) { - Switch writeGraph(scotchCoeffs.lookup("writeGraph")); - - if (writeGraph) + OFstream str(mesh_.time().path() / mesh_.name() + ".grf"); + + Info<< "Dumping Scotch graph file to " << str.name() << endl + << "Use this in combination with gpart." << endl; + + label version = 0; + str << version << nl; + // Numer of vertices + str << xadj.size()-1 << ' ' << adjncy.size() << nl; + // Numbering starts from 0 + label baseval = 0; + // Has weights? + label hasEdgeWeights = 0; + label hasVertexWeights = 0; + label numericflag = 10*hasEdgeWeights+hasVertexWeights; + str << baseval << ' ' << numericflag << nl; + for (label cellI = 0; cellI < xadj.size()-1; cellI++) { - OFstream str(mesh_.time().path() / mesh_.name() + ".grf"); - - Info<< "Dumping Scotch graph file to " << str.name() << endl - << "Use this in combination with gpart." << endl; - - label version = 0; - str << version << nl; - // Numer of vertices - str << xadj.size()-1 << ' ' << adjncy.size() << nl; - // Numbering starts from 0 - label baseval = 0; - // Has weights? - label hasEdgeWeights = 0; - label hasVertexWeights = 0; - label numericflag = 10*hasEdgeWeights+hasVertexWeights; - str << baseval << ' ' << numericflag << nl; - for (label cellI = 0; cellI < xadj.size()-1; cellI++) + label start = xadj[cellI]; + label end = xadj[cellI+1]; + str << end-start; + + for (label i = start; i < end; i++) { - label start = xadj[cellI]; - label end = xadj[cellI+1]; - str << end-start; - - for (label i = start; i < end; i++) - { - str << ' ' << adjncy[i]; - } - str << nl; + str << ' ' << adjncy[i]; } + str << nl; } } } @@ -229,7 +224,6 @@ Foam::label Foam::scotchDecomp::decompose const dictionary& scotchCoeffs = decompositionDict_.subDict("scotchCoeffs"); - string strategy; if (scotchCoeffs.readIfPresent("strategy", strategy)) { diff --git a/src/postProcessing/functionObjects/forces/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyDisplacementPointPatchVectorField.C b/src/postProcessing/functionObjects/forces/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyDisplacementPointPatchVectorField.C index 8b248991d5cce5caca462a6ecf920856691cc935..fdcfa25e1a66b510989d04cb175f4ed1aad326a3 100644 --- a/src/postProcessing/functionObjects/forces/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyDisplacementPointPatchVectorField.C +++ b/src/postProcessing/functionObjects/forces/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyDisplacementPointPatchVectorField.C @@ -76,11 +76,9 @@ sixDoFRigidBodyDisplacementPointPatchVectorField rhoInf_ = readScalar(dict.lookup("rhoInf")); } - if (dict.found("g")) + if (dict.readIfPresent("g", g_)) { lookupGravity_ = -2; - - g_ = dict.lookup("g"); } if (!dict.found("value"))