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

added triangulate argument

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