GIT: resolved merge conflict

This commit is contained in:
Andrew Heather
2018-06-13 14:20:18 +01:00
148 changed files with 835 additions and 925 deletions

View File

@ -66,7 +66,7 @@ int main(int argc, char *argv[])
fft::reverseTransform
(
K/(mag(K) + 1.0e-6) ^ forceGen.newField(), K.nn()
)
)*recRootN
);
#include "globalProperties.H"

View File

@ -19,3 +19,10 @@
Kmesh K(mesh);
UOprocess forceGen(K, runTime.deltaTValue(), turbulenceProperties);
label ntot = 1;
forAll(K.nn(), idim)
{
ntot *= K.nn()[idim];
}
const scalar recRootN = 1.0/Foam::sqrt(scalar(ntot));

View File

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

View File

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

View File

@ -58,14 +58,14 @@ Foam::PDRDragModel::PDRDragModel
(
PDRProperties.subDict
(
word(PDRProperties.lookup("PDRDragModel")) + "Coeffs"
PDRProperties.get<word>("PDRDragModel") + "Coeffs"
)
),
turbulence_(turbulence),
rho_(rho),
U_(U),
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_.lookup("drag") >> on_;
PDRDragModelCoeffs_.read("drag", on_);
return true;
}

View File

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

View File

@ -36,9 +36,9 @@ Foam::autoPtr<Foam::PDRDragModel> Foam::PDRDragModel::New
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);

View File

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

View File

@ -1,2 +1,3 @@
Switch adjustTimeStep(runTime.controlDict().lookup("adjustTimeStep"));
scalar maxDeltaT(readScalar(runTime.controlDict().lookup("maxDeltaT")));
bool adjustTimeStep(runTime.controlDict().get<bool>("adjustTimeStep"));
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);
Switch pressureImplicitPorosity(false);
bool pressureImplicitPorosity(false);
// nUCorrectors used for pressureImplicitPorosity
int nUCorr = 0;

View File

@ -13,9 +13,11 @@ IOdictionary gravitationalProperties
);
const dimensionedVector g(gravitationalProperties.lookup("g"));
const Switch rotating(gravitationalProperties.lookup("rotating"));
const bool rotating(gravitationalProperties.get<bool>("rotating"));
const dimensionedVector 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 dimensionedVector gHat = g/magg;

View File

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

View File

