Commit 491e4821 authored by mattijs's avatar mattijs
Browse files

ENH: plane sampling: make triangulation optional

parent 31446daa
......@@ -165,6 +165,10 @@ surfaces
//- Optional: restrict to a particular zone
// zone zone1;
//- Optional: do not triangulate (only for surfaceFormats that support
// polygons)
//triangulate false;
}
interpolatedPlane
......
......@@ -45,12 +45,14 @@ Foam::sampledPlane::sampledPlane
const word& name,
const polyMesh& mesh,
const plane& planeDesc,
const keyType& zoneKey
const keyType& zoneKey,
const bool triangulate
)
:
sampledSurface(name, mesh),
cuttingPlane(planeDesc),
zoneKey_(zoneKey),
triangulate_(triangulate),
needsUpdate_(true)
{
if (debug && zoneKey_.size() && mesh.cellZones().findIndex(zoneKey_) < 0)
......@@ -71,6 +73,7 @@ Foam::sampledPlane::sampledPlane
sampledSurface(name, mesh, dict),
cuttingPlane(plane(dict.lookup("basePoint"), dict.lookup("normalVector"))),
zoneKey_(keyType::null),
triangulate_(dict.lookupOrDefault("triangulate", true)),
needsUpdate_(true)
{
// make plane relative to the coordinateSystem (Cartesian)
......@@ -138,11 +141,11 @@ bool Foam::sampledPlane::update()
if (selectedCells.empty())
{
reCut(mesh(), true); // always triangulate. Note:Make option?
reCut(mesh(), triangulate_);
}
else
{
reCut(mesh(), true, selectedCells);
reCut(mesh(), triangulate_, selectedCells);
}
if (debug)
......@@ -250,6 +253,7 @@ void Foam::sampledPlane::print(Ostream& os) const
os << "sampledPlane: " << name() << " :"
<< " base:" << refPoint()
<< " normal:" << normal()
<< " triangulate:" << triangulate_
<< " faces:" << faces().size()
<< " points:" << points().size();
}
......
......@@ -25,7 +25,7 @@ Class
Foam::sampledPlane
Description
A sampledSurface defined by a cuttingPlane. Always triangulated.
A sampledSurface defined by a cuttingPlane. Triangulated by default.
Note
Does not actually cut until update() called.
......@@ -60,6 +60,9 @@ class sampledPlane
//- If restricted to zones, name of this zone or a regular expression
keyType zoneKey_;
//- Triangulated faces or keep faces as is
const bool triangulate_;
//- Track if the surface needs an update
mutable bool needsUpdate_;
......@@ -92,7 +95,8 @@ public:
const word& name,
const polyMesh& mesh,
const plane& planeDesc,
const keyType& zoneKey = word::null
const keyType& zoneKey = word::null,
const bool triangulate = true
);
//- Construct from dictionary
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment