mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: surfaceSubset: add select-by-plane
This commit is contained in:
@ -42,6 +42,7 @@ Description
|
||||
#include "treeDataTriSurface.H"
|
||||
#include "Random.H"
|
||||
#include "volumeType.H"
|
||||
#include "plane.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
@ -277,6 +278,31 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
|
||||
if (meshSubsetDict.found("plane"))
|
||||
{
|
||||
const dictionary& planeDict = meshSubsetDict.subDict("plane");
|
||||
|
||||
const plane pl(planeDict);
|
||||
const scalar distance(readScalar(planeDict.lookup("distance")));
|
||||
const scalar cosAngle(readScalar(planeDict.lookup("cosAngle")));
|
||||
|
||||
// Select all triangles that are close to the plane and
|
||||
// whose normal aligns with the plane as well.
|
||||
|
||||
forAll(surf1.faceCentres(), faceI)
|
||||
{
|
||||
const point& fc = surf1.faceCentres()[faceI];
|
||||
const point& nf = surf1.faceNormals()[faceI];
|
||||
|
||||
if (pl.distance(fc) < distance && mag(pl.normal() & nf) > cosAngle)
|
||||
{
|
||||
facesToSubset[faceI] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// pick up specified "faces"
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user