STYLE: reduced usage of Switch

- Since 'bool' and 'Switch' use the _identical_ input mechanism
  (ie, both accept true/false, on/off, yes/no, none, 1/0), the main
  reason to prefer one or the other is the output.

  The output for Switch is as text (eg, "true"), whereas for bool
  it is label (0 or 1). If the output is required for a dictionary,
  Switch may be appropriate. If the output is not required, or is only
  used for Pstream exchange, bool can be more appropriate.
This commit is contained in:
Mark Olesen
2018-06-01 20:51:48 +02:00
parent 0f60cc9263
commit 84b109219a
72 changed files with 227 additions and 319 deletions

View File

@ -78,7 +78,6 @@ Description
#include "XiModel.H" #include "XiModel.H"
#include "PDRDragModel.H" #include "PDRDragModel.H"
#include "ignition.H" #include "ignition.H"
#include "Switch.H"
#include "bound.H" #include "bound.H"
#include "pimpleControl.H" #include "pimpleControl.H"
#include "fvOptions.H" #include "fvOptions.H"

View File

@ -63,7 +63,6 @@ Description
#include "XiModel.H" #include "XiModel.H"
#include "PDRDragModel.H" #include "PDRDragModel.H"
#include "ignition.H" #include "ignition.H"
#include "Switch.H"
#include "bound.H" #include "bound.H"
#include "dynamicRefineFvMesh.H" #include "dynamicRefineFvMesh.H"
#include "pimpleControl.H" #include "pimpleControl.H"

View File

@ -58,14 +58,14 @@ Foam::PDRDragModel::PDRDragModel
( (
PDRProperties.subDict PDRProperties.subDict
( (
word(PDRProperties.lookup("PDRDragModel")) + "Coeffs" PDRProperties.get<word>("PDRDragModel") + "Coeffs"
) )
), ),
turbulence_(turbulence), turbulence_(turbulence),
rho_(rho), rho_(rho),
U_(U), U_(U),
phi_(phi), phi_(phi),
on_(PDRDragModelCoeffs_.lookup("drag")) on_(PDRDragModelCoeffs_.get<bool>("drag"))
{} {}
@ -81,7 +81,7 @@ bool Foam::PDRDragModel::read(const dictionary& PDRProperties)
{ {
PDRDragModelCoeffs_ = PDRProperties.optionalSubDict(type() + "Coeffs"); PDRDragModelCoeffs_ = PDRProperties.optionalSubDict(type() + "Coeffs");
PDRDragModelCoeffs_.lookup("drag") >> on_; PDRDragModelCoeffs_.read("drag", on_);
return true; return true;
} }

View File

@ -67,7 +67,7 @@ protected:
const volVectorField& U_; const volVectorField& U_;
const surfaceScalarField& phi_; const surfaceScalarField& phi_;
Switch on_; bool on_;
private: private:

View File

@ -36,9 +36,9 @@ Foam::autoPtr<Foam::PDRDragModel> Foam::PDRDragModel::New
const surfaceScalarField& phi const surfaceScalarField& phi
) )
{ {
const word modelType(PDRProperties.lookup("PDRDragModel")); const word modelType(PDRProperties.get<word>("PDRDragModel"));
Info<< "Selecting flame-wrinkling model " << modelType << endl; Info<< "Selecting drag model " << modelType << endl;
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType); auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);

View File

@ -165,8 +165,8 @@ bool Foam::PDRDragModels::basic::read(const dictionary& PDRProperties)
{ {
PDRDragModel::read(PDRProperties); PDRDragModel::read(PDRProperties);
PDRDragModelCoeffs_.lookup("Csu") >> Csu.value(); PDRDragModelCoeffs_.read("Csu", Csu.value());
PDRDragModelCoeffs_.lookup("Csk") >> Csk.value(); PDRDragModelCoeffs_.read("Csk", Csk.value());
return true; return true;
} }

View File

@ -1,2 +1,3 @@
Switch adjustTimeStep(runTime.controlDict().lookup("adjustTimeStep")); bool adjustTimeStep(runTime.controlDict().get<bool>("adjustTimeStep"));
scalar maxDeltaT(readScalar(runTime.controlDict().lookup("maxDeltaT")));
scalar maxDeltaT(runTime.controlDict().get<scalar>("maxDeltaT"));

View File

@ -1,3 +1,3 @@
runTime.controlDict().lookup("adjustTimeStep") >> adjustTimeStep; runTime.controlDict().read("adjustTimeStep", adjustTimeStep);
maxDeltaT = readScalar(runTime.controlDict().lookup("maxDeltaT")); runTime.controlDict().read("maxDeltaT", maxDeltaT);

View File

@ -1,5 +1,5 @@
IOporosityModelList pZones(mesh); IOporosityModelList pZones(mesh);
Switch pressureImplicitPorosity(false); bool pressureImplicitPorosity(false);
// nUCorrectors used for pressureImplicitPorosity // nUCorrectors used for pressureImplicitPorosity
int nUCorr = 0; int nUCorr = 0;

View File

@ -13,9 +13,11 @@ IOdictionary gravitationalProperties
); );
const dimensionedVector g(gravitationalProperties.lookup("g")); const dimensionedVector g(gravitationalProperties.lookup("g"));
const Switch rotating(gravitationalProperties.lookup("rotating")); const bool rotating(gravitationalProperties.get<bool>("rotating"));
const dimensionedVector Omega = const dimensionedVector Omega =
(
rotating ? gravitationalProperties.lookup("Omega") rotating ? gravitationalProperties.lookup("Omega")
: dimensionedVector("Omega", -dimTime, vector(0,0,0)); : dimensionedVector("Omega", -dimTime, vector(0,0,0))
);
const dimensionedScalar magg = mag(g); const dimensionedScalar magg = mag(g);
const dimensionedVector gHat = g/magg; const dimensionedVector gHat = g/magg;

View File

@ -1,5 +1,5 @@
IOporosityModelList pZones(mesh); IOporosityModelList pZones(mesh);
Switch pressureImplicitPorosity(false); bool pressureImplicitPorosity(false);
// nUCorrectors used for pressureImplicitPorosity // nUCorrectors used for pressureImplicitPorosity
int nUCorr = 0; int nUCorr = 0;

View File

