From 383acfc6c29eda12b1a1a98eaeae747bf143c147 Mon Sep 17 00:00:00 2001
From: Jonathan Lambrechts <jonathan.lambrechts@uclouvain.be>
Date: Mon, 2 May 2011 11:26:10 +0000
Subject: [PATCH] dgDataCacheMap : compute normals in POINT_MODE on interfaces

---
 Numeric/polynomialBasis.h | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/Numeric/polynomialBasis.h b/Numeric/polynomialBasis.h
index f26edd968f..f330f7651e 100644
--- a/Numeric/polynomialBasis.h
+++ b/Numeric/polynomialBasis.h
@@ -125,9 +125,7 @@ class polynomialBasis
       }
     }
   }
-  // I would favour this interface that allows optimizations (not
-  // implemented) and is easier to bind
-  inline void f(fullMatrix<double> &coord, fullMatrix<double> &sf)
+  inline void f(fullMatrix<double> &coord, fullMatrix<double> &sf) const
   {
     double p[1256];
     sf.resize (coord.size1(), coefficients.size1());
@@ -138,6 +136,21 @@ class polynomialBasis
           sf(iPoint,i) += coefficients(i, j) * p[j];
     }
   }
+  inline void df(fullMatrix<double> &coord, fullMatrix<double> &dfm) const
+  {
+    double dfv[1256][3];
+    dfm.resize (coefficients.size1(), coord.size1() * 3, false);
+    int ii = 0;
+    for (int iPoint=0; iPoint< coord.size1(); iPoint++) {
+      df(coord(iPoint,0), coord(iPoint, 1), coord(iPoint, 2), dfv);
+      for (int i = 0; i < coefficients.size1(); i++) {
+        dfm(i, iPoint * 3 + 0) = dfv[i][0];
+        dfm(i, iPoint * 3 + 1) = dfv[i][1];
+        dfm(i, iPoint * 3 + 2) = dfv[i][2];
+        ++ii;
+      }
+    }
+  }
   inline void df(double u, double v, double w, double grads[][3]) const
   {
     switch (monomials.size2()) {
-- 
GitLab