improved debug messaging

This commit is contained in:
andy
2009-06-15 10:59:20 +01:00
parent 3c642ebdc2
commit f941d92b07
2 changed files with 62 additions and 28 deletions

View File

@ -35,7 +35,7 @@ Foam::autoPtr<Foam::psiChemistryModel> Foam::psiChemistryModel::New
{ {
word psiChemistryModelType; word psiChemistryModelType;
word thermoTypeName; word thermoTypeName;
word userSel; word userModel;
// Enclose the creation of the chemistrtyProperties to ensure it is // Enclose the creation of the chemistrtyProperties to ensure it is
// deleted before the chemistrtyProperties is created otherwise the // deleted before the chemistrtyProperties is created otherwise the
@ -53,26 +53,42 @@ Foam::autoPtr<Foam::psiChemistryModel> Foam::psiChemistryModel::New
) )
); );
chemistryPropertiesDict.lookup("psiChemistryModel") >> userSel; chemistryPropertiesDict.lookup("psiChemistryModel") >> userModel;
// construct chemistry model type name by inserting first template // construct chemistry model type name by inserting first template
// argument // argument
label tempOpen = userSel.find('<'); label tempOpen = userModel.find('<');
label tempClose = userSel.find('>'); label tempClose = userModel.find('>');
word className = userSel(0, tempOpen); word className = userModel(0, tempOpen);
thermoTypeName = userSel(tempOpen + 1, tempClose - tempOpen - 1); thermoTypeName = userModel(tempOpen + 1, tempClose - tempOpen - 1);
psiChemistryModelType = psiChemistryModelType =
className + '<' + typeName + ',' + thermoTypeName + '>'; className + '<' + typeName + ',' + thermoTypeName + '>';
} }
Info<< "Selecting psiChemistryModel " << userSel << endl; if (debug)
{
Info<< "Selecting psiChemistryModel " << psiChemistryModelType << endl;
}
else
{
Info<< "Selecting psiChemistryModel " << userModel << endl;
}
fvMeshConstructorTable::iterator cstrIter = fvMeshConstructorTable::iterator cstrIter =
fvMeshConstructorTablePtr_->find(psiChemistryModelType); fvMeshConstructorTablePtr_->find(psiChemistryModelType);
if (cstrIter == fvMeshConstructorTablePtr_->end()) if (cstrIter == fvMeshConstructorTablePtr_->end())
{
if (debug)
{
FatalErrorIn("psiChemistryModelBase::New(const mesh&)")
<< "Unknown psiChemistryModel type " << psiChemistryModelType
<< nl << nl << "Valid psiChemistryModel types are:" << nl
<< fvMeshConstructorTablePtr_->toc() << nl << exit(FatalError);
}
else
{ {
wordList models = fvMeshConstructorTablePtr_->toc(); wordList models = fvMeshConstructorTablePtr_->toc();
forAll(models, i) forAll(models, i)
@ -81,10 +97,11 @@ Foam::autoPtr<Foam::psiChemistryModel> Foam::psiChemistryModel::New
} }
FatalErrorIn("psiChemistryModelBase::New(const mesh&)") FatalErrorIn("psiChemistryModelBase::New(const mesh&)")
<< "Unknown psiChemistryModel type " << userSel << "Unknown psiChemistryModel type " << userModel
<< nl << nl << "Valid psiChemistryModel types are:" << nl << nl << nl << "Valid psiChemistryModel types are:" << nl
<< models << nl << exit(FatalError); << models << nl << exit(FatalError);
} }
}
return autoPtr<psiChemistryModel> return autoPtr<psiChemistryModel>
(cstrIter()(mesh, typeName, thermoTypeName)); (cstrIter()(mesh, typeName, thermoTypeName));

View File

@ -35,7 +35,7 @@ Foam::autoPtr<Foam::rhoChemistryModel> Foam::rhoChemistryModel::New
{ {
word rhoChemistryModelType; word rhoChemistryModelType;
word thermoTypeName; word thermoTypeName;
word userSel; word userModel;
// Enclose the creation of the chemistrtyProperties to ensure it is // Enclose the creation of the chemistrtyProperties to ensure it is
// deleted before the chemistrtyProperties is created otherwise the // deleted before the chemistrtyProperties is created otherwise the
@ -53,26 +53,42 @@ Foam::autoPtr<Foam::rhoChemistryModel> Foam::rhoChemistryModel::New
) )
); );
chemistryPropertiesDict.lookup("rhoChemistryModelType") >> userSel; chemistryPropertiesDict.lookup("rhoChemistryModelType") >> userModel;
// construct chemistry model type name by inserting first template // construct chemistry model type name by inserting first template
// argument // argument
label tempOpen = userSel.find('<'); label tempOpen = userModel.find('<');
label tempClose = userSel.find('>'); label tempClose = userModel.find('>');
word className = userSel(0, tempOpen); word className = userModel(0, tempOpen);
thermoTypeName = userSel(tempOpen + 1, tempClose - tempOpen - 1); thermoTypeName = userModel(tempOpen + 1, tempClose - tempOpen - 1);
rhoChemistryModelType = rhoChemistryModelType =
className + '<' + typeName + ',' + thermoTypeName + '>'; className + '<' + typeName + ',' + thermoTypeName + '>';
} }
Info<< "Selecting rhoChemistryModel " << userSel << endl; if (debug)
{
Info<< "Selecting rhoChemistryModel " << rhoChemistryModelType << endl;
}
else
{
Info<< "Selecting rhoChemistryModel " << userModel << endl;
}
fvMeshConstructorTable::iterator cstrIter = fvMeshConstructorTable::iterator cstrIter =
fvMeshConstructorTablePtr_->find(rhoChemistryModelType); fvMeshConstructorTablePtr_->find(rhoChemistryModelType);
if (cstrIter == fvMeshConstructorTablePtr_->end()) if (cstrIter == fvMeshConstructorTablePtr_->end())
{
if (debug)
{
FatalErrorIn("rhoChemistryModelBase::New(const mesh&)")
<< "Unknown rhoChemistryModel type " << rhoChemistryModelType
<< nl << nl << "Valid rhoChemistryModel types are:" << nl
<< fvMeshConstructorTablePtr_->toc() << nl << exit(FatalError);
}
else
{ {
wordList models = fvMeshConstructorTablePtr_->toc(); wordList models = fvMeshConstructorTablePtr_->toc();
forAll(models, i) forAll(models, i)
@ -81,10 +97,11 @@ Foam::autoPtr<Foam::rhoChemistryModel> Foam::rhoChemistryModel::New
} }
FatalErrorIn("rhoChemistryModelBase::New(const mesh&)") FatalErrorIn("rhoChemistryModelBase::New(const mesh&)")
<< "Unknown rhoChemistryModel type " << userSel << "Unknown rhoChemistryModel type " << userModel
<< nl << nl << "Valid rhoChemistryModel types are:" << nl << nl << nl << "Valid rhoChemistryModel types are:" << nl
<< models << nl << exit(FatalError); << models << nl << exit(FatalError);
} }
}
return autoPtr<rhoChemistryModel> return autoPtr<rhoChemistryModel>
(cstrIter()(mesh, typeName, thermoTypeName)); (cstrIter()(mesh, typeName, thermoTypeName));