diff --git a/AMDiS/src/parallel/FeSpaceMapping.cc b/AMDiS/src/parallel/FeSpaceMapping.cc
index 4167cc168c1297949be852556ddf74661a2e7c10..7daa9ef39a905ffc2913d6d354a4d564106ee287 100644
--- a/AMDiS/src/parallel/FeSpaceMapping.cc
+++ b/AMDiS/src/parallel/FeSpaceMapping.cc
@@ -102,4 +102,185 @@ namespace AMDiS {
       else
 	MSG("  %d -> %d  \n", it->first, it->second.local);
   }
+
+
+  void ParallelDofMapping::addFeSpace(const FiniteElemSpace* feSpace)
+  {
+    FUNCNAME("ParallelDofMapping::addFeSpace()");
+    
+    if (data.count(feSpace))
+      data.find(feSpace)->second.clear();
+    else
+      data.insert(make_pair(feSpace, GlobalDofMap(mpiComm)));
+    
+    data.find(feSpace)->second.setFeSpace(feSpace);
+  }    
+
+
+  int ParallelDofMapping::getRankDofs(vector<const FiniteElemSpace*> &fe)
+  {
+    FUNCNAME("ParallelDofMapping::getRankDofs()");
+    
+    int result = 0;
+    for (unsigned int i = 0; i < fe.size(); i++) {
+      TEST_EXIT_DBG(data.count(fe[i]))("Cannot find FE space: %p\n", fe[i]);
+      result += data[fe[i]].nRankDofs;
+    }
+    
+    return result;
+  }
+
+
+  int ParallelDofMapping::getLocalDofs(vector<const FiniteElemSpace*> &fe)
+  {
+    FUNCNAME("ParallelDofMapping::getLocalDofs()");
+    
+    int result = 0;
+    for (unsigned int i = 0; i < fe.size(); i++) {
+      TEST_EXIT_DBG(data.count(fe[i]))("Cannot find FE space: %p\n", fe[i]);
+      result += data[fe[i]].nLocalDofs;
+    }
+    
+    return result;
+  }
+
+
+  int ParallelDofMapping::getOverallDofs(vector<const FiniteElemSpace*> &feSpaces)
+  {
+    FUNCNAME("ParallelDofMapping::getOverallDofs()");
+
+    int result = 0;
+    for (unsigned int i = 0; i < feSpaces.size(); i++) {
+      TEST_EXIT_DBG(data.count(feSpaces[i]))("Should not happen!\n");
+      result += data.find(feSpaces[i])->second.nOverallDofs;
+    }
+    
+    return result;
+  }
+
+
+  int ParallelDofMapping::getStartDofs(vector<const FiniteElemSpace*> &feSpaces)
+  {
+    FUNCNAME("ParallelDofMapping::getStartDofs()");
+
+    int result = 0;
+    for (unsigned int i = 0; i < feSpaces.size(); i++) {
+      TEST_EXIT_DBG(data.count(feSpaces[i]))("Should not happen!\n");
+      result += data.find(feSpaces[i])->second.rStartDofs;
+    }
+    
+    return result;
+  }
+
+
+  void ParallelDofMapping::init(MPI::Intracomm *m,
+				vector<const FiniteElemSpace*> &fe,
+				bool needGlobalMapping,
+				bool bNonLocalDofs)
+  {
+    FUNCNAME("ParallelDofMapping::init()");
+
+    mpiComm = m;
+    feSpaces = fe;
+    hasNonLocalDofs = bNonLocalDofs;
+    for (unsigned int i = 0; i < feSpaces.size(); i++) {
+      feSpacesUnique.insert(feSpaces[i]);
+      
+      addFeSpace(feSpaces[i]);
+      data[feSpaces[i]].setNeedGlobalMapping(needGlobalMapping);
+      data[feSpaces[i]].setNonLocalDofs(hasNonLocalDofs);
+    }
+  }
+  
+
+  void ParallelDofMapping::update()
+  {
+    FUNCNAME("ParallelDofMapping::update()");
+
+    for (std::set<const FiniteElemSpace*>::iterator it = feSpacesUnique.begin();
+	 it != feSpacesUnique.end(); ++it)
+      data[*it].update();
+    
+    nRankDofs = getRankDofs(feSpaces);
+    nLocalDofs = getLocalDofs(feSpaces);
+    nOverallDofs = getOverallDofs(feSpaces);
+    rStartDofs = getStartDofs(feSpaces);
+    
+    computeMatIndex();
+  }
+  
+  
+  void ParallelDofMapping::computeMatIndex()
+  {
+    FUNCNAME("ParallelDofMapping::computeMatIndex()");
+    
+    dofToMatIndex.clear();
+    
+    int offset = rStartDofs;
+    
+    for (unsigned int i = 0; i < feSpaces.size(); i++) {
+      
+      map<DegreeOfFreedom, MultiIndex>& dofMap = data[feSpaces[i]].getMap();
+      typedef map<DegreeOfFreedom, MultiIndex>::iterator ItType;
+      for (ItType it = dofMap.begin(); it != dofMap.end(); ++it) {
+	if (data[feSpaces[i]].isRankDof(it->first)) {
+	  int globalMatIndex = it->second.local + offset;
+	  dofToMatIndex.add(i, it->first, globalMatIndex);
+	}
+      }
+      
+      offset += data[feSpaces[i]].nRankDofs;
+	
+      if (!hasNonLocalDofs)
+	continue;
+      
+      TEST_EXIT_DBG(sendDofs != NULL && recvDofs != NULL)
+	("No communicator given!\n");
+      
+      StdMpi<vector<DegreeOfFreedom> > stdMpi(*mpiComm);
+      for (DofComm::Iterator it(*sendDofs, feSpaces[i]); 
+	   !it.end(); it.nextRank()) {
+	vector<DegreeOfFreedom> sendGlobalDofs;
+	
+	for (; !it.endDofIter(); it.nextDof())
+	  if (dofMap.count(it.getDofIndex()))
+	    sendGlobalDofs.push_back(dofToMatIndex.get(i, it.getDofIndex()));
+	
+	stdMpi.send(it.getRank(), sendGlobalDofs);
+      }
+      
+      for (DofComm::Iterator it(*recvDofs, feSpaces[i]); 
+	   !it.end(); it.nextRank())
+	stdMpi.recv(it.getRank());
+      
+      stdMpi.startCommunication();
+      
+      {
+	for (DofComm::Iterator it(*recvDofs, feSpaces[i]); 
+	     !it.end(); it.nextRank()) {
+	  int counter = 0;
+	  for (; !it.endDofIter(); it.nextDof()) {
+	    if (dofMap.count(it.getDofIndex())) {
+	      DegreeOfFreedom d = stdMpi.getRecvData(it.getRank())[counter++];
+	      dofToMatIndex.add(i, it.getDofIndex(), d);
+	    }
+	  }
+	}
+      }
+    }
+  }
+  
+
+  void ParallelDofMapping::setDofComm(DofComm &pSend, DofComm &pRecv)
+  {
+    FUNCNAME("ParallelDofMapping::setDofComm()");
+
+    sendDofs = &pSend;
+    recvDofs = &pRecv;
+
+    for (std::set<const FiniteElemSpace*>::iterator it = feSpacesUnique.begin();
+	 it != feSpacesUnique.end(); ++it)
+      data[*it].setDofComm(pSend, pRecv);
+  }
+  
 }
