mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: use string substr instead of string::operator()
- makes the purpose clearer. In some places, string::resize() is even simpler. - use C++11 string::back() in preference to str[str.size()-1]
This commit is contained in:
@ -34,16 +34,15 @@ Foam::autoPtr<Foam::reactionRateFlameArea> Foam::reactionRateFlameArea::New
|
||||
const combustionModel& combModel
|
||||
)
|
||||
{
|
||||
word reactionRateFlameAreaType
|
||||
const word modelType
|
||||
(
|
||||
dict.lookup("reactionRateFlameArea")
|
||||
);
|
||||
|
||||
Info<< "Selecting reaction rate flame area correlation "
|
||||
<< reactionRateFlameAreaType << endl;
|
||||
<< modelType << endl;
|
||||
|
||||
auto cstrIter =
|
||||
dictionaryConstructorTablePtr_->cfind(reactionRateFlameAreaType);
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
@ -51,15 +50,13 @@ Foam::autoPtr<Foam::reactionRateFlameArea> Foam::reactionRateFlameArea::New
|
||||
(
|
||||
dict
|
||||
) << "Unknown reactionRateFlameArea type "
|
||||
<< reactionRateFlameAreaType << nl << nl
|
||||
<< modelType << nl << nl
|
||||
<< "Valid reaction rate flame area types :" << endl
|
||||
<< dictionaryConstructorTablePtr_->sortedToc()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
const label tempOpen = reactionRateFlameAreaType.find('<');
|
||||
|
||||
const word className = reactionRateFlameAreaType(0, tempOpen);
|
||||
const word className = modelType.substr(0, modelType.find('<'));
|
||||
|
||||
return autoPtr<reactionRateFlameArea>
|
||||
(cstrIter()(className, dict, mesh, combModel));
|
||||
|
||||
@ -35,7 +35,7 @@ Foam::combustionModels::psiCombustionModel::New
|
||||
const word& phaseName
|
||||
)
|
||||
{
|
||||
const word combModelName
|
||||
const word modelType
|
||||
(
|
||||
IOdictionary
|
||||
(
|
||||
@ -51,21 +51,21 @@ Foam::combustionModels::psiCombustionModel::New
|
||||
).lookup("combustionModel")
|
||||
);
|
||||
|
||||
Info<< "Selecting combustion model " << combModelName << endl;
|
||||
Info<< "Selecting combustion model " << modelType << endl;
|
||||
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(combModelName);
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown psiCombustionModel type "
|
||||
<< combModelName << endl << endl
|
||||
<< "Valid combustionModel types :" << endl
|
||||
<< modelType << nl << nl
|
||||
<< "Valid combustionModel types :" << nl
|
||||
<< dictionaryConstructorTablePtr_->sortedToc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
const word className = combModelName(0, combModelName.find('<'));
|
||||
const word className = modelType.substr(0, modelType.find('<'));
|
||||
|
||||
return autoPtr<psiCombustionModel>
|
||||
(
|
||||
|
||||
@ -35,7 +35,7 @@ Foam::combustionModels::rhoCombustionModel::New
|
||||
const word& phaseName
|
||||
)
|
||||
{
|
||||
const word combTypeName
|
||||
const word modelType
|
||||
(
|
||||
IOdictionary
|
||||
(
|
||||
@ -51,23 +51,21 @@ Foam::combustionModels::rhoCombustionModel::New
|
||||
).lookup("combustionModel")
|
||||
);
|
||||
|
||||
Info<< "Selecting combustion model " << combTypeName << endl;
|
||||
Info<< "Selecting combustion model " << modelType << endl;
|
||||
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(combTypeName);
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown rhoCombustionModel type "
|
||||
<< combTypeName << endl << endl
|
||||
<< "Valid combustionModel types :" << endl
|
||||
<< modelType << nl << nl
|
||||
<< "Valid combustionModel types :" << nl
|
||||
<< dictionaryConstructorTablePtr_->sortedToc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
const label tempOpen = combTypeName.find('<');
|
||||
|
||||
const word className = combTypeName(0, tempOpen);
|
||||
const word className = modelType.substr(0, modelType.find('<'));
|
||||
|
||||
return autoPtr<rhoCombustionModel>
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user