Commit 5531e2d8 by Amaury Johnen

fix bug reversed triangle (issue #293)

parent c3adb40e
......@@ -288,6 +288,25 @@ void MTriangle::getIntegrationPoints(int pOrder, int *npts, IntPt **pts)
*pts = getGQTPts(pOrder);
}
void MTriangleN::reverse()
{
MVertex *tmp;
tmp = _v[1]; _v[1] = _v[2]; _v[2] = tmp;
int npts = _order-1, base = 0;
std::vector<MVertex*>::iterator begin = _vs.begin() + base;
while (npts > 0) {
std::reverse(begin, begin + 3 * npts);
base += 3 * npts;
if (npts > 2) {
tmp = _vs[base+1]; _vs[base+1] = _vs[base+2]; _vs[base+2] = tmp;
}
npts -= 3;
begin = _vs.begin() + base + 3;
}
}
void MTriangle::reorient(int rot,bool swap)
{
if (rot == 0 && !swap) return;
......
......@@ -340,14 +340,7 @@ class MTriangleN : public MTriangle {
{
return (_order == 2) ? 22 : MTriangle::getTypeForVTK();
}
virtual void reverse()
{
MVertex *tmp;
tmp = _v[1]; _v[1] = _v[2]; _v[2] = tmp;
std::vector<MVertex*> inv;
inv.insert(inv.begin(), _vs.rbegin(), _vs.rend());
_vs = inv;
}
virtual void reverse();
virtual void getNode(int num, double &u, double &v, double &w) const
{
num < 3 ? MTriangle::getNode(num, u, v, w) : MElement::getNode(num, u, v, w);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment