ENH: autoHexMesh: warn for unused entries

This commit is contained in:
mattijs
2013-08-09 15:11:05 +01:00
parent 1308248581
commit 736e45960b
2 changed files with 50 additions and 11 deletions

View File

@ -126,14 +126,20 @@ Foam::refinementSurfaces::refinementSurfaces
List<Map<scalar> > regionAngle(surfI);
List<Map<autoPtr<dictionary> > > regionPatchInfo(surfI);
HashSet<word> unmatchedKeys(surfacesDict.toc());
surfI = 0;
forAll(allGeometry.names(), geomI)
{
const word& geomName = allGeometry_.names()[geomI];
if (surfacesDict.found(geomName))
const entry* ePtr = surfacesDict.lookupEntryPtr(geomName, false, true);
if (ePtr)
{
const dictionary& dict = surfacesDict.subDict(geomName);
const dictionary& dict = ePtr->dict();
unmatchedKeys.erase(ePtr->keyword());
names_[surfI] = geomName;
surfaces_[surfI] = geomI;
@ -154,16 +160,17 @@ Foam::refinementSurfaces::refinementSurfaces
|| globalLevelIncr[surfI] < 0
)
{
FatalErrorIn
FatalIOErrorIn
(
"refinementSurfaces::refinementSurfaces"
"(const searchableSurfaces&, const dictionary>&"
"(const searchableSurfaces&, const dictionary>&",
dict
) << "Illegal level specification for surface "
<< names_[surfI]
<< " : minLevel:" << globalMinLevel[surfI]
<< " maxLevel:" << globalMaxLevel[surfI]
<< " levelIncrement:" << globalLevelIncr[surfI]
<< exit(FatalError);
<< exit(FatalIOError);
}
@ -286,17 +293,18 @@ Foam::refinementSurfaces::refinementSurfaces
|| levelIncr < 0
)
{
FatalErrorIn
FatalIOErrorIn
(
"refinementSurfaces::refinementSurfaces"
"(const searchableSurfaces&, const dictionary>&"
"(const searchableSurfaces&, const dictionary&",
dict
) << "Illegal level specification for surface "
<< names_[surfI] << " region "
<< regionNames[regionI]
<< " : minLevel:" << refLevel[0]
<< " maxLevel:" << refLevel[1]
<< " levelIncrement:" << levelIncr
<< exit(FatalError);
<< exit(FatalIOError);
}
@ -328,6 +336,19 @@ Foam::refinementSurfaces::refinementSurfaces
}
}
if (unmatchedKeys.size() > 0)
{
IOWarningIn
(
"refinementSurfaces::refinementSurfaces(..)",
surfacesDict
) << "Not all entries in refinementSurfaces dictionary were used."
<< " The following entries were not used : "
<< unmatchedKeys.sortedToc()
<< endl;
}
// Calculate local to global region offset
label nRegions = 0;

View File

@ -387,15 +387,21 @@ Foam::shellSurfaces::shellSurfaces
distances_.setSize(shellI);
levels_.setSize(shellI);
HashSet<word> unmatchedKeys(shellsDict.toc());
shellI = 0;
forAll(allGeometry.names(), geomI)
forAll(allGeometry_.names(), geomI)
{
const word& geomName = allGeometry_.names()[geomI];
if (shellsDict.found(geomName))
const entry* ePtr = shellsDict.lookupEntryPtr(geomName, false, true);
if (ePtr)
{
const dictionary& dict = ePtr->dict();
unmatchedKeys.erase(ePtr->keyword());
shells_[shellI] = geomI;
const dictionary& dict = shellsDict.subDict(geomName);
modes_[shellI] = refineModeNames_.read(dict.lookup("mode"));
// Read pairs of distance+level
@ -405,6 +411,18 @@ Foam::shellSurfaces::shellSurfaces
}
}
if (unmatchedKeys.size() > 0)
{
IOWarningIn
(
"shellSurfaces::shellSurfaces(..)",
shellsDict
) << "Not all entries in refinementRegions dictionary were used."
<< " The following entries were not used : "
<< unmatchedKeys.sortedToc()
<< endl;
}
// Orient shell surfaces before any searching is done. Note that this
// only needs to be done for inside or outside. Orienting surfaces
// constructs lots of addressing which we want to avoid.