ENH: Recognise already converted boundary file and change fields accordingly.

This commit is contained in:
mattijs
2010-05-04 12:41:01 +01:00
parent 284dd5c4b0
commit 72caa3020b

View File

@ -50,6 +50,7 @@ Usage
#include "volFields.H"
#include "pointFields.H"
#include "surfaceFields.H"
#include "string.H"
using namespace Foam;
@ -90,13 +91,7 @@ void rewriteBoundary
if (word(patchDict["type"]) == cyclicPolyPatch::typeName)
{
if (patchDict.found("neighbourPatch"))
{
Info<< "Patch " << patches[patchI].keyword()
<< " already has 'neighbourPatch' entry; assuming it"
<< " is already converted." << endl;
}
else
if (!patchDict.found("neighbourPatch"))
{
Info<< "Patch " << patches[patchI].keyword()
<< " does not have 'neighbourPatch' entry; assuming it"
@ -130,10 +125,42 @@ void rewriteBoundary
if
(
word(patchDict["type"]) == cyclicPolyPatch::typeName
&& !patchDict.found("neighbourPatch")
)
{
const word& name = oldPatches[patchI].keyword();
if (patchDict.found("neighbourPatch"))
{
patches.set(patchI, oldPatches.set(patchI, NULL));
oldToNew[patchI] = newPatchI++;
// Check if patches come from automatic conversion
word oldName;
string::size_type i = name.rfind("_half0");
if (i != string::npos)
{
oldName = name.substr(0, i);
thisNames.insert(oldName, name);
Info<< "Detected converted cyclic patch " << name
<< " ; assuming it originates from " << oldName
<< endl;
}
else
{
i = name.rfind("_half1");
if (i != string::npos)
{
oldName = name.substr(0, i);
nbrNames.insert(oldName, name);
Info<< "Detected converted cyclic patch " << name
<< " ; assuming it originates from " << oldName
<< endl;
}
}
}
else
{
label nFaces = readLabel(patchDict["nFaces"]);
label startFace = readLabel(patchDict["startFace"]);
@ -194,6 +221,7 @@ void rewriteBoundary
addedPatchI++;
}
}
else
{
patches.set(patchI, oldPatches.set(patchI, NULL));
@ -265,6 +293,7 @@ void rewriteField
dictionary& boundaryField = fieldDict.subDict("boundaryField");
label nChanged = 0;
forAllConstIter(HashTable<word>, thisNames, iter)
{
const word& patchName = iter.key();