@ -39,7 +39,7 @@ ThermalPhaseChangePhaseSystem
HeatAndMassTransferPhaseSystem<BasePhaseSystem>(mesh), HeatAndMassTransferPhaseSystem<BasePhaseSystem>(mesh),
volatile_(this->lookup("volatile")), volatile_(this->lookup("volatile")),
saturationModel_(saturationModel::New(this->subDict("saturationModel"))), saturationModel_(saturationModel::New(this->subDict("saturationModel"))),
massTransfer_(this->lookup("massTransfer")) massTransfer_(this->template get<bool>("massTransfer"))
{ {
forAllConstIters(this->phasePairs_, phasePairIter) forAllConstIters(this->phasePairs_, phasePairIter)
@ -357,7 +357,7 @@ void Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::correctThermo()
volScalarField iDmdtNew(iDmdt); volScalarField iDmdtNew(iDmdt);
if (massTransfer_ ) if (massTransfer_)
{ {
volScalarField H1 volScalarField H1
( (

View File

@ -43,7 +43,6 @@ SourceFiles
#include "HeatAndMassTransferPhaseSystem.H" #include "HeatAndMassTransferPhaseSystem.H"
#include "saturationModel.H" #include "saturationModel.H"
#include "Switch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -71,7 +70,7 @@ protected:
autoPtr<saturationModel> saturationModel_; autoPtr<saturationModel> saturationModel_;
// Mass transfer enabled // Mass transfer enabled
Switch massTransfer_; bool massTransfer_;
//- Interfacial Mass transfer rate //- Interfacial Mass transfer rate
HashPtrTable<volScalarField, phasePairKey, phasePairKey::hash> HashPtrTable<volScalarField, phasePairKey, phasePairKey::hash>

View File

@ -1,3 +1,3 @@
const dictionary& stressControl = mesh.solutionDict().subDict("stressAnalysis"); const dictionary& stressControl = mesh.solutionDict().subDict("stressAnalysis");
Switch compactNormalStress(stressControl.lookup("compactNormalStress")); bool compactNormalStress(stressControl.get<bool>("compactNormalStress"));

View File

@ -2,4 +2,4 @@
int nCorr = stressControl.lookupOrDefault<int>("nCorrectors", 1); int nCorr = stressControl.lookupOrDefault<int>("nCorrectors", 1);
scalar convergenceTolerance(readScalar(stressControl.lookup("D"))); scalar convergenceTolerance(stressControl.get<scalar>("D"));

View File

@ -184,9 +184,7 @@
volScalarField lambda(nu*E/((1.0 + nu)*(1.0 - 2.0*nu))); volScalarField lambda(nu*E/((1.0 + nu)*(1.0 - 2.0*nu)));
volScalarField threeK(E/(1.0 - 2.0*nu)); volScalarField threeK(E/(1.0 - 2.0*nu));
Switch planeStress(mechanicalProperties.lookup("planeStress")); if (mechanicalProperties.get<bool>("planeStress"))
if (planeStress)
{ {
Info<< "Plane Stress\n" << endl; Info<< "Plane Stress\n" << endl;

View File

@ -1,3 +1,3 @@
nCorr = stressControl.lookupOrDefault<int>("nCorrectors", 1); nCorr = stressControl.lookupOrDefault<int>("nCorrectors", 1);
convergenceTolerance = readScalar(stressControl.lookup("D")); convergenceTolerance = stressControl.get<scalar>("D");
stressControl.lookup("compactNormalStress") >> compactNormalStress; compactNormalStress = stressControl.get<bool>("compactNormalStress");

View File

@ -12,7 +12,7 @@ IOdictionary thermalProperties
) )
); );
Switch thermalStress(thermalProperties.lookup("thermalStress")); bool thermalStress(thermalProperties.get<bool>("thermalStress"));
volScalarField threeKalpha volScalarField threeKalpha
( (
@ -46,7 +46,6 @@ volScalarField DT
if (thermalStress) if (thermalStress)
{ {
autoPtr<volScalarField> CPtr; autoPtr<volScalarField> CPtr;
IOobject CIO IOobject CIO

View File

@ -39,7 +39,6 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "fvCFD.H" #include "fvCFD.H"
#include "Switch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -164,9 +164,7 @@ void tractionDisplacementFvPatchVectorField::updateCoeffs()
scalarField lambda(nu*E/((1.0 + nu)*(1.0 - 2.0*nu))); scalarField lambda(nu*E/((1.0 + nu)*(1.0 - 2.0*nu)));
scalarField threeK(E/(1.0 - 2.0*nu)); scalarField threeK(E/(1.0 - 2.0*nu));
Switch planeStress(mechanicalProperties.lookup("planeStress")); if (mechanicalProperties.get<bool>("planeStress"))
if (planeStress)
{ {
lambda = nu*E/((1.0 + nu)*(1.0 - nu)); lambda = nu*E/((1.0 + nu)*(1.0 - nu));
threeK = E/(1.0 - nu); threeK = E/(1.0 - nu);
@ -185,9 +183,7 @@ void tractionDisplacementFvPatchVectorField::updateCoeffs()
+ twoMuLambda*fvPatchField<vector>::snGrad() - (n & sigmaD) + twoMuLambda*fvPatchField<vector>::snGrad() - (n & sigmaD)
)/twoMuLambda; )/twoMuLambda;
Switch thermalStress(thermalProperties.lookup("thermalStress")); if (thermalProperties.get<bool>("thermalStress"))
if (thermalStress)
{ {
const fvPatchField<scalar>& threeKalpha= const fvPatchField<scalar>& threeKalpha=
patch().lookupPatchField<volScalarField, scalar>("threeKalpha"); patch().lookupPatchField<volScalarField, scalar>("threeKalpha");

View File

@ -39,7 +39,6 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "fvCFD.H" #include "fvCFD.H"
#include "Switch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -163,9 +163,7 @@ void tractionDisplacementCorrectionFvPatchVectorField::updateCoeffs()
scalarField mu(E/(2.0*(1.0 + nu))); scalarField mu(E/(2.0*(1.0 + nu)));
scalarField lambda(nu*E/((1.0 + nu)*(1.0 - 2.0*nu))); scalarField lambda(nu*E/((1.0 + nu)*(1.0 - 2.0*nu)));
Switch planeStress(mechanicalProperties.lookup("planeStress")); if (mechanicalProperties.get<bool>("planeStress"))
if (planeStress)
{ {
lambda = nu*E/((1.0 + nu)*(1.0 - nu)); lambda = nu*E/((1.0 + nu)*(1.0 - nu));
} }

View File

@ -89,9 +89,7 @@ Foam::edgeStats::edgeStats(const polyMesh& mesh)
IOdictionary motionProperties(motionObj); IOdictionary motionProperties(motionObj);
Switch twoDMotion(motionProperties.lookup("twoDMotion")); if (motionProperties.get<bool>("twoDMotion"))
if (twoDMotion)
{ {
Info<< "Correcting for 2D motion" << endl << endl; Info<< "Correcting for 2D motion" << endl << endl;

View File

@ -658,9 +658,7 @@ int main(int argc, char *argv[])
IOdictionary motionProperties(motionObj); IOdictionary motionProperties(motionObj);
Switch twoDMotion(motionProperties.lookup("twoDMotion")); if (motionProperties.get<bool>("twoDMotion"))
if (twoDMotion)
{ {
Info<< "Correcting for 2D motion" << endl << endl; Info<< "Correcting for 2D motion" << endl << endl;
correct2DPtr = new twoDPointCorrector(mesh); correct2DPtr = new twoDPointCorrector(mesh);

View File

@ -297,7 +297,7 @@ int main(int argc, char *argv[])
autoPtr<extrudeModel> model(extrudeModel::New(dict)); autoPtr<extrudeModel> model(extrudeModel::New(dict));
// Whether to flip normals // Whether to flip normals
const Switch flipNormals(dict.lookup("flipNormals")); const bool flipNormals(dict.get<bool>("flipNormals"));
// What to extrude // What to extrude
const ExtrudeMode mode = ExtrudeModeNames.lookup const ExtrudeMode mode = ExtrudeModeNames.lookup
@ -983,8 +983,7 @@ int main(int argc, char *argv[])
// Merging front and back patch faces // Merging front and back patch faces
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Switch mergeFaces(dict.lookup("mergeFaces")); if (dict.get<bool>("mergeFaces"))
if (mergeFaces)
{ {
if (mode == MESH) if (mode == MESH)
{ {
@ -1009,7 +1008,6 @@ int main(int argc, char *argv[])
} }
polyTopoChanger stitcher(mesh); polyTopoChanger stitcher(mesh);
stitcher.setSize(1); stitcher.setSize(1);

View File

@ -1536,8 +1536,8 @@ int main(int argc, char *argv[])
mappedPatchBase::sampleMode sampleMode = mappedPatchBase::sampleMode sampleMode =
mappedPatchBase::sampleModeNames_[dict.lookup("sampleMode")]; mappedPatchBase::sampleModeNames_[dict.lookup("sampleMode")];
const Switch oneD(dict.lookup("oneD")); const bool oneD(dict.get<bool>("oneD"));
Switch oneDNonManifoldEdges(false); bool oneDNonManifoldEdges(false);
word oneDPatchType(emptyPolyPatch::typeName); word oneDPatchType(emptyPolyPatch::typeName);
if (oneD) if (oneD)
{ {
@ -1545,7 +1545,7 @@ int main(int argc, char *argv[])
dict.lookup("oneDPolyPatchType") >> oneDPatchType; dict.lookup("oneDPolyPatchType") >> oneDPatchType;
} }
const Switch adaptMesh(dict.lookup("adaptMesh")); const bool adaptMesh(dict.get<bool>("adaptMesh"));
if (hasZones) if (hasZones)
{ {

View File

@ -97,7 +97,7 @@ Foam::automatic::automatic
( (
const dictionary& cellSizeCalcTypeDict, const dictionary& cellSizeCalcTypeDict,
const triSurfaceMesh& surface, const triSurfaceMesh& surface,
const scalar& defaultCellSize const scalar defaultCellSize
) )
: :
cellSizeCalculationType cellSizeCalculationType
@ -109,12 +109,15 @@ Foam::automatic::automatic
), ),
coeffsDict_(cellSizeCalcTypeDict.optionalSubDict(typeName + "Coeffs")), coeffsDict_(cellSizeCalcTypeDict.optionalSubDict(typeName + "Coeffs")),
surfaceName_(surface.searchableSurface::name()), surfaceName_(surface.searchableSurface::name()),
readCurvature_(Switch(coeffsDict_.lookup("curvature"))),
curvatureFile_(coeffsDict_.lookup("curvatureFile")), readCurvature_(coeffsDict_.get<bool>("curvature")),
readFeatureProximity_(Switch(coeffsDict_.lookup("featureProximity"))), readFeatureProximity_(coeffsDict_.get<bool>("featureProximity")),
featureProximityFile_(coeffsDict_.lookup("featureProximityFile")), readInternalCloseness_(coeffsDict_.get<bool>("internalCloseness")),
readInternalCloseness_(Switch(coeffsDict_.lookup("internalCloseness"))),
internalClosenessFile_(coeffsDict_.lookup("internalClosenessFile")), curvatureFile_(coeffsDict_.get<word>("curvatureFile")),
featureProximityFile_(coeffsDict_.get<word>("featureProximityFile")),
internalClosenessFile_(coeffsDict_.get<word>("internalClosenessFile")),
curvatureCellSizeCoeff_ curvatureCellSizeCoeff_
( (
readScalar(coeffsDict_.lookup("curvatureCellSizeCoeff")) readScalar(coeffsDict_.lookup("curvatureCellSizeCoeff"))

View File

@ -37,7 +37,6 @@ SourceFiles
#include "cellSizeCalculationType.H" #include "cellSizeCalculationType.H"
#include "triSurfaceFields.H" #include "triSurfaceFields.H"
#include "PrimitivePatchInterpolation.H" #include "PrimitivePatchInterpolation.H"
#include "Switch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -54,9 +53,6 @@ class automatic
: :
public cellSizeCalculationType public cellSizeCalculationType
{ {
private:
// Private data // Private data
//- Dictionary of coefficients for automatic cell sizing //- Dictionary of coefficients for automatic cell sizing
@ -65,13 +61,12 @@ private:
//- Name of the surface. Used to write the cell size field //- Name of the surface. Used to write the cell size field
const fileName surfaceName_; const fileName surfaceName_;
const Switch readCurvature_; const bool readCurvature_;
const bool readFeatureProximity_;
const bool readInternalCloseness_;
const word curvatureFile_; const word curvatureFile_;
const Switch readFeatureProximity_;
const word featureProximityFile_; const word featureProximityFile_;
const Switch readInternalCloseness_;
const word internalClosenessFile_; const word internalClosenessFile_;
//- The curvature values are multiplied by the inverse of this value to //- The curvature values are multiplied by the inverse of this value to
@ -100,13 +95,12 @@ public:
( (
const dictionary& cellSizeCalcTypeDict, const dictionary& cellSizeCalcTypeDict,
const triSurfaceMesh& surface, const triSurfaceMesh& surface,
const scalar& defaultCellSize const scalar defaultCellSize
); );
//- Destructor //- Destructor
virtual ~automatic() virtual ~automatic() = default;
{}
// Member Functions // Member Functions

View File

@ -42,43 +42,30 @@ Foam::cvControls::cvControls
foamyHexMeshDict_.subDict("surfaceConformation") foamyHexMeshDict_.subDict("surfaceConformation")
); );
pointPairDistanceCoeff_ = readScalar pointPairDistanceCoeff_ =
( surfDict.get<scalar>("pointPairDistanceCoeff");
surfDict.lookup("pointPairDistanceCoeff")
);
mixedFeaturePointPPDistanceCoeff_ = readScalar mixedFeaturePointPPDistanceCoeff_ =
( surfDict.get<scalar>("mixedFeaturePointPPDistanceCoeff");
surfDict.lookup("mixedFeaturePointPPDistanceCoeff")
);
featurePointExclusionDistanceCoeff_ = readScalar featurePointExclusionDistanceCoeff_ =
( surfDict.get<scalar>("featurePointExclusionDistanceCoeff");
surfDict.lookup("featurePointExclusionDistanceCoeff")
);
featureEdgeExclusionDistanceCoeff_ = readScalar featureEdgeExclusionDistanceCoeff_ =
( surfDict.get<scalar>("featureEdgeExclusionDistanceCoeff");
surfDict.lookup("featureEdgeExclusionDistanceCoeff")
);
surfaceSearchDistanceCoeff_ =
surfDict.get<scalar>("surfaceSearchDistanceCoeff");
surfaceSearchDistanceCoeff_ = readScalar maxSurfaceProtrusionCoeff_ =
( surfDict.get<scalar>("maxSurfaceProtrusionCoeff");
surfDict.lookup("surfaceSearchDistanceCoeff")
);
maxSurfaceProtrusionCoeff_ = readScalar maxQuadAngle_ = surfDict.get<scalar>("maxQuadAngle");
(
surfDict.lookup("maxSurfaceProtrusionCoeff")
);
maxQuadAngle_ = readScalar(surfDict.lookup("maxQuadAngle"));
surfaceConformationRebuildFrequency_ = max surfaceConformationRebuildFrequency_ = max
( (
1, 1,
readLabel(surfDict.lookup("surfaceConformationRebuildFrequency")) surfDict.get<label>("surfaceConformationRebuildFrequency")
); );
@ -87,33 +74,23 @@ Foam::cvControls::cvControls
surfDict.subDict("featurePointControls") surfDict.subDict("featurePointControls")
); );
specialiseFeaturePoints_ = Switch specialiseFeaturePoints_ =
( featurePointControlsDict.get<Switch>("specialiseFeaturePoints");
featurePointControlsDict.lookup("specialiseFeaturePoints")
);
guardFeaturePoints_ = Switch guardFeaturePoints_ =
( featurePointControlsDict.get<Switch>("guardFeaturePoints");
featurePointControlsDict.lookup("guardFeaturePoints")
);
edgeAiming_ = Switch edgeAiming_ =
( featurePointControlsDict.get<Switch>("edgeAiming");
featurePointControlsDict.lookup("edgeAiming")
);
if (!guardFeaturePoints_) if (!guardFeaturePoints_)
{ {
snapFeaturePoints_ = Switch snapFeaturePoints_ =
( featurePointControlsDict.get<Switch>("snapFeaturePoints");
featurePointControlsDict.lookup("snapFeaturePoints")
);
} }
circulateEdges_ = Switch circulateEdges_ =
( featurePointControlsDict.get<Switch>("circulateEdges");
featurePointControlsDict.lookup("circulateEdges")
);
// Controls for coarse surface conformation // Controls for coarse surface conformation
@ -122,62 +99,47 @@ Foam::cvControls::cvControls
surfDict.subDict("conformationControls") surfDict.subDict("conformationControls")
); );
surfacePtExclusionDistanceCoeff_ = readScalar surfacePtExclusionDistanceCoeff_ =
( conformationControlsDict.get<scalar>("surfacePtExclusionDistanceCoeff");
conformationControlsDict.lookup("surfacePtExclusionDistanceCoeff")
);
edgeSearchDistCoeffSqr_ = sqr edgeSearchDistCoeffSqr_ = sqr
( (
readScalar conformationControlsDict.get<scalar>("edgeSearchDistCoeff")
(
conformationControlsDict.lookup("edgeSearchDistCoeff")
)
); );
surfacePtReplaceDistCoeffSqr_ = sqr surfacePtReplaceDistCoeffSqr_ = sqr
( (
readScalar conformationControlsDict.get<scalar>("surfacePtReplaceDistCoeff")
(
conformationControlsDict.lookup("surfacePtReplaceDistCoeff")
)
); );
maxConformationIterations_ = readLabel maxConformationIterations_ =
( conformationControlsDict.get<label>("maxIterations");
conformationControlsDict.lookup("maxIterations")
);
iterationToInitialHitRatioLimit_ = readScalar iterationToInitialHitRatioLimit_ =
( conformationControlsDict.get<scalar>("iterationToInitialHitRatioLimit");
conformationControlsDict.lookup("iterationToInitialHitRatioLimit")
);
// Motion control controls // Motion control controls
const dictionary& motionDict(foamyHexMeshDict_.subDict("motionControl")); const dictionary& motionDict(foamyHexMeshDict_.subDict("motionControl"));
defaultCellSize_ = readScalar(motionDict.lookup("defaultCellSize")); defaultCellSize_ = motionDict.get<scalar>("defaultCellSize");
minimumCellSize_ = minimumCellSize_ =
readScalar(motionDict.lookup("minimumCellSizeCoeff"))*defaultCellSize_; motionDict.get<scalar>("minimumCellSizeCoeff")*defaultCellSize_;
objOutput_ = Switch(motionDict.lookupOrDefault<Switch>("objOutput", false)); objOutput_ =
motionDict.lookupOrDefault<Switch>("objOutput", false);
timeChecks_ = Switch timeChecks_ =
( motionDict.lookupOrDefault<Switch>("timeChecks", false);
motionDict.lookupOrDefault<Switch>("timeChecks", false)
);
printVertexInfo_ = Switch printVertexInfo_ =
( motionDict.lookupOrDefault<Switch>("printVertexInfo", false);
motionDict.lookupOrDefault<Switch>("printVertexInfo", false)
);
if (Pstream::parRun()) if (Pstream::parRun())
{ {
maxLoadUnbalance_ = readScalar(motionDict.lookup("maxLoadUnbalance")); maxLoadUnbalance_ = motionDict.get<scalar>("maxLoadUnbalance");
} }
else else
{ {
@ -186,7 +148,7 @@ Foam::cvControls::cvControls
cosAlignmentAcceptanceAngle_ = cos cosAlignmentAcceptanceAngle_ = cos
( (
degToRad(readScalar(motionDict.lookup("alignmentAcceptanceAngle"))) degToRad(motionDict.get<scalar>("alignmentAcceptanceAngle"))
); );
@ -197,19 +159,15 @@ Foam::cvControls::cvControls
motionDict.subDict("pointInsertionCriteria") motionDict.subDict("pointInsertionCriteria")
); );
insertionDistCoeff_ = readScalar insertionDistCoeff_ =
( insertionDict.get<scalar>("cellCentreDistCoeff");
insertionDict.lookup("cellCentreDistCoeff")
);
faceAreaRatioCoeff_ = readScalar faceAreaRatioCoeff_ =
( insertionDict.get<scalar>("faceAreaRatioCoeff");
insertionDict.lookup("faceAreaRatioCoeff")
);
cosInsertionAcceptanceAngle_ = cos cosInsertionAcceptanceAngle_ = cos
( (
degToRad(readScalar(insertionDict.lookup("acceptanceAngle"))) degToRad(insertionDict.get<scalar>("acceptanceAngle"))
); );
// Point removal criteria // Point removal criteria
@ -219,10 +177,8 @@ Foam::cvControls::cvControls
motionDict.subDict("pointRemovalCriteria") motionDict.subDict("pointRemovalCriteria")
); );
removalDistCoeff_ = readScalar removalDistCoeff_ =
( removalDict.get<scalar>("cellCentreDistCoeff");
removalDict.lookup("cellCentreDistCoeff")
);
// polyMesh filtering controls // polyMesh filtering controls
@ -231,34 +187,31 @@ Foam::cvControls::cvControls
foamyHexMeshDict_.subDict("polyMeshFiltering") foamyHexMeshDict_.subDict("polyMeshFiltering")
); );
filterEdges_ = Switch filterEdges_ =
( filteringDict.lookupOrDefault<Switch>("filterEdges", true);
filteringDict.lookupOrDefault<Switch>("filterEdges", true)
);
filterFaces_ = Switch filterFaces_ =
( filteringDict.lookupOrDefault<Switch>("filterFaces", false);
filteringDict.lookupOrDefault<Switch>("filterFaces", false)
);
if (filterFaces_) if (filterFaces_)
{ {
filterEdges_ = Switch::ON; filterEdges_ = filterFaces_;
} }
writeTetDualMesh_ = Switch(filteringDict.lookup("writeTetDualMesh")); writeTetDualMesh_ =
filteringDict.get<Switch>("writeTetDualMesh");
writeCellShapeControlMesh_ = writeCellShapeControlMesh_ =
Switch(filteringDict.lookup("writeCellShapeControlMesh")); filteringDict.get<Switch>("writeCellShapeControlMesh");
if (Pstream::parRun()) if (Pstream::parRun())
{ {
writeBackgroundMeshDecomposition_ = writeBackgroundMeshDecomposition_ =
Switch(filteringDict.lookup("writeBackgroundMeshDecomposition")); filteringDict.get<Switch>("writeBackgroundMeshDecomposition");
} }
else else
{ {
writeBackgroundMeshDecomposition_ = Switch(false); writeBackgroundMeshDecomposition_ = Switch::FALSE;
} }
} }

View File

@ -58,13 +58,10 @@ Foam::initialPointsMethod::initialPointsMethod
( (
sqr sqr
( (
readScalar initialPointsDict.get<scalar>("minimumSurfaceDistanceCoeff")
(
initialPointsDict.lookup("minimumSurfaceDistanceCoeff")
)
) )
), ),
fixInitialPoints_(Switch(initialPointsDict.lookup("fixInitialPoints"))) fixInitialPoints_(initialPointsDict.get<bool>("fixInitialPoints"))
{} {}
@ -80,7 +77,7 @@ Foam::autoPtr<Foam::initialPointsMethod> Foam::initialPointsMethod::New
const autoPtr<backgroundMeshDecomposition>& decomposition const autoPtr<backgroundMeshDecomposition>& decomposition
) )
{ {
const word methodName(initialPointsDict.lookup("initialPointsMethod")); const word methodName(initialPointsDict.get<word>("initialPointsMethod"));
Info<< nl << "Selecting initialPointsMethod " Info<< nl << "Selecting initialPointsMethod "
<< methodName << endl; << methodName << endl;

View File

@ -40,7 +40,6 @@ SourceFiles
#include "backgroundMeshDecomposition.H" #include "backgroundMeshDecomposition.H"
#include "dictionary.H" #include "dictionary.H"
#include "Random.H" #include "Random.H"
#include "Switch.H"
#include "autoPtr.H" #include "autoPtr.H"
#include "runTimeSelectionTables.H" #include "runTimeSelectionTables.H"
@ -80,7 +79,7 @@ protected:
// the local target cell size. Store square of value. // the local target cell size. Store square of value.
scalar minimumSurfaceDistanceCoeffSqr_; scalar minimumSurfaceDistanceCoeffSqr_;
Switch fixInitialPoints_; bool fixInitialPoints_;
private: private:
@ -194,7 +193,7 @@ public:
return detailsDict_; return detailsDict_;
} }
Switch fixInitialPoints() const bool fixInitialPoints() const
{ {
return fixInitialPoints_; return fixInitialPoints_;
} }

View File

@ -81,7 +81,7 @@ int main(int argc, char *argv[])
); );
const dictionary& extrusionDict(controlDict.subDict("extrusion")); const dictionary& extrusionDict(controlDict.subDict("extrusion"));
Switch extrude(extrusionDict.lookup("extrude")); const bool extrude = extrusionDict.get<bool>("extrude");
const bool overwrite = args.found("overwrite"); const bool overwrite = args.found("overwrite");
// Read and triangulation // Read and triangulation

View File

@ -141,12 +141,13 @@ autoPtr<refinementSurfaces> createRefinementSurfaces
// Invert surfaceCellSize to get the refinementLevel // Invert surfaceCellSize to get the refinementLevel
const word scsFuncName = const word scsFuncName =
shapeDict.lookup("surfaceCellSizeFunction"); shapeDict.get<word>("surfaceCellSizeFunction");
const dictionary& scsDict = const dictionary& scsDict =
shapeDict.optionalSubDict(scsFuncName + "Coeffs"); shapeDict.optionalSubDict(scsFuncName + "Coeffs");
const scalar surfaceCellSize = const scalar surfaceCellSize =
readScalar(scsDict.lookup("surfaceCellSizeCoeff")); scsDict.get<scalar>("surfaceCellSizeCoeff");
const label refLevel = sizeCoeffToRefinement const label refLevel = sizeCoeffToRefinement
( (
@ -222,7 +223,7 @@ autoPtr<refinementSurfaces> createRefinementSurfaces
); );
const word scsFuncName = const word scsFuncName =
shapeControlRegionDict.lookup shapeControlRegionDict.get<word>
( (
"surfaceCellSizeFunction" "surfaceCellSizeFunction"
); );
@ -233,10 +234,7 @@ autoPtr<refinementSurfaces> createRefinementSurfaces
); );
const scalar surfaceCellSize = const scalar surfaceCellSize =
readScalar scsDict.get<scalar>("surfaceCellSizeCoeff");
(
scsDict.lookup("surfaceCellSizeCoeff")
);
const label refLevel = sizeCoeffToRefinement const label refLevel = sizeCoeffToRefinement
( (
@ -780,10 +778,10 @@ int main(int argc, char *argv[])
const scalar mergeDist = getMergeDistance const scalar mergeDist = getMergeDistance
( (
mesh, mesh,
readScalar(meshDict.lookup("mergeTolerance")) meshDict.get<scalar>("mergeTolerance")
); );
const Switch keepPatches(meshDict.lookupOrDefault("keepPatches", false)); const bool keepPatches(meshDict.lookupOrDefault("keepPatches", false));
// Read decomposePar dictionary // Read decomposePar dictionary
@ -958,7 +956,7 @@ int main(int argc, char *argv[])
// Calculate current ratio of hex cells v.s. wanted cell size // Calculate current ratio of hex cells v.s. wanted cell size
const scalar defaultCellSize = const scalar defaultCellSize =
readScalar(motionDict.lookup("defaultCellSize")); motionDict.get<scalar>("defaultCellSize");
const scalar initialCellSize = ::pow(meshPtr().V()[0], 1.0/3.0); const scalar initialCellSize = ::pow(meshPtr().V()[0], 1.0/3.0);
@ -1020,7 +1018,7 @@ int main(int argc, char *argv[])
if (patchInfo.set(globalRegioni)) if (patchInfo.set(globalRegioni))
{ {
patchTypes[geomi][regioni] = patchTypes[geomi][regioni] =
word(patchInfo[globalRegioni].lookup("type")); patchInfo[globalRegioni].get<word>("type");
} }
else else
{ {
@ -1449,11 +1447,11 @@ int main(int argc, char *argv[])
// Now do the real work -refinement -snapping -layers // Now do the real work -refinement -snapping -layers
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
const Switch wantRefine(meshDict.lookup("castellatedMesh")); const bool wantRefine(meshDict.get<bool>("castellatedMesh"));
const Switch wantSnap(meshDict.lookup("snap")); const bool wantSnap(meshDict.get<bool>("snap"));
const Switch wantLayers(meshDict.lookup("addLayers")); const bool wantLayers(meshDict.get<bool>("addLayers"));
const Switch mergePatchFaces const bool mergePatchFaces
( (
meshDict.lookupOrDefault("mergePatchFaces", true) meshDict.lookupOrDefault("mergePatchFaces", true)
); );

View File

@ -444,16 +444,16 @@ int main(int argc, char *argv[])
const word dictName("createBafflesDict"); const word dictName("createBafflesDict");
#include "setSystemMeshDictionaryIO.H" #include "setSystemMeshDictionaryIO.H"
Switch internalFacesOnly(false); bool internalFacesOnly(false);
Switch noFields(false); bool noFields(false);
PtrList<faceSelection> selectors; PtrList<faceSelection> selectors;
{ {
Info<< "Reading baffle criteria from " << dictName << nl << endl; Info<< "Reading baffle criteria from " << dictName << nl << endl;
IOdictionary dict(dictIO); IOdictionary dict(dictIO);
dict.lookup("internalFacesOnly") >> internalFacesOnly; internalFacesOnly = dict.get<bool>("internalFacesOnly");
noFields = dict.lookupOrDefault("noFields", false); noFields = dict.lookupOrDefault("noFields", false);
const dictionary& selectionsDict = dict.subDict("baffles"); const dictionary& selectionsDict = dict.subDict("baffles");
@ -717,10 +717,9 @@ int main(int argc, char *argv[])
// master and slave in different groupNames // master and slave in different groupNames
// (ie 3D thermal baffles) // (ie 3D thermal baffles)
Switch sameGroup const bool sameGroup =
( patchSource.lookupOrDefault("sameGroup", true);
patchSource.lookupOrDefault("sameGroup", true)
);
if (!sameGroup) if (!sameGroup)
{ {
groupNameMaster = groupName + "Group_master"; groupNameMaster = groupName + "Group_master";
@ -800,7 +799,6 @@ int main(int argc, char *argv[])
} }
createFaces createFaces
( (
internalFacesOnly, internalFacesOnly,
@ -897,10 +895,8 @@ int main(int argc, char *argv[])
{ {
const dictionary& patchSource = dict.subDict("patchPairs"); const dictionary& patchSource = dict.subDict("patchPairs");
Switch sameGroup const bool sameGroup =
( patchSource.lookupOrDefault("sameGroup", true);
patchSource.lookupOrDefault("sameGroup", true)
);
const word& groupName = selectors[selectorI].name(); const word& groupName = selectors[selectorI].name();

View File

@ -41,7 +41,6 @@ SourceFiles
#include "autoPtr.H" #include "autoPtr.H"
#include "boolList.H" #include "boolList.H"
#include "labelList.H" #include "labelList.H"
#include "Switch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -71,7 +70,7 @@ protected:
const dictionary dict_; const dictionary dict_;
//- Switch direction? //- Switch direction?
const Switch flip_; const bool flip_;
public: public:

View File

@ -540,8 +540,7 @@ int main(int argc, char *argv[])
IOdictionary dict(dictIO); IOdictionary dict(dictIO);
// Whether to synchronise points // Whether to synchronise points
const Switch pointSync(dict.lookup("pointSync")); const bool pointSync(dict.get<bool>("pointSync"));
const polyBoundaryMesh& patches = mesh.boundaryMesh(); const polyBoundaryMesh& patches = mesh.boundaryMesh();

View File

@ -37,7 +37,6 @@ Description
#include "triSurfaceSearch.H" #include "triSurfaceSearch.H"
#include "argList.H" #include "argList.H"
#include "Fstream.H" #include "Fstream.H"
#include "Switch.H"
#include "IOdictionary.H" #include "IOdictionary.H"
#include "boundBox.H" #include "boundBox.H"
#include "indexedOctree.H" #include "indexedOctree.H"
@ -102,10 +101,8 @@ int main(int argc, char *argv[])
<< exit(FatalError); << exit(FatalError);
} }
Switch addFaceNeighbours const bool addFaceNeighbours =
( meshSubsetDict.get<bool>("addFaceNeighbours");
meshSubsetDict.lookup("addFaceNeighbours")
);
const bool invertSelection = const bool invertSelection =
meshSubsetDict.lookupOrDefault("invertSelection", false); meshSubsetDict.lookupOrDefault("invertSelection", false);
@ -231,7 +228,7 @@ int main(int argc, char *argv[])
fileName surfName(surfDict.lookup("name")); fileName surfName(surfDict.lookup("name"));
Switch outside(surfDict.lookup("outside")); const bool outside(surfDict.get<bool>("outside"));
if (outside) if (outside)
{ {

View File

@ -203,7 +203,7 @@ void Foam::dynamicRefineFvMesh::readDict()
correctFluxes_.insert(fluxVelocities[i][0], fluxVelocities[i][1]); correctFluxes_.insert(fluxVelocities[i][0], fluxVelocities[i][1]);
} }
dumpLevel_ = Switch(refineDict.lookup("dumpLevel")); dumpLevel_ = refineDict.get<bool>("dumpLevel");
} }

View File

@ -71,7 +71,6 @@ SourceFiles
#include "dynamicFvMesh.H" #include "dynamicFvMesh.H"
#include "hexRef8.H" #include "hexRef8.H"
#include "bitSet.H" #include "bitSet.H"
#include "Switch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -92,7 +91,7 @@ protected:
hexRef8 meshCutter_; hexRef8 meshCutter_;
//- Dump cellLevel for post-processing //- Dump cellLevel for post-processing
Switch dumpLevel_; bool dumpLevel_;
//- Fluxes to map //- Fluxes to map
HashTable<word> correctFluxes_; HashTable<word> correctFluxes_;

View File

@ -266,7 +266,7 @@ Foam::attachDetach::attachDetach
const polyTopoChanger& mme const polyTopoChanger& mme
) )
: :
polyMeshModifier(name, index, mme, Switch(dict.lookup("active"))), polyMeshModifier(name, index, mme, dict.get<bool>("active")),
faceZoneID_ faceZoneID_
( (
dict.lookup("faceZoneName"), dict.lookup("faceZoneName"),

View File

@ -140,7 +140,7 @@ Foam::layerAdditionRemoval::layerAdditionRemoval
const word& zoneName, const word& zoneName,
const scalar minThickness, const scalar minThickness,
const scalar maxThickness, const scalar maxThickness,
const Switch thicknessFromVolume const bool thicknessFromVolume
) )
: :
polyMeshModifier(name, index, ptc, true), polyMeshModifier(name, index, ptc, true),
@ -166,14 +166,11 @@ Foam::layerAdditionRemoval::layerAdditionRemoval
const polyTopoChanger& ptc const polyTopoChanger& ptc
) )
: :
polyMeshModifier(name, index, ptc, Switch(dict.lookup("active"))), polyMeshModifier(name, index, ptc, dict.get<bool>("active")),
faceZoneID_(dict.lookup("faceZoneName"), ptc.mesh().faceZones()), faceZoneID_(dict.lookup("faceZoneName"), ptc.mesh().faceZones()),
minLayerThickness_(readScalar(dict.lookup("minLayerThickness"))), minLayerThickness_(readScalar(dict.lookup("minLayerThickness"))),
maxLayerThickness_(readScalar(dict.lookup("maxLayerThickness"))), maxLayerThickness_(readScalar(dict.lookup("maxLayerThickness"))),
thicknessFromVolume_ thicknessFromVolume_(dict.lookupOrDefault("thicknessFromVolume", true)),
(
dict.lookupOrDefault<Switch>("thicknessFromVolume", true)
),
oldLayerThickness_(readOldThickness(dict)), oldLayerThickness_(readOldThickness(dict)),
pointsPairingPtr_(nullptr), pointsPairingPtr_(nullptr),
facesPairingPtr_(nullptr), facesPairingPtr_(nullptr),

View File

@ -158,7 +158,7 @@ public:
const word& zoneName, const word& zoneName,
const scalar minThickness, const scalar minThickness,
const scalar maxThickness, const scalar maxThickness,
const Switch thicknessFromVolume = true const bool thicknessFromVolume = true
); );
//- Construct from dictionary //- Construct from dictionary

View File

@ -31,7 +31,6 @@ License
#include "OFstream.H" #include "OFstream.H"
#include "meshTools.H" #include "meshTools.H"
#include "hexMatcher.H" #include "hexMatcher.H"
#include "Switch.H"
#include "globalMeshData.H" #include "globalMeshData.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -371,7 +370,7 @@ Foam::directions::directions
<< tan1 << endl << endl; << tan1 << endl << endl;
} }
Switch useTopo(dict.lookup("useHexTopology")); const bool useTopo(dict.get<bool>("useHexTopology"));
vectorField normalDirs; vectorField normalDirs;
vectorField tan1Dirs; vectorField tan1Dirs;

View File

@ -450,7 +450,7 @@ void Foam::multiDirRefinement::refineFromDict
) )
{ {
// How to walk cell circumference. // How to walk cell circumference.
Switch pureGeomCut(dict.lookup("geometricCut")); const bool pureGeomCut(dict.get<bool>("geometricCut"));
autoPtr<cellLooper> cellWalker; autoPtr<cellLooper> cellWalker;
if (pureGeomCut) if (pureGeomCut)
@ -486,9 +486,9 @@ Foam::multiDirRefinement::multiDirRefinement
cellLabels_(cellLabels), cellLabels_(cellLabels),
addedCells_(mesh.nCells()) addedCells_(mesh.nCells())
{ {
Switch useHex(dict.lookup("useHexTopology")); const bool useHex(dict.get<bool>("useHexTopology"));
Switch writeMesh(dict.lookup("writeMesh")); const bool writeMesh(dict.get<bool>("writeMesh"));
wordList dirNames(dict.lookup("directions")); wordList dirNames(dict.lookup("directions"));
@ -529,9 +529,9 @@ Foam::multiDirRefinement::multiDirRefinement
cellLabels_(cellLabels), cellLabels_(cellLabels),
addedCells_(mesh.nCells()) addedCells_(mesh.nCells())
{ {
Switch useHex(dict.lookup("useHexTopology")); const bool useHex(dict.get<bool>("useHexTopology"));
Switch writeMesh(dict.lookup("writeMesh")); const bool writeMesh(dict.get<bool>("writeMesh"));
wordList dirNames(dict.lookup("directions")); wordList dirNames(dict.lookup("directions"));

View File

@ -56,7 +56,7 @@ Foam::setUpdater::setUpdater
const polyTopoChanger& mme const polyTopoChanger& mme
) )
: :
polyMeshModifier(name, index, mme, Switch(dict.lookup("active"))) polyMeshModifier(name, index, mme, dict.get<bool>("active"))
{} {}

View File

@ -210,7 +210,7 @@ Foam::slidingInterface::slidingInterface
const polyTopoChanger& mme const polyTopoChanger& mme
) )
: :
polyMeshModifier(name, index, mme, Switch(dict.lookup("active"))), polyMeshModifier(name, index, mme, dict.get<bool>("active")),
masterFaceZoneID_ masterFaceZoneID_
( (
dict.lookup("masterFaceZoneName"), dict.lookup("masterFaceZoneName"),

View File

@ -179,10 +179,10 @@ void Foam::faSchemes::read(const dictionary& dict)
if if
( (
fluxRequired_.found("default") fluxRequired_.found("default")
&& word(fluxRequired_.lookup("default")) != "none" && fluxRequired_.get<word>("default") != "none"
) )
{ {
defaultFluxRequired_ = Switch(fluxRequired_.lookup("default")); defaultFluxRequired_ = fluxRequired_.get<bool>("default");
} }
} }
} }

