From 36f63032053b2484148e53742c20a98a2827dc52 Mon Sep 17 00:00:00 2001
From: Nicolas Marsic <nicolas.marsic@gmail.com>
Date: Thu, 17 Jan 2013 15:36:24 +0000
Subject: [PATCH] Remove BasisLocal{Scalar,Vector,} -- Everything is in Basis
 now

---
 FunctionSpace/Basis.h                     | 274 +++++++++++++++++-----
 FunctionSpace/BasisHierarchicalScalar.cpp |  33 +--
 FunctionSpace/BasisHierarchicalScalar.h   |  18 +-
 FunctionSpace/BasisHierarchicalVector.cpp | 116 ++-------
 FunctionSpace/BasisHierarchicalVector.h   |  32 +--
 FunctionSpace/BasisLagrange.cpp           |  27 ++-
 FunctionSpace/BasisLagrange.h             |  18 +-
 FunctionSpace/BasisLocalScalar.cpp        |   8 -
 FunctionSpace/BasisLocalScalar.h          | 144 ------------
 FunctionSpace/BasisLocalVector.cpp        |   8 -
 FunctionSpace/BasisLocalVector.h          | 179 --------------
 FunctionSpace/CMakeLists.txt              |   9 +-
 FunctionSpace/FunctionSpaceEdge.cpp       |  53 ++---
 FunctionSpace/FunctionSpaceNode.cpp       |  33 ++-
 FunctionSpace/FunctionSpaceScalar.h       |  16 +-
 FunctionSpace/FunctionSpaceVector.h       |  22 +-
 16 files changed, 352 insertions(+), 638 deletions(-)
 delete mode 100644 FunctionSpace/BasisLocalScalar.cpp
 delete mode 100644 FunctionSpace/BasisLocalScalar.h
 delete mode 100644 FunctionSpace/BasisLocalVector.cpp
 delete mode 100644 FunctionSpace/BasisLocalVector.h

diff --git a/FunctionSpace/Basis.h b/FunctionSpace/Basis.h
index a0ae3dd131..b1f6f77d1e 100644
--- a/FunctionSpace/Basis.h
+++ b/FunctionSpace/Basis.h
@@ -11,6 +11,34 @@
 
    A Basis is @em set of @em linearly @em independent Polynomial%s
    (or Vector%s of Polynomial%s).@n
