mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Recognise already converted boundary file and change fields accordingly.
This commit is contained in:
@ -50,6 +50,7 @@ Usage
|
|||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
#include "pointFields.H"
|
#include "pointFields.H"
|
||||||
#include "surfaceFields.H"
|
#include "surfaceFields.H"
|
||||||
|
#include "string.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
@ -90,13 +91,7 @@ void rewriteBoundary
|
|||||||
|
|
||||||
if (word(patchDict["type"]) == cyclicPolyPatch::typeName)
|
if (word(patchDict["type"]) == cyclicPolyPatch::typeName)
|
||||||
{
|
{
|
||||||
if (patchDict.found("neighbourPatch"))
|
if (!patchDict.found("neighbourPatch"))
|
||||||
{
|
|
||||||
Info<< "Patch " << patches[patchI].keyword()
|
|
||||||
<< " already has 'neighbourPatch' entry; assuming it"
|
|
||||||
<< " is already converted." << endl;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
Info<< "Patch " << patches[patchI].keyword()
|
Info<< "Patch " << patches[patchI].keyword()
|
||||||
<< " does not have 'neighbourPatch' entry; assuming it"
|
<< " does not have 'neighbourPatch' entry; assuming it"
|
||||||
@ -130,10 +125,42 @@ void rewriteBoundary
|
|||||||
if
|
if
|
||||||
(
|
(
|
||||||
word(patchDict["type"]) == cyclicPolyPatch::typeName
|
word(patchDict["type"]) == cyclicPolyPatch::typeName
|
||||||
&& !patchDict.found("neighbourPatch")
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const word& name = oldPatches[patchI].keyword();
|
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 nFaces = readLabel(patchDict["nFaces"]);
|
||||||
label startFace = readLabel(patchDict["startFace"]);
|
label startFace = readLabel(patchDict["startFace"]);
|
||||||
|
|
||||||
@ -194,6 +221,7 @@ void rewriteBoundary
|
|||||||
|
|
||||||
addedPatchI++;
|
addedPatchI++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
patches.set(patchI, oldPatches.set(patchI, NULL));
|
patches.set(patchI, oldPatches.set(patchI, NULL));
|
||||||
@ -265,6 +293,7 @@ void rewriteField
|
|||||||
dictionary& boundaryField = fieldDict.subDict("boundaryField");
|
dictionary& boundaryField = fieldDict.subDict("boundaryField");
|
||||||
|
|
||||||
label nChanged = 0;
|
label nChanged = 0;
|
||||||
|
|
||||||
forAllConstIter(HashTable<word>, thisNames, iter)
|
forAllConstIter(HashTable<word>, thisNames, iter)
|
||||||
{
|
{
|
||||||
const word& patchName = iter.key();
|
const word& patchName = iter.key();
|
||||||
|
|||||||
Reference in New Issue
Block a user