From a0e443d8a7cd4a166e53c8b111ba4bed650e4ade Mon Sep 17 00:00:00 2001
From: Samuel Melchior <samuel.melchior@uclouvain.be>
Date: Mon, 4 Jan 2010 09:43:20 +0000
Subject: [PATCH] =?UTF-8?q?Bug=20closure=203D=20corrig=C3=A9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 Numeric/polynomialBasis.cpp | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/Numeric/polynomialBasis.cpp b/Numeric/polynomialBasis.cpp
index 9b43f6340c..2221660205 100644
--- a/Numeric/polynomialBasis.cpp
+++ b/Numeric/polynomialBasis.cpp
@@ -675,8 +675,8 @@ static void getFaceClosure(int iFace, int iSign, int iRotate, std::vector<int> &
     closure[0] = 0;
     break;
   default:
-    int face[4][3] = {{0, 1, 2}, {0, 4, -3}, {1, 5, -4}, {-2, 5, -3}};
-    int order1node[4][3] = {{0, 1, 2}, {0, 1, 3}, {1, 2, 3}, {0, 2, 3}};
+    int face[4][3] = {{-3, -2, -1}, {1, -6, 4}, {-4, 5, 3}, {6, 2, -5}};
+    int order1node[4][3] = {{0, 2, 1}, {0, 1, 3}, {0, 3, 2}, {3, 1, 2}};
     // int facedofstmp[200];
     // face 0 | 0 1 2
     // face 1 | 0 4 -3
@@ -687,19 +687,19 @@ static void getFaceClosure(int iFace, int iSign, int iRotate, std::vector<int> &
     // edge 2   |  4+2*(order-1)-> 4+ 3*(order-1)-1
     // edge k   |  4+k*(order-1) -> 4+(k+1)*(order-1)-1
     for (int i = 0; i < 3; ++i){
-      int k = (3 + (iSign * i) + iRotate) % 3;
+      int k = (3 + (iSign * i) + iRotate) % 3;	//- iSign * iRotate
       closure[i] = order1node[iFace][k];
     }
     for (int i = 0;i < 3; ++i){
       int edgenumber = iSign * 
-        face[iFace][(6 + i * iSign + (-1 + iSign) / 2 + iRotate) % 3];
+        face[iFace][(6 + i * iSign + (-1 + iSign) / 2 + iRotate) % 3];	//- iSign * iRotate
       for (int k = 0; k < (order - 1); k++){
-	if (edgenumber > 0 || ((edgenumber == 0) && (iSign > 0)))
+	if (edgenumber > 0)
 	  closure[3 + i * (order - 1) + k] =
-            4 + edgenumber * (order - 1) + k;
+            4 + (edgenumber - 1) * (order - 1) + k;
 	else
 	  closure[3 + i * (order - 1) + k] =
-            4 + (1 - edgenumber) * (order - 1) - 1 - k; 
+            4 + (-edgenumber) * (order - 1) - 1 - k; 
       }
     }
     int fi = 3 + 3 * (order - 1);
@@ -710,13 +710,13 @@ static void getFaceClosure(int iFace, int iSign, int iRotate, std::vector<int> &
       int orderint = order - 3 - k * 3;
       if (orderint > 0){
 	for (int ci = 0; ci < 3 ; ci++){
-	  int  shift = (3 + iSign * ci + iRotate) % 3;
+	  int  shift = (3 + iSign * ci + iRotate) % 3;	//- iSign * iRotate
 	  closure[fi + ci] = ti + shift;
 	}
 	fi = fi + 3; ti = ti + 3;
 	for (int l = 0; l < orderint - 1; l++){
 	  for (int ei = 0; ei < 3; ei++){
-            int edgenumber = (6 + ei * iSign + (-1 + iSign) / 2 + iRotate) % 3;
+            int edgenumber = (6 + ei * iSign + (-1 + iSign) / 2 + iRotate) % 3;	//- iSign * iRotate
             if (iSign > 0) 
               closure[fi + ei * (orderint - 1) + l] = 
                 ti + edgenumber * (orderint - 1) + l;
-- 
GitLab