+
+   @note
+   The returned matrices are the result of the evaluation
+   of the basis functions (at @c N points).@n
+
+   The @c i-th row of these matrices is always refering to the
+   @c i-th function of the basis.@n
+
+   Depending on the nature of the returned value
+   (@em scalar or @em vector), the columns are organized
+   diferently.
+
+   For @em scalar values, we have:
+   @li The @c j-th column of the @c i-th row is
+   the evaluation of the @c i-th function at the @c j-th point
+
+   For @em vectorial values, we have:
+   @li The @c j-th column of the @c i-th row is
+   the @em first @em coordinate of
+   the evaluation of the @c i-th function at the @c 3 @c x @c j-th point
+
+   @li The @c (@c j-th @c + @c 1 @c ) column of the @c i-th row is
+   the @em second @em coordinate of
+   the evaluation of the @c i-th function at the @c 3 @c x @c j-th point
+
+   @li The @c (@c j-th @c + @c 2 @c ) column of the @c i-th row is
+   the @em third @em coordinate of
+   the evaluation of the @c i-th function at the @c 3 @c x @c j-th point
  */
 
 class Basis{
@@ -30,83 +58,219 @@ class Basis{
   unsigned int nFunction;
 
  public:
-  //! Deletes this Basis
-  //!
+  // Destructor //
   virtual ~Basis(void);
 
-  //! @return Returns:
-  //! @li @c true, if this is a
-  //! @em scalar Basis
-  //! @li @c false, if this is a
-  //! @em vectorial Basis
-  //!
-  //! @note
-  //! Scalar basis are sets of
-  //! Polynomial%s@n
-  //! Vectorial basis are sets of
-  //! Vector%s of Polynomial%s
+  // Scalar & Local //
   bool isScalar(void) const;
-
-  //! @return Returns:
-  //! @li @c true, if this is a
-  //! @em Local Basis
-  //! @li @c false, if this is a
-  //! @em Global Basis
   bool isLocal(void) const;
 
-  //! @return Returns the @em polynomial @em order of the Basis
+  // Type of Basis //
   unsigned int getOrder(void) const;
-
-  //! @return Returns the @em type of the Basis:
-  //! @li 0 for 0-form
-  //! @li 1 for 1-form
-  //! @li 2 for 2-form
-  //! @li 3 for 3-form
   unsigned int getType(void) const;
-
-  //! @return Returns the @em dimension
-  //! (1D, 2D or 3D) of the Basis
   unsigned int getDim(void) const;
 
-  //! @return Returns the number of @em Vertex
-  //! @em Based functions of this Basis
+  // Number of Functions //
   unsigned int getNVertexBased(void) const;
-
-  //! @return Returns the number of @em Edge
-  //! @em Based functions of this Basis
   unsigned int getNEdgeBased(void) const;
-
-  //! @return Returns the number of @em Face
-  //! @em Based functions of this Basis
   unsigned int getNFaceBased(void) const;
-
-  //! @return Returns the number of @em Cell
-  //! @em Based functions of this Basis
   unsigned int getNCellBased(void) const;
-
-  //! @return Returns the number of Polynomial%s
-  //! (or Vector%s of Polynomial%s) Functions
-  //! in this Basis
   unsigned int getNFunction(void) const;
 
-  //! @return Returns the number of
-  //! @em orientation of this Basis
-  //! Reference Space
+  // Orientations //
   virtual unsigned int getNOrientation(void) const = 0;
-
-  //! @param element A MElement
-  //! @return Returns a number charaterizing
-  //! the @em orientation of the given element
   virtual unsigned int getOrientation(const MElement& element) const = 0;
 
+  // Direct Access to Evaluated Functions //
+  virtual fullMatrix<double>* getFunctions(const MElement& element,
+                                           double u, double v, double w) const = 0;
+
+  virtual fullMatrix<double>* getFunctions(unsigned int orientation,
+                                           double u, double v, double w) const = 0;
+
+  // Precompute Functions //
+  virtual void preEvaluateFunctions(const fullMatrix<double>& point) const = 0;
+  virtual void preEvaluateDerivatives(const fullMatrix<double>& point) const = 0;
+
+  // Access to Precomputed Functions //
+  virtual const fullMatrix<double>&
+    getPreEvaluatedFunctions(const MElement& element) const = 0;
+
+  virtual const fullMatrix<double>&
+    getPreEvaluatedDerivatives(const MElement& element) const = 0;
+
+  virtual const fullMatrix<double>&
+    getPreEvaluatedFunctions(unsigned int orientation) const = 0;
+
+  virtual const fullMatrix<double>&
+    getPreEvaluatedDerivatives(unsigned int orientation) const = 0;
+
  protected:
-  //! @internal
-  //! Instantiate a new Basis
-  //!
-  //! @endinternal
+  // 'Constructor' //
   Basis(void);
 };
 
+
+/**
+   @internal
+   @fn Basis::Basis
+
+   Instantiate a new Basis
+   @endinternal
+   **
+
+   @fn Basis::~Basis
+
+   Deletes this Basis
+   **
+
+   @fn Basis::isScalar
+   @return Returns:
+   @li @c true, if this is a
+   @em scalar Basis
+   @li @c false, if this is a
+   @em vectorial Basis
+
+   @note
+   Scalar basis are sets of
+   Polynomial%s@n
+   Vectorial basis are sets of
+   Vector%s of Polynomial%s
+   **
+
+   @fn Basis::isLocal
+   @return Returns:
+   @li @c true, if this is a
+   @em Local Basis
+   @li @c false, if this is a
+   @em Global Basis
+   **
+
+   @fn Basis::getOrder
+   @return Returns the @em polynomial @em order of the Basis
+   **
+
+   @fn Basis::getType
+   @return Returns the @em type of the Basis:
+   @li 0 for 0-form
+   @li 1 for 1-form
+   @li 2 for 2-form
+   @li 3 for 3-form
+   **
+
+   @fn Basis::getDim
+   @return Returns the @em dimension
+   (@c 1D, @c 2D or @c 3D) of the Basis
+   **
+
+   @fn Basis::getNVertexBased
+   @return Returns the number of @em Vertex
+   @em Based functions of this Basis
+   **
+
+   @fn Basis::getNEdgeBased
+   @return Returns the number of @em Edge
+   @em Based functions of this Basis
+   **
+
+   @fn Basis::getNFaceBased
+   @return Returns the number of @em Face
+   @em Based functions of this Basis
+   **
+
+   @fn Basis::getNCellBased
+   @return Returns the number of @em Cell
+   @em Based functions of this Basis
+   **
+
+   @fn Basis::getNFunction
+   @return Returns the number of Polynomial%s
+   (or Vector%s of Polynomial%s) Functions
+   in this Basis
+   **
+
+   @fn Basis::getNOrientation
+   @return Returns the number of
+   @em orientation of this Basis
+   Reference Space
+   **
+
+   @fn Basis::getOrientation
+   @param element A MElement
+   @return Returns a number charaterizing
+   the @em orientation of the given element
+   **
+
+   @fn Basis::getFunctions(unsigned int, double, double, double) const
+   @param orientation A natural number defining the reference space @em orientation
+   @param u A @c u coordinate in the reference space of this Basis
+   @param v A @c v coordinate in the reference space of this Basis
+   @param w A @c w coordinate in the reference space of this Basis
+   @return Instanciates a new fullMatrix<double> with the @em evaluation
+   of every basis function at the given coordinates, and for the
+   given orientation
+
+   @warning
+   The Instanciated Matrix must be deleted by the @em calling function
+   **
+
+   @fn Basis::getFunctions(const MElement&, double, double, double) const
+   @param element A MElement
+   @param u A @c u coordinate in the reference space of this Basis
+   @param v A @c v coordinate in the reference space of this Basis
+   @param w A @c w coordinate in the reference space of this Basis
+   @return Same as Basis::getFunction(Basis::getOrientation(@c element),
+   @c u, @c u, @c w)
+   **
+
+   @fn Basis::preEvaluateFunctions
+   @param point A Matrix with points coordinate
+   (each line is a point and got 3 coordinates, @em i.e. 3 rows)
+   @return Pre Evaluates every basis function at the given points
+   **
+
+   @fn Basis::preEvaluateDerivatives
+   @param point A Matrix with points coordinate
+   (each line is a point and got 3 coordinates, @em i.e. 3 rows)
+   @return Pre Evaluates every basis function @em derivative at the given points
+
+   @note
+   @li For 0-Form it computes the @em gradient
+   @li For 1-Form it computes the @em curl
+   @li For 2-Form it computes the @em divergence
+   @li For 3-Form it computes the @em ???
+   @todo What is the derivative of a 3-Form
+   (does it exists -- discontinous field nope ?) ?
+   **
+
+   @fn Basis::getPreEvaluatedFunctions(unsigned int) const
+   @param orientation A natural number defining the reference space @em orientation
+   @return Returns a Matrix with the PreEvaluated basis functions
+   (see Basis::preEvaluateFunctions()), with the given @em orientation
+
+   @note
+   If no PreEvaluation has been done before calling this function,
+   an Exception is thrown
+   **
+
+   @fn Basis::getPreEvaluatedDerivatives(unsigned int) const
+   @param orientation A natural number defining the reference space @em orientation
+   @return Returns a Matrix with the PreEvaluated basis functions @em derivatives
+   (see Basis::preEvaluateDerivatives()), with the given @em orientation
+
+   @note
+   If no PreEvaluation of the gradient has been done before calling this function,
+   an Exception is thrown
+   **
+
+   @fn Basis::getPreEvaluatedFunctions(const MElement&) const
+   @return Same as Basis::getPreEvaluatedFunctions(Basis::getOrientation(@c element))
+   **
+
+   @fn Basis::getPreEvaluatedDerivatives(const MElement&) const
+   @return Same as Basis::getPreEvaluatedDerivatives(Basis::getOrientation(@c element))
+*/
+
 //////////////////////
 // Inline Functions //
 //////////////////////
diff --git a/FunctionSpace/BasisHierarchicalScalar.cpp b/FunctionSpace/BasisHierarchicalScalar.cpp
index 7c50c5ab8f..5acf26b9a8 100644
--- a/FunctionSpace/BasisHierarchicalScalar.cpp
+++ b/FunctionSpace/BasisHierarchicalScalar.cpp
@@ -5,6 +5,9 @@
 using namespace std;
 
 BasisHierarchicalScalar::BasisHierarchicalScalar(void){
+  // Scalar Basis ? //
+  scalar = true;
+
   // Grad Basis //
   hasGrad = false;
   grad    = NULL;
@@ -46,6 +49,16 @@ BasisHierarchicalScalar::~BasisHierarchicalScalar(void){
   }
 }
 
+unsigned int BasisHierarchicalScalar::
+getNOrientation(void) const{
+  return refSpace->getNPermutation();
+}
+
+unsigned int BasisHierarchicalScalar::
+getOrientation(const MElement& element) const{
+  return refSpace->getPermutation(element);
+}
+
 fullMatrix<double>* BasisHierarchicalScalar::
 getFunctions(const MElement& element,
 	     double u, double v, double w) const{
@@ -111,7 +124,7 @@ preEvaluateFunctions(const fullMatrix<double>& point) const{
 }
 
 void BasisHierarchicalScalar::
-preEvaluateGradFunctions(const fullMatrix<double>& point) const{
+preEvaluateDerivatives(const fullMatrix<double>& point) const{
   // Build Grad //
   if(!hasGrad)
     getGrad();
@@ -161,8 +174,8 @@ getPreEvaluatedFunctions(const MElement& element) const{
 }
 
 const fullMatrix<double>& BasisHierarchicalScalar::
-getPreEvaluatedGradFunctions(const MElement& element) const{
-  return getPreEvaluatedGradFunctions(refSpace->getPermutation(element));
+getPreEvaluatedDerivatives(const MElement& element) const{
+  return getPreEvaluatedDerivatives(refSpace->getPermutation(element));
 }
 
 const fullMatrix<double>& BasisHierarchicalScalar::
@@ -174,23 +187,13 @@ getPreEvaluatedFunctions(unsigned int orientation) const{
 }
 
 const fullMatrix<double>& BasisHierarchicalScalar::
-getPreEvaluatedGradFunctions(unsigned int orientation) const{
+getPreEvaluatedDerivatives(unsigned int orientation) const{
   if(!preEvaluatedGrad)
-    throw Exception("getPreEvaluatedGradFunction: gradient has not been preEvaluated");
+    throw Exception("getPreEvaluatedDerivative: gradient has not been preEvaluated");
 
   return *preEvaluatedGradFunction[orientation];
 }
 
-unsigned int BasisHierarchicalScalar::
-getNOrientation(void) const{
-  return refSpace->getNPermutation();
-}
-
-unsigned int BasisHierarchicalScalar::
-getOrientation(const MElement& element) const{
-  return refSpace->getPermutation(element);
-}
-
 void BasisHierarchicalScalar::getGrad(void) const{
   // Alloc //
   grad = new vector<Polynomial>**[nRefSpace];
diff --git a/FunctionSpace/BasisHierarchicalScalar.h b/FunctionSpace/BasisHierarchicalScalar.h
index d5901da837..65941fb193 100644
--- a/FunctionSpace/BasisHierarchicalScalar.h
+++ b/FunctionSpace/BasisHierarchicalScalar.h
@@ -2,7 +2,7 @@
 #define _BASISHIERARCHICALSCALAR_H_
 
 #include <string>
-#include "BasisLocalScalar.h"
+#include "BasisLocal.h"
 #include "Polynomial.h"
 #include "ReferenceSpace.h"
 
@@ -13,7 +13,7 @@
    This is an interface for Hierarchical Scalar Local Basis.@n
 */
 
-class BasisHierarchicalScalar: public BasisLocalScalar{
+class BasisHierarchicalScalar: public BasisLocal{
  protected:
   // Orientation //
   ReferenceSpace* refSpace;
@@ -36,29 +36,29 @@ class BasisHierarchicalScalar: public BasisLocalScalar{
  public:
   virtual ~BasisHierarchicalScalar(void);
 
+  virtual unsigned int getNOrientation(void) const;
+  virtual unsigned int getOrientation(const MElement& element) const;
+
   virtual fullMatrix<double>* getFunctions(const MElement& element,
 					   double u, double v, double w) const;
 
   virtual fullMatrix<double>* getFunctions(unsigned int orientation,
 					   double u, double v, double w) const;
 
-  virtual void preEvaluateFunctions    (const fullMatrix<double>& point) const;
-  virtual void preEvaluateGradFunctions(const fullMatrix<double>& point) const;
+  virtual void preEvaluateFunctions(const fullMatrix<double>& point) const;
+  virtual void preEvaluateDerivatives(const fullMatrix<double>& point) const;
 
   virtual const fullMatrix<double>&
     getPreEvaluatedFunctions(const MElement& element) const;
 
   virtual const fullMatrix<double>&
-    getPreEvaluatedGradFunctions(const MElement& element) const;
+    getPreEvaluatedDerivatives(const MElement& element) const;
 
   virtual const fullMatrix<double>&
     getPreEvaluatedFunctions(unsigned int orientation) const;
 
   virtual const fullMatrix<double>&
-    getPreEvaluatedGradFunctions(unsigned int orientation) const;
-
-  virtual unsigned int getNOrientation(void) const;
-  virtual unsigned int getOrientation(const MElement& element) const;
+    getPreEvaluatedDerivatives(unsigned int orientation) const;
 
   std::string toString(void) const;
 
diff --git a/FunctionSpace/BasisHierarchicalVector.cpp b/FunctionSpace/BasisHierarchicalVector.cpp
index 0c1be9289b..de07bf0e6b 100644
--- a/FunctionSpace/BasisHierarchicalVector.cpp
+++ b/FunctionSpace/BasisHierarchicalVector.cpp
@@ -5,22 +5,19 @@
 using namespace std;
 
 BasisHierarchicalVector::BasisHierarchicalVector(void){
+  // Scalar Basis ?//
+  scalar = false;
+
   // Curl Basis //
   hasCurl = false;
   curl    = NULL;
 
-  // Div Basis //
-  hasDiv = false;
-  div    = NULL;
-
   // PreEvaluation //
   preEvaluated     = false;
   preEvaluatedCurl = false;
-  preEvaluatedDiv  = false;
 
   preEvaluatedFunction     = NULL;
   preEvaluatedCurlFunction = NULL;
-  preEvaluatedDivFunction  = NULL;
 }
 
 BasisHierarchicalVector::~BasisHierarchicalVector(void){
@@ -36,18 +33,6 @@ BasisHierarchicalVector::~BasisHierarchicalVector(void){
     delete[] curl;
   }
 
-  // Div Basis //
-  if(hasDiv){
-    for(unsigned int i = 0; i < nRefSpace; i++){
-      for(unsigned int j = 0; j < nFunction; j++)
-	delete div[i][j];
-
-      delete[] div[i];
-    }
-
-    delete[] div;
-  }
-
   // PreEvaluation //
   if(preEvaluated){
     for(unsigned int i = 0; i < nRefSpace; i++)
@@ -64,6 +49,16 @@ BasisHierarchicalVector::~BasisHierarchicalVector(void){
   }
 }
 
+unsigned int BasisHierarchicalVector::
+getNOrientation(void) const{
+  return refSpace->getNPermutation();
+}
+
+unsigned int BasisHierarchicalVector::
+getOrientation(const MElement& element) const{
+  return refSpace->getPermutation(element);
+}
+
 fullMatrix<double>* BasisHierarchicalVector::
 getFunctions(const MElement& element,
 	     double u, double v, double w) const{
@@ -151,7 +146,7 @@ preEvaluateFunctions(const fullMatrix<double>& point) const{
 }
 
 void BasisHierarchicalVector::
-preEvaluateCurlFunctions(const fullMatrix<double>& point) const{
+preEvaluateDerivatives(const fullMatrix<double>& point) const{
   // Build Curl //
   if(!hasCurl)
     getCurl();
@@ -195,54 +190,14 @@ preEvaluateCurlFunctions(const fullMatrix<double>& point) const{
   preEvaluatedCurl = true;
 }
 
-void BasisHierarchicalVector::
-preEvaluateDivFunctions(const fullMatrix<double>& point) const{
-  // Build Div //
-  if(!hasDiv)
-    getDiv();
-
-  // Delete if older //
-  if(preEvaluatedDiv){
-    for(unsigned int i = 0; i < nRefSpace; i++)
-      delete preEvaluatedDivFunction[i];
-
-    delete[] preEvaluatedDivFunction;
-  }
-
-  // Alloc //
-  const unsigned int nPoint = point.size1();
-  preEvaluatedDivFunction   = new fullMatrix<double>*[nRefSpace];
-
-  for(unsigned int i = 0; i < nRefSpace; i++)
-    preEvaluatedDivFunction[i] =
-      new fullMatrix<double>(nFunction, nPoint);
-
-  // Fill Matrix //
-  for(unsigned int i = 0; i < nRefSpace; i++)
-    for(unsigned int j = 0; j < nFunction; j++)
-      for(unsigned int k = 0; k < nPoint; k++)
-	(*preEvaluatedDivFunction[i])(j, k) =
-	  div[i][j]->at(point(k, 0),
-			point(k, 1),
-			point(k, 2));
-
-  // PreEvaluated //
-  preEvaluatedDiv = true;
-}
-
 const fullMatrix<double>& BasisHierarchicalVector::
 getPreEvaluatedFunctions(const MElement& element) const{
   return getPreEvaluatedFunctions(refSpace->getPermutation(element));
 }
 
 const fullMatrix<double>& BasisHierarchicalVector::
-getPreEvaluatedCurlFunctions(const MElement& element) const{
-  return getPreEvaluatedCurlFunctions(refSpace->getPermutation(element));
-}
-
-const fullMatrix<double>& BasisHierarchicalVector::
-getPreEvaluatedDivFunctions(const MElement& element) const{
-  return getPreEvaluatedDivFunctions(refSpace->getPermutation(element));
+getPreEvaluatedDerivatives(const MElement& element) const{
+  return getPreEvaluatedDerivatives(refSpace->getPermutation(element));
 }
 
 const fullMatrix<double>& BasisHierarchicalVector::
@@ -254,31 +209,13 @@ getPreEvaluatedFunctions(unsigned int orientation) const{
 }
 
 const fullMatrix<double>& BasisHierarchicalVector::
-getPreEvaluatedCurlFunctions(unsigned int orientation) const{
+getPreEvaluatedDerivatives(unsigned int orientation) const{
   if(!preEvaluatedCurl)
-    throw Exception("getPreEvaluatedCurlFunction: curl has not been preEvaluated");
+    throw Exception("getPreEvaluatedDerivative: curl has not been preEvaluated");
 
   return *preEvaluatedCurlFunction[orientation];
 }
 
-const fullMatrix<double>& BasisHierarchicalVector::
-getPreEvaluatedDivFunctions(unsigned int orientation) const{
-  if(!preEvaluatedDiv)
-    throw Exception("getPreEvaluatedDivFunction: divergence has not been preEvaluated");
-
-  return *preEvaluatedDivFunction[orientation];
-}
-
-unsigned int BasisHierarchicalVector::
-getNOrientation(void) const{
-  return refSpace->getNPermutation();
-}
-
-unsigned int BasisHierarchicalVector::
-getOrientation(const MElement& element) const{
-  return refSpace->getPermutation(element);
-}
-
 void BasisHierarchicalVector::getCurl(void) const{
   // Alloc //
   curl = new vector<Polynomial>**[nRefSpace];
@@ -296,23 +233,6 @@ void BasisHierarchicalVector::getCurl(void) const{
   hasCurl = true;
 }
 
-void BasisHierarchicalVector::getDiv(void) const{
-  // Alloc //
-  div = new Polynomial**[nRefSpace];
-
-  for(unsigned int s = 0; s < nRefSpace; s++)
-    div[s] = new Polynomial*[nFunction];
-
-  // Div //
-  for(unsigned int s = 0; s < nRefSpace; s++)
-    for(unsigned int f = 0 ; f < nFunction; f++)
-      div[s][f] =
-	new Polynomial(Polynomial::divergence(*basis[s][f]));
-
-  // Has Div //
-  hasDiv = true;
-}
-
 string BasisHierarchicalVector::toString(void) const{
   stringstream stream;
   unsigned int i = 0;
diff --git a/FunctionSpace/BasisHierarchicalVector.h b/FunctionSpace/BasisHierarchicalVector.h
index bef7cab6e0..b45a834d30 100644
--- a/FunctionSpace/BasisHierarchicalVector.h
+++ b/FunctionSpace/BasisHierarchicalVector.h
@@ -2,7 +2,7 @@
 #define _BASISHIERARCHICALVECTOR_H_
 
 #include <string>
-#include "BasisLocalVector.h"
+#include "BasisLocal.h"
 #include "Polynomial.h"
 #include "ReferenceSpace.h"
 
@@ -13,7 +13,7 @@
    This is an interface for Hierarchical Vectorial Local Basis.@n
 */
 
-class BasisHierarchicalVector: public BasisLocalVector{
+class BasisHierarchicalVector: public BasisLocal{
  protected:
   // Orientation //
   ReferenceSpace* refSpace;
@@ -26,52 +26,39 @@ class BasisHierarchicalVector: public BasisLocalVector{
   mutable bool hasCurl;
   mutable std::vector<Polynomial>*** curl;
 
-  // Div Basis //
-  mutable bool hasDiv;
-  mutable Polynomial*** div;
-
   // PreEvaluation //
   mutable bool preEvaluated;
   mutable bool preEvaluatedCurl;
-  mutable bool preEvaluatedDiv;
 
   mutable fullMatrix<double>** preEvaluatedFunction;
   mutable fullMatrix<double>** preEvaluatedCurlFunction;
-  mutable fullMatrix<double>** preEvaluatedDivFunction;
 
  public:
   virtual ~BasisHierarchicalVector(void);
 
+  virtual unsigned int getNOrientation(void) const;
+  virtual unsigned int getOrientation(const MElement& element) const;
+
   virtual fullMatrix<double>* getFunctions(const MElement& element,
 					   double u, double v, double w) const;
 
   virtual fullMatrix<double>* getFunctions(unsigned int orientation,
 					   double u, double v, double w) const;
 
-  virtual void preEvaluateFunctions    (const fullMatrix<double>& point) const;
-  virtual void preEvaluateCurlFunctions(const fullMatrix<double>& point) const;
-  virtual void preEvaluateDivFunctions (const fullMatrix<double>& point) const;
+  virtual void preEvaluateFunctions(const fullMatrix<double>& point) const;
+  virtual void preEvaluateDerivatives(const fullMatrix<double>& point) const;
 
   virtual const fullMatrix<double>&
     getPreEvaluatedFunctions(const MElement& element) const;
 
   virtual const fullMatrix<double>&
-    getPreEvaluatedCurlFunctions(const MElement& element) const;
-
-  virtual const fullMatrix<double>&
-    getPreEvaluatedDivFunctions (const MElement& element)const;
+    getPreEvaluatedDerivatives(const MElement& element) const;
 
   virtual const fullMatrix<double>&
     getPreEvaluatedFunctions(unsigned int orientation) const;
 
   virtual const fullMatrix<double>&
-    getPreEvaluatedCurlFunctions(unsigned int orientation) const;
-
-  virtual const fullMatrix<double>&
-    getPreEvaluatedDivFunctions(unsigned int orientation) const;
-
-  virtual unsigned int getNOrientation(void) const;
-  virtual unsigned int getOrientation(const MElement& element) const;
+    getPreEvaluatedDerivatives(unsigned int orientation) const;
 
   std::string toString(void) const;
 
@@ -80,7 +67,6 @@ class BasisHierarchicalVector: public BasisLocalVector{
 
  private:
   void getCurl(void) const;
-  void getDiv(void) const;
 };
 
 /**
diff --git a/FunctionSpace/BasisLagrange.cpp b/FunctionSpace/BasisLagrange.cpp
index d05bd4cd1b..4475930788 100644
--- a/FunctionSpace/BasisLagrange.cpp
+++ b/FunctionSpace/BasisLagrange.cpp
@@ -2,11 +2,22 @@
 #include "BasisLagrange.h"
 
 BasisLagrange::BasisLagrange(void){
+  scalar = true;
 }
 
 BasisLagrange::~BasisLagrange(void){
 }
 
+unsigned int BasisLagrange::
+getNOrientation(void) const{
+  throw Exception("BasisLagrange::Not Implemented");
+}
+
+unsigned int BasisLagrange::
+getOrientation(const MElement& element) const{
+  throw Exception("BasisLagrange::Not Implemented");
+}
+
 fullMatrix<double>* BasisLagrange::
 getFunctions(const MElement& element,
 	     double u, double v, double w) const{
@@ -41,7 +52,7 @@ void BasisLagrange::preEvaluateFunctions(const fullMatrix<double>& point) const{
   throw Exception("BasisLagrange::Not Implemented");
 }
 
-void BasisLagrange::preEvaluateGradFunctions(const fullMatrix<double>& point) const{
+void BasisLagrange::preEvaluateDerivatives(const fullMatrix<double>& point) const{
   throw Exception("BasisLagrange::Not Implemented");
 }
 
@@ -51,7 +62,7 @@ BasisLagrange::getPreEvaluatedFunctions(const MElement& element) const{
 }
 
 const fullMatrix<double>&
-BasisLagrange::getPreEvaluatedGradFunctions(const MElement& element) const{
+BasisLagrange::getPreEvaluatedDerivatives(const MElement& element) const{
   throw Exception("BasisLagrange::Not Implemented");
 }
 
@@ -61,17 +72,7 @@ BasisLagrange::getPreEvaluatedFunctions(unsigned int orientation) const{
 }
 
 const fullMatrix<double>&
-BasisLagrange::getPreEvaluatedGradFunctions(unsigned int orientation) const{
-  throw Exception("BasisLagrange::Not Implemented");
-}
-
-unsigned int BasisLagrange::
-getNOrientation(void) const{
-  throw Exception("BasisLagrange::Not Implemented");
-}
-
-unsigned int BasisLagrange::
-getOrientation(const MElement& element) const{
+BasisLagrange::getPreEvaluatedDerivatives(unsigned int orientation) const{
   throw Exception("BasisLagrange::Not Implemented");
 }
 
diff --git a/FunctionSpace/BasisLagrange.h b/FunctionSpace/BasisLagrange.h
index 8c5b2a2a78..eec1c84aee 100644
--- a/FunctionSpace/BasisLagrange.h
+++ b/FunctionSpace/BasisLagrange.h
@@ -1,7 +1,7 @@
 #ifndef _BASISLAGRANGE_H_
 #define _BASISLAGRANGE_H_
 
-#include "BasisLocalScalar.h"
+#include "BasisLocal.h"
 #include "FunctionSpaceScalar.h"
 #include "FunctionSpaceVector.h"
 #include "fullMatrix.h"
@@ -23,7 +23,7 @@
    Add a method to get lagrange Point in polynomialBasis
 */
 
-class BasisLagrange: public BasisLocalScalar{
+class BasisLagrange: public BasisLocal{
  protected:
   polynomialBasis*    lBasis; // Lagrange Basis
   fullMatrix<double>* lPoint; // Lagrange Points
@@ -31,29 +31,29 @@ class BasisLagrange: public BasisLocalScalar{
  public:
   virtual ~BasisLagrange(void);
 
+  virtual unsigned int getNOrientation(void) const;
+  virtual unsigned int getOrientation(const MElement& element) const;
+
   virtual fullMatrix<double>* getFunctions(const MElement& element,
 					   double u, double v, double w) const;
 
   virtual fullMatrix<double>* getFunctions(unsigned int orientation,
 					   double u, double v, double w) const;
 
-  virtual void preEvaluateFunctions    (const fullMatrix<double>& point) const;
-  virtual void preEvaluateGradFunctions(const fullMatrix<double>& point) const;
+  virtual void preEvaluateFunctions(const fullMatrix<double>& point) const;
+  virtual void preEvaluateDerivatives(const fullMatrix<double>& point) const;
 
   virtual const fullMatrix<double>&
     getPreEvaluatedFunctions(const MElement& element) const;
 
   virtual const fullMatrix<double>&
-    getPreEvaluatedGradFunctions(const MElement& element) const;
+    getPreEvaluatedDerivatives(const MElement& element) const;
 
   virtual const fullMatrix<double>&
     getPreEvaluatedFunctions(unsigned int orientation) const;
 
   virtual const fullMatrix<double>&
-    getPreEvaluatedGradFunctions(unsigned int orientation) const;
-
-  virtual unsigned int getNOrientation(void) const;
-  virtual unsigned int getOrientation(const MElement& element) const;
+    getPreEvaluatedDerivatives(unsigned int orientation) const;
 
   const fullMatrix<double>& getCoefficient(void) const;
   const fullMatrix<double>& getMonomial(void) const;
diff --git a/FunctionSpace/BasisLocalScalar.cpp b/FunctionSpace/BasisLocalScalar.cpp
deleted file mode 100644
index 3c0319431e..0000000000
--- a/FunctionSpace/BasisLocalScalar.cpp
+++ /dev/null
@@ -1,8 +0,0 @@
-#include "BasisLocalScalar.h"
-
-BasisLocalScalar::BasisLocalScalar(void){
-  scalar = true;
-}
-
-BasisLocalScalar::~BasisLocalScalar(void){
-}
diff --git a/FunctionSpace/BasisLocalScalar.h b/FunctionSpace/BasisLocalScalar.h
deleted file mode 100644
index 4546da1bb9..0000000000
--- a/FunctionSpace/BasisLocalScalar.h
+++ /dev/null
@@ -1,144 +0,0 @@
-#ifndef _BASISLOCALSCALAR_H_
-#define _BASISLOCALSCALAR_H_
-
-#include "BasisLocal.h"
-#include "MElement.h"
-#include "fullMatrix.h"
-
-/**
-   @interface BasisLocalScalar
-   @brief Common Interface for all
-   @em Scalar Local Basis
-
-   This class is the @em common @em interface for all
-   @em scalar Local Basis.@n
-*/
-
-class BasisLocalScalar: public BasisLocal{
- public:
-  virtual ~BasisLocalScalar(void);
-
-  virtual fullMatrix<double>* getFunctions(const MElement& element,
-					   double u, double v, double w) const = 0;
-
-  virtual fullMatrix<double>* getFunctions(unsigned int orientation,
-					   double u, double v, double w) const = 0;
-
-  virtual void preEvaluateFunctions    (const fullMatrix<double>& point) const = 0;
-  virtual void preEvaluateGradFunctions(const fullMatrix<double>& point) const = 0;
-
-  virtual const fullMatrix<double>&
-    getPreEvaluatedFunctions(const MElement& element) const = 0;
-
-  virtual const fullMatrix<double>&
-    getPreEvaluatedGradFunctions(const MElement& element) const = 0;
-
-  virtual const fullMatrix<double>&
-    getPreEvaluatedFunctions(unsigned int orientation) const = 0;
-
-  virtual const fullMatrix<double>&
-    getPreEvaluatedGradFunctions(unsigned int orientation) const = 0;
-
- protected:
-  BasisLocalScalar(void);
-};
-
-
-/**
-   @internal
-   @fn BasisLocalScalar::BasisLocalScalar
-
-   Instantiates a new BasisLocalScalar
-   @endinternal
-   **
-
-   @fn BasisLocalScalar::~BasisLocalScalar
-
-   Deletes this BasisLocalScalar
-   **
-
-   @fn BasisLocalScalar::getFunctions(const MElement&, double, double, double) const
-   @param element A MElement
-   @param u A @c u coordinate in the reference space of this BasisLocal
-   @param v A @c v coordinate in the reference space of this BasisLocal
-   @param w A @c w coordinate in the reference space of this BasisLocal
-   @return Instanciates a new Matrix with the @em evaluation
-   of every basis function at the given coordinates, and for the
-   given element @em orientation
-
-   @note
-   The returned Matrix if of size BasisLocalScalar::getNFunction() @c x 1
-
-   @warning
-   The Instanciated Matrix must be deleted by the @em calling function
-   **
-
-   @fn BasisLocalScalar::getFunctions(unsigned int, double, double, double) const
-   @param orientation A natural number defining the reference space @em orientation
-   @param u A @c u coordinate in the reference space of this BasisLocal
-   @param v A @c v coordinate in the reference space of this BasisLocal
-   @param w A @c w coordinate in the reference space of this BasisLocal
-   @return Instanciates a new fullMatrix<double> with the @em evaluation
-   of every basis function at the given coordinates, and for the
-   given orientation
-
-   @note
-   The returned Matrix if of size BasisLocalScalar::getNFunction() @c x 1
-
-   @warning
-   The Instanciated Matrix must be deleted by the @em calling function
-   **
-
-   @fn BasisLocalScalar::preEvaluateFunctions
-   @param point A Matrix with points coordinate (each line is a point and got 3 coordinates, @em i.e. 3 rows)
-   @return Pre Evaluates every basis function at the given points
-   **
-
-   @fn BasisLocalScalar::preEvaluateGradFunctions
-   @param point A Matrix with points coordinate (each line is a point and got 3 coordinates, @em i.e. 3 rows)
-   @return Pre Evaluates every basis function @em gradient at the given points
-   **
-
-   @fn BasisLocalScalar::getPreEvaluatedFunctions(const MElement&) const
-   @param element A MElement
-   @return Returns a Matrix with the PreEvaluated basis functions
-   (see BasisLocalFunction::preEvaluateFunctions()), with the given
-   element @em orientation
-
-   @note
-   The returned Matrix is of size BasisLocalScalar::getNFunction() @c x @c number @c of @c
-   PreEvaluated @c points
-
-   @note
-   If no PreEvaluation has been done before calling this function,
-   an Exception is thrown
-   **
-
-   @fn BasisLocalScalar::getPreEvaluatedGradFunctions(const MElement&) const
-   @param element A MElement
-   @return Returns a Matrix with the PreEvaluated basis functions @em gradient
-   (see BasisLocalFunction::preEvaluateGradFunctions()), with the given
-   element @em orientation
-
-   @note
-   The returned Matrix is of size BasisLocalScalar::getNFunction() @c x @c ( @c number @c of @c PreEvaluated @c points @c x @c 3 @c ) @n
-   Each row is a succession of values in 3 coordinates
-
-   @note
-   If no PreEvaluation of the gradient has been done before calling this function,
-   an Exception is thrown
-   **
-
-   @fn BasisLocalScalar::getPreEvaluatedFunctions(unsigned int) const
-   @param orientation A number definig the orientation of the reference space
-   @return Same as BasisLocalScalar::getPreEvaluatedFunctions(const MElement&) const
-   but the orientation is not given by en element but by a number (@c orientation)
-   **
-
-   @fn BasisLocalScalar::getPreEvaluatedGradFunctions(unsigned int) const
-   @param orientation A number definig the orientation of the reference space
-   @return Same as BasisLocalScalar::getPreEvaluatedGradFunctions(const MElement&) const
-   but the orientation is not given by en element but by a number (@c orientation)
- */
-
-#endif
diff --git a/FunctionSpace/BasisLocalVector.cpp b/FunctionSpace/BasisLocalVector.cpp
deleted file mode 100644
index c701cee2d8..0000000000
--- a/FunctionSpace/BasisLocalVector.cpp
+++ /dev/null
@@ -1,8 +0,0 @@
-#include "BasisLocalVector.h"
-
-BasisLocalVector::BasisLocalVector(void){
-  scalar = false;
-}
-
-BasisLocalVector::~BasisLocalVector(void){
-}
diff --git a/FunctionSpace/BasisLocalVector.h b/FunctionSpace/BasisLocalVector.h
deleted file mode 100644
index 78d618733a..0000000000
--- a/FunctionSpace/BasisLocalVector.h
+++ /dev/null
@@ -1,179 +0,0 @@
-#ifndef _BASISLOCALVECTOR_H_
-#define _BASISLOCALVECTOR_H_
-
-#include "BasisLocal.h"
-#include "MElement.h"
-#include "fullMatrix.h"
-
-/**
-   @interface BasisLocalVector
-   @brief Common Interface for all
-   @em Vectorial Local Basis
-
-   This class is the @em common @em interface for all
-   @em vectorial Local Basis.@n
-*/
-
-class BasisLocalVector: public BasisLocal{
- public:
-  virtual ~BasisLocalVector(void);
-
-  virtual fullMatrix<double>* getFunctions(const MElement& element,
-					   double u, double v, double w) const = 0;
-
-  virtual fullMatrix<double>* getFunctions(unsigned int orientation,
-					   double u, double v, double w) const = 0;
-
-  virtual void preEvaluateFunctions    (const fullMatrix<double>& point) const = 0;
-  virtual void preEvaluateCurlFunctions(const fullMatrix<double>& point) const = 0;
-  virtual void preEvaluateDivFunctions (const fullMatrix<double>& point) const = 0;
-
-  virtual const fullMatrix<double>&
-    getPreEvaluatedFunctions(const MElement& element) const = 0;
-
-  virtual const fullMatrix<double>&
-    getPreEvaluatedCurlFunctions(const MElement& element) const = 0;
-
-  virtual const fullMatrix<double>&
-    getPreEvaluatedDivFunctions(const MElement& element) const = 0;
-
-  virtual const fullMatrix<double>&
-    getPreEvaluatedFunctions(unsigned int orientation) const = 0;
-
-  virtual const fullMatrix<double>&
-    getPreEvaluatedCurlFunctions(unsigned int orientation) const = 0;
-
-  virtual const fullMatrix<double>&
-    getPreEvaluatedDivFunctions(unsigned int orientation) const = 0;
-
- protected:
-  BasisLocalVector(void);
-};
-
-
-/**
-   @internal
-   @fn BasisLocalVector::BasisLocalVector
-
-   Instantiates a new BasisLocalVector
-   @endinternal
-   **
-
-   @fn BasisLocalVector::~BasisLocalVector
-
-   Deletes this BasisLocalVector
-   **
-
-   @fn BasisLocalVector::getFunctions(const MElement&, double, double, double) const
-   @param element A MElement
-   @param u A @c u coordinate in the reference space of this BasisLocal
-   @param v A @c v coordinate in the reference space of this BasisLocal
-   @param w A @c w coordinate in the reference space of this BasisLocal
-   @return Instanciates a new Matrix with the @em evaluation
-   of every basis function at the given coordinates, and for the
-   given element @em orientation
-
-   @note
-   The returned Matrix if of size BasisLocalVector::getNFunction() @c x 3@n
-   Each row is a succession of values in 3 coordinates
-
-   @warning
-   The Instanciated Matrix must be deleted by the @em calling function
-   **
-
-   @fn BasisLocalVector::getFunctions(unsigned int, double, double, double) const
-   @param orientation A natural number defining the reference space @em orientation
-   @param u A @c u coordinate in the reference space of this BasisLocal
-   @param v A @c v coordinate in the reference space of this BasisLocal
-   @param w A @c w coordinate in the reference space of this BasisLocal
-   @return Instanciates a new fullMatrix<double> with the @em evaluation
-   of every basis function at the given coordinates, and for the
-   given orientation
-
-   @note
-   The returned Matrix if of size BasisLocalVector::getNFunction() @c x 3@n
-   Each row is a succession of values in 3 coordinates
-
-   @warning
-   The Instanciated Matrix must be deleted by the @em calling function
-   **
-
-   @fn BasisLocalVector::preEvaluateFunctions
-   @param point A Matrix with points coordinate (each line is a point and got 3 coordinates, @em i.e. 3 rows)
-   @return Pre Evaluates every basis function at the given points
-   **
-
-   @fn BasisLocalVector::preEvaluateCurlFunctions
-   @param point A Matrix with points coordinate (each line is a point and got 3 coordinates, @em i.e. 3 rows)
-   @return Pre Evaluates every basis function @em curl at the given points
-   **
-
-   @fn BasisLocalVector::preEvaluateDivFunctions
-   @param point A Matrix with points coordinate (each line is a point and got 3 coordinates, @em i.e. 3 rows)
-   @return Pre Evaluates every basis function @em divergence at the given points
-   **
-
-   @fn BasisLocalVector::getPreEvaluatedFunctions(const MElement&) const
-   @param element A MElement
-   @return Returns a Matrix with the PreEvaluated basis functions
-   (see BasisLocalFunction::preEvaluateFunctions()), with the given
-   element @em orientation
-
-   @note
-   The returned Matrix is of size BasisLocalVector::getNFunction() @c x @c ( @c number @c of @c PreEvaluated @c points @c x @c 3 @c ) @n
-   Each row is a succession of values in 3 coordinates
-
-   @note
-   If no PreEvaluation has been done before calling this function,
-   an Exception is thrown
-   **
-
-   @fn BasisLocalVector::getPreEvaluatedCurlFunctions(const MElement&) const
-   @param element A MElement
-   @return Returns a Matrix with the PreEvaluated basis functions @em curl
-   (see BasisLocalFunction::preEvaluateCurlFunctions()), with the given
-   element @em orientation
-
-   @note
-   The returned Matrix is of size BasisLocalVector::getNFunction() @c x @c ( @c number @c of @c PreEvaluated @c points @c x @c 3 @c ) @n
-   Each row is a succession of values in 3 coordinates
-
-   @note
-   If no PreEvaluation of the curl has been done before calling this function,
-   an Exception is thrown
-   **
-
-   @fn BasisLocalVector::getPreEvaluatedDivFunctions(const MElement&) const
-   @param element A MElement
-   @return Returns a Matrix with the PreEvaluated basis functions @em divergence
-   (see BasisLocalFunction::preEvaluateDivFunctions()), with the given
-   element @em orientation
-
-   @note
-   The returned Matrix is of size BasisLocalVector::getNFunction() @c x @c number @c of @c
-   PreEvaluated @c points
-
-   @note
-   If no PreEvaluation of the divergence has been done before calling this function,
-   an Exception is thrown
-   **
-
-   @fn BasisLocalVector::getPreEvaluatedFunctions(unsigned int) const
-   @param orientation A number definig the orientation of the reference space
-   @return Same as BasisLocalVector::getPreEvaluatedFunctions(const MElement&) const
-   but the orientation is not given by en element but by a number (@c orientation)
-   **
-
-   @fn BasisLocalVector::getPreEvaluatedCurlFunctions(unsigned int) const
-   @param orientation A number definig the orientation of the reference space
-   @return Same as BasisLocalVector::getPreEvaluatedCurlFunctions(const MElement&) const
-   but the orientation is not given by en element but by a number (@c orientation)
-   **
-
-   @fn BasisLocalVector::getPreEvaluatedDivFunctions(unsigned int) const
-   @param orientation A number definig the orientation of the reference space
-   @return Same as BasisLocalVector::getPreEvaluatedDivFunctions(const MElement&) const
-   but the orientation is not given by en element but by a number (@c orientation)
-*/
-
-#endif
diff --git a/FunctionSpace/CMakeLists.txt b/FunctionSpace/CMakeLists.txt
index 012f10ce8f..c2256639d3 100644
--- a/FunctionSpace/CMakeLists.txt
+++ b/FunctionSpace/CMakeLists.txt
@@ -13,11 +13,8 @@ set(SRC
   TetReferenceSpace.cpp
 
   Basis.cpp
-  BasisGenerator.cpp
-
   BasisLocal.cpp
-  BasisLocalScalar.cpp
-  BasisLocalVector.cpp
+  BasisGenerator.cpp
 
   BasisLagrange.cpp
   BasisHierarchicalScalar.cpp
@@ -40,7 +37,7 @@ set(SRC
 
   TetNodeBasis.cpp
   TetEdgeBasis.cpp
-  
+
   FunctionSpace.cpp
   FunctionSpaceScalar.cpp
   FunctionSpaceVector.cpp
@@ -48,7 +45,7 @@ set(SRC
   FunctionSpaceEdge.cpp
 )
 
-file(GLOB HDR RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.h) 
+file(GLOB HDR RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.h)
 append_gmsh_src(FunctionSpace "${SRC};${HDR}")
 
 ## Compatibility with SmallFEM (TO BE REMOVED !!!)
diff --git a/FunctionSpace/FunctionSpaceEdge.cpp b/FunctionSpace/FunctionSpaceEdge.cpp
index c1e46be70c..aedef910a2 100644
--- a/FunctionSpace/FunctionSpaceEdge.cpp
+++ b/FunctionSpace/FunctionSpaceEdge.cpp
@@ -1,6 +1,5 @@
 #include <vector>
 
-#include "BasisLocalVector.h"
 #include "Mapper.h"
 #include "FunctionSpaceEdge.h"
 
@@ -9,46 +8,42 @@ using namespace std;
 FunctionSpaceEdge::FunctionSpaceEdge(const GroupOfElement& goe,
 				     int order){
   // Build 1Form Basis //
-  build(goe, 1, order); 
-
-  // Init BasisVector //
-  localBasisVector = 
-    static_cast<const BasisLocalVector*>(localBasis);
+  build(goe, 1, order);
 }
-    
+
 FunctionSpaceEdge::~FunctionSpaceEdge(void){
 }
 
 fullVector<double> FunctionSpaceEdge::
-interpolate(const MElement& element, 
+interpolate(const MElement& element,
 	    const std::vector<double>& coef,
 	    const fullVector<double>& xyz) const{
 
   // Const Cast For MElement //
-  MElement& eelement = 
+  MElement& eelement =
     const_cast<MElement&>(element);
-  
+
   // Get Reference coordinate //
   double phys[3] = {xyz(0), xyz(1), xyz(2)};
   double uvw[3];
-  
+
   eelement.xyz2uvw(phys, uvw);
-  
+
   // Get Jacobian //
-  fullMatrix<double>  invJac(3, 3);        
+  fullMatrix<double>  invJac(3, 3);
   eelement.getJacobian(uvw[0], uvw[1], uvw[2], invJac);
   invJac.invertInPlace();
- 
+
   // Get Basis Functions //
-  fullMatrix<double>* fun = 
-    localBasisVector->getFunctions(element, uvw[0], uvw[1], uvw[2]);
+  fullMatrix<double>* fun =
+    localBasis->getFunctions(element, uvw[0], uvw[1], uvw[2]);
 
   const unsigned int nFun = fun->size1();
 
   // Interpolate (in Reference Place) //
-  fullVector<double> val(3); 
-  val(0) = 0; 
-  val(1) = 0; 
+  fullVector<double> val(3);
+  val(0) = 0;
+  val(1) = 0;
   val(2) = 0;
 
   for(unsigned int i = 0; i < nFun; i++){
@@ -63,30 +58,30 @@ interpolate(const MElement& element,
 }
 
 fullVector<double> FunctionSpaceEdge::
-interpolateInRefSpace(const MElement& element, 
+interpolateInRefSpace(const MElement& element,
 		      const std::vector<double>& coef,
 		      const fullVector<double>& uvw) const{
 
   // Const Cast For MElement //
-  MElement& eelement = 
+  MElement& eelement =
     const_cast<MElement&>(element);
-  
+
   // Get Jacobian //
-  fullMatrix<double>  invJac(3, 3);        
+  fullMatrix<double>  invJac(3, 3);
   eelement.getJacobian(uvw(0), uvw(1), uvw(2), invJac);
   invJac.invertInPlace();
 
-  // Get Basis Functions // 
-  fullMatrix<double>* fun = 
-    localBasisVector->getFunctions(element, uvw(0), uvw(1), uvw(2));
+  // Get Basis Functions //
+  fullMatrix<double>* fun =
+    localBasis->getFunctions(element, uvw(0), uvw(1), uvw(2));
 
   const unsigned int nFun = fun->size1();
 
 
   // Interpolate (in Reference Place) //
-  fullVector<double> val(3); 
-  val(0) = 0; 
-  val(1) = 0; 
+  fullVector<double> val(3);
+  val(0) = 0;
+  val(1) = 0;
   val(2) = 0;
 
   for(unsigned int i = 0; i < nFun; i++){
diff --git a/FunctionSpace/FunctionSpaceNode.cpp b/FunctionSpace/FunctionSpaceNode.cpp
index bcadfe3a2f..2f3c4a5335 100644
--- a/FunctionSpace/FunctionSpaceNode.cpp
+++ b/FunctionSpace/FunctionSpaceNode.cpp
@@ -1,6 +1,5 @@
 #include <vector>
 
-#include "BasisLocalScalar.h"
 #include "Mapper.h"
 #include "FunctionSpaceNode.h"
 
@@ -9,25 +8,21 @@ using namespace std;
 FunctionSpaceNode::FunctionSpaceNode(const GroupOfElement& goe,
 				     int order){
   // Build 0Form Basis //
-  build(goe, 0, order); 
-
-  // Init BasisScalar //
-  localBasisScalar = 
-    static_cast<const BasisLocalScalar*>(localBasis);
+  build(goe, 0, order);
 }
-    
+
 FunctionSpaceNode::~FunctionSpaceNode(void){
 }
 
 double FunctionSpaceNode::
-interpolate(const MElement& element, 
+interpolate(const MElement& element,
 	    const std::vector<double>& coef,
 	    const fullVector<double>& xyz) const{
-  
+
   // Const Cast For MElement //
-  MElement& eelement = 
+  MElement& eelement =
     const_cast<MElement&>(element);
-    
+
   // Get Reference coordinate //
   double phys[3] = {xyz(0), xyz(1), xyz(2)};
   double uvw[3];
@@ -35,13 +30,13 @@ interpolate(const MElement& element,
   eelement.xyz2uvw(phys, uvw);
 
   // Get Basis Functions //
-  fullMatrix<double>* fun = 
-    localBasisScalar->getFunctions(element, uvw[0], uvw[1], uvw[2]);
+  fullMatrix<double>* fun =
+    localBasis->getFunctions(element, uvw[0], uvw[1], uvw[2]);
 
   const unsigned int nFun = fun->size1();
 
   // Interpolate (in Reference Place) //
-  double val = 0; 
+  double val = 0;
 
   for(unsigned int i = 0; i < nFun; i++)
     val += (*fun)(i, 0) * coef[i];
@@ -52,18 +47,18 @@ interpolate(const MElement& element,
 }
 
 double FunctionSpaceNode::
-interpolateInRefSpace(const MElement& element, 
+interpolateInRefSpace(const MElement& element,
 		      const std::vector<double>& coef,
 		      const fullVector<double>& uvw) const{
 
   // Get Basis Functions //
-  fullMatrix<double>* fun = 
-    localBasisScalar->getFunctions(element, uvw(0), uvw(1), uvw(2));
+  fullMatrix<double>* fun =
+    localBasis->getFunctions(element, uvw(0), uvw(1), uvw(2));
 
   const unsigned int nFun = fun->size1();
-  
+
   // Interpolate (in Reference Place) //
-  double val = 0; 
+  double val = 0;
 
   for(unsigned int i = 0; i < nFun; i++)
     val += (*fun)(i, 0) * coef[i];
diff --git a/FunctionSpace/FunctionSpaceScalar.h b/FunctionSpace/FunctionSpaceScalar.h
index 3bd4f65797..7f2a9ad176 100644
--- a/FunctionSpace/FunctionSpaceScalar.h
+++ b/FunctionSpace/FunctionSpaceScalar.h
@@ -2,7 +2,6 @@
 #define _FUNCTIONSPACESCALAR_H_
 
 #include "Exception.h"
-#include "BasisLocalScalar.h"
 #include "FunctionSpace.h"
 
 /**
@@ -23,9 +22,6 @@
 
 
 class FunctionSpaceScalar : public FunctionSpace{
- protected:
-  const BasisLocalScalar* localBasisScalar;
-
  public:
   virtual ~FunctionSpaceScalar(void);
 
@@ -168,18 +164,18 @@ class FunctionSpaceScalar : public FunctionSpace{
 
 inline void FunctionSpaceScalar::
 preEvaluateLocalFunctions(const fullMatrix<double>& point) const{
-  localBasisScalar->preEvaluateFunctions(point);
+  localBasis->preEvaluateFunctions(point);
 }
 
 inline void FunctionSpaceScalar::
 preEvaluateGradLocalFunctions(const fullMatrix<double>& point) const{
-  localBasisScalar->preEvaluateGradFunctions(point);
+  localBasis->preEvaluateDerivatives(point);
 }
 
 inline const fullMatrix<double>&
 FunctionSpaceScalar::getEvaluatedLocalFunctions(const MElement& element) const{
   try{
-    return localBasisScalar->getPreEvaluatedFunctions(element);
+    return localBasis->getPreEvaluatedFunctions(element);
   }
 
   catch(Exception& any){
@@ -190,7 +186,7 @@ FunctionSpaceScalar::getEvaluatedLocalFunctions(const MElement& element) const{
 inline const fullMatrix<double>&
 FunctionSpaceScalar::getEvaluatedGradLocalFunctions(const MElement& element) const{
   try{
-    return localBasisScalar->getPreEvaluatedGradFunctions(element);
+    return localBasis->getPreEvaluatedDerivatives(element);
   }
 
   catch(Exception& any){
@@ -201,7 +197,7 @@ FunctionSpaceScalar::getEvaluatedGradLocalFunctions(const MElement& element) con
 inline const fullMatrix<double>&
 FunctionSpaceScalar::getEvaluatedLocalFunctions(unsigned int orientation) const{
   try{
-    return localBasisScalar->getPreEvaluatedFunctions(orientation);
+    return localBasis->getPreEvaluatedFunctions(orientation);
   }
 
   catch(Exception& any){
@@ -212,7 +208,7 @@ FunctionSpaceScalar::getEvaluatedLocalFunctions(unsigned int orientation) const{
 inline const fullMatrix<double>&
 FunctionSpaceScalar::getEvaluatedGradLocalFunctions(unsigned int orientation) const{
   try{
-    return localBasisScalar->getPreEvaluatedGradFunctions(orientation);
+    return localBasis->getPreEvaluatedDerivatives(orientation);
   }
 
   catch(Exception& any){
diff --git a/FunctionSpace/FunctionSpaceVector.h b/FunctionSpace/FunctionSpaceVector.h
index 838f30ee49..9bc3d0680e 100644
--- a/FunctionSpace/FunctionSpaceVector.h
+++ b/FunctionSpace/FunctionSpaceVector.h
@@ -2,7 +2,6 @@
 #define _FUNCTIONSPACEVECTOR_H_
 
 #include "Exception.h"
-#include "BasisLocalVector.h"
 #include "FunctionSpace.h"
 
 /**
@@ -23,9 +22,6 @@
 
 
 class FunctionSpaceVector : public FunctionSpace{
- protected:
-  const BasisLocalVector* localBasisVector;
-
  public:
   virtual ~FunctionSpaceVector(void);
 
@@ -205,23 +201,23 @@ class FunctionSpaceVector : public FunctionSpace{
 
 inline void FunctionSpaceVector::
 preEvaluateLocalFunctions(const fullMatrix<double>& point) const{
-  localBasisVector->preEvaluateFunctions(point);
+  localBasis->preEvaluateFunctions(point);
 }
 
 inline void FunctionSpaceVector::
 preEvaluateCurlLocalFunctions(const fullMatrix<double>& point) const{
-  localBasisVector->preEvaluateCurlFunctions(point);
+  localBasis->preEvaluateDerivatives(point);
 }
 
 inline void FunctionSpaceVector::
 preEvaluateDivLocalFunctions(const fullMatrix<double>& point) const{
-  localBasisVector->preEvaluateDivFunctions(point);
+  localBasis->preEvaluateDerivatives(point);
 }
 
 inline const fullMatrix<double>&
 FunctionSpaceVector::getEvaluatedLocalFunctions(const MElement& element) const{
   try{
-    return localBasisVector->getPreEvaluatedFunctions(element);
+    return localBasis->getPreEvaluatedFunctions(element);
   }
 
   catch(Exception& any){
@@ -232,7 +228,7 @@ FunctionSpaceVector::getEvaluatedLocalFunctions(const MElement& element) const{
 inline const fullMatrix<double>&
 FunctionSpaceVector::getEvaluatedCurlLocalFunctions(const MElement& element) const{
   try{
-    return localBasisVector->getPreEvaluatedCurlFunctions(element);
+    return localBasis->getPreEvaluatedDerivatives(element);
   }
 
   catch(Exception& any){
@@ -243,7 +239,7 @@ FunctionSpaceVector::getEvaluatedCurlLocalFunctions(const MElement& element) con
 inline const fullMatrix<double>&
 FunctionSpaceVector::getEvaluatedDivLocalFunctions(const MElement& element) const{
   try{
-    return localBasisVector->getPreEvaluatedFunctions(element);
+    return localBasis->getPreEvaluatedFunctions(element);
   }
 
   catch(Exception& any){
@@ -254,7 +250,7 @@ FunctionSpaceVector::getEvaluatedDivLocalFunctions(const MElement& element) cons
 inline const fullMatrix<double>&
 FunctionSpaceVector::getEvaluatedLocalFunctions(unsigned int orientation) const{
   try{
-    return localBasisVector->getPreEvaluatedFunctions(orientation);
+    return localBasis->getPreEvaluatedFunctions(orientation);
   }
 
   catch(Exception& any){
@@ -265,7 +261,7 @@ FunctionSpaceVector::getEvaluatedLocalFunctions(unsigned int orientation) const{
 inline const fullMatrix<double>&
 FunctionSpaceVector::getEvaluatedCurlLocalFunctions(unsigned int orientation) const{
   try{
-    return localBasisVector->getPreEvaluatedCurlFunctions(orientation);
+    return localBasis->getPreEvaluatedDerivatives(orientation);
   }
 
   catch(Exception& any){
@@ -276,7 +272,7 @@ FunctionSpaceVector::getEvaluatedCurlLocalFunctions(unsigned int orientation) co
 inline const fullMatrix<double>&
 FunctionSpaceVector::getEvaluatedDivLocalFunctions(unsigned int orientation) const{
   try{
-    return localBasisVector->getPreEvaluatedFunctions(orientation);
+    return localBasis->getPreEvaluatedFunctions(orientation);
   }
 
   catch(Exception& any){
-- 
GitLab