ENH: setsToFaceZone: allow flipping

This commit is contained in:
mattijs
2013-10-17 14:04:22 +01:00
parent cfcd1ab30b
commit 7a2269eccb
3 changed files with 31 additions and 14 deletions

View File

@ -368,6 +368,8 @@ FoamFile
// { // {
// faceSet f0; // name of faceSet // faceSet f0; // name of faceSet
// cellSet c0; // name of cellSet of slave side // cellSet c0; // name of cellSet of slave side
// flip false; // optional: flip the faceZone (so now the cellSet
// // is the master side)
// } // }
// //
// // Select based on surface. Orientation from normals on surface // // Select based on surface. Orientation from normals on surface

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -56,12 +56,14 @@ Foam::setsToFaceZone::setsToFaceZone
( (
const polyMesh& mesh, const polyMesh& mesh,
const word& faceSetName, const word& faceSetName,
const word& cellSetName const word& cellSetName,
const Switch& flip
) )
: :
topoSetSource(mesh), topoSetSource(mesh),
faceSetName_(faceSetName), faceSetName_(faceSetName),
cellSetName_(cellSetName) cellSetName_(cellSetName),
flip_(flip)
{} {}
@ -74,7 +76,8 @@ Foam::setsToFaceZone::setsToFaceZone
: :
topoSetSource(mesh), topoSetSource(mesh),
faceSetName_(dict.lookup("faceSet")), faceSetName_(dict.lookup("faceSet")),
cellSetName_(dict.lookup("cellSet")) cellSetName_(dict.lookup("cellSet")),
flip_(dict.lookupOrDefault("flip", false))
{} {}
@ -87,7 +90,8 @@ Foam::setsToFaceZone::setsToFaceZone
: :
topoSetSource(mesh), topoSetSource(mesh),
faceSetName_(checkIs(is)), faceSetName_(checkIs(is)),
cellSetName_(checkIs(is)) cellSetName_(checkIs(is)),
flip_(false)
{} {}
@ -136,7 +140,7 @@ void Foam::setsToFaceZone::applyToSet
if (!fzSet.found(faceI)) if (!fzSet.found(faceI))
{ {
bool flip = false; bool flipFace = false;
label own = mesh_.faceOwner()[faceI]; label own = mesh_.faceOwner()[faceI];
bool ownFound = cSet.found(own); bool ownFound = cSet.found(own);
@ -148,11 +152,11 @@ void Foam::setsToFaceZone::applyToSet
if (ownFound && !neiFound) if (ownFound && !neiFound)
{ {
flip = false; flipFace = false;
} }
else if (!ownFound && neiFound) else if (!ownFound && neiFound)
{ {
flip = true; flipFace = true;
} }
else else
{ {
@ -174,11 +178,17 @@ void Foam::setsToFaceZone::applyToSet
} }
else else
{ {
flip = !ownFound; flipFace = !ownFound;
}
if (flip_)
{
flipFace = !flipFace;
} }
newAddressing.append(faceI); newAddressing.append(faceI);
newFlipMap.append(flip); newFlipMap.append(flipFace);
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -36,6 +36,7 @@ SourceFiles
#define setsToFaceZone_H #define setsToFaceZone_H
#include "topoSetSource.H" #include "topoSetSource.H"
#include "Switch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -56,10 +57,13 @@ class setsToFaceZone
static addToUsageTable usage_; static addToUsageTable usage_;
//- Name of set to use //- Name of set to use
word faceSetName_; const word faceSetName_;
//- Name of set to use //- Name of set to use
word cellSetName_; const word cellSetName_;
//- Whether cellSet is slave cells or master cells
const Switch flip_;
public: public:
@ -73,7 +77,8 @@ public:
( (
const polyMesh& mesh, const polyMesh& mesh,
const word& faceSetName, const word& faceSetName,
const word& cellSetName const word& cellSetName,
const Switch& flip
); );
//- Construct from dictionary //- Construct from dictionary