Commit eafd5a38 authored by Andrew Heather's avatar Andrew Heather
Browse files

ENH: Updated Info, Warning and Error messages

parent ae95edee
......@@ -58,7 +58,7 @@
if (magnetZonei == -1)
{
FatalIOErrorIn(args.executable().c_str(), transportProperties)
FatalIOErrorInFunction(transportProperties)
<< "Cannot find faceZone for magnet " << magnets[i].name()
<< exit(FatalIOError);
}
......
......@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -225,7 +225,7 @@ int main(int argc, char *argv[])
}
if (pointI != nNodes)
{
FatalIOErrorIn(args.executable().c_str(), nodeStream)
FatalIOErrorInFunction(nodeStream)
<< "Only " << pointI << " nodes present instead of " << nNodes
<< " from header." << exit(FatalIOError);
}
......@@ -258,7 +258,7 @@ int main(int argc, char *argv[])
if (nPtsPerTet != 4)
{
FatalIOErrorIn(args.executable().c_str(), eleStream)
FatalIOErrorInFunction(eleStream)
<< "Cannot handle tets with "
<< nPtsPerTet << " points per tetrahedron in .ele file" << endl
<< "Can only handle tetrahedra with four points"
......@@ -377,7 +377,7 @@ int main(int argc, char *argv[])
if (nFaceAttr != 1)
{
FatalIOErrorIn(args.executable().c_str(), faceStream)
FatalIOErrorInFunction(faceStream)
<< "Expect boundary markers to be"
<< " present in .face file." << endl
<< "This is the second number in the header which is now:"
......
......@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -1523,7 +1523,7 @@ int main(int argc, char *argv[])
// Check
if (dict.found("faceSets"))
{
FatalIOErrorIn(args.executable().c_str(), dict)
FatalIOErrorInFunction(dict)
<< "Please supply faces to extrude either through 'faceZones'"
<< " or 'faceSets' entry. Found both."
<< exit(FatalIOError);
......@@ -1567,7 +1567,7 @@ int main(int argc, char *argv[])
if (shellRegionName == regionName)
{
FatalIOErrorIn(args.executable().c_str(), dict)
FatalIOErrorInFunction(dict)
<< "Cannot extrude into same region as mesh." << endl
<< "Mesh region : " << regionName << endl
<< "Shell region : " << shellRegionName
......@@ -1693,7 +1693,7 @@ int main(int argc, char *argv[])
meshZoneID[i] = faceZones.findZoneID(zoneNames[i]);
if (meshZoneID[i] == -1)
{
FatalIOErrorIn(args.executable().c_str(), dict)
FatalIOErrorInFunction(dict)
<< "Cannot find zone " << zoneNames[i] << endl
<< "Valid zones are " << faceZones.names()
<< exit(FatalIOError);
......@@ -1740,7 +1740,7 @@ int main(int argc, char *argv[])
zoneShadowIDs[i] = faceZones.findZoneID(zoneShadowNames[i]);
if (zoneShadowIDs[i] == -1)
{
FatalIOErrorIn(args.executable().c_str(), dict)
FatalIOErrorInFunction(dict)
<< "Cannot find zone " << zoneShadowNames[i] << endl
<< "Valid zones are " << faceZones.names()
<< exit(FatalIOError);
......@@ -1803,7 +1803,7 @@ int main(int argc, char *argv[])
label faceI = iter.key();
if (mesh.isInternalFace(faceI))
{
FatalIOErrorIn(args.executable().c_str(), dict)
FatalIOErrorInFunction(dict)
<< "faceSet " << fz.name()
<< "contains internal faces."
<< " This is not permitted."
......@@ -1843,7 +1843,7 @@ int main(int argc, char *argv[])
if (nExtrudeFaces != nShadowFaces)
{
FatalIOErrorIn(args.executable().c_str(), dict)
FatalIOErrorInFunction(dict)
<< "Extruded faces " << nExtrudeFaces << endl
<< "is different from shadow faces. " << nShadowFaces
<< "This is not permitted " << endl
......@@ -1863,7 +1863,7 @@ int main(int argc, char *argv[])
label faceI = iter.key();
if (mesh.isInternalFace(faceI))
{
FatalIOErrorIn(args.executable().c_str(), dict)
FatalIOErrorInFunction(dict)
<< "faceSet " << fz.name()
<< "contains internal faces."
<< " This is not permitted."
......
......@@ -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.
......@@ -60,7 +60,7 @@ void Foam::printMeshStats(const polyMesh& mesh, const bool allTopology)
if (returnReduce(mesh.nInternalPoints(), minOp<label>()) == -1)
{
WarningIn("Foam::printMeshStats(const polyMesh&, const bool)")
WarningInFunction
<< "Some processors have their points sorted into internal"
<< " and external and some do not." << endl
<< "This can cause problems later on." << endl;
......
......@@ -300,7 +300,7 @@ void determineDecomposition
if (!decomposer.parallelAware())
{
WarningIn("determineDecomposition(..)")
WarningInFunction
<< "You have selected decomposition method "
<< decomposer.typeName
<< " which does" << endl
......@@ -543,11 +543,8 @@ void writeProcAddressing
if (!cellOk || !faceOk || !pointOk || !patchOk)
{
WarningIn
(
"void writeProcAddressing"
"(const bool, const fvMesh&, const mapDistributePolyMesh&)"
) << "Failed to write " << cellMap.objectPath()
WarningInFunction
<< "Failed to write " << cellMap.objectPath()
<< ", " << faceMap.objectPath()
<< ", " << pointMap.objectPath()
<< ", " << patchMap.objectPath()
......@@ -785,7 +782,7 @@ void correctCoupledBoundaryConditions(fvMesh& mesh)
}
else
{
FatalErrorIn("correctCoupledBoundaryConditions()")
FatalErrorInFunction
<< "Unsuported communications type "
<< Pstream::commsTypeNames[Pstream::defaultCommsType]
<< exit(FatalError);
......@@ -865,7 +862,7 @@ autoPtr<mapDistributePolyMesh> redistributeAndWrite
if (nonProcI == -1)
{
FatalErrorIn("redistributeAndWrite(..)")
FatalErrorInFunction
<< "Cannot find non-processor patch on processor "
<< Pstream::myProcNo() << endl
<< " Current patches:" << patches.names()
......@@ -1508,11 +1505,8 @@ void readProcAddressing
|| mesh.boundaryMesh().size() != boundaryProcAddressing.size()
)
{
FatalErrorIn
(
"readProcAddressing(const fvMesh&, const autoPtr<fvMesh>&,"
"autoPtr<mapDistributePolyMesh>&"
) << "Read addressing inconsistent with mesh sizes" << nl
FatalErrorInFunction
<< "Read addressing inconsistent with mesh sizes" << nl
<< "cells:" << mesh.nCells()
<< " addressing:" << cellProcAddressing.objectPath()
<< " size:" << cellProcAddressing.size() << nl
......@@ -2173,7 +2167,7 @@ int main(int argc, char *argv[])
if (env("FOAM_SIGFPE"))
{
WarningIn(args.executable())
WarningInFunction
<< "Detected floating point exception trapping (FOAM_SIGFPE)."
<< " This might give" << nl
<< " problems when mapping fields. Switch it off in case"
......@@ -2191,7 +2185,7 @@ int main(int argc, char *argv[])
Info<< "Decomposing case (like decomposePar)" << nl << endl;
if (reconstruct)
{
FatalErrorIn(args.executable())
FatalErrorInFunction
<< "Cannot specify both -decompose and -reconstruct"
<< exit(FatalError);
}
......@@ -2206,7 +2200,7 @@ int main(int argc, char *argv[])
{
if (!overwrite)
{
WarningIn(args.executable())
WarningInFunction
<< "Working in decompose or reconstruction mode automatically"
<< " implies -overwrite" << nl << endl;
overwrite = true;
......@@ -2216,7 +2210,7 @@ int main(int argc, char *argv[])
if (!Pstream::parRun())
{
FatalErrorIn(args.executable())
FatalErrorInFunction
<< ": This utility can only be run parallel"
<< exit(FatalError);
}
......@@ -2224,7 +2218,7 @@ int main(int argc, char *argv[])
if (!isDir(args.rootPath()))
{
FatalErrorIn(args.executable())
FatalErrorInFunction
<< ": cannot open root directory " << args.rootPath()
<< exit(FatalError);
}
......@@ -2375,7 +2369,7 @@ int main(int argc, char *argv[])
if (timeDirs.empty())
{
FatalErrorIn(args.executable())
FatalErrorInFunction
<< "No times selected"
<< exit(FatalError);
}
......
......@@ -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);
......
......@@ -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
......
......@@ -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);
......
......@@ -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"
)