ENH: Updated Info, Warning and Error messages

This commit is contained in:
Andrew Heather
2015-12-08 11:15:39 +00:00
parent ae95edeea4
commit eafd5a3850
94 changed files with 351 additions and 1040 deletions

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -192,7 +192,8 @@ Foam::dictionary Foam::boundaryTemplates::generatePatchDict
if (!regionOptions.found(category))
{
FatalError<< "No options available for category "
FatalErrorInFunction
<< "No options available for category "
<< category << exit(FatalError);
}
@ -207,19 +208,7 @@ Foam::dictionary Foam::boundaryTemplates::generatePatchDict
word selected;
if (!conditionOptions.readIfPresent(option, selected))
{
FatalErrorIn
(
"Foam::dictionary "
"Foam::boundaryTemplates::generatePatchDict"
"("
"const word&, "
"const word&, "
"const word&, "
"const word&, "
"const word&, "
"const dictionary&"
") const"
)
FatalErrorInFunction
<< "Condition " << condition << ": "
<< "No option '" << option
<< "' available for category '" << category
@ -231,19 +220,7 @@ Foam::dictionary Foam::boundaryTemplates::generatePatchDict
if (!dict.found(option))
{
FatalErrorIn
(
"Foam::dictionary "
"Foam::boundaryTemplates::generatePatchDict"
"("
"const word&, "
"const word&, "
"const word&, "
"const word&, "
"const word&, "
"const dictionary&"
") const"
)
FatalErrorInFunction
<< "Condition " << condition << ": "
<< "No option '" << option
<< "' available for category '" << category
@ -256,19 +233,7 @@ Foam::dictionary Foam::boundaryTemplates::generatePatchDict
if (!optionDict.found(selected))
{
FatalErrorIn
(
"Foam::dictionary "
"Foam::boundaryTemplates::generatePatchDict"
"("
"const word&, "
"const word&, "
"const word&, "
"const word&, "
"const word&, "
"const dictionary&"
") const"
)
FatalErrorInFunction
<< "Condition " << condition << ": "
<< "No option '" << selected
<< "' available for category '" << category
@ -307,19 +272,7 @@ Foam::dictionary Foam::boundaryTemplates::generatePatchDict
}
else
{
FatalErrorIn
(
"Foam::dictionary "
"Foam::boundaryTemplates::generatePatchDict"
"("
"const word&, "
"const word&, "
"const word&, "
"const word&, "
"const word&, "
"const dictionary&"
") const"
)
FatalErrorInFunction
<< "Condition " << condition << ": "
<< "No '" << patchType
<< "' condition found for field '" << fieldName
@ -329,19 +282,7 @@ Foam::dictionary Foam::boundaryTemplates::generatePatchDict
}
else
{
FatalErrorIn
(
"Foam::dictionary "
"Foam::boundaryTemplates::generatePatchDict"
"("
"const word&, "
"const word&, "
"const word&, "
"const word&, "
"const word&, "
"const dictionary&"
") const"
)
FatalErrorInFunction
<< "Condition " << condition << ": "
<< "No '" << patchType << "' boundary types defined in "
<< categoryDict.dictName() << " templates. "
@ -351,19 +292,7 @@ Foam::dictionary Foam::boundaryTemplates::generatePatchDict
}
else
{
FatalErrorIn
(
"Foam::dictionary "
"Foam::boundaryTemplates::generatePatchDict"
"("
"const word&, "
"const word&, "
"const word&, "
"const word&, "
"const word&, "
"const dictionary&"
") const"
)
FatalErrorInFunction
<< "Condition " << condition << ": "
<< "Invalid boundary condition type '" << patchType
<< "'. Valid types are:" << regionTemplates.toc()
@ -386,14 +315,7 @@ void Foam::boundaryTemplates::checkPatch
if (!regionTemplates.found(category))
{
FatalErrorIn
(
"void Foam::boundaryTemplates::checkPatch"
"("
"const word&, "
"const word&"
") const"
)
FatalErrorInFunction
<< "Condition " << condition << ": "
<< "Unknown category '" << category
<< "'. Valid categories are: " << regionTemplates.toc()
@ -404,14 +326,7 @@ void Foam::boundaryTemplates::checkPatch
if (!categoryDict.found(patchType))
{
FatalErrorIn
(
"void Foam::boundaryTemplates::checkPatch"
"("
"const word&, "
"const word&"
") const"
)
FatalErrorInFunction
<< "Condition " << condition << ": "
<< "Unknown type '" << patchType << "' in category '"
<< category << "'. Valid types are: " << categoryDict.toc()
@ -444,14 +359,7 @@ bool Foam::boundaryTemplates::optionsRequired
}
else
{
FatalErrorIn
(
"bool Foam::boundaryTemplates::optionsRequired"
"("
"const word&, "
"const word&"
") const"
)
FatalErrorInFunction
<< "No type '" << patchType << "' found in category '"
<< category << "'. Valid types are "
<< categoryDict.toc()
@ -460,14 +368,7 @@ bool Foam::boundaryTemplates::optionsRequired
}
else
{
FatalErrorIn
(
"bool Foam::boundaryTemplates::optionsRequired"
"("
"const word&, "
"const word&"
") const"
)
FatalErrorInFunction
<< "No category '" << category << "' found in templates. "
<< "Valid categories are " << templates_.toc()
<< exit(FatalError);

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -40,7 +40,7 @@ Foam::label Foam::caseInfo::findPatchConditionID
{
const wordList& patchGroups = boundaryInfo_.groups()[patchI];
// assign condition according to last condition applied, wins
// Assign condition according to last condition applied, wins
forAllReverse(conditionNames_, conditionI)
{
const wordReList& patchNames = patchNames_[conditionI];
@ -49,17 +49,17 @@ Foam::label Foam::caseInfo::findPatchConditionID
{
if (patchNames[nameI] == patchName)
{
// check for explicit match
// Check for explicit match
return conditionI;
}
else if (patchNames[nameI].match(patchName))
{
// check wildcards
// Check wildcards
return conditionI;
}
else
{
// check for group match
// Check for group match
forAll(patchGroups, groupI)
{
if (patchNames[nameI] == patchGroups[groupI])
@ -71,14 +71,7 @@ Foam::label Foam::caseInfo::findPatchConditionID
}
}
FatalErrorIn
(
"Foam::label Foam::caseInfo::findPatchConditionID"
"("
"const label, "
"const word&"
") const"
)
FatalErrorInFunction
<< "Boundary patch " << patchName << " not defined"
<< exit(FatalError);
@ -94,7 +87,7 @@ void Foam::caseInfo::updateGeometricBoundaryField()
if (!boundaryInfo_.constraint()[i])
{
// condition ID to apply to mesh boundary patch name
// Condition ID to apply to mesh boundary patch name
const label conditionI = findPatchConditionID(i, patchName);
const word& category = patchCategories_[conditionI];
@ -130,7 +123,7 @@ Foam::caseInfo::caseInfo(const Time& runTime, const word& regionName)
patchCategories_(conditionNames_.size()),
patchTypes_(conditionNames_.size())
{
// read the (user-supplied) boundary condition information
// Read the (user-supplied) boundary condition information
Info<< " Reading case properties" << endl;
forAll(conditionNames_, i)
@ -153,7 +146,7 @@ void Foam::caseInfo::checkPatches
const boundaryTemplates& bcTemplates
) const
{
// check that all conditions have been specified correctly wrt templates
// Check that all conditions have been specified correctly wrt templates
forAll(conditionNames_, i)
{
bcTemplates.checkPatch
@ -209,26 +202,18 @@ Foam::dictionary Foam::caseInfo::generateBoundaryField
dictionary patchDict = dictionary::null;
patchDict.add("type", boundaryInfo_.types()[j]);
// add value for processor patches
// Add value for processor patches
patchDict.add("value", "${:internalField}");
boundaryField.add(patchName.c_str(), patchDict);
}
else
{
// condition ID to apply to mesh boundary patch name
// Condition ID to apply to mesh boundary patch name
const label conditionI = findPatchConditionID(j, patchName);
if (conditionI == -1)
{
FatalErrorIn
(
"Foam::dictionary Foam::caseInfo::generateBoundaryField"
"("
"const word&, "
"const word&, "
"const boundaryTemplates&"
") const"
)
FatalErrorInFunction
<< "Unable to find patch " << patchName
<< " in list of boundary conditions"
<< exit(FatalError);
@ -246,7 +231,7 @@ Foam::dictionary Foam::caseInfo::generateBoundaryField
optionDict = bcDict_.subDict(condition).subDict("options");
}
// create the patch dictionary entry
// Create the patch dictionary entry
dictionary patchDict
(
bcTemplates.generatePatchDict

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -243,7 +243,7 @@ int main(int argc, char *argv[])
if (!isDir(baseDir))
{
FatalErrorIn(args.executable())
FatalErrorInFunction
<< "templateDir " << baseDir
<< " should point to the folder containing the "
<< "case set-up templates" << exit(FatalError);

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -59,14 +59,7 @@ Foam::word Foam::solverTemplate::readFromDict
{
if (!dictHeader.headerOk())
{
FatalErrorIn
(
"Foam::word Foam::solverTemplate::readFromDict"
"("
"IOobject&, "
"const word&"
") const"
)
FatalErrorInFunction
<< "Unable to open file "
<< dictHeader.objectPath()
<< exit(FatalError);
@ -142,33 +135,16 @@ Foam::dictionary Foam::solverTemplate::readFluidFieldTemplates
}
else
{
FatalErrorIn
(
"Foam::dictionary "
"Foam::solverTemplate::readFluidFieldTemplates"
"("
"const word&, "
"const fileName&, "
"const dictionary&, "
"const Time&"
") const"
) << "Unhandled turbulence model option " << simulationType
FatalErrorInFunction
<< "Unhandled turbulence model option " << simulationType
<< ". Valid options are laminar, RAS, LES"
<< exit(FatalError);
}
}
else
{
FatalErrorIn
(
"Foam::dictionary Foam::solverTemplate::readFluidFieldTemplates"
"("
"const word&, "
"const fileName&, "
"const dictionary&, "
"const Time&"
") const"
) << "Unhandled turbulence model option " << simulationType
FatalErrorInFunction
<< "Unhandled turbulence model option " << simulationType
<< ". Valid options are turbulenceModel"
<< exit(FatalError);
}