diff --git a/AMDiS/src/parallel/FeSpaceMapping.h b/AMDiS/src/parallel/FeSpaceMapping.h
index 88e8762e6e6551b9b0765ed7b5934be87fc1cd50..333dd6a2514777cfce152a5dd80e7385dca2af35 100644
--- a/AMDiS/src/parallel/FeSpaceMapping.h
+++ b/AMDiS/src/parallel/FeSpaceMapping.h
@@ -216,11 +216,10 @@ namespace AMDiS {
   };
   
 
-  template<typename T>
-  class FeSpaceData
+  class ParallelDofMapping
   {
   public:
-    FeSpaceData() 
+    ParallelDofMapping() 
       : mpiComm(NULL),
 	sendDofs(NULL),
 	recvDofs(NULL),
@@ -231,39 +230,18 @@ namespace AMDiS {
 	rStartDofs(-1)
     {} 
 
-    T& operator[](const FiniteElemSpace* feSpace)
+    inline GlobalDofMap& operator[](const FiniteElemSpace* feSpace)
     {
-      FUNCNAME("FeSpaceData::operator[]()");
+      FUNCNAME("ParallelDofMapping::operator[]()");
 
       TEST_EXIT_DBG(data.count(feSpace))("Should not happen!\n");
 
       return data.find(feSpace)->second;
     }
 
-    void addFeSpace(const FiniteElemSpace* feSpace)
-    {
-      FUNCNAME("FeSpaceData::addFeSpace()");
-      
-      if (data.count(feSpace))
-	data.find(feSpace)->second.clear();
-      else
-	data.insert(make_pair(feSpace, T(mpiComm)));
-
-      data.find(feSpace)->second.setFeSpace(feSpace);
-    }    
-
-    int getRankDofs(vector<const FiniteElemSpace*> &fe)
-    {
-      FUNCNAME("FeSpaceData::getRankDofs()");
+    void addFeSpace(const FiniteElemSpace* feSpace);
 
-      int result = 0;
-      for (unsigned int i = 0; i < fe.size(); i++) {
-	TEST_EXIT_DBG(data.count(fe[i]))("Cannot find FE space: %p\n", fe[i]);
-	result += data[fe[i]].nRankDofs;
-      }
-
-      return result;
-    }
+    int getRankDofs(vector<const FiniteElemSpace*> &fe);
 
     inline int getRankDofs()
     {
@@ -272,18 +250,7 @@ namespace AMDiS {
       return nRankDofs;
     }
 
-    int getLocalDofs(vector<const FiniteElemSpace*> &fe)
-    {
-      FUNCNAME("FeSpaceData::getLocalDofs()");
-
-      int result = 0;
-      for (unsigned int i = 0; i < fe.size(); i++) {
-	TEST_EXIT_DBG(data.count(fe[i]))("Cannot find FE space: %p\n", fe[i]);
-	result += data[fe[i]].nLocalDofs;
-      }
-
-      return result;
-    }
+    int getLocalDofs(vector<const FiniteElemSpace*> &fe);
 
     inline int getLocalDofs()
     {
@@ -292,16 +259,7 @@ namespace AMDiS {
       return nLocalDofs;
     }
 
-    int getOverallDofs(vector<const FiniteElemSpace*> &feSpaces)
-    {
-      int result = 0;
-      for (unsigned int i = 0; i < feSpaces.size(); i++) {
-	TEST_EXIT_DBG(data.count(feSpaces[i]))("Should not happen!\n");
-	result += data.find(feSpaces[i])->second.nOverallDofs;
-      }
-
-      return result;
-    }
+    int getOverallDofs(vector<const FiniteElemSpace*> &feSpaces);
 
     inline int getOverallDofs()
     {
@@ -310,18 +268,9 @@ namespace AMDiS {
       return nOverallDofs;
     }
 
-    int getStartDofs(vector<const FiniteElemSpace*> &feSpaces)
-    {
-      int result = 0;
-      for (unsigned int i = 0; i < feSpaces.size(); i++) {
-	TEST_EXIT_DBG(data.count(feSpaces[i]))("Should not happen!\n");
-	result += data.find(feSpaces[i])->second.rStartDofs;
-      }
-
-      return result;
-    }
+    int getStartDofs(vector<const FiniteElemSpace*> &feSpaces);
 
-    int getStartDofs()
+    inline int getStartDofs()
     {
       TEST_EXIT_DBG(rStartDofs >= 0)("Should not happen!\n");
 
@@ -331,102 +280,13 @@ namespace AMDiS {
     void init(MPI::Intracomm *m,
 	      vector<const FiniteElemSpace*> &fe,
 	      bool needGlobalMapping,
-	      bool bNonLocalDofs)
-    {
-      mpiComm = m;
-      feSpaces = fe;
-      hasNonLocalDofs = bNonLocalDofs;
-      for (unsigned int i = 0; i < feSpaces.size(); i++) {
-	feSpacesUnique.insert(feSpaces[i]);
-	
-	addFeSpace(feSpaces[i]);
-	data[feSpaces[i]].setNeedGlobalMapping(needGlobalMapping);
-	data[feSpaces[i]].setNonLocalDofs(hasNonLocalDofs);
-      }
-    }
-
-    void update()
-    {
-      for (std::set<const FiniteElemSpace*>::iterator it = feSpacesUnique.begin();
-	   it != feSpacesUnique.end(); ++it)
-	data[*it].update();
-
-      nRankDofs = getRankDofs(feSpaces);
-      nLocalDofs = getLocalDofs(feSpaces);
-      nOverallDofs = getOverallDofs(feSpaces);
-      rStartDofs = getStartDofs(feSpaces);
-
-      computeMatIndex();
-    }
-
+	      bool bNonLocalDofs);
 
-    void computeMatIndex()
-    {
-      dofToMatIndex.clear();
-
-      int offset = rStartDofs;
-
-      for (unsigned int i = 0; i < feSpaces.size(); i++) {
-
-	map<DegreeOfFreedom, MultiIndex>& dofMap = data[feSpaces[i]].getMap();
-	typedef map<DegreeOfFreedom, MultiIndex>::iterator ItType;
-	for (ItType it = dofMap.begin(); it != dofMap.end(); ++it) {
-	  if (data[feSpaces[i]].isRankDof(it->first)) {
- 	    int globalMatIndex = it->second.local + offset;
-	    dofToMatIndex.add(i, it->first, globalMatIndex);
-	  }
-	}
-
-	offset += data[feSpaces[i]].nRankDofs;
-	
-	if (!hasNonLocalDofs)
-	  continue;
-	
-	TEST_EXIT_DBG(sendDofs != NULL && recvDofs != NULL)
-	  ("No communicator given!\n");
-	
-	StdMpi<vector<DegreeOfFreedom> > stdMpi(*mpiComm);
-	for (DofComm::Iterator it(*sendDofs, feSpaces[i]); 
-	     !it.end(); it.nextRank()) {
-	  vector<DegreeOfFreedom> sendGlobalDofs;
-	  
-	  for (; !it.endDofIter(); it.nextDof())
-	    if (dofMap.count(it.getDofIndex()))
-	      sendGlobalDofs.push_back(dofToMatIndex.get(i, it.getDofIndex()));
-	  
-	  stdMpi.send(it.getRank(), sendGlobalDofs);
-	}
-	
-	for (DofComm::Iterator it(*recvDofs, feSpaces[i]); 
-	     !it.end(); it.nextRank())
-	  stdMpi.recv(it.getRank());
-	
-	stdMpi.startCommunication();
-	
-	{
-	  for (DofComm::Iterator it(*recvDofs, feSpaces[i]); 
-	       !it.end(); it.nextRank()) {
-	    int counter = 0;
-	    for (; !it.endDofIter(); it.nextDof()) {
-	      if (dofMap.count(it.getDofIndex())) {
-		DegreeOfFreedom d = stdMpi.getRecvData(it.getRank())[counter++];
-		dofToMatIndex.add(i, it.getDofIndex(), d);
-	      }
-	    }
-	  }
-	}
-      }
-    }
+    void update();
 
-    void setDofComm(DofComm &pSend, DofComm &pRecv)
-    {
-      sendDofs = &pSend;
-      recvDofs = &pRecv;
+    void computeMatIndex();
 
-      for (std::set<const FiniteElemSpace*>::iterator it = feSpacesUnique.begin();
-	   it != feSpacesUnique.end(); ++it)
-	data[*it].setDofComm(pSend, pRecv);
-    }
+    void setDofComm(DofComm &pSend, DofComm &pRecv);
 
     inline int getMatIndex(int ithComponent, DegreeOfFreedom d)
     {
@@ -435,7 +295,7 @@ namespace AMDiS {
 
     inline int getLocalMatIndex(int ithComponent, DegreeOfFreedom d)
     {
-      FUNCNAME("FeSpaceData::getLocalMatIndex()");
+      FUNCNAME("ParallelDofMapping::getLocalMatIndex()");
 
       TEST_EXIT_DBG(data[feSpaces[ithComponent]].isRankDof(d))
 	("Should not happen!\n");
@@ -455,7 +315,7 @@ namespace AMDiS {
     /// are also owned by this rank.
     bool hasNonLocalDofs;
     
-    map<const FiniteElemSpace*, T> data;
+    map<const FiniteElemSpace*, GlobalDofMap> data;
 
     vector<const FiniteElemSpace*> feSpaces;
 
diff --git a/AMDiS/src/parallel/MeshDistributor.cc b/AMDiS/src/parallel/MeshDistributor.cc
index 51e052e1c9ceb0412a0af2bce7675683de1c7762..452543424c4bb669a5c46c47734a7ea15513f035 100644
--- a/AMDiS/src/parallel/MeshDistributor.cc
+++ b/AMDiS/src/parallel/MeshDistributor.cc
@@ -2287,7 +2287,7 @@ namespace AMDiS {
 
     TEST_EXIT_DBG(dofFeData.count(feSpace))("Should not happen!\n");
 
-    for (DofMapping::iterator it = dofFeData[feSpace].mapDofToGlobal.begin();
+    for (DofMap::iterator it = dofFeData[feSpace].mapDofToGlobal.begin();
 	 it != dofFeData[feSpace].mapDofToGlobal.end(); ++it) 
       if (it->second == dof)
 	return it->first;
diff --git a/AMDiS/src/parallel/MeshDistributor.h b/AMDiS/src/parallel/MeshDistributor.h
index 366680ed55e5a45b562e2c18863c52996b5ffc63..49c79d5da4a16453e3fe455a42a2fdbe0151a93d 100644
--- a/AMDiS/src/parallel/MeshDistributor.h
+++ b/AMDiS/src/parallel/MeshDistributor.h
@@ -70,10 +70,10 @@ namespace AMDiS {
     DofIndexToBool isRankDof;
 
     /// Maps local to global dof indices.
-    DofMapping mapDofToGlobal;
+    DofMap mapDofToGlobal;
 
     /// Maps local dof indices to real dof indices.
-    DofMapping mapLocalToDof;
+    DofMap mapLocalToDof;
   };
 
 
@@ -271,7 +271,7 @@ namespace AMDiS {
       return result;
     }
 
-    inline DofMapping& getMapDofToGlobal(const FiniteElemSpace *feSpace)
+    inline DofMap& getMapDofToGlobal(const FiniteElemSpace *feSpace)
     {
       FUNCNAME("MeshDistributor::getMapDofToGlobal()");
 
diff --git a/AMDiS/src/parallel/ParallelDebug.cc b/AMDiS/src/parallel/ParallelDebug.cc
index 94e2a4ae2f25092b56be880292b1188f314d513a..2e24631771b40ebddb4db8d6e85810049c3c0ac9 100644
--- a/AMDiS/src/parallel/ParallelDebug.cc
+++ b/AMDiS/src/parallel/ParallelDebug.cc
@@ -203,7 +203,7 @@ namespace AMDiS {
 	
 	for (PeriodicDofMap::iterator it = otherMap.begin(); 
 	     it != otherMap.end(); ++it) {
-	  for (DofMapping::iterator dofIt = it->second.begin();
+	  for (DofMap::iterator dofIt = it->second.begin();
 	       dofIt != it->second.end(); ++dofIt) {
 	    if (dofMap.count(it->first) == 1 &&
 		dofMap[it->first].count(dofIt->first) == 1) {
@@ -222,7 +222,7 @@ namespace AMDiS {
 
       for (PeriodicDofMap::iterator it = dofMap.begin(); 
 	   it != dofMap.end(); ++it) {
-	for (DofMapping::iterator dofIt = it->second.begin();
+	for (DofMap::iterator dofIt = it->second.begin();
 	     dofIt != it->second.end(); ++dofIt) {
 	  if (it->second[dofIt->second] != dofIt->first) {
 	    MSG("[DBG]  For boundary type %d: DOF %d -> %d, but %d -> %d!\n",
@@ -646,7 +646,7 @@ namespace AMDiS {
 
       cout << "====== DOF MAP LOCAL -> GLOBAL ====== " << endl;
       
-      for (DofMapping::iterator it = pdb.dofFeData[feSpace].mapDofToGlobal.begin();
+      for (DofMap::iterator it = pdb.dofFeData[feSpace].mapDofToGlobal.begin();
 	   it != pdb.dofFeData[feSpace].mapDofToGlobal.end(); it++) {
 	DegreeOfFreedom localdof = -1;
 	if (pdb.dofFeData[feSpace].mapLocalToDof.count(it->first) > 0)
@@ -686,7 +686,7 @@ namespace AMDiS {
 
     const FiniteElemSpace* feSpace = pdb.feSpaces[0];
 
-    typedef map<DegreeOfFreedom, DegreeOfFreedom> DofMapping;
+    typedef map<DegreeOfFreedom, DegreeOfFreedom> DofMap;
     typedef map<DegreeOfFreedom, std::set<DegreeOfFreedom> > PeriodicDofMap;
 
     if (rank == -1 || pdb.mpiRank == rank) {
@@ -701,7 +701,7 @@ namespace AMDiS {
 	cout << endl;
 
 	DegreeOfFreedom localdof = -1;
-	for (DofMapping::iterator dofIt = pdb.dofFeData[feSpace].mapDofToGlobal.begin();
+	for (DofMap::iterator dofIt = pdb.dofFeData[feSpace].mapDofToGlobal.begin();
 	     dofIt != pdb.dofFeData[feSpace].mapDofToGlobal.end(); ++dofIt)
 	  if (dofIt->second == it->first)
 	    localdof = dofIt->first;
diff --git a/AMDiS/src/parallel/ParallelTypes.h b/AMDiS/src/parallel/ParallelTypes.h
index 4f85959ce920df8ab7bbfa8c87da449595c257b4..a0f3dba4488efe42a409d905a3f0faf18829f728 100644
--- a/AMDiS/src/parallel/ParallelTypes.h
+++ b/AMDiS/src/parallel/ParallelTypes.h
@@ -49,7 +49,7 @@ namespace AMDiS {
   typedef map<int, DofContainer> RankToDofContainer;
   
   /// Defines a mapping type from DOF indices to DOF indices.
-  typedef map<DegreeOfFreedom, DegreeOfFreedom> DofMapping;
+  typedef map<DegreeOfFreedom, DegreeOfFreedom> DofMap;
   
   /// Defines a mapping type from DOFs to boolean values.
   typedef map<const DegreeOfFreedom*, bool> DofToBool;
diff --git a/AMDiS/src/parallel/PeriodicMap.cc b/AMDiS/src/parallel/PeriodicMap.cc
index 8d7af1502d2b6e16b2f411e7cef82c3594a5b320..31636ce06cf155fb0c919b65e482884e94c3d741 100644
--- a/AMDiS/src/parallel/PeriodicMap.cc
+++ b/AMDiS/src/parallel/PeriodicMap.cc
@@ -21,7 +21,7 @@ namespace AMDiS {
     FUNCNAME("PeriodicMap::add()");
     
     for (PeriodicDofMap::iterator it = newMap.begin(); it != newMap.end(); ++it)
-      for (DofMapping::iterator dofIt =it->second.begin();
+      for (DofMap::iterator dofIt =it->second.begin();
 	   dofIt != it->second.end(); ++dofIt)
 	add(feSpace, it->first, dofIt->second, dofIt->first);
   }
@@ -64,7 +64,7 @@ namespace AMDiS {
     
     for (PeriodicDofMap::iterator it = data.begin(); it != data.end(); ++it) {
       int type = it->first;
-      DofMapping dofMap = it->second;
+      DofMap dofMap = it->second;
       
       SerUtil::serialize(out, type);
       SerUtil::serialize(out, dofMap);
@@ -97,7 +97,7 @@ namespace AMDiS {
     
     for (int i = 0; i < mapSize; i++) {
       int type;
-      DofMapping dofMap;
+      DofMap dofMap;
       
       SerUtil::deserialize(in, type);
       SerUtil::deserialize(in, dofMap);
diff --git a/AMDiS/src/parallel/PeriodicMap.h b/AMDiS/src/parallel/PeriodicMap.h
index 3de25ffeec28694814d4c773f06cd26aa61d6d53..11da11dab7c2ac0c5c93790870fc5761c88bc7a3 100644
--- a/AMDiS/src/parallel/PeriodicMap.h
+++ b/AMDiS/src/parallel/PeriodicMap.h
@@ -34,7 +34,7 @@ namespace AMDiS {
 
   /// Maps a boundary type, i.e., a boundary identifier index, to a periodic 
   /// DOF mapping. 
-  typedef std::map<BoundaryType, DofMapping> PeriodicDofMap;
+  typedef std::map<BoundaryType, DofMap> PeriodicDofMap;
   
   /// Different FE spaces may have different DOFs on the same mesh. Thus we
   /// need to have a periodic DOF mapping for each FE space.
diff --git a/AMDiS/src/parallel/PetscSolverFeti.cc b/AMDiS/src/parallel/PetscSolverFeti.cc
index 5db733dce6148737664914f61b6e358f13187906..f2afc4f005545f4d16f2844a4c53c35b61eacb13 100644
--- a/AMDiS/src/parallel/PetscSolverFeti.cc
+++ b/AMDiS/src/parallel/PetscSolverFeti.cc
@@ -150,8 +150,9 @@ namespace AMDiS {
     VecGetArray(data->tmp_vec_b, &local_b);
     VecGetArray(data->tmp_vec_duals0, &local_duals);
 
-    for (int i = nLocalB - nLocalDuals, j = 0; i < nLocalB; i++, j++)
-      local_duals[j] = local_b[i];
+    for (map<int, int>::iterator it = data->localToDualMap.begin();
+	 it != data->localToDualMap.end(); ++it)
+      local_duals[it->second] = local_b[it->first];
 
     VecRestoreArray(data->tmp_vec_b, &local_b);
     VecRestoreArray(data->tmp_vec_duals0, &local_duals);
@@ -167,8 +168,9 @@ namespace AMDiS {
     VecGetArray(data->tmp_vec_b, &local_b);
     VecGetArray(data->tmp_vec_duals1, &local_duals);
 
-    for (int i = nLocalB - nLocalDuals, j = 0; i < nLocalB; i++, j++)
-      local_b[i] = local_duals[j];
+    for (map<int, int>::iterator it = data->localToDualMap.begin();
+	 it != data->localToDualMap.end(); ++it)
+      local_b[it->first] = local_duals[it->second];
 
     VecRestoreArray(data->tmp_vec_b, &local_b);
     VecRestoreArray(data->tmp_vec_duals0, &local_duals);
@@ -700,6 +702,18 @@ namespace AMDiS {
       fetiLumpedPreconData.mat_lagrange_scaled = &mat_lagrange_scaled;
       fetiLumpedPreconData.mat_duals_duals = &mat_duals_duals;
 
+      for (unsigned int i = 0; i < feSpaces.size(); i++) {
+	map<DegreeOfFreedom, MultiIndex> &dualMap = 
+	  dualDofMap[feSpaces[i]].getMap();
+	for (map<DegreeOfFreedom, MultiIndex>::iterator it = dualMap.begin(); 
+	     it != dualMap.end(); ++it) {
+	  DegreeOfFreedom d = it->first;
+	  int matIndexLocal = localDofMap.getLocalMatIndex(i, d);
+	  int matIndexDual = dualDofMap.getLocalMatIndex(i, d);
+	  fetiLumpedPreconData.localToDualMap[matIndexLocal] = matIndexDual;
+	}
+      }
+
       VecCreateMPI(PETSC_COMM_WORLD, 
 		   localDofMap.getRankDofs(),
 		   localDofMap.getOverallDofs(),
@@ -1104,7 +1118,7 @@ namespace AMDiS {
 		int rowIndex = dualDofMap.getLocalMatIndex(i, *cursor);		
 		MatSetValues(mat_duals_duals, 1, &rowIndex, colsLocal.size(),
 			     &(colsLocal[0]), &(valuesLocal[0]), INSERT_VALUES);
-	      }		
+	      }			
 	      break;
 	    default:
 	      break;
diff --git a/AMDiS/src/parallel/PetscSolverFeti.h b/AMDiS/src/parallel/PetscSolverFeti.h
index 3d02e9e563bdaf43c7d34df4121bd4843ac396b5..1855eabd1bca8511d608ece7dee2eb45e3892744 100644
--- a/AMDiS/src/parallel/PetscSolverFeti.h
+++ b/AMDiS/src/parallel/PetscSolverFeti.h
@@ -158,21 +158,21 @@ namespace AMDiS {
 
   protected:
     /// Mapping from primal DOF indices to a global index of primals.
-    FeSpaceData<GlobalDofMap> primalDofMap;
+    ParallelDofMapping primalDofMap;
 
     /// Mapping from dual DOF indices to a global index of duals.
-    FeSpaceData<GlobalDofMap> dualDofMap;
+    ParallelDofMapping dualDofMap;
 
     /// Stores to each dual DOF index the index of the first Lagrange
     /// constraint that is assigned to this DOF.
-    FeSpaceData<GlobalDofMap> lagrangeMap;
+    ParallelDofMapping lagrangeMap;
     
     /// Index for each non primal DOF to the global index of B variables.
-    FeSpaceData<GlobalDofMap> localDofMap;
+    ParallelDofMapping localDofMap;
 
     /// Mapping of pure local DOF indices, thus no primal and no dual DOFs are
     /// in this map. Is used for the Dirichlet preconditioner only.
-    FeSpaceData<GlobalDofMap> interiorDofMap;
+    ParallelDofMapping interiorDofMap;
 
     /// Stores to each dual boundary DOF in each finite elment space the set of
     /// ranks in which the DOF is contained in.
diff --git a/AMDiS/src/parallel/PetscSolverFetiStructs.h b/AMDiS/src/parallel/PetscSolverFetiStructs.h
index adc44ac54e85c0650ad83da713ac5aea642de24e..8132d1727ffa70f9593955eb2ac20d6ee528b52d 100644
--- a/AMDiS/src/parallel/PetscSolverFetiStructs.h
+++ b/AMDiS/src/parallel/PetscSolverFetiStructs.h
@@ -113,6 +113,8 @@ namespace AMDiS {
 
     /// Temporal vector on the dual variables.
     Vec tmp_vec_duals0, tmp_vec_duals1;
+
+    map<int, int> localToDualMap;
   };