Commit fb09f56a authored by Mark Olesen's avatar Mark Olesen Committed by Andrew Heather
Browse files

ENH: use FatalErrorInLookup macros (#1362)

parent 1d86fc4f
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2015 OpenFOAM Foundation
......@@ -46,12 +46,12 @@ Foam::autoPtr<Foam::PDRDragModel> Foam::PDRDragModel::New
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown PDRDragModel type "
<< modelType << nl << nl
<< "Valid PDRDragModel types :" << endl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError);
FatalErrorInLookup
(
"PDRDragModel",
modelType,
*dictionaryConstructorTablePtr_
) << exit(FatalError);
}
return autoPtr<PDRDragModel>
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2015 OpenFOAM Foundation
......@@ -45,12 +45,12 @@ Foam::autoPtr<Foam::XiEqModel> Foam::XiEqModel::New
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown XiEqModel type "
<< modelType << nl << nl
<< "Valid XiEqModel types :" << endl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError);
FatalErrorInLookup
(
"XiEqModel",
modelType,
*dictionaryConstructorTablePtr_
) << exit(FatalError);
}
return autoPtr<XiEqModel>(cstrIter()(propDict, thermo, turbulence, Su));
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2015 OpenFOAM Foundation
......@@ -45,12 +45,12 @@ Foam::autoPtr<Foam::XiGModel> Foam::XiGModel::New
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown XiGModel type "
<< modelType << nl << nl
<< "Valid XiGModel types :" << endl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError);
FatalErrorInLookup
(
"XiGModel",
modelType,
*dictionaryConstructorTablePtr_
) << exit(FatalError);
}
return autoPtr<XiGModel>(cstrIter()(propDict, thermo, turbulence, Su));
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2015 OpenFOAM Foundation
......@@ -48,12 +48,12 @@ Foam::autoPtr<Foam::XiModel> Foam::XiModel::New
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown XiModel type "
<< modelType << nl << nl
<< "Valid XiModel types :" << endl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError);
FatalErrorInLookup
(
"XiModel",
modelType,
*dictionaryConstructorTablePtr_
) << exit(FatalError);
}
return autoPtr<XiModel>
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2014-2015 OpenFOAM Foundation
......@@ -47,12 +47,12 @@ Foam::autoPtr<Foam::mixtureViscosityModel> Foam::mixtureViscosityModel::New
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown mixtureViscosityModel type "
<< modelType << nl << nl
<< "Valid mixtureViscosityModel types :" << endl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError);
FatalErrorInLookup
(
"mixtureViscosityModel",
modelType,
*dictionaryConstructorTablePtr_
) << exit(FatalError);
}
return autoPtr<mixtureViscosityModel>
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2014-2017 OpenFOAM Foundation
......@@ -114,12 +114,12 @@ Foam::autoPtr<Foam::relativeVelocityModel> Foam::relativeVelocityModel::New
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown time scale model type "
<< modelType << nl << nl
<< "Valid time scale model types :" << endl
<< dictionaryConstructorTablePtr_->sortedToc()
<< abort(FatalError);
FatalErrorInLookup
(
"relative velocity",
modelType,
*dictionaryConstructorTablePtr_
) << abort(FatalError);
}
return
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -43,11 +43,13 @@ Foam::radiation::reflectionModel::New
if (!cstrIter.found())
{
FatalIOErrorInFunction(dict)
<< "Unknown reflectionModel type " << modelType << nl << nl
<< "Valid types :" << nl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalIOError);
FatalIOErrorInLookup
(
dict,
"reflectionModel",
modelType,
*dictionaryConstructorTablePtr_
) << exit(FatalIOError);
}
return autoPtr<reflectionModel>(cstrIter()(dict, mesh));
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2017 OpenFOAM Foundation
......@@ -38,7 +38,7 @@ Foam::interfaceCompositionModel::New
const phasePair& pair
)
{
word interfaceCompositionModelType
const word modelType
(
dict.get<word>("type")
+ "<"
......@@ -49,19 +49,18 @@ Foam::interfaceCompositionModel::New
);
Info<< "Selecting interfaceCompositionModel for "
<< pair << ": " << interfaceCompositionModelType << endl;
<< pair << ": " << modelType << endl;
const auto cstrIter =
dictionaryConstructorTablePtr_->cfind(interfaceCompositionModelType);
const auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown interfaceCompositionModelType type "
<< interfaceCompositionModelType << nl << nl
<< "Valid interfaceCompositionModel types are : " << nl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError);
FatalErrorInLookup
(
"interfaceCompositionModel",
modelType,
*dictionaryConstructorTablePtr_
) << exit(FatalError);
}
return cstrIter()(dict, pair);
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -43,12 +43,12 @@ Foam::autoPtr<Foam::porousModel> Foam::porousModel::New
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown modelType type "
<< modelType << endl << endl
<< "Valid porousModel types are : " << endl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError);
FatalErrorInLookup
(
"porousModel",
modelType,
*dictionaryConstructorTablePtr_
) << exit(FatalError);
}
return cstrIter()(dict, mesh);
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -43,12 +43,12 @@ Foam::autoPtr<Foam::surfaceTensionModel> Foam::surfaceTensionModel::New
if (!cstrIter.found())
{
FatalIOErrorInFunction(dict)
<< "Unknown surfaceTensionModel type "
<< surfaceTensionModelType << endl << endl
<< "Valid modelType types are : " << endl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalIOError);
FatalErrorInLookup
(
"surfaceTensionModel",
modelType,
*dictionaryConstructorTablePtr_
) << exit(FatalError);
}
return cstrIter()(dict, pair, true);
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -43,12 +43,12 @@ Foam::autoPtr<Foam::phaseModel> Foam::phaseModel::New
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown phaseModel type "
<< modelType << endl << endl
<< "Valid phaseModel types are : " << endl
<< phaseSystemConstructorTablePtr_->sortedToc()
<< exit(FatalError);
FatalErrorInLookup
(
"phaseModel",
modelType,
*phaseSystemConstructorTablePtr_
) << exit(FatalError);
}
return cstrIter()(fluid, phaseName);
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -32,7 +32,7 @@ Foam::autoPtr<Foam::multiphaseSystem> Foam::multiphaseSystem::New
const fvMesh& mesh
)
{
const word multiphaseSystemType
const word systemType
(
IOdictionary
(
......@@ -48,22 +48,21 @@ Foam::autoPtr<Foam::multiphaseSystem> Foam::multiphaseSystem::New
).get<word>("type")
);
Info<< "Selecting multiphaseSystem " << multiphaseSystemType << endl;
Info<< "Selecting multiphaseSystem " << systemType << endl;
const auto cstrIter =
dictionaryConstructorTablePtr_->cfind(multiphaseSystemType);
const auto cstrIter = dictionaryConstructorTablePtr_->cfind(systemType);
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown multiphaseSystemType type "
<< multiphaseSystemType << endl
<< "Valid multiphaseSystem types are : " << endl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError);
FatalErrorInLookup
(
"multiphaseSystem",
systemType,
*dictionaryConstructorTablePtr_
) << exit(FatalError);
}
return autoPtr<multiphaseSystem> (cstrIter()(mesh));
return autoPtr<multiphaseSystem>(cstrIter()(mesh));
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -35,22 +35,20 @@ Foam::temperaturePhaseChangeTwoPhaseMixture::New
const fvMesh& mesh
)
{
IOdictionary phaseChangePropertiesDict
(
IOobject
(
"phaseChangeProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
);
const word modelType
(
phaseChangePropertiesDict.get<word>("phaseChangeTwoPhaseModel")
IOdictionary
(
IOobject
(
"phaseChangeProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false // Do not register
)
).get<word>("phaseChangeTwoPhaseModel")
);
Info<< "Selecting phaseChange model " << modelType << endl;
......@@ -59,16 +57,19 @@ Foam::temperaturePhaseChangeTwoPhaseMixture::New
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown temperaturePhaseChangeTwoPhaseMixture type "
<< modelType << nl << nl
<< "Valid temperaturePhaseChangeTwoPhaseMixture types :" << endl
<< componentsConstructorTablePtr_->sortedToc()
<< exit(FatalError);
FatalErrorInLookup
(
"temperaturePhaseChangeTwoPhaseMixture",
modelType,
*componentsConstructorTablePtr_
) << exit(FatalError);
}
return autoPtr<temperaturePhaseChangeTwoPhaseMixture>
(cstrIter()(thermo, mesh));
return
autoPtr<temperaturePhaseChangeTwoPhaseMixture>
(
cstrIter()(thermo, mesh)
);
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2015 OpenFOAM Foundation
......@@ -37,22 +37,20 @@ Foam::phaseChangeTwoPhaseMixture::New
const surfaceScalarField& phi
)
{
IOdictionary transportPropertiesDict
(
IOobject
(
"transportProperties",
U.time().constant(),
U.db(),
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
);
const word modelType
(
transportPropertiesDict.lookup("phaseChangeTwoPhaseMixture")
IOdictionary
(
IOobject
(
"transportProperties",
U.time().constant(),
U.db(),
IOobject::MUST_READ,
IOobject::NO_WRITE,
false // Do not register
)
).get<word>("phaseChangeTwoPhaseMixture")
);
Info<< "Selecting phaseChange model " << modelType << endl;
......@@ -61,12 +59,12 @@ Foam::phaseChangeTwoPhaseMixture::New
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown phaseChangeTwoPhaseMixture type "
<< modelType << nl << nl
<< "Valid phaseChangeTwoPhaseMixture types :" << endl
<< componentsConstructorTablePtr_->sortedToc()
<< exit(FatalError);
FatalErrorInLookup
(
"phaseChangeTwoPhaseMixture",
modelType,
*componentsConstructorTablePtr_
) << exit(FatalError);
}
return autoPtr<phaseChangeTwoPhaseMixture>(cstrIter()(U, phi));
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2015 OpenFOAM Foundation
......@@ -47,12 +47,12 @@ Foam::autoPtr<Foam::dragModel> Foam::dragModel::New