View File

@ -181,10 +181,10 @@ void Foam::fvSchemes::read(const dictionary& dict)
if if
( (
fluxRequired_.found("default") fluxRequired_.found("default")
&& word(fluxRequired_.lookup("default")) != "none" && fluxRequired_.get<word>("default") != "none"
) )
{ {
defaultFluxRequired_ = Switch(fluxRequired_.lookup("default")); defaultFluxRequired_ = fluxRequired_.get<bool>("default");
} }
} }
} }

View File

@ -1114,7 +1114,7 @@ Foam::InteractionLists<ParticleType>::InteractionLists
( (
const polyMesh& mesh, const polyMesh& mesh,
scalar maxDistance, scalar maxDistance,
Switch writeCloud, bool writeCloud,
const word& UName const word& UName
) )
: :

View File

@ -89,7 +89,7 @@ class InteractionLists
//- Switch controlling whether or not the cloud gets populated //- Switch controlling whether or not the cloud gets populated
// with the referred particles, hence gets written out // with the referred particles, hence gets written out
const Switch writeCloud_; const bool writeCloud_;
//- mapDistribute to exchange referred particles into referred cells //- mapDistribute to exchange referred particles into referred cells
autoPtr<mapDistribute> cellMapPtr_; autoPtr<mapDistribute> cellMapPtr_;
@ -218,7 +218,7 @@ public:
( (
const polyMesh& mesh, const polyMesh& mesh,
scalar maxDistance, scalar maxDistance,
Switch writeCloud = false, bool writeCloud = false,
const word& UName = "U" const word& UName = "U"
); );