@ -39,7 +39,7 @@ ThermalPhaseChangePhaseSystem
HeatAndMassTransferPhaseSystem<BasePhaseSystem>(mesh),
volatile_(this->lookup("volatile")),
saturationModel_(saturationModel::New(this->subDict("saturationModel"))),
massTransfer_(this->lookup("massTransfer"))
massTransfer_(this->template get<bool>("massTransfer"))
{
forAllConstIters(this->phasePairs_, phasePairIter)

View File

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

View File

@ -1,3 +1,3 @@
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);
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 threeK(E/(1.0 - 2.0*nu));
Switch planeStress(mechanicalProperties.lookup("planeStress"));
if (planeStress)
if (mechanicalProperties.get<bool>("planeStress"))
{
Info<< "Plane Stress\n" << endl;

View File

@ -1,3 +1,3 @@
nCorr = stressControl.lookupOrDefault<int>("nCorrectors", 1);
convergenceTolerance = readScalar(stressControl.lookup("D"));
stressControl.lookup("compactNormalStress") >> compactNormalStress;
convergenceTolerance = stressControl.get<scalar>("D");
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
(
@ -46,7 +46,6 @@ volScalarField DT
if (thermalStress)
{
autoPtr<volScalarField> CPtr;
IOobject CIO

View File

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

View File

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

View File

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

View File

@ -137,10 +137,9 @@ int main(int argc, char *argv[])
<< cells.instance()/cells.local()/cells.name()
<< nl << endl;
for (const label celli : cells)
{
cutCells.erase(celli);
}
cutCells.retain(cells);
Info<< "Removed from cells to cut all the ones not in set "
<< setName << nl << endl;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -58,13 +58,10 @@ Foam::initialPointsMethod::initialPointsMethod
(
sqr
(
readScalar
(
initialPointsDict.lookup("minimumSurfaceDistanceCoeff")
)
initialPointsDict.get<scalar>("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 word methodName(initialPointsDict.lookup("initialPointsMethod"));
const word methodName(initialPointsDict.get<word>("initialPointsMethod"));
Info<< nl << "Selecting initialPointsMethod "
<< methodName << endl;

View File

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

View File

@ -150,7 +150,7 @@ Foam::CV2D::CV2D
),
z_
(
point
Foam::point
(
cvMeshDict.subDict("surfaceConformation").lookup("locationInMesh")
).z()
@ -260,7 +260,7 @@ void Foam::CV2D::insertGrid()
{
for (int j=0; j<nj; j++)
{
point p(x0 + i*deltax, y0 + j*deltay, 0);
Foam::point p(x0 + i*deltax, y0 + j*deltay, 0);
if (meshControls().randomiseInitialGrid())
{

View File

@ -347,9 +347,9 @@ public:
// Conversion functions between point2D, point and Point
inline const point2D& toPoint2D(const point&) const;
inline const point2D& toPoint2D(const Foam::point&) const;
inline const point2DField toPoint2D(const pointField&) const;
inline point toPoint3D(const point2D&) const;
inline Foam::point toPoint3D(const point2D&) const;
#ifdef CGAL_INEXACT
typedef const point2D& point2DFromPoint;
@ -361,7 +361,7 @@ public:
inline point2DFromPoint toPoint2D(const Point&) const;
inline PointFromPoint2D toPoint(const point2D&) const;
inline point toPoint3D(const Point&) const;
inline Foam::point toPoint3D(const Point&) const;
// Point insertion

View File

@ -121,7 +121,7 @@ inline const Foam::cv2DControls& Foam::CV2D::meshControls() const
}
inline const Foam::point2D& Foam::CV2D::toPoint2D(const point& p) const
inline const Foam::point2D& Foam::CV2D::toPoint2D(const Foam::point& p) const
{
return reinterpret_cast<const point2D&>(p);
}
@ -140,7 +140,7 @@ inline const Foam::point2DField Foam::CV2D::toPoint2D(const pointField& p) const
inline Foam::point Foam::CV2D::toPoint3D(const point2D& p) const
{
return point(p.x(), p.y(), z_);
return Foam::point(p.x(), p.y(), z_);
}
@ -175,7 +175,7 @@ inline Foam::CV2D::PointFromPoint2D Foam::CV2D::toPoint(const point2D& p) const
inline Foam::point Foam::CV2D::toPoint3D(const Point& P) const
{
return point(CGAL::to_double(P.x()), CGAL::to_double(P.y()), z_);
return Foam::point(CGAL::to_double(P.x()), CGAL::to_double(P.y()), z_);
}

View File

@ -210,8 +210,8 @@ void Foam::CV2D::extractPatches
|| (vB->internalOrBoundaryPoint() && !vA->internalOrBoundaryPoint())
)
{
point ptA = toPoint3D(vA->point());
point ptB = toPoint3D(vB->point());
Foam::point ptA = toPoint3D(vA->point());
Foam::point ptB = toPoint3D(vB->point());
label patchIndex = qSurf_.findPatch(ptA, ptB);

View File

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

View File

@ -295,7 +295,7 @@ void Foam::CV2D::markNearBoundaryPoints()
{
if (vit->internalPoint())
{
point vert(toPoint3D(vit->point()));
Foam::point vert(toPoint3D(vit->point()));
pointIndexHit pHit;
label hitSurface = -1;

View File

@ -109,8 +109,8 @@ void Foam::CV2D::insertFeaturePoints()
{
const edge& e = feMesh.edges()[edgeI];
const point& ep0 = points[e.start()];
const point& ep1 = points[e.end()];
const Foam::point& ep0 = points[e.start()];
const Foam::point& ep1 = points[e.end()];
const linePointRef line(ep0, ep1);

View File

@ -39,7 +39,7 @@ bool Foam::CV2D::dualCellSurfaceIntersection
{
if (!is_infinite(ec))
{
point e0 = toPoint3D(circumcenter(ec->first));
Foam::point e0 = toPoint3D(circumcenter(ec->first));
// If edge end is outside bounding box then edge cuts boundary
if (!qSurf_.globalBounds().contains(e0))
@ -47,7 +47,8 @@ bool Foam::CV2D::dualCellSurfaceIntersection
return true;
}
point e1 = toPoint3D(circumcenter(ec->first->neighbor(ec->second)));
Foam::point e1 =
toPoint3D(circumcenter(ec->first->neighbor(ec->second)));
// If other edge end is outside bounding box then edge cuts boundary
if (!qSurf_.globalBounds().contains(e1))

View File

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

View File

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

View File

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

View File

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

View File

@ -50,7 +50,7 @@ Usage
Write differences with respect to the specified dictionary
(or sub entry if -entry specified)
- \par -diffEtc \<dictionary\>
- \par -diff-etc \<dictionary\>
Write differences with respect to the specified dictionary
(or sub entry if -entry specified)
@ -94,13 +94,13 @@ Usage
- Write the differences with respect to a template dictionary:
\verbatim
foamDictionary 0/U -diffEtc templates/closedVolume/0/U
foamDictionary 0/U -diff-etc templates/closedVolume/0/U
\endverbatim
- Write the differences in boundaryField with respect to a
template dictionary:
\verbatim
foamDictionary 0/U -diffEtc templates/closedVolume/0/U \
foamDictionary 0/U -diff-etc templates/closedVolume/0/U \
-entry boundaryField
\endverbatim
@ -217,11 +217,9 @@ const dictionary& lookupScopedDict
if (!eptr || !eptr->isDict())
{
FatalIOErrorInFunction(dict)
<< "keyword " << subDictName
<< " is undefined in dictionary "
<< dict.name() << " or is not a dictionary"
<< endl
<< "Valid keywords are " << dict.keys()
<< "'" << subDictName << "' not found in dictionary "
<< dict.name() << " or is not a dictionary" << nl
<< "Known entries are " << dict.keys()
<< exit(FatalIOError);
}
@ -300,10 +298,12 @@ int main(int argc, char *argv[])
);
argList::addOption
(
"diffEtc",
"diff-etc",
"dict",
"As per -diff, but locate the file as per foamEtcFile"
);
argList::addOptionCompat("diff-etc", {"diffEtc", 1712});
argList::addBoolOption
(
"includes",
@ -371,10 +371,10 @@ int main(int argc, char *argv[])
}
// Has "diff" or "diffEtc"
// Has "diff" or "diff-etc"
bool optDiff = false;
// Reference dictionary for -diff / -diffEtc
// Reference dictionary for -diff / -diff-etc
dictionary diffDict;
{
fileName diffFileName;
@ -392,7 +392,7 @@ int main(int argc, char *argv[])
diffDict.read(diffFile, true);
optDiff = true;
}
else if (args.readIfPresent("diffEtc", diffFileName))
else if (args.readIfPresent("diff-etc", diffFileName))
{
fileName foundName = findEtcFile(diffFileName);
if (foundName.empty())

View File

@ -55,8 +55,8 @@ Usage
}
// Input file
inputFile "postProcessing/faceSource1/surface/patch/patch.case";
// Input files list
files ("postProcessing/faceSource1/surface/patch/patch.case";)
// Surface reader
reader ensight;

View File

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

View File

@ -63,4 +63,6 @@ alpha1Min/Min\(alpha1\) =/Min(alpha1) =
alpha1Max/Max\(alpha1\) =/Max(alpha1) =
# AMI
AMIMin/AMI: Patch source sum/average =
AMIMin/AMI: Patch source sum/min =
AMIMax/AMI: Patch source sum/max =
AMIAvg/AMI: Patch source sum/average =

View File

@ -43,7 +43,7 @@
#------------------------------------------------------------------------------
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
setenv ParaView_VERSION 5.5.0
setenv ParaView_VERSION 5.5.1
set ParaView_QT=qt-system
set cmake_version=cmake-system
@ -126,7 +126,7 @@ if ( $?ParaView_VERSION ) then
set qtDir="$archDir/$ParaView_QT"
if ( -d "$qtDir" ) then
switch ($ParaView_QT)
case *-qt*:
case *-5*:
setenv Qt5_DIR $qtDir
breaksw
endsw

View File

@ -2,7 +2,7 @@
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
# \\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd.
# \\/ M anipulation |
#------------------------------------------------------------------------------
# License
@ -126,7 +126,7 @@ _of_complete_()
COMPREPLY=($(compgen -W "$choices" -- ${cur}))
;;
-fileHandler)
choices="collated uncollated masterUncollated"
choices="collated uncollated hostCollated masterUncollated"
COMPREPLY=($(compgen -W "$choices" -- ${cur}))
;;
*)

View File

@ -46,7 +46,7 @@
#------------------------------------------------------------------------------
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
ParaView_VERSION=5.5.0
ParaView_VERSION=5.5.1
ParaView_QT=qt-system
cmake_version=cmake-system

View File

@ -138,7 +138,7 @@ const T* Foam::DictionaryBase<IDLListType, T>::lookup(const word& keyword) const
if (iter == hashedTs_.end())
{
FatalErrorInFunction
<< keyword << " is undefined"
<< "'" << keyword << "' not found"
<< exit(FatalError);
}
@ -154,7 +154,7 @@ T* Foam::DictionaryBase<IDLListType, T>::lookup(const word& keyword)
if (iter == hashedTs_.end())
{
FatalErrorInFunction
<< keyword << " is undefined"
<< "'" << keyword << "' not found"
<< exit(FatalError);
}

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -24,6 +24,8 @@ License
\*---------------------------------------------------------------------------*/
#include "dictionary.H"
#include "error.H"
#include "JobInfo.H"
#include "primitiveEntry.H"
#include "dictionaryEntry.H"
#include "regExp.H"
@ -48,7 +50,6 @@ bool Foam::dictionary::writeOptionalEntries
void Foam::dictionary::excessTokens
(
OSstream& msg,
const word& keyword,
const ITstream& is
) const
@ -60,12 +61,44 @@ void Foam::dictionary::excessTokens
return;
}
msg << "entry '" << keyword << "' has "
<< nExcess << " excess tokens, near line: " << is.lineNumber() << nl
<< "dictionary: " << name() << nl
<< "stream: ";
is.writeList(msg, 0);
msg << nl;
// Similar to SafeFatalIOError
if (JobInfo::constructed)
{
OSstream& err =
FatalIOError
(
"", // functionName
"", // sourceFileName
0, // sourceFileLineNumber
this->name(), // ioFileName
is.lineNumber() // ioStartLineNumber
);
err << "'" << keyword << "' has "
<< nExcess << " excess tokens in stream" << nl << nl
<< " ";
is.writeList(err, 0);
err << exit(FatalIOError);
}
else
{
std::cerr
<< nl
<< "--> FOAM FATAL IO ERROR:" << nl;
std::cerr
<< "'" << keyword << "' has "
<< nExcess << " excess tokens in stream" << nl << nl;
std::cerr
<< "file: " << this->name()
<< " at line " << is.lineNumber() << '.' << nl
<< std::endl;
::exit(1);
}
}
@ -296,10 +329,8 @@ const Foam::entry& Foam::dictionary::lookupEntry
if (!finder.found())
{
FatalIOErrorInFunction
(
*this
) << "keyword " << keyword << " is undefined in dictionary "
FatalIOErrorInFunction(*this)
<< "'" << keyword << "' not found in dictionary "
<< name()
<< exit(FatalIOError);
}
@ -422,10 +453,8 @@ const Foam::dictionary& Foam::dictionary::subDict(const word& keyword) const
if (!finder.found())
{
FatalIOErrorInFunction
(
*this
) << "keyword " << keyword << " is undefined in dictionary "
FatalIOErrorInFunction(*this)
<< "'" << keyword << "' not found in dictionary "
<< name()
<< exit(FatalIOError);
}
@ -441,10 +470,8 @@ Foam::dictionary& Foam::dictionary::subDict(const word& keyword)
if (!finder.found())
{
FatalIOErrorInFunction
(
*this
) << "keyword " << keyword << " is undefined in dictionary "
FatalIOErrorInFunction(*this)
<< "'" << keyword << "' not found in dictionary "
<< name()
<< exit(FatalIOError);
}
@ -470,20 +497,18 @@ Foam::dictionary Foam::dictionary::subOrEmptyDict
if (mustRead)
{
FatalIOErrorInFunction
(
*this
) << "keyword " << keyword
<< " is not a sub-dictionary in dictionary "
FatalIOErrorInFunction(*this)
<< "'" << keyword
<< "' is not a sub-dictionary in dictionary "
<< name()
<< exit(FatalIOError);
}
if (finder.found())
{
IOWarningInFunction((*this))
<< "keyword " << keyword
<< " found but not a sub-dictionary in dictionary "
IOWarningInFunction(*this)
<< "'" << keyword
<< "' found but not a sub-dictionary in dictionary "
<< name() << endl;
}
@ -506,9 +531,9 @@ const Foam::dictionary& Foam::dictionary::optionalSubDict
if (finder.found())
{
IOWarningInFunction((*this))
<< "keyword " << keyword
<< " found but not a sub-dictionary in dictionary "
IOWarningInFunction(*this)
<< "'" << keyword
<< "' found but not a sub-dictionary in dictionary "
<< name() << endl;
}
@ -597,7 +622,7 @@ Foam::entry* Foam::dictionary::add(entry* entryPtr, bool mergeEntry)
}
IOWarningInFunction((*this))
IOWarningInFunction(*this)
<< "problem replacing entry "<< entryPtr->keyword()
<< " in dictionary " << name() << endl;
@ -626,7 +651,7 @@ Foam::entry* Foam::dictionary::add(entry* entryPtr, bool mergeEntry)
}
IOWarningInFunction((*this))
IOWarningInFunction(*this)
<< "attempt to add entry " << entryPtr->keyword()
<< " which already exists in dictionary " << name()
<< endl;

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -143,18 +143,18 @@ public:
return name_;
}
//- Return the dictionary name
//- Return the dictionary name for modification (use with caution).
fileName& name()
{
return name_;
}
//- Return the local dictionary name (final part of scoped name)
const word dictName() const
word dictName() const
{
const word scopedName = name_.name();
const auto i = scopedName.rfind('.');
word scopedName(name_.name());
const auto i = scopedName.rfind('.');
if (i == std::string::npos)
{
return scopedName;
@ -383,13 +383,8 @@ private:
) const;
//- Add report of excess tokens to the messageStream
void excessTokens
(
OSstream& msg,
const word& keyword,
const ITstream& is
) const;
//- Emit FatalIOError if excess tokens exist
void excessTokens(const word& keyword, const ITstream& is) const;
public:
@ -505,7 +500,7 @@ public:
) const;
//- Find and return an entry pointer for manipulation if present,
// or return a nullptr.
//- or return a nullptr.
//
// \param recursive search parent dictionaries
// \param patternMatch use regular expressions
@ -516,7 +511,7 @@ public:
bool patternMatch
);
//- Find and return an entry if present otherwise error.
//- Find and return an entry if present, otherwise FatalIOError.
//
// \param recursive search parent dictionaries
// \param patternMatch use regular expressions
@ -528,7 +523,7 @@ public:
) const;
//- Find and return a T.
//- FatalError if not found, or if there are excess tokens.
//- FatalIOError if not found, or if there are excess tokens.
// Default search: non-recursive with patterns.
//
// \param recursive search parent dictionaries
@ -554,13 +549,13 @@ public:
) const;
//- Find and return a T.
//- FatalError if not found, or if there are excess tokens.
//- FatalIOError if not found, or if there are excess tokens.
// Default search: non-recursive with patterns.
//
// \param recursive search parent dictionaries
// \param patternMatch use regular expressions
//
// \note same as get()
// \deprecated - same as the get() method
template<class T>
T lookupType
(
@ -570,7 +565,7 @@ public:
) const;
//- Find and return a T, or return the given default value
//- FatalError if it is found and there are excess tokens.
//- FatalIOError if it is found and there are excess tokens.
// Default search: non-recursive with patterns.
//
// \param recursive search parent dictionaries
@ -586,7 +581,7 @@ public:
//- Find and return a T, or return the given default value
//- and add it to dictionary.
//- FatalError if it is found and there are excess tokens.
//- FatalIOError if it is found and there are excess tokens.
// Default search: non-recursive with patterns.
//
// \param recursive search parent dictionaries
@ -600,8 +595,26 @@ public:
bool patternMatch = true
);
//- Find entry and assign to T val.
//- FatalIOError if it is found and there are excess tokens.
// Default search: non-recursive with patterns.
//
// \param recursive search parent dictionaries
// \param patternMatch use regular expressions
//
// \return true if the entry was found.
template<class T>
bool read
(
const word& keyword,
T& val,
bool recursive = false,
bool patternMatch = true,
bool mandatory = true
) const;
//- Find an entry if present, and assign to T val.
//- FatalError if it is found and there are excess tokens.
//- FatalIOError if it is found and there are excess tokens.
// Default search: non-recursive with patterns.
//
// \param val the value to read
@ -662,7 +675,7 @@ public:
dictionary& subDict(const word& keyword);
//- Find and return a sub-dictionary as a copy, otherwise return
// an empty dictionary.
//- an empty dictionary.
// Warn if the entry exists but is not a sub-dictionary.
//
// Search type: non-recursive with patterns.
@ -984,7 +997,7 @@ public:
bool patternMatch
) const;
//- Find and return an entry if present otherwise error,
//- Find and return an entry if present, otherwise FatalIOError,
//- using any compatibility names if needed.
//
// \param compat list of old compatibility keywords and the last
@ -999,6 +1012,24 @@ public:
bool patternMatch
) const;
//- Find and return a T
//- using any compatibility names if needed.
//- FatalIOError if not found, or if there are excess tokens.
// Default search: non-recursive with patterns.
//
// \param compat list of old compatibility keywords and the last
// OpenFOAM version for which they were used.
// \param recursive search parent dictionaries
// \param patternMatch use regular expressions
template<class T>
T getCompat
(
const word& keyword,
std::initializer_list<std::pair<const char*,int>> compat,
bool recursive = false,
bool patternMatch = true
) const;
//- Find and return an entry data stream,
//- using any compatibility names if needed.
// Default search: non-recursive with patterns.
@ -1033,8 +1064,32 @@ public:
bool patternMatch = true
) const;
//- Find entry and assign to T val
//- using any compatibility names if needed.
//- FatalIOError if there are excess tokens.
// Default search: non-recursive with patterns.
//
// \param compat list of old compatibility keywords and the last
// OpenFOAM version for which they were used.
// \param val the value to read
// \param recursive search parent dictionaries
// \param patternMatch use regular expressions
//
// \return true if the entry was found.
template<class T>
bool readCompat
(
const word& keyword,
std::initializer_list<std::pair<const char*,int>> compat,
T& val,
bool recursive = false,
bool patternMatch = true,
bool mandatory = true
) const;
//- Find an entry if present, and assign to T val
//- using any compatibility names if needed.
//- FatalIOError if it is found and there are excess tokens.
// Default search: non-recursive with patterns.
//
// \param compat list of old compatibility keywords and the last

View File

@ -124,10 +124,8 @@ const Foam::entry& Foam::dictionary::lookupEntryCompat
if (!finder.found())
{
FatalIOErrorInFunction
(
*this
) << "keyword " << keyword << " is undefined in dictionary "
FatalIOErrorInFunction(*this)
<< "'" << keyword << "' not found in dictionary "
<< name()
<< exit(FatalIOError);
}
@ -144,7 +142,8 @@ Foam::ITstream& Foam::dictionary::lookupCompat
bool patternMatch
) const
{
return lookupEntryCompat(keyword, compat, recursive,patternMatch).stream();
return
lookupEntryCompat(keyword, compat, recursive, patternMatch).stream();
}

View File

@ -27,18 +27,17 @@ License
#include "dictionaryEntry.H"
#include "stringOps.H"
/* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
namespace Foam
namespace
{
// file-scope
//- Walk lists of patterns and regexps for an exact match
// or regular expression match
// Walk lists of patterns and regexps for an exact match
// or a regular expression match
template<class WcIterator, class ReIterator>
static bool findInPatterns
(
const bool patternMatch,
const word& keyword,
const Foam::word& keyword,
WcIterator& wcIter,
ReIterator& reIter
)
@ -61,7 +60,8 @@ namespace Foam
return false;
}
}
} // End anonymous namespace
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -73,7 +73,7 @@ Foam::dictionary::const_searcher Foam::dictionary::csearchDotScoped
bool patternMatch
) const
{
std::string::size_type scopePos = keyword.find('.');
auto scopePos = keyword.find('.');
if (scopePos == string::npos)
{
@ -101,10 +101,8 @@ Foam::dictionary::const_searcher Foam::dictionary::csearchDotScoped
}
else
{
FatalIOErrorInFunction
(
*this
) << "No parent of current dictionary when searching for "
FatalIOErrorInFunction(*this)
<< "No parent of current dictionary when searching for "
<< keyword.substr(1)
<< exit(FatalIOError);
@ -210,10 +208,8 @@ Foam::dictionary::const_searcher Foam::dictionary::csearchSlashScoped
}
else
{
FatalIOErrorInFunction
(
*dictPtr
) << "No parent of current dictionary when searching for "
FatalIOErrorInFunction(*dictPtr)
<< "No parent of current dictionary when searching for "
<< keyword << " at " << cmpt
<< exit(FatalIOError);
break;
@ -424,10 +420,8 @@ const Foam::dictionary* Foam::dictionary::cfindScopedDictPtr
}
else
{
FatalIOErrorInFunction
(
*dictPtr
) << "No parent for dictionary while searching "
FatalIOErrorInFunction(*dictPtr)
<< "No parent for dictionary while searching "
<< path
<< exit(FatalIOError);
@ -451,10 +445,8 @@ const Foam::dictionary* Foam::dictionary::cfindScopedDictPtr
}
else
{
FatalIOErrorInFunction
(
*dictPtr
) << "Found entry '" << cmpt
FatalIOErrorInFunction(*dictPtr)
<< "Found entry '" << cmpt
<< "' but not a dictionary, while searching scoped"
<< nl
<< " " << path
@ -533,10 +525,8 @@ Foam::dictionary* Foam::dictionary::makeScopedDictPtr(const fileName& dictPath)
}
else
{
FatalIOErrorInFunction
(
*dictPtr
) << "No parent for dictionary while searching "
FatalIOErrorInFunction(*dictPtr)
<< "No parent for dictionary while searching "
<< path
<< exit(FatalIOError);
@ -561,10 +551,8 @@ Foam::dictionary* Foam::dictionary::makeScopedDictPtr(const fileName& dictPath)
}
else
{
FatalIOErrorInFunction
(
*dictPtr
) << "Cannot create sub-dictionary entry '" << cmptName
FatalIOErrorInFunction(*dictPtr)
<< "Cannot create sub-dictionary entry '" << cmptName
<< "' - a non-dictionary entry is in the way"
<< nl << "Encountered in scope" << nl
<< " " << path
@ -621,11 +609,9 @@ bool Foam::dictionary::remove(const word& keyword)
return true;
}
else
{
return false;
}
}
bool Foam::dictionary::changeKeyword
@ -651,10 +637,8 @@ bool Foam::dictionary::changeKeyword
if (iter()->keyword().isPattern())
{
FatalIOErrorInFunction
(
*this
) << "Old keyword "<< oldKeyword
FatalIOErrorInFunction(*this)
<< "Old keyword "<< oldKeyword
<< " is a pattern."
<< "Pattern replacement not yet implemented."
<< exit(FatalIOError);
@ -688,10 +672,8 @@ bool Foam::dictionary::changeKeyword
}
else
{
IOWarningInFunction
(
*this
) << "cannot rename keyword "<< oldKeyword
IOWarningInFunction(*this)
<< "cannot rename keyword "<< oldKeyword
<< " to existing keyword " << newKeyword
<< " in dictionary " << name() << endl;
return false;

View File

@ -57,31 +57,63 @@ T Foam::dictionary::get
bool patternMatch
) const
{
const const_searcher finder(csearch(keyword, recursive, patternMatch));
if (!finder.found())
{
FatalIOErrorInFunction(*this)
<< "keyword " << keyword << " is undefined in dictionary "
<< name()
<< exit(FatalIOError);
}
T val;
ITstream& is = finder.ptr()->stream();
is >> val;
if (!is.eof())
{
auto err = FatalIOErrorInFunction(*this);
excessTokens(err, keyword, is);
err << exit(FatalIOError);
}
read<T>(keyword, val, recursive, patternMatch);
return val;
}
template<class T>
T Foam::dictionary::getCompat
(
const word& keyword,
std::initializer_list<std::pair<const char*,int>> compat,
bool recursive,
bool patternMatch
) const
{
T val;
readCompat<T>(keyword, compat, val, recursive, patternMatch);
return val;
}
template<class T>
bool Foam::dictionary::readCompat
(
const word& keyword,
std::initializer_list<std::pair<const char*,int>> compat,
T& val,
bool recursive,
bool patternMatch,
bool mandatory
) const
{
const const_searcher
finder(csearchCompat(keyword, compat, recursive, patternMatch));
if (finder.found())
{
ITstream& is = finder.ptr()->stream();
is >> val;
excessTokens(keyword, is);
return true;
}
else if (mandatory)
{
FatalIOErrorInFunction(*this)
<< "'" << keyword << "' not found in dictionary "
<< name()
<< exit(FatalIOError);
}
return false;
}
// older name
template<class T>
T Foam::dictionary::lookupType
(
@ -112,21 +144,15 @@ T Foam::dictionary::lookupOrDefault
ITstream& is = finder.ptr()->stream();
is >> val;
if (!is.eof())
{
auto err = FatalIOErrorInFunction(*this);
excessTokens(err, keyword, is);
err << exit(FatalIOError);
}
excessTokens(keyword, is);
return val;
}
if (writeOptionalEntries)
else if (writeOptionalEntries)
{
IOInfoInFunction(*this)
<< "Optional entry '" << keyword << "' is not present,"
<< " returning the default value '" << deflt << "'"
<< "Optional entry '" << keyword << "' not found,"
<< " using default value '" << deflt << "'"
<< endl;
}
@ -152,21 +178,15 @@ T Foam::dictionary::lookupOrAddDefault
ITstream& is = finder.ptr()->stream();
is >> val;
if (!is.eof())
{
auto err = FatalIOErrorInFunction(*this);
excessTokens(err, keyword, is);
err << exit(FatalIOError);
}
excessTokens(keyword, is);
return val;
}
if (writeOptionalEntries)
else if (writeOptionalEntries)
{
IOInfoInFunction(*this)
<< "Optional entry '" << keyword << "' is not present,"
<< " adding and returning the default value '" << deflt << "'"
<< "Optional entry '" << keyword << "' not found,"
<< " adding default value '" << deflt << "'"
<< endl;
}
@ -175,6 +195,39 @@ T Foam::dictionary::lookupOrAddDefault
}
template<class T>
bool Foam::dictionary::read
(
const word& keyword,
T& val,
bool recursive,
bool patternMatch,
bool mandatory
) const
{
const const_searcher finder(csearch(keyword, recursive, patternMatch));
if (finder.found())
{
ITstream& is = finder.ptr()->stream();
is >> val;
excessTokens(keyword, is);
return true;
}
else if (mandatory)
{
FatalIOErrorInFunction(*this)
<< "'" << keyword << "' not found in dictionary "
<< name()
<< exit(FatalIOError);
}
return false;
}
template<class T>
bool Foam::dictionary::readIfPresent
(
@ -184,32 +237,8 @@ bool Foam::dictionary::readIfPresent
bool patternMatch
) const
{
const const_searcher finder(csearch(keyword, recursive, patternMatch));
if (finder.found())
{
ITstream& is = finder.ptr()->stream();
is >> val;
if (!is.eof())
{
auto err = FatalIOErrorInFunction(*this);
excessTokens(err, keyword, is);
err << exit(FatalIOError);
}
return true;
}
if (writeOptionalEntries)
{
IOInfoInFunction(*this)
<< "Optional entry '" << keyword << "' is not present,"
<< " the default value '" << val << "' will be used."
<< endl;
}
return false;
// Read is non-mandatory
return read<T>(keyword, val, recursive, patternMatch, false);
}
@ -233,21 +262,15 @@ T Foam::dictionary::lookupOrDefaultCompat
ITstream& is = finder.ptr()->stream();
is >> val;
if (!is.eof())
{
auto err = FatalIOErrorInFunction(*this);
excessTokens(err, keyword, is);
err << exit(FatalIOError);
}
excessTokens(keyword, is);
return val;
}
if (writeOptionalEntries)
else if (writeOptionalEntries)
{
IOInfoInFunction(*this)
<< "Optional entry '" << keyword << "' is not present,"
<< " returning the default value '" << deflt << "'"
<< "Optional entry '" << keyword << "' not found,"
<< " using default value '" << deflt << "'"
<< endl;
}
@ -265,33 +288,8 @@ bool Foam::dictionary::readIfPresentCompat
bool patternMatch
) const
{
const const_searcher
finder(csearchCompat(keyword, compat, recursive, patternMatch));
if (finder.found())
{
ITstream& is = finder.ptr()->stream();
is >> val;
if (!is.eof())
{
auto err = FatalIOErrorInFunction(*this);
excessTokens(err, keyword, is);
err << exit(FatalIOError);
}
return true;
}
if (writeOptionalEntries)
{
IOInfoInFunction(*this)
<< "Optional entry '" << keyword << "' is not present,"
<< " the default value '" << val << "' will be used."
<< endl;
}
return false;
// Read is non-mandatory
return readCompat<T>(keyword, compat, recursive, patternMatch, false);
}

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -79,104 +79,92 @@ Foam::dlLibraryTable::~dlLibraryTable()
bool Foam::dlLibraryTable::open
(
const fileName& functionLibName,
const fileName& libName,
const bool verbose
)
{
if (functionLibName.size())
if (libName.empty())
{
void* functionLibPtr = dlOpen
(
fileName(functionLibName).expand(),
verbose
);
return false;
}
void* ptr = dlOpen(fileName(libName).expand(), verbose);
if (debug)
{
InfoInFunction
<< "Opened " << functionLibName
<< " resulting in handle " << uintptr_t(functionLibPtr) << endl;
<< "Opened " << libName
<< " resulting in handle " << uintptr_t(ptr) << endl;
}
if (!functionLibPtr)
if (ptr)
{
libPtrs_.append(ptr);
libNames_.append(libName);
return true;
}
if (verbose)
{
WarningInFunction
<< "could not load " << functionLibName
<< "could not load " << libName
<< endl;
}
return false;
}
else
{
libPtrs_.append(functionLibPtr);
libNames_.append(functionLibName);
return true;
}
}
else
{
return false;
}
}
bool Foam::dlLibraryTable::close
(
const fileName& functionLibName,
const fileName& libName,
const bool verbose
)
{
label index = -1;
forAllReverse(libNames_, i)
{
if (libNames_[i] == functionLibName)
if (libName == libNames_[i])
{
index = i;
break;
}
}
if (index != -1)
if (index == -1)
{
return false;
}
if (debug)
{
InfoInFunction
<< "Closing " << functionLibName
<< "Closing " << libName
<< " with handle " << uintptr_t(libPtrs_[index]) << endl;
}
bool ok = dlClose(libPtrs_[index]);
const bool ok = dlClose(libPtrs_[index]);
libPtrs_[index] = nullptr;
libNames_[index] = fileName::null;
libNames_[index].clear();
if (!ok)
{
if (verbose)
if (!ok && verbose)
{
WarningInFunction
<< "could not close " << functionLibName
<< "could not close " << libName
<< endl;
}
return false;
}
return true;
}
return false;
return ok;
}
void* Foam::dlLibraryTable::findLibrary(const fileName& functionLibName)
void* Foam::dlLibraryTable::findLibrary(const fileName& libName)
{
label index = -1;
forAllReverse(libNames_, i)
{
if (libNames_[i] == functionLibName)
if (libName == libNames_[i])
{
index = i;
break;
@ -187,6 +175,7 @@ void* Foam::dlLibraryTable::findLibrary(const fileName& functionLibName)
{
return libPtrs_[index];
}
return nullptr;
}
@ -197,23 +186,20 @@ bool Foam::dlLibraryTable::open
const word& libsEntry
)
{
if (dict.found(libsEntry))
{
fileNameList libNames(dict.lookup(libsEntry));
fileNameList libNames;
dict.readIfPresent(libsEntry, libNames);
bool allOpened = !libNames.empty();
label nOpen = 0;
forAll(libNames, i)
for (const fileName& libName : libNames)
{
allOpened = dlLibraryTable::open(libNames[i]) && allOpened;
if (dlLibraryTable::open(libName))
{
++nOpen;
}
}
return allOpened;
}
else
{
return false;
}
return nOpen && nOpen == libNames.size();
}

View File

@ -49,13 +49,15 @@ namespace Foam
class dlLibraryTable
{
// Private Member Functions
// Private data
DynamicList<void*> libPtrs_;
DynamicList<fileName> libNames_;
// Private Member Functions
//- No copy construct
dlLibraryTable(const dlLibraryTable&) = delete;
@ -73,9 +75,9 @@ public:
//- Construct null
dlLibraryTable();
//- Construct from dictionary and name of 'libs' entry giving
// the libraries to load
dlLibraryTable(const dictionary&, const word&);
//- Open all libraries listed in the 'libsEntry' entry in the
//- given dictionary.
dlLibraryTable(const dictionary& dict, const word& libsEntry);
//- Destructor
@ -85,25 +87,25 @@ public:
// Member Functions
//- Open the named library, optionally with warnings if problems occur
bool open(const fileName& name, const bool verbose = true);
bool open(const fileName& libName, const bool verbose = true);
//- Close the named library, optionally with warnings if problems occur
bool close(const fileName& name, const bool verbose = true);
bool close(const fileName& libName, const bool verbose = true);
//- Find the handle of the named library
void* findLibrary(const fileName& name);
void* findLibrary(const fileName& libName);
//- Open all the libraries listed in the 'libsEntry' entry in the
// given dictionary if present
bool open(const dictionary&, const word& libsEntry);
//- Open all libraries listed in the 'libsEntry' entry in the
//- given dictionary.
bool open(const dictionary& dict, const word& libsEntry);
//- Open all the libraries listed in the 'libsEntry' entry in the
// given dictionary if present and check the additions
// to the given constructor table
//- Open all libraries listed in the 'libsEntry' entry in the
//- given dictionary and check the additions
//- to the given constructor table
template<class TablePtr>
bool open
(
const dictionary&,
const dictionary& dict,
const word& libsEntry,
const TablePtr& tablePtr
);

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -37,48 +37,37 @@ bool Foam::dlLibraryTable::open
const TablePtr& tablePtr
)
{
if (dict.found(libsEntry))
fileNameList libNames;
dict.readIfPresent(libsEntry, libNames);
label nOpen = 0;
for (const fileName& libName : libNames)
{
fileNameList libNames(dict.lookup(libsEntry));
const label nEntries = (tablePtr ? tablePtr->size() : 0);
bool allOpened = (libNames.size() > 0);
forAll(libNames, i)
if (dlLibraryTable::open(libName))
{
const fileName& libName = libNames[i];
++nOpen;
label nEntries = 0;
if (tablePtr)
{
nEntries = tablePtr->size();
}
bool opened = dlLibraryTable::open(libName);
allOpened = opened && allOpened;
if (!opened)
{
WarningInFunction
<< "Could not open library " << libName
<< endl << endl;
}
else if (debug && (!tablePtr || tablePtr->size() <= nEntries))
if (debug && (!tablePtr || tablePtr->size() <= nEntries))
{
WarningInFunction
<< "library " << libName
<< " did not introduce any new entries"
<< endl << endl;
<< nl << endl;
}
}
return allOpened;
}
else
{
return false;
WarningInFunction
<< "Could not open library " << libName
<< nl << endl;
}
}
return nOpen && nOpen == libNames.size();
}
// ************************************************************************* //

View File

@ -139,15 +139,15 @@ void Foam::IOerror::SafeFatalIOError
else
{
std::cerr
<< std::endl
<< "--> FOAM FATAL IO ERROR:" << std::endl
<< nl
<< "--> FOAM FATAL IO ERROR:" << nl
<< msg
<< std::endl
<< nl
<< "file: " << ioStream.name()
<< " at line " << ioStream.lineNumber() << '.'
<< std::endl << std::endl
<< nl << nl
<< " From function " << functionName
<< std::endl
<< nl
<< " in file " << sourceFileName
<< " at line " << sourceFileLineNumber << '.'
<< std::endl;

View File

@ -199,7 +199,7 @@ Foam::dimensioned<Type> Foam::dimensioned<Type>::lookupOrDefault
{
if (dict.found(name))
{
return dimensioned<Type>(name, dims, dict.lookup(name));
return dimensioned<Type>(name, dims, dict.get<Type>(name));
}
return dimensioned<Type>(name, dims, defaultValue);
@ -316,7 +316,7 @@ void Foam::dimensioned<Type>::replace
template<class Type>
void Foam::dimensioned<Type>::read(const dictionary& dict)
{
dict.lookup(name_) >> value_;
dict.read(name_, value_);
}

View File

@ -141,6 +141,7 @@ public:
// Static member functions
//- Construct from dictionary, with default dimensions and value.
//- FatalIOError if there are excess tokens.
static dimensioned<Type> lookupOrDefault
(
const word& name,
@ -149,7 +150,8 @@ public:
const Type& defaultValue = Type(Zero)
);
//- Construct from dictionary dimensionless with value.
//- Construct from dictionary, dimensionless and with a value.
// FatalIOError if it is found and there are excess tokens.
static dimensioned<Type> lookupOrDefault
(
const word& name,
@ -159,6 +161,7 @@ public:
//- Construct from dictionary, with default value.
// If the value is not found, it is added into the dictionary.
// FatalIOError if it is found and there are excess tokens.
static dimensioned<Type> lookupOrAddToDict
(
const word& name,
@ -169,6 +172,7 @@ public:
//- Construct from dictionary, dimensionless with default value.
// If the value is not found, it is added into the dictionary.
// FatalIOError if it is found and there are excess tokens.
static dimensioned<Type> lookupOrAddToDict
(
const word& name,

View File

@ -35,7 +35,7 @@ Description
SourceFiles
pointPatchField.C
newPointPatchField.C
pointPatchFieldNew.C
\*---------------------------------------------------------------------------*/

View File

@ -6,20 +6,20 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of2011 OpenFOAM.
This file is part of OpenFOAM.
2011 OpenFOAM is free software: you can redistribute it and/or modify it
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
2011 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with2011 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2016 Bernhard Gschaider
\\/ M anipulation | Copyright (C) 2016-2107 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.

View File

@ -186,7 +186,7 @@ EnumType Foam::Enum<EnumType>::lookup
const dictionary& dict
) const
{
const word enumName(dict.lookup(key));
const word enumName(dict.get<word>(key));
const label idx = getIndex(enumName);
if (idx < 0)
@ -228,7 +228,7 @@ EnumType Foam::Enum<EnumType>::lookupOrFailsafe
{
if (dict.found(key))
{
const word enumName(dict.lookup(key));
const word enumName(dict.get<word>(key));
const label idx = getIndex(enumName);
if (idx >= 0)

View File

@ -30,7 +30,7 @@ License
void Foam::Function1Types::ramp::read(const dictionary& coeffs)
{
start_ = coeffs.lookupOrDefault<scalar>("start", 0);
duration_ = coeffs.lookupType<scalar>("duration");
duration_ = coeffs.get<scalar>("duration");
}

View File

@ -100,6 +100,12 @@ public:
//- Calculate time scale
virtual tmp<volScalarField> timeScale() = 0;
//- Return the CEDC coefficient
scalar CEDC() const
{
return CEDC_;
}
// I-O

View File

@ -40,6 +40,7 @@ SourceFiles
#include "singleStepReactingMixture.H"
#include "ThermoCombustion.H"
#include "fvScalarMatrix.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016-2107 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016-2107 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -203,7 +203,7 @@ void Foam::dynamicRefineFvMesh::readDict()
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 "hexRef8.H"
#include "bitSet.H"
#include "Switch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -92,7 +91,7 @@ protected:
hexRef8 meshCutter_;
//- Dump cellLevel for post-processing
Switch dumpLevel_;
bool dumpLevel_;
//- Fluxes to map
HashTable<word> correctFluxes_;

View File

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

View File

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

View File

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

View File

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

View File

@ -450,7 +450,7 @@ void Foam::multiDirRefinement::refineFromDict
)
{
// How to walk cell circumference.
Switch pureGeomCut(dict.lookup("geometricCut"));
const bool pureGeomCut(dict.get<bool>("geometricCut"));
autoPtr<cellLooper> cellWalker;
if (pureGeomCut)
@ -486,9 +486,9 @@ Foam::multiDirRefinement::multiDirRefinement
cellLabels_(cellLabels),
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"));
@ -529,9 +529,9 @@ Foam::multiDirRefinement::multiDirRefinement
cellLabels_(cellLabels),
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"));

View File

@ -56,7 +56,7 @@ Foam::setUpdater::setUpdater
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
)
:
polyMeshModifier(name, index, mme, Switch(dict.lookup("active"))),
polyMeshModifier(name, index, mme, dict.get<bool>("active")),
masterFaceZoneID_
(
dict.lookup("masterFaceZoneName"),

View File

@ -59,8 +59,6 @@ namespace vtk
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Constants
// General Functions
//- Return a default asciiFormatter
@ -94,7 +92,7 @@ namespace vtk
void writeList
(
vtk::formatter& fmt,
const UList<Type>& lst
const UList<Type>& list
);
//- Write a list of values.
@ -103,7 +101,7 @@ namespace vtk
void writeList
(
vtk::formatter& fmt,
const FixedList<Type, Size>& lst
const FixedList<Type, Size>& list
);
@ -113,7 +111,7 @@ namespace vtk
void writeList
(
vtk::formatter& fmt,
const UList<Type>& lst,
const UList<Type>& list,
const labelUList& addressing
);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016-2107 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -44,12 +44,12 @@ template<class Type>
void Foam::vtk::writeList
(
vtk::formatter& fmt,
const UList<Type>& lst
const UList<Type>& list
)
{
forAll(lst, i)
for (const Type& val : list)
{
write(fmt, lst[i]);
write(fmt, val);
}
}
@ -58,12 +58,12 @@ template<class Type, unsigned Size>
void Foam::vtk::writeList
(
vtk::formatter& fmt,
const FixedList<Type, Size>& lst
const FixedList<Type, Size>& list
)
{
for (unsigned i=0; i<Size; ++i)
for (const Type& val : list)
{
write(fmt, lst[i]);
write(fmt, val);
}
}
@ -72,13 +72,13 @@ template<class Type>
void Foam::vtk::writeList
(
vtk::formatter& fmt,
const UList<Type>& lst,
const UList<Type>& list,
const labelUList& addressing
)
{
forAll(addressing, i)
for (const label idx : addressing)
{
write(fmt, lst[addressing[i]]);
write(fmt, list[idx]);
}
}

View File

@ -179,10 +179,10 @@ void Foam::faSchemes::read(const dictionary& dict)
if
(
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
(
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,
scalar maxDistance,
Switch writeCloud,
bool writeCloud,
const word& UName
)
:

View File

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

View File

@ -180,7 +180,7 @@ Foam::scalar Foam::COxidationIntrinsicRate<CloudType>::calculate
max(0.5*d*sqrt(Sb_*rhop*Ag_*ki*ppO2/(De*rhoO2)), ROOTVSMALL);
// Effectiveness factor []
const scalar eta = max(3.0*sqr(phi)*(phi/tanh(phi) - 1.0), 0.0);
const scalar eta = max(3.0/sqr(phi)*(phi/tanh(phi) - 1.0), 0.0);
// Chemical rate [kmol/m2/s]
const scalar R = eta*d/6.0*rhop*Ag_*ki;

View File

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

View File

@ -198,12 +198,12 @@ Foam::label Foam::ConeInjection<CloudType>::parcelsToInject
{
const scalar targetVolume = flowRateProfile_.integrate(0, time1);
const scalar volumeFraction = targetVolume/this->volumeTotal_;
const label targetParcels =
parcelsPerInjector_*targetVolume/this->volumeTotal_;
ceil(positionAxis_.size()*parcelsPerInjector_*volumeFraction);
const label nToInject = targetParcels - nInjected_;
return positionAxis_.size()*nToInject;
return targetParcels - nInjected_;
}
else
{

View File

@ -214,7 +214,7 @@ Foam::ConeNozzleInjection<CloudType>::ConeNozzleInjection
while(magTangent < SMALL)
{
vector v = rndGen.sample01<vector>();
vector v = rndGen.globalSample01<vector>();
tangent = v - (v & direction_)*direction_;
magTangent = mag(tangent);
@ -354,7 +354,7 @@ void Foam::ConeNozzleInjection<CloudType>::setPositionAndCell
{
Random& rndGen = this->owner().rndGen();
scalar beta = mathematical::twoPi*rndGen.sample01<scalar>();
scalar beta = mathematical::twoPi*rndGen.globalSample01<scalar>();
normal_ = tanVec1_*cos(beta) + tanVec2_*sin(beta);
switch (injectionMethod_)

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_)
{

View File

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

View File

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

View File

@ -68,7 +68,7 @@ Foam::pairPotential::pairPotential
forceLookup_(0),
energyLookup_(0),
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_;
}
// ************************************************************************* //

View File

@ -301,7 +301,10 @@ Foam::ORourkeCollision<CloudType>::ORourkeCollision
(
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_;
//- Coalescence activation switch
Switch coalescence_;
//- Coalescence activated?
bool coalescence_;
// Protected Member Functions

Some files were not shown because too many files have changed in this diff Show More