mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: topoSet: added pointToCell/Face with edge option
This commit is contained in:
@ -86,6 +86,7 @@ FoamFile
|
||||
// set p0;
|
||||
// option any; // cell with any point in pointSet
|
||||
// //option all; // cell with all points in pointSet
|
||||
// //option edge; // cell with an edge with both points in pointSet
|
||||
// }
|
||||
//
|
||||
// // Select based on cellShape
|
||||
@ -198,6 +199,7 @@ FoamFile
|
||||
// set p0;
|
||||
// option any; // Faces using any point in pointSet
|
||||
// //option all // Faces with all points in pointSet
|
||||
// //option edge // Faces with two consecutive points in pointSet
|
||||
// }
|
||||
//
|
||||
// // Select by explicitly providing face labels
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -41,10 +41,11 @@ namespace Foam
|
||||
const char* Foam::NamedEnum
|
||||
<
|
||||
Foam::pointToCell::pointAction,
|
||||
1
|
||||
2
|
||||
>::names[] =
|
||||
{
|
||||
"any"
|
||||
"any",
|
||||
"edge"
|
||||
};
|
||||
}
|
||||
|
||||
@ -52,11 +53,12 @@ namespace Foam
|
||||
Foam::topoSetSource::addToUsageTable Foam::pointToCell::usage_
|
||||
(
|
||||
pointToCell::typeName,
|
||||
"\n Usage: pointToCell <pointSet> any\n\n"
|
||||
" Select all cells with any point in the pointSet\n\n"
|
||||
"\n Usage: pointToCell <pointSet> any|edge\n\n"
|
||||
" Select all cells with any point ('any') or any edge ('edge')"
|
||||
" in the pointSet\n\n"
|
||||
);
|
||||
|
||||
const Foam::NamedEnum<Foam::pointToCell::pointAction, 1>
|
||||
const Foam::NamedEnum<Foam::pointToCell::pointAction, 2>
|
||||
Foam::pointToCell::pointActionNames_;
|
||||
|
||||
|
||||
@ -82,6 +84,26 @@ void Foam::pointToCell::combine(topoSet& set, const bool add) const
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (option_ == EDGE)
|
||||
{
|
||||
const faceList& faces = mesh_.faces();
|
||||
forAll(faces, faceI)
|
||||
{
|
||||
const face& f = faces[faceI];
|
||||
|
||||
forAll(f, fp)
|
||||
{
|
||||
if (loadedSet.found(f[fp]) && loadedSet.found(f.nextLabel(fp)))
|
||||
{
|
||||
addOrDelete(set, mesh_.faceOwner()[faceI], add);
|
||||
if (mesh_.isInternalFace(faceI))
|
||||
{
|
||||
addOrDelete(set, mesh_.faceNeighbour()[faceI], add);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -55,7 +55,8 @@ public:
|
||||
//- Enumeration defining the valid options
|
||||
enum pointAction
|
||||
{
|
||||
ANY // Cells using any point in set
|
||||
ANY, // Cells using any point in set
|
||||
EDGE // Cells using an edge with both points in set
|
||||
//ALL // Possible extension: cells whose all points are in set
|
||||
};
|
||||
|
||||
@ -64,7 +65,7 @@ private:
|
||||
//- Add usage string
|
||||
static addToUsageTable usage_;
|
||||
|
||||
static const NamedEnum<pointAction, 1> pointActionNames_;
|
||||
static const NamedEnum<pointAction, 2> pointActionNames_;
|
||||
|
||||
//- Name of set to use
|
||||
word setName_;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -41,11 +41,12 @@ namespace Foam
|
||||
const char* Foam::NamedEnum
|
||||
<
|
||||
Foam::pointToFace::pointAction,
|
||||
2
|
||||
3
|
||||
>::names[] =
|
||||
{
|
||||
"any",
|
||||
"all"
|
||||
"all",
|
||||
"edge"
|
||||
};
|
||||
}
|
||||
|
||||
@ -53,13 +54,14 @@ namespace Foam
|
||||
Foam::topoSetSource::addToUsageTable Foam::pointToFace::usage_
|
||||
(
|
||||
pointToFace::typeName,
|
||||
"\n Usage: pointToFace <pointSet> any|all\n\n"
|
||||
"\n Usage: pointToFace <pointSet> any|all|edge\n\n"
|
||||
" Select faces with\n"
|
||||
" -any point in the pointSet\n"
|
||||
" -all points in the pointSet\n\n"
|
||||
" -two consecutive points (an edge) in the pointSet\n\n"
|
||||
);
|
||||
|
||||
const Foam::NamedEnum<Foam::pointToFace::pointAction, 2>
|
||||
const Foam::NamedEnum<Foam::pointToFace::pointAction, 3>
|
||||
Foam::pointToFace::pointActionNames_;
|
||||
|
||||
|
||||
@ -126,6 +128,23 @@ void Foam::pointToFace::combine(topoSet& set, const bool add) const
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (option_ == EDGE)
|
||||
{
|
||||
const faceList& faces = mesh_.faces();
|
||||
forAll(faces, faceI)
|
||||
{
|
||||
const face& f = faces[faceI];
|
||||
|
||||
forAll(f, fp)
|
||||
{
|
||||
if (loadedSet.found(f[fp]) && loadedSet.found(f.nextLabel(fp)))
|
||||
{
|
||||
addOrDelete(set, faceI, add);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -58,7 +58,8 @@ public:
|
||||
enum pointAction
|
||||
{
|
||||
ANY,
|
||||
ALL
|
||||
ALL,
|
||||
EDGE
|
||||
};
|
||||
|
||||
|
||||
@ -67,7 +68,7 @@ private:
|
||||
//- Add usage string
|
||||
static addToUsageTable usage_;
|
||||
|
||||
static const NamedEnum<pointAction, 2> pointActionNames_;
|
||||
static const NamedEnum<pointAction, 3> pointActionNames_;
|
||||
|
||||
//- Name of set to use
|
||||
word setName_;
|
||||
|
||||
Reference in New Issue
Block a user