View File

@ -553,13 +553,10 @@ Foam::PairCollision<CloudType>::PairCollision
( (
owner.mesh(), owner.mesh(),
readScalar(this->coeffDict().lookup("maxInteractionDistance")), readScalar(this->coeffDict().lookup("maxInteractionDistance")),
Switch this->coeffDict().lookupOrDefault
( (
this->coeffDict().lookupOrDefault "writeReferredParticleCloud",
( false
"writeReferredParticleCloud",
false
)
), ),
this->coeffDict().lookupOrDefault("U", word("U")) this->coeffDict().lookupOrDefault("U", word("U"))
) )

View File

@ -64,7 +64,7 @@ bool Foam::MultiInteraction<CloudType>::read(const dictionary& dict)
} }
} }
oneInteractionOnly_ = Switch(dict.lookup("oneInteractionOnly")); oneInteractionOnly_ = dict.get<bool>("oneInteractionOnly");
if (oneInteractionOnly_) if (oneInteractionOnly_)
{ {

View File

@ -94,7 +94,7 @@ class MultiInteraction
{ {
// Private data // Private data
Switch oneInteractionOnly_; bool oneInteractionOnly_;
//- Submodels //- Submodels
PtrList<PatchInteractionModel<CloudType>> models_; PtrList<PatchInteractionModel<CloudType>> models_;

View File

@ -59,7 +59,7 @@ correlationFunction<vector> vacf
molecules.size() molecules.size()
); );
bool writeVacf(Switch(velocityACFDict.lookup("writeFile"))); bool writeVacf(velocityACFDict.get<bool>("writeFile"));
//- Pressure autocorrelation function //- Pressure autocorrelation function
@ -77,7 +77,7 @@ correlationFunction<vector> pacf
1 1
); );
bool writePacf(Switch(pressureACFDict.lookup("writeFile"))); bool writePacf(pressureACFDict.get<bool>("writeFile"));
//- Heat flux autocorrelation function //- Heat flux autocorrelation function
@ -95,4 +95,4 @@ correlationFunction<vector> hfacf
1 1
); );
bool writeHFacf(Switch(heatFluxACFDict.lookup("writeFile"))); bool writeHFacf(heatFluxACFDict.get<bool>("writeFile"));

