+
+/*
+// N3
+// +
+// /|\
+// 7/ | \8
+// / |4 \ QUADRATIC
+// N0 +---|---+ N1 TETRAHEDRON
+// \ +9 /
+// \ | /
+// 6\ | /5
+// \|/
+// +
+// N2
+*/
+static int QuadTetra_F [4][7] = { // FORWARD == EXTERNAL
+ { 0, 4, 1, 5, 2, 6, 0 }, // All faces have external normals
+ { 0, 7, 3, 8, 1, 4, 0 },
+ { 1, 8, 3, 9, 2, 5, 1 },
+ { 0, 6, 2, 9, 3, 7, 0 }};
+static int QuadTetra_R [4][7] = { // REVERSED
+ { 0, 4, 1, 5, 2, 6, 0 }, // All faces but a bottom have external normals
+ { 0, 4, 1, 8, 3, 7, 0 },
+ { 1, 5, 2, 9, 3, 8, 1 },
+ { 0, 7, 3, 9, 2, 6, 0 }};
+static int QuadTetra_RE [4][7] = { // REVERSED -> FORWARD (EXTERNAL)
+ { 0, 6, 2, 5, 1, 4, 0 }, // All faces have external normals
+ { 0, 4, 1, 8, 3, 7, 0 },
+ { 1, 5, 2, 9, 3, 8, 1 },
+ { 0, 7, 3, 9, 2, 6, 0 }};
+static int QuadTetra_nbN [] = { 6, 6, 6, 6 };
+
+//
+// QUADRATIC
+// PYRAMID
+//
+// +4
+//
+//
+// 10+-----+11
+// | | 9 - middle point for (0,4) etc.
+// | |
+// 9+-----+12
+//
+// 6
+// 1+----+----+2
+// | |
+// | |
+// 5+ +7
+// | |
+// | |
+// 0+----+----+3
+// 8
+static int QuadPyram_F [5][9] = { // FORWARD == EXTERNAL
+ { 0, 5, 1, 6, 2, 7, 3, 8, 0 }, // All faces have external normals
+ { 0, 9, 4, 10,1, 5, 0, 4, 4 },
+ { 1, 10,4, 11,2, 6, 1, 4, 4 },
+ { 2, 11,4, 12,3, 7, 2, 4, 4 },
+ { 3, 12,4, 9, 0, 8, 3, 4, 4 }};
+static int QuadPyram_R [5][9] = { // REVERSED
+ { 0, 5, 1, 6, 2, 7, 3, 8, 0 }, // All faces but a bottom have external normals
+ { 0, 5, 1, 10,4, 9, 0, 4, 4 },
+ { 1, 6, 2, 11,4, 10,1, 4, 4 },
+ { 2, 7, 3, 12,4, 11,2, 4, 4 },
+ { 3, 8, 0, 9, 4, 12,3, 4, 4 }};
+static int QuadPyram_RE [5][9] = { // REVERSED -> FORWARD (EXTERNAL)
+ { 0, 8, 3, 7, 2, 6, 1, 5, 0 }, // All faces but a bottom have external normals
+ { 0, 5, 1, 10,4, 9, 0, 4, 4 },
+ { 1, 6, 2, 11,4, 10,1, 4, 4 },
+ { 2, 7, 3, 12,4, 11,2, 4, 4 },
+ { 3, 8, 0, 9, 4, 12,3, 4, 4 }};
+static int QuadPyram_nbN [] = { 8, 6, 6, 6, 6 };
+
+/*
+// + N4
+// /|\
+// 9/ | \10
+// / | \
+// / | \
+// N3 +----+----+ N5
+// | |11 |
+// | | |
+// | +13 | QUADRATIC
+// | | | PENTAHEDRON
+// | | |
+// | | |
+// | | |
+// 12+ | +14
+// | | |
+// | | |
+// | + N1 |
+// | / \ |
+// | 6/ \7 |
+// | / \ |
+// |/ \|
+// N0 +---------+ N2
+// 8
+*/
+static int QuadPenta_F [5][9] = { // FORWARD
+ { 0, 6, 1, 7, 2, 8, 0, 0, 0 }, // Top face has an internal normal, other - external
+ { 3, 9, 4, 10,5, 11,3, 3, 3 }, // 0 is bottom, 1 is top face
+ { 0, 8, 2, 14,5, 11,3, 12,0 },
+ { 1, 13,4, 10,5, 14,2, 7, 1 },
+ { 0, 12,3, 9, 4, 13,1, 6, 0 }};
+static int QuadPenta_R [5][9] = { // REVERSED
+ { 0, 6, 1, 7, 2, 8, 0, 0, 0 }, // Bottom face has an internal normal, other - external
+ { 3, 9, 4, 10,5, 11,3, 3, 3 }, // 0 is bottom, 1 is top face
+ { 0, 12,3, 11,5, 14,2, 8, 0 },
+ { 1, 7, 2, 14,5, 10,4, 13,1 },
+ { 0, 6, 1, 13,4, 9, 3, 12,0 }};
+static int QuadPenta_FE [5][9] = { // FORWARD -> EXTERNAL
+ { 0, 6, 1, 7, 2, 8, 0, 0, 0 },
+ { 3,11, 5, 10,4, 9, 3, 3, 3 },
+ { 0, 8, 2, 14,5, 11,3, 12,0 },
+ { 1, 13,4, 10,5, 14,2, 7, 1 },
+ { 0, 12,3, 9, 4, 13,1, 6, 0 }};
+static int QuadPenta_RE [5][9] = { // REVERSED -> EXTERNAL
+ { 0, 8, 2, 7, 1, 6, 0, 0, 0 },
+ { 3, 9, 4, 10,5, 11,3, 3, 3 },
+ { 0, 12,3, 11,5, 14,2, 8, 0 },
+ { 1, 7, 2, 14,5, 10,4, 13,1 },
+ { 0, 6, 1, 13,4, 9, 3, 12,0 }};
+static int QuadPenta_nbN [] = { 6, 6, 8, 8, 8 };
+
+/*
+// 13
+// N5+-----+-----+N6
+// /| /|
+// 12+ | 14+ |
+// / | / |
+// N4+-----+-----+N7 | QUADRATIC
+// | | 15 | | HEXAHEDRON
+// | | | |
+// | 17+ | +18
+// | | | |
+// | | | |
+// | | | |
+// 16+ | +19 |
+// | | | |
+// | | 9 | |
+// | N1+-----+-|---+N2
+// | / | /
+// | +8 | +10
+// |/ |/
+// N0+-----+-----+N3
+// 11
+*/
+static int QuadHexa_F [6][9] = { // FORWARD
+ { 0, 8, 1, 9, 2, 10,3, 11,0 }, // opposite faces are neighbouring,
+ { 4, 12,5, 13,6, 14,7, 15,4 }, // odd face(1,3,5) normal is internal, even(0,2,4) - external
+ { 1, 8, 0, 16,4, 12,5, 17,1 }, // same index nodes of opposite faces are linked
+ { 2, 10,3, 19,7, 14,6, 18,2 },
+ { 0, 11,3, 19,7, 15,4, 16,0 },
+ { 1, 9, 2, 18,6, 13,5, 17,1 }};
+// static int Hexa_R [6][5] = { // REVERSED
+// { 0, 3, 2, 1, 0 }, // opposite faces are neighbouring,
+// { 4, 7, 6, 5, 4 }, // odd face(1,3,5) normal is external, even(0,2,4) - internal
+// { 1, 5, 4, 0, 1 }, // same index nodes of opposite faces are linked
+// { 2, 6, 7, 3, 2 },
+// { 0, 4, 7, 3, 0 },
+// { 1, 5, 6, 2, 1 }};
+static int QuadHexa_FE [6][9] = { // FORWARD -> EXTERNAL
+ { 0, 8, 1, 9, 2, 10,3, 11,0 }, // opposite faces are neighbouring,
+ { 4, 15,7, 14,6, 13,5, 12,4 }, // all face normals are external,
+ { 0, 16,4, 12,5, 17,1, 8, 0 }, // links in opposite faces: 0-0, 1-3, 2-2, 3-1
+ { 3, 10,2, 18,6, 14,7, 19,3 },
+ { 0, 11,3, 19,7, 15,4, 16,0 },
+ { 1, 17,5, 13,6, 18,2, 9, 1 }};
+static int QuadHexa_RE [6][9] = { // REVERSED -> EXTERNAL
+ { 0, 11,3, 10,2, 9, 1, 8, 0 }, // opposite faces are neighbouring,
+ { 4, 12,5, 13,6, 14,7, 15,4 }, // all face normals are external,
+ { 0, 8, 1, 17,5, 12,4, 16,0 }, // links in opposite faces: 0-0, 1-3, 2-2, 3-1
+ { 3, 19,7, 14,6, 18,2, 10,3 },
+ { 0, 16,4, 15,7, 19,3, 11,0 },
+ { 1, 9, 2, 18,6, 13,5, 17,1 }};
+static int QuadHexa_nbN [] = { 8, 8, 8, 8, 8, 8 };
+
+