Commit 004a1a8c authored by mattijs's avatar mattijs
Browse files

added triangulate argument

parent dcc53875
...@@ -258,6 +258,7 @@ bool Foam::cuttingPlane::walkCell ...@@ -258,6 +258,7 @@ bool Foam::cuttingPlane::walkCell
void Foam::cuttingPlane::walkCellCuts void Foam::cuttingPlane::walkCellCuts
( (
const primitiveMesh& mesh, const primitiveMesh& mesh,
const bool triangulate,
const UList<label>& edgePoint const UList<label>& edgePoint
) )
{ {
...@@ -293,7 +294,7 @@ void Foam::cuttingPlane::walkCellCuts ...@@ -293,7 +294,7 @@ void Foam::cuttingPlane::walkCellCuts
// Check for the unexpected ... // Check for the unexpected ...
if (startEdgeI == -1) if (startEdgeI == -1)
{ {
FatalErrorIn("Foam::cuttingPlane::walkCellCuts") FatalErrorIn("Foam::cuttingPlane::walkCellCuts(..)")
<< "Cannot find cut edge for cut cell " << cellI << "Cannot find cut edge for cut cell " << cellI
<< abort(FatalError); << abort(FatalError);
} }
...@@ -318,10 +319,18 @@ void Foam::cuttingPlane::walkCellCuts ...@@ -318,10 +319,18 @@ void Foam::cuttingPlane::walkCellCuts
f = f.reverseFace(); f = f.reverseFace();
} }
// the cut faces are usually quite ugly, so always triangulate // the cut faces are usually quite ugly, so optionally triangulate
label nTri = f.triangles(cutPoints, dynCutFaces); if (triangulate)
while (nTri--)
{ {
label nTri = f.triangles(cutPoints, dynCutFaces);
while (nTri--)
{
dynCutCells.append(cellI);
}
}
else
{
dynCutFaces.append(f);
dynCutCells.append(cellI); dynCutCells.append(cellI);
} }
} }
...@@ -346,12 +355,13 @@ Foam::cuttingPlane::cuttingPlane ...@@ -346,12 +355,13 @@ Foam::cuttingPlane::cuttingPlane
( (
const plane& pln, const plane& pln,
const primitiveMesh& mesh, const primitiveMesh& mesh,
const bool triangulate,
const UList<label>& cellIdLabels const UList<label>& cellIdLabels
) )
: :
plane(pln) plane(pln)
{ {
reCut(mesh, cellIdLabels); reCut(mesh, triangulate, cellIdLabels);
} }
...@@ -362,6 +372,7 @@ Foam::cuttingPlane::cuttingPlane ...@@ -362,6 +372,7 @@ Foam::cuttingPlane::cuttingPlane
void Foam::cuttingPlane::reCut void Foam::cuttingPlane::reCut
( (
const primitiveMesh& mesh, const primitiveMesh& mesh,
const bool triangulate,
const UList<label>& cellIdLabels const UList<label>& cellIdLabels
) )
{ {
...@@ -379,7 +390,7 @@ void Foam::cuttingPlane::reCut ...@@ -379,7 +390,7 @@ void Foam::cuttingPlane::reCut
intersectEdges(mesh, dotProducts, edgePoint); intersectEdges(mesh, dotProducts, edgePoint);
// Do topological walk around cell to find closed loop. // Do topological walk around cell to find closed loop.
walkCellCuts(mesh, edgePoint); walkCellCuts(mesh, triangulate, edgePoint);
} }
......
...@@ -105,6 +105,7 @@ class cuttingPlane ...@@ -105,6 +105,7 @@ class cuttingPlane
void walkCellCuts void walkCellCuts
( (
const primitiveMesh& mesh, const primitiveMesh& mesh,
const bool triangulate,
const UList<label>& edgePoint const UList<label>& edgePoint
); );
...@@ -122,6 +123,7 @@ protected: ...@@ -122,6 +123,7 @@ protected:
void reCut void reCut
( (
const primitiveMesh&, const primitiveMesh&,
const bool triangulate,
const UList<label>& cellIdLabels = UList<label>::null() const UList<label>& cellIdLabels = UList<label>::null()
); );
...@@ -138,6 +140,7 @@ public: ...@@ -138,6 +140,7 @@ public:
( (
const plane&, const plane&,
const primitiveMesh&, const primitiveMesh&,
const bool triangulate,
const UList<label>& cellIdLabels = UList<label>::null() const UList<label>& cellIdLabels = UList<label>::null()
); );
......
...@@ -150,11 +150,11 @@ bool Foam::sampledPlane::update() ...@@ -150,11 +150,11 @@ bool Foam::sampledPlane::update()
if (zoneId < 0) if (zoneId < 0)
{ {
reCut(mesh()); reCut(mesh(), true); // always triangulate. Note:Make option?
} }
else else
{ {
reCut(mesh(), mesh().cellZones()[zoneId]); reCut(mesh(), true, mesh().cellZones()[zoneId]);
} }
if (debug) if (debug)
......
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