View File

@ -68,7 +68,7 @@ Foam::pairPotential::pairPotential
forceLookup_(0), forceLookup_(0),
energyLookup_(0), energyLookup_(0),
esfPtr_(nullptr), esfPtr_(nullptr),
writeTables_(Switch(pairPotentialProperties_.lookup("writeTables"))) writeTables_(pairPotentialProperties_.get<bool>("writeTables"))
{} {}

View File

@ -54,4 +54,5 @@ inline bool Foam::pairPotential::writeTables() const
return writeTables_; return writeTables_;
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -301,7 +301,10 @@ Foam::ORourkeCollision<CloudType>::ORourkeCollision
( (
owner.db().template lookupObject<SLGThermo>("SLGThermo").liquids() owner.db().template lookupObject<SLGThermo>("SLGThermo").liquids()
), ),
coalescence_(this->coeffDict().lookup("coalescence")) coalescence_
(
this->coeffDict().template get<bool>("coalescence")
)
{} {}

View File

@ -58,8 +58,8 @@ protected:
const liquidMixtureProperties& liquids_; const liquidMixtureProperties& liquids_;
//- Coalescence activation switch //- Coalescence activated?
Switch coalescence_; bool coalescence_;
// Protected Member Functions // Protected Member Functions

View File

@ -36,7 +36,6 @@ Description
#include "point.H" #include "point.H"
#include "extrudeModel.H" #include "extrudeModel.H"
#include "Switch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -73,7 +72,7 @@ class offsetSurface
autoPtr<triSurfaceSearch> offsetSearchPtr_; autoPtr<triSurfaceSearch> offsetSearchPtr_;
// Whether to re-project onto offsetted surface // Whether to re-project onto offsetted surface
const Switch project_; const bool project_;
public: public:

View File

@ -398,7 +398,7 @@ Foam::regionModels::regionModel::regionModel
), ),
primaryMesh_(mesh), primaryMesh_(mesh),
time_(mesh.time()), time_(mesh.time()),
active_(lookup("active")), active_(get<Switch>("active")),
infoOutput_(true), infoOutput_(true),
modelName_(modelName), modelName_(modelName),
regionMeshPtr_(nullptr), regionMeshPtr_(nullptr),
@ -446,7 +446,7 @@ Foam::regionModels::regionModel::regionModel
), ),
primaryMesh_(mesh), primaryMesh_(mesh),
time_(mesh.time()), time_(mesh.time()),
active_(dict.lookup("active")), active_(dict.get<Switch>("active")),
infoOutput_(false), infoOutput_(false),
modelName_(modelName), modelName_(modelName),
regionMeshPtr_(nullptr), regionMeshPtr_(nullptr),

View File

@ -55,8 +55,8 @@ Foam::structuredRenumber::structuredRenumber
methodDict_(renumberDict.optionalSubDict(typeName + "Coeffs")), methodDict_(renumberDict.optionalSubDict(typeName + "Coeffs")),
patches_(methodDict_.lookup("patches")), patches_(methodDict_.lookup("patches")),
nLayers_(methodDict_.lookupOrDefault<label>("nLayers", labelMax)), nLayers_(methodDict_.lookupOrDefault<label>("nLayers", labelMax)),
depthFirst_(methodDict_.lookup("depthFirst")), depthFirst_(methodDict_.get<bool>("depthFirst")),
reverse_(methodDict_.lookup("reverse")), reverse_(methodDict_.get<bool>("reverse")),
method_(renumberMethod::New(methodDict_)) method_(renumberMethod::New(methodDict_))
{} {}

View File

