mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'feature-runTimeCompat' into 'develop'
long-term maintenance improvement for runTime selection tables See merge request Development/openfoam!481
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -43,9 +43,9 @@ Foam::autoPtr<Foam::PDRDragModel> Foam::PDRDragModel::New
|
||||
|
||||
Info<< "Selecting drag model " << modelType << endl;
|
||||
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
|
||||
auto* ctorPtr = dictionaryConstructorTable(modelType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -57,7 +57,9 @@ Foam::autoPtr<Foam::PDRDragModel> Foam::PDRDragModel::New
|
||||
}
|
||||
|
||||
return autoPtr<PDRDragModel>
|
||||
(cstrIter()(dict, turbulence, rho, U, phi));
|
||||
(
|
||||
ctorPtr(dict, turbulence, rho, U, phi)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -42,9 +42,9 @@ Foam::autoPtr<Foam::XiEqModel> Foam::XiEqModel::New
|
||||
|
||||
Info<< "Selecting flame-wrinkling model " << modelType << endl;
|
||||
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
|
||||
auto* ctorPtr = dictionaryConstructorTable(modelType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -55,7 +55,7 @@ Foam::autoPtr<Foam::XiEqModel> Foam::XiEqModel::New
|
||||
) << exit(FatalIOError);
|
||||
}
|
||||
|
||||
return autoPtr<XiEqModel>(cstrIter()(dict, thermo, turbulence, Su));
|
||||
return autoPtr<XiEqModel>(ctorPtr(dict, thermo, turbulence, Su));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -42,9 +42,9 @@ Foam::autoPtr<Foam::XiGModel> Foam::XiGModel::New
|
||||
|
||||
Info<< "Selecting flame-wrinkling model " << modelType << endl;
|
||||
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
|
||||
auto* ctorPtr = dictionaryConstructorTable(modelType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -55,7 +55,7 @@ Foam::autoPtr<Foam::XiGModel> Foam::XiGModel::New
|
||||
) << exit(FatalIOError);
|
||||
}
|
||||
|
||||
return autoPtr<XiGModel>(cstrIter()(dict, thermo, turbulence, Su));
|
||||
return autoPtr<XiGModel>(ctorPtr(dict, thermo, turbulence, Su));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -45,9 +45,9 @@ Foam::autoPtr<Foam::XiModel> Foam::XiModel::New
|
||||
|
||||
Info<< "Selecting flame-wrinkling model " << modelType << endl;
|
||||
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
|
||||
auto* ctorPtr = dictionaryConstructorTable(modelType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -59,7 +59,9 @@ Foam::autoPtr<Foam::XiModel> Foam::XiModel::New
|
||||
}
|
||||
|
||||
return autoPtr<XiModel>
|
||||
(cstrIter()(dict, thermo, turbulence, Su, rho, b, phi));
|
||||
(
|
||||
ctorPtr(dict, thermo, turbulence, Su, rho, b, phi)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2014-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -44,9 +44,9 @@ Foam::autoPtr<Foam::mixtureViscosityModel> Foam::mixtureViscosityModel::New
|
||||
|
||||
Info<< "Selecting incompressible transport model " << modelType << endl;
|
||||
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
|
||||
auto* ctorPtr = dictionaryConstructorTable(modelType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -58,7 +58,9 @@ Foam::autoPtr<Foam::mixtureViscosityModel> Foam::mixtureViscosityModel::New
|
||||
}
|
||||
|
||||
return autoPtr<mixtureViscosityModel>
|
||||
(cstrIter()(name, dict, U, phi));
|
||||
(
|
||||
ctorPtr(name, dict, U, phi)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2014-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -111,9 +111,9 @@ Foam::autoPtr<Foam::relativeVelocityModel> Foam::relativeVelocityModel::New
|
||||
|
||||
Info<< "Selecting relative velocity model " << modelType << endl;
|
||||
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
|
||||
auto* ctorPtr = dictionaryConstructorTable(modelType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -127,7 +127,7 @@ Foam::autoPtr<Foam::relativeVelocityModel> Foam::relativeVelocityModel::New
|
||||
return
|
||||
autoPtr<relativeVelocityModel>
|
||||
(
|
||||
cstrIter()
|
||||
ctorPtr
|
||||
(
|
||||
dict.optionalSubDict(modelType + "Coeffs"),
|
||||
mixture
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -41,9 +41,9 @@ Foam::radiation::reflectionModel::New
|
||||
|
||||
Info<< "Selecting reflectionModel " << modelType << endl;
|
||||
|
||||
const auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
|
||||
auto* ctorPtr = dictionaryConstructorTable(modelType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -54,7 +54,7 @@ Foam::radiation::reflectionModel::New
|
||||
) << exit(FatalIOError);
|
||||
}
|
||||
|
||||
return autoPtr<reflectionModel>(cstrIter()(dict, mesh));
|
||||
return autoPtr<reflectionModel>(ctorPtr(dict, mesh));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -54,9 +54,9 @@ Foam::temperaturePhaseChangeTwoPhaseMixture::New
|
||||
|
||||
Info<< "Selecting phaseChange model " << modelType << endl;
|
||||
|
||||
auto cstrIter = componentsConstructorTablePtr_->cfind(modelType);
|
||||
auto* ctorPtr = componentsConstructorTable(modelType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -70,7 +70,7 @@ Foam::temperaturePhaseChangeTwoPhaseMixture::New
|
||||
return
|
||||
autoPtr<temperaturePhaseChangeTwoPhaseMixture>
|
||||
(
|
||||
cstrIter()(thermo, mesh)
|
||||
ctorPtr(thermo, mesh)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -56,9 +56,9 @@ Foam::phaseChangeTwoPhaseMixture::New
|
||||
|
||||
Info<< "Selecting phaseChange model " << modelType << endl;
|
||||
|
||||
auto cstrIter = componentsConstructorTablePtr_->cfind(modelType);
|
||||
auto* ctorPtr = componentsConstructorTable(modelType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -69,7 +69,7 @@ Foam::phaseChangeTwoPhaseMixture::New
|
||||
) << exit(FatalIOError);
|
||||
}
|
||||
|
||||
return autoPtr<phaseChangeTwoPhaseMixture>(cstrIter()(U, phi));
|
||||
return autoPtr<phaseChangeTwoPhaseMixture>(ctorPtr(U, phi));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2012-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -80,9 +80,9 @@ Foam::cellSizeAndAlignmentControl::New
|
||||
Info<< indent << "Selecting cellSizeAndAlignmentControl "
|
||||
<< modelType << endl;
|
||||
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
|
||||
auto* ctorPtr = dictionaryConstructorTable(modelType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -95,7 +95,7 @@ Foam::cellSizeAndAlignmentControl::New
|
||||
|
||||
return autoPtr<cellSizeAndAlignmentControl>
|
||||
(
|
||||
cstrIter()
|
||||
ctorPtr
|
||||
(
|
||||
runTime,
|
||||
name,
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2012-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -134,9 +134,9 @@ Foam::autoPtr<Foam::cellSizeFunction> Foam::cellSizeFunction::New
|
||||
|
||||
Info<< indent << "Selecting cellSizeFunction " << modelType << endl;
|
||||
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
|
||||
auto* ctorPtr = dictionaryConstructorTable(modelType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -149,7 +149,7 @@ Foam::autoPtr<Foam::cellSizeFunction> Foam::cellSizeFunction::New
|
||||
|
||||
return autoPtr<cellSizeFunction>
|
||||
(
|
||||
cstrIter()
|
||||
ctorPtr
|
||||
(
|
||||
dict,
|
||||
surface,
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2012-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -67,9 +67,9 @@ Foam::autoPtr<Foam::cellSizeCalculationType> Foam::cellSizeCalculationType::New
|
||||
|
||||
Info<< indent << "Selecting cellSizeCalculationType " << modelType << endl;
|
||||
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
|
||||
auto* ctorPtr = dictionaryConstructorTable(modelType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -82,7 +82,7 @@ Foam::autoPtr<Foam::cellSizeCalculationType> Foam::cellSizeCalculationType::New
|
||||
|
||||
return autoPtr<cellSizeCalculationType>
|
||||
(
|
||||
cstrIter()(dict, surface, defaultCellSize)
|
||||
ctorPtr(dict, surface, defaultCellSize)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2012-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -72,9 +72,9 @@ Foam::autoPtr<Foam::surfaceCellSizeFunction> Foam::surfaceCellSizeFunction::New
|
||||
|
||||
Info<< indent << "Selecting surfaceCellSizeFunction " << modelType << endl;
|
||||
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
|
||||
auto* ctorPtr = dictionaryConstructorTable(modelType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -87,7 +87,7 @@ Foam::autoPtr<Foam::surfaceCellSizeFunction> Foam::surfaceCellSizeFunction::New
|
||||
|
||||
return autoPtr<surfaceCellSizeFunction>
|
||||
(
|
||||
cstrIter()(dict, surface, defaultCellSize)
|
||||
ctorPtr(dict, surface, defaultCellSize)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2012-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -61,9 +61,9 @@ Foam::autoPtr<Foam::faceAreaWeightModel> Foam::faceAreaWeightModel::New
|
||||
|
||||
Info<< nl << "Selecting faceAreaWeightModel " << modelType << endl;
|
||||
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
|
||||
auto* ctorPtr = dictionaryConstructorTable(modelType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -74,7 +74,7 @@ Foam::autoPtr<Foam::faceAreaWeightModel> Foam::faceAreaWeightModel::New
|
||||
) << exit(FatalIOError);
|
||||
}
|
||||
|
||||
return autoPtr<faceAreaWeightModel>(cstrIter()(dict));
|
||||
return autoPtr<faceAreaWeightModel>(ctorPtr(dict));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2012-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -84,9 +84,9 @@ Foam::autoPtr<Foam::initialPointsMethod> Foam::initialPointsMethod::New
|
||||
|
||||
Info<< nl << "Selecting initialPointsMethod " << modelType << endl;
|
||||
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
|
||||
auto* ctorPtr = dictionaryConstructorTable(modelType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -100,7 +100,7 @@ Foam::autoPtr<Foam::initialPointsMethod> Foam::initialPointsMethod::New
|
||||
return
|
||||
autoPtr<initialPointsMethod>
|
||||
(
|
||||
cstrIter()
|
||||
ctorPtr
|
||||
(
|
||||
dict,
|
||||
runTime,
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2012-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -65,9 +65,9 @@ Foam::autoPtr<Foam::relaxationModel> Foam::relaxationModel::New
|
||||
|
||||
Info<< nl << "Selecting relaxationModel " << modelType << endl;
|
||||
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
|
||||
auto* ctorPtr = dictionaryConstructorTable(modelType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -78,7 +78,7 @@ Foam::autoPtr<Foam::relaxationModel> Foam::relaxationModel::New
|
||||
) << exit(FatalIOError);
|
||||
}
|
||||
|
||||
return autoPtr<relaxationModel>(cstrIter()(dict, runTime));
|
||||
return autoPtr<relaxationModel>(ctorPtr(dict, runTime));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2013-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -48,9 +48,9 @@ Foam::searchableSurfaceFeatures::New
|
||||
{
|
||||
const word modelType(surface.type() + "Features");
|
||||
|
||||
auto cstrIter = dictConstructorTablePtr_->cfind(modelType);
|
||||
auto* ctorPtr = dictConstructorTable(modelType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -61,7 +61,7 @@ Foam::searchableSurfaceFeatures::New
|
||||
) << exit(FatalIOError);
|
||||
}
|
||||
|
||||
return autoPtr<searchableSurfaceFeatures>(cstrIter()(surface, dict));
|
||||
return autoPtr<searchableSurfaceFeatures>(ctorPtr(surface, dict));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -71,9 +71,9 @@ Foam::autoPtr<Foam::faceSelection> Foam::faceSelection::New
|
||||
{
|
||||
const word modelType(dict.get<word>("type"));
|
||||
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
|
||||
auto* ctorPtr = dictionaryConstructorTable(modelType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -84,7 +84,7 @@ Foam::autoPtr<Foam::faceSelection> Foam::faceSelection::New
|
||||
) << exit(FatalIOError);
|
||||
}
|
||||
|
||||
return autoPtr<faceSelection>(cstrIter()(name, mesh, dict));
|
||||
return autoPtr<faceSelection>(ctorPtr(name, mesh, dict));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2012-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2012-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -34,9 +35,9 @@ Foam::autoPtr<Foam::helpType> Foam::helpType::New
|
||||
const word& helpTypeName
|
||||
)
|
||||
{
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(helpTypeName);
|
||||
auto* ctorPtr = dictionaryConstructorTable(helpTypeName);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
// special treatment for -help
|
||||
// exit without stack trace
|
||||
@ -61,7 +62,7 @@ Foam::autoPtr<Foam::helpType> Foam::helpType::New
|
||||
|
||||
Info<< "Selecting helpType '" << helpTypeName << "'" << endl;
|
||||
|
||||
return autoPtr<helpType>(cstrIter()());
|
||||
return autoPtr<helpType>(ctorPtr());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -40,7 +40,7 @@ using namespace Foam::constant;
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineMemberFunctionSelectionTable(PDRobstacle, read, dictRead);
|
||||
defineMemberFunctionSelectionTable(PDRobstacle, read, dictionary);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016 Shell Research Ltd.
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -178,7 +178,7 @@ public:
|
||||
void,
|
||||
PDRobstacle,
|
||||
read,
|
||||
dictRead,
|
||||
dictionary,
|
||||
(
|
||||
PDRobstacle& obs,
|
||||
const dictionary& dict
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -41,18 +41,20 @@ bool Foam::PDRobstacle::read(Istream& is)
|
||||
const word obsType(is);
|
||||
const dictionary dict(is);
|
||||
|
||||
const auto mfIter = readdictReadMemberFunctionTablePtr_->cfind(obsType);
|
||||
auto* mfuncPtr = readdictionaryMemberFunctionTable(obsType);
|
||||
|
||||
if (!mfIter.good())
|
||||
if (!mfuncPtr)
|
||||
{
|
||||
FatalIOErrorInFunction(is)
|
||||
<< "Unknown obstacle type: " << obsType << nl
|
||||
<< "Valid types:" << nl
|
||||
<< readdictReadMemberFunctionTablePtr_->sortedToc() << nl
|
||||
<< exit(FatalIOError);
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
is,
|
||||
"obstacle",
|
||||
obsType,
|
||||
*readdictionaryMemberFunctionTablePtr_
|
||||
) << exit(FatalIOError);
|
||||
}
|
||||
|
||||
mfIter()(*this, dict);
|
||||
mfuncPtr(*this, dict);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -45,7 +45,7 @@ using namespace Foam::constant;
|
||||
PDRobstacle, \
|
||||
obsType, \
|
||||
read, \
|
||||
dictRead, \
|
||||
dictionary, \
|
||||
obsName \
|
||||
); \
|
||||
} \
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 DLR
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -46,9 +46,9 @@ Foam::autoPtr<Foam::implicitFunction> Foam::implicitFunction::New
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
auto cstrIter = dictConstructorTablePtr_->cfind(implicitFunctionType);
|
||||
auto* ctorPtr = dictConstructorTable(implicitFunctionType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -59,7 +59,7 @@ Foam::autoPtr<Foam::implicitFunction> Foam::implicitFunction::New
|
||||
) << exit(FatalIOError);
|
||||
}
|
||||
|
||||
return autoPtr<implicitFunction>(cstrIter()(dict));
|
||||
return autoPtr<implicitFunction>(ctorPtr(dict));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -41,9 +41,9 @@ Foam::tabulatedWallFunctions::tabulatedWallFunction::New
|
||||
|
||||
Info<< "Selecting tabulatedWallFunction " << functionName << endl;
|
||||
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(functionName);
|
||||
auto* ctorPtr = dictionaryConstructorTable(functionName);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -54,7 +54,7 @@ Foam::tabulatedWallFunctions::tabulatedWallFunction::New
|
||||
) << exit(FatalIOError);
|
||||
}
|
||||
|
||||
return autoPtr<tabulatedWallFunction>(cstrIter()(dict, mesh));
|
||||
return autoPtr<tabulatedWallFunction>(ctorPtr(dict, mesh));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -72,9 +72,9 @@ Foam::surfaceFeaturesExtraction::method::New
|
||||
{
|
||||
const word modelType(dict.get<word>("extractionMethod"));
|
||||
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
|
||||
auto* ctorPtr = dictionaryConstructorTable(modelType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -85,7 +85,7 @@ Foam::surfaceFeaturesExtraction::method::New
|
||||
) << exit(FatalIOError);
|
||||
}
|
||||
|
||||
return autoPtr<method>(cstrIter.val()(dict));
|
||||
return autoPtr<method>(ctorPtr(dict));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2014 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -67,9 +67,9 @@ Foam::searchableSurfaceModifier::New
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(type);
|
||||
auto* ctorPtr = dictionaryConstructorTable(type);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -80,7 +80,7 @@ Foam::searchableSurfaceModifier::New
|
||||
) << exit(FatalIOError);
|
||||
}
|
||||
|
||||
return autoPtr<searchableSurfaceModifier>(cstrIter()(geometry, dict));
|
||||
return autoPtr<searchableSurfaceModifier>(ctorPtr(geometry, dict));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -39,9 +39,9 @@ Foam::autoPtr<Foam::ODESolver> Foam::ODESolver::New
|
||||
const word solverType(dict.get<word>("solver"));
|
||||
Info<< "Selecting ODE solver " << solverType << endl;
|
||||
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(solverType);
|
||||
auto* ctorPtr = dictionaryConstructorTable(solverType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -52,7 +52,7 @@ Foam::autoPtr<Foam::ODESolver> Foam::ODESolver::New
|
||||
) << exit(FatalIOError);
|
||||
}
|
||||
|
||||
return autoPtr<ODESolver>(cstrIter()(odes, dict));
|
||||
return autoPtr<ODESolver>(ctorPtr(odes, dict));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -84,7 +84,7 @@ bool Foam::IOobject::readHeader(dictionary& headerDict, Istream& is)
|
||||
{
|
||||
FatalIOErrorInFunction(is)
|
||||
<< " stream not open for reading essential object from file "
|
||||
<< is.name()
|
||||
<< is.relativeName()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
@ -92,7 +92,7 @@ bool Foam::IOobject::readHeader(dictionary& headerDict, Istream& is)
|
||||
{
|
||||
SeriousIOErrorInFunction(is)
|
||||
<< " stream not open for reading from file "
|
||||
<< is.name() << endl;
|
||||
<< is.relativeName() << endl;
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -135,8 +135,8 @@ bool Foam::IOobject::readHeader(dictionary& headerDict, Istream& is)
|
||||
FatalIOErrorInFunction(is)
|
||||
<< " stream failure while reading header"
|
||||
<< " on line " << is.lineNumber()
|
||||
<< " of file " << is.name()
|
||||
<< " for essential object" << name()
|
||||
<< " of file " << is.relativeName()
|
||||
<< " for essential object:" << name()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
@ -145,7 +145,7 @@ bool Foam::IOobject::readHeader(dictionary& headerDict, Istream& is)
|
||||
InfoInFunction
|
||||
<< "Stream failure while reading header"
|
||||
<< " on line " << is.lineNumber()
|
||||
<< " of file " << is.name() << endl;
|
||||
<< " of file " << is.relativeName() << endl;
|
||||
}
|
||||
|
||||
objState_ = BAD;
|
||||
|
||||
@ -259,8 +259,8 @@ Foam::decomposedBlockData::readBlock
|
||||
if (!headerIO.readHeader(*realIsPtr))
|
||||
{
|
||||
FatalIOErrorInFunction(*realIsPtr)
|
||||
<< "Problem while reading header for object "
|
||||
<< is.name() << nl
|
||||
<< "Problem while reading object header "
|
||||
<< is.relativeName() << nl
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
}
|
||||
@ -273,8 +273,8 @@ Foam::decomposedBlockData::readBlock
|
||||
if (!headerIO.readHeader(headerStream))
|
||||
{
|
||||
FatalIOErrorInFunction(headerStream)
|
||||
<< "Problem while reading header for object "
|
||||
<< is.name() << nl
|
||||
<< "Problem while reading object header "
|
||||
<< is.relativeName() << nl
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
streamOptData = static_cast<IOstreamOption>(headerStream);
|
||||
@ -447,8 +447,8 @@ Foam::autoPtr<Foam::ISstream> Foam::decomposedBlockData::readBlocks
|
||||
if (!headerIO.readHeader(*realIsPtr))
|
||||
{
|
||||
FatalIOErrorInFunction(*realIsPtr)
|
||||
<< "Problem while reading header for object "
|
||||
<< is.name() << nl
|
||||
<< "Problem while reading object header "
|
||||
<< is.relativeName() << nl
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,6 +28,7 @@ License
|
||||
|
||||
#include "IOstream.H"
|
||||
#include "error.H"
|
||||
#include "argList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -48,6 +49,12 @@ Foam::fileName& Foam::IOstream::name()
|
||||
}
|
||||
|
||||
|
||||
Foam::fileName Foam::IOstream::relativeName() const
|
||||
{
|
||||
return argList::envRelativePath(this->name());
|
||||
}
|
||||
|
||||
|
||||
bool Foam::IOstream::check(const char* operation) const
|
||||
{
|
||||
return fatalCheck(operation);
|
||||
@ -61,7 +68,8 @@ bool Foam::IOstream::fatalCheck(const char* operation) const
|
||||
if (!ok)
|
||||
{
|
||||
FatalIOErrorInFunction(*this)
|
||||
<< "error in IOstream " << name() << " for operation " << operation
|
||||
<< "error in IOstream " << relativeName()
|
||||
<< " for operation " << operation
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
|
||||
@ -201,6 +201,10 @@ public:
|
||||
//- Return stream name for modification
|
||||
virtual fileName& name();
|
||||
|
||||
//- Return the name of the stream relative to the current case.
|
||||
// Uses argList::envRelativePath()
|
||||
fileName relativeName() const;
|
||||
|
||||
|
||||
// Check
|
||||
|
||||
|
||||
@ -58,9 +58,9 @@ Foam::autoPtr<Foam::token::compound> Foam::token::compound::New
|
||||
Istream& is
|
||||
)
|
||||
{
|
||||
auto cstrIter = IstreamConstructorTablePtr_->cfind(compoundType);
|
||||
auto* ctorPtr = IstreamConstructorTable(compoundType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -71,7 +71,7 @@ Foam::autoPtr<Foam::token::compound> Foam::token::compound::New
|
||||
) << abort(FatalIOError);
|
||||
}
|
||||
|
||||
return autoPtr<Foam::token::compound>(cstrIter()(is));
|
||||
return autoPtr<Foam::token::compound>(ctorPtr(is));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -262,7 +262,7 @@ void Foam::dictionary::checkITstream
|
||||
"", // functionName
|
||||
"", // sourceFileName
|
||||
0, // sourceFileLineNumber
|
||||
this->name(), // ioFileName
|
||||
relativeName(), // ioFileName == dictionary name
|
||||
is.lineNumber() // ioStartLineNumber
|
||||
);
|
||||
|
||||
@ -284,7 +284,8 @@ void Foam::dictionary::checkITstream
|
||||
<< remaining << " excess tokens in stream" << nl << nl;
|
||||
|
||||
std::cerr
|
||||
<< "file: " << this->name()
|
||||
// ioFileName == dictionary name
|
||||
<< "file: " << relativeName()
|
||||
<< " at line " << is.lineNumber() << '.' << nl
|
||||
<< std::endl;
|
||||
|
||||
@ -301,7 +302,7 @@ void Foam::dictionary::checkITstream
|
||||
"", // functionName
|
||||
"", // sourceFileName
|
||||
0, // sourceFileLineNumber
|
||||
this->name(), // ioFileName
|
||||
relativeName(), // ioFileName == dictionary name
|
||||
is.lineNumber() // ioStartLineNumber
|
||||
)
|
||||
<< "Entry '" << keyword
|
||||
@ -317,7 +318,8 @@ void Foam::dictionary::checkITstream
|
||||
<< "' had no tokens in stream" << nl << nl;
|
||||
|
||||
std::cerr
|
||||
<< "file: " << this->name()
|
||||
// ioFileName == dictionary name
|
||||
<< "file: " << relativeName()
|
||||
<< " at line " << is.lineNumber() << '.' << nl
|
||||
<< std::endl;
|
||||
|
||||
@ -340,7 +342,7 @@ void Foam::dictionary::raiseBadInput
|
||||
"", // functionName
|
||||
"", // sourceFileName
|
||||
0, // sourceFileLineNumber
|
||||
this->name(), // ioFileName
|
||||
relativeName(), // ioFileName == dictionary name
|
||||
is.lineNumber(), // ioStartLineNumber
|
||||
-1 // ioEndLineNumber
|
||||
)
|
||||
@ -401,7 +403,7 @@ const Foam::entry& Foam::dictionary::lookupEntry
|
||||
{
|
||||
FatalIOErrorInFunction(*this)
|
||||
<< "Entry '" << keyword << "' not found in dictionary "
|
||||
<< name() << nl
|
||||
<< relativeName() << nl
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
@ -525,7 +527,7 @@ const Foam::dictionary& Foam::dictionary::subDict
|
||||
{
|
||||
FatalIOErrorInFunction(*this)
|
||||
<< "Entry '" << keyword << "' not found in dictionary "
|
||||
<< name() << nl
|
||||
<< relativeName() << nl
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
@ -545,7 +547,7 @@ Foam::dictionary& Foam::dictionary::subDict
|
||||
{
|
||||
FatalIOErrorInFunction(*this)
|
||||
<< "Entry '" << keyword << "' not found in dictionary "
|
||||
<< name() << nl
|
||||
<< relativeName() << nl
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
@ -574,7 +576,7 @@ Foam::dictionary& Foam::dictionary::subDictOrAdd
|
||||
FatalIOErrorInFunction(*this)
|
||||
<< "Entry '" << keyword
|
||||
<< "' is not a sub-dictionary in dictionary "
|
||||
<< name() << nl
|
||||
<< relativeName() << nl
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
@ -585,7 +587,7 @@ Foam::dictionary& Foam::dictionary::subDictOrAdd
|
||||
FatalIOErrorInFunction(*this)
|
||||
<< "Failed to insert sub-dictionary '" << keyword
|
||||
<< "' in dictionary "
|
||||
<< name() << nl
|
||||
<< relativeName() << nl
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
@ -613,7 +615,7 @@ Foam::dictionary Foam::dictionary::subOrEmptyDict
|
||||
FatalIOErrorInFunction(*this)
|
||||
<< "Entry '" << keyword
|
||||
<< "' is not a sub-dictionary in dictionary "
|
||||
<< name() << nl
|
||||
<< relativeName() << nl
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
@ -622,7 +624,7 @@ Foam::dictionary Foam::dictionary::subOrEmptyDict
|
||||
IOWarningInFunction(*this)
|
||||
<< "Entry '" << keyword
|
||||
<< "' found but not a sub-dictionary in dictionary "
|
||||
<< name() << endl;
|
||||
<< relativeName() << endl;
|
||||
}
|
||||
|
||||
// The move constructor properly qualifies the dictionary name
|
||||
@ -649,7 +651,7 @@ const Foam::dictionary& Foam::dictionary::optionalSubDict
|
||||
IOWarningInFunction(*this)
|
||||
<< "Entry '" << keyword
|
||||
<< "' found but not a sub-dictionary in dictionary "
|
||||
<< name() << endl;
|
||||
<< relativeName() << endl;
|
||||
}
|
||||
|
||||
return *this;
|
||||
@ -737,7 +739,7 @@ Foam::entry* Foam::dictionary::add(entry* entryPtr, bool mergeEntry)
|
||||
|
||||
IOWarningInFunction(*this)
|
||||
<< "Problem replacing entry "<< entryPtr->keyword()
|
||||
<< " in dictionary " << name() << endl;
|
||||
<< " in dictionary " << relativeName() << endl;
|
||||
|
||||
parent_type::remove(entryPtr);
|
||||
|
||||
@ -765,7 +767,8 @@ Foam::entry* Foam::dictionary::add(entry* entryPtr, bool mergeEntry)
|
||||
|
||||
IOWarningInFunction(*this)
|
||||
<< "Attempt to add entry " << entryPtr->keyword()
|
||||
<< " which already exists in dictionary " << name() << endl;
|
||||
<< " which already exists in dictionary "
|
||||
<< relativeName() << endl;
|
||||
|
||||
delete entryPtr;
|
||||
return nullptr;
|
||||
@ -871,7 +874,7 @@ bool Foam::dictionary::merge(const dictionary& dict)
|
||||
{
|
||||
FatalIOErrorInFunction(*this)
|
||||
<< "Attempted merge to self, for dictionary "
|
||||
<< name() << nl
|
||||
<< relativeName() << nl
|
||||
<< abort(FatalIOError);
|
||||
}
|
||||
|
||||
@ -960,7 +963,7 @@ void Foam::dictionary::operator+=(const dictionary& rhs)
|
||||
{
|
||||
FatalIOErrorInFunction(*this)
|
||||
<< "Attempted addition to self, for dictionary "
|
||||
<< name() << nl
|
||||
<< relativeName() << nl
|
||||
<< abort(FatalIOError);
|
||||
}
|
||||
|
||||
@ -977,7 +980,7 @@ void Foam::dictionary::operator|=(const dictionary& rhs)
|
||||
{
|
||||
FatalIOErrorInFunction(*this)
|
||||
<< "Attempted |= merging to self, for dictionary "
|
||||
<< name() << nl
|
||||
<< relativeName() << nl
|
||||
<< abort(FatalIOError);
|
||||
}
|
||||
|
||||
@ -997,7 +1000,7 @@ void Foam::dictionary::operator<<=(const dictionary& rhs)
|
||||
{
|
||||
FatalIOErrorInFunction(*this)
|
||||
<< "Attempted addition to self, for dictionary "
|
||||
<< name() << nl
|
||||
<< relativeName() << nl
|
||||
<< abort(FatalIOError);
|
||||
}
|
||||
|
||||
|
||||
@ -50,21 +50,14 @@ Foam::dictionary::const_searcher Foam::dictionary::csearchCompat
|
||||
|
||||
if (finder.good())
|
||||
{
|
||||
// Want single warning (on master), but guard with parRun to avoid
|
||||
// Pstream::master() when Pstream has not yet been initialized
|
||||
if
|
||||
(
|
||||
(Pstream::parRun() ? Pstream::master() : true)
|
||||
&& error::warnAboutAge(alt.second)
|
||||
)
|
||||
if (error::warnAboutAge(alt.second) && error::master())
|
||||
{
|
||||
std::cerr
|
||||
<< "--> FOAM IOWarning :" << nl
|
||||
<< " Found [v" << alt.second << "] '"
|
||||
<< alt.first << "' entry instead of '"
|
||||
<< keyword.c_str() << "' in dictionary \""
|
||||
<< name().c_str() << "\" "
|
||||
<< nl
|
||||
<< relativeName() << '"' << nl
|
||||
<< std::endl;
|
||||
|
||||
error::warnAboutAge("keyword", alt.second);
|
||||
@ -113,7 +106,7 @@ const Foam::entry& Foam::dictionary::lookupEntryCompat
|
||||
{
|
||||
FatalIOErrorInFunction(*this)
|
||||
<< "Entry '" << keyword << "' not found in dictionary "
|
||||
<< name()
|
||||
<< relativeName()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
|
||||
@ -125,6 +125,12 @@ public:
|
||||
return dictionary::name();
|
||||
}
|
||||
|
||||
//- Return scoped dictionary name relative to the current case
|
||||
virtual fileName relativeName() const
|
||||
{
|
||||
return dictionary::relativeName();
|
||||
}
|
||||
|
||||
//- Return line number of first token in dictionary
|
||||
virtual label startLineNumber() const;
|
||||
|
||||
@ -132,7 +138,7 @@ public:
|
||||
virtual label endLineNumber() const;
|
||||
|
||||
//- This entry is not a primitive,
|
||||
// calling this function generates a FatalError
|
||||
//- calling this function generates a FatalError
|
||||
virtual ITstream& stream() const;
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -44,6 +44,20 @@ Foam::entry::inputMode Foam::entry::globalInputMode = inputMode::MERGE;
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
void Foam::entry::reportReadWarning
|
||||
(
|
||||
const IOstream& is,
|
||||
const std::string& msg
|
||||
)
|
||||
{
|
||||
std::cerr
|
||||
<< "--> FOAM Warning :\n"
|
||||
<< " Reading \"" << is.relativeName()
|
||||
<< "\" at line " << is.lineNumber() << '\n'
|
||||
<< " " << msg << std::endl;
|
||||
}
|
||||
|
||||
|
||||
void Foam::entry::resetInputMode()
|
||||
{
|
||||
globalInputMode = inputMode::MERGE;
|
||||
@ -85,7 +99,7 @@ void Foam::entry::raiseBadInput(const ITstream& is) const
|
||||
"", // functionName
|
||||
"", // sourceFileName
|
||||
0, // sourceFileLineNumber
|
||||
this->name(), // ioFileName
|
||||
this->relativeName(), // ioFileName
|
||||
is.lineNumber() // ioStartLineNumber
|
||||
)
|
||||
<< "Entry '" << keyword << "' with invalid input" << nl << nl
|
||||
@ -110,7 +124,7 @@ void Foam::entry::checkITstream(const ITstream& is) const
|
||||
"", // functionName
|
||||
"", // sourceFileName
|
||||
0, // sourceFileLineNumber
|
||||
this->name(), // ioFileName
|
||||
this->relativeName(), // ioFileName
|
||||
is.lineNumber() // ioStartLineNumber
|
||||
);
|
||||
|
||||
@ -132,7 +146,7 @@ void Foam::entry::checkITstream(const ITstream& is) const
|
||||
<< remaining << " excess tokens in stream" << nl << nl;
|
||||
|
||||
std::cerr
|
||||
<< "file: " << this->name()
|
||||
<< "file: " << this->relativeName()
|
||||
<< " at line " << is.lineNumber() << '.' << nl
|
||||
<< std::endl;
|
||||
|
||||
@ -149,7 +163,7 @@ void Foam::entry::checkITstream(const ITstream& is) const
|
||||
"", // functionName
|
||||
"", // sourceFileName
|
||||
0, // sourceFileLineNumber
|
||||
this->name(), // ioFileName
|
||||
this->relativeName(), // ioFileName
|
||||
is.lineNumber() // ioStartLineNumber
|
||||
)
|
||||
<< "Entry '" << keyword
|
||||
@ -165,7 +179,7 @@ void Foam::entry::checkITstream(const ITstream& is) const
|
||||
<< "' had no tokens in stream" << nl << nl;
|
||||
|
||||
std::cerr
|
||||
<< "file: " << this->name()
|
||||
<< "file: " << this->relativeName()
|
||||
<< " at line " << is.lineNumber() << '.' << nl
|
||||
<< std::endl;
|
||||
|
||||
|
||||
@ -87,7 +87,7 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
// Private data
|
||||
// Private Data
|
||||
|
||||
//- Keyword of entry
|
||||
keyType keyword_;
|
||||
@ -114,6 +114,14 @@ private:
|
||||
void raiseBadInput(const ITstream& is) const;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Report a read warning (on std::cerr)
|
||||
static void reportReadWarning(const IOstream&, const std::string&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Enable or disable use of function entries and variable expansions.
|
||||
@ -202,6 +210,9 @@ public:
|
||||
//- Return the entry name for modification
|
||||
virtual fileName& name() = 0;
|
||||
|
||||
//- Return the entry name relative to the current case
|
||||
virtual fileName relativeName() const = 0;
|
||||
|
||||
//- Return line number of first token in dictionary
|
||||
virtual label startLineNumber() const = 0;
|
||||
|
||||
|
||||
@ -92,10 +92,11 @@ bool Foam::entry::getKeyword(keyType& keyword, Istream& is)
|
||||
<< "--> FOAM Warning :" << nl
|
||||
<< " From function " << FUNCTION_NAME << nl
|
||||
<< " in file " << __FILE__ << " at line " << __LINE__ << nl
|
||||
<< " Reading " << is.name() << nl
|
||||
<< " Reading " << is.relativeName() << nl
|
||||
<< " found " << keyToken << nl
|
||||
<< " expected either " << token::END_BLOCK << " or EOF"
|
||||
<< std::endl;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -68,8 +68,9 @@ Foam::string Foam::functionEntries::calcEntry::evaluate
|
||||
)
|
||||
{
|
||||
DetailInfo
|
||||
<< "Using #calc at line " << is.lineNumber()
|
||||
<< " in file " << parentDict.name() << endl;
|
||||
<< "Using #calc - line "
|
||||
<< is.lineNumber() << " in file "
|
||||
<< parentDict.relativeName() << nl;
|
||||
|
||||
dynamicCode::checkSecurity
|
||||
(
|
||||
|
||||
@ -356,7 +356,7 @@ Foam::string Foam::functionEntries::codeStream::evaluate
|
||||
{
|
||||
DetailInfo
|
||||
<< "Using #codeStream at line " << is.lineNumber()
|
||||
<< " in file " << parentDict.name() << endl;
|
||||
<< " in file " << parentDict.relativeName() << endl;
|
||||
|
||||
dynamicCode::checkSecurity
|
||||
(
|
||||
|
||||
@ -58,25 +58,6 @@ namespace functionEntries
|
||||
|
||||
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
|
||||
|
||||
namespace
|
||||
{
|
||||
// This is akin to a SafeIOWarning, which does not yet exist
|
||||
inline void safeIOWarning
|
||||
(
|
||||
const Foam::IOstream& is,
|
||||
const std::string& msg
|
||||
)
|
||||
{
|
||||
std::cerr
|
||||
<< "--> FOAM Warning :\n"
|
||||
<< " Reading \"" << is.name() << "\" at line "
|
||||
<< is.lineNumber() << '\n'
|
||||
<< " " << msg << std::endl;
|
||||
}
|
||||
|
||||
} // End anonymous namespace
|
||||
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
@ -158,8 +139,6 @@ static bool slurpUntilBalancedBrace(ISstream& is, std::string& str)
|
||||
|
||||
str.append(buf, nChar); // Finalize pending content
|
||||
|
||||
safeIOWarning(is, "Premature end while reading expression - missing '}'?");
|
||||
|
||||
is.fatalCheck(FUNCTION_NAME);
|
||||
return false;
|
||||
}
|
||||
@ -252,7 +231,8 @@ Foam::tokenList Foam::functionEntries::evalEntry::evaluate
|
||||
{
|
||||
InfoErr
|
||||
<< "Empty #eval - line "
|
||||
<< is.lineNumber() << " in file " << parentDict.name() << nl;
|
||||
<< is.lineNumber() << " in file "
|
||||
<< parentDict.relativeName() << nl;
|
||||
|
||||
return tokenList();
|
||||
}
|
||||
@ -268,7 +248,8 @@ Foam::tokenList Foam::functionEntries::evalEntry::evaluate
|
||||
{
|
||||
InfoErr
|
||||
<< "Failed #eval - line "
|
||||
<< is.lineNumber() << " in file " << parentDict.name() << nl;
|
||||
<< is.lineNumber() << " in file "
|
||||
<< parentDict.relativeName() << nl;
|
||||
|
||||
return tokenList();
|
||||
}
|
||||
@ -296,7 +277,8 @@ Foam::tokenList Foam::functionEntries::evalEntry::evaluate
|
||||
#ifdef FULLDEBUG
|
||||
DetailInfo
|
||||
<< "Using #eval - line "
|
||||
<< is.lineNumber() << " in file " << parentDict.name() << nl;
|
||||
<< is.lineNumber() << " in file "
|
||||
<< parentDict.relativeName() << nl;
|
||||
#endif
|
||||
|
||||
token tok(is);
|
||||
@ -321,7 +303,14 @@ Foam::tokenList Foam::functionEntries::evalEntry::evaluate
|
||||
else if (tok.isPunctuation(token::BEGIN_BLOCK))
|
||||
{
|
||||
// - #eval { expr }
|
||||
slurpUntilBalancedBrace(dynamic_cast<ISstream&>(is), str);
|
||||
if (!slurpUntilBalancedBrace(dynamic_cast<ISstream&>(is), str))
|
||||
{
|
||||
reportReadWarning
|
||||
(
|
||||
is,
|
||||
"Premature end while reading expression - missing '}'?"
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -99,21 +100,21 @@ bool Foam::functionEntry::execute
|
||||
return true;
|
||||
}
|
||||
|
||||
auto mfIter =
|
||||
executedictionaryIstreamMemberFunctionTablePtr_->cfind(functionName);
|
||||
auto* mfuncPtr =
|
||||
executedictionaryIstreamMemberFunctionTable(functionName);
|
||||
|
||||
if (!mfIter.found())
|
||||
if (!mfuncPtr)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown functionEntry '" << functionName
|
||||
<< "' in " << is.name() << " near line " << is.lineNumber()
|
||||
<< nl << nl
|
||||
<< "Valid functionEntries :" << endl
|
||||
<< "' in " << is.relativeName()
|
||||
<< " near line " << is.lineNumber() << nl << nl
|
||||
<< "Valid functionEntries :" << nl
|
||||
<< executedictionaryIstreamMemberFunctionTablePtr_->sortedToc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return mfIter()(parentDict, is);
|
||||
return mfuncPtr(parentDict, is);
|
||||
}
|
||||
|
||||
|
||||
@ -138,24 +139,21 @@ bool Foam::functionEntry::execute
|
||||
return true;
|
||||
}
|
||||
|
||||
auto mfIter =
|
||||
executeprimitiveEntryIstreamMemberFunctionTablePtr_->cfind
|
||||
(
|
||||
functionName
|
||||
);
|
||||
auto* mfuncPtr =
|
||||
executeprimitiveEntryIstreamMemberFunctionTable(functionName);
|
||||
|
||||
if (!mfIter.found())
|
||||
if (!mfuncPtr)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown functionEntry '" << functionName
|
||||
<< "' in " << is.name() << " near line " << is.lineNumber()
|
||||
<< nl << nl
|
||||
<< "Valid functionEntries :" << endl
|
||||
<< "' in " << is.relativeName()
|
||||
<< " near line " << is.lineNumber() << nl << nl
|
||||
<< "Valid functionEntries :" << nl
|
||||
<< executeprimitiveEntryIstreamMemberFunctionTablePtr_->sortedToc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return mfIter()(parentDict, entry, is);
|
||||
return mfuncPtr(parentDict, entry, is);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -48,15 +49,15 @@ SourceFiles
|
||||
#ifndef functionEntry_H
|
||||
#define functionEntry_H
|
||||
|
||||
#include "word.H"
|
||||
#include "memberFunctionSelectionTables.H"
|
||||
#include "primitiveEntry.H"
|
||||
#include "memberFunctionSelectionTables.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward Declarations
|
||||
class dictionary;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
@ -67,17 +68,10 @@ class functionEntry
|
||||
:
|
||||
public primitiveEntry
|
||||
{
|
||||
// Private Member Functions
|
||||
|
||||
//- No copy construct
|
||||
functionEntry(const functionEntry&) = delete;
|
||||
|
||||
//- No copy assignment
|
||||
void operator=(const functionEntry&) = delete;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Read line and return as a string token
|
||||
static token readLine(const word& key, Istream& is);
|
||||
|
||||
@ -86,6 +80,12 @@ protected:
|
||||
template<class StringType>
|
||||
static List<StringType> readStringList(Istream& is);
|
||||
|
||||
//- No copy construct
|
||||
functionEntry(const functionEntry&) = delete;
|
||||
|
||||
//- No copy assignment
|
||||
void operator=(const functionEntry&) = delete;
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
@ -391,8 +391,8 @@ bool Foam::functionEntries::ifeqEntry::execute
|
||||
|
||||
if (ifEntry::isTrue(e.stream()))
|
||||
{
|
||||
// Info<< "Using #elif " << doIf << " at line " << lineNo
|
||||
// << " in file " << is.name() << endl;
|
||||
// Info<< "Using #elif " << doIf << " - line " << lineNo
|
||||
// << " in file " << is.relativeName() << endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -170,7 +170,7 @@ bool Foam::functionEntries::includeEntry::execute
|
||||
FatalIOErrorInFunction(is)
|
||||
<< "Cannot open include file "
|
||||
<< (ifs.name().size() ? ifs.name() : rawName)
|
||||
<< " while reading dictionary " << parentDict.name()
|
||||
<< " while reading dictionary " << parentDict.relativeName()
|
||||
<< exit(FatalIOError);
|
||||
|
||||
return false;
|
||||
@ -222,7 +222,7 @@ bool Foam::functionEntries::includeEntry::execute
|
||||
FatalIOErrorInFunction(is)
|
||||
<< "Cannot open include file "
|
||||
<< (ifs.name().size() ? ifs.name() : rawName)
|
||||
<< " while reading dictionary " << parentDict.name()
|
||||
<< " while reading dictionary " << parentDict.relativeName()
|
||||
<< exit(FatalIOError);
|
||||
|
||||
return false;
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -138,7 +138,7 @@ bool Foam::functionEntries::includeEtcEntry::execute
|
||||
FatalIOErrorInFunction(is)
|
||||
<< "Cannot open etc file "
|
||||
<< (ifs.name().size() ? ifs.name() : rawName)
|
||||
<< " while reading dictionary " << parentDict.name()
|
||||
<< " while reading dictionary " << parentDict.relativeName()
|
||||
<< exit(FatalIOError);
|
||||
|
||||
return false;
|
||||
@ -178,7 +178,7 @@ bool Foam::functionEntries::includeEtcEntry::execute
|
||||
FatalIOErrorInFunction(is)
|
||||
<< "Cannot open etc file "
|
||||
<< (ifs.name().size() ? ifs.name() : rawName)
|
||||
<< " while reading dictionary " << parentDict.name()
|
||||
<< " while reading dictionary " << parentDict.relativeName()
|
||||
<< exit(FatalIOError);
|
||||
|
||||
return false;
|
||||
|
||||
@ -155,6 +155,12 @@ public:
|
||||
return ITstream::name();
|
||||
}
|
||||
|
||||
//- Return token stream name relative to the current case
|
||||
virtual fileName relativeName() const
|
||||
{
|
||||
return ITstream::relativeName();
|
||||
}
|
||||
|
||||
//- Return line number of first token in dictionary
|
||||
virtual label startLineNumber() const;
|
||||
|
||||
|
||||
@ -30,27 +30,6 @@ License
|
||||
#include "functionEntry.H"
|
||||
#include "evalEntry.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
|
||||
|
||||
namespace
|
||||
{
|
||||
// This is akin to a SafeIOWarning, which does not yet exist
|
||||
inline void safeIOWarning
|
||||
(
|
||||
const Foam::IOstream& is,
|
||||
const std::string& msg
|
||||
)
|
||||
{
|
||||
std::cerr
|
||||
<< "--> FOAM Warning :\n"
|
||||
<< " Reading \"" << is.name() << "\" at line "
|
||||
<< is.lineNumber() << '\n'
|
||||
<< " " << msg << std::endl;
|
||||
}
|
||||
|
||||
} // End anonymous namespace
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
bool Foam::primitiveEntry::acceptToken
|
||||
@ -182,7 +161,7 @@ bool Foam::primitiveEntry::read(const dictionary& dict, Istream& is)
|
||||
--depth;
|
||||
if (depth < 0)
|
||||
{
|
||||
safeIOWarning
|
||||
reportReadWarning
|
||||
(
|
||||
is,
|
||||
"Too many closing ')' ... was a ';' forgotten?"
|
||||
@ -191,7 +170,7 @@ bool Foam::primitiveEntry::read(const dictionary& dict, Istream& is)
|
||||
else if (depth < 61 && ((balanced >> depth) & 1u))
|
||||
{
|
||||
// Bit was set, but expected it to be unset.
|
||||
safeIOWarning(is, "Imbalanced '{' with ')'");
|
||||
reportReadWarning(is, "Imbalanced '{' with ')'");
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -201,7 +180,7 @@ bool Foam::primitiveEntry::read(const dictionary& dict, Istream& is)
|
||||
--depth;
|
||||
if (depth < 0)
|
||||
{
|
||||
safeIOWarning
|
||||
reportReadWarning
|
||||
(
|
||||
is,
|
||||
"Too many closing '}' ... was a ';' forgotten?"
|
||||
@ -210,7 +189,7 @@ bool Foam::primitiveEntry::read(const dictionary& dict, Istream& is)
|
||||
else if (depth < 61 && !((balanced >> depth) & 1u))
|
||||
{
|
||||
// Bit was unset, but expected it to be set.
|
||||
safeIOWarning(is, "Imbalanced '(' with '}'");
|
||||
reportReadWarning(is, "Imbalanced '(' with '}'");
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -230,7 +209,7 @@ bool Foam::primitiveEntry::read(const dictionary& dict, Istream& is)
|
||||
|
||||
if (depth)
|
||||
{
|
||||
safeIOWarning(is, "Imbalanced brackets");
|
||||
reportReadWarning(is, "Imbalanced brackets");
|
||||
}
|
||||
|
||||
is.fatalCheck(FUNCTION_NAME);
|
||||
|
||||
@ -27,7 +27,6 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "error.H"
|
||||
#include "argList.H"
|
||||
#include "StringStream.H"
|
||||
#include "fileName.H"
|
||||
#include "dictionary.H"
|
||||
@ -100,7 +99,7 @@ Foam::OSstream& Foam::IOerror::operator()
|
||||
functionName,
|
||||
sourceFileName,
|
||||
sourceFileLineNumber,
|
||||
argList::envRelativePath(ioStream.name()),
|
||||
ioStream.relativeName(),
|
||||
ioStream.lineNumber(),
|
||||
-1 // No known endLineNumber
|
||||
);
|
||||
@ -137,8 +136,8 @@ Foam::OSstream& Foam::IOerror::operator()
|
||||
(
|
||||
where.c_str(),
|
||||
"", // No source file
|
||||
1, // Non-zero to ensure that 'where' is reported
|
||||
argList::envRelativePath(ioStream.name()),
|
||||
-1, // Non-zero to ensure 'where' is reported
|
||||
ioStream.relativeName(),
|
||||
ioStream.lineNumber(),
|
||||
-1 // No known endLineNumber
|
||||
);
|
||||
@ -155,7 +154,7 @@ Foam::OSstream& Foam::IOerror::operator()
|
||||
(
|
||||
where.c_str(),
|
||||
"", // No source file
|
||||
1, // Non-zero to ensure that 'where' is reported
|
||||
-1, // Non-zero to ensure 'where' is reported
|
||||
dict.relativeName(),
|
||||
dict.startLineNumber(),
|
||||
dict.endLineNumber()
|
||||
@ -188,7 +187,7 @@ void Foam::IOerror::SafeFatalIOError
|
||||
<< nl
|
||||
<< "--> FOAM FATAL IO ERROR:" << nl
|
||||
<< msg << nl
|
||||
<< "file: " << ioStream.name()
|
||||
<< "file: " << ioStream.relativeName()
|
||||
<< " at line " << ioStream.lineNumber() << '.' << nl << nl
|
||||
<< " From " << functionName << nl
|
||||
<< " in file " << sourceFileName
|
||||
@ -253,7 +252,7 @@ void Foam::IOerror::abort()
|
||||
}
|
||||
|
||||
|
||||
void Foam::IOerror::write(Ostream& os, const bool includeTitle) const
|
||||
void Foam::IOerror::write(Ostream& os, const bool withTitle) const
|
||||
{
|
||||
if (os.bad())
|
||||
{
|
||||
@ -261,7 +260,7 @@ void Foam::IOerror::write(Ostream& os, const bool includeTitle) const
|
||||
}
|
||||
|
||||
os << nl;
|
||||
if (includeTitle && !title().empty())
|
||||
if (withTitle && !title().empty())
|
||||
{
|
||||
os << title().c_str()
|
||||
<< "(openfoam-" << foamVersion::api;
|
||||
|
||||
@ -38,6 +38,20 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::error::master(const label communicator)
|
||||
{
|
||||
// Trap negative value for comm as 'default'. This avoids direct use
|
||||
// of Pstream::worldComm which may not have been initialised
|
||||
|
||||
return
|
||||
(
|
||||
UPstream::parRun()
|
||||
? (communicator < 0 ? UPstream::master() : UPstream::master(communicator))
|
||||
: true
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::error::warnAboutAge(const int version) noexcept
|
||||
{
|
||||
// No warning for 0 (unversioned) or -ve values (silent versioning)
|
||||
@ -245,20 +259,20 @@ void Foam::error::simpleExit(const int errNo, const bool isAbort)
|
||||
error::printStack(Perr);
|
||||
std::abort();
|
||||
}
|
||||
else if (Pstream::parRun())
|
||||
else if (UPstream::parRun())
|
||||
{
|
||||
if (isAbort)
|
||||
{
|
||||
Perr<< nl << *this << nl
|
||||
<< "\nFOAM parallel run aborting\n" << endl;
|
||||
error::printStack(Perr);
|
||||
Pstream::abort();
|
||||
UPstream::abort();
|
||||
}
|
||||
else
|
||||
{
|
||||
Perr<< nl << *this << nl
|
||||
<< "\nFOAM parallel run exiting\n" << endl;
|
||||
Pstream::exit(errNo);
|
||||
UPstream::exit(errNo);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -326,7 +340,7 @@ void Foam::error::abort()
|
||||
}
|
||||
|
||||
|
||||
void Foam::error::write(Ostream& os, const bool includeTitle) const
|
||||
void Foam::error::write(Ostream& os, const bool withTitle) const
|
||||
{
|
||||
if (os.bad())
|
||||
{
|
||||
@ -334,7 +348,7 @@ void Foam::error::write(Ostream& os, const bool includeTitle) const
|
||||
}
|
||||
|
||||
os << nl;
|
||||
if (includeTitle && !title().empty())
|
||||
if (withTitle && !title().empty())
|
||||
{
|
||||
os << title().c_str()
|
||||
<< "(openfoam-" << foamVersion::api;
|
||||
|
||||
@ -119,6 +119,13 @@ public:
|
||||
|
||||
// Static Functions
|
||||
|
||||
//- Like Pstream::master but with a Pstream::parRun guard in case
|
||||
//- Pstream has not yet been initialised.
|
||||
//
|
||||
// \param communicator is the numbered MPI communicator.
|
||||
// By default it uses UPstream::worldComm
|
||||
static bool master(const label communicator = -1);
|
||||
|
||||
//- Test if an age warning should be emitted.
|
||||
// \param version is the old version (YYMM) for determining the
|
||||
// age in months compared to the current OpenFOAM version
|
||||
@ -244,7 +251,7 @@ public:
|
||||
void abort();
|
||||
|
||||
//- Print error message
|
||||
virtual void write(Ostream& os, const bool includeTitle = true) const;
|
||||
virtual void write(Ostream& os, const bool withTitle = true) const;
|
||||
|
||||
|
||||
// Housekeeping
|
||||
@ -405,7 +412,7 @@ public:
|
||||
void abort();
|
||||
|
||||
//- Print error message
|
||||
virtual void write(Ostream& os, const bool includeTitle = true) const;
|
||||
virtual void write(Ostream& os, const bool withTitle = true) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -80,10 +80,10 @@ Foam::OSstream& Foam::messageStream::stream(OSstream* alternative)
|
||||
|| severity_ == INFO_STDERR
|
||||
|| severity_ == WARNING
|
||||
)
|
||||
|| !Pstream::parRun()
|
||||
|| !UPstream::parRun()
|
||||
);
|
||||
|
||||
if (serialOnly && (Pstream::parRun() && !Pstream::master()))
|
||||
if (serialOnly && (UPstream::parRun() && !UPstream::master()))
|
||||
{
|
||||
return Snull; // Non-serial, non-master: exit early
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -108,9 +108,9 @@ Foam::autoPtr<Foam::functionObject> Foam::functionObject::New
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(functionType);
|
||||
auto* ctorPtr = dictionaryConstructorTable(functionType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
// FatalError (not FatalIOError) to ensure it can be caught
|
||||
// as an exception and ignored
|
||||
@ -122,7 +122,7 @@ Foam::autoPtr<Foam::functionObject> Foam::functionObject::New
|
||||
) << exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<functionObject>(cstrIter()(name, runTime, dict));
|
||||
return autoPtr<functionObject>(ctorPtr(name, runTime, dict));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -26,6 +27,10 @@ License
|
||||
Description
|
||||
Macros for easy insertion into run-time selection tables
|
||||
|
||||
Note
|
||||
The helper macro names used here must remain synchronized with
|
||||
definitions in runTimeSelectionTables.H
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef addToRunTimeSelectionTable_H
|
||||
@ -33,88 +38,119 @@ Description
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
//- Add to hash-table of functions with typename as the key
|
||||
//- Add to construction table with typeName as the key
|
||||
#define addToRunTimeSelectionTable\
|
||||
(baseType,thisType,argNames) \
|
||||
\
|
||||
/* Add the thisType constructor function to the table */ \
|
||||
/* Add thisType factory method to the table */ \
|
||||
baseType::add##argNames##ConstructorToTable<thisType> \
|
||||
add##thisType##argNames##ConstructorTo##baseType##Table_
|
||||
|
||||
|
||||
//- Add to hash-table of functions with 'lookup' as the key
|
||||
#define addNamedToRunTimeSelectionTable\
|
||||
(baseType,thisType,argNames,lookup) \
|
||||
\
|
||||
/* Add the thisType constructor function to the table, find by lookup */ \
|
||||
baseType::add##argNames##ConstructorToTable<thisType> \
|
||||
add_##lookup##_##thisType##argNames##ConstructorTo##baseType##Table_ \
|
||||
(#lookup)
|
||||
|
||||
|
||||
//- Add to hash-table of functions with typename as the key
|
||||
//- Add to construction table with typeName as the key
|
||||
#define addRemovableToRunTimeSelectionTable\
|
||||
(baseType,thisType,argNames) \
|
||||
\
|
||||
/* Add the thisType constructor function to the table */ \
|
||||
/* Add thisType factory method to the table */ \
|
||||
baseType::addRemovable##argNames##ConstructorToTable<thisType> \
|
||||
addRemovable##thisType##argNames##ConstructorTo##baseType##Table_
|
||||
|
||||
|
||||
//- Add to hash-table of functions with 'lookup' as the key
|
||||
#define addRemovableNamedToRunTimeSelectionTable\
|
||||
(baseType,thisType,argNames,lookup) \
|
||||
//- Add to construction table with 'lookupName' as the key
|
||||
#define addNamedToRunTimeSelectionTable\
|
||||
(baseType,thisType,argNames,lookupName) \
|
||||
\
|
||||
/* Add the thisType constructor function to the table, find by lookup */ \
|
||||
/* Add thisType factory method to the table, find by lookupName */ \
|
||||
baseType::add##argNames##ConstructorToTable<thisType> \
|
||||
add##thisType##argNames##ConstructorTo## \
|
||||
baseType##Table_##lookupName##_(#lookupName)
|
||||
|
||||
|
||||
//- Add to construction table with 'lookupName' as the key
|
||||
#define addRemovableNamedToRunTimeSelectionTable\
|
||||
(baseType,thisType,argNames,lookupName) \
|
||||
\
|
||||
/* Add thisType factory method to the table, find by lookupName */ \
|
||||
baseType::addRemovable##argNames##ConstructorToTable<thisType> \
|
||||
addRemovable_##lookup##_##thisType##argNames##ConstructorTo \
|
||||
##baseType##Table_(#lookup)
|
||||
addRemovable##thisType##argNames##ConstructorTo## \
|
||||
baseType##Table_##lookupName##_(#lookupName)
|
||||
|
||||
|
||||
//- Add lookup alias for runTime selection
|
||||
#define addAliasToRunTimeSelectionTable\
|
||||
(baseType,thisType,argNames,lookup,other,ver) \
|
||||
\
|
||||
/* Add thisType constructor function to the table, find by lookup */ \
|
||||
baseType::addAlias##argNames##ConstructorToTable<thisType> \
|
||||
add##thisType##argNames##ConstructorTo##baseType##Table_ \
|
||||
##lookup##_##other##_(#lookup,#other,ver)
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
//- Add to hash-table of functions with typename as the key.
|
||||
//- Add to construction table with typeName as the key.
|
||||
// Use when baseType doesn't need a template argument (eg, is a typedef)
|
||||
#define addTemplateToRunTimeSelectionTable\
|
||||
(baseType,thisType,Targ,argNames) \
|
||||
\
|
||||
/* Add the thisType constructor function to the table */ \
|
||||
/* Add thisType factory method to the table */ \
|
||||
baseType::add##argNames##ConstructorToTable<thisType<Targ>> \
|
||||
add##thisType##Targ##argNames##ConstructorTo##baseType##Table_
|
||||
|
||||
|
||||
//- Add to hash-table of functions with 'lookup' as the key.
|
||||
//- Add to construction table with 'lookupName' as the key.
|
||||
// Use when baseType doesn't need a template argument (eg, is a typedef)
|
||||
#define addNamedTemplateToRunTimeSelectionTable\
|
||||
(baseType,thisType,Targ,argNames,lookup) \
|
||||
(baseType,thisType,Targ,argNames,lookupName) \
|
||||
\
|
||||
/* Add the thisType constructor function to the table, find by lookup */ \
|
||||
/* Add thisType factory method to the table, find by lookupName */ \
|
||||
baseType::add##argNames##ConstructorToTable<thisType<Targ>> \
|
||||
add_##lookup##_##thisType##Targ##argNames##ConstructorTo##baseType \
|
||||
##Table_(#lookup)
|
||||
add##thisType##Targ##argNames##ConstructorTo## \
|
||||
baseType##Table_##lookupName##_(#lookupName)
|
||||
|
||||
|
||||
//- Add lookup alias for for runTime selection
|
||||
#define addAliasTemplateToRunTimeSelectionTable\
|
||||
(baseType,thisType,Targ,argNames,lookup,other,ver) \
|
||||
\
|
||||
/* Add thisType constructor function to the table, find by lookup */ \
|
||||
baseType::addAlias##argNames##ConstructorToTable<thisType<Targ>> \
|
||||
add##thisType##Targs##argNames##ConstructorTo##baseType##Table_ \
|
||||
##lookup##_##other##_(#lookup,#other,ver)
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
//- Add to hash-table of functions with typename as the key.
|
||||
//- Add to construction table with typeName as the key.
|
||||
// Use when baseType requires the Targ template argument as well
|
||||
#define addTemplatedToRunTimeSelectionTable\
|
||||
(baseType,thisType,Targ,argNames) \
|
||||
\
|
||||
/* Add the thisType constructor function to the table */ \
|
||||
/* Add thisType factory method to the table */ \
|
||||
baseType<Targ>::add##argNames##ConstructorToTable<thisType<Targ>> \
|
||||
add##thisType##Targ##argNames##ConstructorTo##baseType##Targ##Table_
|
||||
|
||||
|
||||
//- Add to hash-table of functions with 'lookup' as the key.
|
||||
//- Add to construction table with 'lookupName' as the key.
|
||||
// Use when baseType requires the Targ template argument as well
|
||||
#define addNamedTemplatedToRunTimeSelectionTable\
|
||||
(baseType,thisType,Targ,argNames,lookup) \
|
||||
(baseType,thisType,Targ,argNames,lookupName) \
|
||||
\
|
||||
/* Add thisType factory method to the table, find by lookupName */ \
|
||||
baseType<Targ>::add##argNames##ConstructorToTable<thisType<Targ>> \
|
||||
add##thisType##Targ##argNames##ConstructorTo## \
|
||||
baseType##Targ##Table_##lookupName##_(#lookupName)
|
||||
|
||||
|
||||
//- Add lookup alias for for runTime selection
|
||||
// Use when baseType requires the Targ template argument as well
|
||||
#define addAliasTemplatedToRunTimeSelectionTable\
|
||||
(baseType,thisType,Targ,argNames,lookup,other,ver) \
|
||||
\
|
||||
/* Add the thisType constructor function to the table, find by lookup */ \
|
||||
baseType<Targ>::add##argNames##ConstructorToTable<thisType<Targ>> \
|
||||
add_##lookup##_##thisType##Targ##argNames##ConstructorTo##baseType## \
|
||||
Targ##Table_(#lookup)
|
||||
add##thisType##Targ##argNames##ConstructorTo##baseType##Targ## \
|
||||
Table_##lookup##_##other##_(#lookup,#other,ver)
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -40,339 +40,358 @@ Description
|
||||
#ifndef runTimeSelectionTables_H
|
||||
#define runTimeSelectionTables_H
|
||||
|
||||
#include <memory> // For std::unique_ptr
|
||||
#include <utility> // For std::pair
|
||||
|
||||
#include "autoPtr.H"
|
||||
#include "HashTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
//- Declare a run-time selection
|
||||
#define declareRunTimeSelectionTable(autoPtr,baseType,argNames,argList,parList)\
|
||||
// Common infrastructure
|
||||
|
||||
// Not used directly: declare run-time selection (variables and methods)
|
||||
#define declareRunTimeSelectionTableBase(returnType,prefix,argList) \
|
||||
\
|
||||
/* Construct from argList function pointer type */ \
|
||||
typedef autoPtr<baseType> (*argNames##ConstructorPtr)argList; \
|
||||
/* Function pointer type: construct from argList */ \
|
||||
typedef returnType (*prefix##Ptr)argList; \
|
||||
\
|
||||
/* Construct from argList function table type */ \
|
||||
typedef HashTable \
|
||||
/* Function table type: construct from argList */ \
|
||||
typedef ::Foam::HashTable \
|
||||
< \
|
||||
argNames##ConstructorPtr, \
|
||||
prefix##Ptr, \
|
||||
::Foam::word, \
|
||||
::Foam::string::hasher \
|
||||
> argNames##ConstructorTable; \
|
||||
> prefix##TableType; \
|
||||
\
|
||||
/* Construct from argList function pointer table pointer */ \
|
||||
static argNames##ConstructorTable* argNames##ConstructorTablePtr_; \
|
||||
\
|
||||
/* Table constructor called from the table add function */ \
|
||||
static void construct##argNames##ConstructorTables(); \
|
||||
\
|
||||
/* Table destructor called from the table add function destructor */ \
|
||||
static void destroy##argNames##ConstructorTables(); \
|
||||
\
|
||||
/* Class to add constructor from argList to table */ \
|
||||
template<class baseType##Type> \
|
||||
class add##argNames##ConstructorToTable \
|
||||
{ \
|
||||
public: \
|
||||
\
|
||||
static autoPtr<baseType> New argList \
|
||||
{ \
|
||||
return autoPtr<baseType>(new baseType##Type parList); \
|
||||
} \
|
||||
\
|
||||
explicit add##argNames##ConstructorToTable \
|
||||
( \
|
||||
const ::Foam::word& lookup = baseType##Type::typeName \
|
||||
) \
|
||||
{ \
|
||||
construct##argNames##ConstructorTables(); \
|
||||
if (!argNames##ConstructorTablePtr_->insert(lookup, New)) \
|
||||
{ \
|
||||
std::cerr<< "Duplicate entry " << lookup \
|
||||
<< " in runtime selection table " << #baseType \
|
||||
<< std::endl; \
|
||||
error::safePrintStack(std::cerr); \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
~add##argNames##ConstructorToTable() \
|
||||
{ \
|
||||
destroy##argNames##ConstructorTables(); \
|
||||
} \
|
||||
\
|
||||
add##argNames##ConstructorToTable \
|
||||
(const add##argNames##ConstructorToTable&) = delete; \
|
||||
\
|
||||
void operator= \
|
||||
(const add##argNames##ConstructorToTable&) = delete; \
|
||||
}; \
|
||||
\
|
||||
/* Class to add constructor from argList to table */ \
|
||||
/* Remove only the entry (not the table) upon destruction */ \
|
||||
template<class baseType##Type> \
|
||||
class addRemovable##argNames##ConstructorToTable \
|
||||
{ \
|
||||
public: \
|
||||
\
|
||||
const ::Foam::word name; /* Lookup name for later removal */ \
|
||||
\
|
||||
static autoPtr<baseType> New argList \
|
||||
{ \
|
||||
return autoPtr<baseType>(new baseType##Type parList); \
|
||||
} \
|
||||
\
|
||||
explicit addRemovable##argNames##ConstructorToTable \
|
||||
( \
|
||||
const ::Foam::word& lookup = baseType##Type::typeName \
|
||||
) \
|
||||
: \
|
||||
name(lookup) \
|
||||
{ \
|
||||
construct##argNames##ConstructorTables(); \
|
||||
argNames##ConstructorTablePtr_->set(lookup, New); \
|
||||
} \
|
||||
\
|
||||
~addRemovable##argNames##ConstructorToTable() \
|
||||
{ \
|
||||
if (argNames##ConstructorTablePtr_) \
|
||||
{ \
|
||||
argNames##ConstructorTablePtr_->erase(name); \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
addRemovable##argNames##ConstructorToTable \
|
||||
(const addRemovable##argNames##ConstructorToTable&) = delete; \
|
||||
\
|
||||
void operator= \
|
||||
(const addRemovable##argNames##ConstructorToTable&) = delete; \
|
||||
};
|
||||
|
||||
|
||||
|
||||
//- Declare a run-time selection for derived classes
|
||||
#define declareRunTimeNewSelectionTable( \
|
||||
autoPtr,baseType,argNames,argList,parList) \
|
||||
\
|
||||
/* Construct from argList function pointer type */ \
|
||||
typedef autoPtr<baseType> (*argNames##ConstructorPtr)argList; \
|
||||
\
|
||||
/* Construct from argList function table type */ \
|
||||
typedef HashTable \
|
||||
/* Lookup aliases for constructors */ \
|
||||
typedef ::Foam::HashTable \
|
||||
< \
|
||||
argNames##ConstructorPtr, \
|
||||
std::pair<::Foam::word,int>, \
|
||||
::Foam::word, \
|
||||
::Foam::string::hasher \
|
||||
> argNames##ConstructorTable; \
|
||||
> prefix##CompatTableType; \
|
||||
\
|
||||
/* Construct from argList function pointer table pointer */ \
|
||||
static argNames##ConstructorTable* argNames##ConstructorTablePtr_; \
|
||||
/* Table singleton (storage) */ \
|
||||
static prefix##TableType* prefix##TablePtr_; \
|
||||
\
|
||||
/* Table constructor called from the table add function */ \
|
||||
static void construct##argNames##ConstructorTables(); \
|
||||
/* Lookup aliases singleton (storage) */ \
|
||||
static std::unique_ptr<prefix##CompatTableType> prefix##CompatTablePtr_; \
|
||||
\
|
||||
/* Table destructor called from the table add function destructor */ \
|
||||
static void destroy##argNames##ConstructorTables(); \
|
||||
/* Aliases singleton (access) */ \
|
||||
static prefix##CompatTableType& prefix##CompatTable(); \
|
||||
\
|
||||
/* Class to add constructor from argList to table */ \
|
||||
template<class baseType##Type> \
|
||||
class add##argNames##ConstructorToTable \
|
||||
{ \
|
||||
public: \
|
||||
/* Table construct/destruct helper */ \
|
||||
static void prefix##TablePtr_construct(bool load); \
|
||||
\
|
||||
static autoPtr<baseType> New##baseType argList \
|
||||
{ \
|
||||
return autoPtr<baseType>(baseType##Type::New parList.ptr()); \
|
||||
} \
|
||||
\
|
||||
explicit add##argNames##ConstructorToTable \
|
||||
( \
|
||||
const ::Foam::word& lookup = baseType##Type::typeName \
|
||||
) \
|
||||
{ \
|
||||
construct##argNames##ConstructorTables(); \
|
||||
if \
|
||||
( \
|
||||
!argNames##ConstructorTablePtr_->insert \
|
||||
( \
|
||||
lookup, \
|
||||
New##baseType \
|
||||
) \
|
||||
) \
|
||||
{ \
|
||||
std::cerr<< "Duplicate entry " << lookup \
|
||||
<< " in runtime selection table " << #baseType \
|
||||
<< std::endl; \
|
||||
error::safePrintStack(std::cerr); \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
~add##argNames##ConstructorToTable() \
|
||||
{ \
|
||||
destroy##argNames##ConstructorTables(); \
|
||||
} \
|
||||
\
|
||||
add##argNames##ConstructorToTable \
|
||||
(const add##argNames##ConstructorToTable&) = delete; \
|
||||
\
|
||||
void operator= \
|
||||
(const add##argNames##ConstructorToTable&) = delete; \
|
||||
}; \
|
||||
\
|
||||
/* Class to add constructor from argList to table */ \
|
||||
template<class baseType##Type> \
|
||||
class addRemovable##argNames##ConstructorToTable \
|
||||
{ \
|
||||
public: \
|
||||
\
|
||||
const ::Foam::word name; /* Lookup name for later removal */ \
|
||||
\
|
||||
static autoPtr<baseType> New##baseType argList \
|
||||
{ \
|
||||
return autoPtr<baseType>(baseType##Type::New parList.ptr()); \
|
||||
} \
|
||||
\
|
||||
explicit addRemovable##argNames##ConstructorToTable \
|
||||
( \
|
||||
const ::Foam::word& lookup = baseType##Type::typeName \
|
||||
) \
|
||||
: \
|
||||
name(lookup) \
|
||||
{ \
|
||||
construct##argNames##ConstructorTables(); \
|
||||
argNames##ConstructorTablePtr_->set \
|
||||
( \
|
||||
lookup, \
|
||||
New##baseType \
|
||||
); \
|
||||
} \
|
||||
\
|
||||
~addRemovable##argNames##ConstructorToTable() \
|
||||
{ \
|
||||
if (argNames##ConstructorTablePtr_) \
|
||||
{ \
|
||||
argNames##ConstructorTablePtr_->erase(name); \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
addRemovable##argNames##ConstructorToTable \
|
||||
(const addRemovable##argNames##ConstructorToTable&) = delete; \
|
||||
\
|
||||
void operator= \
|
||||
(const addRemovable##argNames##ConstructorToTable&) = delete; \
|
||||
};
|
||||
/* Lookup function pointer from singleton, nullptr if not found */ \
|
||||
static prefix##Ptr prefix##Table(const ::Foam::word& k)
|
||||
|
||||
|
||||
// Constructor aid
|
||||
#define defineRunTimeSelectionTableConstructor(baseType,argNames) \
|
||||
// Not used directly: storage and helper methods for runtime tables
|
||||
#define defineRunTimeSelectionTableBase(baseType,prefix,Tspecialize) \
|
||||
\
|
||||
/* Table constructor called from the table add function */ \
|
||||
void baseType::construct##argNames##ConstructorTables() \
|
||||
/* Define table singleton (storage) */ \
|
||||
Tspecialize prefix##TableType* prefix##TablePtr_(nullptr); \
|
||||
\
|
||||
/* Define aliases singleton (storage) */ \
|
||||
Tspecialize \
|
||||
std::unique_ptr<prefix##CompatTableType> prefix##CompatTablePtr_(nullptr); \
|
||||
\
|
||||
/* Define table singleton (access) for aliases */ \
|
||||
Tspecialize prefix##CompatTableType& prefix##CompatTable() \
|
||||
{ \
|
||||
if (!prefix##CompatTablePtr_) \
|
||||
{ \
|
||||
prefix##CompatTablePtr_.reset(new prefix##CompatTableType(16)); \
|
||||
} \
|
||||
return *(prefix##CompatTablePtr_); \
|
||||
} \
|
||||
\
|
||||
/* Table construct/destruct helper */ \
|
||||
Tspecialize void prefix##TablePtr_construct(bool load) \
|
||||
{ \
|
||||
static bool constructed = false; \
|
||||
if (load) \
|
||||
{ \
|
||||
if (!constructed) \
|
||||
{ \
|
||||
prefix##TablePtr_ = new prefix##TableType; \
|
||||
constructed = true; \
|
||||
baseType::argNames##ConstructorTablePtr_ \
|
||||
= new baseType::argNames##ConstructorTable; \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
// Destructor aid
|
||||
#define defineRunTimeSelectionTableDestructor(baseType,argNames) \
|
||||
\
|
||||
/* Table destructor called from the table add function destructor */ \
|
||||
void baseType::destroy##argNames##ConstructorTables() \
|
||||
{ \
|
||||
if (baseType::argNames##ConstructorTablePtr_) \
|
||||
{ \
|
||||
delete baseType::argNames##ConstructorTablePtr_; \
|
||||
baseType::argNames##ConstructorTablePtr_ = nullptr; \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
// Create pointer to hash-table of functions
|
||||
#define defineRunTimeSelectionTablePtr(baseType,argNames) \
|
||||
else if (prefix##TablePtr_) \
|
||||
{ \
|
||||
delete prefix##TablePtr_; \
|
||||
prefix##TablePtr_ = nullptr; \
|
||||
prefix##CompatTablePtr_.reset(nullptr); \
|
||||
constructed = false; \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
/* Define the constructor function table */ \
|
||||
baseType::argNames##ConstructorTable* \
|
||||
baseType::argNames##ConstructorTablePtr_(nullptr)
|
||||
|
||||
/* Define lookup function pointer (singleton) */ \
|
||||
Tspecialize prefix##Ptr prefix##Table(const ::Foam::word& k) \
|
||||
{ \
|
||||
if (prefix##TablePtr_) \
|
||||
{ \
|
||||
const auto& tbl = *prefix##TablePtr_; \
|
||||
auto iter = tbl.cfind(k); \
|
||||
if (!iter.found() && prefix##CompatTablePtr_) \
|
||||
{ \
|
||||
const auto altIter = prefix##CompatTablePtr_->cfind(k); \
|
||||
if (altIter.found()) \
|
||||
{ \
|
||||
const auto& alt = altIter.val(); /* <word,int> */ \
|
||||
iter = tbl.cfind(alt.first); \
|
||||
if (::Foam::error::warnAboutAge(alt.second)) \
|
||||
{ \
|
||||
std::cerr \
|
||||
<< "Using [v" << alt.second << "] '" << k \
|
||||
<< "' instead of '" << alt.first \
|
||||
<< " in runtime selection table: " \
|
||||
<< #baseType << '\n' << std::endl; \
|
||||
::Foam::error::warnAboutAge("lookup", alt.second); \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
if (iter.found()) \
|
||||
{ \
|
||||
return iter.val(); \
|
||||
} \
|
||||
} \
|
||||
return nullptr; \
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
//
|
||||
// Declaration Macros
|
||||
//
|
||||
|
||||
//- Declare a run-time selection (variables and adder classes)
|
||||
// The ptrWrapper is typically a Foam::autoPtr or a Foam::tmp container.
|
||||
#define declareRunTimeSelectionTable\
|
||||
(ptrWrapper,baseType,argNames,argList,parList) \
|
||||
\
|
||||
declareRunTimeSelectionTableBase( \
|
||||
ptrWrapper<baseType>, argNames##Constructor, argList); \
|
||||
\
|
||||
/* Helper to add compatibility/alias for runtime selection table */ \
|
||||
template<class baseType##Type> \
|
||||
struct addAlias##argNames##ConstructorToTable \
|
||||
{ \
|
||||
explicit addAlias##argNames##ConstructorToTable \
|
||||
( \
|
||||
const ::Foam::word& k, \
|
||||
const ::Foam::word& alias, \
|
||||
const int ver \
|
||||
) \
|
||||
{ \
|
||||
argNames##ConstructorCompatTable() \
|
||||
.set(alias, std::pair<::Foam::word,int>(k,ver)); \
|
||||
} \
|
||||
}; \
|
||||
\
|
||||
/* Helper to add constructor from argList to table */ \
|
||||
template<class baseType##Type> \
|
||||
struct add##argNames##ConstructorToTable \
|
||||
{ \
|
||||
static ptrWrapper<baseType> New argList \
|
||||
{ \
|
||||
return ptrWrapper<baseType>(new baseType##Type parList); \
|
||||
} \
|
||||
\
|
||||
explicit add##argNames##ConstructorToTable \
|
||||
( \
|
||||
const ::Foam::word& k = baseType##Type::typeName \
|
||||
) \
|
||||
{ \
|
||||
argNames##ConstructorTablePtr_construct(true); \
|
||||
if (!argNames##ConstructorTablePtr_->insert(k, New)) \
|
||||
{ \
|
||||
std::cerr \
|
||||
<< "Duplicate entry " << k << " in runtime table " \
|
||||
<< #baseType << std::endl; \
|
||||
::Foam::error::safePrintStack(std::cerr); \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
~add##argNames##ConstructorToTable() \
|
||||
{ \
|
||||
argNames##ConstructorTablePtr_construct(false); \
|
||||
} \
|
||||
\
|
||||
add##argNames##ConstructorToTable \
|
||||
(const add##argNames##ConstructorToTable&) = delete; \
|
||||
\
|
||||
void operator= \
|
||||
(const add##argNames##ConstructorToTable&) = delete; \
|
||||
}; \
|
||||
\
|
||||
/* Helper to add constructor from argList to table */ \
|
||||
/* Remove only the entry (not the table) upon destruction */ \
|
||||
template<class baseType##Type> \
|
||||
struct addRemovable##argNames##ConstructorToTable \
|
||||
{ \
|
||||
const ::Foam::word name; /* Lookup name for later removal */ \
|
||||
\
|
||||
static ptrWrapper<baseType> New argList \
|
||||
{ \
|
||||
return ptrWrapper<baseType>(new baseType##Type parList); \
|
||||
} \
|
||||
\
|
||||
explicit addRemovable##argNames##ConstructorToTable \
|
||||
( \
|
||||
const ::Foam::word& k = baseType##Type::typeName \
|
||||
) \
|
||||
: \
|
||||
name(k) \
|
||||
{ \
|
||||
argNames##ConstructorTablePtr_construct(true); \
|
||||
argNames##ConstructorTablePtr_->set(k, New); \
|
||||
} \
|
||||
\
|
||||
~addRemovable##argNames##ConstructorToTable() \
|
||||
{ \
|
||||
if (argNames##ConstructorTablePtr_) \
|
||||
{ \
|
||||
argNames##ConstructorTablePtr_->erase(name); \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
addRemovable##argNames##ConstructorToTable \
|
||||
(const addRemovable##argNames##ConstructorToTable&) = delete; \
|
||||
\
|
||||
void operator= \
|
||||
(const addRemovable##argNames##ConstructorToTable&) = delete; \
|
||||
};
|
||||
|
||||
|
||||
//- Declare a run-time selection for derived classes
|
||||
#define declareRunTimeNewSelectionTable\
|
||||
(ptrWrapper,baseType,argNames,argList,parList) \
|
||||
\
|
||||
declareRunTimeSelectionTableBase( \
|
||||
ptrWrapper<baseType>,argNames##Constructor,argList); \
|
||||
\
|
||||
/* Helper to add compatibility/alias for runtime selection table */ \
|
||||
template<class baseType##Type> \
|
||||
struct addAlias##argNames##ConstructorToTable \
|
||||
{ \
|
||||
explicit addAlias##argNames##ConstructorToTable \
|
||||
( \
|
||||
const ::Foam::word& k, \
|
||||
const ::Foam::word& alias, \
|
||||
const int ver \
|
||||
) \
|
||||
{ \
|
||||
argNames##ConstructorCompatTable() \
|
||||
.set(alias, std::pair<::Foam::word,int>(k,ver)); \
|
||||
} \
|
||||
}; \
|
||||
\
|
||||
/* Helper to add constructor from argList to table */ \
|
||||
template<class baseType##Type> \
|
||||
struct add##argNames##ConstructorToTable \
|
||||
{ \
|
||||
static ptrWrapper<baseType> New##baseType argList \
|
||||
{ \
|
||||
return ptrWrapper<baseType>(baseType##Type::New parList.ptr()); \
|
||||
} \
|
||||
\
|
||||
explicit add##argNames##ConstructorToTable \
|
||||
( \
|
||||
const ::Foam::word& k = baseType##Type::typeName \
|
||||
) \
|
||||
{ \
|
||||
argNames##ConstructorTablePtr_construct(true); \
|
||||
if (!argNames##ConstructorTablePtr_->insert(k, New##baseType)) \
|
||||
{ \
|
||||
std::cerr \
|
||||
<< "Duplicate entry " << k << " in runtime table " \
|
||||
<< #baseType << std::endl; \
|
||||
::Foam::error::safePrintStack(std::cerr); \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
~add##argNames##ConstructorToTable() \
|
||||
{ \
|
||||
argNames##ConstructorTablePtr_construct(false); \
|
||||
} \
|
||||
\
|
||||
add##argNames##ConstructorToTable \
|
||||
(const add##argNames##ConstructorToTable&) = delete; \
|
||||
\
|
||||
void operator= \
|
||||
(const add##argNames##ConstructorToTable&) = delete; \
|
||||
}; \
|
||||
\
|
||||
/* Helper to add constructor from argList to table */ \
|
||||
template<class baseType##Type> \
|
||||
struct addRemovable##argNames##ConstructorToTable \
|
||||
{ \
|
||||
const ::Foam::word name; /* Retain name for later removal */ \
|
||||
\
|
||||
static ptrWrapper<baseType> New##baseType argList \
|
||||
{ \
|
||||
return ptrWrapper<baseType>(baseType##Type::New parList.ptr()); \
|
||||
} \
|
||||
\
|
||||
explicit addRemovable##argNames##ConstructorToTable \
|
||||
( \
|
||||
const ::Foam::word& k = baseType##Type::typeName \
|
||||
) \
|
||||
: \
|
||||
name(k) \
|
||||
{ \
|
||||
argNames##ConstructorTablePtr_construct(true); \
|
||||
argNames##ConstructorTablePtr_->set(k, New##baseType); \
|
||||
} \
|
||||
\
|
||||
~addRemovable##argNames##ConstructorToTable() \
|
||||
{ \
|
||||
if (argNames##ConstructorTablePtr_) \
|
||||
{ \
|
||||
argNames##ConstructorTablePtr_->erase(name); \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
addRemovable##argNames##ConstructorToTable \
|
||||
(const addRemovable##argNames##ConstructorToTable&) = delete; \
|
||||
\
|
||||
void operator= \
|
||||
(const addRemovable##argNames##ConstructorToTable&) = delete; \
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
//
|
||||
// Definition Macros
|
||||
//
|
||||
|
||||
//- Define run-time selection table
|
||||
#define defineRunTimeSelectionTable(baseType,argNames) \
|
||||
\
|
||||
defineRunTimeSelectionTablePtr(baseType,argNames); \
|
||||
defineRunTimeSelectionTableConstructor(baseType,argNames); \
|
||||
defineRunTimeSelectionTableDestructor(baseType,argNames)
|
||||
defineRunTimeSelectionTableBase( \
|
||||
baseType,baseType::argNames##Constructor,)
|
||||
|
||||
|
||||
//- Define run-time selection table for template classes
|
||||
// use when baseType doesn't need a template argument (eg, is a typedef)
|
||||
#define defineTemplateRunTimeSelectionTable(baseType,argNames) \
|
||||
\
|
||||
template<> \
|
||||
defineRunTimeSelectionTablePtr(baseType,argNames); \
|
||||
template<> \
|
||||
defineRunTimeSelectionTableConstructor(baseType,argNames); \
|
||||
template<> \
|
||||
defineRunTimeSelectionTableDestructor(baseType,argNames)
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Constructor aid: use when baseType requires the Targ template argument
|
||||
#define defineTemplatedRunTimeSelectionTableConstructor(baseType,argNames,Targ)\
|
||||
\
|
||||
/* Table constructor called from the table add function */ \
|
||||
void baseType<Targ>::construct##argNames##ConstructorTables() \
|
||||
{ \
|
||||
static bool constructed = false; \
|
||||
if (!constructed) \
|
||||
{ \
|
||||
constructed = true; \
|
||||
baseType<Targ>::argNames##ConstructorTablePtr_ \
|
||||
= new baseType<Targ>::argNames##ConstructorTable; \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
// Destructor aid: use when baseType requires the Targ template argument
|
||||
#define defineTemplatedRunTimeSelectionTableDestructor(baseType,argNames,Targ) \
|
||||
\
|
||||
/* Table destructor called from the table add function destructor */ \
|
||||
void baseType<Targ>::destroy##argNames##ConstructorTables() \
|
||||
{ \
|
||||
if (baseType<Targ>::argNames##ConstructorTablePtr_) \
|
||||
{ \
|
||||
delete baseType<Targ>::argNames##ConstructorTablePtr_; \
|
||||
baseType<Targ>::argNames##ConstructorTablePtr_ = nullptr; \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
//- Create pointer to hash-table of functions
|
||||
// use when baseType requires the Targ template argument
|
||||
#define defineTemplatedRunTimeSelectionTablePtr(baseType,argNames,Targ) \
|
||||
\
|
||||
/* Define the constructor function table */ \
|
||||
baseType<Targ>::argNames##ConstructorTable* \
|
||||
baseType<Targ>::argNames##ConstructorTablePtr_(nullptr)
|
||||
defineRunTimeSelectionTableBase( \
|
||||
baseType,baseType::argNames##Constructor,template<>)
|
||||
|
||||
|
||||
//- Define run-time selection table for template classes
|
||||
// use when baseType requires the Targ template argument
|
||||
#define defineTemplatedRunTimeSelectionTable(baseType,argNames,Targ) \
|
||||
\
|
||||
template<> \
|
||||
defineTemplatedRunTimeSelectionTablePtr(baseType,argNames,Targ); \
|
||||
template<> \
|
||||
defineTemplatedRunTimeSelectionTableConstructor(baseType,argNames,Targ); \
|
||||
template<> \
|
||||
defineTemplatedRunTimeSelectionTableDestructor(baseType,argNames,Targ)
|
||||
defineRunTimeSelectionTableBase( \
|
||||
baseType,baseType<Targ>::argNames##Constructor,template<>)
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -29,6 +30,10 @@ InClass
|
||||
Description
|
||||
Macros for easy insertion into member function selection tables
|
||||
|
||||
Note
|
||||
The helper macro names used here must remain synchronized with
|
||||
definitions in memberFunctionSelectionTables.H
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef addToMemberFunctionSelectionTable_H
|
||||
@ -36,99 +41,103 @@ Description
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// add to hash-table of functions with typename as the key
|
||||
//- Add to hash-table of functions with typeName as the key.
|
||||
#define addToMemberFunctionSelectionTable\
|
||||
(baseType,thisType,memberFunction,argNames) \
|
||||
(baseType,thisType,funcName,argNames) \
|
||||
\
|
||||
/* Add the thisType memberFunction to the table */ \
|
||||
baseType::add##memberFunction##argNames##MemberFunctionToTable<thisType> \
|
||||
add##thisType##memberFunction##argNames##MemberFunctionTo##baseType##Table_
|
||||
/* Add thisType funcName to the table */ \
|
||||
baseType::add##funcName##argNames##MemberFunctionToTable<thisType> \
|
||||
add##thisType##funcName##argNames##MemberFunctionTo##baseType##Table_
|
||||
|
||||
|
||||
|
||||
// add to hash-table of functions with 'lookup' as the key
|
||||
//- Add to hash-table of functions with 'lookupName' as the key.
|
||||
#define addNamedToMemberFunctionSelectionTable\
|
||||
(baseType,thisType,memberFunction,argNames,lookup) \
|
||||
(baseType,thisType,funcName,argNames,lookupName) \
|
||||
\
|
||||
/* Add the thisType memberFunction to the table, find by lookup name */ \
|
||||
baseType::add##memberFunction##argNames##MemberFunctionToTable<thisType> \
|
||||
add_##lookup##_##thisType##memberFunction##argNames##MemberFunctionTo## \
|
||||
baseType##Table_(#lookup)
|
||||
/* Add thisType funcName to the table, find by lookup name */ \
|
||||
baseType::add##funcName##argNames##MemberFunctionToTable<thisType> \
|
||||
add##thisType##funcName##argNames##MemberFunctionTo## \
|
||||
baseType##Table_##lookupName##_(#lookupName)
|
||||
|
||||
|
||||
//- Add lookup alias for runTime member selection.
|
||||
#define addAliasToMemberFunctionSelectionTable\
|
||||
(baseType,thisType,funcName,argNames,lookup,other,ver) \
|
||||
\
|
||||
/* Add thisType funcName to the table, find by lookup name */ \
|
||||
baseType::addAlias##funcName##argNames##MemberFunctionToTable<thisType> \
|
||||
add##thisType##funcName##argNames##MemberFunctionTo##baseType##Table_ \
|
||||
##lookup##_##other##_(#lookup,#other,ver)
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// add to hash-table of functions with typename as the key
|
||||
// use when baseType doesn't need a template argument (eg, is a typedef)
|
||||
//- Add to hash-table of functions with typeName as the key.
|
||||
// Use when baseType doesn't need a template argument (eg, is a typedef)
|
||||
#define addTemplateToMemberFunctionSelectionTable\
|
||||
(baseType,thisType,Targ,memberFunction,argNames) \
|
||||
(baseType,thisType,Targ,funcName,argNames) \
|
||||
\
|
||||
/* Add the thisType memberFunction to the table */ \
|
||||
baseType::add##memberFunction##argNames## \
|
||||
MemberFunctionToTable<thisType<Targ>> \
|
||||
add##thisType##Targ##memberFunction##argNames##MemberFunctionTo## \
|
||||
/* Add thisType funcName to the table */ \
|
||||
baseType::add##funcName##argNames##MemberFunctionToTable<thisType<Targ>> \
|
||||
add##thisType##Targ##funcName##argNames##MemberFunctionTo## \
|
||||
baseType##Table_
|
||||
|
||||
|
||||
// add to hash-table of functions with 'lookup' as the key
|
||||
// use when baseType doesn't need a template argument (eg, is a typedef)
|
||||
//- Add to hash-table of functions with 'lookupName' as the key.
|
||||
// Use when baseType doesn't need a template argument (eg, is a typedef)
|
||||
#define addNamedTemplateToMemberFunctionSelectionTable\
|
||||
(baseType,thisType,Targ,memberFunction,argNames,lookup) \
|
||||
(baseType,thisType,Targ,funcName,argNames,lookupName) \
|
||||
\
|
||||
/* Add the thisType memberFunction to the table, find by lookup name */ \
|
||||
baseType::add##memberFunction##argNames## \
|
||||
MemberFunctionToTable<thisType<Targ>> \
|
||||
add_##lookup##_##thisType##Targ##memberFunction##argNames## \
|
||||
MemberFunctionTo##baseType##Table_(#lookup)
|
||||
/* Add thisType funcName to the table, find by lookupName */ \
|
||||
baseType::add##funcName##argNames##MemberFunctionToTable<thisType<Targ>> \
|
||||
add##thisType##Targ##funcName##argNames##MemberFunctionTo## \
|
||||
baseType##Table_##lookupName##_(#lookupName)
|
||||
|
||||
// use when baseType requires the Targ template argument as well
|
||||
#define addTemplatedToMemberFunctionSelectionTable\
|
||||
(baseType,thisType,Targ,memberFunction,argNames) \
|
||||
\
|
||||
/* Add the thisType memberFunction to the table */ \
|
||||
baseType<Targ>::add##memberFunction##argNames## \
|
||||
MemberFunctionToTable<thisType<Targ>> \
|
||||
add##thisType##Targ##memberFunction##argNames##MemberFunctionTo## \
|
||||
baseType##Targ##Table_
|
||||
|
||||
// use when baseType requires the Targ template argument as well
|
||||
#define addNamedTemplatedToMemberFunctionSelectionTable\
|
||||
(baseType,thisType,Targ,memberFunction,argNames,lookup) \
|
||||
//- Add lookup alias for runTime member selection.
|
||||
#define addAliasTemplateToMemberFunctionSelectionTable\
|
||||
(baseType,thisType,Targ,funcName,argNames,lookup,other,ver) \
|
||||
\
|
||||
/* Add the thisType memberFunction to the table, find by lookup name */ \
|
||||
baseType<Targ>::add##memberFunction##argNames## \
|
||||
MemberFunctionToTable<thisType<Targ>> \
|
||||
add_##lookup##_##thisType##Targ##memberFunction##argNames## \
|
||||
MemberFunctionTo##baseType##Targ##Table_(#lookup)
|
||||
/* Add thisType funcName to the table, find by lookup name */ \
|
||||
baseType::addAlias##funcName##argNames##MemberFunctionToTable \
|
||||
<thisType<Targ>> \
|
||||
add##thisType##Targ##funcName##argNames##MemberFunctionTo##baseType \
|
||||
##lookup##_##other##_(#lookup,#other,ver)
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// add to hash-table of functions with typename as the key
|
||||
// use when baseType requires the Targ template argument as well
|
||||
//- Add to hash-table of functions with typeName as the key.
|
||||
// Use when baseType requires the Targ template argument as well
|
||||
#define addTemplatedToMemberFunctionSelectionTable\
|
||||
(baseType,thisType,Targ,memberFunction,argNames) \
|
||||
(baseType,thisType,Targ,funcName,argNames) \
|
||||
\
|
||||
/* Add the thisType memberFunction to the table */ \
|
||||
baseType<Targ>::add##memberFunction##argNames## \
|
||||
MemberFunctionToTable<thisType<Targ>> \
|
||||
add##thisType##Targ##memberFunction##argNames##MemberFunctionTo## \
|
||||
/* Add thisType funcName to the table */ \
|
||||
baseType<Targ>::add##funcName##argNames##MemberFunctionToTable \
|
||||
<thisType<Targ>> \
|
||||
add##thisType##Targ##funcName##argNames##MemberFunctionTo## \
|
||||
baseType##Targ##Table_
|
||||
|
||||
|
||||
// add to hash-table of functions with 'lookup' as the key
|
||||
// use when baseType requires the Targ template argument as well
|
||||
//- Add to hash-table of functions with 'lookupName' as the key.
|
||||
// Use when baseType requires the Targ template argument as well
|
||||
#define addNamedTemplatedToMemberFunctionSelectionTable\
|
||||
(baseType,thisType,Targ,memberFunction,argNames,lookup) \
|
||||
(baseType,thisType,Targ,funcName,argNames,lookupName) \
|
||||
\
|
||||
/* Add the thisType memberFunction to the table, find by lookup name */ \
|
||||
baseType<Targ>::add##memberFunction##argNames## \
|
||||
MemberFunctionToTable<thisType<Targ>> \
|
||||
add_##lookup##_##thisType##Targ##memberFunction##argNames## \
|
||||
MemberFunctionTo##baseType##Targ##Table_(#lookup)
|
||||
/* Add thisType funcName to the table, find by lookupName */ \
|
||||
baseType<Targ>::add##funcName##argNames##MemberFunctionToTable \
|
||||
<thisType<Targ>> \
|
||||
add##thisType##Targ##funcName##argNames##MemberFunctionTo## \
|
||||
baseType##Targ##Table_##lookupName##_(#lookupName)
|
||||
|
||||
//- Add lookup alias for runTime member selection.
|
||||
#define addAliasTemplatedToMemberFunctionSelectionTable\
|
||||
(baseType,thisType,Targ,funcName,argNames,lookup,other,ver) \
|
||||
\
|
||||
/* Add thisType funcName to the table, find by lookup name */ \
|
||||
baseType<Targ>::addAlias##funcName##argNames##MemberFunctionToTable \
|
||||
<thisType<Targ>> \
|
||||
add##thisType##Targ##funcName##argNames##MemberFunctionTo##baseType## \
|
||||
Targ##Table_##lookup##_##other##_(#lookup,#other,ver)
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -25,206 +25,146 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Description
|
||||
Macros to enable the easy declaration of member function selection tables.
|
||||
Macros to ease declaration of member function selection tables.
|
||||
|
||||
Note
|
||||
Uses macros from runTimeSelectionTables.H
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "token.H"
|
||||
|
||||
#ifndef memberFunctionSelectionTables_H
|
||||
#define memberFunctionSelectionTables_H
|
||||
|
||||
#include "HashTable.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
//- Declare a run-time selection:
|
||||
#define declareMemberFunctionSelectionTable( \
|
||||
returnType,baseType,memberFunction,argNames,argList,parList) \
|
||||
//
|
||||
// Declaration Macros
|
||||
//
|
||||
|
||||
//- Declare a run-time member-function selection (variables and adder classes)
|
||||
#define declareMemberFunctionSelectionTable\
|
||||
(returnType,baseType,funcName,argNames,argList,parListUnused) \
|
||||
\
|
||||
/* Construct from argList function pointer type */ \
|
||||
typedef returnType (*memberFunction##argNames##MemberFunctionPtr)argList; \
|
||||
declareRunTimeSelectionTableBase( \
|
||||
returnType, funcName##argNames##MemberFunction, argList); \
|
||||
\
|
||||
/* Construct from argList function table type */ \
|
||||
typedef HashTable \
|
||||
< \
|
||||
memberFunction##argNames##MemberFunctionPtr, \
|
||||
::Foam::word, \
|
||||
::Foam::string::hasher \
|
||||
> memberFunction##argNames##MemberFunctionTable; \
|
||||
\
|
||||
/* Construct from argList function pointer table pointer */ \
|
||||
static memberFunction##argNames##MemberFunctionTable* \
|
||||
memberFunction##argNames##MemberFunctionTablePtr_; \
|
||||
\
|
||||
/* Class to add constructor from argList to table */ \
|
||||
/* Helper to add funcName to table */ \
|
||||
template<class baseType##Type> \
|
||||
class add##memberFunction##argNames##MemberFunctionToTable \
|
||||
struct add##funcName##argNames##MemberFunctionToTable \
|
||||
{ \
|
||||
public: \
|
||||
\
|
||||
explicit add##memberFunction##argNames##MemberFunctionToTable \
|
||||
explicit add##funcName##argNames##MemberFunctionToTable \
|
||||
( \
|
||||
const ::Foam::word& lookup = baseType##Type::typeName \
|
||||
const ::Foam::word& k = baseType##Type::typeName \
|
||||
) \
|
||||
{ \
|
||||
construct##memberFunction##argNames##MemberFunctionTables(); \
|
||||
memberFunction##argNames##MemberFunctionTablePtr_->insert \
|
||||
funcName##argNames##MemberFunctionTablePtr_construct(true); \
|
||||
if \
|
||||
( \
|
||||
lookup, \
|
||||
baseType##Type::memberFunction \
|
||||
); \
|
||||
!funcName##argNames##MemberFunctionTablePtr_ \
|
||||
->insert(k, baseType##Type::funcName) \
|
||||
) \
|
||||
{ \
|
||||
std::cerr \
|
||||
<< "Duplicate entry " << k << " in member table " \
|
||||
<< #baseType << std::endl; \
|
||||
::Foam::error::safePrintStack(std::cerr); \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
~add##memberFunction##argNames##MemberFunctionToTable() \
|
||||
~add##funcName##argNames##MemberFunctionToTable() \
|
||||
{ \
|
||||
destroy##memberFunction##argNames##MemberFunctionTables(); \
|
||||
funcName##argNames##MemberFunctionTablePtr_construct(false); \
|
||||
} \
|
||||
\
|
||||
add##funcName##argNames##MemberFunctionToTable \
|
||||
(const add##funcName##argNames##MemberFunctionToTable&) \
|
||||
= delete; \
|
||||
void operator= \
|
||||
(const add##funcName##argNames##MemberFunctionToTable&) \
|
||||
= delete; \
|
||||
}; \
|
||||
\
|
||||
/* Table memberFunction called from the table add function */ \
|
||||
static void construct##memberFunction##argNames##MemberFunctionTables(); \
|
||||
\
|
||||
/* Table destructor called from the table add function destructor */ \
|
||||
static void destroy##memberFunction##argNames##MemberFunctionTables()
|
||||
|
||||
|
||||
// Constructor aid
|
||||
#define defineMemberFunctionSelectionTableMemberFunction( \
|
||||
baseType,memberFunction,argNames) \
|
||||
\
|
||||
/* Table memberFunction called from the table add function */ \
|
||||
void baseType::construct##memberFunction##argNames##MemberFunctionTables() \
|
||||
/* Helper to add funcName to table */ \
|
||||
template<class baseType##Type> \
|
||||
struct addRemovable##funcName##argNames##MemberFunctionToTable \
|
||||
{ \
|
||||
static bool constructed = false; \
|
||||
if (!constructed) \
|
||||
const ::Foam::word name; /* Retain name for later removal */ \
|
||||
\
|
||||
explicit addRemovable##funcName##argNames##MemberFunctionToTable \
|
||||
( \
|
||||
const ::Foam::word& k = baseType##Type::typeName \
|
||||
) \
|
||||
: \
|
||||
name(k) \
|
||||
{ \
|
||||
constructed = true; \
|
||||
baseType::memberFunction##argNames##MemberFunctionTablePtr_ \
|
||||
= new baseType::memberFunction##argNames##MemberFunctionTable; \
|
||||
funcName##argNames##MemberFunctionTablePtr_construct(true); \
|
||||
funcName##argNames##MemberFunctionTablePtr_ \
|
||||
->set(k, baseType##Type::funcName); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
// Destructor aid
|
||||
#define defineMemberFunctionSelectionTableDestructor( \
|
||||
baseType,memberFunction,argNames) \
|
||||
\
|
||||
/* Table destructor called from the table add function destructor */ \
|
||||
void baseType::destroy##memberFunction##argNames##MemberFunctionTables() \
|
||||
~addRemovable##funcName##argNames##MemberFunctionToTable() \
|
||||
{ \
|
||||
if (baseType::memberFunction##argNames##MemberFunctionTablePtr_) \
|
||||
if (funcName##argNames##MemberFunctionTablePtr_) \
|
||||
{ \
|
||||
delete baseType::memberFunction##argNames## \
|
||||
MemberFunctionTablePtr_; \
|
||||
baseType::memberFunction##argNames## \
|
||||
MemberFunctionTablePtr_ = nullptr; \
|
||||
funcName##argNames##MemberFunctionTablePtr_->erase(name); \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
// Create pointer to hash-table of functions
|
||||
#define defineMemberFunctionSelectionTablePtr(baseType,memberFunction,argNames)\
|
||||
\
|
||||
/* Define the memberFunction table */ \
|
||||
baseType::memberFunction##argNames##MemberFunctionTable* \
|
||||
baseType::memberFunction##argNames##MemberFunctionTablePtr_(nullptr)
|
||||
addRemovable##funcName##argNames##MemberFunctionToTable \
|
||||
(const addRemovable##funcName##argNames##MemberFunctionToTable&) \
|
||||
= delete; \
|
||||
void operator= \
|
||||
(const addRemovable##funcName##argNames##MemberFunctionToTable&) \
|
||||
= delete; \
|
||||
}; \
|
||||
\
|
||||
/* Helper to add alias for funcName to table */ \
|
||||
template<class baseType##Type> \
|
||||
struct addAlias##funcName##argNames##MemberFunctionToTable \
|
||||
{ \
|
||||
explicit addAlias##funcName##argNames##MemberFunctionToTable \
|
||||
( \
|
||||
const ::Foam::word& k, \
|
||||
const ::Foam::word& alias, \
|
||||
const int ver \
|
||||
) \
|
||||
{ \
|
||||
funcName##argNames##MemberFunctionCompatTable() \
|
||||
.set(alias, std::pair<::Foam::word,int>(k,ver)); \
|
||||
} \
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
//
|
||||
// Definition Macros
|
||||
//
|
||||
|
||||
//- Define run-time selection table
|
||||
#define defineMemberFunctionSelectionTable(baseType,memberFunction,argNames) \
|
||||
#define defineMemberFunctionSelectionTable(baseType,funcName,argNames) \
|
||||
\
|
||||
defineMemberFunctionSelectionTablePtr \
|
||||
(baseType,memberFunction,argNames); \
|
||||
defineMemberFunctionSelectionTableMemberFunction \
|
||||
(baseType,memberFunction,argNames) \
|
||||
defineMemberFunctionSelectionTableDestructor \
|
||||
(baseType,memberFunction,argNames)
|
||||
defineRunTimeSelectionTableBase( \
|
||||
baseType,baseType::funcName##argNames##MemberFunction,)
|
||||
|
||||
|
||||
//- Define run-time selection table for template classes
|
||||
// use when baseType doesn't need a template argument (eg, is a typedef)
|
||||
#define defineTemplateMemberFunctionSelectionTable( \
|
||||
baseType,memberFunction,argNames) \
|
||||
#define defineTemplateMemberFunctionSelectionTable(baseType,funcName,argNames) \
|
||||
\
|
||||
template<> \
|
||||
defineMemberFunctionSelectionTablePtr \
|
||||
(baseType,memberFunction,argNames); \
|
||||
template<> \
|
||||
defineMemberFunctionSelectionTableMemberFunction \
|
||||
(baseType,memberFunction,argNames) \
|
||||
template<> \
|
||||
defineMemberFunctionSelectionTableDestructor \
|
||||
(baseType,memberFunction,argNames)
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Constructor aid: use when baseType requires the Targ template argument
|
||||
#define defineTemplatedMemberFunctionSelectionTableMemberFunction( \
|
||||
baseType,memberFunction,argNames,Targ) \
|
||||
\
|
||||
/* Table memberFunction called from the table add function */ \
|
||||
void baseType<Targ>::construct##memberFunction##argNames## \
|
||||
MemberFunctionTables() \
|
||||
{ \
|
||||
static bool constructed = false; \
|
||||
if (!constructed) \
|
||||
{ \
|
||||
constructed = true; \
|
||||
baseType<Targ>::memberFunction##argNames##MemberFunctionTablePtr_ \
|
||||
= new baseType<Targ>::memberFunction##argNames## \
|
||||
MemberFunctionTable; \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
// Destructor aid
|
||||
// use when baseType requires the Targ template argument
|
||||
#define defineTemplatedMemberFunctionSelectionTableDestructor( \
|
||||
baseType,memberFunction,argNames,Targ) \
|
||||
\
|
||||
/* Table destructor called from the table add function destructor */ \
|
||||
void baseType<Targ>::destroy##memberFunction##argNames## \
|
||||
MemberFunctionTables() \
|
||||
{ \
|
||||
if (baseType<Targ>::memberFunction##argNames##MemberFunctionTablePtr_) \
|
||||
{ \
|
||||
delete baseType<Targ>::memberFunction##argNames## \
|
||||
MemberFunctionTablePtr_; \
|
||||
baseType<Targ>::memberFunction##argNames## \
|
||||
MemberFunctionTablePtr_ = nullptr; \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
// Create pointer to hash-table of functions
|
||||
// use when baseType requires the Targ template argument
|
||||
#define defineTemplatedMemberFunctionSelectionTablePtr( \
|
||||
baseType,memberFunction,argNames,Targ) \
|
||||
\
|
||||
/* Define the memberFunction table */ \
|
||||
baseType<Targ>::memberFunction##argNames##MemberFunctionTable* \
|
||||
baseType<Targ>::memberFunction##argNames## \
|
||||
MemberFunctionTablePtr_(nullptr)
|
||||
defineRunTimeSelectionTableBase( \
|
||||
baseType,baseType::funcName##argNames##MemberFunction,template<>)
|
||||
|
||||
|
||||
//- Define run-time selection table for template classes
|
||||
// use when baseType requires the Targ template argument
|
||||
#define defineTemplatedMemberFunctionSelectionTable( \
|
||||
baseType,memberFunction,argNames,Targ) \
|
||||
#define defineTemplatedMemberFunctionSelectionTable\
|
||||
(baseType,funcName,argNames,Targ) \
|
||||
\
|
||||
template<> \
|
||||
defineTemplatedMemberFunctionSelectionTablePtr \
|
||||
(baseType,memberFunction,argNames,Targ); \
|
||||
template<> \
|
||||
defineTemplatedMemberFunctionSelectionTableMemberFunction \
|
||||
(baseType,memberFunction,argNames,Targ) \
|
||||
template<> \
|
||||
defineTemplatedMemberFunctionSelectionTableDestructor \
|
||||
(baseType,memberFunction,argNames,Targ)
|
||||
defineRunTimeSelectionTableBase( \
|
||||
baseType,baseType<Targ>::funcName##argNames##MemberFunction,template<>)
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Original code Copyright (C) 2014-2018 Bernhard Gschaider
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -119,9 +119,9 @@ Foam::exprTools::expressionEntry::New
|
||||
const word& name
|
||||
)
|
||||
{
|
||||
auto cstrIter = emptyConstructorTablePtr_->cfind(name);
|
||||
auto* ctorPtr = emptyConstructorTable(name);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalErrorInLookup
|
||||
(
|
||||
@ -131,7 +131,7 @@ Foam::exprTools::expressionEntry::New
|
||||
) << exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<expressionEntry>(cstrIter()());
|
||||
return autoPtr<expressionEntry>(ctorPtr());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -314,9 +314,9 @@ Foam::expressions::exprResult::New
|
||||
|
||||
if (dict.getOrDefault("unsetValue", false))
|
||||
{
|
||||
auto cstrIter = emptyConstructorTablePtr_->cfind(resultType);
|
||||
auto* ctorPtr = emptyConstructorTable(resultType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -330,13 +330,13 @@ Foam::expressions::exprResult::New
|
||||
DebugInfo
|
||||
<< "Creating unset result of type " << resultType << nl;
|
||||
|
||||
return autoPtr<exprResult>(cstrIter()());
|
||||
return autoPtr<exprResult>(ctorPtr());
|
||||
}
|
||||
|
||||
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(resultType);
|
||||
auto* ctorPtr = dictionaryConstructorTable(resultType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -350,7 +350,7 @@ Foam::expressions::exprResult::New
|
||||
DebugInfo
|
||||
<< "Creating result of type " << resultType << nl;
|
||||
|
||||
return autoPtr<exprResult>(cstrIter()(dict));
|
||||
return autoPtr<exprResult>(ctorPtr(dict));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -93,14 +94,13 @@ Foam::pointPatchField<Type>::NewCalculatedType
|
||||
const pointPatchField<Type2>& pf
|
||||
)
|
||||
{
|
||||
auto patchTypeCstrIter =
|
||||
pointPatchConstructorTablePtr_->cfind(pf.patch().type());
|
||||
auto* patchTypeCtor = pointPatchConstructorTable(pf.patch().type());
|
||||
|
||||
if (patchTypeCstrIter.found())
|
||||
if (patchTypeCtor)
|
||||
{
|
||||
return autoPtr<pointPatchField<Type>>
|
||||
(
|
||||
patchTypeCstrIter()
|
||||
patchTypeCtor
|
||||
(
|
||||
pf.patch(),
|
||||
Field<Type>::null()
|
||||
|
||||
@ -39,9 +39,9 @@ Foam::autoPtr<Foam::pointPatchField<Type>> Foam::pointPatchField<Type>::New
|
||||
{
|
||||
DebugInFunction << "Constructing pointPatchField<Type>" << endl;
|
||||
|
||||
auto cstrIter = pointPatchConstructorTablePtr_->cfind(patchFieldType);
|
||||
auto* ctorPtr = pointPatchConstructorTable(patchFieldType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalErrorInLookup
|
||||
(
|
||||
@ -51,7 +51,7 @@ Foam::autoPtr<Foam::pointPatchField<Type>> Foam::pointPatchField<Type>::New
|
||||
) << exit(FatalError);
|
||||
}
|
||||
|
||||
autoPtr<pointPatchField<Type>> pfPtr(cstrIter()(p, iF));
|
||||
autoPtr<pointPatchField<Type>> pfPtr(ctorPtr(p, iF));
|
||||
|
||||
if
|
||||
(
|
||||
@ -64,10 +64,9 @@ Foam::autoPtr<Foam::pointPatchField<Type>> Foam::pointPatchField<Type>::New
|
||||
// Incompatible (constraint-wise) with the patch type
|
||||
// - use default constraint type
|
||||
|
||||
auto patchTypeCstrIter =
|
||||
pointPatchConstructorTablePtr_->cfind(p.type());
|
||||
auto* patchTypeCtor = pointPatchConstructorTable(p.type());
|
||||
|
||||
if (!patchTypeCstrIter.found())
|
||||
if (!patchTypeCtor)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Inconsistent patch and patchField types for\n"
|
||||
@ -76,7 +75,7 @@ Foam::autoPtr<Foam::pointPatchField<Type>> Foam::pointPatchField<Type>::New
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return patchTypeCstrIter()(p, iF);
|
||||
return patchTypeCtor(p, iF);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -115,16 +114,16 @@ Foam::autoPtr<Foam::pointPatchField<Type>> Foam::pointPatchField<Type>::New
|
||||
|
||||
const word patchFieldType(dict.get<word>("type"));
|
||||
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(patchFieldType);
|
||||
auto* ctorPtr = dictionaryConstructorTable(patchFieldType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
if (!disallowGenericPointPatchField)
|
||||
{
|
||||
cstrIter = dictionaryConstructorTablePtr_->cfind("generic");
|
||||
ctorPtr = dictionaryConstructorTable("generic");
|
||||
}
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInFunction(dict)
|
||||
<< "Unknown patchField type " << patchFieldType
|
||||
@ -136,7 +135,7 @@ Foam::autoPtr<Foam::pointPatchField<Type>> Foam::pointPatchField<Type>::New
|
||||
}
|
||||
|
||||
// Construct (but not necessarily returned)
|
||||
autoPtr<pointPatchField<Type>> pfPtr(cstrIter()(p, iF, dict));
|
||||
autoPtr<pointPatchField<Type>> pfPtr(ctorPtr(p, iF, dict));
|
||||
|
||||
if
|
||||
(
|
||||
@ -149,10 +148,9 @@ Foam::autoPtr<Foam::pointPatchField<Type>> Foam::pointPatchField<Type>::New
|
||||
// Incompatible (constraint-wise) with the patch type
|
||||
// - use default constraint type
|
||||
|
||||
auto patchTypeCstrIter =
|
||||
dictionaryConstructorTablePtr_->cfind(p.type());
|
||||
auto* patchTypeCtor = dictionaryConstructorTable(p.type());
|
||||
|
||||
if (!patchTypeCstrIter.found())
|
||||
if (!patchTypeCtor)
|
||||
{
|
||||
FatalIOErrorInFunction(dict)
|
||||
<< "Inconsistent patch and patchField types for\n"
|
||||
@ -161,7 +159,7 @@ Foam::autoPtr<Foam::pointPatchField<Type>> Foam::pointPatchField<Type>::New
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
return patchTypeCstrIter()(p, iF, dict);
|
||||
return patchTypeCtor(p, iF, dict);
|
||||
}
|
||||
}
|
||||
|
||||
@ -180,9 +178,9 @@ Foam::autoPtr<Foam::pointPatchField<Type>> Foam::pointPatchField<Type>::New
|
||||
{
|
||||
DebugInFunction << "Constructing pointPatchField<Type>" << endl;
|
||||
|
||||
auto cstrIter = patchMapperConstructorTablePtr_->cfind(ptf.type());
|
||||
auto* ctorPtr = patchMapperConstructorTable(ptf.type());
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalErrorInLookup
|
||||
(
|
||||
@ -192,7 +190,7 @@ Foam::autoPtr<Foam::pointPatchField<Type>> Foam::pointPatchField<Type>::New
|
||||
) << exit(FatalError);
|
||||
}
|
||||
|
||||
return cstrIter()(ptf, p, iF, pfMapper);
|
||||
return ctorPtr(ptf, p, iF, pfMapper);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -571,6 +571,7 @@ Foam::word Foam::argList::optionCompat(const word& optName)
|
||||
{
|
||||
const auto& alt = fnd.val();
|
||||
|
||||
// No error::master() guard - only called on master anyhow
|
||||
if (error::warnAboutAge(alt.second))
|
||||
{
|
||||
std::cerr
|
||||
@ -609,6 +610,7 @@ int Foam::argList::optionIgnore(const word& optName)
|
||||
// '-option ARG' or '-option'
|
||||
const int nskip = (alt.first ? 2 : 1);
|
||||
|
||||
// No error::master() guard - only called on master anyhow
|
||||
if (error::warnAboutAge(alt.second))
|
||||
{
|
||||
std::cerr
|
||||
|
||||
@ -711,9 +711,9 @@ Foam::fileOperation::New
|
||||
DebugInFunction
|
||||
<< "Constructing fileHandler" << endl;
|
||||
|
||||
auto cstrIter = wordConstructorTablePtr_->cfind(handlerType);
|
||||
auto* ctorPtr = wordConstructorTable(handlerType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalErrorInLookup
|
||||
(
|
||||
@ -723,7 +723,7 @@ Foam::fileOperation::New
|
||||
) << abort(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<fileOperation>(cstrIter()(verbose));
|
||||
return autoPtr<fileOperation>(ctorPtr(verbose));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -85,9 +85,9 @@ Foam::fileOperations::fileOperationInitialise::New
|
||||
{
|
||||
DebugInFunction << "Constructing fileOperationInitialise" << endl;
|
||||
|
||||
auto cstrIter = wordConstructorTablePtr_->cfind(type);
|
||||
auto* ctorPtr = wordConstructorTable(type);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalErrorInLookup
|
||||
(
|
||||
@ -97,7 +97,7 @@ Foam::fileOperations::fileOperationInitialise::New
|
||||
) << abort(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<fileOperationInitialise>(cstrIter()(argc, argv));
|
||||
return autoPtr<fileOperationInitialise>(ctorPtr(argc, argv));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -219,9 +219,9 @@ Foam::autoPtr<Foam::graph::writer> Foam::graph::writer::New
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
auto cstrIter = wordConstructorTablePtr_->cfind(graphFormat);
|
||||
auto* ctorPtr = wordConstructorTable(graphFormat);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalErrorInLookup
|
||||
(
|
||||
@ -231,7 +231,7 @@ Foam::autoPtr<Foam::graph::writer> Foam::graph::writer::New
|
||||
) << exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<graph::writer>(cstrIter()());
|
||||
return autoPtr<graph::writer>(ctorPtr());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -42,9 +42,9 @@ Foam::autoPtr<Foam::tableReader<Type>> Foam::tableReader<Type>::New
|
||||
"openFoam"
|
||||
);
|
||||
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(readerType);
|
||||
auto* ctorPtr = dictionaryConstructorTable(readerType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -55,7 +55,7 @@ Foam::autoPtr<Foam::tableReader<Type>> Foam::tableReader<Type>::New
|
||||
) << exit(FatalIOError);
|
||||
}
|
||||
|
||||
return autoPtr<tableReader<Type>>(cstrIter()(spec));
|
||||
return autoPtr<tableReader<Type>>(ctorPtr(spec));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2012-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -57,9 +57,9 @@ Foam::autoPtr<Foam::interpolationWeights> Foam::interpolationWeights::New
|
||||
{
|
||||
DebugInFunction << "Selecting interpolationWeights " << type << endl;
|
||||
|
||||
auto cstrIter = wordConstructorTablePtr_->cfind(type);
|
||||
auto* ctorPtr = wordConstructorTable(type);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalErrorInLookup
|
||||
(
|
||||
@ -69,7 +69,7 @@ Foam::autoPtr<Foam::interpolationWeights> Foam::interpolationWeights::New
|
||||
) << exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<interpolationWeights>(cstrIter()(samples));
|
||||
return autoPtr<interpolationWeights>(ctorPtr(samples));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -45,10 +45,9 @@ Foam::LduMatrix<Type, DType, LUType>::preconditioner::New
|
||||
|
||||
if (sol.matrix().symmetric())
|
||||
{
|
||||
auto cstrIter =
|
||||
symMatrixConstructorTablePtr_->cfind(preconditionerName);
|
||||
auto* ctorPtr = symMatrixConstructorTable(preconditionerName);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -61,7 +60,7 @@ Foam::LduMatrix<Type, DType, LUType>::preconditioner::New
|
||||
|
||||
return autoPtr<typename LduMatrix<Type, DType, LUType>::preconditioner>
|
||||
(
|
||||
cstrIter()
|
||||
ctorPtr
|
||||
(
|
||||
sol,
|
||||
preconditionerDict
|
||||
@ -70,10 +69,9 @@ Foam::LduMatrix<Type, DType, LUType>::preconditioner::New
|
||||
}
|
||||
else if (sol.matrix().asymmetric())
|
||||
{
|
||||
auto cstrIter =
|
||||
asymMatrixConstructorTablePtr_->cfind(preconditionerName);
|
||||
auto* ctorPtr = asymMatrixConstructorTable(preconditionerName);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -86,7 +84,7 @@ Foam::LduMatrix<Type, DType, LUType>::preconditioner::New
|
||||
|
||||
return autoPtr<typename LduMatrix<Type, DType, LUType>::preconditioner>
|
||||
(
|
||||
cstrIter()
|
||||
ctorPtr
|
||||
(
|
||||
sol,
|
||||
preconditionerDict
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -43,9 +43,9 @@ Foam::LduMatrix<Type, DType, LUType>::smoother::New
|
||||
|
||||
if (matrix.symmetric())
|
||||
{
|
||||
auto cstrIter = symMatrixConstructorTablePtr_->cfind(smootherName);
|
||||
auto* ctorPtr = symMatrixConstructorTable(smootherName);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -58,7 +58,7 @@ Foam::LduMatrix<Type, DType, LUType>::smoother::New
|
||||
|
||||
return autoPtr<typename LduMatrix<Type, DType, LUType>::smoother>
|
||||
(
|
||||
cstrIter()
|
||||
ctorPtr
|
||||
(
|
||||
fieldName,
|
||||
matrix
|
||||
@ -67,9 +67,9 @@ Foam::LduMatrix<Type, DType, LUType>::smoother::New
|
||||
}
|
||||
else if (matrix.asymmetric())
|
||||
{
|
||||
auto cstrIter = asymMatrixConstructorTablePtr_->cfind(smootherName);
|
||||
auto* ctorPtr = asymMatrixConstructorTable(smootherName);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -82,7 +82,7 @@ Foam::LduMatrix<Type, DType, LUType>::smoother::New
|
||||
|
||||
return autoPtr<typename LduMatrix<Type, DType, LUType>::smoother>
|
||||
(
|
||||
cstrIter()
|
||||
ctorPtr
|
||||
(
|
||||
fieldName,
|
||||
matrix
|
||||
|
||||
@ -56,9 +56,9 @@ Foam::LduMatrix<Type, DType, LUType>::solver::New
|
||||
}
|
||||
else if (matrix.symmetric())
|
||||
{
|
||||
auto cstrIter = symMatrixConstructorTablePtr_->cfind(solverName);
|
||||
auto* ctorPtr = symMatrixConstructorTable(solverName);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -71,7 +71,7 @@ Foam::LduMatrix<Type, DType, LUType>::solver::New
|
||||
|
||||
return autoPtr<typename LduMatrix<Type, DType, LUType>::solver>
|
||||
(
|
||||
cstrIter()
|
||||
ctorPtr
|
||||
(
|
||||
fieldName,
|
||||
matrix,
|
||||
@ -81,9 +81,9 @@ Foam::LduMatrix<Type, DType, LUType>::solver::New
|
||||
}
|
||||
else if (matrix.asymmetric())
|
||||
{
|
||||
auto cstrIter = asymMatrixConstructorTablePtr_->cfind(solverName);
|
||||
auto* ctorPtr = asymMatrixConstructorTable(solverName);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -96,7 +96,7 @@ Foam::LduMatrix<Type, DType, LUType>::solver::New
|
||||
|
||||
return autoPtr<typename LduMatrix<Type, DType, LUType>::solver>
|
||||
(
|
||||
cstrIter()
|
||||
ctorPtr
|
||||
(
|
||||
fieldName,
|
||||
matrix,
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -90,9 +90,9 @@ Foam::lduMatrix::preconditioner::New
|
||||
|
||||
if (sol.matrix().symmetric())
|
||||
{
|
||||
auto cstrIter = symMatrixConstructorTablePtr_->cfind(name);
|
||||
auto* ctorPtr = symMatrixConstructorTable(name);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -105,7 +105,7 @@ Foam::lduMatrix::preconditioner::New
|
||||
|
||||
return autoPtr<lduMatrix::preconditioner>
|
||||
(
|
||||
cstrIter()
|
||||
ctorPtr
|
||||
(
|
||||
sol,
|
||||
controls
|
||||
@ -114,9 +114,9 @@ Foam::lduMatrix::preconditioner::New
|
||||
}
|
||||
else if (sol.matrix().asymmetric())
|
||||
{
|
||||
auto cstrIter = asymMatrixConstructorTablePtr_->cfind(name);
|
||||
auto* ctorPtr = asymMatrixConstructorTable(name);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -129,7 +129,7 @@ Foam::lduMatrix::preconditioner::New
|
||||
|
||||
return autoPtr<lduMatrix::preconditioner>
|
||||
(
|
||||
cstrIter()
|
||||
ctorPtr
|
||||
(
|
||||
sol,
|
||||
controls
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -93,9 +93,9 @@ Foam::autoPtr<Foam::lduMatrix::smoother> Foam::lduMatrix::smoother::New
|
||||
|
||||
if (matrix.symmetric())
|
||||
{
|
||||
auto cstrIter = symMatrixConstructorTablePtr_->cfind(name);
|
||||
auto* ctorPtr = symMatrixConstructorTable(name);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -108,7 +108,7 @@ Foam::autoPtr<Foam::lduMatrix::smoother> Foam::lduMatrix::smoother::New
|
||||
|
||||
return autoPtr<lduMatrix::smoother>
|
||||
(
|
||||
cstrIter()
|
||||
ctorPtr
|
||||
(
|
||||
fieldName,
|
||||
matrix,
|
||||
@ -120,9 +120,9 @@ Foam::autoPtr<Foam::lduMatrix::smoother> Foam::lduMatrix::smoother::New
|
||||
}
|
||||
else if (matrix.asymmetric())
|
||||
{
|
||||
auto cstrIter = asymMatrixConstructorTablePtr_->cfind(name);
|
||||
auto* ctorPtr = asymMatrixConstructorTable(name);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -135,7 +135,7 @@ Foam::autoPtr<Foam::lduMatrix::smoother> Foam::lduMatrix::smoother::New
|
||||
|
||||
return autoPtr<lduMatrix::smoother>
|
||||
(
|
||||
cstrIter()
|
||||
ctorPtr
|
||||
(
|
||||
fieldName,
|
||||
matrix,
|
||||
|
||||
@ -70,9 +70,9 @@ Foam::autoPtr<Foam::lduMatrix::solver> Foam::lduMatrix::solver::New
|
||||
}
|
||||
else if (matrix.symmetric())
|
||||
{
|
||||
auto cstrIter = symMatrixConstructorTablePtr_->cfind(name);
|
||||
auto* ctorPtr = symMatrixConstructorTable(name);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -85,7 +85,7 @@ Foam::autoPtr<Foam::lduMatrix::solver> Foam::lduMatrix::solver::New
|
||||
|
||||
return autoPtr<lduMatrix::solver>
|
||||
(
|
||||
cstrIter()
|
||||
ctorPtr
|
||||
(
|
||||
fieldName,
|
||||
matrix,
|
||||
@ -98,9 +98,9 @@ Foam::autoPtr<Foam::lduMatrix::solver> Foam::lduMatrix::solver::New
|
||||
}
|
||||
else if (matrix.asymmetric())
|
||||
{
|
||||
auto cstrIter = asymMatrixConstructorTablePtr_->cfind(name);
|
||||
auto* ctorPtr = asymMatrixConstructorTable(name);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -113,7 +113,7 @@ Foam::autoPtr<Foam::lduMatrix::solver> Foam::lduMatrix::solver::New
|
||||
|
||||
return autoPtr<lduMatrix::solver>
|
||||
(
|
||||
cstrIter()
|
||||
ctorPtr
|
||||
(
|
||||
fieldName,
|
||||
matrix,
|
||||
|
||||
@ -319,9 +319,9 @@ const Foam::GAMGAgglomeration& Foam::GAMGAgglomeration::New
|
||||
lduMeshConstructorTablePtr_
|
||||
);
|
||||
|
||||
auto cstrIter = lduMeshConstructorTablePtr_->cfind(agglomeratorType);
|
||||
auto* ctorPtr = lduMeshConstructorTable(agglomeratorType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown GAMGAgglomeration type "
|
||||
@ -333,7 +333,7 @@ const Foam::GAMGAgglomeration& Foam::GAMGAgglomeration::New
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return store(cstrIter()(mesh, controlDict).ptr());
|
||||
return store(ctorPtr(mesh, controlDict).ptr());
|
||||
}
|
||||
}
|
||||
|
||||
@ -370,20 +370,15 @@ const Foam::GAMGAgglomeration& Foam::GAMGAgglomeration::New
|
||||
lduMatrixConstructorTablePtr_
|
||||
);
|
||||
|
||||
if
|
||||
(
|
||||
!lduMatrixConstructorTablePtr_
|
||||
|| !lduMatrixConstructorTablePtr_->found(agglomeratorType)
|
||||
)
|
||||
auto* ctorPtr = lduMatrixConstructorTable(agglomeratorType);
|
||||
|
||||
if (!ctorPtr)
|
||||
{
|
||||
return New(mesh, controlDict);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto cstrIter =
|
||||
lduMatrixConstructorTablePtr_->cfind(agglomeratorType);
|
||||
|
||||
return store(cstrIter()(matrix, controlDict).ptr());
|
||||
return store(ctorPtr(matrix, controlDict).ptr());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -422,9 +417,9 @@ const Foam::GAMGAgglomeration& Foam::GAMGAgglomeration::New
|
||||
geometryConstructorTablePtr_
|
||||
);
|
||||
|
||||
auto cstrIter = geometryConstructorTablePtr_->cfind(agglomeratorType);
|
||||
auto* ctorPtr = geometryConstructorTable(agglomeratorType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown GAMGAgglomeration type "
|
||||
@ -436,7 +431,7 @@ const Foam::GAMGAgglomeration& Foam::GAMGAgglomeration::New
|
||||
|
||||
return store
|
||||
(
|
||||
cstrIter()
|
||||
ctorPtr
|
||||
(
|
||||
mesh,
|
||||
cellVolumes,
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2013-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -364,9 +365,9 @@ Foam::autoPtr<Foam::GAMGProcAgglomeration> Foam::GAMGProcAgglomeration::New
|
||||
{
|
||||
DebugInFunction << "Constructing GAMGProcAgglomeration" << endl;
|
||||
|
||||
auto cstrIter = GAMGAgglomerationConstructorTablePtr_->cfind(type);
|
||||
auto* ctorPtr = GAMGAgglomerationConstructorTable(type);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown GAMGProcAgglomeration type "
|
||||
@ -376,7 +377,7 @@ Foam::autoPtr<Foam::GAMGProcAgglomeration> Foam::GAMGProcAgglomeration::New
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<GAMGProcAgglomeration>(cstrIter()(agglom, controlDict));
|
||||
return autoPtr<GAMGProcAgglomeration>(ctorPtr(agglom, controlDict));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -38,9 +38,9 @@ Foam::autoPtr<Foam::GAMGInterfaceField> Foam::GAMGInterfaceField::New
|
||||
{
|
||||
const word coupleType(fineInterface.interfaceFieldType());
|
||||
|
||||
auto cstrIter = lduInterfaceFieldConstructorTablePtr_->cfind(coupleType);
|
||||
auto* ctorPtr = lduInterfaceFieldConstructorTable(coupleType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalErrorInLookup
|
||||
(
|
||||
@ -50,7 +50,7 @@ Foam::autoPtr<Foam::GAMGInterfaceField> Foam::GAMGInterfaceField::New
|
||||
) << exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<GAMGInterfaceField>(cstrIter()(GAMGCp, fineInterface));
|
||||
return autoPtr<GAMGInterfaceField>(ctorPtr(GAMGCp, fineInterface));
|
||||
}
|
||||
|
||||
|
||||
@ -63,9 +63,9 @@ Foam::autoPtr<Foam::GAMGInterfaceField> Foam::GAMGInterfaceField::New
|
||||
{
|
||||
const word coupleType(GAMGCp.type());
|
||||
|
||||
auto cstrIter = lduInterfaceConstructorTablePtr_->cfind(coupleType);
|
||||
auto* ctorPtr = lduInterfaceConstructorTable(coupleType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalErrorInLookup
|
||||
(
|
||||
@ -75,7 +75,7 @@ Foam::autoPtr<Foam::GAMGInterfaceField> Foam::GAMGInterfaceField::New
|
||||
) << exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<GAMGInterfaceField>(cstrIter()(GAMGCp, doTransform, rank));
|
||||
return autoPtr<GAMGInterfaceField>(ctorPtr(GAMGCp, doTransform, rank));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -46,9 +46,9 @@ Foam::autoPtr<Foam::GAMGInterface> Foam::GAMGInterface::New
|
||||
{
|
||||
const word coupleType(fineInterface.type());
|
||||
|
||||
auto cstrIter = lduInterfaceConstructorTablePtr_->cfind(coupleType);
|
||||
auto* ctorPtr = lduInterfaceConstructorTable(coupleType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalErrorInLookup
|
||||
(
|
||||
@ -60,7 +60,7 @@ Foam::autoPtr<Foam::GAMGInterface> Foam::GAMGInterface::New
|
||||
|
||||
return autoPtr<GAMGInterface>
|
||||
(
|
||||
cstrIter()
|
||||
ctorPtr
|
||||
(
|
||||
index,
|
||||
coarseInterfaces,
|
||||
@ -82,9 +82,9 @@ Foam::autoPtr<Foam::GAMGInterface> Foam::GAMGInterface::New
|
||||
Istream& is
|
||||
)
|
||||
{
|
||||
auto cstrIter = IstreamConstructorTablePtr_->cfind(coupleType);
|
||||
auto* ctorPtr = IstreamConstructorTable(coupleType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalErrorInLookup
|
||||
(
|
||||
@ -94,7 +94,7 @@ Foam::autoPtr<Foam::GAMGInterface> Foam::GAMGInterface::New
|
||||
) << exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<GAMGInterface>(cstrIter()(index, coarseInterfaces, is));
|
||||
return autoPtr<GAMGInterface>(ctorPtr(index, coarseInterfaces, is));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -38,9 +38,9 @@ Foam::autoPtr<Foam::facePointPatch> Foam::facePointPatch::New
|
||||
{
|
||||
DebugInFunction << "Constructing facePointPatch" << endl;
|
||||
|
||||
auto cstrIter = polyPatchConstructorTablePtr_->cfind(patch.type());
|
||||
auto* ctorPtr = polyPatchConstructorTable(patch.type());
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalErrorInLookup
|
||||
(
|
||||
@ -50,7 +50,7 @@ Foam::autoPtr<Foam::facePointPatch> Foam::facePointPatch::New
|
||||
) << exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<facePointPatch>(cstrIter()(patch, bm));
|
||||
return autoPtr<facePointPatch>(ctorPtr(patch, bm));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -276,21 +276,27 @@ Foam::polyPatch::~polyPatch()
|
||||
|
||||
bool Foam::polyPatch::constraintType(const word& pt)
|
||||
{
|
||||
return pointPatchField<scalar>::pointPatchConstructorTablePtr_->found(pt);
|
||||
return
|
||||
(
|
||||
pointPatchField<scalar>::pointPatchConstructorTablePtr_
|
||||
&& pointPatchField<scalar>::pointPatchConstructorTablePtr_->found(pt)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::wordList Foam::polyPatch::constraintTypes()
|
||||
{
|
||||
wordList cTypes(dictionaryConstructorTablePtr_->size());
|
||||
const auto& cnstrTable = *dictionaryConstructorTablePtr_;
|
||||
|
||||
wordList cTypes(cnstrTable.size());
|
||||
|
||||
label i = 0;
|
||||
|
||||
forAllConstIters(*dictionaryConstructorTablePtr_, cstrIter)
|
||||
forAllConstIters(cnstrTable, iter)
|
||||
{
|
||||
if (constraintType(cstrIter.key()))
|
||||
if (constraintType(iter.key()))
|
||||
{
|
||||
cTypes[i++] = cstrIter.key();
|
||||
cTypes[i++] = iter.key();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -43,9 +43,9 @@ Foam::autoPtr<Foam::polyPatch> Foam::polyPatch::New
|
||||
{
|
||||
DebugInFunction << "Constructing polyPatch" << endl;
|
||||
|
||||
auto cstrIter = wordConstructorTablePtr_->cfind(patchType);
|
||||
auto* ctorPtr = wordConstructorTable(patchType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalErrorInLookup
|
||||
(
|
||||
@ -57,7 +57,7 @@ Foam::autoPtr<Foam::polyPatch> Foam::polyPatch::New
|
||||
|
||||
return autoPtr<polyPatch>
|
||||
(
|
||||
cstrIter()
|
||||
ctorPtr
|
||||
(
|
||||
name,
|
||||
size,
|
||||
@ -98,16 +98,16 @@ Foam::autoPtr<Foam::polyPatch> Foam::polyPatch::New
|
||||
{
|
||||
DebugInFunction << "Constructing polyPatch" << endl;
|
||||
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(patchType);
|
||||
auto* ctorPtr = dictionaryConstructorTable(patchType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
if (!disallowGenericPolyPatch)
|
||||
{
|
||||
cstrIter = dictionaryConstructorTablePtr_->cfind("genericPatch");
|
||||
ctorPtr = dictionaryConstructorTable("genericPatch");
|
||||
}
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -119,7 +119,7 @@ Foam::autoPtr<Foam::polyPatch> Foam::polyPatch::New
|
||||
}
|
||||
}
|
||||
|
||||
return autoPtr<polyPatch>(cstrIter()(name, dict, index, bm, patchType));
|
||||
return autoPtr<polyPatch>(ctorPtr(name, dict, index, bm, patchType));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -43,9 +43,9 @@ Foam::autoPtr<Foam::cellZone> Foam::cellZone::New
|
||||
|
||||
const word zoneType(dict.get<word>("type"));
|
||||
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(zoneType);
|
||||
auto* ctorPtr = dictionaryConstructorTable(zoneType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -56,7 +56,7 @@ Foam::autoPtr<Foam::cellZone> Foam::cellZone::New
|
||||
) << exit(FatalIOError);
|
||||
}
|
||||
|
||||
return autoPtr<cellZone>(cstrIter()(name, dict, index, zm));
|
||||
return autoPtr<cellZone>(ctorPtr(name, dict, index, zm));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -43,9 +43,9 @@ Foam::autoPtr<Foam::faceZone> Foam::faceZone::New
|
||||
|
||||
const word zoneType(dict.get<word>("type"));
|
||||
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(zoneType);
|
||||
auto* ctorPtr = dictionaryConstructorTable(zoneType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -56,7 +56,7 @@ Foam::autoPtr<Foam::faceZone> Foam::faceZone::New
|
||||
) << exit(FatalIOError);
|
||||
}
|
||||
|
||||
return autoPtr<faceZone>(cstrIter()(name, dict, index, zm));
|
||||
return autoPtr<faceZone>(ctorPtr(name, dict, index, zm));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -43,9 +43,9 @@ Foam::autoPtr<Foam::pointZone> Foam::pointZone::New
|
||||
|
||||
const word zoneType(dict.get<word>("type"));
|
||||
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(zoneType);
|
||||
auto* ctorPtr = dictionaryConstructorTable(zoneType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -56,7 +56,7 @@ Foam::autoPtr<Foam::pointZone> Foam::pointZone::New
|
||||
) << exit(FatalIOError);
|
||||
}
|
||||
|
||||
return autoPtr<pointZone>(cstrIter()(name, dict, index, zm));
|
||||
return autoPtr<pointZone>(ctorPtr(name, dict, index, zm));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -123,9 +123,9 @@ Foam::Function1<Type>::New
|
||||
}
|
||||
|
||||
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
|
||||
auto* ctorPtr = dictionaryConstructorTable(modelType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInFunction(dict)
|
||||
<< "Unknown Function1 type "
|
||||
@ -135,7 +135,7 @@ Foam::Function1<Type>::New
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
return cstrIter()(entryName, *coeffs);
|
||||
return ctorPtr(entryName, *coeffs);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -161,9 +161,7 @@ static void expandLeadingTilde(std::string& s)
|
||||
// Compat Warning
|
||||
const int version(1806);
|
||||
|
||||
// Single warning (on master) with guard to avoid Pstream::master()
|
||||
// when Pstream has not yet been initialized
|
||||
if (UPstream::parRun() ? UPstream::master() : true)
|
||||
if (error::master())
|
||||
{
|
||||
std::cerr
|
||||
<< nl
|
||||
|
||||
@ -163,9 +163,9 @@ Foam::LESModel<BasicTurbulenceModel>::New
|
||||
|
||||
Info<< "Selecting LES turbulence model " << modelType << endl;
|
||||
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
|
||||
auto* ctorPtr = dictionaryConstructorTable(modelType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -178,7 +178,7 @@ Foam::LESModel<BasicTurbulenceModel>::New
|
||||
|
||||
return autoPtr<LESModel>
|
||||
(
|
||||
cstrIter()(alpha, rho, U, alphaRhoPhi, phi, transport, propertiesName)
|
||||
ctorPtr(alpha, rho, U, alphaRhoPhi, phi, transport, propertiesName)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -77,9 +77,9 @@ Foam::autoPtr<Foam::LESdelta> Foam::LESdelta::New
|
||||
|
||||
Info<< "Selecting LES " << lookupName << " type " << deltaType << endl;
|
||||
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(deltaType);
|
||||
auto* ctorPtr = dictionaryConstructorTable(deltaType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -90,7 +90,7 @@ Foam::autoPtr<Foam::LESdelta> Foam::LESdelta::New
|
||||
) << exit(FatalIOError);
|
||||
}
|
||||
|
||||
return autoPtr<LESdelta>(cstrIter()(name, turbulence, dict));
|
||||
return autoPtr<LESdelta>(ctorPtr(name, turbulence, dict));
|
||||
}
|
||||
|
||||
|
||||
@ -99,7 +99,7 @@ Foam::autoPtr<Foam::LESdelta> Foam::LESdelta::New
|
||||
const word& name,
|
||||
const turbulenceModel& turbulence,
|
||||
const dictionary& dict,
|
||||
const dictionaryConstructorTable& additionalConstructors,
|
||||
const dictionaryConstructorTableType& additionalConstructors,
|
||||
const word& lookupName
|
||||
)
|
||||
{
|
||||
@ -109,30 +109,37 @@ Foam::autoPtr<Foam::LESdelta> Foam::LESdelta::New
|
||||
|
||||
// First any additional ones
|
||||
{
|
||||
auto cstrIter = additionalConstructors.cfind(deltaType);
|
||||
auto ctorIter = additionalConstructors.cfind(deltaType);
|
||||
|
||||
if (cstrIter.found())
|
||||
if (ctorIter.found())
|
||||
{
|
||||
return autoPtr<LESdelta>(cstrIter()(name, turbulence, dict));
|
||||
return autoPtr<LESdelta>(ctorIter.val()(name, turbulence, dict));
|
||||
}
|
||||
}
|
||||
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(deltaType);
|
||||
auto* ctorPtr = dictionaryConstructorTable(deltaType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
dict,
|
||||
"LESdelta",
|
||||
deltaType,
|
||||
additionalConstructors
|
||||
)
|
||||
<< " and " << dictionaryConstructorTablePtr_->sortedToc()
|
||||
*dictionaryConstructorTablePtr_
|
||||
);
|
||||
|
||||
if (!additionalConstructors.empty())
|
||||
{
|
||||
FatalIOError
|
||||
<< " and " << additionalConstructors.sortedToc() << nl;
|
||||
}
|
||||
|
||||
FatalIOError
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
return autoPtr<LESdelta>(cstrIter()(name, turbulence, dict));
|
||||
return autoPtr<LESdelta>(ctorPtr(name, turbulence, dict));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -53,10 +53,9 @@ namespace Foam
|
||||
|
||||
class LESdelta
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
// Protected Data
|
||||
|
||||
const turbulenceModel& turbulenceModel_;
|
||||
|
||||
@ -121,7 +120,7 @@ public:
|
||||
const word& name,
|
||||
const turbulenceModel& turbulence,
|
||||
const dictionary& dict,
|
||||
const dictionaryConstructorTable& additionalConstructors,
|
||||
const dictionaryConstructorTableType& additionalConstructors,
|
||||
const word& lookupName = "delta"
|
||||
);
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -49,9 +49,9 @@ Foam::autoPtr<Foam::LESfilter> Foam::LESfilter::New
|
||||
{
|
||||
const word filterType(dict.get<word>(filterDictName));
|
||||
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(filterType);
|
||||
auto* ctorPtr = dictionaryConstructorTable(filterType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -62,7 +62,7 @@ Foam::autoPtr<Foam::LESfilter> Foam::LESfilter::New
|
||||
) << exit(FatalIOError);
|
||||
}
|
||||
|
||||
return autoPtr<LESfilter>(cstrIter()(mesh, dict));
|
||||
return autoPtr<LESfilter>(ctorPtr(mesh, dict));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -145,9 +145,9 @@ Foam::RASModel<BasicTurbulenceModel>::New
|
||||
|
||||
Info<< "Selecting RAS turbulence model " << modelType << endl;
|
||||
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
|
||||
auto* ctorPtr = dictionaryConstructorTable(modelType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -160,7 +160,7 @@ Foam::RASModel<BasicTurbulenceModel>::New
|
||||
|
||||
return autoPtr<RASModel>
|
||||
(
|
||||
cstrIter()(alpha, rho, U, alphaRhoPhi, phi, transport, propertiesName)
|
||||
ctorPtr(alpha, rho, U, alphaRhoPhi, phi, transport, propertiesName)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2013-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -105,9 +105,9 @@ Foam::TurbulenceModel<Alpha, Rho, BasicTurbulenceModel, TransportModel>::New
|
||||
|
||||
Info<< "Selecting turbulence model type " << modelType << endl;
|
||||
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
|
||||
auto* ctorPtr = dictionaryConstructorTable(modelType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -120,7 +120,7 @@ Foam::TurbulenceModel<Alpha, Rho, BasicTurbulenceModel, TransportModel>::New
|
||||
|
||||
return autoPtr<TurbulenceModel>
|
||||
(
|
||||
cstrIter()(alpha, rho, U, alphaRhoPhi, phi, transport, propertiesName)
|
||||
ctorPtr(alpha, rho, U, alphaRhoPhi, phi, transport, propertiesName)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2020 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -40,9 +40,9 @@ Foam::laminarModels::generalizedNewtonianViscosityModel::New
|
||||
|
||||
Info<< "Selecting generalized Newtonian model " << modelType << endl;
|
||||
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->find(modelType);
|
||||
auto* ctorPtr = dictionaryConstructorTable(modelType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -53,7 +53,7 @@ Foam::laminarModels::generalizedNewtonianViscosityModel::New
|
||||
) << exit(FatalIOError);
|
||||
}
|
||||
|
||||
return autoPtr<generalizedNewtonianViscosityModel>(cstrIter()(dict));
|
||||
return autoPtr<generalizedNewtonianViscosityModel>(ctorPtr(dict));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -120,9 +120,9 @@ Foam::laminarModel<BasicTurbulenceModel>::New
|
||||
|
||||
Info<< "Selecting laminar stress model " << modelType << endl;
|
||||
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
|
||||
auto* ctorPtr = dictionaryConstructorTable(modelType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -135,7 +135,7 @@ Foam::laminarModel<BasicTurbulenceModel>::New
|
||||
|
||||
return autoPtr<laminarModel>
|
||||
(
|
||||
cstrIter()
|
||||
ctorPtr
|
||||
(
|
||||
alpha,
|
||||
rho,
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -45,9 +45,9 @@ Foam::autoPtr<Foam::reactionRateFlameArea> Foam::reactionRateFlameArea::New
|
||||
Info<< "Selecting reaction rate flame area correlation "
|
||||
<< modelType << endl;
|
||||
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
|
||||
auto* ctorPtr = dictionaryConstructorTable(modelType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -61,7 +61,7 @@ Foam::autoPtr<Foam::reactionRateFlameArea> Foam::reactionRateFlameArea::New
|
||||
const word className = modelType.substr(0, modelType.find('<'));
|
||||
|
||||
return autoPtr<reactionRateFlameArea>
|
||||
(cstrIter()(className, dict, mesh, combModel));
|
||||
(ctorPtr(className, dict, mesh, combModel));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -73,6 +73,7 @@ Foam::autoPtr<CombustionModel> Foam::combustionModel::New
|
||||
<< "combustion model " << combModelName << "." << endl;
|
||||
}
|
||||
|
||||
|
||||
const word compCombModelName
|
||||
(
|
||||
combModelName + '<' + CombustionModel::reactionThermo::typeName + '>'
|
||||
@ -87,20 +88,27 @@ Foam::autoPtr<CombustionModel> Foam::combustionModel::New
|
||||
|
||||
const auto& cnstrTable = *(CombustionModel::dictionaryConstructorTablePtr_);
|
||||
|
||||
auto compCstrIter = cnstrTable.cfind(compCombModelName);
|
||||
auto ctorIter = cnstrTable.cfind(thermoCombModelName);
|
||||
|
||||
auto thermoCstrIter = cnstrTable.cfind(thermoCombModelName);
|
||||
|
||||
if (!compCstrIter.found() && !thermoCstrIter.found())
|
||||
if (!ctorIter.found())
|
||||
{
|
||||
wordList thisCmpts;
|
||||
thisCmpts.append(word::null);
|
||||
thisCmpts.append(CombustionModel::reactionThermo::typeName);
|
||||
thisCmpts.append(basicThermo::splitThermoName(thermo.thermoName(), 5));
|
||||
ctorIter = cnstrTable.cfind(compCombModelName);
|
||||
}
|
||||
|
||||
wordList validNames;
|
||||
if (!ctorIter.found())
|
||||
{
|
||||
const wordList names(cnstrTable.sortedToc());
|
||||
|
||||
List<wordList> validCmpts2;
|
||||
/// DynamicList<word> thisCmpts(6);
|
||||
/// thisCmpts.append(CombustionModel::reactionThermo::typeName);
|
||||
/// thisCmpts.append(basicThermo::splitThermoName
|
||||
/// (
|
||||
/// basicThermo::splitThermoName(thermo.thermoName(), 5)
|
||||
/// );
|
||||
///
|
||||
/// DynamicList<word> validNames;
|
||||
|
||||
DynamicList<wordList> validCmpts2;
|
||||
validCmpts2.append
|
||||
(
|
||||
// Header
|
||||
@ -112,7 +120,7 @@ Foam::autoPtr<CombustionModel> Foam::combustionModel::New
|
||||
})
|
||||
);
|
||||
|
||||
List<wordList> validCmpts7;
|
||||
DynamicList<wordList> validCmpts7;
|
||||
validCmpts7.append
|
||||
(
|
||||
// Header
|
||||
@ -129,61 +137,56 @@ Foam::autoPtr<CombustionModel> Foam::combustionModel::New
|
||||
})
|
||||
);
|
||||
|
||||
for (const word& validName : cnstrTable.sortedToc())
|
||||
for (const word& validName : names)
|
||||
{
|
||||
wordList cmpts(basicThermo::splitThermoName(validName, 2));
|
||||
wordList cmpts(basicThermo::splitThermoName(validName, 0));
|
||||
|
||||
if (cmpts.size() == 2)
|
||||
{
|
||||
validCmpts2.append(cmpts);
|
||||
validCmpts2.append(std::move(cmpts));
|
||||
}
|
||||
else
|
||||
else if (cmpts.size() == 7)
|
||||
{
|
||||
cmpts = basicThermo::splitThermoName(validName, 7);
|
||||
if (cmpts.size() == 7)
|
||||
{
|
||||
validCmpts7.append(cmpts);
|
||||
/// if (thisCmpts == SubList<word>(cmpts, 6, 1))
|
||||
/// {
|
||||
/// validNames.append(cmpts[0]);
|
||||
/// }
|
||||
validCmpts7.append(std::move(cmpts));
|
||||
}
|
||||
}
|
||||
|
||||
bool isValid = true;
|
||||
for (label i = 1; i < cmpts.size() && isValid; ++i)
|
||||
{
|
||||
isValid = isValid && cmpts[i] == thisCmpts[i];
|
||||
}
|
||||
|
||||
if (isValid)
|
||||
{
|
||||
validNames.append(cmpts[0]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FatalErrorInLookup
|
||||
(
|
||||
combustionModel::typeName,
|
||||
combModelName,
|
||||
cnstrTable
|
||||
)
|
||||
);
|
||||
|
||||
if (validCmpts2.size() > 1)
|
||||
{
|
||||
FatalError
|
||||
<< "All " << validCmpts2[0][0] << '/' << validCmpts2[0][1]
|
||||
<< " combinations are:" << nl << nl;
|
||||
|
||||
printTable(validCmpts2, FatalErrorInFunction)
|
||||
<< nl;
|
||||
printTable(validCmpts2, FatalError) << nl;
|
||||
}
|
||||
|
||||
FatalErrorInFunction
|
||||
if (validCmpts7.size() > 1)
|
||||
{
|
||||
FatalError
|
||||
<< "All " << validCmpts7[0][0] << '/' << validCmpts7[0][1]
|
||||
<< "/thermoPhysics combinations are:" << nl << nl;
|
||||
|
||||
printTable(validCmpts7, FatalErrorInFunction)
|
||||
printTable(validCmpts7, FatalError) << nl;
|
||||
}
|
||||
|
||||
FatalError
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<CombustionModel>
|
||||
(
|
||||
thermoCstrIter.found()
|
||||
? thermoCstrIter()(combModelName, thermo, turb, combustionProperties)
|
||||
: compCstrIter()(combModelName, thermo, turb, combustionProperties)
|
||||
ctorIter.val()(combModelName, thermo, turb, combustionProperties)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -72,9 +72,8 @@ Foam::autoPtr<Foam::dynamicFvMesh> Foam::dynamicFvMesh::New(const IOobject& io)
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
auto doInitCstrIter = doInitConstructorTablePtr_->cfind(modelType);
|
||||
|
||||
if (doInitCstrIter.found())
|
||||
auto* doInitCtor = doInitConstructorTable(modelType);
|
||||
if (doInitCtor)
|
||||
{
|
||||
DebugInfo
|
||||
<< "Constructing dynamicFvMesh with explicit initialisation"
|
||||
@ -82,7 +81,7 @@ Foam::autoPtr<Foam::dynamicFvMesh> Foam::dynamicFvMesh::New(const IOobject& io)
|
||||
|
||||
// Two-step constructor
|
||||
// 1. Construct mesh, do not initialise
|
||||
autoPtr<dynamicFvMesh> meshPtr(doInitCstrIter()(io, false));
|
||||
autoPtr<dynamicFvMesh> meshPtr(doInitCtor(io, false));
|
||||
|
||||
// 2. Initialise parents and itself
|
||||
meshPtr().init(true);
|
||||
@ -90,9 +89,9 @@ Foam::autoPtr<Foam::dynamicFvMesh> Foam::dynamicFvMesh::New(const IOobject& io)
|
||||
return meshPtr;
|
||||
}
|
||||
|
||||
auto cstrIter = IOobjectConstructorTablePtr_->cfind(modelType);
|
||||
auto* ctorPtr = IOobjectConstructorTable(modelType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalIOErrorInLookup
|
||||
(
|
||||
@ -103,7 +102,7 @@ Foam::autoPtr<Foam::dynamicFvMesh> Foam::dynamicFvMesh::New(const IOobject& io)
|
||||
) << exit(FatalIOError);
|
||||
}
|
||||
|
||||
return autoPtr<dynamicFvMesh>(cstrIter()(io));
|
||||
return autoPtr<dynamicFvMesh>(ctorPtr(io));
|
||||
}
|
||||
|
||||
DebugInfo
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -64,12 +64,12 @@ Foam::simplifiedMeshes::simplifiedDynamicFvMeshBase::New
|
||||
|
||||
const word modelType(dict.get<word>("dynamicFvMesh"));
|
||||
|
||||
auto cstrIter = timeConstructorTablePtr_->cfind(modelType);
|
||||
auto* ctorPtr = timeConstructorTable(modelType);
|
||||
|
||||
if (cstrIter.found())
|
||||
if (ctorPtr)
|
||||
{
|
||||
Info<< "Selecting simplified mesh model " << modelType << endl;
|
||||
return autoPtr<dynamicFvMesh>(cstrIter()(io.time(), io.name()));
|
||||
return autoPtr<dynamicFvMesh>(ctorPtr(io.time(), io.name()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -48,9 +48,9 @@ Foam::autoPtr<Foam::cellLooper> Foam::cellLooper::New
|
||||
const polyMesh& mesh
|
||||
)
|
||||
{
|
||||
auto cstrIter = wordConstructorTablePtr_->cfind(type);
|
||||
auto* ctorPtr = wordConstructorTable(type);
|
||||
|
||||
if (!cstrIter.found())
|
||||
if (!ctorPtr)
|
||||
{
|
||||
FatalErrorInLookup
|
||||
(
|
||||
@ -60,7 +60,7 @@ Foam::autoPtr<Foam::cellLooper> Foam::cellLooper::New
|
||||
) << exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<cellLooper>(cstrIter()(mesh));
|
||||
return autoPtr<cellLooper>(ctorPtr(mesh));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user