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

@ -203,12 +203,7 @@ void Foam::externalCoupledFunctionObject::wait() const
{
if (totalTime > timeOut_)
{
FatalErrorIn
(
"void "
"Foam::externalCoupledFunctionObject::wait() "
"const"
)
FatalErrorInFunction
<< "Wait time exceeded time out time of " << timeOut_
<< " s" << abort(FatalError);
}
@ -280,11 +275,8 @@ void Foam::externalCoupledFunctionObject::readColumns
{
if (!masterFilePtr().good())
{
FatalIOErrorIn
(
"externalCoupledFunctionObject::readColumns()",
masterFilePtr()
) << "Trying to read data for processor " << procI
FatalIOErrorInFunction(masterFilePtr())
<< "Trying to read data for processor " << procI
<< " row " << rowI
<< ". Does your file have as many rows as there are"
<< " patch faces (" << globalFaces.size()
@ -347,11 +339,8 @@ void Foam::externalCoupledFunctionObject::readLines
{
if (!masterFilePtr().good())
{
FatalIOErrorIn
(
"externalCoupledFunctionObject::readColumns()",
masterFilePtr()
) << "Trying to read data for processor " << procI
FatalIOErrorInFunction(masterFilePtr())
<< "Trying to read data for processor " << procI
<< " row " << rowI
<< ". Does your file have as many rows as there are"
<< " patch faces (" << globalFaces.size()
@ -542,10 +531,8 @@ Foam::word Foam::externalCoupledFunctionObject::compositeName
{
if (regionNames.size() == 0)
{
FatalErrorIn
(
"externalCoupledFunctionObject::compositeName(const wordList&)"
) << "Empty regionNames" << abort(FatalError);
FatalErrorInFunction
<< "Empty regionNames" << abort(FatalError);
return word::null;
}
else if (regionNames.size() == 1)
@ -586,10 +573,8 @@ void Foam::externalCoupledFunctionObject::checkOrder
sortedOrder(regionNames, order);
if (order != identity(regionNames.size()))
{
FatalErrorIn
(
"externalCoupledFunctionObject::checkOrder(const wordList&)"
) << "regionNames " << regionNames << " not in alphabetical order :"
FatalErrorInFunction
<< "regionNames " << regionNames << " not in alphabetical order :"
<< order << exit(FatalError);
}
}
@ -655,10 +640,7 @@ void Foam::externalCoupledFunctionObject::readData()
if (!ok)
{
WarningIn
(
"void Foam::externalCoupledFunctionObject::readData()"
)
WarningInFunction
<< "Field " << fieldName << " in regions " << compName
<< " was not found." << endl;
}
@ -728,10 +710,7 @@ void Foam::externalCoupledFunctionObject::writeData() const
if (!ok)
{
WarningIn
(
"void Foam::externalCoupledFunctionObject::writeData()"
)
WarningInFunction
<< "Field " << fieldName << " in regions " << compName
<< " was not found." << endl;
}
@ -948,12 +927,7 @@ bool Foam::externalCoupledFunctionObject::read(const dictionary& dict)
{
if (!iter().isDict())
{
FatalIOErrorIn
(
"void Foam::externalCoupledFunctionObject::read"
"(const dictionary&)",
allRegionsDict
)
FatalIOErrorInFunction(allRegionsDict)
<< "Regions must be specified in dictionary format"
<< exit(FatalIOError);
}
@ -973,12 +947,7 @@ bool Foam::externalCoupledFunctionObject::read(const dictionary& dict)
{
if (!regionIter().isDict())
{
FatalIOErrorIn
(
"void Foam::externalCoupledFunctionObject::read"
"(const dictionary&)",
regionDict
)
FatalIOErrorInFunction(regionDict)
<< "Regions must be specified in dictionary format"
<< exit(FatalIOError);
}

View File

@ -73,16 +73,8 @@ bool Foam::externalCoupledFunctionObject::readData
if (!masterFilePtr().good())
{
FatalIOErrorIn
(
"void externalCoupledFunctionObject::readData"
"("
"const UPtrList<const fvMesh>&, "
"const wordRe&, "
"const word&"
")",
masterFilePtr()
) << "Cannot open file for region " << compositeName(regionNames)
FatalIOErrorInFunction(masterFilePtr())
<< "Cannot open file for region " << compositeName(regionNames)
<< ", field " << fieldName
<< exit(FatalIOError);
}
@ -285,15 +277,7 @@ bool Foam::externalCoupledFunctionObject::readData
}
else
{
FatalErrorIn
(
"void externalCoupledFunctionObject::readData"
"("
"const UPtrList<const fvMesh>&, "
"const wordRe&, "
"const word&"
")"
)
FatalErrorInFunction
<< "Unsupported boundary condition " << bf[patchI].type()
<< " for patch " << bf[patchI].patch().name()
<< " in region " << mesh.name()
@ -389,16 +373,8 @@ bool Foam::externalCoupledFunctionObject::writeData
if (!masterFilePtr().good())
{
FatalIOErrorIn
(
"externalCoupledFunctionObject::writeData"
"("
"const UPtrList<const fvMesh>&, "
"const wordRe&, "
"const word&"
") const",
masterFilePtr()
) << "Cannot open file for region " << compositeName(regionNames)
FatalIOErrorInFunction(masterFilePtr())
<< "Cannot open file for region " << compositeName(regionNames)
<< ", field " << fieldName
<< exit(FatalIOError);
}

View File

@ -135,7 +135,7 @@ bool Foam::averageCondition::apply()
if (unprocessedFields.size())
{
WarningIn("bool Foam::averageCondition::apply()")
WarningInFunction
<< "From function object: " << functionObjectName_ << nl
<< "Unprocessed fields:" << nl;

View File

@ -74,17 +74,7 @@ Foam::equationInitialResidualCondition::equationInitialResidualCondition
{
if (!fieldNames_.size())
{
WarningIn
(
"Foam::equationInitialResidualCondition::"
"equationInitialResidualCondition"
"("
"const word&, "
"const objectRegistry&, "
"const dictionary&, "
"functionObjectState&"
")"
)
WarningInFunction
<< "No fields supplied: deactivating" << endl;
active_ = false;
@ -151,10 +141,7 @@ bool Foam::equationInitialResidualCondition::apply()
}
default:
{
FatalErrorIn
(
"bool Foam::equationInitialResidualCondition::apply()"
)
FatalErrorInFunction
<< "Unhandled enumeration "
<< operatingModeNames[mode_]
<< abort(FatalError);
@ -168,7 +155,7 @@ bool Foam::equationInitialResidualCondition::apply()
{
if (result[i] < 0)
{
WarningIn("bool Foam::equationInitialResidualCondition::apply()")
WarningInFunction
<< "Initial residual data not found for field "
<< fieldNames_[i] << endl;
}
@ -180,7 +167,7 @@ bool Foam::equationInitialResidualCondition::apply()
if (!valid)
{
WarningIn("bool Foam::equationInitialResidualCondition::apply()")
WarningInFunction
<< "Initial residual data not found for any fields: "
<< "deactivating" << endl;

View File

@ -59,17 +59,7 @@ Foam::equationMaxIterCondition::equationMaxIterCondition
{
if (!fieldNames_.size())
{
WarningIn
(
"Foam::equationMaxIterCondition::"
"equationMaxIterCondition"
"("
"const word&, "
"const objectRegistry&, "
"const dictionary&, "
"functionObjectState&"
")"
)
WarningInFunction
<< "No fields supplied: deactivating" << endl;
active_ = false;
@ -129,7 +119,7 @@ bool Foam::equationMaxIterCondition::apply()
{
if (result[i] < 0)
{
WarningIn("bool Foam::equationMaxIterCondition::apply()")
WarningInFunction
<< "Number of iterations data not found for field "
<< fieldNames_[i] << endl;
}
@ -141,7 +131,7 @@ bool Foam::equationMaxIterCondition::apply()
if (!valid)
{
WarningIn("bool Foam::equationMaxIterCondition::apply()")
WarningInFunction
<< "Number of iterations data not found for any fields: "
<< "deactivating" << endl;

View File

@ -104,7 +104,7 @@ bool Foam::minMaxCondition::apply()
if (valueType == word::null)
{
WarningIn("bool Foam::minMaxCondition::apply()")
WarningInFunction
<< "Unable to find entry " << fieldName
<< " for function object " << functionObjectName_
<< ". Condition will not be applied."

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.
@ -44,16 +44,8 @@ Foam::autoPtr<Foam::runTimeCondition> Foam::runTimeCondition::New
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorIn
(
"runTimeCondition::New"
"("
"const word&, "
"const objectRegistry&, "
"const dictionary&, "
"functionObjectState&"
")"
) << "Unknown runTimeCondition type "
FatalErrorInFunction
<< "Unknown runTimeCondition type "
<< conditionType << nl << nl
<< "Valid runTimeCondition types are:" << nl
<< dictionaryConstructorTablePtr_->sortedToc()

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.
@ -163,7 +163,7 @@ void Foam::runTimeControl::execute()
if (conditionIter == groupMap_.end())
{
FatalErrorIn("void Foam::runTimeControl::execute()")
FatalErrorInFunction
<< "group " << groupI << " not found in map"
<< abort(FatalError);
}