@ -42,7 +42,6 @@ SourceFiles
#include "renumberMethod.H" #include "renumberMethod.H"
#include "topoDistanceData.H" #include "topoDistanceData.H"
#include "Switch.H"
namespace Foam namespace Foam
{ {
@ -63,7 +62,7 @@ public:
// column and layer // column and layer
class layerLess class layerLess
{ {
const Switch depthFirst_; const bool depthFirst_;
const labelList& order_; const labelList& order_;
const List<topoDistanceData>& distance_; const List<topoDistanceData>& distance_;
@ -71,7 +70,7 @@ public:
layerLess layerLess
( (
const Switch depthFirst, const bool depthFirst,
const labelList& order, const labelList& order,
const List<topoDistanceData>& distance const List<topoDistanceData>& distance
) )
@ -93,9 +92,9 @@ public:
const label nLayers_; const label nLayers_;
const Switch depthFirst_; const bool depthFirst_;
const Switch reverse_; const bool reverse_;
const autoPtr<renumberMethod> method_; const autoPtr<renumberMethod> method_;

View File

@ -85,7 +85,7 @@ class sampledDistanceSurface
// Private data // Private data
//- Whether to recalculate cell values as average of point values //- Whether to recalculate cell values as average of point values
const Switch average_; const bool average_;
//- Track if the surface needs an update //- Track if the surface needs an update
mutable bool needsUpdate_; mutable bool needsUpdate_;

View File

@ -98,11 +98,11 @@ class sampledIsoSurface
//- Merge tolerance //- Merge tolerance
const scalar mergeTol_; const scalar mergeTol_;
//- Whether to coarse //- Whether to coarsen
const Switch regularise_; const bool regularise_;
//- Whether to recalculate cell values as average of point values //- Whether to recalculate cell values as average of point values
const Switch average_; const bool average_;
//- Zone name/index (if restricted to zones) //- Zone name/index (if restricted to zones)
mutable cellZoneID zoneID_; mutable cellZoneID zoneID_;

View File

@ -97,10 +97,10 @@ class sampledIsoSurfaceCell
const boundBox bounds_; const boundBox bounds_;
//- Whether to coarse //- Whether to coarse
const Switch regularise_; const bool regularise_;
//- Whether to recalculate cell values as average of point values //- Whether to recalculate cell values as average of point values
const Switch average_; const bool average_;
//- If restricted to zones, name of this zone or a regular expression //- If restricted to zones, name of this zone or a regular expression
keyType zoneKey_; keyType zoneKey_;

View File

@ -102,10 +102,10 @@ class sampledCuttingPlane
const scalar mergeTol_; const scalar mergeTol_;
//- Whether to coarsen //- Whether to coarsen
const Switch regularise_; const bool regularise_;
//- Whether to recalculate cell values as average of point values //- Whether to recalculate cell values as average of point values
const Switch average_; const bool average_;
//- Zone name/index (if restricted to zones) //- Zone name/index (if restricted to zones)
mutable cellZoneID zoneID_; mutable cellZoneID zoneID_;

View File

@ -66,7 +66,7 @@ Foam::distanceSurface::distanceSurface
) )
), ),
distance_(readScalar(dict.lookup("distance"))), distance_(readScalar(dict.lookup("distance"))),
signed_(readBool(dict.lookup("signed"))), signed_(dict.get<bool>("signed")),
cell_(dict.lookupOrDefault("cell", true)), cell_(dict.lookupOrDefault("cell", true)),
regularise_(dict.lookupOrDefault("regularise", true)), regularise_(dict.lookupOrDefault("regularise", true)),
bounds_(dict.lookupOrDefault("bounds", boundBox::invertedBox)), bounds_(dict.lookupOrDefault("bounds", boundBox::invertedBox)),
@ -85,7 +85,7 @@ Foam::distanceSurface::distanceSurface
const scalar distance, const scalar distance,
const bool signedDistance, const bool signedDistance,
const bool cell, const bool cell,
const Switch regularise, const bool regularise,
const boundBox& bounds const boundBox& bounds
) )
: :

View File

@ -84,7 +84,7 @@ class distanceSurface
const bool cell_; const bool cell_;
//- Whether to coarsen //- Whether to coarsen
const Switch regularise_; const bool regularise_;
//- Optional bounding box to trim triangles against //- Optional bounding box to trim triangles against
const boundBox bounds_; const boundBox bounds_;
@ -131,7 +131,7 @@ public:
const scalar distance, const scalar distance,
const bool signedDistance, const bool signedDistance,
const bool cell, const bool cell,
const Switch regularise, const bool regularise,
const boundBox& bounds = boundBox::invertedBox const boundBox& bounds = boundBox::invertedBox
); );

View File

@ -122,7 +122,7 @@ class isoSurface
const scalar iso_; const scalar iso_;
//- Regularise? //- Regularise?
const Switch regularise_; const bool regularise_;
//- Optional bounds //- Optional bounds
const boundBox bounds_; const boundBox bounds_;

View File

@ -42,7 +42,6 @@ SourceFiles
#include "chemistryReader.H" #include "chemistryReader.H"
#include "fileName.H" #include "fileName.H"
#include "typeInfo.H" #include "typeInfo.H"
#include "Switch.H"
#include "HashPtrTable.H" #include "HashPtrTable.H"
#include "ReactionList.H" #include "ReactionList.H"
#include "DynamicList.H" #include "DynamicList.H"
@ -187,7 +186,7 @@ private:
dictionary transportDict_; dictionary transportDict_;
//- Flag to indicate that file is in new format //- Flag to indicate that file is in new format
Switch newFormat_; bool newFormat_;
//- Tolerance for element imbalance in a reaction //- Tolerance for element imbalance in a reaction
scalar imbalanceTol_; scalar imbalanceTol_;

View File

@ -25,7 +25,6 @@ License
#include "liquidProperties.H" #include "liquidProperties.H"
#include "HashTable.H" #include "HashTable.H"
#include "Switch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -121,38 +120,36 @@ Foam::autoPtr<Foam::liquidProperties> Foam::liquidProperties::New
InfoInFunction << "Constructing liquidProperties" << endl; InfoInFunction << "Constructing liquidProperties" << endl;
} }
const word& liquidType = dict.dictName(); const word liquidType(dict.dictName());
if (dict.found("defaultCoeffs")) if (dict.found("defaultCoeffs"))
{ {
// Backward-compatibility // Backward-compatibility
if (Switch(dict.lookup("defaultCoeffs"))) if (dict.get<bool>("defaultCoeffs"))
{ {
return New(liquidType); return New(liquidType);
} }
else
auto cstrIter = dictionaryConstructorTablePtr_->cfind(liquidType);
if (!cstrIter.found())
{ {
auto cstrIter = dictionaryConstructorTablePtr_->cfind(liquidType); FatalErrorInFunction
<< "Unknown liquidProperties type "
if (!cstrIter.found()) << liquidType << nl << nl
{ << "Valid liquidProperties types :" << nl
FatalErrorInFunction << dictionaryConstructorTablePtr_->sortedToc()
<< "Unknown liquidProperties type " << exit(FatalError);
<< liquidType << nl << nl
<< "Valid liquidProperties types :" << nl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
return autoPtr<liquidProperties>
(
cstrIter()
(
dict.optionalSubDict(liquidType + "Coeffs")
)
);
} }
return autoPtr<liquidProperties>
(
cstrIter()
(
dict.optionalSubDict(liquidType + "Coeffs")
)
);
} }
auto cstrIter = dictionaryConstructorTablePtr_->cfind(liquidType); auto cstrIter = dictionaryConstructorTablePtr_->cfind(liquidType);

View File

@ -70,7 +70,7 @@ Foam::autoPtr<Foam::solidProperties> Foam::solidProperties::New
{ {
// Backward-compatibility // Backward-compatibility
if (Switch(dict.lookup("defaultCoeffs"))) if (dict.get<bool>("defaultCoeffs"))
{ {
return New(solidType); return New(solidType);
} }