mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
GIT: resolved merge conflict
This commit is contained in:
@ -66,7 +66,7 @@ int main(int argc, char *argv[])
|
|||||||
fft::reverseTransform
|
fft::reverseTransform
|
||||||
(
|
(
|
||||||
K/(mag(K) + 1.0e-6) ^ forceGen.newField(), K.nn()
|
K/(mag(K) + 1.0e-6) ^ forceGen.newField(), K.nn()
|
||||||
)
|
)*recRootN
|
||||||
);
|
);
|
||||||
|
|
||||||
#include "globalProperties.H"
|
#include "globalProperties.H"
|
||||||
|
|||||||
@ -19,3 +19,10 @@
|
|||||||
|
|
||||||
Kmesh K(mesh);
|
Kmesh K(mesh);
|
||||||
UOprocess forceGen(K, runTime.deltaTValue(), turbulenceProperties);
|
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));
|
||||||
|
|||||||
@ -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"
|
||||||
|
|||||||
@ -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"
|
||||||
|
|||||||
@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -67,7 +67,7 @@ protected:
|
|||||||
const volVectorField& U_;
|
const volVectorField& U_;
|
||||||
const surfaceScalarField& phi_;
|
const surfaceScalarField& phi_;
|
||||||
|
|
||||||
Switch on_;
|
bool on_;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -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);
|
||||||
|
|
||||||
|
|||||||
@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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"));
|
||||||
|
|||||||
@ -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);
|
||||||
|
|||||||
@ -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;
|
||||||
|
|||||||
@ -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;
|
||||||
|
|||||||
@ -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;
|
||||||
|
|||||||
@ -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
|
||||||
(
|
(
|
||||||
|
|||||||
@ -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>
|
||||||
|
|||||||
@ -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"));
|
||||||
|
|||||||
@ -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"));
|
||||||
|
|||||||
@ -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;
|
||||||
|
|
||||||
|
|||||||
@ -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");
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -39,7 +39,6 @@ Description
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "fvCFD.H"
|
#include "fvCFD.H"
|
||||||
#include "Switch.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|||||||
@ -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");
|
||||||
|
|||||||
@ -39,7 +39,6 @@ Description
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "fvCFD.H"
|
#include "fvCFD.H"
|
||||||
#include "Switch.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|||||||
@ -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));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -137,10 +137,9 @@ int main(int argc, char *argv[])
|
|||||||
<< cells.instance()/cells.local()/cells.name()
|
<< cells.instance()/cells.local()/cells.name()
|
||||||
<< nl << endl;
|
<< nl << endl;
|
||||||
|
|
||||||
for (const label celli : cells)
|
|
||||||
{
|
cutCells.retain(cells);
|
||||||
cutCells.erase(celli);
|
|
||||||
}
|
|
||||||
Info<< "Removed from cells to cut all the ones not in set "
|
Info<< "Removed from cells to cut all the ones not in set "
|
||||||
<< setName << nl << endl;
|
<< setName << nl << endl;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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;
|
||||||
|
|
||||||
|
|||||||
@ -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);
|
||||||
|
|||||||
@ -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);
|
||||||
|
|
||||||
|
|||||||
@ -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)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -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"))
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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;
|
||||||
|
|||||||
@ -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_;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -150,7 +150,7 @@ Foam::CV2D::CV2D
|
|||||||
),
|
),
|
||||||
z_
|
z_
|
||||||
(
|
(
|
||||||
point
|
Foam::point
|
||||||
(
|
(
|
||||||
cvMeshDict.subDict("surfaceConformation").lookup("locationInMesh")
|
cvMeshDict.subDict("surfaceConformation").lookup("locationInMesh")
|
||||||
).z()
|
).z()
|
||||||
@ -260,7 +260,7 @@ void Foam::CV2D::insertGrid()
|
|||||||
{
|
{
|
||||||
for (int j=0; j<nj; j++)
|
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())
|
if (meshControls().randomiseInitialGrid())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -347,9 +347,9 @@ public:
|
|||||||
|
|
||||||
// Conversion functions between point2D, point and Point
|
// 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 const point2DField toPoint2D(const pointField&) const;
|
||||||
inline point toPoint3D(const point2D&) const;
|
inline Foam::point toPoint3D(const point2D&) const;
|
||||||
|
|
||||||
#ifdef CGAL_INEXACT
|
#ifdef CGAL_INEXACT
|
||||||
typedef const point2D& point2DFromPoint;
|
typedef const point2D& point2DFromPoint;
|
||||||
@ -361,7 +361,7 @@ public:
|
|||||||
|
|
||||||
inline point2DFromPoint toPoint2D(const Point&) const;
|
inline point2DFromPoint toPoint2D(const Point&) const;
|
||||||
inline PointFromPoint2D toPoint(const point2D&) const;
|
inline PointFromPoint2D toPoint(const point2D&) const;
|
||||||
inline point toPoint3D(const Point&) const;
|
inline Foam::point toPoint3D(const Point&) const;
|
||||||
|
|
||||||
|
|
||||||
// Point insertion
|
// Point insertion
|
||||||
|
|||||||
@ -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);
|
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
|
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
|
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_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -210,8 +210,8 @@ void Foam::CV2D::extractPatches
|
|||||||
|| (vB->internalOrBoundaryPoint() && !vA->internalOrBoundaryPoint())
|
|| (vB->internalOrBoundaryPoint() && !vA->internalOrBoundaryPoint())
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
point ptA = toPoint3D(vA->point());
|
Foam::point ptA = toPoint3D(vA->point());
|
||||||
point ptB = toPoint3D(vB->point());
|
Foam::point ptB = toPoint3D(vB->point());
|
||||||
|
|
||||||
label patchIndex = qSurf_.findPatch(ptA, ptB);
|
label patchIndex = qSurf_.findPatch(ptA, ptB);
|
||||||
|
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -295,7 +295,7 @@ void Foam::CV2D::markNearBoundaryPoints()
|
|||||||
{
|
{
|
||||||
if (vit->internalPoint())
|
if (vit->internalPoint())
|
||||||
{
|
{
|
||||||
point vert(toPoint3D(vit->point()));
|
Foam::point vert(toPoint3D(vit->point()));
|
||||||
|
|
||||||
pointIndexHit pHit;
|
pointIndexHit pHit;
|
||||||
label hitSurface = -1;
|
label hitSurface = -1;
|
||||||
|
|||||||
@ -109,8 +109,8 @@ void Foam::CV2D::insertFeaturePoints()
|
|||||||
{
|
{
|
||||||
const edge& e = feMesh.edges()[edgeI];
|
const edge& e = feMesh.edges()[edgeI];
|
||||||
|
|
||||||
const point& ep0 = points[e.start()];
|
const Foam::point& ep0 = points[e.start()];
|
||||||
const point& ep1 = points[e.end()];
|
const Foam::point& ep1 = points[e.end()];
|
||||||
|
|
||||||
const linePointRef line(ep0, ep1);
|
const linePointRef line(ep0, ep1);
|
||||||
|
|
||||||
|
|||||||
@ -39,7 +39,7 @@ bool Foam::CV2D::dualCellSurfaceIntersection
|
|||||||
{
|
{
|
||||||
if (!is_infinite(ec))
|
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 edge end is outside bounding box then edge cuts boundary
|
||||||
if (!qSurf_.globalBounds().contains(e0))
|
if (!qSurf_.globalBounds().contains(e0))
|
||||||
@ -47,7 +47,8 @@ bool Foam::CV2D::dualCellSurfaceIntersection
|
|||||||
return true;
|
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 other edge end is outside bounding box then edge cuts boundary
|
||||||
if (!qSurf_.globalBounds().contains(e1))
|
if (!qSurf_.globalBounds().contains(e1))
|
||||||
|
|||||||
@ -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)
|
||||||
);
|
);
|
||||||
|
|||||||
@ -457,16 +457,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");
|
||||||
@ -730,10 +730,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";
|
||||||
@ -813,7 +812,6 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
createFaces
|
createFaces
|
||||||
(
|
(
|
||||||
internalFacesOnly,
|
internalFacesOnly,
|
||||||
@ -910,10 +908,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();
|
||||||
|
|
||||||
|
|||||||
@ -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:
|
||||||
|
|
||||||
|
|||||||
@ -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();
|
||||||
|
|
||||||
|
|||||||
@ -50,7 +50,7 @@ Usage
|
|||||||
Write differences with respect to the specified dictionary
|
Write differences with respect to the specified dictionary
|
||||||
(or sub entry if -entry specified)
|
(or sub entry if -entry specified)
|
||||||
|
|
||||||
- \par -diffEtc \<dictionary\>
|
- \par -diff-etc \<dictionary\>
|
||||||
Write differences with respect to the specified dictionary
|
Write differences with respect to the specified dictionary
|
||||||
(or sub entry if -entry specified)
|
(or sub entry if -entry specified)
|
||||||
|
|
||||||
@ -94,13 +94,13 @@ Usage
|
|||||||
|
|
||||||
- Write the differences with respect to a template dictionary:
|
- Write the differences with respect to a template dictionary:
|
||||||
\verbatim
|
\verbatim
|
||||||
foamDictionary 0/U -diffEtc templates/closedVolume/0/U
|
foamDictionary 0/U -diff-etc templates/closedVolume/0/U
|
||||||
\endverbatim
|
\endverbatim
|
||||||
|
|
||||||
- Write the differences in boundaryField with respect to a
|
- Write the differences in boundaryField with respect to a
|
||||||
template dictionary:
|
template dictionary:
|
||||||
\verbatim
|
\verbatim
|
||||||
foamDictionary 0/U -diffEtc templates/closedVolume/0/U \
|
foamDictionary 0/U -diff-etc templates/closedVolume/0/U \
|
||||||
-entry boundaryField
|
-entry boundaryField
|
||||||
\endverbatim
|
\endverbatim
|
||||||
|
|
||||||
@ -217,11 +217,9 @@ const dictionary& lookupScopedDict
|
|||||||
if (!eptr || !eptr->isDict())
|
if (!eptr || !eptr->isDict())
|
||||||
{
|
{
|
||||||
FatalIOErrorInFunction(dict)
|
FatalIOErrorInFunction(dict)
|
||||||
<< "keyword " << subDictName
|
<< "'" << subDictName << "' not found in dictionary "
|
||||||
<< " is undefined in dictionary "
|
<< dict.name() << " or is not a dictionary" << nl
|
||||||
<< dict.name() << " or is not a dictionary"
|
<< "Known entries are " << dict.keys()
|
||||||
<< endl
|
|
||||||
<< "Valid keywords are " << dict.keys()
|
|
||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -300,10 +298,12 @@ int main(int argc, char *argv[])
|
|||||||
);
|
);
|
||||||
argList::addOption
|
argList::addOption
|
||||||
(
|
(
|
||||||
"diffEtc",
|
"diff-etc",
|
||||||
"dict",
|
"dict",
|
||||||
"As per -diff, but locate the file as per foamEtcFile"
|
"As per -diff, but locate the file as per foamEtcFile"
|
||||||
);
|
);
|
||||||
|
argList::addOptionCompat("diff-etc", {"diffEtc", 1712});
|
||||||
|
|
||||||
argList::addBoolOption
|
argList::addBoolOption
|
||||||
(
|
(
|
||||||
"includes",
|
"includes",
|
||||||
@ -371,10 +371,10 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Has "diff" or "diffEtc"
|
// Has "diff" or "diff-etc"
|
||||||
bool optDiff = false;
|
bool optDiff = false;
|
||||||
|
|
||||||
// Reference dictionary for -diff / -diffEtc
|
// Reference dictionary for -diff / -diff-etc
|
||||||
dictionary diffDict;
|
dictionary diffDict;
|
||||||
{
|
{
|
||||||
fileName diffFileName;
|
fileName diffFileName;
|
||||||
@ -392,7 +392,7 @@ int main(int argc, char *argv[])
|
|||||||
diffDict.read(diffFile, true);
|
diffDict.read(diffFile, true);
|
||||||
optDiff = true;
|
optDiff = true;
|
||||||
}
|
}
|
||||||
else if (args.readIfPresent("diffEtc", diffFileName))
|
else if (args.readIfPresent("diff-etc", diffFileName))
|
||||||
{
|
{
|
||||||
fileName foundName = findEtcFile(diffFileName);
|
fileName foundName = findEtcFile(diffFileName);
|
||||||
if (foundName.empty())
|
if (foundName.empty())
|
||||||
|
|||||||
@ -55,8 +55,8 @@ Usage
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Input file
|
// Input files list
|
||||||
inputFile "postProcessing/faceSource1/surface/patch/patch.case";
|
files ("postProcessing/faceSource1/surface/patch/patch.case";)
|
||||||
|
|
||||||
// Surface reader
|
// Surface reader
|
||||||
reader ensight;
|
reader ensight;
|
||||||
|
|||||||
@ -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)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -63,4 +63,6 @@ alpha1Min/Min\(alpha1\) =/Min(alpha1) =
|
|||||||
alpha1Max/Max\(alpha1\) =/Max(alpha1) =
|
alpha1Max/Max\(alpha1\) =/Max(alpha1) =
|
||||||
|
|
||||||
# AMI
|
# 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 =
|
||||||
|
|||||||
@ -43,7 +43,7 @@
|
|||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
|
# 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 ParaView_QT=qt-system
|
||||||
set cmake_version=cmake-system
|
set cmake_version=cmake-system
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ if ( $?ParaView_VERSION ) then
|
|||||||
set qtDir="$archDir/$ParaView_QT"
|
set qtDir="$archDir/$ParaView_QT"
|
||||||
if ( -d "$qtDir" ) then
|
if ( -d "$qtDir" ) then
|
||||||
switch ($ParaView_QT)
|
switch ($ParaView_QT)
|
||||||
case *-qt*:
|
case *-5*:
|
||||||
setenv Qt5_DIR $qtDir
|
setenv Qt5_DIR $qtDir
|
||||||
breaksw
|
breaksw
|
||||||
endsw
|
endsw
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
# ========= |
|
# ========= |
|
||||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
# \\ / O peration |
|
# \\ / O peration |
|
||||||
# \\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
# \\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd.
|
||||||
# \\/ M anipulation |
|
# \\/ M anipulation |
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# License
|
# License
|
||||||
@ -109,7 +109,7 @@ _of_complete_()
|
|||||||
local choices
|
local choices
|
||||||
|
|
||||||
case ${prev} in
|
case ${prev} in
|
||||||
-help|-help-full|-doc|-doc-source)
|
-help | -help-full | -doc | -doc-source)
|
||||||
# These options are usage - we can stop now.
|
# These options are usage - we can stop now.
|
||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
return 0
|
return 0
|
||||||
@ -126,7 +126,7 @@ _of_complete_()
|
|||||||
COMPREPLY=($(compgen -W "$choices" -- ${cur}))
|
COMPREPLY=($(compgen -W "$choices" -- ${cur}))
|
||||||
;;
|
;;
|
||||||
-fileHandler)
|
-fileHandler)
|
||||||
choices="collated uncollated masterUncollated"
|
choices="collated uncollated hostCollated masterUncollated"
|
||||||
COMPREPLY=($(compgen -W "$choices" -- ${cur}))
|
COMPREPLY=($(compgen -W "$choices" -- ${cur}))
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
|||||||
@ -46,7 +46,7 @@
|
|||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
|
# 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
|
ParaView_QT=qt-system
|
||||||
cmake_version=cmake-system
|
cmake_version=cmake-system
|
||||||
|
|
||||||
|
|||||||
@ -138,7 +138,7 @@ const T* Foam::DictionaryBase<IDLListType, T>::lookup(const word& keyword) const
|
|||||||
if (iter == hashedTs_.end())
|
if (iter == hashedTs_.end())
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< keyword << " is undefined"
|
<< "'" << keyword << "' not found"
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,7 +154,7 @@ T* Foam::DictionaryBase<IDLListType, T>::lookup(const word& keyword)
|
|||||||
if (iter == hashedTs_.end())
|
if (iter == hashedTs_.end())
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< keyword << " is undefined"
|
<< "'" << keyword << "' not found"
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
\\ / 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
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -24,6 +24,8 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "dictionary.H"
|
#include "dictionary.H"
|
||||||
|
#include "error.H"
|
||||||
|
#include "JobInfo.H"
|
||||||
#include "primitiveEntry.H"
|
#include "primitiveEntry.H"
|
||||||
#include "dictionaryEntry.H"
|
#include "dictionaryEntry.H"
|
||||||
#include "regExp.H"
|
#include "regExp.H"
|
||||||
@ -48,7 +50,6 @@ bool Foam::dictionary::writeOptionalEntries
|
|||||||
|
|
||||||
void Foam::dictionary::excessTokens
|
void Foam::dictionary::excessTokens
|
||||||
(
|
(
|
||||||
OSstream& msg,
|
|
||||||
const word& keyword,
|
const word& keyword,
|
||||||
const ITstream& is
|
const ITstream& is
|
||||||
) const
|
) const
|
||||||
@ -60,12 +61,44 @@ void Foam::dictionary::excessTokens
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
msg << "entry '" << keyword << "' has "
|
// Similar to SafeFatalIOError
|
||||||
<< nExcess << " excess tokens, near line: " << is.lineNumber() << nl
|
|
||||||
<< "dictionary: " << name() << nl
|
if (JobInfo::constructed)
|
||||||
<< "stream: ";
|
{
|
||||||
is.writeList(msg, 0);
|
OSstream& err =
|
||||||
msg << nl;
|
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())
|
if (!finder.found())
|
||||||
{
|
{
|
||||||
FatalIOErrorInFunction
|
FatalIOErrorInFunction(*this)
|
||||||
(
|
<< "'" << keyword << "' not found in dictionary "
|
||||||
*this
|
|
||||||
) << "keyword " << keyword << " is undefined in dictionary "
|
|
||||||
<< name()
|
<< name()
|
||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
@ -422,10 +453,8 @@ const Foam::dictionary& Foam::dictionary::subDict(const word& keyword) const
|
|||||||
|
|
||||||
if (!finder.found())
|
if (!finder.found())
|
||||||
{
|
{
|
||||||
FatalIOErrorInFunction
|
FatalIOErrorInFunction(*this)
|
||||||
(
|
<< "'" << keyword << "' not found in dictionary "
|
||||||
*this
|
|
||||||
) << "keyword " << keyword << " is undefined in dictionary "
|
|
||||||
<< name()
|
<< name()
|
||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
@ -441,10 +470,8 @@ Foam::dictionary& Foam::dictionary::subDict(const word& keyword)
|
|||||||
|
|
||||||
if (!finder.found())
|
if (!finder.found())
|
||||||
{
|
{
|
||||||
FatalIOErrorInFunction
|
FatalIOErrorInFunction(*this)
|
||||||
(
|
<< "'" << keyword << "' not found in dictionary "
|
||||||
*this
|
|
||||||
) << "keyword " << keyword << " is undefined in dictionary "
|
|
||||||
<< name()
|
<< name()
|
||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
@ -470,20 +497,18 @@ Foam::dictionary Foam::dictionary::subOrEmptyDict
|
|||||||
|
|
||||||
if (mustRead)
|
if (mustRead)
|
||||||
{
|
{
|
||||||
FatalIOErrorInFunction
|
FatalIOErrorInFunction(*this)
|
||||||
(
|
<< "'" << keyword
|
||||||
*this
|
<< "' is not a sub-dictionary in dictionary "
|
||||||
) << "keyword " << keyword
|
|
||||||
<< " is not a sub-dictionary in dictionary "
|
|
||||||
<< name()
|
<< name()
|
||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (finder.found())
|
if (finder.found())
|
||||||
{
|
{
|
||||||
IOWarningInFunction((*this))
|
IOWarningInFunction(*this)
|
||||||
<< "keyword " << keyword
|
<< "'" << keyword
|
||||||
<< " found but not a sub-dictionary in dictionary "
|
<< "' found but not a sub-dictionary in dictionary "
|
||||||
<< name() << endl;
|
<< name() << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -506,9 +531,9 @@ const Foam::dictionary& Foam::dictionary::optionalSubDict
|
|||||||
|
|
||||||
if (finder.found())
|
if (finder.found())
|
||||||
{
|
{
|
||||||
IOWarningInFunction((*this))
|
IOWarningInFunction(*this)
|
||||||
<< "keyword " << keyword
|
<< "'" << keyword
|
||||||
<< " found but not a sub-dictionary in dictionary "
|
<< "' found but not a sub-dictionary in dictionary "
|
||||||
<< name() << endl;
|
<< name() << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -597,7 +622,7 @@ Foam::entry* Foam::dictionary::add(entry* entryPtr, bool mergeEntry)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
IOWarningInFunction((*this))
|
IOWarningInFunction(*this)
|
||||||
<< "problem replacing entry "<< entryPtr->keyword()
|
<< "problem replacing entry "<< entryPtr->keyword()
|
||||||
<< " in dictionary " << name() << endl;
|
<< " 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()
|
<< "attempt to add entry " << entryPtr->keyword()
|
||||||
<< " which already exists in dictionary " << name()
|
<< " which already exists in dictionary " << name()
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
\\ / 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
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -143,18 +143,18 @@ public:
|
|||||||
return name_;
|
return name_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return the dictionary name
|
//- Return the dictionary name for modification (use with caution).
|
||||||
fileName& name()
|
fileName& name()
|
||||||
{
|
{
|
||||||
return name_;
|
return name_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return the local dictionary name (final part of scoped name)
|
//- Return the local dictionary name (final part of scoped name)
|
||||||
const word dictName() const
|
word dictName() const
|
||||||
{
|
{
|
||||||
const word scopedName = name_.name();
|
word scopedName(name_.name());
|
||||||
const auto i = scopedName.rfind('.');
|
|
||||||
|
|
||||||
|
const auto i = scopedName.rfind('.');
|
||||||
if (i == std::string::npos)
|
if (i == std::string::npos)
|
||||||
{
|
{
|
||||||
return scopedName;
|
return scopedName;
|
||||||
@ -383,13 +383,8 @@ private:
|
|||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
|
||||||
//- Add report of excess tokens to the messageStream
|
//- Emit FatalIOError if excess tokens exist
|
||||||
void excessTokens
|
void excessTokens(const word& keyword, const ITstream& is) const;
|
||||||
(
|
|
||||||
OSstream& msg,
|
|
||||||
const word& keyword,
|
|
||||||
const ITstream& is
|
|
||||||
) const;
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -505,7 +500,7 @@ public:
|
|||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Find and return an entry pointer for manipulation if present,
|
//- Find and return an entry pointer for manipulation if present,
|
||||||
// or return a nullptr.
|
//- or return a nullptr.
|
||||||
//
|
//
|
||||||
// \param recursive search parent dictionaries
|
// \param recursive search parent dictionaries
|
||||||
// \param patternMatch use regular expressions
|
// \param patternMatch use regular expressions
|
||||||
@ -516,7 +511,7 @@ public:
|
|||||||
bool patternMatch
|
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 recursive search parent dictionaries
|
||||||
// \param patternMatch use regular expressions
|
// \param patternMatch use regular expressions
|
||||||
@ -528,7 +523,7 @@ public:
|
|||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Find and return a T.
|
//- 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.
|
// Default search: non-recursive with patterns.
|
||||||
//
|
//
|
||||||
// \param recursive search parent dictionaries
|
// \param recursive search parent dictionaries
|
||||||
@ -554,13 +549,13 @@ public:
|
|||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Find and return a T.
|
//- 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.
|
// Default search: non-recursive with patterns.
|
||||||
//
|
//
|
||||||
// \param recursive search parent dictionaries
|
// \param recursive search parent dictionaries
|
||||||
// \param patternMatch use regular expressions
|
// \param patternMatch use regular expressions
|
||||||
//
|
//
|
||||||
// \note same as get()
|
// \deprecated - same as the get() method
|
||||||
template<class T>
|
template<class T>
|
||||||
T lookupType
|
T lookupType
|
||||||
(
|
(
|
||||||
@ -570,7 +565,7 @@ public:
|
|||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Find and return a T, or return the given default value
|
//- 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.
|
// Default search: non-recursive with patterns.
|
||||||
//
|
//
|
||||||
// \param recursive search parent dictionaries
|
// \param recursive search parent dictionaries
|
||||||
@ -586,7 +581,7 @@ public:
|
|||||||
|
|
||||||
//- Find and return a T, or return the given default value
|
//- Find and return a T, or return the given default value
|
||||||
//- and add it to dictionary.
|
//- 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.
|
// Default search: non-recursive with patterns.
|
||||||
//
|
//
|
||||||
// \param recursive search parent dictionaries
|
// \param recursive search parent dictionaries
|
||||||
@ -600,8 +595,26 @@ public:
|
|||||||
bool patternMatch = true
|
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.
|
//- 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.
|
// Default search: non-recursive with patterns.
|
||||||
//
|
//
|
||||||
// \param val the value to read
|
// \param val the value to read
|
||||||
@ -662,7 +675,7 @@ public:
|
|||||||
dictionary& subDict(const word& keyword);
|
dictionary& subDict(const word& keyword);
|
||||||
|
|
||||||
//- Find and return a sub-dictionary as a copy, otherwise return
|
//- 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.
|
// Warn if the entry exists but is not a sub-dictionary.
|
||||||
//
|
//
|
||||||
// Search type: non-recursive with patterns.
|
// Search type: non-recursive with patterns.
|
||||||
@ -984,7 +997,7 @@ public:
|
|||||||
bool patternMatch
|
bool patternMatch
|
||||||
) const;
|
) 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.
|
//- using any compatibility names if needed.
|
||||||
//
|
//
|
||||||
// \param compat list of old compatibility keywords and the last
|
// \param compat list of old compatibility keywords and the last
|
||||||
@ -999,6 +1012,24 @@ public:
|
|||||||
bool patternMatch
|
bool patternMatch
|
||||||
) const;
|
) 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,
|
//- Find and return an entry data stream,
|
||||||
//- using any compatibility names if needed.
|
//- using any compatibility names if needed.
|
||||||
// Default search: non-recursive with patterns.
|
// Default search: non-recursive with patterns.
|
||||||
@ -1033,8 +1064,32 @@ public:
|
|||||||
bool patternMatch = true
|
bool patternMatch = true
|
||||||
) const;
|
) 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
|
//- Find an entry if present, and assign to T val
|
||||||
//- using any compatibility names if needed.
|
//- using any compatibility names if needed.
|
||||||
|
//- FatalIOError if it is found and there are excess tokens.
|
||||||
// Default search: non-recursive with patterns.
|
// Default search: non-recursive with patterns.
|
||||||
//
|
//
|
||||||
// \param compat list of old compatibility keywords and the last
|
// \param compat list of old compatibility keywords and the last
|
||||||
|
|||||||
@ -52,7 +52,7 @@ Foam::dictionary::const_searcher Foam::dictionary::csearchCompat
|
|||||||
bool patternMatch
|
bool patternMatch
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const_searcher finder(csearch(keyword, recursive,patternMatch));
|
const_searcher finder(csearch(keyword, recursive, patternMatch));
|
||||||
|
|
||||||
if (finder.found())
|
if (finder.found())
|
||||||
{
|
{
|
||||||
@ -61,7 +61,7 @@ Foam::dictionary::const_searcher Foam::dictionary::csearchCompat
|
|||||||
|
|
||||||
for (const std::pair<const char*,int>& iter : compat)
|
for (const std::pair<const char*,int>& iter : compat)
|
||||||
{
|
{
|
||||||
finder = csearch(word::validate(iter.first), recursive,patternMatch);
|
finder = csearch(word::validate(iter.first), recursive, patternMatch);
|
||||||
|
|
||||||
if (finder.found())
|
if (finder.found())
|
||||||
{
|
{
|
||||||
@ -95,7 +95,7 @@ bool Foam::dictionary::foundCompat
|
|||||||
bool patternMatch
|
bool patternMatch
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
return csearchCompat(keyword, compat, recursive,patternMatch).found();
|
return csearchCompat(keyword, compat, recursive, patternMatch).found();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -107,7 +107,7 @@ const Foam::entry* Foam::dictionary::lookupEntryPtrCompat
|
|||||||
bool patternMatch
|
bool patternMatch
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
return csearchCompat(keyword, compat, recursive,patternMatch).ptr();
|
return csearchCompat(keyword, compat, recursive, patternMatch).ptr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -120,14 +120,12 @@ const Foam::entry& Foam::dictionary::lookupEntryCompat
|
|||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const const_searcher
|
const const_searcher
|
||||||
finder(csearchCompat(keyword, compat, recursive,patternMatch));
|
finder(csearchCompat(keyword, compat, recursive, patternMatch));
|
||||||
|
|
||||||
if (!finder.found())
|
if (!finder.found())
|
||||||
{
|
{
|
||||||
FatalIOErrorInFunction
|
FatalIOErrorInFunction(*this)
|
||||||
(
|
<< "'" << keyword << "' not found in dictionary "
|
||||||
*this
|
|
||||||
) << "keyword " << keyword << " is undefined in dictionary "
|
|
||||||
<< name()
|
<< name()
|
||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
@ -144,7 +142,8 @@ Foam::ITstream& Foam::dictionary::lookupCompat
|
|||||||
bool patternMatch
|
bool patternMatch
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
return lookupEntryCompat(keyword, compat, recursive,patternMatch).stream();
|
return
|
||||||
|
lookupEntryCompat(keyword, compat, recursive, patternMatch).stream();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -27,18 +27,17 @@ License
|
|||||||
#include "dictionaryEntry.H"
|
#include "dictionaryEntry.H"
|
||||||
#include "stringOps.H"
|
#include "stringOps.H"
|
||||||
|
|
||||||
/* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */
|
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace
|
||||||
{
|
{
|
||||||
// file-scope
|
// Walk lists of patterns and regexps for an exact match
|
||||||
//- Walk lists of patterns and regexps for an exact match
|
// or a regular expression match
|
||||||
// or regular expression match
|
|
||||||
template<class WcIterator, class ReIterator>
|
template<class WcIterator, class ReIterator>
|
||||||
static bool findInPatterns
|
static bool findInPatterns
|
||||||
(
|
(
|
||||||
const bool patternMatch,
|
const bool patternMatch,
|
||||||
const word& keyword,
|
const Foam::word& keyword,
|
||||||
WcIterator& wcIter,
|
WcIterator& wcIter,
|
||||||
ReIterator& reIter
|
ReIterator& reIter
|
||||||
)
|
)
|
||||||
@ -61,7 +60,8 @@ namespace Foam
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
} // End anonymous namespace
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
@ -73,7 +73,7 @@ Foam::dictionary::const_searcher Foam::dictionary::csearchDotScoped
|
|||||||
bool patternMatch
|
bool patternMatch
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
std::string::size_type scopePos = keyword.find('.');
|
auto scopePos = keyword.find('.');
|
||||||
|
|
||||||
if (scopePos == string::npos)
|
if (scopePos == string::npos)
|
||||||
{
|
{
|
||||||
@ -101,10 +101,8 @@ Foam::dictionary::const_searcher Foam::dictionary::csearchDotScoped
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FatalIOErrorInFunction
|
FatalIOErrorInFunction(*this)
|
||||||
(
|
<< "No parent of current dictionary when searching for "
|
||||||
*this
|
|
||||||
) << "No parent of current dictionary when searching for "
|
|
||||||
<< keyword.substr(1)
|
<< keyword.substr(1)
|
||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
|
|
||||||
@ -210,10 +208,8 @@ Foam::dictionary::const_searcher Foam::dictionary::csearchSlashScoped
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FatalIOErrorInFunction
|
FatalIOErrorInFunction(*dictPtr)
|
||||||
(
|
<< "No parent of current dictionary when searching for "
|
||||||
*dictPtr
|
|
||||||
) << "No parent of current dictionary when searching for "
|
|
||||||
<< keyword << " at " << cmpt
|
<< keyword << " at " << cmpt
|
||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
break;
|
break;
|
||||||
@ -424,10 +420,8 @@ const Foam::dictionary* Foam::dictionary::cfindScopedDictPtr
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FatalIOErrorInFunction
|
FatalIOErrorInFunction(*dictPtr)
|
||||||
(
|
<< "No parent for dictionary while searching "
|
||||||
*dictPtr
|
|
||||||
) << "No parent for dictionary while searching "
|
|
||||||
<< path
|
<< path
|
||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
|
|
||||||
@ -451,10 +445,8 @@ const Foam::dictionary* Foam::dictionary::cfindScopedDictPtr
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FatalIOErrorInFunction
|
FatalIOErrorInFunction(*dictPtr)
|
||||||
(
|
<< "Found entry '" << cmpt
|
||||||
*dictPtr
|
|
||||||
) << "Found entry '" << cmpt
|
|
||||||
<< "' but not a dictionary, while searching scoped"
|
<< "' but not a dictionary, while searching scoped"
|
||||||
<< nl
|
<< nl
|
||||||
<< " " << path
|
<< " " << path
|
||||||
@ -533,10 +525,8 @@ Foam::dictionary* Foam::dictionary::makeScopedDictPtr(const fileName& dictPath)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FatalIOErrorInFunction
|
FatalIOErrorInFunction(*dictPtr)
|
||||||
(
|
<< "No parent for dictionary while searching "
|
||||||
*dictPtr
|
|
||||||
) << "No parent for dictionary while searching "
|
|
||||||
<< path
|
<< path
|
||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
|
|
||||||
@ -561,10 +551,8 @@ Foam::dictionary* Foam::dictionary::makeScopedDictPtr(const fileName& dictPath)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FatalIOErrorInFunction
|
FatalIOErrorInFunction(*dictPtr)
|
||||||
(
|
<< "Cannot create sub-dictionary entry '" << cmptName
|
||||||
*dictPtr
|
|
||||||
) << "Cannot create sub-dictionary entry '" << cmptName
|
|
||||||
<< "' - a non-dictionary entry is in the way"
|
<< "' - a non-dictionary entry is in the way"
|
||||||
<< nl << "Encountered in scope" << nl
|
<< nl << "Encountered in scope" << nl
|
||||||
<< " " << path
|
<< " " << path
|
||||||
@ -621,10 +609,8 @@ bool Foam::dictionary::remove(const word& keyword)
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -651,10 +637,8 @@ bool Foam::dictionary::changeKeyword
|
|||||||
|
|
||||||
if (iter()->keyword().isPattern())
|
if (iter()->keyword().isPattern())
|
||||||
{
|
{
|
||||||
FatalIOErrorInFunction
|
FatalIOErrorInFunction(*this)
|
||||||
(
|
<< "Old keyword "<< oldKeyword
|
||||||
*this
|
|
||||||
) << "Old keyword "<< oldKeyword
|
|
||||||
<< " is a pattern."
|
<< " is a pattern."
|
||||||
<< "Pattern replacement not yet implemented."
|
<< "Pattern replacement not yet implemented."
|
||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
@ -688,10 +672,8 @@ bool Foam::dictionary::changeKeyword
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
IOWarningInFunction
|
IOWarningInFunction(*this)
|
||||||
(
|
<< "cannot rename keyword "<< oldKeyword
|
||||||
*this
|
|
||||||
) << "cannot rename keyword "<< oldKeyword
|
|
||||||
<< " to existing keyword " << newKeyword
|
<< " to existing keyword " << newKeyword
|
||||||
<< " in dictionary " << name() << endl;
|
<< " in dictionary " << name() << endl;
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -57,31 +57,63 @@ T Foam::dictionary::get
|
|||||||
bool patternMatch
|
bool patternMatch
|
||||||
) const
|
) 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;
|
T val;
|
||||||
ITstream& is = finder.ptr()->stream();
|
read<T>(keyword, val, recursive, patternMatch);
|
||||||
is >> val;
|
|
||||||
|
|
||||||
if (!is.eof())
|
|
||||||
{
|
|
||||||
auto err = FatalIOErrorInFunction(*this);
|
|
||||||
excessTokens(err, keyword, is);
|
|
||||||
err << exit(FatalIOError);
|
|
||||||
}
|
|
||||||
|
|
||||||
return val;
|
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>
|
template<class T>
|
||||||
T Foam::dictionary::lookupType
|
T Foam::dictionary::lookupType
|
||||||
(
|
(
|
||||||
@ -112,21 +144,15 @@ T Foam::dictionary::lookupOrDefault
|
|||||||
ITstream& is = finder.ptr()->stream();
|
ITstream& is = finder.ptr()->stream();
|
||||||
is >> val;
|
is >> val;
|
||||||
|
|
||||||
if (!is.eof())
|
excessTokens(keyword, is);
|
||||||
{
|
|
||||||
auto err = FatalIOErrorInFunction(*this);
|
|
||||||
excessTokens(err, keyword, is);
|
|
||||||
err << exit(FatalIOError);
|
|
||||||
}
|
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
else if (writeOptionalEntries)
|
||||||
if (writeOptionalEntries)
|
|
||||||
{
|
{
|
||||||
IOInfoInFunction(*this)
|
IOInfoInFunction(*this)
|
||||||
<< "Optional entry '" << keyword << "' is not present,"
|
<< "Optional entry '" << keyword << "' not found,"
|
||||||
<< " returning the default value '" << deflt << "'"
|
<< " using default value '" << deflt << "'"
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,21 +178,15 @@ T Foam::dictionary::lookupOrAddDefault
|
|||||||
ITstream& is = finder.ptr()->stream();
|
ITstream& is = finder.ptr()->stream();
|
||||||
is >> val;
|
is >> val;
|
||||||
|
|
||||||
if (!is.eof())
|
excessTokens(keyword, is);
|
||||||
{
|
|
||||||
auto err = FatalIOErrorInFunction(*this);
|
|
||||||
excessTokens(err, keyword, is);
|
|
||||||
err << exit(FatalIOError);
|
|
||||||
}
|
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
else if (writeOptionalEntries)
|
||||||
if (writeOptionalEntries)
|
|
||||||
{
|
{
|
||||||
IOInfoInFunction(*this)
|
IOInfoInFunction(*this)
|
||||||
<< "Optional entry '" << keyword << "' is not present,"
|
<< "Optional entry '" << keyword << "' not found,"
|
||||||
<< " adding and returning the default value '" << deflt << "'"
|
<< " adding default value '" << deflt << "'"
|
||||||
<< endl;
|
<< 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>
|
template<class T>
|
||||||
bool Foam::dictionary::readIfPresent
|
bool Foam::dictionary::readIfPresent
|
||||||
(
|
(
|
||||||
@ -184,32 +237,8 @@ bool Foam::dictionary::readIfPresent
|
|||||||
bool patternMatch
|
bool patternMatch
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const const_searcher finder(csearch(keyword, recursive, patternMatch));
|
// Read is non-mandatory
|
||||||
|
return read<T>(keyword, val, recursive, patternMatch, false);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -233,21 +262,15 @@ T Foam::dictionary::lookupOrDefaultCompat
|
|||||||
ITstream& is = finder.ptr()->stream();
|
ITstream& is = finder.ptr()->stream();
|
||||||
is >> val;
|
is >> val;
|
||||||
|
|
||||||
if (!is.eof())
|
excessTokens(keyword, is);
|
||||||
{
|
|
||||||
auto err = FatalIOErrorInFunction(*this);
|
|
||||||
excessTokens(err, keyword, is);
|
|
||||||
err << exit(FatalIOError);
|
|
||||||
}
|
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
else if (writeOptionalEntries)
|
||||||
if (writeOptionalEntries)
|
|
||||||
{
|
{
|
||||||
IOInfoInFunction(*this)
|
IOInfoInFunction(*this)
|
||||||
<< "Optional entry '" << keyword << "' is not present,"
|
<< "Optional entry '" << keyword << "' not found,"
|
||||||
<< " returning the default value '" << deflt << "'"
|
<< " using default value '" << deflt << "'"
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,33 +288,8 @@ bool Foam::dictionary::readIfPresentCompat
|
|||||||
bool patternMatch
|
bool patternMatch
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const const_searcher
|
// Read is non-mandatory
|
||||||
finder(csearchCompat(keyword, compat, recursive, patternMatch));
|
return readCompat<T>(keyword, compat, recursive, patternMatch, false);
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -79,104 +79,92 @@ Foam::dlLibraryTable::~dlLibraryTable()
|
|||||||
|
|
||||||
bool Foam::dlLibraryTable::open
|
bool Foam::dlLibraryTable::open
|
||||||
(
|
(
|
||||||
const fileName& functionLibName,
|
const fileName& libName,
|
||||||
const bool verbose
|
const bool verbose
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (functionLibName.size())
|
if (libName.empty())
|
||||||
{
|
{
|
||||||
void* functionLibPtr = dlOpen
|
return false;
|
||||||
(
|
}
|
||||||
fileName(functionLibName).expand(),
|
|
||||||
verbose
|
void* ptr = dlOpen(fileName(libName).expand(), verbose);
|
||||||
);
|
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
InfoInFunction
|
InfoInFunction
|
||||||
<< "Opened " << functionLibName
|
<< "Opened " << libName
|
||||||
<< " resulting in handle " << uintptr_t(functionLibPtr) << endl;
|
<< " resulting in handle " << uintptr_t(ptr) << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!functionLibPtr)
|
if (ptr)
|
||||||
{
|
{
|
||||||
|
libPtrs_.append(ptr);
|
||||||
|
libNames_.append(libName);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
{
|
{
|
||||||
WarningInFunction
|
WarningInFunction
|
||||||
<< "could not load " << functionLibName
|
<< "could not load " << libName
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
libPtrs_.append(functionLibPtr);
|
|
||||||
libNames_.append(functionLibName);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::dlLibraryTable::close
|
bool Foam::dlLibraryTable::close
|
||||||
(
|
(
|
||||||
const fileName& functionLibName,
|
const fileName& libName,
|
||||||
const bool verbose
|
const bool verbose
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
label index = -1;
|
label index = -1;
|
||||||
forAllReverse(libNames_, i)
|
forAllReverse(libNames_, i)
|
||||||
{
|
{
|
||||||
if (libNames_[i] == functionLibName)
|
if (libName == libNames_[i])
|
||||||
{
|
{
|
||||||
index = i;
|
index = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index != -1)
|
if (index == -1)
|
||||||
{
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
InfoInFunction
|
InfoInFunction
|
||||||
<< "Closing " << functionLibName
|
<< "Closing " << libName
|
||||||
<< " with handle " << uintptr_t(libPtrs_[index]) << endl;
|
<< " with handle " << uintptr_t(libPtrs_[index]) << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ok = dlClose(libPtrs_[index]);
|
const bool ok = dlClose(libPtrs_[index]);
|
||||||
|
|
||||||
libPtrs_[index] = nullptr;
|
libPtrs_[index] = nullptr;
|
||||||
libNames_[index] = fileName::null;
|
libNames_[index].clear();
|
||||||
|
|
||||||
if (!ok)
|
if (!ok && verbose)
|
||||||
{
|
|
||||||
if (verbose)
|
|
||||||
{
|
{
|
||||||
WarningInFunction
|
WarningInFunction
|
||||||
<< "could not close " << functionLibName
|
<< "could not close " << libName
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return ok;
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void* Foam::dlLibraryTable::findLibrary(const fileName& functionLibName)
|
void* Foam::dlLibraryTable::findLibrary(const fileName& libName)
|
||||||
{
|
{
|
||||||
label index = -1;
|
label index = -1;
|
||||||
forAllReverse(libNames_, i)
|
forAllReverse(libNames_, i)
|
||||||
{
|
{
|
||||||
if (libNames_[i] == functionLibName)
|
if (libName == libNames_[i])
|
||||||
{
|
{
|
||||||
index = i;
|
index = i;
|
||||||
break;
|
break;
|
||||||
@ -187,6 +175,7 @@ void* Foam::dlLibraryTable::findLibrary(const fileName& functionLibName)
|
|||||||
{
|
{
|
||||||
return libPtrs_[index];
|
return libPtrs_[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,23 +186,20 @@ bool Foam::dlLibraryTable::open
|
|||||||
const word& libsEntry
|
const word& libsEntry
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (dict.found(libsEntry))
|
fileNameList libNames;
|
||||||
{
|
dict.readIfPresent(libsEntry, libNames);
|
||||||
fileNameList libNames(dict.lookup(libsEntry));
|
|
||||||
|
|
||||||
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;
|
return nOpen && nOpen == libNames.size();
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -49,13 +49,15 @@ namespace Foam
|
|||||||
|
|
||||||
class dlLibraryTable
|
class dlLibraryTable
|
||||||
{
|
{
|
||||||
// Private Member Functions
|
// Private data
|
||||||
|
|
||||||
DynamicList<void*> libPtrs_;
|
DynamicList<void*> libPtrs_;
|
||||||
|
|
||||||
DynamicList<fileName> libNames_;
|
DynamicList<fileName> libNames_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
//- No copy construct
|
//- No copy construct
|
||||||
dlLibraryTable(const dlLibraryTable&) = delete;
|
dlLibraryTable(const dlLibraryTable&) = delete;
|
||||||
|
|
||||||
@ -73,9 +75,9 @@ public:
|
|||||||
//- Construct null
|
//- Construct null
|
||||||
dlLibraryTable();
|
dlLibraryTable();
|
||||||
|
|
||||||
//- Construct from dictionary and name of 'libs' entry giving
|
//- Open all libraries listed in the 'libsEntry' entry in the
|
||||||
// the libraries to load
|
//- given dictionary.
|
||||||
dlLibraryTable(const dictionary&, const word&);
|
dlLibraryTable(const dictionary& dict, const word& libsEntry);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
@ -85,25 +87,25 @@ public:
|
|||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Open the named library, optionally with warnings if problems occur
|
//- 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
|
//- 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
|
//- 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
|
//- Open all libraries listed in the 'libsEntry' entry in the
|
||||||
// given dictionary if present
|
//- given dictionary.
|
||||||
bool open(const dictionary&, const word& libsEntry);
|
bool open(const dictionary& dict, const word& libsEntry);
|
||||||
|
|
||||||
//- Open all the libraries listed in the 'libsEntry' entry in the
|
//- Open all libraries listed in the 'libsEntry' entry in the
|
||||||
// given dictionary if present and check the additions
|
//- given dictionary and check the additions
|
||||||
// to the given constructor table
|
//- to the given constructor table
|
||||||
template<class TablePtr>
|
template<class TablePtr>
|
||||||
bool open
|
bool open
|
||||||
(
|
(
|
||||||
const dictionary&,
|
const dictionary& dict,
|
||||||
const word& libsEntry,
|
const word& libsEntry,
|
||||||
const TablePtr& tablePtr
|
const TablePtr& tablePtr
|
||||||
);
|
);
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -37,47 +37,36 @@ bool Foam::dlLibraryTable::open
|
|||||||
const TablePtr& tablePtr
|
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);
|
if (dlLibraryTable::open(libName))
|
||||||
|
|
||||||
forAll(libNames, i)
|
|
||||||
{
|
{
|
||||||
const fileName& libName = libNames[i];
|
++nOpen;
|
||||||
|
|
||||||
label nEntries = 0;
|
if (debug && (!tablePtr || tablePtr->size() <= nEntries))
|
||||||
|
|
||||||
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))
|
|
||||||
{
|
{
|
||||||
WarningInFunction
|
WarningInFunction
|
||||||
<< "library " << libName
|
<< "library " << libName
|
||||||
<< " did not introduce any new entries"
|
<< " did not introduce any new entries"
|
||||||
<< endl << endl;
|
<< nl << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return allOpened;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return false;
|
WarningInFunction
|
||||||
|
<< "Could not open library " << libName
|
||||||
|
<< nl << endl;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nOpen && nOpen == libNames.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -139,15 +139,15 @@ void Foam::IOerror::SafeFatalIOError
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cerr
|
std::cerr
|
||||||
<< std::endl
|
<< nl
|
||||||
<< "--> FOAM FATAL IO ERROR:" << std::endl
|
<< "--> FOAM FATAL IO ERROR:" << nl
|
||||||
<< msg
|
<< msg
|
||||||
<< std::endl
|
<< nl
|
||||||
<< "file: " << ioStream.name()
|
<< "file: " << ioStream.name()
|
||||||
<< " at line " << ioStream.lineNumber() << '.'
|
<< " at line " << ioStream.lineNumber() << '.'
|
||||||
<< std::endl << std::endl
|
<< nl << nl
|
||||||
<< " From function " << functionName
|
<< " From function " << functionName
|
||||||
<< std::endl
|
<< nl
|
||||||
<< " in file " << sourceFileName
|
<< " in file " << sourceFileName
|
||||||
<< " at line " << sourceFileLineNumber << '.'
|
<< " at line " << sourceFileLineNumber << '.'
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
|||||||
@ -199,7 +199,7 @@ Foam::dimensioned<Type> Foam::dimensioned<Type>::lookupOrDefault
|
|||||||
{
|
{
|
||||||
if (dict.found(name))
|
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);
|
return dimensioned<Type>(name, dims, defaultValue);
|
||||||
@ -316,7 +316,7 @@ void Foam::dimensioned<Type>::replace
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::dimensioned<Type>::read(const dictionary& dict)
|
void Foam::dimensioned<Type>::read(const dictionary& dict)
|
||||||
{
|
{
|
||||||
dict.lookup(name_) >> value_;
|
dict.read(name_, value_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -141,6 +141,7 @@ public:
|
|||||||
// Static member functions
|
// Static member functions
|
||||||
|
|
||||||
//- Construct from dictionary, with default dimensions and value.
|
//- Construct from dictionary, with default dimensions and value.
|
||||||
|
//- FatalIOError if there are excess tokens.
|
||||||
static dimensioned<Type> lookupOrDefault
|
static dimensioned<Type> lookupOrDefault
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
@ -149,7 +150,8 @@ public:
|
|||||||
const Type& defaultValue = Type(Zero)
|
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
|
static dimensioned<Type> lookupOrDefault
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
@ -159,6 +161,7 @@ public:
|
|||||||
|
|
||||||
//- Construct from dictionary, with default value.
|
//- Construct from dictionary, with default value.
|
||||||
// If the value is not found, it is added into the dictionary.
|
// 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
|
static dimensioned<Type> lookupOrAddToDict
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
@ -169,6 +172,7 @@ public:
|
|||||||
|
|
||||||
//- Construct from dictionary, dimensionless with default value.
|
//- Construct from dictionary, dimensionless with default value.
|
||||||
// If the value is not found, it is added into the dictionary.
|
// 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
|
static dimensioned<Type> lookupOrAddToDict
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
|
|||||||
@ -35,7 +35,7 @@ Description
|
|||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
pointPatchField.C
|
pointPatchField.C
|
||||||
newPointPatchField.C
|
pointPatchFieldNew.C
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|||||||
@ -6,20 +6,20 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
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
|
under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
(at your option) any later version.
|
(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
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
for more details.
|
for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
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/>.
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2009-2016 Bernhard Gschaider
|
\\ / 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
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
|
|||||||
@ -186,7 +186,7 @@ EnumType Foam::Enum<EnumType>::lookup
|
|||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const word enumName(dict.lookup(key));
|
const word enumName(dict.get<word>(key));
|
||||||
const label idx = getIndex(enumName);
|
const label idx = getIndex(enumName);
|
||||||
|
|
||||||
if (idx < 0)
|
if (idx < 0)
|
||||||
@ -228,7 +228,7 @@ EnumType Foam::Enum<EnumType>::lookupOrFailsafe
|
|||||||
{
|
{
|
||||||
if (dict.found(key))
|
if (dict.found(key))
|
||||||
{
|
{
|
||||||
const word enumName(dict.lookup(key));
|
const word enumName(dict.get<word>(key));
|
||||||
const label idx = getIndex(enumName);
|
const label idx = getIndex(enumName);
|
||||||
|
|
||||||
if (idx >= 0)
|
if (idx >= 0)
|
||||||
|
|||||||
@ -30,7 +30,7 @@ License
|
|||||||
void Foam::Function1Types::ramp::read(const dictionary& coeffs)
|
void Foam::Function1Types::ramp::read(const dictionary& coeffs)
|
||||||
{
|
{
|
||||||
start_ = coeffs.lookupOrDefault<scalar>("start", 0);
|
start_ = coeffs.lookupOrDefault<scalar>("start", 0);
|
||||||
duration_ = coeffs.lookupType<scalar>("duration");
|
duration_ = coeffs.get<scalar>("duration");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -100,6 +100,12 @@ public:
|
|||||||
//- Calculate time scale
|
//- Calculate time scale
|
||||||
virtual tmp<volScalarField> timeScale() = 0;
|
virtual tmp<volScalarField> timeScale() = 0;
|
||||||
|
|
||||||
|
//- Return the CEDC coefficient
|
||||||
|
scalar CEDC() const
|
||||||
|
{
|
||||||
|
return CEDC_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// I-O
|
// I-O
|
||||||
|
|
||||||
|
|||||||
@ -40,6 +40,7 @@ SourceFiles
|
|||||||
|
|
||||||
#include "singleStepReactingMixture.H"
|
#include "singleStepReactingMixture.H"
|
||||||
#include "ThermoCombustion.H"
|
#include "ThermoCombustion.H"
|
||||||
|
#include "fvScalarMatrix.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2016-2107 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2016-2107 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -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");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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_;
|
||||||
|
|||||||
@ -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"),
|
||||||
|
|||||||
@ -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),
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -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;
|
||||||
|
|||||||
@ -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"));
|
||||||
|
|
||||||
|
|||||||
@ -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"))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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"),
|
||||||
|
|||||||
@ -59,9 +59,7 @@ namespace vtk
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
// Constants
|
// General Functions
|
||||||
|
|
||||||
// General Functions
|
|
||||||
|
|
||||||
//- Return a default asciiFormatter
|
//- Return a default asciiFormatter
|
||||||
autoPtr<vtk::formatter> newFormatter(std::ostream& os);
|
autoPtr<vtk::formatter> newFormatter(std::ostream& os);
|
||||||
@ -94,7 +92,7 @@ namespace vtk
|
|||||||
void writeList
|
void writeList
|
||||||
(
|
(
|
||||||
vtk::formatter& fmt,
|
vtk::formatter& fmt,
|
||||||
const UList<Type>& lst
|
const UList<Type>& list
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Write a list of values.
|
//- Write a list of values.
|
||||||
@ -103,7 +101,7 @@ namespace vtk
|
|||||||
void writeList
|
void writeList
|
||||||
(
|
(
|
||||||
vtk::formatter& fmt,
|
vtk::formatter& fmt,
|
||||||
const FixedList<Type, Size>& lst
|
const FixedList<Type, Size>& list
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -113,7 +111,7 @@ namespace vtk
|
|||||||
void writeList
|
void writeList
|
||||||
(
|
(
|
||||||
vtk::formatter& fmt,
|
vtk::formatter& fmt,
|
||||||
const UList<Type>& lst,
|
const UList<Type>& list,
|
||||||
const labelUList& addressing
|
const labelUList& addressing
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -126,7 +124,7 @@ namespace vtk
|
|||||||
namespace legacy
|
namespace legacy
|
||||||
{
|
{
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
|
|
||||||
//- Strings corresponding to the (POLYDATA, UNSTRUCTURED_GRID) elements
|
//- Strings corresponding to the (POLYDATA, UNSTRUCTURED_GRID) elements
|
||||||
extern const Foam::Enum<vtk::fileTag> contentNames;
|
extern const Foam::Enum<vtk::fileTag> contentNames;
|
||||||
@ -135,7 +133,7 @@ namespace legacy
|
|||||||
extern const Foam::Enum<vtk::fileTag> dataTypeNames;
|
extern const Foam::Enum<vtk::fileTag> dataTypeNames;
|
||||||
|
|
||||||
|
|
||||||
// Functions
|
// Functions
|
||||||
|
|
||||||
//- Emit header for legacy file.
|
//- Emit header for legacy file.
|
||||||
// Writes "ASCII" or "BINARY" depending on specified type.
|
// Writes "ASCII" or "BINARY" depending on specified type.
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2016-2107 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -44,12 +44,12 @@ template<class Type>
|
|||||||
void Foam::vtk::writeList
|
void Foam::vtk::writeList
|
||||||
(
|
(
|
||||||
vtk::formatter& fmt,
|
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
|
void Foam::vtk::writeList
|
||||||
(
|
(
|
||||||
vtk::formatter& fmt,
|
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
|
void Foam::vtk::writeList
|
||||||
(
|
(
|
||||||
vtk::formatter& fmt,
|
vtk::formatter& fmt,
|
||||||
const UList<Type>& lst,
|
const UList<Type>& list,
|
||||||
const labelUList& addressing
|
const labelUList& addressing
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
forAll(addressing, i)
|
for (const label idx : addressing)
|
||||||
{
|
{
|
||||||
write(fmt, lst[addressing[i]]);
|
write(fmt, list[idx]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
|
|||||||
@ -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"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -180,7 +180,7 @@ Foam::scalar Foam::COxidationIntrinsicRate<CloudType>::calculate
|
|||||||
max(0.5*d*sqrt(Sb_*rhop*Ag_*ki*ppO2/(De*rhoO2)), ROOTVSMALL);
|
max(0.5*d*sqrt(Sb_*rhop*Ag_*ki*ppO2/(De*rhoO2)), ROOTVSMALL);
|
||||||
|
|
||||||
// Effectiveness factor []
|
// 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]
|
// Chemical rate [kmol/m2/s]
|
||||||
const scalar R = eta*d/6.0*rhop*Ag_*ki;
|
const scalar R = eta*d/6.0*rhop*Ag_*ki;
|
||||||
|
|||||||
@ -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",
|
"writeReferredParticleCloud",
|
||||||
false
|
false
|
||||||
)
|
|
||||||
),
|
),
|
||||||
this->coeffDict().lookupOrDefault("U", word("U"))
|
this->coeffDict().lookupOrDefault("U", word("U"))
|
||||||
)
|
)
|
||||||
|
|||||||
@ -198,12 +198,12 @@ Foam::label Foam::ConeInjection<CloudType>::parcelsToInject
|
|||||||
{
|
{
|
||||||
const scalar targetVolume = flowRateProfile_.integrate(0, time1);
|
const scalar targetVolume = flowRateProfile_.integrate(0, time1);
|
||||||
|
|
||||||
|
const scalar volumeFraction = targetVolume/this->volumeTotal_;
|
||||||
|
|
||||||
const label targetParcels =
|
const label targetParcels =
|
||||||
parcelsPerInjector_*targetVolume/this->volumeTotal_;
|
ceil(positionAxis_.size()*parcelsPerInjector_*volumeFraction);
|
||||||
|
|
||||||
const label nToInject = targetParcels - nInjected_;
|
return targetParcels - nInjected_;
|
||||||
|
|
||||||
return positionAxis_.size()*nToInject;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -214,7 +214,7 @@ Foam::ConeNozzleInjection<CloudType>::ConeNozzleInjection
|
|||||||
|
|
||||||
while(magTangent < SMALL)
|
while(magTangent < SMALL)
|
||||||
{
|
{
|
||||||
vector v = rndGen.sample01<vector>();
|
vector v = rndGen.globalSample01<vector>();
|
||||||
|
|
||||||
tangent = v - (v & direction_)*direction_;
|
tangent = v - (v & direction_)*direction_;
|
||||||
magTangent = mag(tangent);
|
magTangent = mag(tangent);
|
||||||
@ -354,7 +354,7 @@ void Foam::ConeNozzleInjection<CloudType>::setPositionAndCell
|
|||||||
{
|
{
|
||||||
Random& rndGen = this->owner().rndGen();
|
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);
|
normal_ = tanVec1_*cos(beta) + tanVec2_*sin(beta);
|
||||||
|
|
||||||
switch (injectionMethod_)
|
switch (injectionMethod_)
|
||||||
|
|||||||
@ -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_)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -94,7 +94,7 @@ class MultiInteraction
|
|||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
Switch oneInteractionOnly_;
|
bool oneInteractionOnly_;
|
||||||
|
|
||||||
//- Submodels
|
//- Submodels
|
||||||
PtrList<PatchInteractionModel<CloudType>> models_;
|
PtrList<PatchInteractionModel<CloudType>> models_;
|
||||||
|
|||||||
@ -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"));
|
||||||
|
|||||||
@ -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"))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -54,4 +54,5 @@ inline bool Foam::pairPotential::writeTables() const
|
|||||||
return writeTables_;
|
return writeTables_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -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")
|
||||||
|
)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user