Skip to content
Snippets Groups Projects
Commit 99ca2d6f authored by Amaury Johnen's avatar Amaury Johnen
Browse files

fix MTetrahedronN::getFaceVertices(..)

parent 5b9c2ace
No related branches found
No related tags found
No related merge requests found
...@@ -185,6 +185,20 @@ class MHexahedron : public MElement { ...@@ -185,6 +185,20 @@ class MHexahedron : public MElement {
}; };
return f[face][vert]; return f[face][vert];
} }
static int faces2edge_hexa(const int face, const int edge)
{
// return -iedge - 1 if edge is inverted
// iedge + 1 otherwise
static const int e[6][4] = {
{2, -6, -4, -1},
{1, 5, -9, -3},
{3, 10, -8, -2},
{4, 7, -11, -5},
{6, 8, -12, -7},
{9, 11, 12, -10}
};
return e[face][edge];
}
}; };
/* /*
...@@ -499,40 +513,24 @@ class MHexahedronN : public MHexahedron { ...@@ -499,40 +513,24 @@ class MHexahedronN : public MHexahedron {
{ {
v.resize((_order+1)*(_order+1)); v.resize((_order+1)*(_order+1));
MHexahedron::_getFaceVertices(num, v); MHexahedron::_getFaceVertices(num, v);
// static const int f[6][4] = {
// {0, 3, 2, 1}, int count = 3;
// {0, 1, 5, 4}, int n = _order-1;
// {0, 4, 7, 3}, for (int i = 0; i < 4; i++) {
// {1, 2, 6, 5}, if(faces2edge_hexa(num, i) > 0)
// {2, 3, 7, 6},
// {4, 5, 6, 7}
// };
// this is the local edge number indexed from 1. A minus sign is used to indicate that the nodes of the edge must be inverted in order to obtain a MQuandrangleN
static const int f[6][4] = {
{2,-6,-4,-1},
{1,5,-9,-3},
{3,10,-8,-2},
{4,7,-11,-5},
{6,8,-12,-7},
{9,11,12,-10}
};
int count = 4;
for (int i = 0; i < 4; i++){
if(f[num][i]>0)
{ {
int edge_num = f[num][i]-1; int edge_num = faces2edge_hexa(num, i) - 1;
for (int j = 0; j < _order - 1; j++) v[count++] = _vs[(_order-1)*edge_num+j]; for (int j = 0; j < n; j++) v[++count] = _vs[n*edge_num + j];
} }
else else
{ {
int edge_num = -f[num][i]-1; int edge_num = -faces2edge_hexa(num, i) - 1;
for (int j = _order-2; j > - 1; j--) v[count++] = _vs[(_order-1)*edge_num+j]; for (int j = n-1; j >= 0; j--) v[++count] = _vs[n*edge_num + j];
} }
} }
int N = _order - 1; int start = 12 * n + num * n*n;
int start = 12 * N + num * (_order - 1) * (_order - 1);// -8 as _vs has not the 8 first order nodes for (int i = 0; i < n*n; i++){
for (int i = 0; i < (_order - 1) * (_order - 1); i++){ v[++count] = _vs[start + i];
v[count++] = _vs[start + i];
} }
} }
virtual int getTypeForMSH() const virtual int getTypeForMSH() const
......
...@@ -176,6 +176,18 @@ class MTetrahedron : public MElement { ...@@ -176,6 +176,18 @@ class MTetrahedron : public MElement {
}; };
return f[face][vert]; return f[face][vert];
} }
static int faces2edge_tetra(const int face, const int vert)
{
// return -iedge - 1 if edge is inverted
// iedge + 1 otherwise
static const int e[4][3] = {
{-3, -2, -1},
{ 1, -6, 4},
{-4, 5, 3},
{ 6, 2, -5}
};
return e[face][vert];
}
}; };
/* /*
...@@ -334,12 +346,27 @@ class MTetrahedronN : public MTetrahedron { ...@@ -334,12 +346,27 @@ class MTetrahedronN : public MTetrahedron {
} }
virtual void getFaceVertices(const int num, std::vector<MVertex*> &v) const virtual void getFaceVertices(const int num, std::vector<MVertex*> &v) const
{ {
v.resize(3 + 3 * (_order - 1) + (_order-1) * (_order - 2) /2); v.resize((_order+1) * (_order+2) / 2);
MTetrahedron::_getFaceVertices(num, v); MTetrahedron::_getFaceVertices(num, v);
int j = 3;
int nbV = (_order - 1) * (_order - 2) / 2; int count = 2;
const int ie = (num+1)*nbV; int n = _order-1;
for(int i = num*nbV; i != ie; ++i) v[j++] = _vs[i]; for (int i = 0; i < 3; i++) {
if(faces2edge_tetra(num, i) > 0)
{
int edge_num = faces2edge_tetra(num, i) - 1;
for (int j = 0; j < n; j++) v[++count] = _vs[n*edge_num + j];
}
else
{
int edge_num = -faces2edge_tetra(num, i) - 1;
for (int j = n-1; j >= 0; j--) v[++count] = _vs[n*edge_num + j];
}
}
int start = 6 * n + num * (n-1)*n/2;
for (int i = 0; i < (n-1)*n/2; i++){
v[++count] = _vs[start + i];
}
} }
virtual int getNumVolumeVertices() const virtual int getNumVolumeVertices() const
{ {
......
...@@ -1348,6 +1348,7 @@ void SetOrderN(GModel *m, int order, bool linear, bool incomplete, bool onlyVisi ...@@ -1348,6 +1348,7 @@ void SetOrderN(GModel *m, int order, bool linear, bool incomplete, bool onlyVisi
double worst; double worst;
checkHighOrderTriangles("Surface mesh", m, bad, worst); checkHighOrderTriangles("Surface mesh", m, bad, worst);
checkHighOrderTetrahedron("Volume Mesh", m, bad, worst); checkHighOrderTetrahedron("Volume Mesh", m, bad, worst);
// FIXME : add other element check
Msg::StatusBar(true, "Done meshing order %d (%g s)", order, t2 - t1); Msg::StatusBar(true, "Done meshing order %d (%g s)", order, t2 - t1);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment