STYLE: use std::initializer_list instead of const char*[]
This commit is contained in:
parent
573a313f46
commit
e7fde1dbe0
@ -178,8 +178,7 @@ public:
|
||||
(
|
||||
const dictionary& thermoTypeDict,
|
||||
Table* tablePtr,
|
||||
const int nCmpt,
|
||||
const char* cmptNames[],
|
||||
std::initializer_list<const char*> cmptNames,
|
||||
const word& thermoTypeName
|
||||
);
|
||||
|
||||
|
@ -32,8 +32,7 @@ typename Table::iterator Foam::basicThermo::lookupThermo
|
||||
(
|
||||
const dictionary& thermoTypeDict,
|
||||
Table* tablePtr,
|
||||
const int nCmpt,
|
||||
const char* cmptNames[],
|
||||
std::initializer_list<const char*> cmptNames,
|
||||
const word& thermoTypeName
|
||||
)
|
||||
{
|
||||
@ -62,15 +61,19 @@ typename Table::iterator Foam::basicThermo::lookupThermo
|
||||
validThermoTypeNames.size() + 1
|
||||
);
|
||||
|
||||
const int nCmpt = cmptNames.size();
|
||||
validThermoTypeNameCmpts[0].setSize(nCmpt);
|
||||
forAll(validThermoTypeNameCmpts[0], j)
|
||||
|
||||
label j = 0;
|
||||
for (const char* cmptName : cmptNames)
|
||||
{
|
||||
validThermoTypeNameCmpts[0][j] = cmptNames[j];
|
||||
validThermoTypeNameCmpts[0][j] = cmptName;
|
||||
++j;
|
||||
}
|
||||
|
||||
// Split the thermo package names into their constituent parts
|
||||
// Removing incompatible entries from the list
|
||||
label j = 0;
|
||||
j = 0;
|
||||
forAll(validThermoTypeNames, i)
|
||||
{
|
||||
wordList names
|
||||
@ -111,8 +114,7 @@ typename Table::iterator Foam::basicThermo::lookupThermo
|
||||
|
||||
if (thermoTypeDict.found("properties"))
|
||||
{
|
||||
const int nCmpt = 4;
|
||||
const char* cmptNames[nCmpt] =
|
||||
std::initializer_list<const char*> cmptNames
|
||||
{
|
||||
"type",
|
||||
"mixture",
|
||||
@ -133,15 +135,13 @@ typename Table::iterator Foam::basicThermo::lookupThermo
|
||||
(
|
||||
thermoTypeDict,
|
||||
tablePtr,
|
||||
nCmpt,
|
||||
cmptNames,
|
||||
thermoTypeName
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
const int nCmpt = 7;
|
||||
const char* cmptNames[nCmpt] =
|
||||
std::initializer_list<const char*> cmptNames
|
||||
{
|
||||
"type",
|
||||
"mixture",
|
||||
@ -168,7 +168,6 @@ typename Table::iterator Foam::basicThermo::lookupThermo
|
||||
(
|
||||
thermoTypeDict,
|
||||
tablePtr,
|
||||
nCmpt,
|
||||
cmptNames,
|
||||
thermoTypeName
|
||||
);
|
||||
|
@ -236,7 +236,7 @@ public:
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "SpecieMixture.C"
|
||||
|
@ -26,12 +26,6 @@ License
|
||||
#include "egrMixture.H"
|
||||
#include "fvMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
template<class ThermoType>
|
||||
const char* Foam::egrMixture<ThermoType>::specieNames_[3] = {"ft", "b", "egr"};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class ThermoType>
|
||||
@ -45,7 +39,7 @@ Foam::egrMixture<ThermoType>::egrMixture
|
||||
basicCombustionMixture
|
||||
(
|
||||
thermoDict,
|
||||
speciesTable(nSpecies_, specieNames_),
|
||||
speciesTable({"ft", "b", "egr"}),
|
||||
mesh,
|
||||
phaseName
|
||||
),
|
||||
|
@ -28,7 +28,7 @@ Group
|
||||
grpReactionThermophysicalMixtures
|
||||
|
||||
Description
|
||||
Foam::egrMixture
|
||||
The egr mixture contains species ("ft", "b", "egr").
|
||||
|
||||
SourceFiles
|
||||
egrMixture.C
|
||||
@ -54,10 +54,7 @@ class egrMixture
|
||||
:
|
||||
public basicCombustionMixture
|
||||
{
|
||||
// Private data
|
||||
|
||||
static const int nSpecies_ = 3;
|
||||
static const char* specieNames_[3];
|
||||
// Private Data
|
||||
|
||||
dimensionedScalar stoicRatio_;
|
||||
|
||||
@ -190,7 +187,7 @@ public:
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "egrMixture.C"
|
||||
|
@ -26,12 +26,6 @@ License
|
||||
#include "homogeneousMixture.H"
|
||||
#include "fvMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
template<class ThermoType>
|
||||
const char* Foam::homogeneousMixture<ThermoType>::specieNames_[1] = {"b"};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class ThermoType>
|
||||
@ -45,7 +39,7 @@ Foam::homogeneousMixture<ThermoType>::homogeneousMixture
|
||||
basicCombustionMixture
|
||||
(
|
||||
thermoDict,
|
||||
speciesTable(nSpecies_, specieNames_),
|
||||
speciesTable({"b"}),
|
||||
mesh,
|
||||
phaseName
|
||||
),
|
||||
|
@ -28,7 +28,7 @@ Group
|
||||
grpReactionThermophysicalMixtures
|
||||
|
||||
Description
|
||||
Foam::homogeneousMixture
|
||||
The homogeneous mixture contains species ("b").
|
||||
|
||||
SourceFiles
|
||||
homogeneousMixture.C
|
||||
@ -54,10 +54,7 @@ class homogeneousMixture
|
||||
:
|
||||
public basicCombustionMixture
|
||||
{
|
||||
// Private data
|
||||
|
||||
static const int nSpecies_ = 1;
|
||||
static const char* specieNames_[1];
|
||||
// Private Data
|
||||
|
||||
ThermoType reactants_;
|
||||
ThermoType products_;
|
||||
@ -148,7 +145,7 @@ public:
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "homogeneousMixture.C"
|
||||
|
@ -26,16 +26,6 @@ License
|
||||
#include "inhomogeneousMixture.H"
|
||||
#include "fvMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
template<class ThermoType>
|
||||
const char* Foam::inhomogeneousMixture<ThermoType>::specieNames_[2] =
|
||||
{
|
||||
"ft",
|
||||
"b"
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class ThermoType>
|
||||
@ -49,7 +39,7 @@ Foam::inhomogeneousMixture<ThermoType>::inhomogeneousMixture
|
||||
basicCombustionMixture
|
||||
(
|
||||
thermoDict,
|
||||
speciesTable(nSpecies_, specieNames_),
|
||||
speciesTable({"ft", "b"}),
|
||||
mesh,
|
||||
phaseName
|
||||
),
|
||||
|
@ -28,7 +28,7 @@ Group
|
||||
grpReactionThermophysicalMixtures
|
||||
|
||||
Description
|
||||
Foam::inhomogeneousMixture
|
||||
The inhomogeneous mixture contains species ("ft", "b").
|
||||
|
||||
SourceFiles
|
||||
inhomogeneousMixture.C
|
||||
@ -54,10 +54,7 @@ class inhomogeneousMixture
|
||||
:
|
||||
public basicCombustionMixture
|
||||
{
|
||||
// Private data
|
||||
|
||||
static const int nSpecies_ = 2;
|
||||
static const char* specieNames_[2];
|
||||
// Private Data
|
||||
|
||||
dimensionedScalar stoicRatio_;
|
||||
|
||||
@ -182,7 +179,7 @@ public:
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "inhomogeneousMixture.C"
|
||||
|
@ -26,17 +26,6 @@ License
|
||||
#include "veryInhomogeneousMixture.H"
|
||||
#include "fvMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
template<class ThermoType>
|
||||
const char* Foam::veryInhomogeneousMixture<ThermoType>::specieNames_[3] =
|
||||
{
|
||||
"ft",
|
||||
"fu",
|
||||
"b"
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class ThermoType>
|
||||
@ -50,7 +39,7 @@ Foam::veryInhomogeneousMixture<ThermoType>::veryInhomogeneousMixture
|
||||
basicCombustionMixture
|
||||
(
|
||||
thermoDict,
|
||||
speciesTable(nSpecies_, specieNames_),
|
||||
speciesTable({"ft", "fu", "b"}),
|
||||
mesh,
|
||||
phaseName
|
||||
),
|
||||
|
@ -28,7 +28,7 @@ Group
|
||||
grpReactionThermophysicalMixtures
|
||||
|
||||
Description
|
||||
Foam::veryInhomogeneousMixture
|
||||
The very inhomogeneous mixture contains species ("ft", "fu", "b").
|
||||
|
||||
SourceFiles
|
||||
veryInhomogeneousMixture.C
|
||||
@ -54,10 +54,7 @@ class veryInhomogeneousMixture
|
||||
:
|
||||
public basicCombustionMixture
|
||||
{
|
||||
// Private data
|
||||
|
||||
static const int nSpecies_ = 3;
|
||||
static const char* specieNames_[3];
|
||||
// Private Data
|
||||
|
||||
dimensionedScalar stoicRatio_;
|
||||
|
||||
@ -183,7 +180,7 @@ public:
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "veryInhomogeneousMixture.C"
|
||||
|
@ -50,8 +50,7 @@ Foam::basicSolidChemistryModel::New(solidReactionThermo& thermo)
|
||||
|
||||
Info<< "Selecting chemistry type " << chemistryTypeDict << endl;
|
||||
|
||||
const int nCmpt = 13;
|
||||
const char* cmptNames[nCmpt] =
|
||||
std::initializer_list<const char*> cmptNames
|
||||
{
|
||||
"chemistrySolver",
|
||||
"chemistryThermo",
|
||||
@ -136,10 +135,14 @@ Foam::basicSolidChemistryModel::New(solidReactionThermo& thermo)
|
||||
validChemistryTypeNames.size() + 1
|
||||
);
|
||||
|
||||
const int nCmpt = cmptNames.size();
|
||||
validChemistryTypeNameCmpts[0].setSize(nCmpt);
|
||||
forAll(validChemistryTypeNameCmpts[0], j)
|
||||
|
||||
label j = 0;
|
||||
for (const char* cmptName : cmptNames)
|
||||
{
|
||||
validChemistryTypeNameCmpts[0][j] = cmptNames[j];
|
||||
validChemistryTypeNameCmpts[0][j] = cmptName;
|
||||
++j;
|
||||
}
|
||||
|
||||
// Split the thermo package names into their constituent parts
|
||||
|
Loading…
Reference in New Issue
Block a user