From 30954f8fd5e327a41b9caa8e2b9d321430b5d65c Mon Sep 17 00:00:00 2001
From: Nicolas Marsic <nicolas.marsic@gmail.com>
Date: Mon, 30 Jul 2012 09:51:44 +0000
Subject: [PATCH] Jacobian correction (??) + FunctionSpace & DofManager
 cooperation

---
 FunctionSpace/FunctionSpace.cpp |  8 +++++---
 FunctionSpace/FunctionSpace.h   | 28 +++++++++++++++++++++++++++-
 2 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/FunctionSpace/FunctionSpace.cpp b/FunctionSpace/FunctionSpace.cpp
index b3e0d44b8c..7276586ba7 100644
--- a/FunctionSpace/FunctionSpace.cpp
+++ b/FunctionSpace/FunctionSpace.cpp
@@ -5,14 +5,15 @@ using namespace std;
 
 FunctionSpace::FunctionSpace(const GroupOfElement& goe, int basisType, int order){
   // Save GroupOfElement //
-  this->goe = &goe;
+  this->goe = &goe;  
 
   // Look for 1st element to get element type //
   // (We suppose only one type of Mesh !!) //
   int elementType = goe.get(0).getType();
   
-  // Create Basis //
-  basis = BasisGenerator::generate(elementType, basisType, order);
+  // Init Struct //
+  basis  = BasisGenerator::generate(elementType, basisType, order);
+  eToGoD = new map<const MElement*, const GroupOfDof*, ElementComparator>;
 
   // Count Function per Entity //
   int nVertex = goe.get(0).getNumVertices();
@@ -37,5 +38,6 @@ FunctionSpace::FunctionSpace(const GroupOfElement& goe, int basisType, int order
 
 FunctionSpace::~FunctionSpace(void){
   delete basis;
+  delete eToGoD;
 }
 
diff --git a/FunctionSpace/FunctionSpace.h b/FunctionSpace/FunctionSpace.h
index df53bd51b2..2959221242 100644
--- a/FunctionSpace/FunctionSpace.h
+++ b/FunctionSpace/FunctionSpace.h
@@ -1,6 +1,11 @@
 #ifndef _FUNCTIONSPACE_H_
 #define _FUNCTIONSPACE_H_
 
+#include <map>
+
+#include "Dof.h"
+#include "GroupOfDof.h"
+
 #include "Basis.h"
 #include "GroupOfElement.h"
 #include "MElement.h"
@@ -13,14 +18,19 @@
 
     @todo 
     Hybrid Mesh@n
-    Put DofManager::dofFromElement here ??
 */
 
+class ElementComparator;
+
 class FunctionSpace{
  private:
+  friend class DofManager;
+
   const Basis* basis;
   const GroupOfElement* goe;
 
+  std::map<const MElement*, const GroupOfDof*, ElementComparator>* eToGoD;
+
   int fPerVertex;
   int fPerEdge;
   int fPerFace;
@@ -39,6 +49,14 @@ class FunctionSpace{
   int getNFunctionPerEdge(MElement& element) const;
   int getNFunctionPerFace(MElement& element) const;
   int getNFunctionPerCell(MElement& element) const;
+
+ private:
+  void associate(const MElement& element, const GroupOfDof& god);
+};
+
+class ElementComparator{
+ public:
+  bool operator()(const MElement* a, const MElement* b) const;
 };
 
 //////////////////////
@@ -69,4 +87,12 @@ inline int FunctionSpace::getNFunctionPerCell(MElement& element) const{
   return fPerCell;
 }
 
+inline void FunctionSpace::associate(const MElement& element, const GroupOfDof& god){
+  //return fPerCell;
+}
+
+inline bool ElementComparator::operator()(const MElement* a, const MElement* b) const{
+  return a->getNum() < b->getNum();
+}
+
 #endif
-- 
GitLab